@almadar/ui 5.16.4 → 5.17.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 (106) hide show
  1. package/dist/avl/index.cjs +191 -153
  2. package/dist/avl/index.js +191 -153
  3. package/dist/components/atoms/Avatar.d.ts +4 -2
  4. package/dist/components/atoms/ConditionalWrapper.d.ts +2 -2
  5. package/dist/components/atoms/Icon.d.ts +6 -2
  6. package/dist/components/atoms/Input.d.ts +3 -2
  7. package/dist/components/atoms/LawReferenceTooltip.d.ts +2 -2
  8. package/dist/components/atoms/game/MiniMap.d.ts +15 -17
  9. package/dist/components/atoms/index.d.ts +1 -0
  10. package/dist/components/atoms/types.d.ts +40 -0
  11. package/dist/components/index.cjs +191 -153
  12. package/dist/components/index.js +191 -153
  13. package/dist/components/molecules/CTABanner.d.ts +3 -8
  14. package/dist/components/molecules/CalendarGrid.d.ts +2 -2
  15. package/dist/components/molecules/CommunityLinks.d.ts +15 -12
  16. package/dist/components/molecules/DataGrid.d.ts +2 -1
  17. package/dist/components/molecules/DataList.d.ts +12 -11
  18. package/dist/components/molecules/GraphView.d.ts +2 -2
  19. package/dist/components/molecules/HeroSection.d.ts +4 -12
  20. package/dist/components/molecules/MapView.d.ts +2 -2
  21. package/dist/components/molecules/MarketingFooter.d.ts +6 -5
  22. package/dist/components/molecules/Meter.d.ts +2 -1
  23. package/dist/components/molecules/OptionConstraintGroup.d.ts +5 -3
  24. package/dist/components/molecules/PricingCard.d.ts +2 -4
  25. package/dist/components/molecules/QrScanner.d.ts +2 -2
  26. package/dist/components/molecules/RepeatableFormSection.d.ts +2 -2
  27. package/dist/components/molecules/ShowcaseCard.d.ts +2 -4
  28. package/dist/components/molecules/SplitSection.d.ts +2 -4
  29. package/dist/components/molecules/StatDisplay.d.ts +2 -1
  30. package/dist/components/molecules/StatsGrid.d.ts +5 -4
  31. package/dist/components/molecules/TableView.d.ts +2 -1
  32. package/dist/components/molecules/ViolationAlert.d.ts +2 -2
  33. package/dist/components/molecules/game/CraftingRecipe.d.ts +11 -7
  34. package/dist/components/molecules/game/DialogueBox.d.ts +2 -2
  35. package/dist/components/molecules/game/HealthPanel.d.ts +6 -5
  36. package/dist/components/molecules/game/IsometricCanvas.d.ts +9 -13
  37. package/dist/components/organisms/Chart.d.ts +2 -1
  38. package/dist/components/organisms/CodeViewer.d.ts +8 -6
  39. package/dist/components/organisms/ComponentPatterns.d.ts +2 -1
  40. package/dist/components/organisms/ConfirmDialog.d.ts +2 -1
  41. package/dist/components/organisms/CustomPattern.d.ts +2 -1
  42. package/dist/components/organisms/DataTable.d.ts +6 -5
  43. package/dist/components/organisms/DetailPanel.d.ts +5 -4
  44. package/dist/components/organisms/DocumentViewer.d.ts +9 -7
  45. package/dist/components/organisms/DrawerSlot.d.ts +2 -1
  46. package/dist/components/organisms/Form.d.ts +5 -4
  47. package/dist/components/organisms/GraphCanvas.d.ts +2 -1
  48. package/dist/components/organisms/Header.d.ts +17 -14
  49. package/dist/components/organisms/JazariStateMachine.d.ts +2 -1
  50. package/dist/components/organisms/LayoutPatterns.d.ts +4 -3
  51. package/dist/components/organisms/List.d.ts +2 -2
  52. package/dist/components/organisms/Meter.d.ts +2 -1
  53. package/dist/components/organisms/ModalSlot.d.ts +2 -1
  54. package/dist/components/organisms/Navigation.d.ts +2 -1
  55. package/dist/components/organisms/OrbitalVisualization.d.ts +2 -1
  56. package/dist/components/organisms/PageHeader.d.ts +7 -5
  57. package/dist/components/organisms/Section.d.ts +2 -1
  58. package/dist/components/organisms/Sidebar.d.ts +2 -1
  59. package/dist/components/organisms/SignaturePad.d.ts +2 -1
  60. package/dist/components/organisms/Split.d.ts +2 -1
  61. package/dist/components/organisms/StateMachineView.d.ts +8 -4
  62. package/dist/components/organisms/Timeline.d.ts +2 -1
  63. package/dist/components/organisms/ToastSlot.d.ts +2 -1
  64. package/dist/components/organisms/UISlotRenderer.d.ts +4 -3
  65. package/dist/components/organisms/WizardContainer.d.ts +2 -1
  66. package/dist/components/organisms/book/types.d.ts +2 -2
  67. package/dist/components/organisms/game/BattleBoard.d.ts +4 -4
  68. package/dist/components/organisms/game/CanvasEffect.d.ts +2 -1
  69. package/dist/components/organisms/game/CastleBoard.d.ts +6 -5
  70. package/dist/components/organisms/game/GameAudioProvider.d.ts +2 -1
  71. package/dist/components/organisms/game/GameAudioToggle.d.ts +2 -1
  72. package/dist/components/organisms/game/TraitSlot.d.ts +4 -3
  73. package/dist/components/organisms/game/TraitStateViewer.d.ts +6 -5
  74. package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +9 -4
  75. package/dist/components/organisms/game/WorldMapBoard.d.ts +11 -9
  76. package/dist/components/organisms/game/physics-sim/SimulationControls.d.ts +8 -7
  77. package/dist/components/organisms/game/puzzles/builder/BuilderBoard.d.ts +3 -3
  78. package/dist/components/organisms/game/puzzles/classifier/ClassifierBoard.d.ts +3 -3
  79. package/dist/components/organisms/game/puzzles/debugger/DebuggerBoard.d.ts +3 -3
  80. package/dist/components/organisms/game/puzzles/event-handler/EventHandlerBoard.d.ts +7 -4
  81. package/dist/components/organisms/game/puzzles/event-handler/ObjectRulePanel.d.ts +2 -2
  82. package/dist/components/organisms/game/puzzles/event-handler/RuleEditor.d.ts +7 -9
  83. package/dist/components/organisms/game/puzzles/negotiator/NegotiatorBoard.d.ts +3 -3
  84. package/dist/components/organisms/game/puzzles/sequencer/SequencerBoard.d.ts +5 -4
  85. package/dist/components/organisms/game/puzzles/simulator/SimulatorBoard.d.ts +3 -3
  86. package/dist/components/organisms/game/puzzles/state-architect/StateArchitectBoard.d.ts +5 -4
  87. package/dist/components/organisms/game/puzzles/state-architect/StateNode.d.ts +2 -4
  88. package/dist/components/organisms/game/puzzles/state-architect/TransitionArrow.d.ts +3 -8
  89. package/dist/components/organisms/game/types/isometric.d.ts +4 -4
  90. package/dist/components/organisms/index.d.ts +1 -1
  91. package/dist/components/organisms/types.d.ts +3 -1
  92. package/dist/components/templates/DashboardLayout.d.ts +6 -5
  93. package/dist/components/templates/GameTemplate.d.ts +7 -6
  94. package/dist/components/templates/GenericAppTemplate.d.ts +1 -7
  95. package/dist/components/templates/types.d.ts +14 -6
  96. package/dist/docs/index.cjs +60 -22
  97. package/dist/docs/index.d.cts +9 -4
  98. package/dist/docs/index.js +58 -20
  99. package/dist/marketing/index.cjs +61 -23
  100. package/dist/marketing/index.d.cts +54 -55
  101. package/dist/marketing/index.js +58 -20
  102. package/dist/providers/index.cjs +191 -153
  103. package/dist/providers/index.js +191 -153
  104. package/dist/runtime/index.cjs +191 -153
  105. package/dist/runtime/index.js +191 -153
  106. package/package.json +1 -1
