@almadar/ui 2.15.13 → 2.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/avl/index.cjs +1927 -0
  2. package/dist/avl/index.d.cts +314 -0
  3. package/dist/avl/index.d.ts +33 -0
  4. package/dist/avl/index.js +1891 -0
  5. package/dist/components/atoms/avl/AvlApplication.d.ts +8 -0
  6. package/dist/components/atoms/avl/AvlBinding.d.ts +12 -0
  7. package/dist/components/atoms/avl/AvlBindingRef.d.ts +7 -0
  8. package/dist/components/atoms/avl/AvlEffect.d.ts +8 -0
  9. package/dist/components/atoms/avl/AvlEntity.d.ts +9 -0
  10. package/dist/components/atoms/avl/AvlEvent.d.ts +7 -0
  11. package/dist/components/atoms/avl/AvlField.d.ts +10 -0
  12. package/dist/components/atoms/avl/AvlFieldType.d.ts +8 -0
  13. package/dist/components/atoms/avl/AvlGuard.d.ts +7 -0
  14. package/dist/components/atoms/avl/AvlLiteral.d.ts +7 -0
  15. package/dist/components/atoms/avl/AvlOperator.d.ts +8 -0
  16. package/dist/components/atoms/avl/AvlOrbital.d.ts +11 -0
  17. package/dist/components/atoms/avl/AvlPage.d.ts +7 -0
  18. package/dist/components/atoms/avl/AvlPersistence.d.ts +8 -0
  19. package/dist/components/atoms/avl/AvlSExpr.d.ts +8 -0
  20. package/dist/components/atoms/avl/AvlState.d.ts +10 -0
  21. package/dist/components/atoms/avl/AvlTrait.d.ts +13 -0
  22. package/dist/components/atoms/avl/AvlTransition.d.ts +18 -0
  23. package/dist/components/atoms/avl/index.d.ts +20 -0
  24. package/dist/components/atoms/avl/types.d.ts +19 -0
  25. package/dist/components/index.cjs +131 -2411
  26. package/dist/components/index.css +0 -508
  27. package/dist/components/index.js +132 -2411
  28. package/dist/components/molecules/avl/AvlClosedCircuit.d.ts +20 -0
  29. package/dist/components/molecules/avl/AvlEmitListen.d.ts +16 -0
  30. package/dist/components/molecules/avl/AvlExprTree.d.ts +13 -0
  31. package/dist/components/molecules/avl/AvlOrbitalUnit.d.ts +20 -0
  32. package/dist/components/molecules/avl/AvlSlotMap.d.ts +18 -0
  33. package/dist/components/molecules/avl/AvlStateMachine.d.ts +22 -0
  34. package/dist/components/molecules/avl/avl-layout.d.ts +32 -0
  35. package/dist/components/molecules/avl/index.d.ts +7 -0
  36. package/dist/components/organisms/component-registry.generated.d.ts +1 -1
  37. package/dist/components/organisms/game/three/index.cjs +1067 -0
  38. package/dist/components/organisms/game/three/index.css +192 -0
  39. package/dist/components/organisms/game/three/index.d.ts +4 -0
  40. package/dist/components/organisms/game/three/index.js +1068 -5
  41. package/dist/illustrations/index.cjs +1879 -20
  42. package/dist/illustrations/index.d.cts +277 -1
  43. package/dist/illustrations/index.d.ts +24 -0
  44. package/dist/illustrations/index.js +1855 -20
  45. package/dist/providers/index.cjs +152 -1521
  46. package/dist/providers/index.css +0 -508
  47. package/dist/providers/index.js +62 -1430
  48. package/dist/runtime/index.cjs +145 -1514
  49. package/dist/runtime/index.css +0 -508
  50. package/dist/runtime/index.js +63 -1431
  51. package/package.json +6 -1
