@almadar/ui 5.25.1 → 5.26.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 (63) hide show
  1. package/dist/avl/index.cjs +2210 -2295
  2. package/dist/avl/index.js +1159 -1244
  3. package/dist/components/core/atoms/FlipContainer.d.ts +4 -4
  4. package/dist/components/core/atoms/Icon.d.ts +4 -2
  5. package/dist/components/core/atoms/ProgressBar.d.ts +1 -1
  6. package/dist/components/core/atoms/svg/SvgBranch.d.ts +6 -2
  7. package/dist/components/core/atoms/svg/SvgConnection.d.ts +8 -4
  8. package/dist/components/core/atoms/svg/SvgFlow.d.ts +5 -1
  9. package/dist/components/core/atoms/svg/SvgGrid.d.ts +6 -2
  10. package/dist/components/core/atoms/svg/SvgLobe.d.ts +6 -2
  11. package/dist/components/core/atoms/svg/SvgMesh.d.ts +6 -2
  12. package/dist/components/core/atoms/svg/SvgMorph.d.ts +6 -2
  13. package/dist/components/core/atoms/svg/SvgNode.d.ts +6 -2
  14. package/dist/components/core/atoms/svg/SvgPulse.d.ts +6 -2
  15. package/dist/components/core/atoms/svg/SvgRing.d.ts +6 -2
  16. package/dist/components/core/atoms/svg/SvgShield.d.ts +6 -2
  17. package/dist/components/core/atoms/svg/SvgStack.d.ts +6 -2
  18. package/dist/components/core/atoms/types.d.ts +6 -0
  19. package/dist/components/core/molecules/ArrayEditor.d.ts +15 -0
  20. package/dist/components/core/molecules/Carousel.d.ts +8 -2
  21. package/dist/components/core/molecules/Container.d.ts +4 -4
  22. package/dist/components/core/molecules/DateRangeSelector.d.ts +3 -4
  23. package/dist/components/core/molecules/DocSidebar.d.ts +4 -4
  24. package/dist/components/core/molecules/EdgeDecoration.d.ts +3 -2
  25. package/dist/components/core/molecules/Flex.d.ts +4 -4
  26. package/dist/components/core/molecules/FlipCard.d.ts +3 -4
  27. package/dist/components/core/molecules/GradientDivider.d.ts +3 -2
  28. package/dist/components/core/molecules/MapEditor.d.ts +16 -0
  29. package/dist/components/core/molecules/ObjectEditor.d.ts +15 -0
  30. package/dist/components/core/molecules/SidePanel.d.ts +4 -4
  31. package/dist/components/core/molecules/SortableList.d.ts +4 -5
  32. package/dist/components/core/molecules/ViolationAlert.d.ts +4 -9
  33. package/dist/components/core/molecules/index.d.ts +4 -3
  34. package/dist/components/core/molecules/markdown/CodeBlock.d.ts +44 -2
  35. package/dist/components/core/molecules/markdown/MarkdownContent.d.ts +2 -2
  36. package/dist/components/game/atoms/ResourceCounter.d.ts +3 -2
  37. package/dist/components/game/atoms/StateIndicator.d.ts +4 -5
  38. package/dist/components/game/atoms/StatusEffect.d.ts +2 -3
  39. package/dist/components/game/molecules/ActionButtons.d.ts +6 -0
  40. package/dist/components/game/molecules/GameHud.d.ts +2 -3
  41. package/dist/components/game/molecules/StatBadge.d.ts +6 -0
  42. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +16 -0
  43. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  44. package/dist/components/index.cjs +2458 -2092
  45. package/dist/components/index.js +1558 -1192
  46. package/dist/docs/index.cjs +6021 -4606
  47. package/dist/docs/index.css +1252 -0
  48. package/dist/docs/index.d.cts +108 -16
  49. package/dist/docs/index.d.ts +2 -2
  50. package/dist/docs/index.js +5977 -4567
  51. package/dist/hooks/index.cjs +9 -2
  52. package/dist/hooks/index.js +9 -2
  53. package/dist/marketing/index.cjs +32 -9
  54. package/dist/marketing/index.d.cts +30 -20
  55. package/dist/marketing/index.js +32 -9
  56. package/dist/providers/index.cjs +2035 -2120
  57. package/dist/providers/index.js +1134 -1219
  58. package/dist/runtime/index.cjs +2075 -2160
  59. package/dist/runtime/index.js +1138 -1223
  60. package/package.json +1 -1
  61. package/dist/components/core/molecules/CodeViewer.d.ts +0 -70
  62. package/dist/components/core/molecules/DocCodeBlock.d.ts +0 -14
  63. package/dist/components/game/organisms/puzzles/state-architect/CodeView.d.ts +0 -24
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import * as React81 from 'react';
3
- import React81__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
2
+ import * as React79 from 'react';
3
+ import React79__default, { useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, lazy, createContext, useLayoutEffect, useId, useSyncExternalStore } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
7
7
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
8
8
  import * as LucideIcons2 from 'lucide-react';
9
- import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, CheckCircle, XCircle, Wrench, RotateCcw, Send, Search, ChevronUp, ChevronDown, MoreHorizontal, Bug, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, ArrowRight, Pause, Play, SkipForward, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Code, GitBranch, Plus, Trash, ArrowLeft, Menu as Menu$1, Check, AlertTriangle, Trash2, Eraser, FileText, ZoomOut, Download, WrapText, Copy, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
9
+ import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, CheckCircle, XCircle, Wrench, RotateCcw, Send, Search, ChevronUp, ChevronDown, MoreHorizontal, Bug, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ZoomIn, ArrowRight, Pause, Play, SkipForward, TrendingUp, TrendingDown, Minus, AlertCircle, Circle, Clock, CheckCircle2, Code, FileText, WrapText, Check, Copy, HelpCircle, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, GitBranch, Plus, Trash, ArrowLeft, Menu as Menu$1, AlertTriangle, Trash2, Eraser, ZoomOut, Download, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
10
10
  import * as PhosphorIcons from '@phosphor-icons/react';
11
11
  import * as TablerIcons from '@tabler/icons-react';
12
12
  import * as FaIcons from 'react-icons/fa';
@@ -116,18 +116,22 @@ var init_SvgBranch = __esm({
116
116
  "components/core/atoms/svg/SvgBranch.tsx"() {
117
117
  "use client";
118
118
  SvgBranch = ({
119
- x,
120
- y,
119
+ x = 5,
120
+ y = 50,
121
121
  variant = "fork",
122
122
  branches = 2,
123
123
  size = 1,
124
124
  color = "var(--color-primary)",
125
125
  opacity = 1,
126
- className
126
+ className,
127
+ asRoot = true,
128
+ width = 100,
129
+ height = 100
127
130
  }) => {
131
+ let inner;
128
132
  if (variant === "diamond") {
129
133
  const points = buildDiamondPoints(x, y, size);
130
- return /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
134
+ inner = /* @__PURE__ */ jsx("g", { className, opacity, children: /* @__PURE__ */ jsx(
131
135
  "polygon",
132
136
  {
133
137
  points,
@@ -137,23 +141,28 @@ var init_SvgBranch = __esm({
137
141
  strokeLinejoin: "round"
138
142
  }
139
143
  ) });
144
+ } else {
145
+ const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
146
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
147
+ paths.map((d, i) => /* @__PURE__ */ jsx(
148
+ "path",
149
+ {
150
+ d,
151
+ fill: "none",
152
+ stroke: color,
153
+ strokeWidth: 2,
154
+ strokeLinecap: "round"
155
+ },
156
+ i
157
+ )),
158
+ variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
159
+ variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
160
+ ] });
140
161
  }
141
- const paths = variant === "fork" ? buildForkPaths(x, y, branches, size) : buildMergePaths(x, y, branches, size);
142
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
143
- paths.map((d, i) => /* @__PURE__ */ jsx(
144
- "path",
145
- {
146
- d,
147
- fill: "none",
148
- stroke: color,
149
- strokeWidth: 2,
150
- strokeLinecap: "round"
151
- },
152
- i
153
- )),
154
- variant === "fork" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color }),
155
- variant === "merge" && /* @__PURE__ */ jsx("circle", { cx: x + 30 * size, cy: y, r: 3, fill: color })
156
- ] });
162
+ if (asRoot) {
163
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
164
+ }
165
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
157
166
  };
158
167
  SvgBranch.displayName = "SvgBranch";
159
168
  }
@@ -163,20 +172,23 @@ var init_SvgConnection = __esm({
163
172
  "components/core/atoms/svg/SvgConnection.tsx"() {
164
173
  "use client";
165
174
  SvgConnection = ({
166
- x1,
167
- y1,
168
- x2,
169
- y2,
175
+ x1 = 10,
176
+ y1 = 50,
177
+ x2 = 90,
178
+ y2 = 50,
170
179
  variant = "solid",
171
180
  color = "var(--color-primary)",
172
181
  strokeWidth = 1.5,
173
182
  opacity = 1,
174
- className
183
+ className,
184
+ asRoot = true,
185
+ width = 100,
186
+ height = 100
175
187
  }) => {
176
188
  const dashProps = variant === "solid" ? {} : {
177
189
  strokeDasharray: "8 6"
178
190
  };
179
- return /* @__PURE__ */ jsx(
191
+ const inner = /* @__PURE__ */ jsx(
180
192
  "line",
181
193
  {
182
194
  className: [
@@ -194,24 +206,32 @@ var init_SvgConnection = __esm({
194
206
  ...dashProps
195
207
  }
196
208
  );
209
+ if (asRoot) {
210
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
211
+ }
212
+ return inner;
197
213
  };
198
214
  SvgConnection.displayName = "SvgConnection";
199
215
  }
200
216
  });
201
- var flowIdCounter, SvgFlow;
217
+ var flowIdCounter, DEFAULT_POINTS, SvgFlow;
202
218
  var init_SvgFlow = __esm({
203
219
  "components/core/atoms/svg/SvgFlow.tsx"() {
204
220
  "use client";
205
221
  flowIdCounter = 0;
222
+ DEFAULT_POINTS = [[10, 50], [50, 20], [90, 50]];
206
223
  SvgFlow = ({
207
- points,
224
+ points = DEFAULT_POINTS,
208
225
  color = "var(--color-primary)",
209
226
  strokeWidth = 1.5,
210
227
  animated = false,
211
228
  opacity = 1,
212
- className
229
+ className,
230
+ asRoot = true,
231
+ width = 100,
232
+ height = 100
213
233
  }) => {
214
- const markerId = React81__default.useMemo(() => {
234
+ const markerId = React79__default.useMemo(() => {
215
235
  flowIdCounter += 1;
216
236
  return `almadar-flow-arrow-${flowIdCounter}`;
217
237
  }, []);
@@ -219,7 +239,7 @@ var init_SvgFlow = __esm({
219
239
  return null;
220
240
  }
221
241
  const pathData = points.map((pt, i) => `${i === 0 ? "M" : "L"}${pt[0]},${pt[1]}`).join(" ");
222
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
242
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
223
243
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
224
244
  "marker",
225
245
  {
@@ -248,6 +268,10 @@ var init_SvgFlow = __esm({
248
268
  }
249
269
  )
250
270
  ] });
271
+ if (asRoot) {
272
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
273
+ }
274
+ return inner;
251
275
  };
252
276
  SvgFlow.displayName = "SvgFlow";
253
277
  }
@@ -257,8 +281,8 @@ var init_SvgGrid = __esm({
257
281
  "components/core/atoms/svg/SvgGrid.tsx"() {
258
282
  "use client";
259
283
  SvgGrid = ({
260
- x,
261
- y,
284
+ x = 10,
285
+ y = 10,
262
286
  cols = 4,
263
287
  rows: rows2 = 3,
264
288
  spacing = 20,
@@ -266,10 +290,13 @@ var init_SvgGrid = __esm({
266
290
  color = "var(--color-primary)",
267
291
  opacity = 1,
268
292
  className,
269
- highlights = []
293
+ highlights = [],
294
+ asRoot = true,
295
+ width = 100,
296
+ height = 100
270
297
  }) => {
271
298
  const highlightSet = new Set(highlights);
272
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
299
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
273
300
  (_, row) => Array.from({ length: cols }).map((_2, col) => {
274
301
  const index = row * cols + col;
275
302
  const isHighlighted = highlightSet.has(index);
@@ -288,6 +315,10 @@ var init_SvgGrid = __esm({
288
315
  );
289
316
  })
290
317
  ) });
318
+ if (asRoot) {
319
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
320
+ }
321
+ return inner;
291
322
  };
292
323
  SvgGrid.displayName = "SvgGrid";
293
324
  }
@@ -297,15 +328,18 @@ var init_SvgLobe = __esm({
297
328
  "components/core/atoms/svg/SvgLobe.tsx"() {
298
329
  "use client";
299
330
  SvgLobe = ({
300
- cx,
301
- cy,
331
+ cx = 50,
332
+ cy = 50,
302
333
  rx = 14,
303
334
  ry = 20,
304
335
  rotation = 0,
305
336
  shells = 2,
306
337
  color = "var(--color-primary)",
307
338
  opacity = 1,
308
- className
339
+ className,
340
+ asRoot = true,
341
+ width = 100,
342
+ height = 100
309
343
  }) => {
310
344
  const clampedShells = Math.max(1, Math.min(3, shells));
311
345
  const renderShell = (shellIndex) => {
@@ -340,7 +374,7 @@ var init_SvgLobe = __esm({
340
374
  )
341
375
  ] }, shellIndex);
342
376
  };
343
- return /* @__PURE__ */ jsx(
377
+ const inner = /* @__PURE__ */ jsx(
344
378
  "g",
345
379
  {
346
380
  className,
@@ -349,6 +383,10 @@ var init_SvgLobe = __esm({
349
383
  children: Array.from({ length: clampedShells }, (_, i) => renderShell(i))
350
384
  }
351
385
  );
386
+ if (asRoot) {
387
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
388
+ }
389
+ return inner;
352
390
  };
353
391
  SvgLobe.displayName = "SvgLobe";
354
392
  }
@@ -377,18 +415,21 @@ var init_SvgMesh = __esm({
377
415
  "components/core/atoms/svg/SvgMesh.tsx"() {
378
416
  "use client";
379
417
  SvgMesh = ({
380
- cx,
381
- cy,
418
+ cx = 60,
419
+ cy = 60,
382
420
  nodes = 6,
383
421
  radius = 50,
384
422
  color = "var(--color-primary)",
385
423
  connectionDensity = 0.5,
386
424
  opacity = 1,
387
- className
425
+ className,
426
+ asRoot = true,
427
+ width = 120,
428
+ height = 120
388
429
  }) => {
389
430
  const positions = getNodePositions(cx, cy, nodes, radius);
390
431
  const connections = getConnections(nodes, connectionDensity);
391
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
432
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
392
433
  connections.map(([a, b]) => /* @__PURE__ */ jsx(
393
434
  "line",
394
435
  {
@@ -413,6 +454,10 @@ var init_SvgMesh = __esm({
413
454
  i
414
455
  ))
415
456
  ] });
457
+ if (asRoot) {
458
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
459
+ }
460
+ return inner;
416
461
  };
417
462
  SvgMesh.displayName = "SvgMesh";
418
463
  }
@@ -554,74 +599,82 @@ var init_SvgMorph = __esm({
554
599
  };
555
600
  FlowArrow.displayName = "FlowArrow";
556
601
  SvgMorph = ({
557
- x,
558
- y,
602
+ x = 5,
603
+ y = 10,
559
604
  size = 1,
560
605
  variant = "generic",
561
606
  color = "var(--color-primary)",
562
607
  opacity = 1,
563
- className
608
+ className,
609
+ asRoot = true,
610
+ width = 130,
611
+ height = 50
564
612
  }) => {
565
613
  const gap = 40 * size;
566
614
  const midY = y + 10 * size;
615
+ let inner;
567
616
  if (variant === "text-to-code") {
568
617
  const leftEnd = x + 30 * size;
569
618
  const rightStart = leftEnd + gap;
570
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
619
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
571
620
  /* @__PURE__ */ jsx(TextLines, { x, y, scale: size, color }),
572
621
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
573
622
  /* @__PURE__ */ jsx(CodeBrackets, { x: rightStart, y, scale: size, color })
574
623
  ] });
575
- }
576
- if (variant === "code-to-app") {
624
+ } else if (variant === "code-to-app") {
577
625
  const leftEnd = x + 26 * size;
578
626
  const rightStart = leftEnd + gap;
579
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
627
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
580
628
  /* @__PURE__ */ jsx(CodeBrackets, { x, y, scale: size, color }),
581
629
  /* @__PURE__ */ jsx(FlowArrow, { x1: leftEnd, y: midY, x2: rightStart, scale: size, color }),
582
630
  /* @__PURE__ */ jsx(AppRect, { x: rightStart, y, scale: size, color })
583
631
  ] });
632
+ } else {
633
+ const circleR = 10 * size;
634
+ const circleX = x + circleR;
635
+ const squareStart = x + circleR * 2 + gap;
636
+ const squareSize = circleR * 2;
637
+ inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
638
+ /* @__PURE__ */ jsx(
639
+ "circle",
640
+ {
641
+ cx: circleX,
642
+ cy: midY,
643
+ r: circleR,
644
+ fill: "none",
645
+ stroke: color,
646
+ strokeWidth: 2 * size
647
+ }
648
+ ),
649
+ /* @__PURE__ */ jsx(
650
+ FlowArrow,
651
+ {
652
+ x1: circleX + circleR + 2 * size,
653
+ y: midY,
654
+ x2: squareStart,
655
+ scale: size,
656
+ color
657
+ }
658
+ ),
659
+ /* @__PURE__ */ jsx(
660
+ "rect",
661
+ {
662
+ x: squareStart,
663
+ y: midY - circleR,
664
+ width: squareSize,
665
+ height: squareSize,
666
+ rx: 3 * size,
667
+ fill: "none",
668
+ stroke: color,
669
+ strokeWidth: 2 * size
670
+ }
671
+ )
672
+ ] });
584
673
  }
585
- const circleR = 10 * size;
586
- const circleX = x + circleR;
587
- const squareStart = x + circleR * 2 + gap;
588
- const squareSize = circleR * 2;
589
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
590
- /* @__PURE__ */ jsx(
591
- "circle",
592
- {
593
- cx: circleX,
594
- cy: midY,
595
- r: circleR,
596
- fill: "none",
597
- stroke: color,
598
- strokeWidth: 2 * size
599
- }
600
- ),
601
- /* @__PURE__ */ jsx(
602
- FlowArrow,
603
- {
604
- x1: circleX + circleR + 2 * size,
605
- y: midY,
606
- x2: squareStart,
607
- scale: size,
608
- color
609
- }
610
- ),
611
- /* @__PURE__ */ jsx(
612
- "rect",
613
- {
614
- x: squareStart,
615
- y: midY - circleR,
616
- width: squareSize,
617
- height: squareSize,
618
- rx: 3 * size,
619
- fill: "none",
620
- stroke: color,
621
- strokeWidth: 2 * size
622
- }
623
- )
624
- ] });
674
+ if (asRoot) {
675
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
676
+ }
677
+ return /* @__PURE__ */ jsx(Fragment, { children: inner });
625
678
  };
626
679
  SvgMorph.displayName = "SvgMorph";
627
680
  }
@@ -631,16 +684,19 @@ var init_SvgNode = __esm({
631
684
  "components/core/atoms/svg/SvgNode.tsx"() {
632
685
  "use client";
633
686
  SvgNode = ({
634
- x,
635
- y,
687
+ x = 50,
688
+ y = 50,
636
689
  r = 6,
637
690
  variant = "filled",
638
691
  color = "var(--color-primary)",
639
692
  opacity = 1,
640
693
  className,
641
- label
694
+ label,
695
+ asRoot = true,
696
+ width = 100,
697
+ height = 100
642
698
  }) => {
643
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
699
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
644
700
  variant === "pulse" && /* @__PURE__ */ jsx(
645
701
  "circle",
646
702
  {
@@ -678,6 +734,10 @@ var init_SvgNode = __esm({
678
734
  }
679
735
  )
680
736
  ] });
737
+ if (asRoot) {
738
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
739
+ }
740
+ return inner;
681
741
  };
682
742
  SvgNode.displayName = "SvgNode";
683
743
  }
@@ -699,16 +759,19 @@ var init_SvgPulse = __esm({
699
759
  }
700
760
  `;
701
761
  SvgPulse = ({
702
- cx,
703
- cy,
762
+ cx = 70,
763
+ cy = 70,
704
764
  rings = 3,
705
765
  maxRadius = 60,
706
766
  color = "var(--color-primary)",
707
767
  animated = true,
708
768
  opacity = 1,
709
- className
769
+ className,
770
+ asRoot = true,
771
+ width = 140,
772
+ height = 140
710
773
  }) => {
711
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
774
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
712
775
  animated && /* @__PURE__ */ jsx("style", { children: PULSE_KEYFRAMES }),
713
776
  Array.from({ length: rings }).map((_, i) => {
714
777
  const ringRadius = (i + 1) / rings * maxRadius;
@@ -734,6 +797,10 @@ var init_SvgPulse = __esm({
734
797
  }),
735
798
  /* @__PURE__ */ jsx("circle", { cx, cy, r: 3, fill: color })
736
799
  ] });
800
+ if (asRoot) {
801
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
802
+ }
803
+ return inner;
737
804
  };
738
805
  SvgPulse.displayName = "SvgPulse";
739
806
  }
@@ -744,21 +811,24 @@ var init_SvgRing = __esm({
744
811
  "use client";
745
812
  ringIdCounter = 0;
746
813
  SvgRing = ({
747
- cx,
748
- cy,
814
+ cx = 50,
815
+ cy = 50,
749
816
  r = 40,
750
817
  variant = "solid",
751
818
  color = "var(--color-primary)",
752
819
  strokeWidth = 1.5,
753
820
  opacity = 1,
754
821
  className,
755
- label
822
+ label,
823
+ asRoot = true,
824
+ width = 100,
825
+ height = 100
756
826
  }) => {
757
- const gradientId = React81__default.useMemo(() => {
827
+ const gradientId = React79__default.useMemo(() => {
758
828
  ringIdCounter += 1;
759
829
  return `almadar-ring-glow-${ringIdCounter}`;
760
830
  }, []);
761
- return /* @__PURE__ */ jsxs("g", { className, opacity, children: [
831
+ const inner = /* @__PURE__ */ jsxs("g", { className, opacity, children: [
762
832
  variant === "glow" && /* @__PURE__ */ jsxs(Fragment, { children: [
763
833
  /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("radialGradient", { id: gradientId, cx: "50%", cy: "50%", r: "50%", children: [
764
834
  /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.15 }),
@@ -791,6 +861,10 @@ var init_SvgRing = __esm({
791
861
  }
792
862
  )
793
863
  ] });
864
+ if (asRoot) {
865
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
866
+ }
867
+ return inner;
794
868
  };
795
869
  SvgRing.displayName = "SvgRing";
796
870
  }
@@ -802,15 +876,18 @@ var init_SvgShield = __esm({
802
876
  SHIELD_PATH = "M15,2 C15,2 5,5 2,6 C2,6 2,18 5,24 C8,30 15,34 15,34 C15,34 22,30 25,24 C28,18 28,6 28,6 C25,5 15,2 15,2 Z";
803
877
  CHECK_PATH = "M10,18 L14,22 L21,13";
804
878
  SvgShield = ({
805
- x,
806
- y,
879
+ x = 50,
880
+ y = 50,
807
881
  size = 1,
808
882
  variant = "outline",
809
883
  color = "var(--color-primary)",
810
884
  opacity = 1,
811
- className
885
+ className,
886
+ asRoot = true,
887
+ width = 100,
888
+ height = 100
812
889
  }) => {
813
- return /* @__PURE__ */ jsxs(
890
+ const inner = /* @__PURE__ */ jsxs(
814
891
  "g",
815
892
  {
816
893
  className,
@@ -841,6 +918,10 @@ var init_SvgShield = __esm({
841
918
  ]
842
919
  }
843
920
  );
921
+ if (asRoot) {
922
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${width} ${height}`, width, height, children: inner });
923
+ }
924
+ return inner;
844
925
  };