@@ -1831,11 +1831,13 @@ var init_Icon = __esm({
1831
1831
  strokeWidth,
1832
1832
  style
1833
1833
  }) => {
1834
+ const directIcon = typeof icon === "string" ? void 0 : icon;
1835
+ const effectiveName = typeof icon === "string" ? icon : name;
1834
1836
  const family = useIconFamily();
1835
1837
  const RenderedComponent = React80__default.useMemo(() => {
1836
- if (icon) return null;
1837
- return name ? resolveIconForFamily(name, family) : null;
1838
- }, [icon, name, family]);
1838
+ if (directIcon) return null;
1839
+ return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
1840
+ }, [directIcon, effectiveName, family]);
1839
1841
  const effectiveStrokeWidth = strokeWidth ?? void 0;
1840
1842
  const inlineStyle = {
1841
1843
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
@@ -1847,8 +1849,8 @@ var init_Icon = __esm({
1847
1849
  color ? color : "text-current",
1848
1850
  className
1849
1851
  );
1850
- if (icon) {
1851
- const Direct = icon;
1852
+ if (directIcon) {
1853
+ const Direct = directIcon;
1852
1854
  return /* @__PURE__ */ jsx(
1853
1855
  Direct,
1854
1856
  {
@@ -2040,7 +2042,7 @@ var init_Input = __esm({
2040
2042
  error,
2041
2043
  leftIcon,
2042
2044
  rightIcon,
2043
- icon: IconComponent,
2045
+ icon: iconProp,
2044
2046
  clearable,
2045
2047
  onClear,
2046
2048
  value,
@@ -2050,6 +2052,7 @@ var init_Input = __esm({
2050
2052
  ...props
2051
2053
  }, ref) => {
2052
2054
  const type = inputType || htmlType || "text";
2055
+ const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
2053
2056
  const resolvedLeftIcon = leftIcon || IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "h-icon-default w-icon-default" });
2054
2057
  const showClearButton = clearable && value && String(value).length > 0;
2055
2058
  const isMultiline = type === "textarea";
@@ -2688,7 +2691,7 @@ var init_Avatar = __esm({
2688
2691
  alt,
2689
2692
  name,
2690
2693
  initials: providedInitials,
2691
- icon: IconComponent,
2694
+ icon: iconProp,
2692
2695
  size = "md",
2693
2696
  status,
2694
2697
  badge,
@@ -2699,6 +2702,7 @@ var init_Avatar = __esm({
2699
2702
  }) => {
2700
2703
  const eventBus = useEventBus();
2701
2704
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
2705
+ const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
2702
2706
  const hasImage = !!src;
2703
2707
  const hasInitials = !!initials;
2704
2708
  const hasIcon = !!IconComponent;
@@ -13682,6 +13686,7 @@ var init_StateMachineView = __esm({
13682
13686
  setTooltip((prev) => ({ ...prev, pinned: false, visible: false }));
13683
13687
  }, []);
13684
13688
  useEventListener("UI:TOOLTIP_CLOSE", handleCloseTooltip);
13689
+ if (!layoutData) return null;
13685
13690
  const { width, height, title, states, labels, entity, outputs, config } = layoutData;
13686
13691
  const bundles = useMemo(() => {
13687
13692
  const bundleMap = {};
@@ -16026,13 +16031,14 @@ function BuilderBoard({
16026
16031
  }) {
16027
16032
  const { emit } = useEventBus();
16028
16033
  const { t } = useTranslate();
16034
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
16029
16035
  const [placements, setPlacements] = useState({});
16030
16036
  const [headerError, setHeaderError] = useState(false);
16031
16037
  const [submitted, setSubmitted] = useState(false);
16032
16038
  const [attempts, setAttempts] = useState(0);
16033
16039
  const [showHint, setShowHint] = useState(false);
16034
- const components = entity?.components ?? [];
16035
- const slots = entity?.slots ?? [];
16040
+ const components = resolved?.components ?? [];
16041
+ const slots = resolved?.slots ?? [];
16036
16042
  const usedComponentIds = new Set(Object.values(placements));
16037
16043
  const availableComponents = components.filter((c) => !usedComponentIds.has(c.id));
16038
16044
  const [selectedComponent, setSelectedComponent] = useState(null);
@@ -16066,7 +16072,7 @@ function BuilderBoard({
16066
16072
  }, [slots, placements, attempts, completeEvent, emit]);
16067
16073
  const handleReset = () => {
16068
16074
  setSubmitted(false);
16069
- if (attempts >= 2 && entity.hint) {
16075
+ if (attempts >= 2 && resolved?.hint) {
16070
16076
  setShowHint(true);
16071
16077
  }
16072
16078
  };
@@ -16078,20 +16084,21 @@ function BuilderBoard({
16078
16084
  setShowHint(false);
16079
16085
  };
16080
16086
  const getComponentById = (id) => components.find((c) => c.id === id);
16087
+ if (!resolved) return null;
16081
16088
  return /* @__PURE__ */ jsx(
16082
16089
  Box,
16083
16090
  {
16084
16091
  className,
16085
16092
  style: {
16086
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
16093
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
16087
16094
  backgroundSize: "cover",
16088
16095
  backgroundPosition: "center"
16089
16096
  },
16090
16097
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
16091
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
16098
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
16092
16099
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
16093
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
16094
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
16100
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
16101
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
16095
16102
  ] }) }),
16096
16103
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
16097
16104
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.components") }),
@@ -16151,9 +16158,9 @@ function BuilderBoard({
16151
16158
  ] }) }),
16152
16159
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
16153
16160
  /* @__PURE__ */ jsx(Icon, { icon: allCorrect ? CheckCircle : XCircle, size: "lg", className: allCorrect ? "text-success" : "text-error" }),
16154
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("builder.success") : entity.failMessage ?? t("builder.incorrect") })
16161
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("builder.success") : resolved.failMessage ?? t("builder.incorrect") })
16155
16162
  ] }) }),