@@ -0,0 +1,1891 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import React6 from 'react';
3
+
4
+ // components/atoms/avl/types.ts
5
+ var AVL_OPERATOR_COLORS = {
6
+ arithmetic: "#4A90D9",
7
+ comparison: "#E8913A",
8
+ logic: "#9B59B6",
9
+ string: "#27AE60",
10
+ collection: "#1ABC9C",
11
+ time: "#F39C12",
12
+ control: "#E74C3C",
13
+ async: "#E91E8F"
14
+ };
15
+ var AVL_FIELD_TYPE_SHAPES = {
16
+ string: "circle",
17
+ number: "triangle",
18
+ boolean: "square",
19
+ date: "diamond",
20
+ enum: "ring",
21
+ object: "hexagon",
22
+ array: "bars"
23
+ };
24
+ var AvlOrbital = ({
25
+ cx = 0,
26
+ cy = 0,
27
+ r = 80,
28
+ label,
29
+ color = "var(--color-primary)",
30
+ opacity = 1,
31
+ className
32
+ }) => {
33
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
34
+ /* @__PURE__ */ jsx(
35
+ "circle",
36
+ {
37
+ cx,
38
+ cy,
39
+ r,
40
+ fill: "none",
41
+ stroke: color,
42
+ strokeWidth: 2
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(
46
+ "circle",
47
+ {
48
+ cx,
49
+ cy,
50
+ r,
51
+ fill: color,
52
+ opacity: 0.03
53
+ }
54
+ ),
55
+ label && /* @__PURE__ */ jsx(
56
+ "text",
57
+ {
58
+ x: cx,
59
+ y: cy - r - 8,
60
+ textAnchor: "middle",
61
+ fill: color,
62
+ fontSize: 11,
63
+ fontFamily: "inherit",
64
+ fontWeight: "bold",
65
+ children: label
66
+ }
67
+ )
68
+ ] });
69
+ };
70
+ AvlOrbital.displayName = "AvlOrbital";
71
+ function persistenceStroke(kind) {
72
+ switch (kind) {
73
+ case "persistent":
74
+ return { strokeWidth: 2.5 };
75
+ case "runtime":
76
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
77
+ case "singleton":
78
+ return { strokeWidth: 3.5 };
79
+ case "instance":
80
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
81
+ }
82
+ }
83
+ var AvlEntity = ({
84
+ x = 0,
85
+ y = 0,
86
+ r = 18,
87
+ fieldCount = 0,
88
+ persistence = "persistent",
89
+ label,
90
+ color = "var(--color-primary)",
91
+ opacity = 1,
92
+ className
93
+ }) => {
94
+ const strokeProps = persistenceStroke(persistence);
95
+ const facets = Array.from({ length: fieldCount }, (_, i) => {
96
+ const angle = Math.PI * 2 * i / fieldCount - Math.PI / 2;
97
+ const innerR = r + 2;
98
+ const outerR = r + 10;
99
+ return {
100
+ x1: x + innerR * Math.cos(angle),
101
+ y1: y + innerR * Math.sin(angle),
102
+ x2: x + outerR * Math.cos(angle),
103
+ y2: y + outerR * Math.sin(angle)
104
+ };
105
+ });
106
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
107
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r, fill: color, opacity: 0.15 }),
108
+ /* @__PURE__ */ jsx(
109
+ "circle",
110
+ {
111
+ cx: x,
112
+ cy: y,
113
+ r,
114
+ fill: "none",
115
+ stroke: color,
116
+ strokeWidth: strokeProps.strokeWidth,
117
+ strokeDasharray: strokeProps.strokeDasharray
118
+ }
119
+ ),
120
+ persistence === "singleton" && /* @__PURE__ */ jsx(
121
+ "circle",
122
+ {
123
+ cx: x,
124
+ cy: y,
125
+ r: r - 4,
126
+ fill: "none",
127
+ stroke: color,
128
+ strokeWidth: 1.5
129
+ }
130
+ ),
131
+ facets.map((f, i) => /* @__PURE__ */ jsx(
132
+ "line",
133
+ {
134
+ x1: f.x1,
135
+ y1: f.y1,
136
+ x2: f.x2,
137
+ y2: f.y2,
138
+ stroke: color,
139
+ strokeWidth: 1,
140
+ opacity: 0.6
141
+ },
142
+ i
143
+ )),
144
+ label && /* @__PURE__ */ jsx(
145
+ "text",
146
+ {
147
+ x,
148
+ y: y + r + (fieldCount > 0 ? 18 : 14),
149
+ textAnchor: "middle",
150
+ fill: color,
151
+ fontSize: 10,
152
+ fontFamily: "inherit",
153
+ fontWeight: "bold",
154
+ children: label
155
+ }
156
+ )
157
+ ] });
158
+ };
159
+ AvlEntity.displayName = "AvlEntity";
160
+ var AvlTrait = ({
161
+ cx = 0,
162
+ cy = 0,
163
+ rx = 60,
164
+ ry = 30,
165
+ rotation = 0,
166
+ label,
167
+ color = "var(--color-primary)",
168
+ opacity = 1,
169
+ className
170
+ }) => {
171
+ return /* @__PURE__ */ jsxs("g", { className, opacity, transform: `rotate(${rotation},${cx},${cy})`, children: [
172
+ /* @__PURE__ */ jsx(
173
+ "ellipse",
174
+ {
175
+ cx,
176
+ cy,
177
+ rx,
178
+ ry,
179
+ fill: "none",
180
+ stroke: color,
181
+ strokeWidth: 1.5,
182
+ strokeDasharray: "4 2"
183
+ }
184
+ ),
185
+ label && /* @__PURE__ */ jsx(
186
+ "text",
187
+ {
188
+ x: cx - rx - 6,
189
+ y: cy,
190
+ textAnchor: "end",
191
+ dominantBaseline: "central",
192
+ fill: color,
193
+ fontSize: 9,
194
+ fontFamily: "inherit",
195
+ opacity: 0.8,
196
+ transform: `rotate(${-rotation},${cx - rx - 6},${cy})`,
197
+ children: label
198
+ }
199
+ )
200
+ ] });
201
+ };
202
+ AvlTrait.displayName = "AvlTrait";
203
+ var AvlPage = ({
204
+ x = 0,
205
+ y = 0,
206
+ size = 12,
207
+ label,
208
+ color = "var(--color-primary)",
209
+ opacity = 1,
210
+ className
211
+ }) => {
212
+ const half = size / 2;
213
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
214
+ /* @__PURE__ */ jsx(
215
+ "rect",
216
+ {
217
+ x: x - half,
218
+ y: y - half,
219
+ width: size,
220
+ height: size,
221
+ fill: color,
222
+ opacity: 0.3,
223
+ stroke: color,
224
+ strokeWidth: 1.5
225
+ }
226
+ ),
227
+ label && /* @__PURE__ */ jsx(
228
+ "text",
229
+ {
230
+ x,
231
+ y: y + half + 12,
232
+ textAnchor: "middle",
233
+ fill: color,
234
+ fontSize: 8,
235
+ fontFamily: "inherit",
236
+ children: label
237
+ }
238
+ )
239
+ ] });
240
+ };
241
+ AvlPage.displayName = "AvlPage";
242
+ var AvlApplication = ({
243
+ x = 0,
244
+ y = 0,
245
+ width = 500,
246
+ height = 350,
247
+ label,
248
+ color = "var(--color-primary)",
249
+ opacity = 1,
250
+ className
251
+ }) => {
252
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
253
+ /* @__PURE__ */ jsx(
254
+ "rect",
255
+ {
256
+ x,
257
+ y,
258
+ width,
259
+ height,
260
+ rx: 12,
261
+ ry: 12,
262
+ fill: "none",
263
+ stroke: color,
264
+ strokeWidth: 3
265
+ }
266
+ ),
267
+ /* @__PURE__ */ jsx(
268
+ "rect",
269
+ {
270
+ x,
271
+ y,
272
+ width,
273
+ height,
274
+ rx: 12,
275
+ ry: 12,
276
+ fill: color,
277
+ opacity: 0.02
278
+ }
279
+ ),
280
+ label && /* @__PURE__ */ jsx(
281
+ "text",
282
+ {
283
+ x: x + 16,
284
+ y: y + 20,
285
+ fill: color,
286
+ fontSize: 12,
287
+ fontFamily: "inherit",
288
+ fontWeight: "bold",
289
+ children: label
290
+ }
291
+ )
292
+ ] });
293
+ };
294
+ AvlApplication.displayName = "AvlApplication";
295
+ var AvlState = ({
296
+ x = 0,
297
+ y = 0,
298
+ name,
299
+ isInitial = false,
300
+ isTerminal = false,
301
+ width = 100,
302
+ height = 40,
303
+ color = "var(--color-primary)",
304
+ opacity = 1,
305
+ className
306
+ }) => {
307
+ const rx = height / 2;
308
+ return /* @__PURE__ */ jsxs("g", { className, opacity, transform: `translate(${x},${y})`, children: [
309
+ isInitial && /* @__PURE__ */ jsx(
310
+ "circle",
311
+ {
312
+ cx: -16,
313
+ cy: height / 2,
314
+ r: 6,
315
+ fill: color
316
+ }
317
+ ),
318
+ isTerminal && /* @__PURE__ */ jsx(
319
+ "rect",
320
+ {
321
+ x: -4,
322
+ y: -4,
323
+ width: width + 8,
324
+ height: height + 8,
325
+ rx: rx + 4,
326
+ ry: rx + 4,
327
+ fill: "none",
328
+ stroke: color,
329
+ strokeWidth: 1,
330
+ opacity: 0.5
331
+ }
332
+ ),
333
+ /* @__PURE__ */ jsx(
334
+ "rect",
335
+ {
336
+ x: 0,
337
+ y: 0,
338
+ width,
339
+ height,
340
+ rx,
341
+ ry: rx,
342
+ fill: "none",
343
+ stroke: color,
344
+ strokeWidth: 2
345
+ }
346
+ ),
347
+ name && /* @__PURE__ */ jsx(
348
+ "text",
349
+ {
350
+ x: width / 2,
351
+ y: height / 2,
352
+ textAnchor: "middle",
353
+ dominantBaseline: "central",
354
+ fill: color,
355
+ fontSize: 11,
356
+ fontFamily: "inherit",
357
+ children: name
358
+ }
359
+ )
360
+ ] });
361
+ };
362
+ AvlState.displayName = "AvlState";
363
+ var avlTransitionId = 0;
364
+ var AvlTransition = ({
365
+ x1,
366
+ y1,
367
+ x2,
368
+ y2,
369
+ curved = false,
370
+ curveAwayFrom,
371
+ label,
372
+ color = "var(--color-primary)",
373
+ opacity = 1,
374
+ className
375
+ }) => {
376
+ const ids = React6.useMemo(() => {
377
+ avlTransitionId += 1;
378
+ return { arrow: `avl-tr-${avlTransitionId}-arrow` };
379
+ }, []);
380
+ const mx = (x1 + x2) / 2;
381
+ const my = (y1 + y2) / 2;
382
+ const dx = x2 - x1;
383
+ const dy = y2 - y1;
384
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
385
+ const curvature = len * 0.2;
386
+ let perpX = -dy / len;
387
+ let perpY = dx / len;
388
+ if (curveAwayFrom) {
389
+ const testX = mx + perpX * curvature;
390
+ const testY = my + perpY * curvature;
391
+ const distTest = Math.sqrt((testX - curveAwayFrom.x) ** 2 + (testY - curveAwayFrom.y) ** 2);
392
+ const distMid = Math.sqrt((mx - curveAwayFrom.x) ** 2 + (my - curveAwayFrom.y) ** 2);
393
+ if (distTest < distMid) {
394
+ perpX = -perpX;
395
+ perpY = -perpY;
396
+ }
397
+ }
398
+ const cpx = mx + perpX * curvature;
399
+ const cpy = my + perpY * curvature;
400
+ const d = curved ? `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}` : `M${x1},${y1} L${x2},${y2}`;
401
+ const labelX = curved ? (x1 + 2 * cpx + x2) / 4 : mx;
402
+ const labelY = curved ? (y1 + 2 * cpy + y2) / 4 : my;
403
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
404
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
405
+ "marker",
406
+ {
407
+ id: ids.arrow,
408
+ markerWidth: "8",
409
+ markerHeight: "6",
410
+ refX: "7",
411
+ refY: "3",
412
+ orient: "auto",
413
+ markerUnits: "strokeWidth",
414
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color })
415
+ }
416
+ ) }),
417
+ /* @__PURE__ */ jsx(
418
+ "path",
419
+ {
420
+ d,
421
+ fill: "none",
422
+ stroke: color,
423
+ strokeWidth: 1.5,
424
+ markerEnd: `url(#${ids.arrow})`
425
+ }
426
+ ),
427
+ label && /* @__PURE__ */ jsx(
428
+ "text",
429
+ {
430
+ x: labelX,
431
+ y: labelY - 6,
432
+ textAnchor: "middle",
433
+ fill: color,
434
+ fontSize: 9,
435
+ fontFamily: "inherit",
436
+ opacity: 0.8,
437
+ children: label
438
+ }
439
+ )
440
+ ] });
441
+ };
442
+ AvlTransition.displayName = "AvlTransition";
443
+ var AvlEvent = ({
444
+ x = 0,
445
+ y = 0,
446
+ size = 16,
447
+ label,
448
+ color = "var(--color-primary)",
449
+ opacity = 1,
450
+ className
451
+ }) => {
452
+ const s = size / 16;
453
+ const bolt = [
454
+ `M${x - 2 * s},${y - 8 * s}`,
455
+ `L${x + 4 * s},${y - 8 * s}`,
456
+ `L${x + 1 * s},${y - 1 * s}`,
457
+ `L${x + 5 * s},${y - 1 * s}`,
458
+ `L${x - 3 * s},${y + 8 * s}`,
459
+ `L${x},${y + 1 * s}`,
460
+ `L${x - 4 * s},${y + 1 * s}`,
461
+ "Z"
462
+ ].join(" ");
463
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
464
+ /* @__PURE__ */ jsx("path", { d: bolt, fill: color }),
465
+ label && /* @__PURE__ */ jsx(
466
+ "text",
467
+ {
468
+ x,
469
+ y: y + size / 2 + 12,
470
+ textAnchor: "middle",
471
+ fill: color,
472
+ fontSize: 9,
473
+ fontFamily: "inherit",
474
+ children: label
475
+ }
476
+ )
477
+ ] });
478
+ };
479
+ AvlEvent.displayName = "AvlEvent";
480
+ var AvlGuard = ({
481
+ x = 0,
482
+ y = 0,
483
+ size = 24,
484
+ label,
485
+ color = "var(--color-primary)",
486
+ opacity = 1,
487
+ className
488
+ }) => {
489
+ const h = size / 2;
490
+ const points = `${x},${y - h} ${x + h},${y} ${x},${y + h} ${x - h},${y}`;
491
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
492
+ /* @__PURE__ */ jsx(
493
+ "polygon",
494
+ {
495
+ points,
496
+ fill: "none",
497
+ stroke: color,
498
+ strokeWidth: 2,
499
+ strokeLinejoin: "round"
500
+ }
501
+ ),
502
+ label && /* @__PURE__ */ jsx(
503
+ "text",
504
+ {
505
+ x,
506
+ y,
507
+ textAnchor: "middle",
508
+ dominantBaseline: "central",
509
+ fill: color,
510
+ fontSize: 8,
511
+ fontFamily: "inherit",
512
+ children: label
513
+ }
514
+ )
515
+ ] });
516
+ };
517
+ AvlGuard.displayName = "AvlGuard";
518
+ function effectIcon(type, x, y, s, color) {
519
+ switch (type) {
520
+ case "render-ui":
521
+ return /* @__PURE__ */ jsxs("g", { children: [
522
+ /* @__PURE__ */ jsx("rect", { x: x - s, y: y - s, width: s * 2, height: s * 2, fill: "none", stroke: color, strokeWidth: 1.5, rx: 1 }),
523
+ /* @__PURE__ */ jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s, stroke: color, strokeWidth: 1 }),
524
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 1 })
525
+ ] });
526
+ case "set":
527
+ return /* @__PURE__ */ jsx(
528
+ "path",
529
+ {
530
+ d: `M${x - s * 0.6},${y + s} L${x - s},${y + s * 0.4} L${x + s * 0.4},${y - s} L${x + s},${y - s * 0.4} Z`,
531
+ fill: "none",
532
+ stroke: color,
533
+ strokeWidth: 1.5,
534
+ strokeLinejoin: "round"
535
+ }
536
+ );
537
+ case "persist":
538
+ return /* @__PURE__ */ jsxs("g", { children: [
539
+ /* @__PURE__ */ jsx("ellipse", { cx: x, cy: y - s * 0.6, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 }),
540
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x - s, y2: y + s * 0.4, stroke: color, strokeWidth: 1.5 }),
541
+ /* @__PURE__ */ jsx("line", { x1: x + s, y1: y - s * 0.6, x2: x + s, y2: y + s * 0.4, stroke: color, strokeWidth: 1.5 }),
542
+ /* @__PURE__ */ jsx("ellipse", { cx: x, cy: y + s * 0.4, rx: s, ry: s * 0.4, fill: "none", stroke: color, strokeWidth: 1.5 })
543
+ ] });
544
+ case "fetch":
545
+ return /* @__PURE__ */ jsxs("g", { children: [
546
+ /* @__PURE__ */ jsx("line", { x1: x, y1: y - s, x2: x, y2: y + s * 0.6, stroke: color, strokeWidth: 1.5 }),
547
+ /* @__PURE__ */ jsx("polyline", { points: `${x - s * 0.5},${y + s * 0.1} ${x},${y + s} ${x + s * 0.5},${y + s * 0.1}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
548
+ ] });
549
+ case "emit":
550
+ return /* @__PURE__ */ jsxs("g", { children: [
551
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s * 0.3, fill: color }),
552
+ /* @__PURE__ */ jsx("path", { d: `M${x - s * 0.7},${y - s * 0.7} A${s},${s} 0 0,1 ${x + s * 0.7},${y - s * 0.7}`, fill: "none", stroke: color, strokeWidth: 1.5 }),
553
+ /* @__PURE__ */ jsx("path", { d: `M${x - s},${y - s} A${s * 1.4},${s * 1.4} 0 0,1 ${x + s},${y - s}`, fill: "none", stroke: color, strokeWidth: 1, opacity: 0.6 })
554
+ ] });
555
+ case "navigate":
556
+ return /* @__PURE__ */ jsxs("g", { children: [
557
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y, x2: x + s * 0.6, y2: y, stroke: color, strokeWidth: 1.5 }),
558
+ /* @__PURE__ */ jsx("polyline", { points: `${x + s * 0.1},${y - s * 0.5} ${x + s},${y} ${x + s * 0.1},${y + s * 0.5}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
559
+ ] });
560
+ case "notify":
561
+ return /* @__PURE__ */ jsxs("g", { children: [
562
+ /* @__PURE__ */ jsx("path", { d: `M${x - s * 0.7},${y + s * 0.3} Q${x - s * 0.7},${y - s} ${x},${y - s} Q${x + s * 0.7},${y - s} ${x + s * 0.7},${y + s * 0.3} Z`, fill: "none", stroke: color, strokeWidth: 1.5 }),
563
+ /* @__PURE__ */ jsx("line", { x1: x - s * 0.8, y1: y + s * 0.3, x2: x + s * 0.8, y2: y + s * 0.3, stroke: color, strokeWidth: 1.5 }),
564
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y + s * 0.7, r: s * 0.2, fill: color })
565
+ ] });
566
+ case "call-service":
567
+ return /* @__PURE__ */ jsxs("g", { children: [
568
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y - s * 0.3, x2: x + s, y2: y - s * 0.3, stroke: color, strokeWidth: 1.5 }),
569
+ /* @__PURE__ */ jsx("polyline", { points: `${x + s * 0.5},${y - s * 0.7} ${x + s},${y - s * 0.3} ${x + s * 0.5},${y + s * 0.1}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" }),
570
+ /* @__PURE__ */ jsx("line", { x1: x + s, y1: y + s * 0.3, x2: x - s, y2: y + s * 0.3, stroke: color, strokeWidth: 1.5 }),
571
+ /* @__PURE__ */ jsx("polyline", { points: `${x - s * 0.5},${y - s * 0.1} ${x - s},${y + s * 0.3} ${x - s * 0.5},${y + s * 0.7}`, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round" })
572
+ ] });
573
+ case "spawn":
574
+ return /* @__PURE__ */ jsxs("g", { children: [
575
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
576
+ /* @__PURE__ */ jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 }),
577
+ /* @__PURE__ */ jsx("line", { x1: x, y1: y - s * 0.5, x2: x, y2: y + s * 0.5, stroke: color, strokeWidth: 1.5 })
578
+ ] });
579
+ case "despawn":
580
+ return /* @__PURE__ */ jsxs("g", { children: [
581
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
582
+ /* @__PURE__ */ jsx("line", { x1: x - s * 0.5, y1: y, x2: x + s * 0.5, y2: y, stroke: color, strokeWidth: 1.5 })
583
+ ] });
584
+ case "do":
585
+ return /* @__PURE__ */ jsxs("g", { children: [
586
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 }),
587
+ /* @__PURE__ */ jsx("polygon", { points: `${x - s * 0.3},${y - s * 0.5} ${x + s * 0.5},${y} ${x - s * 0.3},${y + s * 0.5}`, fill: color })
588
+ ] });
589
+ case "if":
590
+ return /* @__PURE__ */ jsx(
591
+ "polygon",
592
+ {
593
+ points: `${x},${y - s} ${x + s * 0.7},${y} ${x},${y + s} ${x - s * 0.7},${y}`,
594
+ fill: "none",
595
+ stroke: color,
596
+ strokeWidth: 1.5,
597
+ strokeLinejoin: "round"
598
+ }
599
+ );
600
+ case "log":
601
+ return /* @__PURE__ */ jsx(
602
+ "text",
603
+ {
604
+ x,
605
+ y,
606
+ textAnchor: "middle",
607
+ dominantBaseline: "central",
608
+ fill: color,
609
+ fontSize: s * 2.2,
610
+ fontFamily: "serif",
611
+ children: "\xB6"
612
+ }
613
+ );
614
+ }
615
+ }
616
+ var AvlEffect = ({
617
+ x = 0,
618
+ y = 0,
619
+ effectType,
620
+ size = 8,
621
+ label,
622
+ color = "var(--color-primary)",
623
+ opacity = 1,
624
+ className
625
+ }) => {
626
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
627
+ effectIcon(effectType, x, y, size, color),
628
+ label && /* @__PURE__ */ jsx(
629
+ "text",
630
+ {
631
+ x,
632
+ y: y + size + 10,
633
+ textAnchor: "middle",
634
+ fill: color,
635
+ fontSize: 8,
636
+ fontFamily: "inherit",
637
+ opacity: 0.7,
638
+ children: label
639
+ }
640
+ )
641
+ ] });
642
+ };
643
+ AvlEffect.displayName = "AvlEffect";
644
+ var AvlField = ({
645
+ x = 0,
646
+ y = 0,
647
+ angle = 0,
648
+ length = 30,
649
+ required = true,
650
+ label,
651
+ color = "var(--color-primary)",
652
+ opacity = 1,
653
+ className
654
+ }) => {
655
+ const x2 = x + length * Math.cos(angle);
656
+ const y2 = y + length * Math.sin(angle);
657
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
658
+ /* @__PURE__ */ jsx(
659
+ "line",
660
+ {
661
+ x1: x,
662
+ y1: y,
663
+ x2,
664
+ y2,
665
+ stroke: color,
666
+ strokeWidth: 1.5,
667
+ strokeDasharray: required ? void 0 : "3 2"
668
+ }
669
+ ),
670
+ /* @__PURE__ */ jsx("circle", { cx: x2, cy: y2, r: 2.5, fill: color, opacity: 0.6 }),
671
+ label && /* @__PURE__ */ jsx(
672
+ "text",
673
+ {
674
+ x: x2 + 6 * Math.cos(angle),
675
+ y: y2 + 6 * Math.sin(angle),
676
+ textAnchor: Math.cos(angle) >= 0 ? "start" : "end",
677
+ dominantBaseline: "central",
678
+ fill: color,
679
+ fontSize: 8,
680
+ fontFamily: "inherit",
681
+ opacity: 0.7,
682
+ children: label
683
+ }
684
+ )
685
+ ] });
686
+ };
687
+ AvlField.displayName = "AvlField";
688
+ function typeShape(kind, x, y, s, color) {
689
+ switch (kind) {
690
+ case "string":
691
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: color });
692
+ case "number":
693
+ return /* @__PURE__ */ jsx(
694
+ "polygon",
695
+ {
696
+ points: `${x},${y - s} ${x + s},${y + s * 0.7} ${x - s},${y + s * 0.7}`,
697
+ fill: color
698
+ }
699
+ );
700
+ case "boolean":
701
+ return /* @__PURE__ */ jsx("rect", { x: x - s * 0.8, y: y - s * 0.8, width: s * 1.6, height: s * 1.6, fill: color });
702
+ case "date":
703
+ return /* @__PURE__ */ jsx(
704
+ "polygon",
705
+ {
706
+ points: `${x},${y - s} ${x + s},${y} ${x},${y + s} ${x - s},${y}`,
707
+ fill: color
708
+ }
709
+ );
710
+ case "enum":
711
+ return /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: s, fill: "none", stroke: color, strokeWidth: 1.5 });
712
+ case "object":
713
+ return /* @__PURE__ */ jsx(
714
+ "polygon",
715
+ {
716
+ points: Array.from({ length: 6 }, (_, i) => {
717
+ const a = Math.PI * 2 * i / 6 - Math.PI / 6;
718
+ return `${x + s * Math.cos(a)},${y + s * Math.sin(a)}`;
719
+ }).join(" "),
720
+ fill: color,
721
+ opacity: 0.8
722
+ }
723
+ );
724
+ case "array":
725
+ return /* @__PURE__ */ jsxs("g", { children: [
726
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y - s * 0.6, x2: x + s, y2: y - s * 0.6, stroke: color, strokeWidth: 2 }),
727
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y, x2: x + s, y2: y, stroke: color, strokeWidth: 2 }),
728
+ /* @__PURE__ */ jsx("line", { x1: x - s, y1: y + s * 0.6, x2: x + s, y2: y + s * 0.6, stroke: color, strokeWidth: 2 })
729
+ ] });
730
+ }
731
+ }
732
+ var AvlFieldType = ({
733
+ x = 0,
734
+ y = 0,
735
+ kind,
736
+ size = 5,
737
+ label,
738
+ color = "var(--color-primary)",
739
+ opacity = 1,
740
+ className
741
+ }) => {
742
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
743
+ typeShape(kind, x, y, size, color),
744
+ label && /* @__PURE__ */ jsx(
745
+ "text",
746
+ {
747
+ x,
748
+ y: y + size + 10,
749
+ textAnchor: "middle",
750
+ fill: color,
751
+ fontSize: 8,
752
+ fontFamily: "inherit",
753
+ opacity: 0.7,
754
+ children: label
755
+ }
756
+ )
757
+ ] });
758
+ };
759
+ AvlFieldType.displayName = "AvlFieldType";
760
+ var AvlBinding = ({
761
+ x1,
762
+ y1,
763
+ x2,
764
+ y2,
765
+ label,
766
+ color = "var(--color-primary)",
767
+ opacity = 1,
768
+ className
769
+ }) => {
770
+ const mx = (x1 + x2) / 2;
771
+ const my = (y1 + y2) / 2;
772
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
773
+ /* @__PURE__ */ jsx(
774
+ "line",
775
+ {
776
+ x1,
777
+ y1,
778
+ x2,
779
+ y2,
780
+ stroke: color,
781
+ strokeWidth: 1,
782
+ strokeDasharray: "2 3",
783
+ opacity: 0.6
784
+ }
785
+ ),
786
+ /* @__PURE__ */ jsx(
787
+ "text",
788
+ {
789
+ x: mx,
790
+ y: my - 4,
791
+ textAnchor: "middle",
792
+ fill: color,
793
+ fontSize: 10,
794
+ fontFamily: "inherit",
795
+ fontWeight: "bold",
796
+ children: "@"
797
+ }
798
+ ),
799
+ label && /* @__PURE__ */ jsx(
800
+ "text",
801
+ {
802
+ x: mx,
803
+ y: my + 10,
804
+ textAnchor: "middle",
805
+ fill: color,
806
+ fontSize: 8,
807
+ fontFamily: "inherit",
808
+ opacity: 0.6,
809
+ children: label
810
+ }
811
+ )
812
+ ] });
813
+ };
814
+ AvlBinding.displayName = "AvlBinding";
815
+ var AvlPersistence = ({
816
+ x = 0,
817
+ y = 0,
818
+ kind,
819
+ size = 20,
820
+ label,
821
+ color = "var(--color-primary)",
822
+ opacity = 1,
823
+ className
824
+ }) => {
825
+ const half = size / 2;
826
+ const strokeProps = (() => {
827
+ switch (kind) {
828
+ case "persistent":
829
+ return { strokeWidth: 2.5 };
830
+ case "runtime":
831
+ return { strokeDasharray: "6 3", strokeWidth: 2 };
832
+ case "singleton":
833
+ return { strokeWidth: 3 };
834
+ case "instance":
835
+ return { strokeDasharray: "2 3", strokeWidth: 2 };
836
+ }
837
+ })();
838
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
839
+ /* @__PURE__ */ jsx(
840
+ "line",
841
+ {
842
+ x1: x - half,
843
+ y1: y,
844
+ x2: x + half,
845
+ y2: y,
846
+ stroke: color,
847
+ strokeWidth: strokeProps.strokeWidth,
848
+ strokeDasharray: strokeProps.strokeDasharray,
849
+ strokeLinecap: "round"
850
+ }
851
+ ),
852
+ kind === "singleton" && /* @__PURE__ */ jsx(
853
+ "line",
854
+ {
855
+ x1: x - half,
856
+ y1: y + 5,
857
+ x2: x + half,
858
+ y2: y + 5,
859
+ stroke: color,
860
+ strokeWidth: 1.5,
861
+ strokeLinecap: "round"
862
+ }
863
+ ),
864
+ label && /* @__PURE__ */ jsx(
865
+ "text",
866
+ {
867
+ x,
868
+ y: y + (kind === "singleton" ? 20 : 14),
869
+ textAnchor: "middle",
870
+ fill: color,
871
+ fontSize: 8,
872
+ fontFamily: "inherit",
873
+ opacity: 0.7,
874
+ children: label
875
+ }
876
+ )
877
+ ] });
878
+ };
879
+ AvlPersistence.displayName = "AvlPersistence";
880
+ var AvlOperator = ({
881
+ x = 0,
882
+ y = 0,
883
+ name,
884
+ namespace = "arithmetic",
885
+ size = 16,
886
+ color,
887
+ opacity = 1,
888
+ className
889
+ }) => {
890
+ const opColor = color ?? AVL_OPERATOR_COLORS[namespace];
891
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
892
+ /* @__PURE__ */ jsx(
893
+ "rect",
894
+ {
895
+ x: x - size,
896
+ y: y - size * 0.7,
897
+ width: size * 2,
898
+ height: size * 1.4,
899
+ rx: 4,
900
+ ry: 4,
901
+ fill: opColor,
902
+ fillOpacity: 0.15,
903
+ stroke: opColor,
904
+ strokeWidth: 1.5
905
+ }
906
+ ),
907
+ /* @__PURE__ */ jsx(
908
+ "text",
909
+ {
910
+ x,
911
+ y: y + 1,
912
+ textAnchor: "middle",
913
+ dominantBaseline: "central",
914
+ fill: opColor,
915
+ fontSize: size > 14 ? 10 : 8,
916
+ fontFamily: "inherit",
917
+ fontWeight: "bold",
918
+ children: name
919
+ }
920
+ )
921
+ ] });
922
+ };
923
+ AvlOperator.displayName = "AvlOperator";
924
+ var AvlSExpr = ({
925
+ x = 0,
926
+ y = 0,
927
+ width = 140,
928
+ height = 80,
929
+ label,
930
+ color = "var(--color-primary)",
931
+ opacity = 1,
932
+ className
933
+ }) => {
934
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
935
+ /* @__PURE__ */ jsx(
936
+ "rect",
937
+ {
938
+ x,
939
+ y,
940
+ width,
941
+ height,
942
+ rx: 6,
943
+ ry: 6,
944
+ fill: color,
945
+ fillOpacity: 0.05,
946
+ stroke: color,
947
+ strokeWidth: 1,
948
+ strokeDasharray: "6 3"
949
+ }
950
+ ),
951
+ /* @__PURE__ */ jsx("circle", { cx: x + 12, cy: y + 12, r: 3, fill: color, opacity: 0.4 }),
952
+ /* @__PURE__ */ jsx("line", { x1: x + 12, y1: y + 15, x2: x + 8, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
953
+ /* @__PURE__ */ jsx("line", { x1: x + 12, y1: y + 15, x2: x + 16, y2: y + 22, stroke: color, strokeWidth: 0.8, opacity: 0.3 }),
954
+ label && /* @__PURE__ */ jsx(
955
+ "text",
956
+ {
957
+ x: x + width / 2,
958
+ y: y + height / 2,
959
+ textAnchor: "middle",
960
+ dominantBaseline: "central",
961
+ fill: color,
962
+ fontSize: 9,
963
+ fontFamily: "inherit",
964
+ opacity: 0.6,
965
+ children: label
966
+ }
967
+ )
968
+ ] });
969
+ };
970
+ AvlSExpr.displayName = "AvlSExpr";
971
+ var AvlLiteral = ({
972
+ x = 0,
973
+ y = 0,
974
+ value,
975
+ size = 12,
976
+ color = "var(--color-primary)",
977
+ opacity = 1,
978
+ className
979
+ }) => {
980
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
981
+ /* @__PURE__ */ jsx(
982
+ "circle",
983
+ {
984
+ cx: x,
985
+ cy: y,
986
+ r: size,
987
+ fill: "none",
988
+ stroke: color,
989
+ strokeWidth: 1,
990
+ opacity: 0.5
991
+ }
992
+ ),
993
+ /* @__PURE__ */ jsx(
994
+ "text",
995
+ {
996
+ x,
997
+ y: y + 1,
998
+ textAnchor: "middle",
999
+ dominantBaseline: "central",
1000
+ fill: color,
1001
+ fontSize: size > 10 ? 9 : 7,
1002
+ fontFamily: "inherit",
1003
+ children: value
1004
+ }
1005
+ )
1006
+ ] });
1007
+ };
1008
+ AvlLiteral.displayName = "AvlLiteral";
1009
+ var AvlBindingRef = ({
1010
+ x = 0,
1011
+ y = 0,
1012
+ path,
1013
+ size = 12,
1014
+ color = "var(--color-primary)",
1015
+ opacity = 1,
1016
+ className
1017
+ }) => {
1018
+ const fullLabel = `@${path}`;
1019
+ const autoR = Math.max(size, fullLabel.length * 3.5 + 4);
1020
+ return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
1021
+ /* @__PURE__ */ jsx(
1022
+ "circle",
1023
+ {
1024
+ cx: x,
1025
+ cy: y,
1026
+ r: autoR,
1027
+ fill: "none",
1028
+ stroke: color,
1029
+ strokeWidth: 1.5,
1030
+ strokeDasharray: "3 2"
1031
+ }
1032
+ ),
1033
+ /* @__PURE__ */ jsx(
1034
+ "text",
1035
+ {
1036
+ x,
1037
+ y: y + 1,
1038
+ textAnchor: "middle",
1039
+ dominantBaseline: "central",
1040
+ fill: color,
1041
+ fontSize: 10,
1042
+ fontFamily: "inherit",
1043
+ children: fullLabel
1044
+ }
1045
+ )
1046
+ ] });
1047
+ };
1048
+ AvlBindingRef.displayName = "AvlBindingRef";
1049
+
1050
+ // components/molecules/avl/avl-layout.ts
1051
+ function ringPositions(cx, cy, r, count, startAngle = -Math.PI / 2) {
1052
+ if (count === 0) return [];
1053
+ if (count === 1) {
1054
+ return [{ x: cx, y: cy, angle: 0 }];
1055
+ }
1056
+ if (count === 2) {
1057
+ return [
1058
+ { x: cx - r * 0.7, y: cy, angle: Math.PI },
1059
+ { x: cx + r * 0.7, y: cy, angle: 0 }
1060
+ ];
1061
+ }
1062
+ return Array.from({ length: count }, (_, i) => {
1063
+ const angle = startAngle + Math.PI * 2 * i / count;
1064
+ return {
1065
+ x: cx + r * Math.cos(angle),
1066
+ y: cy + r * Math.sin(angle),
1067
+ angle
1068
+ };
1069
+ });
1070
+ }
1071
+ function arcPath(cx, cy, r, startAngle, endAngle) {
1072
+ const x1 = cx + r * Math.cos(startAngle);
1073
+ const y1 = cy + r * Math.sin(startAngle);
1074
+ const x2 = cx + r * Math.cos(endAngle);
1075
+ const y2 = cy + r * Math.sin(endAngle);
1076
+ const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
1077
+ return `M${x1},${y1} A${r},${r} 0 ${largeArc},1 ${x2},${y2}`;
1078
+ }
1079
+ function radialPositions(cx, cy, innerR, outerR, count, startAngle = -Math.PI / 2) {
1080
+ return Array.from({ length: count }, (_, i) => {
1081
+ const angle = startAngle + Math.PI * 2 * i / count;
1082
+ return {
1083
+ x1: cx + innerR * Math.cos(angle),
1084
+ y1: cy + innerR * Math.sin(angle),
1085
+ x2: cx + outerR * Math.cos(angle),
1086
+ y2: cy + outerR * Math.sin(angle),
1087
+ angle
1088
+ };
1089
+ });
1090
+ }
1091
+ function gridPositions(startX, startY, cols, cellWidth, cellHeight, count) {
1092
+ return Array.from({ length: count }, (_, i) => {
1093
+ const col = i % cols;
1094
+ const row = Math.floor(i / cols);
1095
+ return {
1096
+ x: startX + col * cellWidth,
1097
+ y: startY + row * cellHeight,
1098
+ col,
1099
+ row
1100
+ };
1101
+ });
1102
+ }
1103
+ function curveControlPoint(x1, y1, x2, y2, offset) {
1104
+ const mx = (x1 + x2) / 2;
1105
+ const my = (y1 + y2) / 2;
1106
+ const dx = x2 - x1;
1107
+ const dy = y2 - y1;
1108
+ const len = Math.sqrt(dx * dx + dy * dy) || 1;
1109
+ return {
1110
+ cpx: mx + -dy / len * offset,
1111
+ cpy: my + dx / len * offset
1112
+ };
1113
+ }
1114
+ var avlSmId = 0;
1115
+ var AvlStateMachine = ({
1116
+ states,
1117
+ transitions,
1118
+ className,
1119
+ color = "var(--color-primary)",
1120
+ animated = false
1121
+ }) => {
1122
+ const ids = React6.useMemo(() => {
1123
+ avlSmId += 1;
1124
+ const base = `avl-sm-${avlSmId}`;
1125
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1126
+ }, []);
1127
+ const cx = 300;
1128
+ const cy = 200;
1129
+ const r = 150;
1130
+ const stateWidth = 90;
1131
+ const stateHeight = 36;
1132
+ const positions = ringPositions(cx, cy, r, states.length);
1133
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1134
+ const pairCount = /* @__PURE__ */ new Map();
1135
+ const pairSeen = /* @__PURE__ */ new Map();
1136
+ for (const tr of transitions) {
1137
+ const key = [tr.from, tr.to].sort().join("|");
1138
+ pairCount.set(key, (pairCount.get(key) ?? 0) + 1);
1139
+ }
1140
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1141
+ /* @__PURE__ */ jsxs("defs", { children: [
1142
+ /* @__PURE__ */ jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1143
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1144
+ /* @__PURE__ */ jsxs("feMerge", { children: [
1145
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
1146
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
1147
+ ] })
1148
+ ] }),
1149
+ /* @__PURE__ */ jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1150
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.1 }),
1151
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
1152
+ ] })
1153
+ ] }),
1154
+ animated && /* @__PURE__ */ jsx("style", { children: `
1155
+ @keyframes avl-sm-dash { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
1156
+ ` }),
1157
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
1158
+ transitions.map((tr, i) => {
1159
+ if (tr.from !== tr.to) return null;
1160
+ const idx = stateIndex.get(tr.from);
1161
+ if (idx === void 0) return null;
1162
+ const pos = positions[idx];
1163
+ const loopR = 20;
1164
+ const loopY = pos.y - stateHeight / 2 - 4;
1165
+ const d = `M${pos.x - 14},${loopY} C${pos.x - 14},${loopY - loopR * 2} ${pos.x + 14},${loopY - loopR * 2} ${pos.x + 14},${loopY}`;
1166
+ return /* @__PURE__ */ jsxs("g", { children: [
1167
+ /* @__PURE__ */ jsx(
1168
+ "path",
1169
+ {
1170
+ d,
1171
+ fill: "none",
1172
+ stroke: color,
1173
+ strokeWidth: 1.5,
1174
+ opacity: 0.7,
1175
+ markerEnd: `url(#${ids.grad})`
1176
+ }
1177
+ ),
1178
+ tr.event && /* @__PURE__ */ jsx(
1179
+ "text",
1180
+ {
1181
+ x: pos.x,
1182
+ y: loopY - loopR * 2 + 4,
1183
+ textAnchor: "middle",
1184
+ fill: color,
1185
+ fontSize: 9,
1186
+ fontFamily: "inherit",
1187
+ fontWeight: "bold",
1188
+ opacity: 0.8,
1189
+ children: tr.event
1190
+ }
1191
+ )
1192
+ ] }, `self-${i}`);
1193
+ }),
1194
+ transitions.map((tr, i) => {
1195
+ if (tr.from === tr.to) return null;
1196
+ const fromIdx = stateIndex.get(tr.from);
1197
+ const toIdx = stateIndex.get(tr.to);
1198
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1199
+ const fp = positions[fromIdx];
1200
+ const tp = positions[toIdx];
1201
+ const dx = tp.x - fp.x;
1202
+ const dy = tp.y - fp.y;
1203
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1204
+ const nx = dx / dist;
1205
+ const ny = dy / dist;
1206
+ const pairKey = [tr.from, tr.to].sort().join("|");
1207
+ const totalForPair = pairCount.get(pairKey) ?? 1;
1208
+ const seenIdx = pairSeen.get(pairKey) ?? 0;
1209
+ pairSeen.set(pairKey, seenIdx + 1);
1210
+ const pairOffset = totalForPair > 1 ? (seenIdx - (totalForPair - 1) / 2) * 24 : 0;
1211
+ const x1 = fp.x + nx * (stateWidth / 2 + 4);
1212
+ const y1 = fp.y + ny * (stateHeight / 2 + 4);
1213
+ const x2 = tp.x - nx * (stateWidth / 2 + 8);
1214
+ const y2 = tp.y - ny * (stateHeight / 2 + 8);
1215
+ const t = 0.3;
1216
+ const labelX = x1 * (1 - t) + x2 * t;
1217
+ const labelY = y1 * (1 - t) + y2 * t;
1218
+ const perpX = -ny * (20 + Math.abs(pairOffset));
1219
+ const perpY = nx * (20 + Math.abs(pairOffset));
1220
+ const midToCenter = Math.sqrt((labelX - cx) ** 2 + (labelY - cy) ** 2);
1221
+ const testX = labelX + perpX;
1222
+ const testY = labelY + perpY;
1223
+ const testToCenter = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1224
+ const outSign = testToCenter > midToCenter ? 1 : -1;
1225
+ const lx = labelX + perpX * outSign + -ny * pairOffset;
1226
+ const ly = labelY + perpY * outSign + nx * pairOffset;
1227
+ return /* @__PURE__ */ jsxs("g", { children: [
1228
+ /* @__PURE__ */ jsx(
1229
+ AvlTransition,
1230
+ {
1231
+ x1: x1 + -ny * pairOffset,
1232
+ y1: y1 + nx * pairOffset,
1233
+ x2: x2 + -ny * pairOffset,
1234
+ y2: y2 + nx * pairOffset,
1235
+ curved: states.length > 2,
1236
+ curveAwayFrom: { x: cx, y: cy },
1237
+ color,
1238
+ opacity: 0.7
1239
+ }
1240
+ ),
1241
+ tr.event && /* @__PURE__ */ jsx(
1242
+ "text",
1243
+ {
1244
+ x: lx,
1245
+ y: ly,
1246
+ textAnchor: "middle",
1247
+ fill: color,
1248
+ fontSize: 9,
1249
+ fontFamily: "inherit",
1250
+ fontWeight: "bold",
1251
+ opacity: 0.8,
1252
+ children: tr.event
1253
+ }
1254
+ ),
1255
+ tr.guard && /* @__PURE__ */ jsxs(
1256
+ "text",
1257
+ {
1258
+ x: lx,
1259
+ y: ly + 12,
1260
+ textAnchor: "middle",
1261
+ fill: color,
1262
+ fontSize: 8,
1263
+ fontFamily: "inherit",
1264
+ opacity: 0.6,
1265
+ children: [
1266
+ "[",
1267
+ tr.guard,
1268
+ "]"
1269
+ ]
1270
+ }
1271
+ ),
1272
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsx(
1273
+ AvlEffect,
1274
+ {
1275
+ x: lx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1276
+ y: ly + (tr.guard ? 22 : 12),
1277
+ effectType: eff,
1278
+ size: 5,
1279
+ color,
1280
+ opacity: 0.7
1281
+ },
1282
+ j
1283
+ ))
1284
+ ] }, `tr-${i}`);
1285
+ }),
1286
+ states.map((state, i) => {
1287
+ const pos = positions[i];
1288
+ return /* @__PURE__ */ jsx(
1289
+ AvlState,
1290
+ {
1291
+ x: pos.x - stateWidth / 2,
1292
+ y: pos.y - stateHeight / 2,
1293
+ width: stateWidth,
1294
+ height: stateHeight,
1295
+ name: state.name,
1296
+ isInitial: state.isInitial,
1297
+ isTerminal: state.isTerminal,
1298
+ color
1299
+ },
1300
+ state.name
1301
+ );
1302
+ })
1303
+ ] });
1304
+ };
1305
+ AvlStateMachine.displayName = "AvlStateMachine";
1306
+ var avlOuId = 0;
1307
+ var AvlOrbitalUnit = ({
1308
+ entityName,
1309
+ fields = 4,
1310
+ persistence = "persistent",
1311
+ traits,
1312
+ pages,
1313
+ className,
1314
+ color = "var(--color-primary)",
1315
+ animated = false
1316
+ }) => {
1317
+ const ids = React6.useMemo(() => {
1318
+ avlOuId += 1;
1319
+ const base = `avl-ou-${avlOuId}`;
1320
+ return { glow: `${base}-glow`, grad: `${base}-grad` };
1321
+ }, []);
1322
+ const cx = 300;
1323
+ const cy = 200;
1324
+ const entityR = 24;
1325
+ const orbitalR = 130;
1326
+ const traitBaseRx = 55;
1327
+ const traitBaseRy = 24;
1328
+ const traitRxStep = 20;
1329
+ const traitRyStep = 8;
1330
+ const traitAngleStep = traits.length > 1 ? 120 / (traits.length - 1) : 0;
1331
+ const traitAngleStart = traits.length > 1 ? -60 : 0;
1332
+ const pageAngleStart = -Math.PI / 3;
1333
+ const pageAngleStep = pages.length > 1 ? Math.PI * 0.8 / (pages.length - 1) : 0;
1334
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1335
+ /* @__PURE__ */ jsxs("defs", { children: [
1336
+ /* @__PURE__ */ jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1337
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "3", result: "blur" }),
1338
+ /* @__PURE__ */ jsxs("feMerge", { children: [
1339
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
1340
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
1341
+ ] })
1342
+ ] }),
1343
+ /* @__PURE__ */ jsxs("radialGradient", { id: ids.grad, cx: "50%", cy: "50%", r: "50%", children: [
1344
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.08 }),
1345
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })
1346
+ ] })
1347
+ ] }),
1348
+ animated && /* @__PURE__ */ jsx("style", { children: `
1349
+ @keyframes avl-ou-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
1350
+ ` }),
1351
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: orbitalR + 20, fill: `url(#${ids.grad})` }),
1352
+ /* @__PURE__ */ jsx(AvlOrbital, { cx, cy, r: orbitalR, label: entityName, color }),
1353
+ traits.map((trait, i) => {
1354
+ const rotation = traitAngleStart + i * traitAngleStep;
1355
+ const traitColor = trait.color ?? color;
1356
+ return /* @__PURE__ */ jsx(
1357
+ AvlTrait,
1358
+ {
1359
+ cx,
1360
+ cy,
1361
+ rx: traitBaseRx + i * traitRxStep,
1362
+ ry: traitBaseRy + i * traitRyStep,
1363
+ rotation,
1364
+ label: trait.name,
1365
+ color: traitColor,
1366
+ opacity: 0.7
1367
+ },
1368
+ trait.name
1369
+ );
1370
+ }),
1371
+ /* @__PURE__ */ jsx(
1372
+ AvlEntity,
1373
+ {
1374
+ x: cx,
1375
+ y: cy,
1376
+ r: entityR,
1377
+ fieldCount: fields,
1378
+ persistence,
1379
+ color
1380
+ }
1381
+ ),
1382
+ pages.map((page, i) => {
1383
+ const angle = pageAngleStart + i * pageAngleStep;
1384
+ const px = cx + orbitalR * Math.cos(angle);
1385
+ const py = cy + orbitalR * Math.sin(angle);
1386
+ return /* @__PURE__ */ jsx(
1387
+ AvlPage,
1388
+ {
1389
+ x: px,
1390
+ y: py,
1391
+ size: 10,
1392
+ label: page.name,
1393
+ color
1394
+ },
1395
+ page.name
1396
+ );
1397
+ })
1398
+ ] });
1399
+ };
1400
+ AvlOrbitalUnit.displayName = "AvlOrbitalUnit";
1401
+ var avlCcId = 0;
1402
+ var AvlClosedCircuit = ({
1403
+ states,
1404
+ transitions,
1405
+ className,
1406
+ color = "var(--color-primary)",
1407
+ animated = false
1408
+ }) => {
1409
+ const ids = React6.useMemo(() => {
1410
+ avlCcId += 1;
1411
+ const base = `avl-cc-${avlCcId}`;
1412
+ return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
1413
+ }, []);
1414
+ const cx = 300;
1415
+ const cy = 200;
1416
+ const r = 120;
1417
+ const stateW = 80;
1418
+ const stateH = 32;
1419
+ const positions = ringPositions(cx, cy, r, states.length);
1420
+ const stateIndex = new Map(states.map((s, i) => [s.name, i]));
1421
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1422
+ /* @__PURE__ */ jsxs("defs", { children: [
1423
+ /* @__PURE__ */ jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1424
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
1425
+ /* @__PURE__ */ jsxs("feMerge", { children: [
1426
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
1427
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
1428
+ ] })
1429
+ ] }),
1430
+ /* @__PURE__ */ jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
1431
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
1432
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: color, stopOpacity: 0.4 }),
1433
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.15 })
1434
+ ] }),
1435
+ /* @__PURE__ */ jsx(
1436
+ "marker",
1437
+ {
1438
+ id: ids.arrow,
1439
+ markerWidth: "8",
1440
+ markerHeight: "6",
1441
+ refX: "7",
1442
+ refY: "3",
1443
+ orient: "auto",
1444
+ markerUnits: "strokeWidth",
1445
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1446
+ }
1447
+ )
1448
+ ] }),
1449
+ animated && /* @__PURE__ */ jsx("style", { children: `
1450
+ @keyframes avl-cc-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
1451
+ ` }),
1452
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: r + 30, fill: "none", stroke: color, strokeWidth: 0.3, opacity: 0.06 }),
1453
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: 50, fill: "none", stroke: color, strokeWidth: 0.5, opacity: 0.08 }),
1454
+ transitions.map((tr, i) => {
1455
+ const fromIdx = stateIndex.get(tr.from);
1456
+ const toIdx = stateIndex.get(tr.to);
1457
+ if (fromIdx === void 0 || toIdx === void 0) return null;
1458
+ const fp = positions[fromIdx];
1459
+ const tp = positions[toIdx];
1460
+ const dx = tp.x - fp.x;
1461
+ const dy = tp.y - fp.y;
1462
+ const dist = Math.sqrt(dx * dx + dy * dy) || 1;
1463
+ const nx = dx / dist;
1464
+ const ny = dy / dist;
1465
+ const x1 = fp.x + nx * (stateW / 2 + 4);
1466
+ const y1 = fp.y + ny * (stateH / 2 + 4);
1467
+ const x2 = tp.x - nx * (stateW / 2 + 8);
1468
+ const y2 = tp.y - ny * (stateH / 2 + 8);
1469
+ const mx = (x1 + x2) / 2;
1470
+ const my = (y1 + y2) / 2;
1471
+ const curvature = dist * 0.25;
1472
+ let perpX = -ny;
1473
+ let perpY = nx;
1474
+ const testX = mx + perpX * curvature;
1475
+ const testY = my + perpY * curvature;
1476
+ const distTest = Math.sqrt((testX - cx) ** 2 + (testY - cy) ** 2);
1477
+ const distMid = Math.sqrt((mx - cx) ** 2 + (my - cy) ** 2);
1478
+ if (distTest < distMid) {
1479
+ perpX = -perpX;
1480
+ perpY = -perpY;
1481
+ }
1482
+ const cpx = mx + perpX * curvature;
1483
+ const cpy = my + perpY * curvature;
1484
+ const d = `M${x1},${y1} Q${cpx},${cpy} ${x2},${y2}`;
1485
+ return /* @__PURE__ */ jsxs("g", { children: [
1486
+ /* @__PURE__ */ jsx(
1487
+ "path",
1488
+ {
1489
+ d,
1490
+ fill: "none",
1491
+ stroke: `url(#${ids.grad})`,
1492
+ strokeWidth: 1.5,
1493
+ strokeDasharray: animated ? "8 6" : void 0,
1494
+ markerEnd: `url(#${ids.arrow})`,
1495
+ style: animated ? { animation: "avl-cc-flow 1.5s linear infinite" } : void 0
1496
+ }
1497
+ ),
1498
+ tr.event && /* @__PURE__ */ jsx(
1499
+ AvlEvent,
1500
+ {
1501
+ x: cpx,
1502
+ y: cpy - 14,
1503
+ size: 8,
1504
+ label: tr.event,
1505
+ color,
1506
+ opacity: 0.8
1507
+ }
1508
+ ),
1509
+ tr.guard && /* @__PURE__ */ jsx(
1510
+ AvlGuard,
1511
+ {
1512
+ x: mx,
1513
+ y: my - 8,
1514
+ size: 10,
1515
+ label: tr.guard,
1516
+ color,
1517
+ opacity: 0.6
1518
+ }
1519
+ ),
1520
+ tr.effects?.map((eff, j) => /* @__PURE__ */ jsx(
1521
+ AvlEffect,
1522
+ {
1523
+ x: mx + (j - ((tr.effects?.length ?? 1) - 1) / 2) * 14,
1524
+ y: my + 14,
1525
+ effectType: eff,
1526
+ size: 5,
1527
+ color,
1528
+ opacity: 0.7
1529
+ },
1530
+ j
1531
+ ))
1532
+ ] }, `cc-tr-${i}`);
1533
+ }),
1534
+ states.map((state, i) => {
1535
+ const pos = positions[i];
1536
+ return /* @__PURE__ */ jsx(
1537
+ AvlState,
1538
+ {
1539
+ x: pos.x - stateW / 2,
1540
+ y: pos.y - stateH / 2,
1541
+ width: stateW,
1542
+ height: stateH,
1543
+ name: state.name,
1544
+ color
1545
+ },
1546
+ state.name
1547
+ );
1548
+ }),
1549
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: 3, fill: color, opacity: 0.4 })
1550
+ ] });
1551
+ };
1552
+ AvlClosedCircuit.displayName = "AvlClosedCircuit";
1553
+ var avlElId = 0;
1554
+ var AvlEmitListen = ({
1555
+ emitter,
1556
+ listener,
1557
+ eventName,
1558
+ className,
1559
+ color = "var(--color-primary)",
1560
+ animated = false
1561
+ }) => {
1562
+ const ids = React6.useMemo(() => {
1563
+ avlElId += 1;
1564
+ const base = `avl-el-${avlElId}`;
1565
+ return { arrow: `${base}-arrow`, grad: `${base}-grad` };
1566
+ }, []);
1567
+ const leftCx = 180;
1568
+ const rightCx = 420;
1569
+ const cy = 200;
1570
+ const orbR = 80;
1571
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1572
+ /* @__PURE__ */ jsxs("defs", { children: [
1573
+ /* @__PURE__ */ jsx(
1574
+ "marker",
1575
+ {
1576
+ id: ids.arrow,
1577
+ markerWidth: "8",
1578
+ markerHeight: "6",
1579
+ refX: "7",
1580
+ refY: "3",
1581
+ orient: "auto",
1582
+ markerUnits: "strokeWidth",
1583
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L8,3 L0,6 Z", fill: color, opacity: 0.6 })
1584
+ }
1585
+ ),
1586
+ /* @__PURE__ */ jsxs("linearGradient", { id: ids.grad, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
1587
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.5 }),
1588
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.2 })
1589
+ ] })
1590
+ ] }),
1591
+ animated && /* @__PURE__ */ jsx("style", { children: `
1592
+ @keyframes avl-el-dash { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
1593
+ ` }),
1594
+ /* @__PURE__ */ jsx(AvlOrbital, { cx: leftCx, cy, r: orbR, label: emitter.name, color }),
1595
+ /* @__PURE__ */ jsx(AvlEntity, { x: leftCx, y: cy, r: 18, fieldCount: emitter.fields ?? 3, color }),
1596
+ /* @__PURE__ */ jsx(AvlOrbital, { cx: rightCx, cy, r: orbR, label: listener.name, color }),
1597
+ /* @__PURE__ */ jsx(AvlEntity, { x: rightCx, y: cy, r: 18, fieldCount: listener.fields ?? 3, color }),
1598
+ /* @__PURE__ */ jsx(
1599
+ "path",
1600
+ {
1601
+ d: `M${leftCx + orbR + 4},${cy} L${rightCx - orbR - 8},${cy}`,
1602
+ fill: "none",
1603
+ stroke: `url(#${ids.grad})`,
1604
+ strokeWidth: 2,
1605
+ strokeDasharray: "6 4",
1606
+ markerEnd: `url(#${ids.arrow})`,
1607
+ style: animated ? { animation: "avl-el-dash 1s linear infinite" } : void 0
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ jsx(
1611
+ AvlEffect,
1612
+ {
1613
+ x: leftCx + orbR + 20,
1614
+ y: cy - 20,
1615
+ effectType: "emit",
1616
+ size: 6,
1617
+ color,
1618
+ opacity: 0.8
1619
+ }
1620
+ ),
1621
+ eventName && /* @__PURE__ */ jsxs(
1622
+ "text",
1623
+ {
1624
+ x: 300,
1625
+ y: cy - 18,
1626
+ textAnchor: "middle",
1627
+ fill: color,
1628
+ fontSize: 11,
1629
+ fontFamily: "inherit",
1630
+ fontWeight: "bold",
1631
+ opacity: 0.8,
1632
+ children: [
1633
+ "~",
1634
+ eventName
1635
+ ]
1636
+ }
1637
+ ),
1638
+ /* @__PURE__ */ jsx(
1639
+ "text",
1640
+ {
1641
+ x: 300,
1642
+ y: cy + 18,
1643
+ textAnchor: "middle",
1644
+ fill: color,
1645
+ fontSize: 12,
1646
+ fontFamily: "inherit",
1647
+ opacity: 0.3,
1648
+ letterSpacing: 4,
1649
+ children: "~ ~ ~"
1650
+ }
1651
+ )
1652
+ ] });
1653
+ };
1654
+ AvlEmitListen.displayName = "AvlEmitListen";
1655
+ var SLOT_PRESETS = {
1656
+ header: { x: 10, y: 5, width: 340, height: 35 },
1657
+ main: { x: 120, y: 50, width: 230, height: 195 },
1658
+ sidebar: { x: 10, y: 50, width: 100, height: 195 },
1659
+ modal: { x: 80, y: 60, width: 200, height: 140 },
1660
+ drawer: { x: 220, y: 50, width: 130, height: 195 },
1661
+ toast: { x: 220, y: 210, width: 130, height: 35 },
1662
+ footer: { x: 10, y: 220, width: 340, height: 30 },
1663
+ center: { x: 60, y: 50, width: 240, height: 195 },
1664
+ "hud-top": { x: 10, y: 5, width: 340, height: 30 },
1665
+ "hud-bottom": { x: 10, y: 220, width: 340, height: 30 }
1666
+ };
1667
+ function resolveSlot(slot, fallbackIdx) {
1668
+ if (slot.x !== void 0 && slot.y !== void 0 && slot.width !== void 0 && slot.height !== void 0) {
1669
+ return slot;
1670
+ }
1671
+ const preset = SLOT_PRESETS[slot.name];
1672
+ if (preset) {
1673
+ return {
1674
+ name: slot.name,
1675
+ x: slot.x ?? preset.x,
1676
+ y: slot.y ?? preset.y,
1677
+ width: slot.width ?? preset.width,
1678
+ height: slot.height ?? preset.height
1679
+ };
1680
+ }
1681
+ const col = fallbackIdx % 2;
1682
+ const row = Math.floor(fallbackIdx / 2);
1683
+ return {
1684
+ name: slot.name,
1685
+ x: 10 + col * 175,
1686
+ y: 50 + row * 100,
1687
+ width: 165,
1688
+ height: 90
1689
+ };
1690
+ }
1691
+ var AvlSlotMap = ({
1692
+ slots,
1693
+ pageWidth = 360,
1694
+ pageHeight = 280,
1695
+ className,
1696
+ color = "var(--color-primary)",
1697
+ animated = false
1698
+ }) => {
1699
+ const ox = (600 - pageWidth) / 2;
1700
+ const oy = (400 - pageHeight) / 2;
1701
+ let unknownIdx = 0;
1702
+ const resolvedSlots = slots.map((slot) => {
1703
+ const isUnknown = !SLOT_PRESETS[slot.name] && (slot.x === void 0 || slot.y === void 0);
1704
+ const resolved = resolveSlot(slot, isUnknown ? unknownIdx : 0);
1705
+ if (isUnknown) unknownIdx++;
1706
+ return resolved;
1707
+ });
1708
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1709
+ animated && /* @__PURE__ */ jsx("style", { children: `
1710
+ @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
1711
+ ` }),
1712
+ /* @__PURE__ */ jsx(
1713
+ "rect",
1714
+ {
1715
+ x: ox,
1716
+ y: oy,
1717
+ width: pageWidth,
1718
+ height: pageHeight,
1719
+ rx: 4,
1720
+ ry: 4,
1721
+ fill: "none",
1722
+ stroke: color,
1723
+ strokeWidth: 2
1724
+ }
1725
+ ),
1726
+ /* @__PURE__ */ jsx(
1727
+ "rect",
1728
+ {
1729
+ x: ox,
1730
+ y: oy,
1731
+ width: pageWidth,
1732
+ height: 24,
1733
+ rx: 4,
1734
+ ry: 4,
1735
+ fill: color,
1736
+ opacity: 0.1
1737
+ }
1738
+ ),
1739
+ /* @__PURE__ */ jsx(
1740
+ "text",
1741
+ {
1742
+ x: ox + pageWidth / 2,
1743
+ y: oy + 16,
1744
+ textAnchor: "middle",
1745
+ fill: color,
1746
+ fontSize: 10,
1747
+ fontFamily: "inherit",
1748
+ fontWeight: "bold",
1749
+ children: "Page Layout"
1750
+ }
1751
+ ),
1752
+ resolvedSlots.map((slot) => /* @__PURE__ */ jsxs("g", { children: [
1753
+ /* @__PURE__ */ jsx(
1754
+ "rect",
1755
+ {
1756
+ x: ox + slot.x,
1757
+ y: oy + 24 + slot.y,
1758
+ width: slot.width,
1759
+ height: slot.height,
1760
+ rx: 3,
1761
+ ry: 3,
1762
+ fill: color,
1763
+ opacity: 0.08,
1764
+ stroke: color,
1765
+ strokeWidth: 1,
1766
+ strokeDasharray: "4 2",
1767
+ style: animated ? { animation: "avl-slot-pulse 2s ease-in-out infinite" } : void 0
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ jsx(
1771
+ "text",
1772
+ {
1773
+ x: ox + slot.x + slot.width / 2,
1774
+ y: oy + 24 + slot.y + slot.height / 2,
1775
+ textAnchor: "middle",
1776
+ dominantBaseline: "central",
1777
+ fill: color,
1778
+ fontSize: 9,
1779
+ fontFamily: "inherit",
1780
+ opacity: 0.6,
1781
+ children: slot.name
1782
+ }
1783
+ )
1784
+ ] }, slot.name))
1785
+ ] });
1786
+ };
1787
+ AvlSlotMap.displayName = "AvlSlotMap";
1788
+ var avlEtId = 0;
1789
+ function layoutTree(node, x, y, hSpacing, vSpacing) {
1790
+ const children = node.children ?? [];
1791
+ if (children.length === 0) {
1792
+ return { label: node.label, type: node.type, x, y, children: [] };
1793
+ }
1794
+ const totalWidth = (children.length - 1) * hSpacing;
1795
+ const startX = x - totalWidth / 2;
1796
+ const layoutChildren = children.map(
1797
+ (child, i) => layoutTree(child, startX + i * hSpacing, y + vSpacing, hSpacing * 0.65, vSpacing)
1798
+ );
1799
+ return { label: node.label, type: node.type, x, y, children: layoutChildren };
1800
+ }
1801
+ function nodeColor(type, baseColor) {
1802
+ switch (type) {
1803
+ case "operator":
1804
+ return baseColor;
1805
+ case "literal":
1806
+ return baseColor;
1807
+ case "binding":
1808
+ return baseColor;
1809
+ }
1810
+ }
1811
+ function renderNode(node, color, glowId) {
1812
+ const labelLen = node.label.length;
1813
+ const baseR = node.type === "operator" ? 20 : 16;
1814
+ const r = Math.max(baseR, labelLen * 3.5 + 6);
1815
+ const nc = nodeColor(node.type, color);
1816
+ return /* @__PURE__ */ jsxs(React6.Fragment, { children: [
1817
+ node.children.map((child, i) => {
1818
+ const childR = Math.max(
1819
+ child.type === "operator" ? 20 : 16,
1820
+ child.label.length * 3.5 + 6
1821
+ );
1822
+ return /* @__PURE__ */ jsx(
1823
+ "line",
1824
+ {
1825
+ x1: node.x,
1826
+ y1: node.y + (node.type === "operator" ? r * 0.7 : r),
1827
+ x2: child.x,
1828
+ y2: child.y - (child.type === "operator" ? childR * 0.7 : childR),
1829
+ stroke: color,
1830
+ strokeWidth: 1,
1831
+ opacity: 0.3
1832
+ },
1833
+ `line-${i}`
1834
+ );
1835
+ }),
1836
+ node.type === "operator" ? /* @__PURE__ */ jsx(
1837
+ "rect",
1838
+ {
1839
+ x: node.x - r,
1840
+ y: node.y - r * 0.6,
1841
+ width: r * 2,
1842
+ height: r * 1.2,
1843
+ rx: 4,
1844
+ ry: 4,
1845
+ fill: color,
1846
+ fillOpacity: 0.15,
1847
+ stroke: nc,
1848
+ strokeWidth: 1.5
1849
+ }
1850
+ ) : node.type === "binding" ? /* @__PURE__ */ jsx("circle", { cx: node.x, cy: node.y, r, fill: "none", stroke: nc, strokeWidth: 1.5, strokeDasharray: "3 2" }) : /* @__PURE__ */ jsx("circle", { cx: node.x, cy: node.y, r, fill: "none", stroke: nc, strokeWidth: 1, opacity: 0.5 }),
1851
+ /* @__PURE__ */ jsx(
1852
+ "text",
1853
+ {
1854
+ x: node.x,
1855
+ y: node.y + 1,
1856
+ textAnchor: "middle",
1857
+ dominantBaseline: "central",
1858
+ fill: nc,
1859
+ fontSize: node.type === "operator" ? 11 : 10,
1860
+ fontFamily: "inherit",
1861
+ fontWeight: node.type === "operator" ? "bold" : "normal",
1862
+ children: node.type === "binding" ? `@${node.label}` : node.label
1863
+ }
1864
+ ),
1865
+ node.children.map((child) => renderNode(child, color))
1866
+ ] }, `${node.label}-${node.x}-${node.y}`);
1867
+ }
1868
+ var AvlExprTree = ({
1869
+ expression,
1870
+ className,
1871
+ color = "var(--color-primary)"
1872
+ }) => {
1873
+ const ids = React6.useMemo(() => {
1874
+ avlEtId += 1;
1875
+ return { glow: `avl-et-${avlEtId}-glow` };
1876
+ }, []);
1877
+ const layout = layoutTree(expression, 300, 70, 150, 85);
1878
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
1879
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: ids.glow, x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
1880
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
1881
+ /* @__PURE__ */ jsxs("feMerge", { children: [
1882
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
1883
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
1884
+ ] })
1885
+ ] }) }),
1886
+ renderNode(layout, color, ids.glow)
1887
+ ] });
1888
+ };
1889
+ AvlExprTree.displayName = "AvlExprTree";
1890
+
1891
+ export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, AvlApplication, AvlBinding, AvlBindingRef, AvlClosedCircuit, AvlEffect, AvlEmitListen, AvlEntity, AvlEvent, AvlExprTree, AvlField, AvlFieldType, AvlGuard, AvlLiteral, AvlOperator, AvlOrbital, AvlOrbitalUnit, AvlPage, AvlPersistence, AvlSExpr, AvlSlotMap, AvlState, AvlStateMachine, AvlTrait, AvlTransition, arcPath, curveControlPoint, gridPositions, radialPositions, ringPositions };