845
926
  SvgShield.displayName = "SvgShield";
846
927
  }
@@ -850,20 +931,23 @@ var init_SvgStack = __esm({
850
931
  "components/core/atoms/svg/SvgStack.tsx"() {
851
932
  "use client";
852
933
  SvgStack = ({
853
- x,
854
- y,
934
+ x = 10,
935
+ y = 40,
855
936
  layers: rawLayers = 3,
856
937
  width = 60,
857
938
  height = 40,
858
939
  color = "var(--color-primary)",
859
940
  opacity = 1,
860
941
  className,
861
- labels
942
+ labels,
943
+ asRoot = true,
944
+ svgWidth = 90,
945
+ svgHeight = 80
862
946
  }) => {
863
947
  const layers = Math.max(2, Math.min(4, rawLayers));
864
948
  const verticalOffset = 8;
865
949
  const horizontalOffset = 4;
866
- return /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
950
+ const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: layers }).map((_, i) => {
867
951
  const layerIndex = layers - 1 - i;
868
952
  const layerX = x + layerIndex * horizontalOffset;
869
953
  const layerY = y - layerIndex * verticalOffset;
@@ -901,6 +985,10 @@ var init_SvgStack = __esm({
901
985
  )
902
986
  ] }, layerIndex);
903
987
  }) });
988
+ if (asRoot) {
989
+ return /* @__PURE__ */ jsx("svg", { viewBox: `0 0 ${svgWidth} ${svgHeight}`, width: svgWidth, height: svgHeight, children: inner });
990
+ }
991
+ return inner;
904
992
  };
905
993
  SvgStack.displayName = "SvgStack";
906
994
  }
@@ -1792,12 +1880,20 @@ function doResolve(name) {
1792
1880
  if (asIs && typeof asIs === "object") return asIs;
1793
1881
  return LucideIcons2.HelpCircle;
1794
1882
  }