16156
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
16163
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
16157
16164
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
16158
16165
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allPlaced, children: [
16159
16166
  /* @__PURE__ */ jsx(Icon, { icon: Wrench, size: "sm" }),
@@ -18694,11 +18701,12 @@ function CastleBoard({
18694
18701
  className
18695
18702
  }) {
18696
18703
  const eventBus = useEventBus();
18697
- const tiles = entity.tiles;
18698
- const features = entity.features ?? [];
18699
- const units = entity.units ?? [];
18700
- const assetManifest = entity.assetManifest;
18701
- const backgroundImage = entity.backgroundImage;
18704
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
18705
+ const tiles = resolved?.tiles ?? [];
18706
+ const features = resolved?.features ?? [];
18707
+ const units = resolved?.units ?? [];
18708
+ const assetManifest = resolved?.assetManifest;
18709
+ const backgroundImage = resolved?.backgroundImage;
18702
18710
  const [hoveredTile, setHoveredTile] = useState(null);
18703
18711
  const [selectedFeature, setSelectedFeature] = useState(null);
18704
18712
  const hoveredFeature = useMemo(() => {
@@ -19649,13 +19657,14 @@ function ClassifierBoard({
19649
19657
  }) {
19650
19658
  const { emit } = useEventBus();
19651
19659
  const { t } = useTranslate();
19660
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
19652
19661
  const [assignments, setAssignments] = useState({});
19653
19662
  const [headerError, setHeaderError] = useState(false);
19654
19663
  const [submitted, setSubmitted] = useState(false);
19655
19664
  const [attempts, setAttempts] = useState(0);
19656
19665
  const [showHint, setShowHint] = useState(false);
19657
- const items = entity?.items ?? [];
19658
- const categories = entity?.categories ?? [];
19666
+ const items = resolved?.items ?? [];
19667
+ const categories = resolved?.categories ?? [];
19659
19668
  const unassignedItems = items.filter((item) => !assignments[item.id]);
19660
19669
  const allAssigned = Object.keys(assignments).length === items.length;
19661
19670
  const results = submitted ? items.map((item) => ({
@@ -19687,7 +19696,7 @@ function ClassifierBoard({
19687
19696
  }, [items, assignments, attempts, completeEvent, emit]);
19688
19697
  const handleReset = () => {
19689
19698
  setSubmitted(false);
19690
- if (attempts >= 2 && entity.hint) {
19699
+ if (attempts >= 2 && resolved?.hint) {
19691
19700
  setShowHint(true);
19692
19701
  }
19693
19702
  };
@@ -19697,20 +19706,21 @@ function ClassifierBoard({
19697
19706
  setAttempts(0);
19698
19707
  setShowHint(false);
19699
19708
  };
19709
+ if (!resolved) return null;
19700
19710
  return /* @__PURE__ */ jsx(
19701
19711
  Box,
19702
19712
  {
19703
19713
  className,
19704
19714
  style: {
19705
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
19715
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
19706
19716
  backgroundSize: "cover",
19707
19717
  backgroundPosition: "center"
19708
19718
  },
19709
19719
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
19710
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
19720
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
19711
19721
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
19712
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
19713
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
19722
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
19723
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
19714
19724
  ] }) }),
19715
19725
  unassignedItems.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
19716
19726
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("classifier.itemsToSort") }),
@@ -19762,10 +19772,10 @@ function ClassifierBoard({
19762
19772
  }) }),
19763
19773
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
19764
19774
  /* @__PURE__ */ jsx(Icon, { icon: allCorrect ? CheckCircle : XCircle, size: "lg", className: allCorrect ? "text-success" : "text-error" }),
19765
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
19766
- !allCorrect && entity.failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: entity.failMessage })
19775
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
19776
+ !allCorrect && resolved.failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: resolved.failMessage })
19767
19777
  ] }) }),
19768
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
19778
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
19769
19779
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
19770
19780
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allAssigned, children: [
19771
19781
  /* @__PURE__ */ jsx(Icon, { icon: Send, size: "sm" }),
@@ -31826,7 +31836,7 @@ var init_OptionConstraintGroup = __esm({
31826
31836
  title,
31827
31837
  description,
31828
31838
  options,
31829
- constraint,
31839
+ constraint = { type: "single" },
31830
31840
  selected = [],
31831
31841
  onChange,
31832
31842
  changeEvent,
@@ -35068,7 +35078,7 @@ function DataTable({
35068
35078
  children: /* @__PURE__ */ jsx(
35069
35079
  EmptyState,
35070
35080
  {
35071
- icon: emptyIcon,
35081
+ icon: typeof emptyIcon === "string" ? resolveIcon(emptyIcon) : emptyIcon,
35072
35082
  title: resolvedEmptyTitle,
35073
35083
  description: resolvedEmptyDescription,
35074
35084
  actionLabel: emptyAction?.label,
@@ -35197,6 +35207,7 @@ var init_DataTable = __esm({
35197
35207
  init_Stack();
35198
35208
  init_Typography();
35199
35209
  init_molecules();
35210
+ init_Icon();
35200
35211
  init_useEventBus();
35201
35212
  init_useTranslate();
35202
35213
  init_types3();
@@ -35217,6 +35228,7 @@ function DebuggerBoard({
35217
35228
  }) {
35218
35229
  const { emit } = useEventBus();
35219
35230
  const { t } = useTranslate();
35231
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
35220
35232
  const [flaggedLines, setFlaggedLines] = useState(/* @__PURE__ */ new Set());
35221
35233
  const [headerError, setHeaderError] = useState(false);
35222
35234
  const [submitted, setSubmitted] = useState(false);
@@ -35234,7 +35246,7 @@ function DebuggerBoard({
35234
35246
  return next;
35235
35247
  });
35236
35248
  };
35237
- const lines = entity?.lines ?? [];
35249
+ const lines = resolved?.lines ?? [];
35238
35250
  const bugLines = lines.filter((l) => l.isBug);
35239
35251
  const correctFlags = lines.filter((l) => l.isBug && flaggedLines.has(l.id));
35240
35252
  const falseFlags = lines.filter((l) => !l.isBug && flaggedLines.has(l.id));
@@ -35249,7 +35261,7 @@ function DebuggerBoard({
35249
35261
  }, [correctFlags.length, bugLines.length, falseFlags.length, attempts, completeEvent, emit]);
35250
35262
  const handleReset = () => {
35251
35263
  setSubmitted(false);
35252
- if (attempts >= 2 && entity.hint) {
35264
+ if (attempts >= 2 && resolved?.hint) {
35253
35265
  setShowHint(true);
35254
35266
  }
35255
35267
  };
@@ -35259,24 +35271,25 @@ function DebuggerBoard({
35259
35271
  setAttempts(0);
35260
35272
  setShowHint(false);
35261
35273
  };
35274
+ if (!resolved) return null;
35262
35275
  return /* @__PURE__ */ jsx(
35263
35276
  Box,
35264
35277
  {
35265
35278
  className,
35266
35279
  style: {
35267
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
35280
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
35268
35281
  backgroundSize: "cover",
35269
35282
  backgroundPosition: "center"
35270
35283
  },
35271
35284
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
35272
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
35285
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
35273
35286
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
35274
35287
  /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
35275
35288
  /* @__PURE__ */ jsx(Icon, { icon: Bug, size: "sm" }),
35276
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title })
35289
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title })
35277
35290
  ] }),
35278
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description }),
35279
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(entity.bugCount) }) })
35291
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description }),
35292
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(resolved.bugCount) }) })
35280
35293
  ] }) }),
35281
35294
  /* @__PURE__ */ jsx(Card, { className: "p-0 overflow-hidden", children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: lines.map((line, i) => {
35282
35295
  const isFlagged = flaggedLines.has(line.id);
@@ -35308,7 +35321,7 @@ function DebuggerBoard({
35308
35321
  );
35309
35322
  }) }) }),
35310
35323
  submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
35311
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? entity.successMessage ?? t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
35324
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? resolved.successMessage ?? t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
35312
35325
  bugLines.map((line) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "start", children: [
35313
35326
  /* @__PURE__ */ jsx(
35314
35327
  Icon,
@@ -35324,7 +35337,7 @@ function DebuggerBoard({
35324
35337
  ] })
35325
35338
  ] }, line.id))
35326
35339
  ] }) }),
35327
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
35340
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
35328
35341
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
35329
35342
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: flaggedLines.size === 0, children: [
35330
35343
  /* @__PURE__ */ jsx(Icon, { icon: Send, size: "sm" }),
@@ -36551,7 +36564,8 @@ function EventHandlerBoard({
36551
36564
  }) {
36552
36565
  const { emit } = useEventBus();
36553
36566
  const { t } = useTranslate();
36554
- const entityObjects = entity?.objects ?? [];
36567
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
36568
+ const entityObjects = resolved?.objects ?? [];
36555
36569
  const [objects, setObjects] = useState(entityObjects);
36556
36570
  const [selectedObjectId, setSelectedObjectId] = useState(
36557
36571
  entityObjects[0]?.id || null
@@ -36586,7 +36600,7 @@ function EventHandlerBoard({
36586
36600
  allRules.push({ object: obj, rule });
36587
36601
  });
36588
36602
  });
36589
- const triggers = entity.triggerEvents || [];
36603
+ const triggers = resolved?.triggerEvents || [];
36590
36604
  const eventQueue = [...triggers];
36591
36605
  const firedEvents = /* @__PURE__ */ new Set();
36592
36606
  let stepIdx = 0;
@@ -36617,12 +36631,12 @@ function EventHandlerBoard({
36617
36631
  matching.forEach(({ object, rule }) => {
36618
36632
  addLogEntry(object.icon, t("eventHandler.heardEvent", { object: object.name, event: currentEvent, action: rule.thenAction }), "done");
36619
36633
  eventQueue.push(rule.thenAction);
36620
- if (rule.thenAction === entity.goalEvent) {
36634
+ if (rule.thenAction === resolved?.goalEvent) {
36621
36635
  goalReached = true;
36622
36636
  }
36623
36637
  });
36624
36638
  }
36625
- if (currentEvent === entity.goalEvent) {
36639
+ if (currentEvent === resolved?.goalEvent) {
36626
36640
  goalReached = true;
36627
36641
  }
36628
36642
  stepIdx++;
@@ -36632,7 +36646,7 @@ function EventHandlerBoard({
36632
36646
  addLogEntry("\u{1F3AC}", t("eventHandler.simulationStarted", { events: triggers.join(", ") }), "active");
36633
36647
  }
36634
36648
  timerRef.current = setTimeout(processNext, stepDurationMs);
36635
- }, [playState, objects, entity, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
36649
+ }, [playState, objects, resolved, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
36636
36650
  const handleTryAgain = useCallback(() => {
36637
36651
  if (timerRef.current) clearTimeout(timerRef.current);
36638
36652
  setPlayState("editing");
@@ -36640,12 +36654,13 @@ function EventHandlerBoard({
36640
36654
  }, []);
36641
36655
  const handleReset = useCallback(() => {
36642
36656
  if (timerRef.current) clearTimeout(timerRef.current);
36643
- setObjects(entity?.objects ?? []);
36657
+ setObjects(resolved?.objects ?? []);
36644
36658
  setPlayState("editing");
36645
36659
  setEventLog([]);
36646
- setSelectedObjectId((entity?.objects ?? [])[0]?.id || null);
36660
+ setSelectedObjectId((resolved?.objects ?? [])[0]?.id || null);
36647
36661
  setAttempts(0);
36648
- }, [entity?.objects]);
36662
+ }, [resolved?.objects]);
36663
+ if (!resolved) return null;
36649
36664
  const objectViewers = objects.map((obj) => {
36650
36665
  const machine = {
36651
36666
  name: obj.name,
@@ -36659,25 +36674,25 @@ function EventHandlerBoard({
36659
36674
  };
36660
36675
  return { obj, machine };
36661
36676
  });
36662
- const showHint = attempts >= 3 && entity.hint;
36677
+ const showHint = attempts >= 3 && resolved.hint;
36663
36678
  const encourageKey = ENCOURAGEMENT_KEYS[Math.min(attempts - 1, ENCOURAGEMENT_KEYS.length - 1)] ?? ENCOURAGEMENT_KEYS[0];
36664
36679
  return /* @__PURE__ */ jsxs(
36665
36680
  VStack,
36666
36681
  {
36667
36682
  className: cn("p-4 gap-6", className),
36668
36683
  style: {
36669
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
36684
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
36670
36685
  backgroundSize: "cover",
36671
36686
  backgroundPosition: "center"
36672
36687
  },
36673
36688
  children: [
36674
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
36689
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
36675
36690
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
36676
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
36677
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description }),
36691
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
36692
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description }),
36678
36693
  /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-primary/10 border border-primary/30", gap: "xs", children: [
36679
36694
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold", children: t("game.goal") + ":" }),
36680
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: entity.goalCondition })
36695
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: resolved.goalCondition })
36681
36696
  ] })
36682
36697
  ] }),
36683
36698
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
@@ -36708,12 +36723,12 @@ function EventHandlerBoard({
36708
36723
  }
36709
36724
  ),
36710
36725
  eventLog.length > 0 && /* @__PURE__ */ jsx(EventLog, { entries: eventLog }),
36711
- 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: entity.successMessage || t("eventHandler.chainComplete") }) }),
36726
+ 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: resolved.successMessage || t("eventHandler.chainComplete") }) }),
36712
36727
  playState === "fail" && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
36713
36728
  /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(encourageKey) }) }),
36714
36729
  showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
36715
36730
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
36716
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
36731
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
36717
36732
  ] }) })
36718
36733
  ] }),