1795
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1883
+ var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1796
1884
  var init_Icon = __esm({
1797
1885
  "components/core/atoms/Icon.tsx"() {
1798
1886
  "use client";
1799
1887
  init_cn();
1800
1888
  init_iconFamily();
1889
+ colorTokenClasses = {
1890
+ primary: "text-primary",
1891
+ secondary: "text-secondary",
1892
+ success: "text-success",
1893
+ warning: "text-warning",
1894
+ error: "text-error",
1895
+ muted: "text-muted-foreground"
1896
+ };
1801
1897
  iconAliases = {
1802
1898
  "close": LucideIcons2.X,
1803
1899
  "trash": LucideIcons2.Trash2,
@@ -1836,7 +1932,7 @@ var init_Icon = __esm({
1836
1932
  const directIcon = typeof icon === "string" ? void 0 : icon;
1837
1933
  const effectiveName = typeof icon === "string" ? icon : name;
1838
1934
  const family = useIconFamily();
1839
- const RenderedComponent = React81__default.useMemo(() => {
1935
+ const RenderedComponent = React79__default.useMemo(() => {
1840
1936
  if (directIcon) return null;
1841
1937
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1842
1938
  }, [directIcon, effectiveName, family]);
@@ -1845,10 +1941,11 @@ var init_Icon = __esm({
1845
1941
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
1846
1942
  ...style
1847
1943
  };
1944
+ const resolvedColor = color ? color in colorTokenClasses ? colorTokenClasses[color] : color : "text-current";
1848
1945
  const composedClassName = cn(
1849
1946
  sizeClasses[size],
1850
1947
  animationClasses[animation],
1851
- color ? color : "text-current",
1948
+ resolvedColor,
1852
1949
  className
1853
1950
  );
1854
1951
  if (directIcon) {
@@ -1894,7 +1991,7 @@ function resolveIconProp(value, sizeClass) {
1894
1991
  const IconComp = value;
1895
1992
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1896
1993
  }
1897
- if (React81__default.isValidElement(value)) {
1994
+ if (React79__default.isValidElement(value)) {
1898
1995
  return value;
1899
1996
  }
1900
1997
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -1970,7 +2067,7 @@ var init_Button = __esm({
1970
2067
  md: "h-icon-default w-icon-default",
1971
2068
  lg: "h-icon-default w-icon-default"
1972
2069
  };
1973
- Button = React81__default.forwardRef(
2070
+ Button = React79__default.forwardRef(
1974
2071
  ({
1975
2072
  className,
1976
2073
  variant = "primary",
@@ -2036,7 +2133,7 @@ var init_Input = __esm({
2036
2133
  "components/core/atoms/Input.tsx"() {
2037
2134
  init_cn();
2038
2135
  init_Icon();
2039
- Input = React81__default.forwardRef(
2136
+ Input = React79__default.forwardRef(
2040
2137
  ({
2041
2138
  className,
2042
2139
  inputType,
@@ -2157,7 +2254,7 @@ var Label;
2157
2254
  var init_Label = __esm({
2158
2255
  "components/core/atoms/Label.tsx"() {
2159
2256
  init_cn();
2160
- Label = React81__default.forwardRef(
2257
+ Label = React79__default.forwardRef(
2161
2258
  ({ className, required, children, ...props }, ref) => {
2162
2259
  return /* @__PURE__ */ jsxs(
2163
2260
  "label",
@@ -2183,7 +2280,7 @@ var Textarea;
2183
2280
  var init_Textarea = __esm({
2184
2281
  "components/core/atoms/Textarea.tsx"() {
2185
2282
  init_cn();
2186
- Textarea = React81__default.forwardRef(
2283
+ Textarea = React79__default.forwardRef(
2187
2284
  ({ className, error, ...props }, ref) => {
2188
2285
  return /* @__PURE__ */ jsx(
2189
2286
  "textarea",
@@ -2213,7 +2310,7 @@ var init_Select = __esm({
2213
2310
  "components/core/atoms/Select.tsx"() {
2214
2311
  init_cn();
2215
2312
  init_Icon();
2216
- Select = React81__default.forwardRef(
2313
+ Select = React79__default.forwardRef(
2217
2314
  ({ className, options, placeholder, error, ...props }, ref) => {
2218
2315
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2219
2316
  /* @__PURE__ */ jsxs(
@@ -2255,7 +2352,7 @@ var Checkbox;
2255
2352
  var init_Checkbox = __esm({
2256
2353
  "components/core/atoms/Checkbox.tsx"() {
2257
2354
  init_cn();
2258
- Checkbox = React81__default.forwardRef(
2355
+ Checkbox = React79__default.forwardRef(
2259
2356
  ({ className, label, id, ...props }, ref) => {
2260
2357
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2261
2358
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2346,7 +2443,7 @@ var init_Card = __esm({
2346
2443
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
2347
2444
  "tile-image-first": "p-0 overflow-hidden"
2348
2445
  };
2349
- Card = React81__default.forwardRef(
2446
+ Card = React79__default.forwardRef(
2350
2447
  ({
2351
2448
  className,
2352
2449
  variant = "bordered",
@@ -2384,9 +2481,9 @@ var init_Card = __esm({
2384
2481
  }
2385
2482
  );
2386
2483
  Card.displayName = "Card";
2387
- CardHeader = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2484
+ CardHeader = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2388
2485
  CardHeader.displayName = "CardHeader";
2389
- CardTitle = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2486
+ CardTitle = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2390
2487
  "h3",
2391
2488
  {
2392
2489
  ref,
@@ -2399,11 +2496,11 @@ var init_Card = __esm({
2399
2496
  }
2400
2497
  ));
2401
2498
  CardTitle.displayName = "CardTitle";
2402
- CardContent = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2499
+ CardContent = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2403
2500
  CardContent.displayName = "CardContent";
2404
2501
  CardBody = CardContent;
2405
2502
  CardBody.displayName = "CardBody";
2406
- CardFooter = React81__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2503
+ CardFooter = React79__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2407
2504
  "div",
2408
2505
  {
2409
2506
  ref,
@@ -2456,7 +2553,7 @@ var init_Badge = __esm({
2456
2553
  md: "px-2.5 py-1 text-sm",
2457
2554
  lg: "px-3 py-1.5 text-base"
2458
2555
  };
2459
- Badge = React81__default.forwardRef(
2556
+ Badge = React79__default.forwardRef(
2460
2557
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
2461
2558
  const iconSizes3 = {
2462
2559
  sm: "h-icon-default w-icon-default",
@@ -2549,7 +2646,7 @@ var init_FilterPill = __esm({
2549
2646
  md: "w-3.5 h-3.5",
2550
2647
  lg: "w-4 h-4"
2551
2648
  };
2552
- FilterPill = React81__default.forwardRef(
2649
+ FilterPill = React79__default.forwardRef(
2553
2650
  ({
2554
2651
  className,
2555
2652
  variant = "default",
@@ -2626,7 +2723,7 @@ var init_Spinner = __esm({
2626
2723
  md: "h-6 w-6",
2627
2724
  lg: "h-8 w-8"
2628
2725
  };
2629
- Spinner = React81__default.forwardRef(
2726
+ Spinner = React79__default.forwardRef(
2630
2727
  ({ className, size = "md", ...props }, ref) => {
2631
2728
  return /* @__PURE__ */ jsx(
2632
2729
  "div",
@@ -2705,13 +2802,12 @@ var init_Avatar = __esm({
2705
2802
  actionPayload
2706
2803
  }) => {
2707
2804
  const eventBus = useEventBus();
2708
- const [imgFailed, setImgFailed] = React81__default.useState(false);
2709
- React81__default.useEffect(() => {
2805
+ const [imgFailed, setImgFailed] = React79__default.useState(false);
2806
+ React79__default.useEffect(() => {
2710
2807
  setImgFailed(false);
2711
2808
  }, [src]);
2712
2809
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
2713
2810
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
2714
- const hasImage = !!src && !imgFailed;
2715
2811
  const hasIcon = !!IconComponent;
2716
2812
  const hasInitials = !!initials && !(hasIcon && !providedInitials);
2717
2813
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
@@ -2737,15 +2833,13 @@ var init_Avatar = __esm({
2737
2833
  onClick: isClickable ? handleClick : void 0,
2738
2834
  role: isClickable ? "button" : void 0,
2739
2835
  tabIndex: isClickable ? 0 : void 0,
2740
- children: hasImage ? /* @__PURE__ */ jsx(
2836
+ children: src && !imgFailed ? /* @__PURE__ */ jsx(
2741
2837
  "img",
2742
2838
  {
2743
2839
  src,
2744
2840
  alt: alt || "Avatar",
2745
2841
  className: "w-full h-full object-cover",
2746
- onError: () => {
2747
- setImgFailed(true);
2748
- }
2842
+ onError: () => setImgFailed(true)
2749
2843
  }
2750
2844
  ) : hasInitials ? /* @__PURE__ */ jsx(
2751
2845
  "div",
@@ -2913,7 +3007,7 @@ var init_Box = __esm({
2913
3007
  fixed: "fixed",
2914
3008
  sticky: "sticky"
2915
3009
  };
2916
- Box = React81__default.forwardRef(
3010
+ Box = React79__default.forwardRef(
2917
3011
  ({
2918
3012
  padding,
2919
3013
  paddingX,
@@ -2963,7 +3057,7 @@ var init_Box = __esm({
2963
3057
  onMouseLeave?.(e);
2964
3058
  }, [hoverEvent, eventBus, onMouseLeave]);
2965
3059
  const isClickable = action || onClick;
2966
- return React81__default.createElement(
3060
+ return React79__default.createElement(
2967
3061
  Component,
2968
3062
  {
2969
3063
  ref,
@@ -3120,6 +3214,7 @@ var init_ProgressBar = __esm({
3120
3214
  primary: "bg-primary",
3121
3215
  success: "bg-success",
3122
3216
  warning: "bg-warning",
3217
+ error: "bg-error",
3123
3218
  danger: "bg-error"
3124
3219
  };
3125
3220
  circularSizeClasses = {
@@ -3144,10 +3239,11 @@ var init_ProgressBar = __esm({
3144
3239
  const effectiveColor = color ?? variant;
3145
3240
  const effectiveShowPercentage = showPercentage || showLabel;
3146
3241
  if (progressType === "linear") {
3242
+ const showHeader = label || effectiveShowPercentage;
3147
3243
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
3148
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
3149
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
3150
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-foreground font-medium", children: [
3244
+ showHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
3245
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-bold text-foreground", children: label }),
3246
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-foreground font-medium", !label && "ml-auto"), children: [
3151
3247
  Math.round(percentage),
3152
3248
  "%"
3153
3249
  ] })
@@ -3232,10 +3328,11 @@ var init_ProgressBar = __esm({
3232
3328
  const stepValue = max / steps;
3233
3329
  const activeSteps = Math.floor(value / stepValue);
3234
3330
  const partialStep = value % stepValue / stepValue;
3331
+ const showStepHeader = label || effectiveShowPercentage;
3235
3332
  return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
3236
- label && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
3237
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
3238
- effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
3333
+ showStepHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
3334
+ label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: label }),
3335
+ effectiveShowPercentage && /* @__PURE__ */ jsxs("span", { className: cn("text-sm text-muted-foreground", !label && "ml-auto"), children: [
3239
3336
  Math.round(percentage),
3240
3337
  "%"
3241
3338
  ] })
@@ -3285,7 +3382,7 @@ var init_Radio = __esm({
3285
3382
  md: "w-2.5 h-2.5",
3286
3383
  lg: "w-3 h-3"
3287
3384
  };
3288
- Radio = React81__default.forwardRef(
3385
+ Radio = React79__default.forwardRef(
3289
3386
  ({
3290
3387
  label,
3291
3388
  helperText,
@@ -3302,12 +3399,12 @@ var init_Radio = __esm({
3302
3399
  onChange,
3303
3400
  ...props
3304
3401
  }, ref) => {
3305
- const reactId = React81__default.useId();
3402
+ const reactId = React79__default.useId();
3306
3403
  const baseId = id || `radio-${reactId}`;
3307
3404
  const hasError = !!error;
3308
3405
  const eventBus = useEventBus();
3309
- const [selected, setSelected] = React81__default.useState(value);
3310
- React81__default.useEffect(() => {
3406
+ const [selected, setSelected] = React79__default.useState(value);
3407
+ React79__default.useEffect(() => {
3311
3408
  if (value !== void 0) setSelected(value);
3312
3409
  }, [value]);
3313
3410
  const pick = (next, e) => {
@@ -3489,7 +3586,7 @@ var init_Switch = __esm({
3489
3586
  "components/core/atoms/Switch.tsx"() {
3490
3587
  "use client";
3491
3588
  init_cn();
3492
- Switch = React81.forwardRef(
3589
+ Switch = React79.forwardRef(
3493
3590
  ({
3494
3591
  checked,
3495
3592
  defaultChecked = false,
@@ -3500,10 +3597,10 @@ var init_Switch = __esm({
3500
3597
  name,
3501
3598
  className
3502
3599
  }, ref) => {
3503
- const [isChecked, setIsChecked] = React81.useState(
3600
+ const [isChecked, setIsChecked] = React79.useState(
3504
3601
  checked !== void 0 ? checked : defaultChecked
3505
3602
  );
3506
- React81.useEffect(() => {
3603
+ React79.useEffect(() => {
3507
3604
  if (checked !== void 0) {
3508
3605
  setIsChecked(checked);
3509
3606
  }
@@ -4332,7 +4429,7 @@ var Dialog;
4332
4429
  var init_Dialog = __esm({
4333
4430
  "components/core/atoms/Dialog.tsx"() {
4334
4431
  init_cn();
4335
- Dialog = React81__default.forwardRef(
4432
+ Dialog = React79__default.forwardRef(
4336
4433
  ({
4337
4434
  role = "dialog",
4338
4435
  "aria-modal": ariaModal = true,
@@ -4358,7 +4455,7 @@ var Aside;
4358
4455
  var init_Aside = __esm({
4359
4456
  "components/core/atoms/Aside.tsx"() {
4360
4457
  init_cn();
4361
- Aside = React81__default.forwardRef(
4458
+ Aside = React79__default.forwardRef(
4362
4459
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
4363
4460
  );
4364
4461
  Aside.displayName = "Aside";
@@ -4436,8 +4533,8 @@ var init_LawReferenceTooltip = __esm({
4436
4533
  className
4437
4534
  }) => {
4438
4535
  const { t } = useTranslate();
4439
- const [isVisible, setIsVisible] = React81__default.useState(false);
4440
- const timeoutRef = React81__default.useRef(null);
4536
+ const [isVisible, setIsVisible] = React79__default.useState(false);
4537
+ const timeoutRef = React79__default.useRef(null);
4441
4538
  const handleMouseEnter = () => {
4442
4539
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4443
4540
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -4446,7 +4543,7 @@ var init_LawReferenceTooltip = __esm({
4446
4543
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4447
4544
  setIsVisible(false);
4448
4545
  };
4449
- React81__default.useEffect(() => {
4546
+ React79__default.useEffect(() => {
4450
4547
  return () => {
4451
4548
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4452
4549
  };
@@ -4656,7 +4753,7 @@ var init_StatusDot = __esm({
4656
4753
  md: "w-2.5 h-2.5",
4657
4754
  lg: "w-3 h-3"
4658
4755
  };
4659
- StatusDot = React81__default.forwardRef(
4756
+ StatusDot = React79__default.forwardRef(
4660
4757
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4661
4758
  return /* @__PURE__ */ jsx(
4662
4759
  "span",
@@ -4710,7 +4807,7 @@ var init_TrendIndicator = __esm({
4710
4807
  down: "trending-down",
4711
4808
  flat: "arrow-right"
4712
4809
  };
4713
- TrendIndicator = React81__default.forwardRef(
4810
+ TrendIndicator = React79__default.forwardRef(
4714
4811
  ({
4715
4812
  className,
4716
4813
  value,
@@ -4777,7 +4874,7 @@ var init_RangeSlider = __esm({
4777
4874
  md: "w-4 h-4",
4778
4875
  lg: "w-5 h-5"
4779
4876
  };
4780
- RangeSlider = React81__default.forwardRef(
4877
+ RangeSlider = React79__default.forwardRef(
4781
4878
  ({
4782
4879
  className,
4783
4880
  min = 0,
@@ -5373,7 +5470,7 @@ var init_ContentSection = __esm({
5373
5470
  md: "py-16",
5374
5471
  lg: "py-24"
5375
5472
  };
5376
- ContentSection = React81__default.forwardRef(
5473
+ ContentSection = React79__default.forwardRef(
5377
5474
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
5378
5475
  return /* @__PURE__ */ jsx(
5379
5476
  Box,
@@ -5907,7 +6004,7 @@ var init_AnimatedReveal = __esm({
5907
6004
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5908
6005
  "none": {}
5909
6006
  };
5910
- AnimatedReveal = React81__default.forwardRef(
6007
+ AnimatedReveal = React79__default.forwardRef(
5911
6008
  ({
5912
6009
  trigger = "scroll",
5913
6010
  animation = "fade-up",
@@ -6067,7 +6164,7 @@ var init_AnimatedGraphic = __esm({
6067
6164
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
6068
6165
  "use client";
6069
6166
  init_cn();
6070
- AnimatedGraphic = React81__default.forwardRef(
6167
+ AnimatedGraphic = React79__default.forwardRef(
6071
6168
  ({
6072
6169
  src,
6073
6170
  svgContent,
@@ -6090,7 +6187,7 @@ var init_AnimatedGraphic = __esm({
6090
6187
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
6091
6188
  const resolvedSvg = svgContent ?? fetchedSvg;
6092
6189
  const prevAnimateRef = useRef(animate);
6093
- const setRef = React81__default.useCallback(
6190
+ const setRef = React79__default.useCallback(
6094
6191
  (node) => {
6095
6192
  containerRef.current = node;
6096
6193
  if (typeof ref === "function") ref(node);
@@ -6196,7 +6293,6 @@ var init_Modal = __esm({
6196
6293
  init_Button();
6197
6294
  init_Dialog();
6198
6295
  init_Typography();
6199
- init_Overlay();
6200
6296
  init_cn();
6201
6297
  init_useEventBus();
6202
6298
  sizeClasses6 = {
@@ -6286,124 +6382,117 @@ var init_Modal = __esm({
6286
6382
  }
6287
6383
  };
6288
6384
  return createPortal(
6289
- /* @__PURE__ */ jsxs(Fragment, { children: [
6290
- /* @__PURE__ */ jsx(
6291
- Overlay,
6292
- {
6293
- isVisible: isOpen,
6294
- onClick: handleOverlayClick,
6295
- className: "z-[1000]"
6296
- }
6297
- ),
6298
- /* @__PURE__ */ jsx(
6299
- Box,
6300
- {
6301
- className: cn(
6302
- "fixed inset-0 z-[1001] pointer-events-none",
6303
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6304
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6305
- ),
6306
- children: /* @__PURE__ */ jsxs(
6307
- Dialog,
6308
- {
6309
- ref: modalRef,
6310
- open: true,
6311
- className: cn(
6312
- // Reset browser-default dialog chrome — we own styling. `static`
6313
- // overrides the user-agent `position: absolute` so the parent
6314
- // flex container's `justify-center` actually centers the dialog
6315
- // (without this, the dialog drops out of flex flow and `m-0`
6316
- // kills the user-agent's `margin: auto` centering, pinning the
6317
- // dialog to top-left).
6318
- "static m-0 p-0 border-0 bg-transparent",
6319
- // Pre-existing dialog frame
6320
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6321
- // Desktop sizing + viewport-aware floor.
6322
- sizeClasses6[size],
6323
- minWidthClasses[size],
6324
- "max-h-[80vh]",
6325
- // Mobile: take the entire screen. Override desktop max-w cap,
6326
- // full height, no rounded corners, no min-width.
6327
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6328
- lookStyles2[look],
6329
- className
6385
+ /* @__PURE__ */ jsx(
6386
+ "div",
6387
+ {
6388
+ className: cn(
6389
+ "fixed inset-0 z-[1000]",
6390
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6391
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6392
+ ),
6393
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
6394
+ onClick: handleOverlayClick,
6395
+ "aria-hidden": "true",
6396
+ children: /* @__PURE__ */ jsxs(
6397
+ Dialog,
6398
+ {
6399
+ ref: modalRef,
6400
+ open: true,
6401
+ className: cn(
6402
+ // Reset browser-default dialog chrome — we own styling. `static`
6403
+ // overrides the user-agent `position: absolute` so the parent
6404
+ // flex container's `justify-center` actually centers the dialog
6405
+ // (without this, the dialog drops out of flex flow and `m-0`
6406
+ // kills the user-agent's `margin: auto` centering, pinning the
6407
+ // dialog to top-left).
6408
+ "static m-0 p-0 border-0 bg-transparent",
6409
+ // Pre-existing dialog frame
6410
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6411
+ // Desktop sizing + viewport-aware floor.
6412
+ sizeClasses6[size],
6413
+ minWidthClasses[size],
6414
+ "max-h-[80vh]",
6415
+ // Mobile: take the entire screen. Override desktop max-w cap,
6416
+ // full height, no rounded corners, no min-width.
6417
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6418
+ lookStyles2[look],
6419
+ className
6420
+ ),
6421
+ style: dragY > 0 ? {
6422
+ transform: `translateY(${dragY}px)`,
6423
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6424
+ } : void 0,
6425
+ ...title && { "aria-labelledby": "modal-title" },
6426
+ children: [
6427
+ /* @__PURE__ */ jsx(
6428
+ Box,
6429
+ {
6430
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6431
+ onPointerDown: (e) => {
6432
+ if (!swipeDownToClose) return;
6433
+ dragStartY.current = e.clientY;
6434
+ isDragging.current = true;
6435
+ e.target.setPointerCapture(e.pointerId);
6436
+ },
6437
+ onPointerMove: (e) => {
6438
+ if (!isDragging.current) return;
6439
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6440
+ setDragY(dy);
6441
+ },
6442
+ onPointerUp: () => {
6443
+ if (!isDragging.current) return;
6444
+ isDragging.current = false;
6445
+ if (dragY > 100) {
6446
+ handleClose();
6447
+ }
6448
+ setDragY(0);
6449
+ },
6450
+ onPointerCancel: () => {
6451
+ isDragging.current = false;
6452
+ setDragY(0);
6453
+ },
6454
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6455
+ }
6330
6456
  ),
6331
- style: dragY > 0 ? {
6332
- transform: `translateY(${dragY}px)`,
6333
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6334
- } : void 0,
6335
- ...title && { "aria-labelledby": "modal-title" },
6336
- children: [
6337
- /* @__PURE__ */ jsx(
6338
- Box,
6339
- {
6340
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6341
- onPointerDown: (e) => {
6342
- if (!swipeDownToClose) return;
6343
- dragStartY.current = e.clientY;
6344
- isDragging.current = true;
6345
- e.target.setPointerCapture(e.pointerId);
6346
- },
6347
- onPointerMove: (e) => {
6348
- if (!isDragging.current) return;
6349
- const dy = Math.max(0, e.clientY - dragStartY.current);
6350
- setDragY(dy);
6351
- },
6352
- onPointerUp: () => {
6353
- if (!isDragging.current) return;
6354
- isDragging.current = false;
6355
- if (dragY > 100) {
6356
- handleClose();
6457
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
6458
+ Box,
6459
+ {
6460
+ className: cn(
6461
+ "px-6 py-4 flex items-center justify-between",
6462
+ "border-b-[length:var(--border-width)] border-border"
6463
+ ),
6464
+ children: [
6465
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6466
+ showCloseButton && /* @__PURE__ */ jsx(
6467
+ Button,
6468
+ {
6469
+ variant: "ghost",
6470
+ size: "sm",
6471
+ icon: "x",
6472
+ onClick: handleClose,
6473
+ "data-event": "CLOSE",
6474
+ "aria-label": t("aria.closeModal")
6357
6475
  }
6358
- setDragY(0);
6359
- },
6360
- onPointerCancel: () => {
6361
- isDragging.current = false;
6362
- setDragY(0);
6363
- },
6364
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6365
- }
6366
- ),
6367
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
6368
- Box,
6369
- {
6370
- className: cn(
6371
- "px-6 py-4 flex items-center justify-between",
6372
- "border-b-[length:var(--border-width)] border-border"
6373
- ),
6374
- children: [
6375
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6376
- showCloseButton && /* @__PURE__ */ jsx(
6377
- Button,
6378
- {
6379
- variant: "ghost",
6380
- size: "sm",
6381
- icon: "x",
6382
- onClick: handleClose,
6383
- "data-event": "CLOSE",
6384
- "aria-label": t("aria.closeModal")
6385
- }
6386
- )
6387
- ]
6388
- }
6389
- ),
6390
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6391
- footer && /* @__PURE__ */ jsx(
6392
- Box,
6393
- {
6394
- className: cn(
6395
- "px-6 py-4 bg-muted",
6396
- "border-t-[length:var(--border-width)] border-border"
6397
- ),
6398
- children: footer
6399
- }
6400
- )
6401
- ]
6402
- }
6403
- )
6404
- }
6405
- )
6406
- ] }),
6476
+ )
6477
+ ]
6478
+ }
6479
+ ),
6480
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6481
+ footer && /* @__PURE__ */ jsx(
6482
+ Box,
6483
+ {
6484
+ className: cn(
6485
+ "px-6 py-4 bg-muted",
6486
+ "border-t-[length:var(--border-width)] border-border"
6487
+ ),
6488
+ children: footer
6489
+ }
6490
+ )
6491
+ ]
6492
+ }
6493
+ )
6494
+ }
6495
+ ),
6407
6496
  document.body
6408
6497
  );
6409
6498
  };
@@ -6780,7 +6869,7 @@ var init_ErrorBoundary = __esm({
6780
6869
  }
6781
6870
  );
6782
6871
  };
6783
- ErrorBoundary = class extends React81__default.Component {
6872
+ ErrorBoundary = class extends React79__default.Component {
6784
6873
  constructor(props) {
6785
6874
  super(props);
6786
6875
  __publicField(this, "reset", () => {
@@ -7832,7 +7921,7 @@ var init_Tooltip = __esm({
7832
7921
  setIsVisible(false);
7833
7922
  }, hideDelay);
7834
7923
  };
7835
- useEffect(() => {
7924
+ useLayoutEffect(() => {
7836
7925
  if (isVisible) {
7837
7926
  updatePosition();
7838
7927
  }
@@ -7843,8 +7932,8 @@ var init_Tooltip = __esm({
7843
7932
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7844
7933
  };
7845
7934
  }, []);
7846
- const triggerElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7847
- const trigger = React81__default.cloneElement(triggerElement, {
7935
+ const triggerElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7936
+ const trigger = React79__default.cloneElement(triggerElement, {
7848
7937
  ref: triggerRef,
7849
7938
  onMouseEnter: handleMouseEnter,
7850
7939
  onMouseLeave: handleMouseLeave,
@@ -7991,8 +8080,8 @@ var init_Popover = __esm({
7991
8080
  onMouseEnter: handleOpen,
7992
8081
  onMouseLeave: handleClose
7993
8082
  };
7994
- const childElement = React81__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7995
- const triggerElement = React81__default.cloneElement(
8083
+ const childElement = React79__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
8084
+ const triggerElement = React79__default.cloneElement(
7996
8085
  childElement,
7997
8086
  {
7998
8087
  ref: triggerRef,
@@ -8008,7 +8097,10 @@ var init_Popover = __esm({
8008
8097
  "bg-card border-2 border-border shadow-elevation-popover",
8009
8098
  className
8010
8099
  ),
8011
- style: computePopoverStyle(position, triggerRect, popoverWidth),
8100
+ style: {
8101
+ ...computePopoverStyle(position, triggerRect, popoverWidth),
8102
+ ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
8103
+ },
8012
8104
  role: "dialog",
8013
8105
  onMouseEnter: trigger === "hover" ? handleOpen : void 0,
8014
8106
  onMouseLeave: trigger === "hover" ? handleClose : void 0,
@@ -8118,8 +8210,8 @@ var init_Menu = __esm({
8118
8210
  };
8119
8211
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
8120
8212
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
8121
- const triggerChild = React81__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8122
- const triggerElement = React81__default.cloneElement(
8213
+ const triggerChild = React79__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
8214
+ const triggerElement = React79__default.cloneElement(
8123
8215
  triggerChild,
8124
8216
  {
8125
8217
  ref: triggerRef,
@@ -8526,7 +8618,7 @@ var init_MapView = __esm({
8526
8618
  shadowSize: [41, 41]
8527
8619
  });
8528
8620
  L.Marker.prototype.options.icon = defaultIcon;
8529
- const { useEffect: useEffect71, useRef: useRef68, useCallback: useCallback116, useState: useState102 } = React81__default;
8621
+ const { useEffect: useEffect71, useRef: useRef68, useCallback: useCallback114, useState: useState100 } = React79__default;
8530
8622
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8531
8623
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8532
8624
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -8571,8 +8663,8 @@ var init_MapView = __esm({
8571
8663
  showAttribution = true
8572
8664
  }) {
8573
8665
  const eventBus = useEventBus2();
8574
- const [clickedPosition, setClickedPosition] = useState102(null);
8575
- const handleMapClick = useCallback116((lat, lng) => {
8666
+ const [clickedPosition, setClickedPosition] = useState100(null);
8667
+ const handleMapClick = useCallback114((lat, lng) => {
8576
8668
  if (showClickedPin) {
8577
8669
  setClickedPosition({ lat, lng });
8578
8670
  }
@@ -8581,7 +8673,7 @@ var init_MapView = __esm({
8581
8673
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
8582
8674
  }
8583
8675
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
8584
- const handleMarkerClick = useCallback116((marker) => {
8676
+ const handleMarkerClick = useCallback114((marker) => {
8585
8677
  onMarkerClick?.(marker);
8586
8678
  if (markerClickEvent) {
8587
8679
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -8590,7 +8682,7 @@ var init_MapView = __esm({
8590
8682
  return /* @__PURE__ */ jsx(
8591
8683
  Box,
8592
8684
  {
8593
- className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
8685
+ className: cn("relative isolate z-0 w-full overflow-hidden rounded-lg", className),
8594
8686
  style: { height },
8595
8687
  "data-testid": "map-view",
8596
8688
  children: /* @__PURE__ */ jsxs(
@@ -8772,7 +8864,7 @@ function InputPattern({
8772
8864
  fieldName
8773
8865
  }) {
8774
8866
  const { emit } = useEventBus();
8775
- const [localValue, setLocalValue] = React81__default.useState(value);
8867
+ const [localValue, setLocalValue] = React79__default.useState(value);
8776
8868
  const handleChange = (e) => {
8777
8869
  setLocalValue(e.target.value);
8778
8870
  if (onChange) {
@@ -8810,7 +8902,7 @@ function TextareaPattern({
8810
8902
  fieldName
8811
8903
  }) {
8812
8904
  const { emit } = useEventBus();
8813
- const [localValue, setLocalValue] = React81__default.useState(value);
8905
+ const [localValue, setLocalValue] = React79__default.useState(value);
8814
8906
  const handleChange = (e) => {
8815
8907
  setLocalValue(e.target.value);
8816
8908
  if (onChange) {
@@ -8842,7 +8934,7 @@ function SelectPattern({
8842
8934
  fieldName
8843
8935
  }) {
8844
8936
  const { emit } = useEventBus();
8845
- const [localValue, setLocalValue] = React81__default.useState(value);
8937
+ const [localValue, setLocalValue] = React79__default.useState(value);
8846
8938
  const handleChange = (e) => {
8847
8939
  setLocalValue(e.target.value);
8848
8940
  if (onChange) {
@@ -8871,7 +8963,7 @@ function CheckboxPattern({
8871
8963
  className
8872
8964
  }) {
8873
8965
  const { emit } = useEventBus();
8874
- const [localChecked, setLocalChecked] = React81__default.useState(checked);
8966
+ const [localChecked, setLocalChecked] = React79__default.useState(checked);
8875
8967
  const handleChange = (e) => {
8876
8968
  setLocalChecked(e.target.checked);
8877
8969
  if (onChange) {
@@ -9185,9 +9277,9 @@ function ControlButton({
9185
9277
  className
9186
9278
  }) {
9187
9279
  const eventBus = useEventBus();
9188
- const [isPressed, setIsPressed] = React81.useState(false);
9280
+ const [isPressed, setIsPressed] = React79.useState(false);
9189
9281
  const actualPressed = pressed ?? isPressed;
9190
- const handlePointerDown = React81.useCallback(
9282
+ const handlePointerDown = React79.useCallback(
9191
9283
  (e) => {
9192
9284
  e.preventDefault();
9193
9285
  if (disabled) return;
@@ -9197,7 +9289,7 @@ function ControlButton({
9197
9289
  },
9198
9290
  [disabled, pressEvent, eventBus, onPress]
9199
9291
  );
9200
- const handlePointerUp = React81.useCallback(
9292
+ const handlePointerUp = React79.useCallback(
9201
9293
  (e) => {
9202
9294
  e.preventDefault();
9203
9295
  if (disabled) return;
@@ -9207,7 +9299,7 @@ function ControlButton({
9207
9299
  },
9208
9300
  [disabled, releaseEvent, eventBus, onRelease]
9209
9301
  );
9210
- const handlePointerLeave = React81.useCallback(
9302
+ const handlePointerLeave = React79.useCallback(
9211
9303
  (e) => {
9212
9304
  if (isPressed) {
9213
9305
  setIsPressed(false);
@@ -9284,8 +9376,8 @@ function ActionButtons({
9284
9376
  disabled
9285
9377
  }) {
9286
9378
  const eventBus = useEventBus();
9287
- const [activeButtons, setActiveButtons] = React81.useState(/* @__PURE__ */ new Set());
9288
- const handlePress = React81.useCallback(
9379
+ const [activeButtons, setActiveButtons] = React79.useState(/* @__PURE__ */ new Set());
9380
+ const handlePress = React79.useCallback(
9289
9381
  (id) => {
9290
9382
  setActiveButtons((prev) => new Set(prev).add(id));
9291
9383
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -9293,7 +9385,7 @@ function ActionButtons({
9293
9385
  },
9294
9386
  [actionEvent, eventBus, onAction]
9295
9387
  );
9296
- const handleRelease = React81.useCallback(
9388
+ const handleRelease = React79.useCallback(
9297
9389
  (id) => {
9298
9390
  setActiveButtons((prev) => {
9299
9391
  const next = new Set(prev);
@@ -9583,7 +9675,7 @@ var init_AuthLayout = __esm({
9583
9675
  init_Stack();
9584
9676
  init_Typography();
9585
9677
  AuthLayout = ({
9586
- appName = "{{APP_TITLE}}",
9678
+ appName = "My App",
9587
9679
  logo,
9588
9680
  backgroundImage,
9589
9681
  showBranding = true,
@@ -12185,6 +12277,263 @@ var init_katex_min = __esm({
12185
12277
  "node_modules/katex/dist/katex.min.css"() {
12186
12278
  }
12187
12279
  });
12280
+ var Tabs;
12281
+ var init_Tabs = __esm({
12282
+ "components/core/molecules/Tabs.tsx"() {
12283
+ "use client";
12284
+ init_Icon();
12285
+ init_Badge();
12286
+ init_Typography();
12287
+ init_Box();
12288
+ init_cn();
12289
+ init_useEventBus();
12290
+ Tabs = ({
12291
+ items,
12292
+ tabs,
12293
+ defaultActiveTab,
12294
+ activeTab: controlledActiveTab,
12295
+ onTabChange,
12296
+ tabChangeEvent,
12297
+ variant = "default",
12298
+ orientation = "horizontal",
12299
+ className
12300
+ }) => {
12301
+ const rawItems = items ?? tabs ?? [];
12302
+ const safeItems = rawItems.map(({ id, value, ...rest }) => ({
12303
+ ...rest,
12304
+ id: id || value || ""
12305
+ }));
12306
+ const eventBus = useEventBus();
12307
+ const { t } = useTranslate();
12308
+ const initialActive = safeItems.find((item) => item.active)?.id;
12309
+ const [internalActiveTab, setInternalActiveTab] = useState(
12310
+ defaultActiveTab || initialActive || safeItems[0]?.id || ""
12311
+ );
12312
+ const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
12313
+ const tabRefs = useRef({});
12314
+ const handleTabChange = (tabId, tabEvent) => {
12315
+ if (controlledActiveTab === void 0) {
12316
+ setInternalActiveTab(tabId);
12317
+ }
12318
+ onTabChange?.(tabId);
12319
+ if (tabChangeEvent) {
12320
+ eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
12321
+ }
12322
+ if (tabEvent) {
12323
+ eventBus.emit(`UI:${tabEvent}`, { tabId });
12324
+ }
12325
+ };
12326
+ const handleKeyDown = (e, index) => {
12327
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
12328
+ e.preventDefault();
12329
+ const direction = e.key === "ArrowLeft" ? -1 : 1;
12330
+ const nextIndex = (index + direction + safeItems.length) % safeItems.length;
12331
+ const nextTab = safeItems[nextIndex];
12332
+ if (nextTab && !nextTab.disabled) {
12333
+ handleTabChange(nextTab.id);
12334
+ tabRefs.current[nextTab.id]?.focus();
12335
+ }
12336
+ } else if (e.key === "Home" || e.key === "End") {
12337
+ e.preventDefault();
12338
+ const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
12339
+ const targetTab = safeItems[targetIndex];
12340
+ if (targetTab && !targetTab.disabled) {
12341
+ handleTabChange(targetTab.id);
12342
+ tabRefs.current[targetTab.id]?.focus();
12343
+ }
12344
+ }
12345
+ };
12346
+ const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
12347
+ if (safeItems.length === 0) {
12348
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
12349
+ }
12350
+ const variantClasses2 = {
12351
+ default: [
12352
+ "border-b-[length:var(--border-width)] border-transparent",
12353
+ "hover:border-muted-foreground",
12354
+ "data-[active=true]:border-primary"
12355
+ ].join(" "),
12356
+ pills: [
12357
+ "rounded-sm",
12358
+ "data-[active=true]:bg-primary",
12359
+ "data-[active=true]:text-primary-foreground"
12360
+ ].join(" "),
12361
+ underline: [
12362
+ "border-b-[length:var(--border-width)] border-transparent",
12363
+ "data-[active=true]:border-primary"
12364
+ ].join(" ")
12365
+ };
12366
+ return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
12367
+ /* @__PURE__ */ jsx(
12368
+ Box,
12369
+ {
12370
+ role: "tablist",
12371
+ className: cn(
12372
+ "flex",
12373
+ // Horizontal tab strip becomes a horizontally-scrollable lane
12374
+ // below its container width — phones with many tabs scroll
12375
+ // instead of clipping. `snap-x` snaps to each tab; the
12376
+ // scrollbar is hidden for a cleaner affordance (the swipe
12377
+ // gesture is the discoverability cue).
12378
+ orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
12379
+ variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
12380
+ variant === "underline" && orientation === "vertical" && "border-b-0"
12381
+ ),
12382
+ children: safeItems.map((item, index) => {
12383
+ const isActive = item.id === activeTab;
12384
+ const isDisabled = item.disabled;
12385
+ return /* @__PURE__ */ jsxs(
12386
+ Box,
12387
+ {
12388
+ as: "button",
12389
+ ref: (el) => {
12390
+ tabRefs.current[item.id] = el;
12391
+ },
12392
+ role: "tab",
12393
+ "aria-selected": isActive,
12394
+ "aria-controls": `tabpanel-${item.id}`,
12395
+ "aria-disabled": isDisabled,
12396
+ onClick: () => !isDisabled && handleTabChange(item.id, item.event),
12397
+ onKeyDown: (e) => handleKeyDown(e, index),
12398
+ "data-active": isActive,
12399
+ className: cn(
12400
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
12401
+ orientation === "horizontal" && "snap-start shrink-0",
12402
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
12403
+ isDisabled && "opacity-50 cursor-not-allowed",
12404
+ variantClasses2[variant],
12405
+ isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
12406
+ ),
12407
+ children: [
12408
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
12409
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
12410
+ item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
12411
+ ]
12412
+ },
12413
+ item.id
12414
+ );
12415
+ })
12416
+ }
12417
+ ),
12418
+ activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
12419
+ Box,
12420
+ {
12421
+ role: "tabpanel",
12422
+ id: `tabpanel-${activeTab}`,
12423
+ "aria-labelledby": `tab-${activeTab}`,
12424
+ className: "mt-4",
12425
+ children: activeTabContent
12426
+ }
12427
+ )
12428
+ ] });
12429
+ };
12430
+ Tabs.displayName = "Tabs";
12431
+ }
12432
+ });
12433
+ var ICON_NAME_ALIASES, lookStyles3, EmptyState;
12434
+ var init_EmptyState = __esm({
12435
+ "components/core/molecules/EmptyState.tsx"() {
12436
+ "use client";
12437
+ init_cn();
12438
+ init_atoms2();
12439
+ init_Box();
12440
+ init_Icon();
12441
+ init_Stack();
12442
+ init_Typography();
12443
+ init_useEventBus();
12444
+ ICON_NAME_ALIASES = {
12445
+ check: "check-circle",
12446
+ error: "x-circle",
12447
+ warning: "alert-circle"
12448
+ };
12449
+ lookStyles3 = {
12450
+ "icon-only": "",
12451
+ illustrated: "[&_svg]:w-32 [&_svg]:h-32",
12452
+ "text-only": "[&_svg]:hidden",
12453
+ mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
12454
+ };
12455
+ EmptyState = ({
12456
+ icon,
12457
+ title,
12458
+ message,
12459
+ description,
12460
+ actionLabel,
12461
+ onAction,
12462
+ className,
12463
+ destructive,
12464
+ variant,
12465
+ actionEvent,
12466
+ look = "icon-only"
12467
+ }) => {
12468
+ const eventBus = useEventBus();
12469
+ const { t } = useTranslate();
12470
+ const handleAction = () => {
12471
+ if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
12472
+ onAction?.();
12473
+ };
12474
+ const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
12475
+ const iconComponent = typeof icon === "function" ? icon : void 0;
12476
+ const hasIcon = Boolean(iconName || iconComponent);
12477
+ const isDestructive = destructive || variant === "error";
12478
+ const isSuccess = variant === "success";
12479
+ const displayText = title || message || t("empty.noItems");
12480
+ return /* @__PURE__ */ jsxs(
12481
+ VStack,
12482
+ {
12483
+ align: "center",
12484
+ className: cn(
12485
+ "justify-center py-12 text-center",
12486
+ lookStyles3[look],
12487
+ className
12488
+ ),
12489
+ children: [
12490
+ hasIcon && /* @__PURE__ */ jsx(
12491
+ Box,
12492
+ {
12493
+ className: cn(
12494
+ "mb-4 rounded-full p-3",
12495
+ isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
12496
+ ),
12497
+ children: /* @__PURE__ */ jsx(
12498
+ Icon,
12499
+ {
12500
+ ...iconName ? { name: iconName } : { icon: iconComponent },
12501
+ className: cn(
12502
+ "h-8 w-8",
12503
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
12504
+ )
12505
+ }
12506
+ )
12507
+ }
12508
+ ),
12509
+ /* @__PURE__ */ jsx(
12510
+ Typography,
12511
+ {
12512
+ variant: "h3",
12513
+ className: cn(
12514
+ "text-lg font-medium",
12515
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
12516
+ ),
12517
+ children: displayText
12518
+ }
12519
+ ),
12520
+ description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
12521
+ actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
12522
+ Button,
12523
+ {
12524
+ className: "mt-4",
12525
+ variant: isDestructive ? "danger" : "primary",
12526
+ onClick: handleAction,
12527
+ children: actionLabel
12528
+ }
12529
+ )
12530
+ ]
12531
+ }
12532
+ );
12533
+ };
12534
+ EmptyState.displayName = "EmptyState";
12535
+ }
12536
+ });
12188
12537
  function computeFoldRegions(code) {
12189
12538
  const lines = code.split("\n");
12190
12539
  const regions = [];
@@ -12222,9 +12571,32 @@ function computeFoldRegions(code) {
12222
12571
  function toCodeLanguage(value) {
12223
12572
  return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
12224
12573
  }
12225
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12574
+ function generateDiff(oldVal, newVal) {
12575
+ const oldLines = oldVal.split("\n");
12576
+ const newLines = newVal.split("\n");
12577
+ const diff = [];
12578
+ const maxLen = Math.max(oldLines.length, newLines.length);
12579
+ for (let i = 0; i < maxLen; i++) {
12580
+ const oldLine = oldLines[i];
12581
+ const newLine = newLines[i];
12582
+ if (oldLine === newLine) {
12583
+ diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
12584
+ } else {
12585
+ if (oldLine !== void 0) diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
12586
+ if (newLine !== void 0) diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
12587
+ }
12588
+ }
12589
+ return diff;
12590
+ }
12591
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12226
12592
  var init_CodeBlock = __esm({
12227
12593
  "components/core/molecules/markdown/CodeBlock.tsx"() {
12594
+ init_cn();
12595
+ init_atoms2();
12596
+ init_Tabs();
12597
+ init_LoadingState();
12598
+ init_ErrorState();
12599
+ init_EmptyState();
12228
12600
  init_Box();
12229
12601
  init_Button();
12230
12602
  init_Badge();
@@ -12331,9 +12703,14 @@ var init_CodeBlock = __esm({
12331
12703
  "lolo"
12332
12704
  ];
12333
12705
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
12706
+ DIFF_STYLES = {
12707
+ add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12708
+ remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12709
+ context: { bg: "", prefix: " ", text: "text-foreground" }
12710
+ };
12334
12711
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12335
12712
  HIDDEN_LINE_NUMBERS = { display: "none" };
12336
- CodeBlock = React81__default.memo(
12713
+ CodeBlock = React79__default.memo(
12337
12714
  ({
12338
12715
  code: rawCode,
12339
12716
  language = "text",
@@ -12344,7 +12721,20 @@ var init_CodeBlock = __esm({
12344
12721
  className,
12345
12722
  editable = false,
12346
12723
  onChange,
12347
- errorLines
12724
+ errorLines,
12725
+ // viewer props
12726
+ title,
12727
+ mode = "code",
12728
+ diff: propDiff,
12729
+ oldValue,
12730
+ newValue,
12731
+ showLineNumbers = false,
12732
+ wordWrap = false,
12733
+ files,
12734
+ actions,
12735
+ isLoading = false,
12736
+ error,
12737
+ showCopy
12348
12738
  }) => {
12349
12739
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
12350
12740
  const isOrb = language === "orb";
@@ -12356,6 +12746,20 @@ var init_CodeBlock = __esm({
12356
12746
  const codeRef = useRef(null);
12357
12747
  const savedScrollLeftRef = useRef(0);
12358
12748
  const [copied, setCopied] = useState(false);
12749
+ const [wrap, setWrap] = useState(wordWrap);
12750
+ const [activeFileIndex, setActiveFileIndex] = useState(0);
12751
+ const activeFile = files?.[activeFileIndex];
12752
+ const activeCode = activeFile?.code ?? code;
12753
+ const activeLanguage = activeFile?.language ?? language;
12754
+ const diffLines = useMemo(() => {
12755
+ if (propDiff) return propDiff;
12756
+ if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
12757
+ return generateDiff(oldValue, newValue);
12758
+ }
12759
+ return null;
12760
+ }, [propDiff, mode, oldValue, newValue]);
12761
+ const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
12762
+ const effectiveCopy = showCopy ?? showCopyButton;
12359
12763
  const [editableValue, setEditableValue] = useState(code);
12360
12764
  const [editableTextareaKey, setEditableTextareaKey] = useState(0);
12361
12765
  const lastPropCodeRef = useRef(code);
@@ -12526,13 +12930,13 @@ var init_CodeBlock = __esm({
12526
12930
  }, [language, code]);
12527
12931
  const handleCopy = async () => {
12528
12932
  try {
12529
- await navigator.clipboard.writeText(code);
12933
+ await navigator.clipboard.writeText(activeCode);
12530
12934
  setCopied(true);
12531
- eventBus.emit("UI:COPY_CODE", { language, success: true });
12935
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
12532
12936
  setTimeout(() => setCopied(false), 2e3);
12533
12937
  } catch (err) {
12534
12938
  log5.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
12535
- eventBus.emit("UI:COPY_CODE", { language, success: false });
12939
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
12536
12940
  }
12537
12941
  };
12538
12942
  const handleSelectionCopy = useCallback((e) => {
@@ -12585,11 +12989,134 @@ var init_CodeBlock = __esm({
12585
12989
  }
12586
12990
  });
12587
12991
  }
12588
- const full = code.split("\n").slice(a, endLine + 1).join("\n");
12992
+ const full = activeCode.split("\n").slice(a, endLine + 1).join("\n");
12589
12993
  e.clipboardData.setData("text/plain", full);
12590
12994
  e.preventDefault();
12591
12995
  }, [code]);
12592
- const hasHeader = showLanguageBadge || showCopyButton;
12996
+ if (isLoading) {
12997
+ return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
12998
+ }
12999
+ if (error) {
13000
+ return /* @__PURE__ */ jsx(ErrorState, { title: t("display.codeViewerError"), message: error.message, className });
13001
+ }
13002
+ if (isViewerMode && !activeCode && !diffLines) {
13003
+ return /* @__PURE__ */ jsx(EmptyState, { icon: Code, title: t("display.noCode"), description: "No code to display.", className });
13004
+ }
13005
+ if (isViewerMode) {
13006
+ const tabItems = files?.map((file, idx) => ({
13007
+ id: `file-${idx}`,
13008
+ label: file.label,
13009
+ content: null
13010
+ }));
13011
+ const lines = activeCode.split("\n");
13012
+ return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
13013
+ tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
13014
+ Tabs,
13015
+ {
13016
+ tabs: tabItems,
13017
+ activeTab: `file-${activeFileIndex}`,
13018
+ onTabChange: (id) => {
13019
+ const idx = parseInt(id.replace("file-", ""), 10);
13020
+ setActiveFileIndex(idx);
13021
+ }
13022
+ }
13023
+ ) }),
13024
+ /* @__PURE__ */ jsxs(
13025
+ HStack,
13026
+ {
13027
+ gap: "sm",
13028
+ align: "center",
13029
+ justify: "between",
13030
+ className: "px-4 py-2 border-b border-border bg-muted/30",
13031
+ children: [
13032
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
13033
+ /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
13034
+ title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
13035
+ activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
13036
+ ] }),
13037
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
13038
+ /* @__PURE__ */ jsx(
13039
+ Button,
13040
+ {
13041
+ variant: "ghost",
13042
+ size: "sm",
13043
+ icon: WrapText,
13044
+ onClick: () => setWrap(!wrap),
13045
+ className: cn(wrap && "text-primary")
13046
+ }
13047
+ ),
13048
+ effectiveCopy && /* @__PURE__ */ jsx(
13049
+ Button,
13050
+ {
13051
+ variant: "ghost",
13052
+ size: "sm",
13053
+ icon: copied ? Check : Copy,
13054
+ onClick: handleCopy,
13055
+ className: cn(copied && "text-success")
13056
+ }
13057
+ ),
13058
+ actions?.map((action, idx) => /* @__PURE__ */ jsx(
13059
+ Badge,
13060
+ {
13061
+ variant: "default",
13062
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
13063
+ onClick: () => {
13064
+ if (action.event) eventBus.emit(`UI:${action.event}`, {});
13065
+ },
13066
+ children: action.label
13067
+ },
13068
+ idx
13069
+ ))
13070
+ ] })
13071
+ ]
13072
+ }
13073
+ ),
13074
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
13075
+ const style = DIFF_STYLES[line.type];
13076
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
13077
+ showLineNumbers && /* @__PURE__ */ jsx(
13078
+ Typography,
13079
+ {
13080
+ variant: "caption",
13081
+ color: "secondary",
13082
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
13083
+ children: line.lineNumber ?? ""
13084
+ }
13085
+ ),
13086
+ /* @__PURE__ */ jsxs(
13087
+ Typography,
13088
+ {
13089
+ variant: "caption",
13090
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
13091
+ children: [
13092
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
13093
+ line.content
13094
+ ]
13095
+ }
13096
+ )
13097
+ ] }, idx);
13098
+ }) }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
13099
+ showLineNumbers && /* @__PURE__ */ jsx(
13100
+ Typography,
13101
+ {
13102
+ variant: "caption",
13103
+ color: "secondary",
13104
+ className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
13105
+ children: idx + 1
13106
+ }
13107
+ ),
13108
+ /* @__PURE__ */ jsx(
13109
+ Typography,
13110
+ {
13111
+ variant: "caption",
13112
+ className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
13113
+ children: line || " "
13114
+ }
13115
+ )
13116
+ ] }, idx)) }) })
13117
+ ] }) });
13118
+ }
13119
+ const hasHeader = showLanguageBadge || effectiveCopy;
12593
13120
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
12594
13121
  hasHeader && /* @__PURE__ */ jsxs(
12595
13122
  HStack,
@@ -12599,7 +13126,7 @@ var init_CodeBlock = __esm({
12599
13126
  className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
12600
13127
  children: [
12601
13128
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
12602
- showCopyButton && /* @__PURE__ */ jsx(
13129
+ effectiveCopy && /* @__PURE__ */ jsx(
12603
13130
  Button,
12604
13131
  {
12605
13132
  variant: "ghost",
@@ -12758,7 +13285,7 @@ var init_CodeBlock = __esm({
12758
13285
  )
12759
13286
  ] });
12760
13287
  },
12761
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
13288
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error
12762
13289
  );
12763
13290
  CodeBlock.displayName = "CodeBlock";
12764
13291
  }
@@ -12770,8 +13297,8 @@ var init_MarkdownContent = __esm({
12770
13297
  init_Box();
12771
13298
  init_CodeBlock();
12772
13299
  init_cn();
12773
- MarkdownContent = React81__default.memo(
12774
- ({ content, direction, className }) => {
13300
+ MarkdownContent = React79__default.memo(
13301
+ ({ content, direction = "ltr", className }) => {
12775
13302
  const { t: _t } = useTranslate();
12776
13303
  const safeContent = typeof content === "string" ? content : String(content ?? "");
12777
13304
  return /* @__PURE__ */ jsx(
@@ -13866,7 +14393,7 @@ var init_StateMachineView = __esm({
13866
14393
  style: { top: title ? 30 : 0 },
13867
14394
  children: [
13868
14395
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
13869
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React81__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
14396
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React79__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
13870
14397
  StateNode,
13871
14398
  {
13872
14399
  state,
@@ -15015,110 +15542,6 @@ var init_BookTableOfContents = __esm({
15015
15542
  BookTableOfContents.displayName = "BookTableOfContents";
15016
15543
  }
15017
15544
  });
15018
- var ICON_NAME_ALIASES, lookStyles3, EmptyState;
15019
- var init_EmptyState = __esm({
15020
- "components/core/molecules/EmptyState.tsx"() {
15021
- "use client";
15022
- init_cn();
15023
- init_atoms2();
15024
- init_Box();
15025
- init_Icon();
15026
- init_Stack();
15027
- init_Typography();
15028
- init_useEventBus();
15029
- ICON_NAME_ALIASES = {
15030
- check: "check-circle",
15031
- error: "x-circle",
15032
- warning: "alert-circle"
15033
- };
15034
- lookStyles3 = {
15035
- "icon-only": "",
15036
- illustrated: "[&_svg]:w-32 [&_svg]:h-32",
15037
- "text-only": "[&_svg]:hidden",
15038
- mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
15039
- };
15040
- EmptyState = ({
15041
- icon,
15042
- title,
15043
- message,
15044
- description,
15045
- actionLabel,
15046
- onAction,
15047
- className,
15048
- destructive,
15049
- variant,
15050
- actionEvent,
15051
- look = "icon-only"
15052
- }) => {
15053
- const eventBus = useEventBus();
15054
- const { t } = useTranslate();
15055
- const handleAction = () => {
15056
- if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
15057
- onAction?.();
15058
- };
15059
- const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
15060
- const iconComponent = typeof icon === "function" ? icon : void 0;
15061
- const hasIcon = Boolean(iconName || iconComponent);
15062
- const isDestructive = destructive || variant === "error";
15063
- const isSuccess = variant === "success";
15064
- const displayText = title || message || t("empty.noItems");
15065
- return /* @__PURE__ */ jsxs(
15066
- VStack,
15067
- {
15068
- align: "center",
15069
- className: cn(
15070
- "justify-center py-12 text-center",
15071
- lookStyles3[look],
15072
- className
15073
- ),
15074
- children: [
15075
- hasIcon && /* @__PURE__ */ jsx(
15076
- Box,
15077
- {
15078
- className: cn(
15079
- "mb-4 rounded-full p-3",
15080
- isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
15081
- ),
15082
- children: /* @__PURE__ */ jsx(
15083
- Icon,
15084
- {
15085
- ...iconName ? { name: iconName } : { icon: iconComponent },
15086
- className: cn(
15087
- "h-8 w-8",
15088
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
15089
- )
15090
- }
15091
- )
15092
- }
15093
- ),
15094
- /* @__PURE__ */ jsx(
15095
- Typography,
15096
- {
15097
- variant: "h3",
15098
- className: cn(
15099
- "text-lg font-medium",
15100
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
15101
- ),
15102
- children: displayText
15103
- }
15104
- ),
15105
- description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
15106
- actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
15107
- Button,
15108
- {
15109
- className: "mt-4",
15110
- variant: isDestructive ? "danger" : "primary",
15111
- onClick: handleAction,
15112
- children: actionLabel
15113
- }
15114
- )
15115
- ]
15116
- }
15117
- );
15118
- };
15119
- EmptyState.displayName = "EmptyState";
15120
- }
15121
- });
15122
15545
 
15123
15546
  // components/core/organisms/book/types.ts
15124
15547
  function resolveFieldMap(fieldMap) {
@@ -15471,7 +15894,7 @@ var init_Grid = __esm({
15471
15894
  as: Component = "div"
15472
15895
  }) => {
15473
15896
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
15474
- return React81__default.createElement(
15897
+ return React79__default.createElement(
15475
15898
  Component,
15476
15899
  {
15477
15900
  className: cn(
@@ -19960,449 +20383,6 @@ var init_ClassifierBoard = __esm({
19960
20383
  ClassifierBoard.displayName = "ClassifierBoard";
19961
20384
  }
19962
20385
  });
19963
- function CodeView({
19964
- data,
19965
- label,
19966
- defaultExpanded = false,
19967
- className
19968
- }) {
19969
- const { t } = useTranslate();
19970
- const [expanded, setExpanded] = useState(defaultExpanded);
19971
- const jsonString = JSON.stringify(data, null, 2);
19972
- return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
19973
- /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
19974
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
19975
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
19976
- ] }),
19977
- expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
19978
- Typography,
19979
- {
19980
- variant: "caption",
19981
- className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
19982
- children: jsonString
19983
- }
19984
- ) })
19985
- ] });
19986
- }
19987
- var init_CodeView = __esm({
19988
- "components/game/organisms/puzzles/state-architect/CodeView.tsx"() {
19989
- init_atoms2();
19990
- init_cn();
19991
- CodeView.displayName = "CodeView";
19992
- }
19993
- });
19994
- var Tabs;
19995
- var init_Tabs = __esm({
19996
- "components/core/molecules/Tabs.tsx"() {
19997
- "use client";
19998
- init_Icon();
19999
- init_Badge();
20000
- init_Typography();
20001
- init_Box();
20002
- init_cn();
20003
- init_useEventBus();
20004
- Tabs = ({
20005
- items,
20006
- tabs,
20007
- defaultActiveTab,
20008
- activeTab: controlledActiveTab,
20009
- onTabChange,
20010
- tabChangeEvent,
20011
- variant = "default",
20012
- orientation = "horizontal",
20013
- className
20014
- }) => {
20015
- const rawItems = items ?? tabs ?? [];
20016
- const safeItems = rawItems.map(({ id, value, ...rest }) => ({
20017
- ...rest,
20018
- id: id || value || ""
20019
- }));
20020
- const eventBus = useEventBus();
20021
- const { t } = useTranslate();
20022
- const initialActive = safeItems.find((item) => item.active)?.id;
20023
- const [internalActiveTab, setInternalActiveTab] = useState(
20024
- defaultActiveTab || initialActive || safeItems[0]?.id || ""
20025
- );
20026
- const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
20027
- const tabRefs = useRef({});
20028
- const handleTabChange = (tabId, tabEvent) => {
20029
- if (controlledActiveTab === void 0) {
20030
- setInternalActiveTab(tabId);
20031
- }
20032
- onTabChange?.(tabId);
20033
- if (tabChangeEvent) {
20034
- eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
20035
- }
20036
- if (tabEvent) {
20037
- eventBus.emit(`UI:${tabEvent}`, { tabId });
20038
- }
20039
- };
20040
- const handleKeyDown = (e, index) => {
20041
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
20042
- e.preventDefault();
20043
- const direction = e.key === "ArrowLeft" ? -1 : 1;
20044
- const nextIndex = (index + direction + safeItems.length) % safeItems.length;
20045
- const nextTab = safeItems[nextIndex];
20046
- if (nextTab && !nextTab.disabled) {
20047
- handleTabChange(nextTab.id);
20048
- tabRefs.current[nextTab.id]?.focus();
20049
- }
20050
- } else if (e.key === "Home" || e.key === "End") {
20051
- e.preventDefault();
20052
- const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
20053
- const targetTab = safeItems[targetIndex];
20054
- if (targetTab && !targetTab.disabled) {
20055
- handleTabChange(targetTab.id);
20056
- tabRefs.current[targetTab.id]?.focus();
20057
- }
20058
- }
20059
- };
20060
- const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
20061
- if (safeItems.length === 0) {
20062
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
20063
- }
20064
- const variantClasses2 = {
20065
- default: [
20066
- "border-b-[length:var(--border-width)] border-transparent",
20067
- "hover:border-muted-foreground",
20068
- "data-[active=true]:border-primary"
20069
- ].join(" "),
20070
- pills: [
20071
- "rounded-sm",
20072
- "data-[active=true]:bg-primary",
20073
- "data-[active=true]:text-primary-foreground"
20074
- ].join(" "),
20075
- underline: [
20076
- "border-b-[length:var(--border-width)] border-transparent",
20077
- "data-[active=true]:border-primary"
20078
- ].join(" ")
20079
- };
20080
- return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
20081
- /* @__PURE__ */ jsx(
20082
- Box,
20083
- {
20084
- role: "tablist",
20085
- className: cn(
20086
- "flex",
20087
- // Horizontal tab strip becomes a horizontally-scrollable lane
20088
- // below its container width — phones with many tabs scroll
20089
- // instead of clipping. `snap-x` snaps to each tab; the
20090
- // scrollbar is hidden for a cleaner affordance (the swipe
20091
- // gesture is the discoverability cue).
20092
- orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
20093
- variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
20094
- variant === "underline" && orientation === "vertical" && "border-b-0"
20095
- ),
20096
- children: safeItems.map((item, index) => {
20097
- const isActive = item.id === activeTab;
20098
- const isDisabled = item.disabled;
20099
- return /* @__PURE__ */ jsxs(
20100
- Box,
20101
- {
20102
- as: "button",
20103
- ref: (el) => {
20104
- tabRefs.current[item.id] = el;
20105
- },
20106
- role: "tab",
20107
- "aria-selected": isActive,
20108
- "aria-controls": `tabpanel-${item.id}`,
20109
- "aria-disabled": isDisabled,
20110
- onClick: () => !isDisabled && handleTabChange(item.id, item.event),
20111
- onKeyDown: (e) => handleKeyDown(e, index),
20112
- "data-active": isActive,
20113
- className: cn(
20114
- "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
20115
- orientation === "horizontal" && "snap-start shrink-0",
20116
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
20117
- isDisabled && "opacity-50 cursor-not-allowed",
20118
- variantClasses2[variant],
20119
- isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
20120
- ),
20121
- children: [
20122
- item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
20123
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
20124
- item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
20125
- ]
20126
- },
20127
- item.id
20128
- );
20129
- })
20130
- }
20131
- ),
20132
- activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
20133
- Box,
20134
- {
20135
- role: "tabpanel",
20136
- id: `tabpanel-${activeTab}`,
20137
- "aria-labelledby": `tab-${activeTab}`,
20138
- className: "mt-4",
20139
- children: activeTabContent
20140
- }
20141
- )
20142
- ] });
20143
- };
20144
- Tabs.displayName = "Tabs";
20145
- }
20146
- });
20147
- function generateDiff(oldVal, newVal) {
20148
- const oldLines = oldVal.split("\n");
20149
- const newLines = newVal.split("\n");
20150
- const diff = [];
20151
- const maxLen = Math.max(oldLines.length, newLines.length);
20152
- for (let i = 0; i < maxLen; i++) {
20153
- const oldLine = oldLines[i];
20154
- const newLine = newLines[i];
20155
- if (oldLine === newLine) {
20156
- diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
20157
- } else {
20158
- if (oldLine !== void 0) {
20159
- diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
20160
- }
20161
- if (newLine !== void 0) {
20162
- diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
20163
- }
20164
- }
20165
- }
20166
- return diff;
20167
- }
20168
- var DIFF_STYLES, CodeViewer;
20169
- var init_CodeViewer = __esm({
20170
- "components/core/molecules/CodeViewer.tsx"() {
20171
- "use client";
20172
- init_cn();
20173
- init_atoms2();
20174
- init_Stack();
20175
- init_LoadingState();
20176
- init_ErrorState();
20177
- init_EmptyState();
20178
- init_Tabs();
20179
- init_useEventBus();
20180
- DIFF_STYLES = {
20181
- add: {
20182
- bg: "bg-success/10",
20183
- prefix: "+",
20184
- text: "text-success"
20185
- },
20186
- remove: {
20187
- bg: "bg-error/10",
20188
- prefix: "-",
20189
- text: "text-error"
20190
- },
20191
- context: {
20192
- bg: "",
20193
- prefix: " ",
20194
- text: "text-foreground"
20195
- }
20196
- };
20197
- CodeViewer = ({
20198
- title,
20199
- code,
20200
- language,
20201
- diff: propDiff,
20202
- oldValue,
20203
- newValue,
20204
- mode = "code",
20205
- showLineNumbers = true,
20206
- showCopy = true,
20207
- wordWrap = false,
20208
- maxHeight = 500,
20209
- files,
20210
- actions,
20211
- entity,
20212
- isLoading = false,
20213
- error,
20214
- className
20215
- }) => {
20216
- const eventBus = useEventBus();
20217
- const { t } = useTranslate();
20218
- const [copied, setCopied] = useState(false);
20219
- const [wrap, setWrap] = useState(wordWrap);
20220
- const [activeFileIndex, setActiveFileIndex] = useState(0);
20221
- const handleAction = useCallback(
20222
- (action) => {
20223
- if (action.event) {
20224
- eventBus.emit(`UI:${action.event}`, {});
20225
- }
20226
- },
20227
- [eventBus]
20228
- );
20229
- const activeFile = files?.[activeFileIndex];
20230
- const activeCode = activeFile?.code ?? code ?? "";
20231
- const activeLanguage = activeFile?.language ?? language ?? "text";
20232
- const lines = useMemo(() => activeCode.split("\n"), [activeCode]);
20233
- const diffLines = useMemo(() => {
20234
- if (propDiff) return propDiff;
20235
- if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
20236
- return generateDiff(oldValue, newValue);
20237
- }
20238
- return null;
20239
- }, [propDiff, mode, oldValue, newValue]);
20240
- const handleCopy = useCallback(async () => {
20241
- try {
20242
- await navigator.clipboard.writeText(activeCode);
20243
- setCopied(true);
20244
- eventBus.emit("UI:CODE_COPY", { language: activeLanguage });
20245
- setTimeout(() => setCopied(false), 2e3);
20246
- } catch {
20247
- }
20248
- }, [activeCode, eventBus, activeLanguage]);
20249
- const tabItems = files?.map((file, idx) => ({
20250
- id: `file-${idx}`,
20251
- label: file.label,
20252
- content: null
20253
- }));
20254
- if (isLoading) {
20255
- return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
20256
- }
20257
- if (error) {
20258
- return /* @__PURE__ */ jsx(
20259
- ErrorState,
20260
- {
20261
- title: t("display.codeViewerError"),
20262
- message: error.message,
20263
- className
20264
- }
20265
- );
20266
- }
20267
- if (!activeCode && !diffLines) {
20268
- return /* @__PURE__ */ jsx(
20269
- EmptyState,
20270
- {
20271
- icon: Code,
20272
- title: t("display.noCode"),
20273
- description: "No code to display.",
20274
- className
20275
- }
20276
- );
20277
- }
20278
- return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
20279
- tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
20280
- Tabs,
20281
- {
20282
- tabs: tabItems,
20283
- activeTab: `file-${activeFileIndex}`,
20284
- onTabChange: (id) => {
20285
- const idx = parseInt(id.replace("file-", ""), 10);
20286
- setActiveFileIndex(idx);
20287
- }
20288
- }
20289
- ) }),
20290
- /* @__PURE__ */ jsxs(
20291
- HStack,
20292
- {
20293
- gap: "sm",
20294
- align: "center",
20295
- justify: "between",
20296
- className: "px-4 py-2 border-b border-border bg-muted/30",
20297
- children: [
20298
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
20299
- /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
20300
- title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
20301
- activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
20302
- ] }),
20303
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
20304
- /* @__PURE__ */ jsx(
20305
- Button,
20306
- {
20307
- variant: "ghost",
20308
- size: "sm",
20309
- icon: WrapText,
20310
- onClick: () => setWrap(!wrap),
20311
- className: cn(wrap && "text-primary")
20312
- }
20313
- ),
20314
- showCopy && /* @__PURE__ */ jsx(
20315
- Button,
20316
- {
20317
- variant: "ghost",
20318
- size: "sm",
20319
- icon: copied ? Check : Copy,
20320
- onClick: handleCopy,
20321
- className: cn(copied && "text-success")
20322
- }
20323
- ),
20324
- actions?.map((action, idx) => /* @__PURE__ */ jsx(
20325
- Badge,
20326
- {
20327
- variant: "default",
20328
- className: "cursor-pointer hover:opacity-80 transition-opacity",
20329
- onClick: () => handleAction(action),
20330
- children: action.label
20331
- },
20332
- idx
20333
- ))
20334
- ] })
20335
- ]
20336
- }
20337
- ),
20338
- /* @__PURE__ */ jsx(
20339
- Box,
20340
- {
20341
- className: "overflow-auto bg-muted/20",
20342
- style: { maxHeight },
20343
- children: diffLines ? (
20344
- /* Diff mode */
20345
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: diffLines.map((line, idx) => {
20346
- const style = DIFF_STYLES[line.type];
20347
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
20348
- showLineNumbers && /* @__PURE__ */ jsx(
20349
- Typography,
20350
- {
20351
- variant: "caption",
20352
- color: "secondary",
20353
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
20354
- children: line.lineNumber ?? ""
20355
- }
20356
- ),
20357
- /* @__PURE__ */ jsxs(
20358
- Typography,
20359
- {
20360
- variant: "caption",
20361
- className: cn(
20362
- "font-mono flex-1 min-w-0",
20363
- style.text,
20364
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
20365
- ),
20366
- children: [
20367
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
20368
- line.content
20369
- ]
20370
- }
20371
- )
20372
- ] }, idx);
20373
- }) })
20374
- ) : (
20375
- /* Code mode */
20376
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
20377
- showLineNumbers && /* @__PURE__ */ jsx(
20378
- Typography,
20379
- {
20380
- variant: "caption",
20381
- color: "secondary",
20382
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
20383
- children: idx + 1
20384
- }
20385
- ),
20386
- /* @__PURE__ */ jsx(
20387
- Typography,
20388
- {
20389
- variant: "caption",
20390
- className: cn(
20391
- "font-mono flex-1 min-w-0",
20392
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
20393
- ),
20394
- children: line || " "
20395
- }
20396
- )
20397
- ] }, idx)) })
20398
- )
20399
- }
20400
- )
20401
- ] }) });
20402
- };
20403
- CodeViewer.displayName = "CodeViewer";
20404
- }
20405
- });
20406
20386
  function CombatLog({
20407
20387
  events: events2,
20408
20388
  maxVisible = 50,
@@ -21009,7 +20989,7 @@ function CraftingRecipe({
21009
20989
  className
21010
20990
  }) {
21011
20991
  const eventBus = useEventBus();
21012
- const handleCraft = React81.useCallback(() => {
20992
+ const handleCraft = React79.useCallback(() => {
21013
20993
  onCraft?.();
21014
20994
  if (craftEvent) {
21015
20995
  eventBus.emit(craftEvent, { output: output.label });
@@ -21026,7 +21006,7 @@ function CraftingRecipe({
21026
21006
  children: [
21027
21007
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
21028
21008
  const hasSufficient = ingredient.available >= ingredient.required;
21029
- return /* @__PURE__ */ jsxs(React81.Fragment, { children: [
21009
+ return /* @__PURE__ */ jsxs(React79.Fragment, { children: [
21030
21010
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
21031
21011
  ItemSlot,
21032
21012
  {
@@ -21089,8 +21069,8 @@ function DPad({
21089
21069
  }) {
21090
21070
  const eventBus = useEventBus();
21091
21071
  const sizes = sizeMap6[size];
21092
- const [activeDirections, setActiveDirections] = React81.useState(/* @__PURE__ */ new Set());
21093
- const handlePress = React81.useCallback(
21072
+ const [activeDirections, setActiveDirections] = React79.useState(/* @__PURE__ */ new Set());
21073
+ const handlePress = React79.useCallback(
21094
21074
  (direction) => {
21095
21075
  setActiveDirections((prev) => new Set(prev).add(direction));
21096
21076
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -21098,7 +21078,7 @@ function DPad({
21098
21078
  },
21099
21079
  [directionEvent, eventBus, onDirection]
21100
21080
  );
21101
- const handleRelease = React81.useCallback(
21081
+ const handleRelease = React79.useCallback(
21102
21082
  (direction) => {
21103
21083
  setActiveDirections((prev) => {
21104
21084
  const next = new Set(prev);
@@ -21833,14 +21813,14 @@ function useDataDnd(args) {
21833
21813
  const isZone = Boolean(dragGroup || accepts || sortable);
21834
21814
  const enabled = isZone || Boolean(dndRoot);
21835
21815
  const eventBus = useEventBus();
21836
- const parentRoot = React81__default.useContext(RootCtx);
21816
+ const parentRoot = React79__default.useContext(RootCtx);
21837
21817
  const isRoot = enabled && parentRoot === null;
21838
- const zoneId = React81__default.useId();
21818
+ const zoneId = React79__default.useId();
21839
21819
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21840
- const [optimisticOrders, setOptimisticOrders] = React81__default.useState(() => /* @__PURE__ */ new Map());
21841
- const optimisticOrdersRef = React81__default.useRef(optimisticOrders);
21820
+ const [optimisticOrders, setOptimisticOrders] = React79__default.useState(() => /* @__PURE__ */ new Map());
21821
+ const optimisticOrdersRef = React79__default.useRef(optimisticOrders);
21842
21822
  optimisticOrdersRef.current = optimisticOrders;
21843
- const clearOptimisticOrder = React81__default.useCallback((group) => {
21823
+ const clearOptimisticOrder = React79__default.useCallback((group) => {
21844
21824
  setOptimisticOrders((prev) => {
21845
21825
  if (!prev.has(group)) return prev;
21846
21826
  const next = new Map(prev);
@@ -21865,7 +21845,7 @@ function useDataDnd(args) {
21865
21845
  const raw = it[dndItemIdField];
21866
21846
  return String(raw ?? `__idx_${idx}`);
21867
21847
  }).join("|");
21868
- const itemIds = React81__default.useMemo(
21848
+ const itemIds = React79__default.useMemo(
21869
21849
  () => orderedItems.map((it, idx) => {
21870
21850
  const raw = it[dndItemIdField];
21871
21851
  return raw ?? `__idx_${idx}`;
@@ -21873,7 +21853,7 @@ function useDataDnd(args) {
21873
21853
  [itemIdsSignature]
21874
21854
  );
21875
21855
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
21876
- React81__default.useEffect(() => {
21856
+ React79__default.useEffect(() => {
21877
21857
  const root = isRoot ? null : parentRoot;
21878
21858
  if (root) {
21879
21859
  root.clearOptimisticOrder(ownGroup);
@@ -21881,20 +21861,20 @@ function useDataDnd(args) {
21881
21861
  clearOptimisticOrder(ownGroup);
21882
21862
  }
21883
21863
  }, [itemsContentSig, ownGroup]);
21884
- const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
21885
- const registerZone = React81__default.useCallback((zoneId2, meta2) => {
21864
+ const zonesRef = React79__default.useRef(/* @__PURE__ */ new Map());
21865
+ const registerZone = React79__default.useCallback((zoneId2, meta2) => {
21886
21866
  zonesRef.current.set(zoneId2, meta2);
21887
21867
  }, []);
21888
- const unregisterZone = React81__default.useCallback((zoneId2) => {
21868
+ const unregisterZone = React79__default.useCallback((zoneId2) => {
21889
21869
  zonesRef.current.delete(zoneId2);
21890
21870
  }, []);
21891
- const [activeDrag, setActiveDrag] = React81__default.useState(null);
21892
- const [overZoneGroup, setOverZoneGroup] = React81__default.useState(null);
21893
- const meta = React81__default.useMemo(
21871
+ const [activeDrag, setActiveDrag] = React79__default.useState(null);
21872
+ const [overZoneGroup, setOverZoneGroup] = React79__default.useState(null);
21873
+ const meta = React79__default.useMemo(
21894
21874
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
21895
21875
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
21896
21876
  );
21897
- React81__default.useEffect(() => {
21877
+ React79__default.useEffect(() => {
21898
21878
  const target = isRoot ? null : parentRoot;
21899
21879
  if (!target) {
21900
21880
  zonesRef.current.set(zoneId, meta);
@@ -21913,7 +21893,7 @@ function useDataDnd(args) {
21913
21893
  }, [parentRoot, isRoot, zoneId, meta]);
21914
21894
  const sensors = useAlmadarDndSensors(true);
21915
21895
  const collisionDetection = almadarDndCollisionDetection;
21916
- const findZoneByItem = React81__default.useCallback(
21896
+ const findZoneByItem = React79__default.useCallback(
21917
21897
  (id) => {
21918
21898
  for (const z of zonesRef.current.values()) {
21919
21899
  if (z.itemIds.includes(id)) return z;
@@ -21922,7 +21902,7 @@ function useDataDnd(args) {
21922
21902
  },
21923
21903
  []
21924
21904
  );
21925
- React81__default.useCallback(
21905
+ React79__default.useCallback(
21926
21906
  (group) => {
21927
21907
  for (const z of zonesRef.current.values()) {
21928
21908
  if (z.group === group) return z;
@@ -21931,7 +21911,7 @@ function useDataDnd(args) {
21931
21911
  },
21932
21912
  []
21933
21913
  );
21934
- const handleDragEnd = React81__default.useCallback(
21914
+ const handleDragEnd = React79__default.useCallback(
21935
21915
  (event) => {
21936
21916
  const { active, over } = event;
21937
21917
  const activeIdStr = String(active.id);
@@ -22022,8 +22002,8 @@ function useDataDnd(args) {
22022
22002
  },
22023
22003
  [eventBus]
22024
22004
  );
22025
- const sortableData = React81__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22026
- const SortableItem = React81__default.useCallback(
22005
+ const sortableData = React79__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
22006
+ const SortableItem = React79__default.useCallback(
22027
22007
  ({ id, children }) => {
22028
22008
  const {
22029
22009
  attributes,
@@ -22063,7 +22043,7 @@ function useDataDnd(args) {
22063
22043
  id: droppableId,
22064
22044
  data: sortableData
22065
22045
  });
22066
- const ctx = React81__default.useContext(RootCtx);
22046
+ const ctx = React79__default.useContext(RootCtx);
22067
22047
  const activeDrag2 = ctx?.activeDrag ?? null;
22068
22048
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
22069
22049
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -22078,7 +22058,7 @@ function useDataDnd(args) {
22078
22058
  showForeignPlaceholder,
22079
22059
  ctxAvailable: ctx != null
22080
22060
  });
22081
- React81__default.useEffect(() => {
22061
+ React79__default.useEffect(() => {
22082
22062
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
22083
22063
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
22084
22064
  return /* @__PURE__ */ jsx(
@@ -22092,11 +22072,11 @@ function useDataDnd(args) {
22092
22072
  }
22093
22073
  );
22094
22074
  };
22095
- const rootContextValue = React81__default.useMemo(
22075
+ const rootContextValue = React79__default.useMemo(
22096
22076
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
22097
22077
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
22098
22078
  );
22099
- const handleDragStart = React81__default.useCallback((event) => {
22079
+ const handleDragStart = React79__default.useCallback((event) => {
22100
22080
  const sourceZone = findZoneByItem(event.active.id);
22101
22081
  const rect = event.active.rect.current.initial;
22102
22082
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -22115,7 +22095,7 @@ function useDataDnd(args) {
22115
22095
  isRoot
22116
22096
  });
22117
22097
  }, [findZoneByItem, isRoot, zoneId]);
22118
- const handleDragOver = React81__default.useCallback((event) => {
22098
+ const handleDragOver = React79__default.useCallback((event) => {
22119
22099
  const { active, over } = event;
22120
22100
  const overData = over?.data?.current;
22121
22101
  const overGroup = overData?.dndGroup ?? null;
@@ -22185,7 +22165,7 @@ function useDataDnd(args) {
22185
22165
  return next;
22186
22166
  });
22187
22167
  }, []);
22188
- const handleDragCancel = React81__default.useCallback((event) => {
22168
+ const handleDragCancel = React79__default.useCallback((event) => {
22189
22169
  setActiveDrag(null);
22190
22170
  setOverZoneGroup(null);
22191
22171
  dndLog.warn("dragCancel", {
@@ -22193,12 +22173,12 @@ function useDataDnd(args) {
22193
22173
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
22194
22174
  });
22195
22175
  }, []);
22196
- const handleDragEndWithCleanup = React81__default.useCallback((event) => {
22176
+ const handleDragEndWithCleanup = React79__default.useCallback((event) => {
22197
22177
  handleDragEnd(event);
22198
22178
  setActiveDrag(null);
22199
22179
  setOverZoneGroup(null);
22200
22180
  }, [handleDragEnd]);
22201
- const wrapContainer = React81__default.useCallback(
22181
+ const wrapContainer = React79__default.useCallback(
22202
22182
  (children) => {
22203
22183
  if (!enabled) return children;
22204
22184
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -22252,7 +22232,7 @@ var init_useDataDnd = __esm({
22252
22232
  init_useAlmadarDndCollision();
22253
22233
  init_Box();
22254
22234
  dndLog = createLogger("almadar:ui:dnd");
22255
- RootCtx = React81__default.createContext(null);
22235
+ RootCtx = React79__default.createContext(null);
22256
22236
  }
22257
22237
  });
22258
22238
  function fieldLabel2(key) {
@@ -22772,7 +22752,7 @@ function DataList({
22772
22752
  }) {
22773
22753
  const eventBus = useEventBus();
22774
22754
  const { t } = useTranslate();
22775
- const [visibleCount, setVisibleCount] = React81__default.useState(pageSize || Infinity);
22755
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize || Infinity);
22776
22756
  const fieldDefs = fields ?? columns ?? [];
22777
22757
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
22778
22758
  const dnd = useDataDnd({
@@ -22791,7 +22771,7 @@ function DataList({
22791
22771
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
22792
22772
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
22793
22773
  const hasRenderProp = typeof children === "function";
22794
- React81__default.useEffect(() => {
22774
+ React79__default.useEffect(() => {
22795
22775
  const renderItemTypeOf = typeof schemaRenderItem;
22796
22776
  const childrenTypeOf = typeof children;
22797
22777
  if (data.length > 0 && !hasRenderProp) {
@@ -22896,7 +22876,7 @@ function DataList({
22896
22876
  const items2 = data.map((item) => item);
22897
22877
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
22898
22878
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
22899
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
22879
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
22900
22880
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
22901
22881
  group.items.map((itemData, index) => {
22902
22882
  const id = itemData.id || `${gi}-${index}`;
@@ -23044,7 +23024,7 @@ function DataList({
23044
23024
  className
23045
23025
  ),
23046
23026
  children: [
23047
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
23027
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
23048
23028
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
23049
23029
  group.items.map(
23050
23030
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -23107,6 +23087,422 @@ var init_DataList = __esm({
23107
23087
  DataList.displayName = "DataList";
23108
23088
  }
23109
23089
  });
23090
+ function isTraitConfigObject(v) {
23091
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23092
+ }
23093
+ function LeafControl({
23094
+ value,
23095
+ onChange
23096
+ }) {
23097
+ if (typeof value === "boolean") {
23098
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
23099
+ }
23100
+ if (typeof value === "number") {
23101
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23102
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23103
+ const commit2 = () => {
23104
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23105
+ onChange(Number.isNaN(n) ? 0 : n);
23106
+ };
23107
+ return /* @__PURE__ */ jsx(
23108
+ Input,
23109
+ {
23110
+ inputType: "number",
23111
+ value: draft2,
23112
+ onChange: (e) => setDraft2(e.target.value),
23113
+ onBlur: commit2,
23114
+ onKeyDown: (e) => {
23115
+ if (e.key === "Enter") commit2();
23116
+ }
23117
+ }
23118
+ );
23119
+ }
23120
+ if (isTraitConfigObject(value)) {
23121
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23122
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23123
+ const commit2 = () => {
23124
+ try {
23125
+ const parsed = JSON.parse(draft2);
23126
+ onChange(parsed);
23127
+ } catch {
23128
+ }
23129
+ };
23130
+ return /* @__PURE__ */ jsx(
23131
+ Input,
23132
+ {
23133
+ inputType: "text",
23134
+ value: draft2,
23135
+ onChange: (e) => setDraft2(e.target.value),
23136
+ onBlur: commit2,
23137
+ onKeyDown: (e) => {
23138
+ if (e.key === "Enter") commit2();
23139
+ }
23140
+ }
23141
+ );
23142
+ }
23143
+ if (Array.isArray(value)) {
23144
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23145
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23146
+ const commit2 = () => {
23147
+ try {
23148
+ const parsed = JSON.parse(draft2);
23149
+ onChange(parsed);
23150
+ } catch {
23151
+ }
23152
+ };
23153
+ return /* @__PURE__ */ jsx(
23154
+ Input,
23155
+ {
23156
+ inputType: "text",
23157
+ value: draft2,
23158
+ onChange: (e) => setDraft2(e.target.value),
23159
+ onBlur: commit2,
23160
+ onKeyDown: (e) => {
23161
+ if (e.key === "Enter") commit2();
23162
+ }
23163
+ }
23164
+ );
23165
+ }
23166
+ const strVal = value === null ? "" : String(value);
23167
+ const [draft, setDraft] = React79__default.useState(strVal);
23168
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23169
+ const commit = () => {
23170
+ onChange(draft);
23171
+ };
23172
+ return /* @__PURE__ */ jsx(
23173
+ Input,
23174
+ {
23175
+ inputType: "text",
23176
+ value: draft,
23177
+ onChange: (e) => setDraft(e.target.value),
23178
+ onBlur: commit,
23179
+ onKeyDown: (e) => {
23180
+ if (e.key === "Enter") commit();
23181
+ }
23182
+ }
23183
+ );
23184
+ }
23185
+ function cloneElement(template) {
23186
+ if (isTraitConfigObject(template)) {
23187
+ const blank = {};
23188
+ for (const k of Object.keys(template)) blank[k] = null;
23189
+ return blank;
23190
+ }
23191
+ if (Array.isArray(template)) return [];
23192
+ if (typeof template === "boolean") return false;
23193
+ if (typeof template === "number") return 0;
23194
+ return "";
23195
+ }
23196
+ var ArrayEditor;
23197
+ var init_ArrayEditor = __esm({
23198
+ "components/core/molecules/ArrayEditor.tsx"() {
23199
+ "use client";
23200
+ init_Stack();
23201
+ init_Button();
23202
+ init_Switch();
23203
+ init_Input();
23204
+ init_cn();
23205
+ ArrayEditor = ({ value, onChange, className }) => {
23206
+ const arr = value;
23207
+ const update = (idx, next) => {
23208
+ const copy = [...arr];
23209
+ copy[idx] = next;
23210
+ onChange(copy);
23211
+ };
23212
+ const remove = (idx) => {
23213
+ onChange(arr.filter((_, i) => i !== idx));
23214
+ };
23215
+ const add = () => {
23216
+ const template = arr.length > 0 ? arr[0] : "";
23217
+ onChange([...arr, cloneElement(template)]);
23218
+ };
23219
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("w-full", className), children: [
23220
+ arr.map((elem, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
23221
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(LeafControl, { value: elem, onChange: (next) => update(idx, next) }) }),
23222
+ /* @__PURE__ */ jsx(
23223
+ Button,
23224
+ {
23225
+ variant: "ghost",
23226
+ size: "sm",
23227
+ icon: "trash-2",
23228
+ onClick: () => remove(idx),
23229
+ "aria-label": "Remove item"
23230
+ }
23231
+ )
23232
+ ] }, idx)),
23233
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", icon: "plus", label: "Add item", onClick: add })
23234
+ ] });
23235
+ };
23236
+ }
23237
+ });
23238
+ function isTraitConfigObject2(v) {
23239
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23240
+ }
23241
+ function ScalarControl({
23242
+ fieldKey,
23243
+ value,
23244
+ onFieldChange
23245
+ }) {
23246
+ if (typeof value === "boolean") {
23247
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onFieldChange(fieldKey, c) });
23248
+ }
23249
+ if (typeof value === "number") {
23250
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23251
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23252
+ const commit2 = () => {
23253
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23254
+ onFieldChange(fieldKey, Number.isNaN(n) ? 0 : n);
23255
+ };
23256
+ return /* @__PURE__ */ jsx(
23257
+ Input,
23258
+ {
23259
+ inputType: "number",
23260
+ value: draft2,
23261
+ onChange: (e) => setDraft2(e.target.value),
23262
+ onBlur: commit2,
23263
+ onKeyDown: (e) => {
23264
+ if (e.key === "Enter") commit2();
23265
+ }
23266
+ }
23267
+ );
23268
+ }
23269
+ if (isTraitConfigObject2(value)) {
23270
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23271
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23272
+ const commit2 = () => {
23273
+ try {
23274
+ onFieldChange(fieldKey, JSON.parse(draft2));
23275
+ } catch {
23276
+ }
23277
+ };
23278
+ return /* @__PURE__ */ jsx(
23279
+ Input,
23280
+ {
23281
+ inputType: "text",
23282
+ value: draft2,
23283
+ onChange: (e) => setDraft2(e.target.value),
23284
+ onBlur: commit2,
23285
+ onKeyDown: (e) => {
23286
+ if (e.key === "Enter") commit2();
23287
+ }
23288
+ }
23289
+ );
23290
+ }
23291
+ if (Array.isArray(value)) {
23292
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23293
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23294
+ const commit2 = () => {
23295
+ try {
23296
+ onFieldChange(fieldKey, JSON.parse(draft2));
23297
+ } catch {
23298
+ }
23299
+ };
23300
+ return /* @__PURE__ */ jsx(
23301
+ Input,
23302
+ {
23303
+ inputType: "text",
23304
+ value: draft2,
23305
+ onChange: (e) => setDraft2(e.target.value),
23306
+ onBlur: commit2,
23307
+ onKeyDown: (e) => {
23308
+ if (e.key === "Enter") commit2();
23309
+ }
23310
+ }
23311
+ );
23312
+ }
23313
+ const [draft, setDraft] = React79__default.useState(value === null ? "" : String(value));
23314
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23315
+ const commit = () => {
23316
+ onFieldChange(fieldKey, draft);
23317
+ };
23318
+ return /* @__PURE__ */ jsx(
23319
+ Input,
23320
+ {
23321
+ inputType: "text",
23322
+ value: draft,
23323
+ onChange: (e) => setDraft(e.target.value),
23324
+ onBlur: commit,
23325
+ onKeyDown: (e) => {
23326
+ if (e.key === "Enter") commit();
23327
+ }
23328
+ }
23329
+ );
23330
+ }
23331
+ var ObjectEditor;
23332
+ var init_ObjectEditor = __esm({
23333
+ "components/core/molecules/ObjectEditor.tsx"() {
23334
+ "use client";
23335
+ init_Stack();
23336
+ init_Typography();
23337
+ init_Switch();
23338
+ init_Input();
23339
+ init_cn();
23340
+ ObjectEditor = ({ value, onChange, className }) => {
23341
+ const entries = Object.entries(value);
23342
+ const handleFieldChange = (k, next) => {
23343
+ onChange({ ...value, [k]: next });
23344
+ };
23345
+ if (entries.length === 0) {
23346
+ return /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: "Empty object" });
23347
+ }
23348
+ return /* @__PURE__ */ jsx(VStack, { gap: "xs", className: cn("w-full", className), children: entries.map(([k, v]) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
23349
+ /* @__PURE__ */ jsx("span", { className: "w-24 shrink-0 truncate", title: k, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: k }) }),
23350
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(ScalarControl, { fieldKey: k, value: v, onFieldChange: handleFieldChange }) })
23351
+ ] }, k)) });
23352
+ };
23353
+ }
23354
+ });
23355
+ function isTraitConfigObject3(v) {
23356
+ return v !== null && typeof v === "object" && !Array.isArray(v);
23357
+ }
23358
+ function ValueControl({
23359
+ value,
23360
+ onChange
23361
+ }) {
23362
+ if (typeof value === "boolean") {
23363
+ return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
23364
+ }
23365
+ if (typeof value === "number") {
23366
+ const [draft2, setDraft2] = React79__default.useState(String(value));
23367
+ React79__default.useEffect(() => setDraft2(String(value)), [value]);
23368
+ const commit2 = () => {
23369
+ const n = draft2.trim() === "" ? 0 : Number(draft2);
23370
+ onChange(Number.isNaN(n) ? 0 : n);
23371
+ };
23372
+ return /* @__PURE__ */ jsx(
23373
+ Input,
23374
+ {
23375
+ inputType: "number",
23376
+ value: draft2,
23377
+ onChange: (e) => setDraft2(e.target.value),
23378
+ onBlur: commit2,
23379
+ onKeyDown: (e) => {
23380
+ if (e.key === "Enter") commit2();
23381
+ }
23382
+ }
23383
+ );
23384
+ }
23385
+ if (isTraitConfigObject3(value) || Array.isArray(value)) {
23386
+ const [draft2, setDraft2] = React79__default.useState(JSON.stringify(value));
23387
+ React79__default.useEffect(() => setDraft2(JSON.stringify(value)), [value]);
23388
+ const commit2 = () => {
23389
+ try {
23390
+ onChange(JSON.parse(draft2));
23391
+ } catch {
23392
+ }
23393
+ };
23394
+ return /* @__PURE__ */ jsx(
23395
+ Input,
23396
+ {
23397
+ inputType: "text",
23398
+ value: draft2,
23399
+ onChange: (e) => setDraft2(e.target.value),
23400
+ onBlur: commit2,
23401
+ onKeyDown: (e) => {
23402
+ if (e.key === "Enter") commit2();
23403
+ }
23404
+ }
23405
+ );
23406
+ }
23407
+ const [draft, setDraft] = React79__default.useState(value === null ? "" : String(value));
23408
+ React79__default.useEffect(() => setDraft(value === null ? "" : String(value)), [value]);
23409
+ const commit = () => {
23410
+ onChange(draft);
23411
+ };
23412
+ return /* @__PURE__ */ jsx(
23413
+ Input,
23414
+ {
23415
+ inputType: "text",
23416
+ value: draft,
23417
+ onChange: (e) => setDraft(e.target.value),
23418
+ onBlur: commit,
23419
+ onKeyDown: (e) => {
23420
+ if (e.key === "Enter") commit();
23421
+ }
23422
+ }
23423
+ );
23424
+ }
23425
+ function KeyInput({
23426
+ currentKey,
23427
+ onRename
23428
+ }) {
23429
+ const [draft, setDraft] = React79__default.useState(currentKey);
23430
+ React79__default.useEffect(() => setDraft(currentKey), [currentKey]);
23431
+ const commit = () => {
23432
+ const trimmed = draft.trim();
23433
+ if (trimmed !== "" && trimmed !== currentKey) onRename(trimmed);
23434
+ else setDraft(currentKey);
23435
+ };
23436
+ return /* @__PURE__ */ jsx(
23437
+ Input,
23438
+ {
23439
+ inputType: "text",
23440
+ value: draft,
23441
+ onChange: (e) => setDraft(e.target.value),
23442
+ onBlur: commit,
23443
+ onKeyDown: (e) => {
23444
+ if (e.key === "Enter") commit();
23445
+ },
23446
+ className: "w-24 shrink-0 font-mono text-xs",
23447
+ placeholder: "key"
23448
+ }
23449
+ );
23450
+ }
23451
+ var MapEditor;
23452
+ var init_MapEditor = __esm({
23453
+ "components/core/molecules/MapEditor.tsx"() {
23454
+ "use client";
23455
+ init_Stack();
23456
+ init_Button();
23457
+ init_Input();
23458
+ init_Switch();
23459
+ init_cn();
23460
+ MapEditor = ({ value, onChange, className }) => {
23461
+ const entries = Object.entries(value);
23462
+ const updateKey = (oldKey, newKey) => {
23463
+ const next = {};
23464
+ for (const [k, v] of Object.entries(value)) {
23465
+ next[k === oldKey ? newKey : k] = v;
23466
+ }
23467
+ onChange(next);
23468
+ };
23469
+ const updateValue = (k, next) => {
23470
+ onChange({ ...value, [k]: next });
23471
+ };
23472
+ const remove = (k) => {
23473
+ const next = { ...value };
23474
+ delete next[k];
23475
+ onChange(next);
23476
+ };
23477
+ const add = () => {
23478
+ let key = "key";
23479
+ let i = 1;
23480
+ while (key in value) {
23481
+ key = `key${i}`;
23482
+ i++;
23483
+ }
23484
+ onChange({ ...value, [key]: "" });
23485
+ };
23486
+ return /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: cn("w-full", className), children: [
23487
+ entries.map(([k, v]) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
23488
+ /* @__PURE__ */ jsx(KeyInput, { currentKey: k, onRename: (newKey) => updateKey(k, newKey) }),
23489
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(ValueControl, { value: v, onChange: (next) => updateValue(k, next) }) }),
23490
+ /* @__PURE__ */ jsx(
23491
+ Button,
23492
+ {
23493
+ variant: "ghost",
23494
+ size: "sm",
23495
+ icon: "trash-2",
23496
+ onClick: () => remove(k),
23497
+ "aria-label": "Remove entry"
23498
+ }
23499
+ )
23500
+ ] }, k)),
23501
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", icon: "plus", label: "Add entry", onClick: add })
23502
+ ] });
23503
+ };
23504
+ }
23505
+ });
23110
23506
  function fileIcon(name) {
23111
23507
  const ext = name.split(".").pop()?.toLowerCase() ?? "";
23112
23508
  switch (ext) {
@@ -24668,7 +25064,7 @@ var init_WizardProgress = __esm({
24668
25064
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
24669
25065
  const isActive = index === currentStep;
24670
25066
  const isCompleted = index < currentStep;
24671
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
25067
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
24672
25068
  /* @__PURE__ */ jsx(
24673
25069
  "button",
24674
25070
  {
@@ -25185,8 +25581,9 @@ var init_FormSectionHeader = __esm({
25185
25581
  Box,
25186
25582
  {
25187
25583
  className: cn(
25188
- "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
25189
- isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
25584
+ "px-5 py-4 bg-muted/60 rounded-lg",
25585
+ "border border-border border-l-4 border-l-primary",
25586
+ isClickable && "cursor-pointer hover:bg-muted transition-colors",
25190
25587
  className
25191
25588
  ),
25192
25589
  onClick: isClickable ? onToggle : void 0,
@@ -25197,7 +25594,7 @@ var init_FormSectionHeader = __esm({
25197
25594
  {
25198
25595
  name: icon,
25199
25596
  size: "md",
25200
- className: "text-primary"
25597
+ className: "text-primary shrink-0"
25201
25598
  }
25202
25599
  ),
25203
25600
  statusIcon && /* @__PURE__ */ jsx(
@@ -25205,12 +25602,15 @@ var init_FormSectionHeader = __esm({
25205
25602
  {
25206
25603
  name: statusIcon,
25207
25604
  size: "md",
25208
- className: hasErrors ? "text-error" : "text-success"
25605
+ className: cn(
25606
+ "shrink-0",
25607
+ hasErrors ? "text-error" : "text-success"
25608
+ )
25209
25609
  }
25210
25610
  ),
25211
25611
  /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
25212
- /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
25213
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
25612
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", className: "text-foreground", children: title }),
25613
+ subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "leading-snug", children: subtitle })
25214
25614
  ] })
25215
25615
  ] }),
25216
25616
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -25219,9 +25619,9 @@ var init_FormSectionHeader = __esm({
25219
25619
  Icon,
25220
25620
  {
25221
25621
  name: "chevron-down",
25222
- size: "md",
25622
+ size: "sm",
25223
25623
  className: cn(
25224
- "text-muted-foreground transition-transform",
25624
+ "text-muted-foreground transition-transform duration-200 shrink-0",
25225
25625
  isCollapsed && "-rotate-90"
25226
25626
  )
25227
25627
  }
@@ -26012,9 +26412,9 @@ function ScoreDisplay({
26012
26412
  ...rest
26013
26413
  }) {
26014
26414
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
26015
- const [displayValue, setDisplayValue] = React81.useState(resolvedValue);
26016
- const [isAnimating, setIsAnimating] = React81.useState(false);
26017
- React81.useEffect(() => {
26415
+ const [displayValue, setDisplayValue] = React79.useState(resolvedValue);
26416
+ const [isAnimating, setIsAnimating] = React79.useState(false);
26417
+ React79.useEffect(() => {
26018
26418
  if (!animated || displayValue === resolvedValue) {
26019
26419
  setDisplayValue(resolvedValue);
26020
26420
  return;
@@ -26161,7 +26561,7 @@ function InventoryGrid({
26161
26561
  const eventBus = useEventBus();
26162
26562
  const slotCount = totalSlots ?? items.length;
26163
26563
  const emptySlotCount = Math.max(0, slotCount - items.length);
26164
- const handleSelect = React81.useCallback(
26564
+ const handleSelect = React79.useCallback(
26165
26565
  (id) => {
26166
26566
  onSelect?.(id);
26167
26567
  if (selectEvent) {
@@ -26447,31 +26847,31 @@ function GameCanvas2D({
26447
26847
  assetBaseUrl = "",
26448
26848
  className
26449
26849
  }) {
26450
- const canvasRef = React81.useRef(null);
26451
- const rafRef = React81.useRef(0);
26452
- const frameRef = React81.useRef(0);
26453
- const lastTimeRef = React81.useRef(0);
26454
- const imageCache = React81.useRef(/* @__PURE__ */ new Map());
26850
+ const canvasRef = React79.useRef(null);
26851
+ const rafRef = React79.useRef(0);
26852
+ const frameRef = React79.useRef(0);
26853
+ const lastTimeRef = React79.useRef(0);
26854
+ const imageCache = React79.useRef(/* @__PURE__ */ new Map());
26455
26855
  const emit = useEmitEvent();
26456
- const onDrawRef = React81.useRef(onDraw);
26856
+ const onDrawRef = React79.useRef(onDraw);
26457
26857
  onDrawRef.current = onDraw;
26458
- const onTickRef = React81.useRef(onTick);
26858
+ const onTickRef = React79.useRef(onTick);
26459
26859
  onTickRef.current = onTick;
26460
- const tickEventRef = React81.useRef(tickEvent);
26860
+ const tickEventRef = React79.useRef(tickEvent);
26461
26861
  tickEventRef.current = tickEvent;
26462
- const drawEventRef = React81.useRef(drawEvent);
26862
+ const drawEventRef = React79.useRef(drawEvent);
26463
26863
  drawEventRef.current = drawEvent;
26464
- const emitRef = React81.useRef(emit);
26864
+ const emitRef = React79.useRef(emit);
26465
26865
  emitRef.current = emit;
26466
- const assetBaseUrlRef = React81.useRef(assetBaseUrl);
26866
+ const assetBaseUrlRef = React79.useRef(assetBaseUrl);
26467
26867
  assetBaseUrlRef.current = assetBaseUrl;
26468
- const backgroundImageRef = React81.useRef(backgroundImage);
26868
+ const backgroundImageRef = React79.useRef(backgroundImage);
26469
26869
  backgroundImageRef.current = backgroundImage;
26470
- const widthRef = React81.useRef(width);
26870
+ const widthRef = React79.useRef(width);
26471
26871
  widthRef.current = width;
26472
- const heightRef = React81.useRef(height);
26872
+ const heightRef = React79.useRef(height);
26473
26873
  heightRef.current = height;
26474
- const loadImage = React81.useCallback((url) => {
26874
+ const loadImage = React79.useCallback((url) => {
26475
26875
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
26476
26876
  const cached = imageCache.current.get(fullUrl);
26477
26877
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -26483,7 +26883,7 @@ function GameCanvas2D({
26483
26883
  }
26484
26884
  return null;
26485
26885
  }, []);
26486
- React81.useEffect(() => {
26886
+ React79.useEffect(() => {
26487
26887
  const canvas = canvasRef.current;
26488
26888
  if (!canvas) return;
26489
26889
  const ctx = canvas.getContext("2d");
@@ -26838,7 +27238,7 @@ function TurnPanel({
26838
27238
  className
26839
27239
  }) {
26840
27240
  const eventBus = useEventBus();
26841
- const handleAction = React81.useCallback(
27241
+ const handleAction = React79.useCallback(
26842
27242
  (event) => {
26843
27243
  if (event) {
26844
27244
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -26984,7 +27384,7 @@ function UnitCommandBar({
26984
27384
  className
26985
27385
  }) {
26986
27386
  const eventBus = useEventBus();
26987
- const handleCommand = React81.useCallback(
27387
+ const handleCommand = React79.useCallback(
26988
27388
  (event) => {
26989
27389
  if (event) {
26990
27390
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -27469,7 +27869,7 @@ function GameMenu({
27469
27869
  } catch {
27470
27870
  }
27471
27871
  const eventBus = eventBusProp || eventBusFromHook;
27472
- const handleOptionClick = React81.useCallback(
27872
+ const handleOptionClick = React79.useCallback(
27473
27873
  (option) => {
27474
27874
  if (option.event && eventBus) {
27475
27875
  eventBus.emit(`UI:${option.event}`, { option });
@@ -27583,7 +27983,7 @@ function GameOverScreen({
27583
27983
  } catch {
27584
27984
  }
27585
27985
  const eventBus = eventBusProp || eventBusFromHook;
27586
- const handleActionClick = React81.useCallback(
27986
+ const handleActionClick = React79.useCallback(
27587
27987
  (action) => {
27588
27988
  if (action.event && eventBus) {
27589
27989
  eventBus.emit(`UI:${action.event}`, { action });
@@ -28599,7 +28999,7 @@ var init_StarRating = __esm({
28599
28999
  name: "star",
28600
29000
  className: cn(
28601
29001
  styles.star,
28602
- "text-muted-foreground",
29002
+ "text-foreground/30",
28603
29003
  "transition-colors duration-100"
28604
29004
  ),
28605
29005
  strokeWidth: 1.5
@@ -29082,8 +29482,8 @@ function TableView({
29082
29482
  }) {
29083
29483
  const eventBus = useEventBus();
29084
29484
  const { t } = useTranslate();
29085
- const [visibleCount, setVisibleCount] = React81__default.useState(pageSize > 0 ? pageSize : Infinity);
29086
- const [localSelected, setLocalSelected] = React81__default.useState(/* @__PURE__ */ new Set());
29485
+ const [visibleCount, setVisibleCount] = React79__default.useState(pageSize > 0 ? pageSize : Infinity);
29486
+ const [localSelected, setLocalSelected] = React79__default.useState(/* @__PURE__ */ new Set());
29087
29487
  const colDefs = columns ?? fields ?? [];
29088
29488
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
29089
29489
  const dnd = useDataDnd({
@@ -29278,12 +29678,12 @@ function TableView({
29278
29678
  ]
29279
29679
  }
29280
29680
  );
29281
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React81__default.Fragment, { children: rowInner }, id);
29681
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React79__default.Fragment, { children: rowInner }, id);
29282
29682
  };
29283
29683
  const items = data.map((row) => row);
29284
29684
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
29285
29685
  let runningIndex = 0;
29286
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
29686
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
29287
29687
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
29288
29688
  group.items.map((row) => renderRow(row, runningIndex++))
29289
29689
  ] }, gi)) });
@@ -30635,7 +31035,7 @@ var init_StepFlow = __esm({
30635
31035
  className
30636
31036
  }) => {
30637
31037
  if (orientation === "vertical") {
30638
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React81__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
31038
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React79__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
30639
31039
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
30640
31040
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30641
31041
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -30646,7 +31046,7 @@ var init_StepFlow = __esm({
30646
31046
  ] })
30647
31047
  ] }) }, index)) });
30648
31048
  }
30649
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
31049
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
30650
31050
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
30651
31051
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
30652
31052
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -31401,11 +31801,19 @@ function LatticeSVG({
31401
31801
  function f2(n) {
31402
31802
  return n.toFixed(2);
31403
31803
  }
31404
- var VARIANT_MAP2, EdgeDecoration;
31804
+ var colorTokenVars, VARIANT_MAP2, EdgeDecoration;
31405
31805
  var init_EdgeDecoration = __esm({
31406
31806
  "components/core/molecules/EdgeDecoration.tsx"() {
31407
31807
  "use client";
31408
31808
  init_cn();
31809
+ colorTokenVars = {
31810
+ primary: "var(--color-primary)",
31811
+ secondary: "var(--color-secondary)",
31812
+ success: "var(--color-success)",
31813
+ warning: "var(--color-warning)",
31814
+ error: "var(--color-error)",
31815
+ muted: "var(--color-muted)"
31816
+ };
31409
31817
  VARIANT_MAP2 = {
31410
31818
  arch: ArchSVG,
31411
31819
  vine: VineSVG,
@@ -31415,13 +31823,14 @@ var init_EdgeDecoration = __esm({
31415
31823
  variant = "arch",
31416
31824
  side = "both",
31417
31825
  opacity = 0.15,
31418
- color = "var(--color-primary)",
31826
+ color = "primary",
31419
31827
  strokeWidth = 0.5,
31420
31828
  width = 15,
31421
31829
  className
31422
31830
  }) => {
31423
31831
  const id = useId();
31424
31832
  const Variant = VARIANT_MAP2[variant];
31833
+ const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
31425
31834
  const sides = side === "both" ? ["left", "right"] : [side];
31426
31835
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
31427
31836
  "svg",
@@ -31444,7 +31853,7 @@ var init_EdgeDecoration = __esm({
31444
31853
  facing: s,
31445
31854
  w: 200,
31446
31855
  h: 600,
31447
- color,
31856
+ color: resolvedColor,
31448
31857
  strokeWidth
31449
31858
  }
31450
31859
  )
@@ -31622,7 +32031,7 @@ var init_LikertScale = __esm({
31622
32031
  md: "text-base",
31623
32032
  lg: "text-lg"
31624
32033
  };
31625
- LikertScale = React81__default.forwardRef(
32034
+ LikertScale = React79__default.forwardRef(
31626
32035
  ({
31627
32036
  question,
31628
32037
  options = DEFAULT_LIKERT_OPTIONS,
@@ -31634,7 +32043,7 @@ var init_LikertScale = __esm({
31634
32043
  variant = "radios",
31635
32044
  className
31636
32045
  }, ref) => {
31637
- const groupId = React81__default.useId();
32046
+ const groupId = React79__default.useId();
31638
32047
  const eventBus = useEventBus();
31639
32048
  const handleSelect = useCallback(
31640
32049
  (next) => {
@@ -32784,7 +33193,6 @@ function BlockRow({
32784
33193
  onUpdate,
32785
33194
  onDelete,
32786
33195
  onDuplicate,
32787
- onInsertAfter,
32788
33196
  onChangeType
32789
33197
  }) {
32790
33198
  const { t } = useTranslate();
@@ -33060,34 +33468,16 @@ function BlockRow({
33060
33468
  "data-block-id": block.id,
33061
33469
  "data-block-type": block.type,
33062
33470
  children: [
33063
- !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
33064
- /* @__PURE__ */ jsx(
33065
- Button,
33066
- {
33067
- type: "button",
33068
- variant: "ghost",
33069
- "aria-label": t("richBlockEditor.insertParagraphBelow"),
33070
- className: cn(
33071
- "inline-flex h-6 w-6 items-center justify-center rounded-sm p-0 gap-0",
33072
- "text-muted-foreground hover:bg-muted hover:text-foreground",
33073
- "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
33074
- "transition-opacity"
33075
- ),
33076
- onClick: () => onInsertAfter("paragraph"),
33077
- children: /* @__PURE__ */ jsx(Icon, { name: "plus", className: "w-3.5 h-3.5" })
33078
- }
33079
- ),
33080
- /* @__PURE__ */ jsx(
33081
- BlockMenu,
33082
- {
33083
- block,
33084
- readOnly,
33085
- onDelete,
33086
- onDuplicate,
33087
- onChangeType
33088
- }
33089
- )
33090
- ] }),
33471
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { className: "flex w-8 shrink-0 items-center pt-1", children: /* @__PURE__ */ jsx(
33472
+ BlockMenu,
33473
+ {
33474
+ block,
33475
+ readOnly,
33476
+ onDelete,
33477
+ onDuplicate,
33478
+ onChangeType
33479
+ }
33480
+ ) }),
33091
33481
  /* @__PURE__ */ jsx(Box, { className: "min-w-0 flex-1", children: renderBody() })
33092
33482
  ]
33093
33483
  }
@@ -33210,12 +33600,6 @@ var init_RichBlockEditor = __esm({
33210
33600
  },
33211
33601
  [blocks, commit]
33212
33602
  );
33213
- const handleInsertAfter = useCallback(
33214
- (id, type) => {
33215
- commit(insertAfter(blocks, id, createBlock(type)));
33216
- },
33217
- [blocks, commit]
33218
- );
33219
33603
  const handleChangeType = useCallback(
33220
33604
  (id, type) => {
33221
33605
  commit(
@@ -33272,7 +33656,6 @@ var init_RichBlockEditor = __esm({
33272
33656
  onUpdate: (updater) => handleUpdate(block.id, updater),
33273
33657
  onDelete: () => handleDelete(block.id),
33274
33658
  onDuplicate: () => handleDuplicate(block.id),
33275
- onInsertAfter: (type) => handleInsertAfter(block.id, type),
33276
33659
  onChangeType: (type) => handleChangeType(block.id, type)
33277
33660
  },
33278
33661
  block.id
@@ -33942,7 +34325,7 @@ var init_DocBreadcrumb = __esm({
33942
34325
  "aria-label": t("aria.breadcrumb"),
33943
34326
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
33944
34327
  const isLast = idx === items.length - 1;
33945
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
34328
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
33946
34329
  idx > 0 && /* @__PURE__ */ jsx(
33947
34330
  Icon,
33948
34331
  {
@@ -33989,108 +34372,6 @@ var init_DocBreadcrumb = __esm({
33989
34372
  DocBreadcrumb.displayName = "DocBreadcrumb";
33990
34373
  }
33991
34374
  });
33992
- function DocCodeBlock({
33993
- code,
33994
- language,
33995
- title,
33996
- showLineNumbers = false,
33997
- className
33998
- }) {
33999
- const [copied, setCopied] = useState(false);
34000
- const handleCopy = useCallback(() => {
34001
- void navigator.clipboard.writeText(code).then(() => {
34002
- setCopied(true);
34003
- setTimeout(() => setCopied(false), 2e3);
34004
- });
34005
- }, [code]);
34006
- const lines = code.split("\n");
34007
- return /* @__PURE__ */ jsxs(
34008
- Box,
34009
- {
34010
- className: cn(
34011
- "rounded-container border border-border overflow-hidden",
34012
- className
34013
- ),
34014
- position: "relative",
34015
- children: [
34016
- title ? /* @__PURE__ */ jsxs(
34017
- HStack,
34018
- {
34019
- align: "center",
34020
- justify: "between",
34021
- className: "bg-muted px-4 py-2 border-b border-border",
34022
- children: [
34023
- /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "sm", children: [
34024
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: title }),
34025
- language ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: language }) : null
34026
- ] }),
34027
- /* @__PURE__ */ jsx(
34028
- Button,
34029
- {
34030
- variant: "ghost",
34031
- size: "sm",
34032
- onClick: handleCopy,
34033
- leftIcon: copied ? "check" : "copy",
34034
- children: copied ? "Copied!" : "Copy"
34035
- }
34036
- )
34037
- ]
34038
- }
34039
- ) : null,
34040
- !title ? /* @__PURE__ */ jsx(Box, { position: "absolute", className: "top-2 right-2 z-10", children: /* @__PURE__ */ jsx(
34041
- Button,
34042
- {
34043
- variant: "ghost",
34044
- size: "sm",
34045
- onClick: handleCopy,
34046
- leftIcon: copied ? "check" : "copy",
34047
- children: copied ? "Copied!" : "Copy"
34048
- }
34049
- ) }) : null,
34050
- /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "bg-foreground overflow-x-auto", children: [
34051
- showLineNumbers ? /* @__PURE__ */ jsx(
34052
- Box,
34053
- {
34054
- className: "py-4 pl-4 pr-3 select-none border-r border-border flex-shrink-0",
34055
- children: lines.map((_, i) => /* @__PURE__ */ jsx(
34056
- Typography,
34057
- {
34058
- variant: "caption",
34059
- color: "muted",
34060
- className: "block font-mono text-right leading-6",
34061
- as: "span",
34062
- children: i + 1
34063
- },
34064
- i
34065
- ))
34066
- }
34067
- ) : null,
34068
- /* @__PURE__ */ jsx(
34069
- Box,
34070
- {
34071
- as: "pre",
34072
- className: cn(
34073
- "p-4 font-mono text-sm text-background leading-6 flex-1 min-w-0",
34074
- !title && "pr-24"
34075
- ),
34076
- children: /* @__PURE__ */ jsx(Box, { as: "code", className: "whitespace-pre", children: code })
34077
- }
34078
- )
34079
- ] })
34080
- ]
34081
- }
34082
- );
34083
- }
34084
- var init_DocCodeBlock = __esm({
34085
- "components/core/molecules/DocCodeBlock.tsx"() {
34086
- "use client";
34087
- init_cn();
34088
- init_Box();
34089
- init_Stack();
34090
- init_Typography();
34091
- init_Button();
34092
- }
34093
- });
34094
34375
  function DocPagination({ prev, next, className }) {
34095
34376
  if (!prev && !next) return null;
34096
34377
  return /* @__PURE__ */ jsxs(
@@ -34527,17 +34808,25 @@ var init_DocTOC = __esm({
34527
34808
  DocTOC.displayName = "DocTOC";
34528
34809
  }
34529
34810
  });
34530
- var GradientDivider;
34811
+ var colorTokenVars2, GradientDivider;
34531
34812
  var init_GradientDivider = __esm({
34532
34813
  "components/core/molecules/GradientDivider.tsx"() {
34533
34814
  "use client";
34534
34815
  init_cn();
34535
34816
  init_Box();
34817
+ colorTokenVars2 = {
34818
+ primary: "var(--color-primary)",
34819
+ secondary: "var(--color-secondary)",
34820
+ success: "var(--color-success)",
34821
+ warning: "var(--color-warning)",
34822
+ error: "var(--color-error)",
34823
+ muted: "var(--color-muted)"
34824
+ };
34536
34825
  GradientDivider = ({
34537
34826
  color,
34538
34827
  className
34539
34828
  }) => {
34540
- const centerColor = color ?? "var(--color-primary)";
34829
+ const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
34541
34830
  return /* @__PURE__ */ jsx(
34542
34831
  Box,
34543
34832
  {
@@ -34906,7 +35195,7 @@ var init_MiniStateMachine = __esm({
34906
35195
  const x = 2 + i * (NODE_W + GAP2 + ARROW_W + GAP2);
34907
35196
  const tc = transitionCounts[s.name] ?? 0;
34908
35197
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
34909
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
35198
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
34910
35199
  /* @__PURE__ */ jsx(
34911
35200
  AvlState,
34912
35201
  {
@@ -35110,7 +35399,7 @@ var init_PageHeader = __esm({
35110
35399
  info: "bg-info/10 text-info"
35111
35400
  };
35112
35401
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
35113
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
35402
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
35114
35403
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
35115
35404
  crumb.href ? /* @__PURE__ */ jsx(
35116
35405
  "a",
@@ -35219,7 +35508,7 @@ var init_FormSection = __esm({
35219
35508
  columns = 1,
35220
35509
  className
35221
35510
  }) => {
35222
- const [collapsed, setCollapsed] = React81__default.useState(defaultCollapsed);
35511
+ const [collapsed, setCollapsed] = React79__default.useState(defaultCollapsed);
35223
35512
  const { t } = useTranslate();
35224
35513
  const eventBus = useEventBus();
35225
35514
  const gridClass = {
@@ -35227,7 +35516,7 @@ var init_FormSection = __esm({
35227
35516
  2: "grid-cols-1 md:grid-cols-2",
35228
35517
  3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
35229
35518
  }[columns];
35230
- React81__default.useCallback(() => {
35519
+ React79__default.useCallback(() => {
35231
35520
  if (collapsible) {
35232
35521
  setCollapsed((prev) => !prev);
35233
35522
  eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
@@ -35334,8 +35623,8 @@ function TextLikeControl({
35334
35623
  onCommit
35335
35624
  }) {
35336
35625
  const initial = value === void 0 || value === null ? "" : String(value);
35337
- const [draft, setDraft] = React81__default.useState(initial);
35338
- React81__default.useEffect(() => setDraft(initial), [initial]);
35626
+ const [draft, setDraft] = React79__default.useState(initial);
35627
+ React79__default.useEffect(() => setDraft(initial), [initial]);
35339
35628
  const commit = () => {
35340
35629
  if (numeric) {
35341
35630
  const n = draft.trim() === "" ? 0 : Number(draft);
@@ -35357,6 +35646,9 @@ function TextLikeControl({
35357
35646
  }
35358
35647
  );
35359
35648
  }
35649
+ function isTraitConfigObject4(v) {
35650
+ return v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
35651
+ }
35360
35652
  function FieldControl({
35361
35653
  name,
35362
35654
  decl,
@@ -35366,6 +35658,7 @@ function FieldControl({
35366
35658
  }) {
35367
35659
  let control;
35368
35660
  const stringValue = typeof value === "string" ? value : void 0;
35661
+ const effectiveValue = value ?? decl.default;
35369
35662
  if (decl.type === "icon") {
35370
35663
  control = /* @__PURE__ */ jsx(IconPicker, { value: stringValue, onChange: (icon) => onChange(name, icon) });
35371
35664
  } else if (decl.type === "asset") {
@@ -35392,6 +35685,32 @@ function FieldControl({
35392
35685
  control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: true, value, onCommit: onChange });
35393
35686
  } else if (decl.type === "string") {
35394
35687
  control = /* @__PURE__ */ jsx(TextLikeControl, { field: name, numeric: false, value, onCommit: onChange });
35688
+ } else if (decl.type.startsWith("[") || Array.isArray(effectiveValue)) {
35689
+ const arr = Array.isArray(effectiveValue) ? effectiveValue : [];
35690
+ control = /* @__PURE__ */ jsx(
35691
+ ArrayEditor,
35692
+ {
35693
+ value: arr,
35694
+ onChange: (next) => onChange(name, next)
35695
+ }
35696
+ );
35697
+ } else if (decl.type === "object" && isTraitConfigObject4(effectiveValue)) {
35698
+ control = /* @__PURE__ */ jsx(
35699
+ ObjectEditor,
35700
+ {
35701
+ value: effectiveValue,
35702
+ onChange: (next) => onChange(name, next)
35703
+ }
35704
+ );
35705
+ } else if (decl.type.startsWith("Map ") || !SCALAR_TYPES.has(decl.type) && isTraitConfigObject4(effectiveValue)) {
35706
+ const obj = isTraitConfigObject4(effectiveValue) ? effectiveValue : {};
35707
+ control = /* @__PURE__ */ jsx(
35708
+ MapEditor,
35709
+ {
35710
+ value: obj,
35711
+ onChange: (next) => onChange(name, next)
35712
+ }
35713
+ );
35395
35714
  } else {
35396
35715
  control = /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "muted", children: [
35397
35716
  decl.type,
@@ -35404,7 +35723,7 @@ function FieldControl({
35404
35723
  decl.description !== void 0 && decl.description !== "" && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: decl.description })
35405
35724
  ] });
35406
35725
  }
35407
- var TIER_ORDER, PropertyInspector;
35726
+ var TIER_ORDER, SCALAR_TYPES, PropertyInspector;
35408
35727
  var init_PropertyInspector = __esm({
35409
35728
  "components/core/molecules/PropertyInspector.tsx"() {
35410
35729
  "use client";
@@ -35418,7 +35737,11 @@ var init_PropertyInspector = __esm({
35418
35737
  init_FormSection();
35419
35738
  init_IconPicker();
35420
35739
  init_AssetPicker();
35740
+ init_ArrayEditor();
35741
+ init_ObjectEditor();
35742
+ init_MapEditor();
35421
35743
  TIER_ORDER = ["presentation", "domain", "policy", "infra", "internal"];
35744
+ SCALAR_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "icon", "asset"]);
35422
35745
  PropertyInspector = ({
35423
35746
  config,
35424
35747
  values,
@@ -36112,7 +36435,7 @@ var init_WizardContainer = __esm({
36112
36435
  const isCompleted = index < currentStep;
36113
36436
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36114
36437
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36115
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
36438
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
36116
36439
  /* @__PURE__ */ jsx(
36117
36440
  Button,
36118
36441
  {
@@ -37320,6 +37643,9 @@ var init_GraphCanvas = __esm({
37320
37643
  var init_molecules2 = __esm({
37321
37644
  "components/core/molecules/index.ts"() {
37322
37645
  init_ErrorBoundary();
37646
+ init_ArrayEditor();
37647
+ init_ObjectEditor();
37648
+ init_MapEditor();
37323
37649
  init_FileTree();
37324
37650
  init_FormField();
37325
37651
  init_EmptyState();
@@ -37418,7 +37744,6 @@ var init_molecules2 = __esm({
37418
37744
  init_BranchingLogicBuilder();
37419
37745
  init_VersionDiff();
37420
37746
  init_DocBreadcrumb();
37421
- init_DocCodeBlock();
37422
37747
  init_DocPagination();
37423
37748
  init_DocSearch();
37424
37749
  init_DocSidebar();
@@ -37445,7 +37770,6 @@ var init_molecules2 = __esm({
37445
37770
  init_SignaturePad();
37446
37771
  init_DocumentViewer();
37447
37772
  init_GraphCanvas();
37448
- init_CodeViewer();
37449
37773
  }
37450
37774
  });
37451
37775
 
@@ -38559,7 +38883,7 @@ var init_DialogueBubble = __esm({
38559
38883
  }
38560
38884
  });
38561
38885
  function extractTitle(children) {
38562
- if (!React81__default.isValidElement(children)) return void 0;
38886
+ if (!React79__default.isValidElement(children)) return void 0;
38563
38887
  const props = children.props;
38564
38888
  if (typeof props.title === "string") {
38565
38889
  return props.title;
@@ -38671,7 +38995,7 @@ function LinearView({
38671
38995
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
38672
38996
  const isDone = i < currentIdx;
38673
38997
  const isCurrent = i === currentIdx;
38674
- return /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
38998
+ return /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
38675
38999
  i > 0 && /* @__PURE__ */ jsx(
38676
39000
  Typography,
38677
39001
  {
@@ -39629,12 +39953,12 @@ var init_Form = __esm({
39629
39953
  const isSchemaEntity = isOrbitalEntitySchema(entity);
39630
39954
  const resolvedEntity = isSchemaEntity ? entity : void 0;
39631
39955
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
39632
- const normalizedInitialData = React81__default.useMemo(() => {
39956
+ const normalizedInitialData = React79__default.useMemo(() => {
39633
39957
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
39634
39958
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
39635
39959
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
39636
39960
  }, [entity, initialData]);
39637
- const entityDerivedFields = React81__default.useMemo(() => {
39961
+ const entityDerivedFields = React79__default.useMemo(() => {
39638
39962
  if (fields && fields.length > 0) return void 0;
39639
39963
  if (!resolvedEntity) return void 0;
39640
39964
  return resolvedEntity.fields.map(
@@ -39654,16 +39978,16 @@ var init_Form = __esm({
39654
39978
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
39655
39979
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
39656
39980
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
39657
- const [formData, setFormData] = React81__default.useState(
39981
+ const [formData, setFormData] = React79__default.useState(
39658
39982
  normalizedInitialData
39659
39983
  );
39660
- const [collapsedSections, setCollapsedSections] = React81__default.useState(
39984
+ const [collapsedSections, setCollapsedSections] = React79__default.useState(
39661
39985
  /* @__PURE__ */ new Set()
39662
39986
  );
39663
- const [submitError, setSubmitError] = React81__default.useState(null);
39664
- const formRef = React81__default.useRef(null);
39987
+ const [submitError, setSubmitError] = React79__default.useState(null);
39988
+ const formRef = React79__default.useRef(null);
39665
39989
  const formMode = props.mode;
39666
- const mountedRef = React81__default.useRef(false);
39990
+ const mountedRef = React79__default.useRef(false);
39667
39991
  if (!mountedRef.current) {
39668
39992
  mountedRef.current = true;
39669
39993
  debug("forms", "mount", {
@@ -39676,7 +40000,7 @@ var init_Form = __esm({
39676
40000
  });
39677
40001
  }
39678
40002
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
39679
- const evalContext = React81__default.useMemo(
40003
+ const evalContext = React79__default.useMemo(
39680
40004
  () => ({
39681
40005
  formValues: formData,
39682
40006
  globalVariables: externalContext?.globalVariables ?? {},
@@ -39685,7 +40009,7 @@ var init_Form = __esm({
39685
40009
  }),
39686
40010
  [formData, externalContext]
39687
40011
  );
39688
- React81__default.useEffect(() => {
40012
+ React79__default.useEffect(() => {
39689
40013
  debug("forms", "initialData-sync", {
39690
40014
  mode: formMode,
39691
40015
  normalizedInitialData,
@@ -39696,7 +40020,7 @@ var init_Form = __esm({
39696
40020
  setFormData(normalizedInitialData);
39697
40021
  }
39698
40022
  }, [normalizedInitialData]);
39699
- const processCalculations = React81__default.useCallback(
40023
+ const processCalculations = React79__default.useCallback(
39700
40024
  (changedFieldId, newFormData) => {
39701
40025
  if (!hiddenCalculations.length) return;
39702
40026
  const context = {
@@ -39721,7 +40045,7 @@ var init_Form = __esm({
39721
40045
  },
39722
40046
  [hiddenCalculations, externalContext, eventBus]
39723
40047
  );
39724
- const checkViolations = React81__default.useCallback(
40048
+ const checkViolations = React79__default.useCallback(
39725
40049
  (changedFieldId, newFormData) => {
39726
40050
  if (!violationTriggers.length) return;
39727
40051
  const context = {
@@ -39759,7 +40083,7 @@ var init_Form = __esm({
39759
40083
  processCalculations(name, newFormData);
39760
40084
  checkViolations(name, newFormData);
39761
40085
  };
39762
- const isFieldVisible = React81__default.useCallback(
40086
+ const isFieldVisible = React79__default.useCallback(
39763
40087
  (fieldName) => {
39764
40088
  const condition = conditionalFields[fieldName];
39765
40089
  if (!condition) return true;
@@ -39767,7 +40091,7 @@ var init_Form = __esm({
39767
40091
  },
39768
40092
  [conditionalFields, evalContext]
39769
40093
  );
39770
- const isSectionVisible = React81__default.useCallback(
40094
+ const isSectionVisible = React79__default.useCallback(
39771
40095
  (section) => {
39772
40096
  if (!section.condition) return true;
39773
40097
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -39843,7 +40167,7 @@ var init_Form = __esm({
39843
40167
  eventBus.emit(`UI:${onCancel}`);
39844
40168
  }
39845
40169
  };
39846
- const renderField = React81__default.useCallback(
40170
+ const renderField = React79__default.useCallback(
39847
40171
  (field) => {
39848
40172
  const fieldName = field.name || field.field;
39849
40173
  if (!fieldName) return null;
@@ -39864,7 +40188,7 @@ var init_Form = __esm({
39864
40188
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
39865
40189
  );
39866
40190
  const effectiveFields = entityDerivedFields ?? fields;
39867
- const normalizedFields = React81__default.useMemo(() => {
40191
+ const normalizedFields = React79__default.useMemo(() => {
39868
40192
  if (!effectiveFields || effectiveFields.length === 0) return [];
39869
40193
  return effectiveFields.map((field) => {
39870
40194
  if (typeof field === "string") {
@@ -39887,7 +40211,7 @@ var init_Form = __esm({
39887
40211
  return field;
39888
40212
  });
39889
40213
  }, [effectiveFields, resolvedEntity]);
39890
- const schemaFields = React81__default.useMemo(() => {
40214
+ const schemaFields = React79__default.useMemo(() => {
39891
40215
  if (normalizedFields.length === 0) return null;
39892
40216
  if (isDebugEnabled()) {
39893
40217
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -39897,7 +40221,7 @@ var init_Form = __esm({
39897
40221
  }
39898
40222
  return normalizedFields.map(renderField).filter(Boolean);
39899
40223
  }, [normalizedFields, renderField, entityName, conditionalFields]);
39900
- const sectionElements = React81__default.useMemo(() => {
40224
+ const sectionElements = React79__default.useMemo(() => {
39901
40225
  if (!sections || sections.length === 0) return null;
39902
40226
  return sections.map((section) => {
39903
40227
  if (!isSectionVisible(section)) {
@@ -41179,7 +41503,7 @@ var init_List = __esm({
41179
41503
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
41180
41504
  return [];
41181
41505
  }, [entity]);
41182
- const getItemActions = React81__default.useCallback(
41506
+ const getItemActions = React79__default.useCallback(
41183
41507
  (item) => {
41184
41508
  if (!itemActions) return [];
41185
41509
  if (typeof itemActions === "function") {
@@ -41655,7 +41979,7 @@ var init_MediaGallery = __esm({
41655
41979
  [selectable, selectedItems, selectionEvent, eventBus]
41656
41980
  );
41657
41981
  const entityData = Array.isArray(entity) ? entity : [];
41658
- const items = React81__default.useMemo(() => {
41982
+ const items = React79__default.useMemo(() => {
41659
41983
  if (propItems) return propItems;
41660
41984
  if (entityData.length === 0) return [];
41661
41985
  return entityData.map((record, idx) => ({
@@ -41825,9 +42149,9 @@ function MiniMap({
41825
42149
  viewportRect,
41826
42150
  className
41827
42151
  }) {
41828
- const canvasRef = React81.useRef(null);
41829
- const frameRef = React81.useRef(0);
41830
- React81.useEffect(() => {
42152
+ const canvasRef = React79.useRef(null);
42153
+ const frameRef = React79.useRef(0);
42154
+ React79.useEffect(() => {
41831
42155
  const canvas = canvasRef.current;
41832
42156
  if (!canvas) return;
41833
42157
  const ctx = canvas.getContext("2d");
@@ -41909,7 +42233,7 @@ var init_MiniMap = __esm({
41909
42233
  }
41910
42234
  });
41911
42235
  function extractTitle2(children) {
41912
- if (!React81__default.isValidElement(children)) return void 0;
42236
+ if (!React79__default.isValidElement(children)) return void 0;
41913
42237
  const props = children.props;
41914
42238
  if (typeof props.title === "string") {
41915
42239
  return props.title;
@@ -42256,7 +42580,7 @@ function ResourceCounter({
42256
42580
  children: [
42257
42581
  icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
42258
42582
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
42259
- /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color), children: [
42583
+ /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color && (color in colorTokenClasses2 ? colorTokenClasses2[color] : color)), children: [
42260
42584
  value,
42261
42585
  max != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
42262
42586
  "/",
@@ -42267,10 +42591,18 @@ function ResourceCounter({
42267
42591
  }
42268
42592
  );
42269
42593
  }
42270
- var sizeMap15;
42594
+ var colorTokenClasses2, sizeMap15;
42271
42595
  var init_ResourceCounter = __esm({
42272
42596
  "components/game/atoms/ResourceCounter.tsx"() {
42273
42597
  init_cn();
42598
+ colorTokenClasses2 = {
42599
+ primary: "text-primary",
42600
+ secondary: "text-secondary",
42601
+ success: "text-success",
42602
+ warning: "text-warning",
42603
+ error: "text-error",
42604
+ muted: "text-muted-foreground"
42605
+ };
42274
42606
  sizeMap15 = {
42275
42607
  sm: { wrapper: "text-xs gap-1 px-1.5 py-0.5", icon: "text-sm" },
42276
42608
  md: { wrapper: "text-sm gap-1.5 px-2 py-1", icon: "text-base" },
@@ -42366,7 +42698,7 @@ var init_debugRegistry = __esm({
42366
42698
  }
42367
42699
  });
42368
42700
  function useDebugData() {
42369
- const [data, setData] = React81.useState(() => ({
42701
+ const [data, setData] = React79.useState(() => ({
42370
42702
  traits: [],
42371
42703
  ticks: [],
42372
42704
  guards: [],
@@ -42380,7 +42712,7 @@ function useDebugData() {
42380
42712
  },
42381
42713
  lastUpdate: Date.now()
42382
42714
  }));
42383
- React81.useEffect(() => {
42715
+ React79.useEffect(() => {
42384
42716
  const updateData = () => {
42385
42717
  setData({
42386
42718
  traits: getAllTraits(),
@@ -42489,12 +42821,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
42489
42821
  return positions;
42490
42822
  }
42491
42823
  function WalkMinimap() {
42492
- const [walkStep, setWalkStep] = React81.useState(null);
42493
- const [traits2, setTraits] = React81.useState([]);
42494
- const [coveredEdges, setCoveredEdges] = React81.useState([]);
42495
- const [completedTraits, setCompletedTraits] = React81.useState(/* @__PURE__ */ new Set());
42496
- const prevTraitRef = React81.useRef(null);
42497
- React81.useEffect(() => {
42824
+ const [walkStep, setWalkStep] = React79.useState(null);
42825
+ const [traits2, setTraits] = React79.useState([]);
42826
+ const [coveredEdges, setCoveredEdges] = React79.useState([]);
42827
+ const [completedTraits, setCompletedTraits] = React79.useState(/* @__PURE__ */ new Set());
42828
+ const prevTraitRef = React79.useRef(null);
42829
+ React79.useEffect(() => {
42498
42830
  const interval = setInterval(() => {
42499
42831
  const w = window;
42500
42832
  const step = w.__orbitalWalkStep;
@@ -42930,15 +43262,15 @@ var init_EntitiesTab = __esm({
42930
43262
  });
42931
43263
  function EventFlowTab({ events: events2 }) {
42932
43264
  const { t } = useTranslate();
42933
- const [filter, setFilter] = React81.useState("all");
42934
- const containerRef = React81.useRef(null);
42935
- const [autoScroll, setAutoScroll] = React81.useState(true);
42936
- React81.useEffect(() => {
43265
+ const [filter, setFilter] = React79.useState("all");
43266
+ const containerRef = React79.useRef(null);
43267
+ const [autoScroll, setAutoScroll] = React79.useState(true);
43268
+ React79.useEffect(() => {
42937
43269
  if (autoScroll && containerRef.current) {
42938
43270
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
42939
43271
  }
42940
43272
  }, [events2.length, autoScroll]);
42941
- const filteredEvents = React81.useMemo(() => {
43273
+ const filteredEvents = React79.useMemo(() => {
42942
43274
  if (filter === "all") return events2;
42943
43275
  return events2.filter((e) => e.type === filter);
42944
43276
  }, [events2, filter]);
@@ -43054,7 +43386,7 @@ var init_EventFlowTab = __esm({
43054
43386
  });
43055
43387
  function GuardsPanel({ guards }) {
43056
43388
  const { t } = useTranslate();
43057
- const [filter, setFilter] = React81.useState("all");
43389
+ const [filter, setFilter] = React79.useState("all");
43058
43390
  if (guards.length === 0) {
43059
43391
  return /* @__PURE__ */ jsx(
43060
43392
  EmptyState,
@@ -43067,7 +43399,7 @@ function GuardsPanel({ guards }) {
43067
43399
  }
43068
43400
  const passedCount = guards.filter((g) => g.result).length;
43069
43401
  const failedCount = guards.length - passedCount;
43070
- const filteredGuards = React81.useMemo(() => {
43402
+ const filteredGuards = React79.useMemo(() => {
43071
43403
  if (filter === "all") return guards;
43072
43404
  if (filter === "passed") return guards.filter((g) => g.result);
43073
43405
  return guards.filter((g) => !g.result);
@@ -43230,10 +43562,10 @@ function EffectBadge({ effect }) {
43230
43562
  }
43231
43563
  function TransitionTimeline({ transitions }) {
43232
43564
  const { t } = useTranslate();
43233
- const containerRef = React81.useRef(null);
43234
- const [autoScroll, setAutoScroll] = React81.useState(true);
43235
- const [expandedId, setExpandedId] = React81.useState(null);
43236
- React81.useEffect(() => {
43565
+ const containerRef = React79.useRef(null);
43566
+ const [autoScroll, setAutoScroll] = React79.useState(true);
43567
+ const [expandedId, setExpandedId] = React79.useState(null);
43568
+ React79.useEffect(() => {
43237
43569
  if (autoScroll && containerRef.current) {
43238
43570
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
43239
43571
  }
@@ -43513,9 +43845,9 @@ function getAllEvents(traits2) {
43513
43845
  function EventDispatcherTab({ traits: traits2, schema }) {
43514
43846
  const eventBus = useEventBus();
43515
43847
  const { t } = useTranslate();
43516
- const [log8, setLog] = React81.useState([]);
43517
- const prevStatesRef = React81.useRef(/* @__PURE__ */ new Map());
43518
- React81.useEffect(() => {
43848
+ const [log8, setLog] = React79.useState([]);
43849
+ const prevStatesRef = React79.useRef(/* @__PURE__ */ new Map());
43850
+ React79.useEffect(() => {
43519
43851
  for (const trait of traits2) {
43520
43852
  const prev = prevStatesRef.current.get(trait.id);
43521
43853
  if (prev && prev !== trait.currentState) {
@@ -43684,10 +44016,10 @@ function VerifyModePanel({
43684
44016
  localCount
43685
44017
  }) {
43686
44018
  const { t } = useTranslate();
43687
- const [expanded, setExpanded] = React81.useState(true);
43688
- const scrollRef = React81.useRef(null);
43689
- const prevCountRef = React81.useRef(0);
43690
- React81.useEffect(() => {
44019
+ const [expanded, setExpanded] = React79.useState(true);
44020
+ const scrollRef = React79.useRef(null);
44021
+ const prevCountRef = React79.useRef(0);
44022
+ React79.useEffect(() => {
43691
44023
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
43692
44024
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
43693
44025
  }
@@ -43744,10 +44076,10 @@ function RuntimeDebugger({
43744
44076
  schema
43745
44077
  }) {
43746
44078
  const { t } = useTranslate();
43747
- const [isCollapsed, setIsCollapsed] = React81.useState(mode === "verify" ? true : defaultCollapsed);
43748
- const [isVisible, setIsVisible] = React81.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
44079
+ const [isCollapsed, setIsCollapsed] = React79.useState(mode === "verify" ? true : defaultCollapsed);
44080
+ const [isVisible, setIsVisible] = React79.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
43749
44081
  const debugData = useDebugData();
43750
- React81.useEffect(() => {
44082
+ React79.useEffect(() => {
43751
44083
  if (mode === "inline") return;
43752
44084
  return onDebugToggle((enabled) => {
43753
44085
  setIsVisible(enabled);
@@ -43756,7 +44088,7 @@ function RuntimeDebugger({
43756
44088
  }
43757
44089
  });
43758
44090
  }, [mode]);
43759
- React81.useEffect(() => {
44091
+ React79.useEffect(() => {
43760
44092
  if (mode === "inline") return;
43761
44093
  const handleKeyDown = (e) => {
43762
44094
  if (e.key === "`" && isVisible) {
@@ -44205,7 +44537,7 @@ function SequenceBar({
44205
44537
  onSlotRemove(index);
44206
44538
  }, [onSlotRemove, playing]);
44207
44539
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
44208
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React81__default.Fragment, { children: [
44540
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React79__default.Fragment, { children: [
44209
44541
  i > 0 && /* @__PURE__ */ jsx(
44210
44542
  Typography,
44211
44543
  {
@@ -45295,7 +45627,7 @@ var init_StatCard = __esm({
45295
45627
  const labelToUse = propLabel ?? propTitle;
45296
45628
  const eventBus = useEventBus();
45297
45629
  const { t } = useTranslate();
45298
- const handleActionClick = React81__default.useCallback(() => {
45630
+ const handleActionClick = React79__default.useCallback(() => {
45299
45631
  if (action?.event) {
45300
45632
  eventBus.emit(`UI:${action.event}`, {});
45301
45633
  }
@@ -45306,7 +45638,7 @@ var init_StatCard = __esm({
45306
45638
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
45307
45639
  const isLoading = externalLoading ?? false;
45308
45640
  const error = externalError;
45309
- const computeMetricValue = React81__default.useCallback(
45641
+ const computeMetricValue = React79__default.useCallback(
45310
45642
  (metric, items) => {
45311
45643
  if (metric.value !== void 0) {
45312
45644
  return metric.value;
@@ -45345,7 +45677,7 @@ var init_StatCard = __esm({
45345
45677
  },
45346
45678
  []
45347
45679
  );
45348
- const schemaStats = React81__default.useMemo(() => {
45680
+ const schemaStats = React79__default.useMemo(() => {
45349
45681
  if (!metrics || metrics.length === 0) return null;
45350
45682
  return metrics.map((metric) => ({
45351
45683
  label: metric.label,
@@ -45353,7 +45685,7 @@ var init_StatCard = __esm({
45353
45685
  format: metric.format
45354
45686
  }));
45355
45687
  }, [metrics, data, computeMetricValue]);
45356
- const calculatedTrend = React81__default.useMemo(() => {
45688
+ const calculatedTrend = React79__default.useMemo(() => {
45357
45689
  if (manualTrend !== void 0) return manualTrend;
45358
45690
  if (previousValue === void 0 || currentValue2 === void 0)
45359
45691
  return void 0;
@@ -45634,6 +45966,37 @@ var init_VariablePanel = __esm({
45634
45966
  VariablePanel.displayName = "VariablePanel";
45635
45967
  }
45636
45968
  });
45969
+ function StateJsonView({
45970
+ data,
45971
+ label,
45972
+ defaultExpanded = false,
45973
+ className
45974
+ }) {
45975
+ const { t } = useTranslate();
45976
+ const [expanded, setExpanded] = useState(defaultExpanded);
45977
+ const jsonString = JSON.stringify(data, null, 2);
45978
+ return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
45979
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
45980
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
45981
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
45982
+ ] }),
45983
+ expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
45984
+ Typography,
45985
+ {
45986
+ variant: "caption",
45987
+ className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
45988
+ children: jsonString
45989
+ }
45990
+ ) })
45991
+ ] });
45992
+ }
45993
+ var init_StateJsonView = __esm({
45994
+ "components/game/organisms/puzzles/state-architect/StateJsonView.tsx"() {
45995
+ init_atoms2();
45996
+ init_cn();
45997
+ StateJsonView.displayName = "StateJsonView";
45998
+ }
45999
+ });
45637
46000
  function layoutStates(states, width, height) {
45638
46001
  const cx = width / 2;
45639
46002
  const cy = height / 2;
@@ -45925,7 +46288,7 @@ function StateArchitectBoard({
45925
46288
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
45926
46289
  ] }, i))
45927
46290
  ] }),
45928
- resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
46291
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
45929
46292
  ] })
45930
46293
  ] }),
45931
46294
  playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
@@ -45962,7 +46325,7 @@ var init_StateArchitectBoard = __esm({
45962
46325
  init_StateNode();
45963
46326
  init_TransitionArrow();
45964
46327
  init_VariablePanel();
45965
- init_CodeView();
46328
+ init_StateJsonView();
45966
46329
  init_boardEntity();
45967
46330
  ENCOURAGEMENT_KEYS3 = [
45968
46331
  "puzzle.tryAgain1",
@@ -46042,7 +46405,7 @@ function StatusEffect({
46042
46405
  ),
46043
46406
  title: label,
46044
46407
  children: [
46045
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: icon }),
46408
+ /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }),
46046
46409
  duration !== void 0 && /* @__PURE__ */ jsx(
46047
46410
  "span",
46048
46411
  {
@@ -46073,6 +46436,7 @@ var sizeMap16, variantStyles9;
46073
46436
  var init_StatusEffect = __esm({
46074
46437
  "components/game/atoms/StatusEffect.tsx"() {
46075
46438
  init_cn();
46439
+ init_Icon();
46076
46440
  sizeMap16 = {
46077
46441
  sm: { container: "w-8 h-8", icon: "text-sm", badge: "text-xs -top-1 -right-1 w-4 h-4", timer: "text-[9px]" },
46078
46442
  md: { container: "w-10 h-10", icon: "text-base", badge: "text-xs -top-1 -right-1 w-5 h-5", timer: "text-xs" },
@@ -46358,7 +46722,7 @@ var init_Timeline = __esm({
46358
46722
  }) => {
46359
46723
  const { t } = useTranslate();
46360
46724
  const entityData = Array.isArray(entity) ? entity : [];
46361
- const items = React81__default.useMemo(() => {
46725
+ const items = React79__default.useMemo(() => {
46362
46726
  if (propItems) return propItems;
46363
46727
  if (entityData.length === 0) return [];
46364
46728
  return entityData.map((record, idx) => {
@@ -46515,7 +46879,7 @@ var init_TimerDisplay = __esm({
46515
46879
  }
46516
46880
  });
46517
46881
  function extractToastProps(children) {
46518
- if (!React81__default.isValidElement(children)) {
46882
+ if (!React79__default.isValidElement(children)) {
46519
46883
  if (typeof children === "string") {
46520
46884
  return { message: children };
46521
46885
  }
@@ -46553,7 +46917,7 @@ var init_ToastSlot = __esm({
46553
46917
  eventBus.emit("UI:CLOSE");
46554
46918
  };
46555
46919
  if (!isVisible) return null;
46556
- const isCustomContent = React81__default.isValidElement(children) && !message;
46920
+ const isCustomContent = React79__default.isValidElement(children) && !message;
46557
46921
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
46558
46922
  Toast,
46559
46923
  {
@@ -47073,14 +47437,20 @@ function XPBar({
47073
47437
  }) {
47074
47438
  const sizes = sizeMap18[size];
47075
47439
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
47076
- const [fillWidth, setFillWidth] = React81.useState(animated ? 0 : percentage);
47077
- React81.useEffect(() => {
47440
+ const [fillWidth, setFillWidth] = React79.useState(animated ? 0 : percentage);
47441
+ React79.useEffect(() => {
47078
47442
  if (!animated) {
47079
47443
  setFillWidth(percentage);
47080
47444
  return;
47081
47445
  }
47082
- const frame = requestAnimationFrame(() => setFillWidth(percentage));
47083
- return () => cancelAnimationFrame(frame);
47446
+ let frame2;
47447
+ const frame1 = requestAnimationFrame(() => {
47448
+ frame2 = requestAnimationFrame(() => setFillWidth(percentage));
47449
+ });
47450
+ return () => {
47451
+ cancelAnimationFrame(frame1);
47452
+ cancelAnimationFrame(frame2);
47453
+ };
47084
47454
  }, [animated, percentage]);
47085
47455
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
47086
47456
  level != null && /* @__PURE__ */ jsxs(
@@ -47118,7 +47488,7 @@ function XPBar({
47118
47488
  )
47119
47489
  }
47120
47490
  ),
47121
- showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground tabular-nums", sizes.text), children: [
47491
+ showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-foreground/70 tabular-nums", sizes.text), children: [
47122
47492
  current,
47123
47493
  " / ",
47124
47494
  max,
@@ -47141,12 +47511,12 @@ var init_XPBar = __esm({
47141
47511
  }
47142
47512
  });
47143
47513
  function lazyThree(name, loader) {
47144
- const Lazy = React81__default.lazy(() => loader().then((m) => ({ default: m[name] })));
47514
+ const Lazy = React79__default.lazy(() => loader().then((m) => ({ default: m[name] })));
47145
47515
  function ThreeWrapper(props) {
47146
- return React81__default.createElement(
47147
- React81__default.Suspense,
47516
+ return React79__default.createElement(
47517
+ React79__default.Suspense,
47148
47518
  { fallback: null },
47149
- React81__default.createElement(Lazy, props)
47519
+ React79__default.createElement(Lazy, props)
47150
47520
  );
47151
47521
  }
47152
47522
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -47194,8 +47564,6 @@ var init_component_registry_generated = __esm({
47194
47564
  init_ChoiceButton();
47195
47565
  init_ClassifierBoard();
47196
47566
  init_CodeBlock();
47197
- init_CodeView();
47198
- init_CodeViewer();
47199
47567
  init_CombatLog();
47200
47568
  init_ComboCounter();
47201
47569
  init_CommunityLinks();
@@ -47223,7 +47591,6 @@ var init_component_registry_generated = __esm({
47223
47591
  init_DialogueBox();
47224
47592
  init_DialogueBubble();
47225
47593
  init_DocBreadcrumb();
47226
- init_DocCodeBlock();
47227
47594
  init_DocPagination();
47228
47595
  init_DocSearch();
47229
47596
  init_DocSidebar();
@@ -47361,6 +47728,7 @@ var init_component_registry_generated = __esm({
47361
47728
  init_StatDisplay();
47362
47729
  init_StateArchitectBoard();
47363
47730
  init_StateIndicator();
47731
+ init_StateJsonView();
47364
47732
  init_StateMachineView();
47365
47733
  init_StateNode();
47366
47734
  init_StatsGrid();
@@ -47478,8 +47846,6 @@ var init_component_registry_generated = __esm({
47478
47846
  "ChoiceButton": ChoiceButton,
47479
47847
  "ClassifierBoard": ClassifierBoard,
47480
47848
  "CodeBlock": CodeBlock,
47481
- "CodeView": CodeView,
47482
- "CodeViewer": CodeViewer,
47483
47849
  "CombatLog": CombatLog,
47484
47850
  "ComboCounter": ComboCounter,
47485
47851
  "CommunityLinks": CommunityLinks,
@@ -47511,7 +47877,6 @@ var init_component_registry_generated = __esm({
47511
47877
  "Divider": DividerPattern,
47512
47878
  "DividerPattern": DividerPattern,
47513
47879
  "DocBreadcrumb": DocBreadcrumb,
47514
- "DocCodeBlock": DocCodeBlock,
47515
47880
  "DocPagination": DocPagination,
47516
47881
  "DocSearch": DocSearch,
47517
47882
  "DocSidebar": DocSidebar,
@@ -47678,6 +48043,7 @@ var init_component_registry_generated = __esm({
47678
48043
  "StatDisplay": StatDisplay,
47679
48044
  "StateArchitectBoard": StateArchitectBoard,
47680
48045
  "StateIndicator": StateIndicator,
48046
+ "StateJsonView": StateJsonView,
47681
48047
  "StateMachineView": StateMachineView,
47682
48048
  "StateNode": StateNode2,
47683
48049
  "StatsGrid": StatsGrid,
@@ -47762,7 +48128,7 @@ function SuspenseConfigProvider({
47762
48128
  config,
47763
48129
  children
47764
48130
  }) {
47765
- return React81__default.createElement(
48131
+ return React79__default.createElement(
47766
48132
  SuspenseConfigContext.Provider,
47767
48133
  { value: config },
47768
48134
  children
@@ -48252,7 +48618,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
48252
48618
  const key = `${parentId}-${index}-trait:${traitName}`;
48253
48619
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
48254
48620
  }
48255
- return /* @__PURE__ */ jsx(React81__default.Fragment, { children: child }, `${parentId}-${index}`);
48621
+ return /* @__PURE__ */ jsx(React79__default.Fragment, { children: child }, `${parentId}-${index}`);
48256
48622
  }
48257
48623
  if (!child || typeof child !== "object") return null;
48258
48624
  const childId = `${parentId}-${index}`;
@@ -48292,14 +48658,14 @@ function isPatternConfig(value) {
48292
48658
  if (value === null || value === void 0) return false;
48293
48659
  if (typeof value !== "object") return false;
48294
48660
  if (Array.isArray(value)) return false;
48295
- if (React81__default.isValidElement(value)) return false;
48661
+ if (React79__default.isValidElement(value)) return false;
48296
48662
  if (value instanceof Date) return false;
48297
48663
  if (typeof value === "function") return false;
48298
48664
  const record = value;
48299
48665
  return "type" in record && typeof record.type === "string";
48300
48666
  }
48301
48667
  function isPlainConfigObject(value) {
48302
- if (React81__default.isValidElement(value)) return false;
48668
+ if (React79__default.isValidElement(value)) return false;
48303
48669
  if (value instanceof Date) return false;
48304
48670
  const proto = Object.getPrototypeOf(value);
48305
48671
  return proto === Object.prototype || proto === null;
@@ -49459,7 +49825,7 @@ init_EventHandlerBoard();
49459
49825
  init_StateNode();
49460
49826
  init_TransitionArrow();
49461
49827
  init_VariablePanel();
49462
- init_CodeView();
49828
+ init_StateJsonView();
49463
49829
  init_StateArchitectBoard();
49464
49830
 
49465
49831
  // components/game/organisms/puzzles/simulator/index.ts
@@ -49910,4 +50276,4 @@ init_AboutPageTemplate();
49910
50276
  // components/index.ts
49911
50277
  init_cn();
49912
50278
 
49913
- export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CodeView, CodeViewer, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocCodeBlock, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };
50279
+ export { ALL_PRESETS, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, ActionButton, ActionButtons, Card2 as ActionCard, ActionPalette, ActionTile, Alert, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArrayEditor, ArticleSection, Aside, AssetPicker, AuthLayout, Avatar, Badge, BattleBoard, BattleTemplate, BehaviorView, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, BuilderBoard, Button, ButtonGroup, CTABanner, CalendarGrid, CanvasEffect, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, CastleBoard, CastleTemplate, Center, Chart, ChartLegend, Checkbox, ChoiceButton, ClassifierBoard, Coachmark, CodeBlock, CollapsibleSection, CombatLog, ComboCounter, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, Container, ContentRenderer, ContentSection, ControlButton, CounterTemplate, CraftingRecipe, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, DPad, DamageNumber, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DebuggerBoard, DetailPanel, Dialog, DialogueBox, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmptyState, EnemyPlate, EntityDisplayEvents, ErrorBoundary, ErrorState, EventHandlerBoard, EventLog, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FeatureRenderer2 as FeatureRenderer, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, GameAudioContext, GameAudioProvider, GameAudioToggle, GameCanvas2D, GameHud, GameMenu, GameOverScreen, GameShell, GameTemplate, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HealthPanel, HeroOrganism, HeroSection, IDENTITY_BOOK_FIELDS, Icon, IconPicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, InventoryGrid, InventoryPanel, IsometricCanvas, ItemSlot, JazariStateMachine, Label, LandingPageTemplate, LawReferenceTooltip, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapEditor, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MatrixQuestion, MediaGallery, Menu, Meter, MiniMap, Modal, ModalSlot, ModuleCard, Navigation, NegotiatorBoard, NotifyListener, NumberStepper, ObjectEditor, ObjectRulePanel, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, Pagination, PatternTile, PhysicsManager, PlatformerCanvas, Popover, PositionedCanvas, PowerupSlots, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuestTracker, QuizBlock, Radio, RangeSlider, RelationSelect, RepeatableFormSection, ReplyTree, ResourceBar, ResourceCounter, RichBlockEditor, RuleEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreBoard, ScoreDisplay, SearchInput, Section, SectionHeader, Select, SequenceBar, SequencerBoard, ServiceCatalog, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, SimulationCanvas, SimulationControls, SimulationGraph, SimulatorBoard, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Sprite, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateArchitectBoard, StateIndicator, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StatusEffect, StepFlow, StepFlowOrganism, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeSelector, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TurnIndicator, TurnPanel, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UncontrolledBattleBoard, UnitCommandBar, UploadDropZone, VStack, VariablePanel, VersionDiff, ViolationAlert, VoteStack, WaypointMarker, WizardContainer, WizardNavigation, WizardProgress, WorldMapBoard, WorldMapTemplate, XPBar, applyTemporaryEffect, calculateAttackTargets, calculateDamage, calculateValidMoves, cn, combatAnimations, combatClasses, combatEffects, createInitialGameState, createUnitAnimationState, drawSprite, generateCombatMessage, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, mapBookData, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, screenToIso, springOscillator, tickAnimationState, toCodeLanguage, transitionAnimation, useAnchorRect, useBattleState, useCamera, useGameAudio, useGameAudioContext, useImageCache, usePhysics2D, useSpriteAnimations };