36719
36734
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
@@ -39927,19 +39942,20 @@ function NegotiatorBoard({
39927
39942
  }) {
39928
39943
  const { emit } = useEventBus();
39929
39944
  const { t } = useTranslate();
39945
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
39930
39946
  const [history, setHistory] = useState([]);
39931
39947
  const [headerError, setHeaderError] = useState(false);
39932
39948
  const [showHint, setShowHint] = useState(false);
39933
39949
  const currentRound = history.length;
39934
- const isComplete = currentRound >= entity.totalRounds;
39950
+ const isComplete = currentRound >= (resolved?.totalRounds ?? 0);
39935
39951
  const playerTotal = history.reduce((s, r) => s + r.playerPayoff, 0);
39936
39952
  const opponentTotal = history.reduce((s, r) => s + r.opponentPayoff, 0);
39937
- const won = isComplete && playerTotal >= entity.targetScore;
39938
- const actions = entity?.actions ?? [];
39939
- const payoffMatrix = entity?.payoffMatrix ?? [];
39953
+ const won = isComplete && playerTotal >= (resolved?.targetScore ?? 0);
39954
+ const actions = resolved?.actions ?? [];
39955
+ const payoffMatrix = resolved?.payoffMatrix ?? [];
39940
39956
  const handleAction = useCallback((actionId) => {
39941
39957
  if (isComplete) return;
39942
- const opponentAction = getOpponentAction(entity.opponentStrategy, actions, history);
39958
+ const opponentAction = getOpponentAction(resolved?.opponentStrategy ?? "random", actions, history);
39943
39959
  const payoff = payoffMatrix.find(
39944
39960
  (p2) => p2.playerAction === actionId && p2.opponentAction === opponentAction
39945
39961
  );
@@ -39952,41 +39968,42 @@ function NegotiatorBoard({
39952
39968
  };
39953
39969
  const newHistory = [...history, result];
39954
39970
  setHistory(newHistory);
39955
- if (newHistory.length >= entity.totalRounds) {
39971
+ if (newHistory.length >= (resolved?.totalRounds ?? 0)) {
39956
39972
  const total = newHistory.reduce((s, r) => s + r.playerPayoff, 0);
39957
- if (total >= entity.targetScore) {
39973
+ if (total >= (resolved?.targetScore ?? 0)) {
39958
39974
  emit(`UI:${completeEvent}`, { success: true, score: total });
39959
39975
  }
39960
- if (newHistory.length >= 3 && entity.hint) {
39976
+ if (newHistory.length >= 3 && resolved?.hint) {
39961
39977
  setShowHint(true);
39962
39978
  }
39963
39979
  }
39964
- }, [isComplete, entity, actions, payoffMatrix, history, currentRound, completeEvent, emit]);
39980
+ }, [isComplete, resolved, actions, payoffMatrix, history, currentRound, completeEvent, emit]);
39965
39981
  const handleReset = () => {
39966
39982
  setHistory([]);
39967
39983
  setShowHint(false);
39968
39984
  };
39969
39985
  const getActionLabel = (id) => actions.find((a) => a.id === id)?.label ?? id;
39986
+ if (!resolved) return null;
39970
39987
  return /* @__PURE__ */ jsx(
39971
39988
  Box,
39972
39989
  {
39973
39990
  className,
39974
39991
  style: {
39975
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
39992
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
39976
39993
  backgroundSize: "cover",
39977
39994
  backgroundPosition: "center"
39978
39995
  },
39979
39996
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
39980
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
39997
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
39981
39998
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
39982
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
39983
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description }),
39999
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
40000
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description }),
39984
40001
  /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
39985
- /* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(entity.totalRounds) }) }),
40002
+ /* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(resolved.totalRounds) }) }),
39986
40003
  /* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
39987
40004
  t("negotiator.target"),
39988
40005
  ": ",
39989
- entity.targetScore
40006
+ resolved.targetScore
39990
40007
  ] })
39991
40008
  ] })
39992
40009
  ] }) }),
@@ -40035,16 +40052,16 @@ function NegotiatorBoard({
40035
40052
  ] }) }),
40036
40053
  isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
40037
40054
  /* @__PURE__ */ jsx(Icon, { icon: CheckCircle, size: "lg", className: won ? "text-success" : "text-error" }),
40038
- /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? entity.successMessage ?? t("negotiator.success") : entity.failMessage ?? t("negotiator.failed") }),
40055
+ /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? resolved.successMessage ?? t("negotiator.success") : resolved.failMessage ?? t("negotiator.failed") }),
40039
40056
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
40040
40057
  t("negotiator.finalScore"),
40041
40058
  ": ",
40042
40059
  playerTotal,
40043
40060
  "/",
40044
- entity.targetScore
40061
+ resolved.targetScore
40045
40062
  ] })
40046
40063
  ] }) }),
40047
- showHint && entity.hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
40064
+ showHint && resolved.hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
40048
40065
  isComplete && !won && /* @__PURE__ */ jsx(HStack, { justify: "center", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleReset, children: t("negotiator.playAgain") }) })
40049
40066
  ] })
40050
40067
  }
@@ -42863,15 +42880,16 @@ function SequencerBoard({
42863
42880
  }) {
42864
42881
  const { emit } = useEventBus();
42865
42882
  const { t } = useTranslate();
42883
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
42866
42884
  const [headerError, setHeaderError] = useState(false);
42867
42885
  const [slots, setSlots] = useState(
42868
- () => Array.from({ length: entity.maxSlots }, () => void 0)
42886
+ () => Array.from({ length: resolved?.maxSlots ?? 0 }, () => void 0)
42869
42887
  );
42870
42888
  const [playState, setPlayState] = useState("idle");
42871
42889
  const [currentStep, setCurrentStep] = useState(-1);
42872
42890
  const [attempts, setAttempts] = useState(0);
42873
42891
  const [slotFeedback, setSlotFeedback] = useState(
42874
- () => Array.from({ length: entity.maxSlots }, () => null)
42892
+ () => Array.from({ length: resolved?.maxSlots ?? 0 }, () => null)
42875
42893
  );
42876
42894
  const timerRef = useRef(null);
42877
42895
  useEffect(() => () => {
@@ -42905,17 +42923,17 @@ function SequencerBoard({
42905
42923
  }, [emit]);
42906
42924
  const handleReset = useCallback(() => {
42907
42925
  if (timerRef.current) clearTimeout(timerRef.current);
42908
- setSlots(Array.from({ length: entity.maxSlots }, () => void 0));
42926
+ setSlots(Array.from({ length: resolved?.maxSlots ?? 0 }, () => void 0));
42909
42927
  setPlayState("idle");
42910
42928
  setCurrentStep(-1);
42911
42929
  setAttempts(0);
42912
- setSlotFeedback(Array.from({ length: entity.maxSlots }, () => null));
42913
- }, [entity.maxSlots]);
42930
+ setSlotFeedback(Array.from({ length: resolved?.maxSlots ?? 0 }, () => null));
42931
+ }, [resolved?.maxSlots]);
42914
42932
  const filledSlots = slots.filter((s) => !!s);
42915
42933
  const canPlay = filledSlots.length > 0 && playState === "idle";
42916
42934
  const handlePlay = useCallback(() => {
42917
42935
  if (!canPlay) return;
42918
- setSlotFeedback(Array.from({ length: entity.maxSlots }, () => null));
42936
+ setSlotFeedback(Array.from({ length: resolved?.maxSlots ?? 0 }, () => null));
42919
42937
  emit("UI:PLAY_SOUND", { key: "confirm" });
42920
42938
  const sequence = slots.map((s) => s?.id || "");
42921
42939
  if (playEvent) {
@@ -42926,10 +42944,10 @@ function SequencerBoard({
42926
42944
  let step = 0;
42927
42945
  const advance = () => {
42928
42946
  step++;
42929
- if (step >= entity.maxSlots) {
42947
+ if (step >= (resolved?.maxSlots ?? 0)) {
42930
42948
  const playerSeq = slots.map((s) => s?.id);
42931
42949
  const playerIds = slots.filter(Boolean).map((s) => s?.id || "");
42932
- const success = entity.solutions.some(
42950
+ const success = (resolved?.solutions ?? []).some(
42933
42951
  (sol) => sol.length === playerIds.length && sol.every((id, i) => id === playerIds[i])
42934
42952
  );
42935
42953
  if (success) {
@@ -42941,7 +42959,7 @@ function SequencerBoard({
42941
42959
  }
42942
42960
  } else {
42943
42961
  setAttempts((prev) => prev + 1);
42944
- const feedback = computeSlotFeedback(playerSeq, entity.solutions);
42962
+ const feedback = computeSlotFeedback(playerSeq, resolved?.solutions ?? []);
42945
42963
  setSlotFeedback(feedback);
42946
42964
  setPlayState("idle");
42947
42965
  setCurrentStep(-1);
@@ -42959,10 +42977,10 @@ function SequencerBoard({
42959
42977
  }
42960
42978
  };
42961
42979
  timerRef.current = setTimeout(advance, stepDurationMs);
42962
- }, [canPlay, slots, entity.maxSlots, entity.solutions, stepDurationMs, playEvent, completeEvent, emit]);
42980
+ }, [canPlay, slots, resolved?.maxSlots, resolved?.solutions, stepDurationMs, playEvent, completeEvent, emit]);
42963
42981
  const machine = {
42964
- name: entity.title,
42965
- description: entity.description,
42982
+ name: resolved?.title ?? "",
42983
+ description: resolved?.description ?? "",
42966
42984
  states: slots.map((s, i) => stepLabel(s, i)),
42967
42985
  currentState: currentStep >= 0 ? stepLabel(slots[currentStep], currentStep) : "__idle__",
42968
42986
  transitions: slots.slice(0, -1).map((s, i) => ({
@@ -42971,36 +42989,37 @@ function SequencerBoard({
42971
42989
  event: "NEXT"
42972
42990
  }))
42973
42991
  };
42974
- const usedIds = entity.allowDuplicates === false ? slots.filter(Boolean).map((s) => s?.id || "") : [];
42975
- const showHint = attempts >= 3 && !!entity.hint;
42992
+ const usedIds = resolved?.allowDuplicates === false ? slots.filter(Boolean).map((s) => s?.id || "") : [];
42993
+ const showHint = attempts >= 3 && !!resolved?.hint;
42976
42994
  const hasFeedback = slotFeedback.some((f3) => f3 !== null);
42977
42995
  const correctCount = slotFeedback.filter((f3) => f3 === "correct").length;
42978
42996
  const encourageKey = ENCOURAGEMENT_KEYS2[Math.min(attempts - 1, ENCOURAGEMENT_KEYS2.length - 1)] ?? ENCOURAGEMENT_KEYS2[0];
42997
+ if (!resolved) return null;
42979
42998
  return /* @__PURE__ */ jsxs(
42980
42999
  VStack,
42981
43000
  {
42982
43001
  className: cn("p-4 gap-6", className),
42983
43002
  style: {
42984
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
43003
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
42985
43004
  backgroundSize: "cover",
42986
43005
  backgroundPosition: "center"
42987
43006
  },
42988
43007
  children: [
42989
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
43008
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
42990
43009
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
42991
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
42992
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description })
43010
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
43011
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description })
42993
43012
  ] }),
42994
43013
  showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
42995
43014
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
42996
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
43015
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
42997
43016
  ] }) }),
42998
43017
  filledSlots.length > 0 && /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "linear", size: "md" }),
42999
43018
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
43000
43019
  /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
43001
43020
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("sequencer.yourSequence") + ":" }),
43002
43021
  hasFeedback && playState === "idle" && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
43003
- `${correctCount}/${entity.maxSlots} `,
43022
+ `${correctCount}/${resolved.maxSlots} `,
43004
43023
  "\u2705"
43005
43024
  ] })
43006
43025
  ] }),
@@ -43008,7 +43027,7 @@ function SequencerBoard({
43008
43027
  SequenceBar,
43009
43028
  {
43010
43029
  slots,
43011
- maxSlots: entity.maxSlots,
43030
+ maxSlots: resolved.maxSlots,
43012
43031
  onSlotDrop: handleSlotDrop,
43013
43032
  onSlotRemove: handleSlotRemove,
43014
43033
  playing: playState === "playing",
@@ -43022,15 +43041,15 @@ function SequencerBoard({
43022
43041
  playState !== "playing" && /* @__PURE__ */ jsx(
43023
43042
  ActionPalette,
43024
43043
  {
43025
- actions: entity.availableActions,
43044
+ actions: resolved.availableActions,
43026
43045
  usedActionIds: usedIds,
43027
- allowDuplicates: entity.allowDuplicates !== false,
43046
+ allowDuplicates: resolved.allowDuplicates !== false,
43028
43047
  categoryColors,
43029
43048
  label: t("sequencer.dragActions")
43030
43049
  }
43031
43050
  ),
43032
43051
  hasFeedback && playState === "idle" && attempts > 0 && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: t(encourageKey) }) }),
43033
- 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: entity.successMessage || t("sequencer.levelComplete") }) }),
43052
+ 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: resolved.successMessage || t("sequencer.levelComplete") }) }),
43034
43053
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
43035
43054
  /* @__PURE__ */ jsx(
43036
43055
  Button,
@@ -43853,7 +43872,8 @@ function SimulatorBoard({
43853
43872
  }) {
43854
43873
  const { emit } = useEventBus();
43855
43874
  const { t } = useTranslate();
43856
- const parameters = entity?.parameters ?? [];
43875
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
43876
+ const parameters = resolved?.parameters ?? [];
43857
43877
  const [values, setValues] = useState(() => {
43858
43878
  const init = {};
43859
43879
  for (const p2 of parameters) {
@@ -43867,15 +43887,15 @@ function SimulatorBoard({
43867
43887
  const [showHint, setShowHint] = useState(false);
43868
43888
  const computeOutput = useCallback((params) => {
43869
43889
  try {
43870
- const fn = new Function("params", `return (${entity.computeExpression})`);
43890
+ const fn = new Function("params", `return (${resolved?.computeExpression})`);
43871
43891
  return fn(params);
43872
43892
  } catch {
43873
43893
  return 0;
43874
43894
  }
43875
- }, [entity.computeExpression]);
43895
+ }, [resolved?.computeExpression]);
43876
43896
  const output = useMemo(() => computeOutput(values) ?? 0, [computeOutput, values]);
43877
- const targetValue = entity?.targetValue ?? 0;
43878
- const targetTolerance = entity?.targetTolerance ?? 0;
43897
+ const targetValue = resolved?.targetValue ?? 0;
43898
+ const targetTolerance = resolved?.targetTolerance ?? 0;
43879
43899
  const isCorrect = Math.abs(output - targetValue) <= targetTolerance;
43880
43900
  const handleParameterChange = (id, value) => {
43881
43901
  if (submitted) return;
@@ -43890,7 +43910,7 @@ function SimulatorBoard({
43890
43910
  };
43891
43911
  const handleReset = () => {
43892
43912
  setSubmitted(false);
43893
- if (attempts >= 2 && entity.hint) {
43913
+ if (attempts >= 2 && resolved?.hint) {
43894
43914
  setShowHint(true);
43895
43915
  }
43896
43916
  };
@@ -43904,20 +43924,21 @@ function SimulatorBoard({
43904
43924
  setAttempts(0);
43905
43925
  setShowHint(false);
43906
43926
  };
43927
+ if (!resolved) return null;
43907
43928
  return /* @__PURE__ */ jsx(
43908
43929
  Box,
43909
43930
  {
43910
43931
  className,
43911
43932
  style: {
43912
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
43933
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
43913
43934
  backgroundSize: "cover",
43914
43935
  backgroundPosition: "center"
43915
43936
  },
43916
43937
  children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
43917
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
43938
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
43918
43939
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
43919
- /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: entity.title }),
43920
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.description })
43940
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: resolved.title }),
43941
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.description })
43921
43942
  ] }) }),
43922
43943
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
43923
43944
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("simulator.parameters") }),
@@ -43958,28 +43979,28 @@ function SimulatorBoard({
43958
43979
  ] }, param.id))
43959
43980
  ] }) }),
43960
43981
  /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
43961
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: entity.outputLabel }),
43982
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: resolved.outputLabel }),
43962
43983
  /* @__PURE__ */ jsxs(Typography, { variant: "h3", weight: "bold", children: [
43963
43984
  output.toFixed(2),
43964
43985
  " ",
43965
- entity.outputUnit
43986
+ resolved.outputUnit
43966
43987
  ] }),
43967
43988
  submitted && /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
43968
43989
  /* @__PURE__ */ jsx(Icon, { icon: isCorrect ? CheckCircle : XCircle, size: "sm", className: isCorrect ? "text-success" : "text-error" }),
43969
- /* @__PURE__ */ jsx(Typography, { variant: "body", className: isCorrect ? "text-success" : "text-error", children: isCorrect ? entity.successMessage ?? t("simulator.correct") : entity.failMessage ?? t("simulator.incorrect") })
43990
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: isCorrect ? "text-success" : "text-error", children: isCorrect ? resolved.successMessage ?? t("simulator.correct") : resolved.failMessage ?? t("simulator.incorrect") })
43970
43991
  ] }),
43971
43992
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
43972
43993
  t("simulator.target"),
43973
43994
  ": ",
43974
43995
  targetValue,
43975
43996
  " ",
43976
- entity?.outputUnit ?? "",
43997
+ resolved.outputUnit,
43977
43998
  " (\xB1",
43978
43999
  targetTolerance,
43979
44000
  ")"
43980
44001
  ] })
43981
44002
  ] }) }),
43982
- showHint && entity.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: entity.hint }) }),
44003
+ showHint && resolved.hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: resolved.hint }) }),
43983
44004
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
43984
44005
  !submitted ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, children: [
43985
44006
  /* @__PURE__ */ jsx(Icon, { icon: Play, size: "sm" }),
@@ -44670,13 +44691,14 @@ function StateArchitectBoard({
44670
44691
  }) {
44671
44692
  const { emit } = useEventBus();
44672
44693
  const { t } = useTranslate();
44673
- const [transitions, setTransitions] = useState(entity.transitions);
44694
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
44695
+ const [transitions, setTransitions] = useState(resolved?.transitions ?? []);
44674
44696
  const [headerError, setHeaderError] = useState(false);
44675
44697
  const [playState, setPlayState] = useState("editing");
44676
- const [currentState, setCurrentState] = useState(entity.initialState);
44698
+ const [currentState, setCurrentState] = useState(resolved?.initialState ?? "");
44677
44699
  const [selectedState, setSelectedState] = useState(null);
44678
44700
  const [testResults, setTestResults] = useState([]);
44679
- const [variables, setVariables] = useState(entity.variables);
44701
+ const [variables, setVariables] = useState(resolved?.variables ?? []);
44680
44702
  const [attempts, setAttempts] = useState(0);
44681
44703
  const timerRef = useRef(null);
44682
44704
  const [addingFrom, setAddingFrom] = useState(null);
@@ -44685,12 +44707,12 @@ function StateArchitectBoard({
44685
44707
  }, []);
44686
44708
  const GRAPH_W = 500;
44687
44709
  const GRAPH_H = 400;
44688
- const positions = useMemo(() => layoutStates(entity.states, GRAPH_W, GRAPH_H), [entity.states]);
44710
+ const positions = useMemo(() => layoutStates(resolved?.states ?? [], GRAPH_W, GRAPH_H), [resolved?.states]);
44689
44711
  const handleStateClick = useCallback((state) => {
44690
44712
  if (playState !== "editing") return;
44691
44713
  if (addingFrom) {
44692
44714
  if (addingFrom !== state) {
44693
- const event = entity.availableEvents[0] || "EVENT";
44715
+ const event = resolved?.availableEvents[0] || "EVENT";
44694
44716
  const newTrans = {
44695
44717
  id: `t-${nextTransId++}`,
44696
44718
  from: addingFrom,
@@ -44703,7 +44725,7 @@ function StateArchitectBoard({
44703
44725
  } else {
44704
44726
  setSelectedState(state);
44705
44727
  }
44706
- }, [playState, addingFrom, entity.availableEvents]);
44728
+ }, [playState, addingFrom, resolved?.availableEvents]);
44707
44729
  const handleStartAddTransition = useCallback(() => {
44708
44730
  if (!selectedState) return;
44709
44731
  setAddingFrom(selectedState);
@@ -44712,9 +44734,9 @@ function StateArchitectBoard({
44712
44734
  setTransitions((prev) => prev.filter((t2) => t2.id !== transId));
44713
44735
  }, []);
44714
44736
  const machine = useMemo(() => ({
44715
- name: entity.entityName,
44716
- description: entity.description,
44717
- states: entity.states,
44737
+ name: resolved?.entityName ?? "",
44738
+ description: resolved?.description ?? "",
44739
+ states: resolved?.states ?? [],
44718
44740
  currentState,
44719
44741
  transitions: transitions.map((t2) => ({
44720
44742
  from: t2.from,
@@ -44722,7 +44744,7 @@ function StateArchitectBoard({
44722
44744
  event: t2.event,
44723
44745
  guardHint: t2.guardHint
44724
44746
  }))
44725
- }), [entity, currentState, transitions]);
44747
+ }), [resolved, currentState, transitions]);
44726
44748
  const handleTest = useCallback(() => {
44727
44749
  if (playState !== "editing") return;
44728
44750
  if (testEvent) emit(`UI:${testEvent}`, {});
@@ -44731,7 +44753,7 @@ function StateArchitectBoard({
44731
44753
  const results = [];
44732
44754
  let testIdx = 0;
44733
44755
  const runNextTest = () => {
44734
- if (testIdx >= entity.testCases.length) {
44756
+ if (testIdx >= (resolved?.testCases.length ?? 0)) {
44735
44757
  const allPassed = results.every((r) => r.passed);
44736
44758
  setPlayState(allPassed ? "success" : "fail");
44737
44759
  setTestResults(results);
@@ -44746,8 +44768,9 @@ function StateArchitectBoard({
44746
44768
  }
44747
44769
  return;
44748
44770
  }
44749
- const testCase = entity.testCases[testIdx];
44750
- let state = entity.initialState;
44771
+ const testCase = resolved?.testCases[testIdx];
44772
+ if (!testCase) return;
44773
+ let state = resolved.initialState;
44751
44774
  for (const event of testCase.events) {
44752
44775
  const trans = transitions.find((t2) => t2.from === state && t2.event === event);
44753
44776
  if (trans) {
@@ -44765,52 +44788,53 @@ function StateArchitectBoard({
44765
44788
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
44766
44789
  };
44767
44790
  timerRef.current = setTimeout(runNextTest, stepDurationMs);
44768
- }, [playState, transitions, entity, stepDurationMs, testEvent, completeEvent, emit]);
44791
+ }, [playState, transitions, resolved, stepDurationMs, testEvent, completeEvent, emit]);
44769
44792
  const handleTryAgain = useCallback(() => {
44770
44793
  if (timerRef.current) clearTimeout(timerRef.current);
44771
44794
  setPlayState("editing");
44772
- setCurrentState(entity.initialState);
44795
+ setCurrentState(resolved?.initialState ?? "");
44773
44796
  setTestResults([]);
44774
- }, [entity.initialState]);
44797
+ }, [resolved?.initialState]);
44775
44798
  const handleReset = useCallback(() => {
44776
44799
  if (timerRef.current) clearTimeout(timerRef.current);
44777
- setTransitions(entity.transitions);
44800
+ setTransitions(resolved?.transitions ?? []);
44778
44801
  setPlayState("editing");
44779
- setCurrentState(entity.initialState);
44802
+ setCurrentState(resolved?.initialState ?? "");
44780
44803
  setTestResults([]);
44781
- setVariables(entity.variables);
44804
+ setVariables(resolved?.variables ?? []);
44782
44805
  setSelectedState(null);
44783
44806
  setAddingFrom(null);
44784
44807
  setAttempts(0);
44785
- }, [entity]);
44808
+ }, [resolved]);
44786
44809
  const codeData = useMemo(() => ({
44787
- name: entity.entityName,
44788
- states: entity.states,
44789
- initialState: entity.initialState,
44810
+ name: resolved?.entityName ?? "",
44811
+ states: resolved?.states ?? [],
44812
+ initialState: resolved?.initialState ?? "",
44790
44813
  transitions: transitions.map((t2) => ({
44791
44814
  from: t2.from,
44792
44815
  to: t2.to,
44793
44816
  event: t2.event,
44794
44817
  ...t2.guardHint ? { guard: t2.guardHint } : {}
44795
44818
  }))
44796
- }), [entity, transitions]);
44819
+ }), [resolved, transitions]);
44820
+ if (!resolved) return null;
44797
44821
  return /* @__PURE__ */ jsxs(
44798
44822
  VStack,
44799
44823
  {
44800
44824
  className: cn("p-4 gap-6", className),
44801
44825
  style: {
44802
- backgroundImage: entity.theme?.background ? `url(${entity.theme.background})` : void 0,
44826
+ backgroundImage: resolved.theme?.background ? `url(${resolved.theme.background})` : void 0,
44803
44827
  backgroundSize: "cover",
44804
44828
  backgroundPosition: "center"
44805
44829
  },
44806
44830
  children: [
44807
- entity.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: entity.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : entity.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
44831
+ resolved.headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: resolved.headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : resolved.headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
44808
44832
  /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
44809
- /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: entity.title }),
44810
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: entity.description }),
44833
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: resolved.title }),
44834
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: resolved.description }),
44811
44835
  /* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-warning/10 border border-warning/30", gap: "xs", children: [
44812
44836
  /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-warning font-bold", children: t("game.hint") + ":" }),
44813
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: entity.hint })
44837
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: resolved.hint })
44814
44838
  ] })
44815
44839
  ] }),
44816
44840
  /* @__PURE__ */ jsxs(HStack, { className: "flex-wrap items-start", gap: "lg", children: [
@@ -44858,14 +44882,14 @@ function StateArchitectBoard({
44858
44882
  ]
44859
44883
  }
44860
44884
  ),
44861
- entity.states.map((state) => /* @__PURE__ */ jsx(
44885
+ resolved.states.map((state) => /* @__PURE__ */ jsx(
44862
44886
  StateNode2,
44863
44887
  {
44864
44888
  name: state,
44865
44889
  position: positions[state],
44866
44890
  isCurrent: state === currentState,
44867
44891
  isSelected: state === selectedState,
44868
- isInitial: state === entity.initialState,
44892
+ isInitial: state === resolved.initialState,
44869
44893
  onClick: () => handleStateClick(state)
44870
44894
  },
44871
44895
  state
@@ -44912,7 +44936,7 @@ function StateArchitectBoard({
44912
44936
  /* @__PURE__ */ jsx(
44913
44937
  VariablePanel,
44914
44938
  {
44915
- entityName: entity.entityName,
44939
+ entityName: resolved.entityName,
44916
44940
  variables
44917
44941
  }
44918
44942
  ),
@@ -44924,15 +44948,15 @@ function StateArchitectBoard({
44924
44948
  !r.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r.actualState }) })
44925
44949
  ] }, i))
44926
44950
  ] }),
44927
- entity.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
44951
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
44928
44952
  ] })
44929
44953
  ] }),
44930
- 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: entity.successMessage || t("stateArchitect.allPassed") }) }),
44954
+ 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: resolved.successMessage || t("stateArchitect.allPassed") }) }),
44931
44955
  playState === "fail" && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
44932
44956
  /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(ENCOURAGEMENT_KEYS3[Math.min(attempts - 1, ENCOURAGEMENT_KEYS3.length - 1)] ?? ENCOURAGEMENT_KEYS3[0]) }) }),
44933
- attempts >= 3 && entity.hint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
44957
+ attempts >= 3 && resolved.hint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
44934
44958
  /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
44935
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: entity.hint })
44959
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: resolved.hint })
44936
44960
  ] }) })
44937
44961
  ] }),
44938
44962
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
@@ -45909,8 +45933,9 @@ var init_useBattleState = __esm({
45909
45933
  }
45910
45934
  });
45911
45935
  function UncontrolledBattleBoard({ entity, ...rest }) {
45936
+ const resolved = Array.isArray(entity) ? entity[0] : entity;
45912
45937
  const battleState = useBattleState(
45913
- entity.initialUnits,
45938
+ resolved?.initialUnits ?? [],
45914
45939
  {
45915
45940
  tileClickEvent: rest.tileClickEvent,
45916
45941
  unitClickEvent: rest.unitClickEvent,
@@ -45927,12 +45952,13 @@ function UncontrolledBattleBoard({ entity, ...rest }) {
45927
45952
  calculateDamage: rest.calculateDamage
45928
45953
  }
45929
45954
  );
45955
+ if (!resolved) return null;
45930
45956
  return /* @__PURE__ */ jsx(
45931
45957
  BattleBoard,
45932
45958
  {
45933
45959
  ...rest,
45934
45960
  entity: {
45935
- ...entity,
45961
+ ...resolved,
45936
45962
  units: battleState.units,
45937
45963
  phase: battleState.phase,
45938
45964
  turn: battleState.turn,
@@ -46703,6 +46729,7 @@ var init_component_registry_generated = __esm({
46703
46729
  init_StatsOrganism();
46704
46730
  init_StatusDot();
46705
46731
  init_StatusEffect();
46732
+ init_StepFlow();
46706
46733
  init_StepFlowOrganism();
46707
46734
  init_SvgBranch();
46708
46735
  init_SvgConnection();
@@ -47021,6 +47048,7 @@ var init_component_registry_generated = __esm({
47021
47048
  "StatsOrganism": StatsOrganism,
47022
47049
  "StatusDot": StatusDot,
47023
47050
  "StatusEffect": StatusEffect,
47051
+ "StepFlow": StepFlow,
47024
47052
  "StepFlowOrganism": StepFlowOrganism,
47025
47053
  "SvgBranch": SvgBranch,
47026
47054
  "SvgConnection": SvgConnection,
@@ -47746,6 +47774,16 @@ function SlotContentRenderer({
47746
47774
  );
47747
47775
  }
47748
47776
  }
47777
+ if (propsSchema) {
47778
+ for (const [propKey, propDef] of Object.entries(propsSchema)) {
47779
+ const v = renderedProps[propKey];
47780
+ if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
47781
+ (t) => t === "date" || t === "datetime" || t === "timestamp"
47782
+ )) {
47783
+ renderedProps[propKey] = new Date(v);
47784
+ }
47785
+ }
47786
+ }
47749
47787
  const finalProps = renderedProps;
47750
47788
  const resolvedItems = Array.isArray(
47751
47789
  finalProps.entity