@almadar/ui 5.70.0 → 5.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/avl/index.cjs +1953 -1802
  2. package/dist/avl/index.d.cts +93 -56
  3. package/dist/avl/index.js +677 -526
  4. package/dist/components/avl/molecules/AvlEventWireEdge.d.ts +2 -1
  5. package/dist/components/avl/molecules/AvlTransitionEdge.d.ts +2 -1
  6. package/dist/components/avl/molecules/avl-behavior-compose-converter.d.ts +7 -5
  7. package/dist/components/avl/molecules/avl-behavior-compose-types.d.ts +41 -21
  8. package/dist/components/avl/molecules/avl-canvas-types.d.ts +10 -7
  9. package/dist/components/avl/molecules/avl-preview-converter.d.ts +5 -5
  10. package/dist/components/avl/molecules/avl-preview-types.d.ts +15 -4
  11. package/dist/components/avl/organisms/FlowCanvas.d.ts +2 -2
  12. package/dist/components/avl/organisms/avl-schema-parser.d.ts +18 -16
  13. package/dist/components/core/atoms/Button.d.ts +2 -0
  14. package/dist/components/core/atoms/ConditionalWrapper.d.ts +5 -4
  15. package/dist/components/core/molecules/Carousel.d.ts +2 -2
  16. package/dist/components/core/molecules/OrbitalVisualization.d.ts +4 -3
  17. package/dist/components/core/molecules/PageHeader.d.ts +3 -3
  18. package/dist/components/core/molecules/RepeatableFormSection.d.ts +4 -3
  19. package/dist/components/core/molecules/ViolationAlert.d.ts +2 -0
  20. package/dist/components/core/molecules/WizardContainer.d.ts +23 -22
  21. package/dist/components/core/organisms/CardGrid.d.ts +2 -2
  22. package/dist/components/core/organisms/CustomPattern.d.ts +3 -4
  23. package/dist/components/core/organisms/DataTable.d.ts +2 -2
  24. package/dist/components/core/organisms/DetailPanel.d.ts +1 -1
  25. package/dist/components/core/organisms/Form.d.ts +11 -11
  26. package/dist/components/core/organisms/List.d.ts +3 -5
  27. package/dist/components/core/organisms/StatCard.d.ts +2 -2
  28. package/dist/components/core/organisms/book/types.d.ts +1 -1
  29. package/dist/components/core/organisms/debug/RuntimeDebugger.d.ts +2 -1
  30. package/dist/components/core/organisms/debug/tabs/EventDispatcherTab.d.ts +2 -1
  31. package/dist/components/core/organisms/layout/DashboardGrid.d.ts +0 -2
  32. package/dist/components/core/organisms/types.d.ts +3 -2
  33. package/dist/components/game/atoms/ScoreDisplay.d.ts +3 -1
  34. package/dist/components/game/molecules/three/hooks/useSceneGraph.d.ts +2 -1
  35. package/dist/components/game/molecules/three/index.cjs +37 -24
  36. package/dist/components/game/molecules/three/index.js +37 -24
  37. package/dist/components/game/organisms/PinballBoard.d.ts +4 -4
  38. package/dist/components/game/organisms/boardEntity.d.ts +6 -6
  39. package/dist/components/game/organisms/puzzles/debugger/DebuggerBoard.d.ts +16 -2
  40. package/dist/components/game/organisms/puzzles/event-handler/puzzleObject.d.ts +21 -10
  41. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +2 -1
  42. package/dist/components/index.cjs +1690 -1562
  43. package/dist/components/index.js +569 -441
  44. package/dist/docs/index.cjs +107 -104
  45. package/dist/docs/index.d.cts +2 -0
  46. package/dist/docs/index.js +38 -35
  47. package/dist/lib/getNestedValue.d.ts +2 -13
  48. package/dist/marketing/index.cjs +97 -98
  49. package/dist/marketing/index.d.cts +2 -0
  50. package/dist/marketing/index.js +54 -55
  51. package/dist/providers/index.cjs +1663 -1535
  52. package/dist/providers/index.js +554 -426
  53. package/dist/runtime/index.cjs +1721 -1593
  54. package/dist/runtime/index.js +560 -432
  55. package/package.json +1 -1
package/dist/avl/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React94 from 'react';
3
- import React94__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
2
+ import * as React98 from 'react';
3
+ import React98__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
4
4
  import { OrbitalProvider, EventBusContext, useTraitScope, VerificationProvider, TraitScopeProvider } from '@almadar/ui/providers';
5
5
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
@@ -3181,9 +3181,8 @@ var init_Typography = __esm({
3181
3181
  }) => {
3182
3182
  const variant = variantProp ?? (level ? `h${level}` : "body1");
3183
3183
  const Component2 = as || defaultElements[variant];
3184
- const Comp = Component2;
3185
- return /* @__PURE__ */ jsx(
3186
- Comp,
3184
+ return React98__default.createElement(
3185
+ Component2,
3187
3186
  {
3188
3187
  id,
3189
3188
  className: cn(
@@ -3196,9 +3195,9 @@ var init_Typography = __esm({
3196
3195
  overflow && overflowStyles[overflow],
3197
3196
  className
3198
3197
  ),
3199
- style,
3200
- children: children ?? content
3201
- }
3198
+ style
3199
+ },
3200
+ children ?? content
3202
3201
  );
3203
3202
  };
3204
3203
  Typography.displayName = "Typography";
@@ -3519,7 +3518,7 @@ var init_Box = __esm({
3519
3518
  fixed: "fixed",
3520
3519
  sticky: "sticky"
3521
3520
  };
3522
- Box = React94__default.forwardRef(
3521
+ Box = React98__default.forwardRef(
3523
3522
  ({
3524
3523
  padding,
3525
3524
  paddingX,
@@ -3584,7 +3583,7 @@ var init_Box = __esm({
3584
3583
  onPointerDown?.(e);
3585
3584
  }, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
3586
3585
  const isClickable = action || onClick;
3587
- return React94__default.createElement(
3586
+ return React98__default.createElement(
3588
3587
  Component2,
3589
3588
  {
3590
3589
  ref,
@@ -3680,9 +3679,8 @@ var init_Stack = __esm({
3680
3679
  };
3681
3680
  const isHorizontal = direction === "horizontal";
3682
3681
  const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
3683
- const Comp = Component2;
3684
- return /* @__PURE__ */ jsx(
3685
- Comp,
3682
+ return React98__default.createElement(
3683
+ Component2,
3686
3684
  {
3687
3685
  className: cn(
3688
3686
  "flex",
@@ -3698,9 +3696,9 @@ var init_Stack = __esm({
3698
3696
  onClick: action || onClick ? handleClick : void 0,
3699
3697
  onKeyDown,
3700
3698
  role,
3701
- tabIndex,
3702
- children
3703
- }
3699
+ tabIndex
3700
+ },
3701
+ children
3704
3702
  );
3705
3703
  };
3706
3704
  VStack = (props) => /* @__PURE__ */ jsx(Stack, { direction: "vertical", ...props });
@@ -4078,9 +4076,9 @@ async function computeTraitLayout(data) {
4078
4076
  y: n.y ?? 0,
4079
4077
  width: n.width ?? 110,
4080
4078
  height: n.height ?? STATE_H,
4081
- isInitial: stateInfo?.isInitial,
4082
- isTerminal: stateInfo?.isTerminal,
4083
- role: getStateRole(name, stateInfo?.isInitial, stateInfo?.isTerminal, tc, maxTC),
4079
+ isInitial: stateInfo?.isInitial ?? void 0,
4080
+ isTerminal: stateInfo?.isTerminal ?? void 0,
4081
+ role: getStateRole(name, stateInfo?.isInitial ?? void 0, stateInfo?.isTerminal ?? void 0, tc, maxTC),
4084
4082
  transitionCount: tc
4085
4083
  };
4086
4084
  });
@@ -4091,12 +4089,10 @@ async function computeTraitLayout(data) {
4091
4089
  const sections = e.sections ?? [];
4092
4090
  const points = [];
4093
4091
  for (const section of sections) {
4094
- const startPoint = section.startPoint;
4095
- const endPoint = section.endPoint;
4096
4092
  const bendPoints = section.bendPoints ?? [];
4097
- points.push({ x: startPoint.x, y: startPoint.y });
4093
+ points.push({ x: section.startPoint.x, y: section.startPoint.y });
4098
4094
  for (const bp of bendPoints) points.push({ x: bp.x, y: bp.y });
4099
- points.push({ x: endPoint.x, y: endPoint.y });
4095
+ points.push({ x: section.endPoint.x, y: section.endPoint.y });
4100
4096
  }
4101
4097
  const isSelf = t.from === t.to;
4102
4098
  const isBackward = !isSelf && (nodeXMap[t.to] ?? 0) <= (nodeXMap[t.from] ?? 0);
@@ -4174,8 +4170,8 @@ var init_MiniStateMachine = __esm({
4174
4170
  states.map((s, i) => {
4175
4171
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4176
4172
  const tc = transitionCounts[s.name] ?? 0;
4177
- const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
4178
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
4173
+ const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
4174
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
4179
4175
  /* @__PURE__ */ jsx(
4180
4176
  AvlState,
4181
4177
  {
@@ -4185,8 +4181,8 @@ var init_MiniStateMachine = __esm({
4185
4181
  height: NODE_H,
4186
4182
  name: "",
4187
4183
  role,
4188
- isInitial: s.isInitial,
4189
- isTerminal: s.isTerminal
4184
+ isInitial: s.isInitial ?? void 0,
4185
+ isTerminal: s.isTerminal ?? void 0
4190
4186
  }
4191
4187
  ),
4192
4188
  i < states.length - 1 && /* @__PURE__ */ jsxs("g", { children: [
@@ -4550,7 +4546,7 @@ function loadLib(key, importer) {
4550
4546
  return p2;
4551
4547
  }
4552
4548
  function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4553
- const Lazy = React94__default.lazy(async () => {
4549
+ const Lazy = React98__default.lazy(async () => {
4554
4550
  const lib = await loadLib(libKey, importer);
4555
4551
  const Comp = pick(lib);
4556
4552
  if (!Comp) {
@@ -4560,7 +4556,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4560
4556
  return { default: Comp };
4561
4557
  });
4562
4558
  const Wrapped = (props) => /* @__PURE__ */ jsx(
4563
- React94__default.Suspense,
4559
+ React98__default.Suspense,
4564
4560
  {
4565
4561
  fallback: /* @__PURE__ */ jsx(
4566
4562
  "span",
@@ -5228,9 +5224,10 @@ function resolveIcon(name) {
5228
5224
  function doResolve(name) {
5229
5225
  if (iconAliases[name]) return iconAliases[name];
5230
5226
  const pascalName = kebabToPascal2(name);
5231
- const directLookup = LucideIcons2[pascalName];
5227
+ const lucideMap = LucideIcons2;
5228
+ const directLookup = lucideMap[pascalName];
5232
5229
  if (directLookup && typeof directLookup === "object") return directLookup;
5233
- const asIs = LucideIcons2[name];
5230
+ const asIs = lucideMap[name];
5234
5231
  if (asIs && typeof asIs === "object") return asIs;
5235
5232
  return LucideIcons2.HelpCircle;
5236
5233
  }
@@ -5286,7 +5283,7 @@ var init_Icon = __esm({
5286
5283
  const directIcon = typeof icon === "string" ? void 0 : icon;
5287
5284
  const effectiveName = typeof icon === "string" ? icon : name;
5288
5285
  const family = useIconFamily();
5289
- const RenderedComponent = React94__default.useMemo(() => {
5286
+ const RenderedComponent = React98__default.useMemo(() => {
5290
5287
  if (directIcon) return null;
5291
5288
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
5292
5289
  }, [directIcon, effectiveName, family]);
@@ -5336,6 +5333,9 @@ var init_Icon = __esm({
5336
5333
  Icon.displayName = "Icon";
5337
5334
  }
5338
5335
  });
5336
+ function isIconLike(v) {
5337
+ return typeof v.render === "function";
5338
+ }
5339
5339
  function resolveIconProp(value, sizeClass) {
5340
5340
  if (!value) return null;
5341
5341
  if (typeof value === "string") {
@@ -5345,10 +5345,10 @@ function resolveIconProp(value, sizeClass) {
5345
5345
  const IconComp = value;
5346
5346
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5347
5347
  }
5348
- if (React94__default.isValidElement(value)) {
5348
+ if (React98__default.isValidElement(value)) {
5349
5349
  return value;
5350
5350
  }
5351
- if (typeof value === "object" && value !== null && "render" in value) {
5351
+ if (typeof value === "object" && value !== null && isIconLike(value)) {
5352
5352
  const IconComp = value;
5353
5353
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5354
5354
  }
@@ -5421,7 +5421,7 @@ var init_Button = __esm({
5421
5421
  md: "h-icon-default w-icon-default",
5422
5422
  lg: "h-icon-default w-icon-default"
5423
5423
  };
5424
- Button = React94__default.forwardRef(
5424
+ Button = React98__default.forwardRef(
5425
5425
  ({
5426
5426
  className,
5427
5427
  variant = "primary",
@@ -5437,6 +5437,7 @@ var init_Button = __esm({
5437
5437
  label,
5438
5438
  children,
5439
5439
  onClick,
5440
+ "data-testid": dataTestId,
5440
5441
  ...props
5441
5442
  }, ref) => {
5442
5443
  const eventBus = useEventBus();
@@ -5469,7 +5470,7 @@ var init_Button = __esm({
5469
5470
  ),
5470
5471
  onClick: handleClick,
5471
5472
  ...props,
5472
- "data-testid": props["data-testid"] ?? (action ? `action-${action}` : void 0),
5473
+ "data-testid": dataTestId ?? (action ? `action-${action}` : void 0),
5473
5474
  children: [
5474
5475
  isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-icon-default w-icon-default animate-spin" }) : resolvedLeftIcon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0", children: resolvedLeftIcon }),
5475
5476
  children || label,
@@ -5486,7 +5487,7 @@ var Dialog;
5486
5487
  var init_Dialog = __esm({
5487
5488
  "components/core/atoms/Dialog.tsx"() {
5488
5489
  init_cn();
5489
- Dialog = React94__default.forwardRef(
5490
+ Dialog = React98__default.forwardRef(
5490
5491
  ({
5491
5492
  role = "dialog",
5492
5493
  "aria-modal": ariaModal = true,
@@ -5981,7 +5982,7 @@ var init_Badge = __esm({
5981
5982
  md: "px-2.5 py-1 text-sm",
5982
5983
  lg: "px-3 py-1.5 text-base"
5983
5984
  };
5984
- Badge = React94__default.forwardRef(
5985
+ Badge = React98__default.forwardRef(
5985
5986
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
5986
5987
  const iconSizes3 = {
5987
5988
  sm: "h-icon-default w-icon-default",
@@ -6317,7 +6318,7 @@ var init_SvgFlow = __esm({
6317
6318
  width = 100,
6318
6319
  height = 100
6319
6320
  }) => {
6320
- const markerId = React94__default.useMemo(() => {
6321
+ const markerId = React98__default.useMemo(() => {
6321
6322
  flowIdCounter += 1;
6322
6323
  return `almadar-flow-arrow-${flowIdCounter}`;
6323
6324
  }, []);
@@ -6910,7 +6911,7 @@ var init_SvgRing = __esm({
6910
6911
  width = 100,
6911
6912
  height = 100
6912
6913
  }) => {
6913
- const gradientId = React94__default.useMemo(() => {
6914
+ const gradientId = React98__default.useMemo(() => {
6914
6915
  ringIdCounter += 1;
6915
6916
  return `almadar-ring-glow-${ringIdCounter}`;
6916
6917
  }, []);
@@ -7091,7 +7092,7 @@ var init_Input = __esm({
7091
7092
  init_cn();
7092
7093
  init_Icon();
7093
7094
  init_useEventBus();
7094
- Input = React94__default.forwardRef(
7095
+ Input = React98__default.forwardRef(
7095
7096
  ({
7096
7097
  className,
7097
7098
  inputType,
@@ -7251,7 +7252,7 @@ var Label;
7251
7252
  var init_Label = __esm({
7252
7253
  "components/core/atoms/Label.tsx"() {
7253
7254
  init_cn();
7254
- Label = React94__default.forwardRef(
7255
+ Label = React98__default.forwardRef(
7255
7256
  ({ className, required, children, ...props }, ref) => {
7256
7257
  return /* @__PURE__ */ jsxs(
7257
7258
  "label",
@@ -7278,7 +7279,7 @@ var init_Textarea = __esm({
7278
7279
  "components/core/atoms/Textarea.tsx"() {
7279
7280
  init_cn();
7280
7281
  init_useEventBus();
7281
- Textarea = React94__default.forwardRef(
7282
+ Textarea = React98__default.forwardRef(
7282
7283
  ({ className, error, onChange, ...props }, ref) => {
7283
7284
  const eventBus = useEventBus();
7284
7285
  const handleChange = (e) => {
@@ -7517,7 +7518,7 @@ var init_Select = __esm({
7517
7518
  init_cn();
7518
7519
  init_Icon();
7519
7520
  init_useEventBus();
7520
- Select = React94__default.forwardRef(
7521
+ Select = React98__default.forwardRef(
7521
7522
  (props, _ref) => {
7522
7523
  const { multiple, searchable, clearable } = props;
7523
7524
  if (multiple || searchable || clearable) {
@@ -7534,7 +7535,7 @@ var init_Checkbox = __esm({
7534
7535
  "components/core/atoms/Checkbox.tsx"() {
7535
7536
  init_cn();
7536
7537
  init_useEventBus();
7537
- Checkbox = React94__default.forwardRef(
7538
+ Checkbox = React98__default.forwardRef(
7538
7539
  ({ className, label, id, onChange, ...props }, ref) => {
7539
7540
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7540
7541
  const eventBus = useEventBus();
@@ -7588,7 +7589,7 @@ var init_Spinner = __esm({
7588
7589
  md: "h-6 w-6",
7589
7590
  lg: "h-8 w-8"
7590
7591
  };
7591
- Spinner = React94__default.forwardRef(
7592
+ Spinner = React98__default.forwardRef(
7592
7593
  ({ className, size = "md", overlay, ...props }, ref) => {
7593
7594
  if (overlay) {
7594
7595
  return /* @__PURE__ */ jsx(
@@ -7678,7 +7679,7 @@ var init_Card = __esm({
7678
7679
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7679
7680
  "tile-image-first": "p-0 overflow-hidden"
7680
7681
  };
7681
- Card = React94__default.forwardRef(
7682
+ Card = React98__default.forwardRef(
7682
7683
  ({
7683
7684
  className,
7684
7685
  variant = "bordered",
@@ -7726,9 +7727,9 @@ var init_Card = __esm({
7726
7727
  }
7727
7728
  );
7728
7729
  Card.displayName = "Card";
7729
- CardHeader = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7730
+ CardHeader = React98__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7730
7731
  CardHeader.displayName = "CardHeader";
7731
- CardTitle = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7732
+ CardTitle = React98__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7732
7733
  "h3",
7733
7734
  {
7734
7735
  ref,
@@ -7741,11 +7742,11 @@ var init_Card = __esm({
7741
7742
  }
7742
7743
  ));
7743
7744
  CardTitle.displayName = "CardTitle";
7744
- CardContent = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7745
+ CardContent = React98__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7745
7746
  CardContent.displayName = "CardContent";
7746
7747
  CardBody = CardContent;
7747
7748
  CardBody.displayName = "CardBody";
7748
- CardFooter = React94__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7749
+ CardFooter = React98__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7749
7750
  "div",
7750
7751
  {
7751
7752
  ref,
@@ -7800,7 +7801,7 @@ var init_FilterPill = __esm({
7800
7801
  md: "w-3.5 h-3.5",
7801
7802
  lg: "w-4 h-4"
7802
7803
  };
7803
- FilterPill = React94__default.forwardRef(
7804
+ FilterPill = React98__default.forwardRef(
7804
7805
  ({
7805
7806
  className,
7806
7807
  variant = "default",
@@ -7929,8 +7930,8 @@ var init_Avatar = __esm({
7929
7930
  actionPayload
7930
7931
  }) => {
7931
7932
  const eventBus = useEventBus();
7932
- const [imgFailed, setImgFailed] = React94__default.useState(false);
7933
- React94__default.useEffect(() => {
7933
+ const [imgFailed, setImgFailed] = React98__default.useState(false);
7934
+ React98__default.useEffect(() => {
7934
7935
  setImgFailed(false);
7935
7936
  }, [src]);
7936
7937
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
@@ -8043,22 +8044,18 @@ var init_Center = __esm({
8043
8044
  as: Component2 = "div"
8044
8045
  }) => {
8045
8046
  const mergedStyle = minHeight ? { minHeight, ...style } : style;
8046
- const Comp = Component2;
8047
- return /* @__PURE__ */ jsx(
8048
- Comp,
8049
- {
8050
- className: cn(
8051
- inline ? "inline-flex" : "flex",
8052
- horizontal && "justify-center",
8053
- vertical && "items-center",
8054
- fullHeight && "h-full",
8055
- fullWidth && "w-full",
8056
- className
8057
- ),
8058
- style: mergedStyle,
8059
- children
8060
- }
8061
- );
8047
+ return React98__default.createElement(Component2, {
8048
+ className: cn(
8049
+ inline ? "inline-flex" : "flex",
8050
+ horizontal && "justify-center",
8051
+ vertical && "items-center",
8052
+ fullHeight && "h-full",
8053
+ fullWidth && "w-full",
8054
+ className
8055
+ ),
8056
+ style: mergedStyle,
8057
+ children
8058
+ });
8062
8059
  };
8063
8060
  }
8064
8061
  });
@@ -8315,7 +8312,7 @@ var init_Radio = __esm({
8315
8312
  md: "w-2.5 h-2.5",
8316
8313
  lg: "w-3 h-3"
8317
8314
  };
8318
- Radio = React94__default.forwardRef(
8315
+ Radio = React98__default.forwardRef(
8319
8316
  ({
8320
8317
  label,
8321
8318
  helperText,
@@ -8332,12 +8329,12 @@ var init_Radio = __esm({
8332
8329
  onChange,
8333
8330
  ...props
8334
8331
  }, ref) => {
8335
- const reactId = React94__default.useId();
8332
+ const reactId = React98__default.useId();
8336
8333
  const baseId = id || `radio-${reactId}`;
8337
8334
  const hasError = !!error;
8338
8335
  const eventBus = useEventBus();
8339
- const [selected, setSelected] = React94__default.useState(value);
8340
- React94__default.useEffect(() => {
8336
+ const [selected, setSelected] = React98__default.useState(value);
8337
+ React98__default.useEffect(() => {
8341
8338
  if (value !== void 0) setSelected(value);
8342
8339
  }, [value]);
8343
8340
  const pick = (next, e) => {
@@ -8519,7 +8516,7 @@ var init_Switch = __esm({
8519
8516
  "components/core/atoms/Switch.tsx"() {
8520
8517
  "use client";
8521
8518
  init_cn();
8522
- Switch = React94.forwardRef(
8519
+ Switch = React98.forwardRef(
8523
8520
  ({
8524
8521
  checked,
8525
8522
  defaultChecked = false,
@@ -8530,10 +8527,10 @@ var init_Switch = __esm({
8530
8527
  name,
8531
8528
  className
8532
8529
  }, ref) => {
8533
- const [isChecked, setIsChecked] = React94.useState(
8530
+ const [isChecked, setIsChecked] = React98.useState(
8534
8531
  checked !== void 0 ? checked : defaultChecked
8535
8532
  );
8536
- React94.useEffect(() => {
8533
+ React98.useEffect(() => {
8537
8534
  if (checked !== void 0) {
8538
8535
  setIsChecked(checked);
8539
8536
  }
@@ -8807,7 +8804,7 @@ var Aside;
8807
8804
  var init_Aside = __esm({
8808
8805
  "components/core/atoms/Aside.tsx"() {
8809
8806
  init_cn();
8810
- Aside = React94__default.forwardRef(
8807
+ Aside = React98__default.forwardRef(
8811
8808
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8812
8809
  );
8813
8810
  Aside.displayName = "Aside";
@@ -8886,9 +8883,9 @@ var init_LawReferenceTooltip = __esm({
8886
8883
  className
8887
8884
  }) => {
8888
8885
  const { t } = useTranslate();
8889
- const [isVisible, setIsVisible] = React94__default.useState(false);
8890
- const timeoutRef = React94__default.useRef(null);
8891
- const triggerRef = React94__default.useRef(null);
8886
+ const [isVisible, setIsVisible] = React98__default.useState(false);
8887
+ const timeoutRef = React98__default.useRef(null);
8888
+ const triggerRef = React98__default.useRef(null);
8892
8889
  const handleMouseEnter = () => {
8893
8890
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8894
8891
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8899,7 +8896,7 @@ var init_LawReferenceTooltip = __esm({
8899
8896
  };
8900
8897
  const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
8901
8898
  const open = isVisible || revealed;
8902
- React94__default.useEffect(() => {
8899
+ React98__default.useEffect(() => {
8903
8900
  return () => {
8904
8901
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8905
8902
  };
@@ -9111,7 +9108,7 @@ var init_StatusDot = __esm({
9111
9108
  md: "w-2.5 h-2.5",
9112
9109
  lg: "w-3 h-3"
9113
9110
  };
9114
- StatusDot = React94__default.forwardRef(
9111
+ StatusDot = React98__default.forwardRef(
9115
9112
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
9116
9113
  return /* @__PURE__ */ jsx(
9117
9114
  "span",
@@ -9165,7 +9162,7 @@ var init_TrendIndicator = __esm({
9165
9162
  down: "trending-down",
9166
9163
  flat: "arrow-right"
9167
9164
  };
9168
- TrendIndicator = React94__default.forwardRef(
9165
+ TrendIndicator = React98__default.forwardRef(
9169
9166
  ({
9170
9167
  className,
9171
9168
  value,
@@ -9232,7 +9229,7 @@ var init_RangeSlider = __esm({
9232
9229
  md: "w-4 h-4",
9233
9230
  lg: "w-5 h-5"
9234
9231
  };
9235
- RangeSlider = React94__default.forwardRef(
9232
+ RangeSlider = React98__default.forwardRef(
9236
9233
  ({
9237
9234
  className,
9238
9235
  min = 0,
@@ -9740,7 +9737,7 @@ var init_ContentSection = __esm({
9740
9737
  md: "py-16",
9741
9738
  lg: "py-24"
9742
9739
  };
9743
- ContentSection = React94__default.forwardRef(
9740
+ ContentSection = React98__default.forwardRef(
9744
9741
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9745
9742
  return /* @__PURE__ */ jsx(
9746
9743
  Box,
@@ -10274,7 +10271,7 @@ var init_AnimatedReveal = __esm({
10274
10271
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10275
10272
  "none": {}
10276
10273
  };
10277
- AnimatedReveal = React94__default.forwardRef(
10274
+ AnimatedReveal = React98__default.forwardRef(
10278
10275
  ({
10279
10276
  trigger = "scroll",
10280
10277
  animation = "fade-up",
@@ -10434,7 +10431,7 @@ var init_AnimatedGraphic = __esm({
10434
10431
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10435
10432
  "use client";
10436
10433
  init_cn();
10437
- AnimatedGraphic = React94__default.forwardRef(
10434
+ AnimatedGraphic = React98__default.forwardRef(
10438
10435
  ({
10439
10436
  src,
10440
10437
  svgContent,
@@ -10457,7 +10454,7 @@ var init_AnimatedGraphic = __esm({
10457
10454
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10458
10455
  const resolvedSvg = svgContent ?? fetchedSvg;
10459
10456
  const prevAnimateRef = useRef(animate);
10460
- const setRef = React94__default.useCallback(
10457
+ const setRef = React98__default.useCallback(
10461
10458
  (node) => {
10462
10459
  containerRef.current = node;
10463
10460
  if (typeof ref === "function") ref(node);
@@ -10674,18 +10671,18 @@ var init_HealthBar = __esm({
10674
10671
  function ScoreDisplay({
10675
10672
  assetUrl = DEFAULT_ASSET_URL,
10676
10673
  value,
10674
+ score,
10677
10675
  label,
10678
10676
  icon,
10679
10677
  size = "md",
10680
10678
  className,
10681
10679
  animated = true,
10682
- locale = "en-US",
10683
- ...rest
10680
+ locale = "en-US"
10684
10681
  }) {
10685
- const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
10686
- const [displayValue, setDisplayValue] = React94.useState(resolvedValue);
10687
- const [isAnimating, setIsAnimating] = React94.useState(false);
10688
- React94.useEffect(() => {
10682
+ const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof score === "number" && !Number.isNaN(score) ? score : 0;
10683
+ const [displayValue, setDisplayValue] = React98.useState(resolvedValue);
10684
+ const [isAnimating, setIsAnimating] = React98.useState(false);
10685
+ React98.useEffect(() => {
10689
10686
  if (!animated || displayValue === resolvedValue) {
10690
10687
  setDisplayValue(resolvedValue);
10691
10688
  return;
@@ -10768,9 +10765,9 @@ function ControlButton({
10768
10765
  className
10769
10766
  }) {
10770
10767
  const eventBus = useEventBus();
10771
- const [isPressed, setIsPressed] = React94.useState(false);
10768
+ const [isPressed, setIsPressed] = React98.useState(false);
10772
10769
  const actualPressed = pressed ?? isPressed;
10773
- const handlePointerDown = React94.useCallback(
10770
+ const handlePointerDown = React98.useCallback(
10774
10771
  (e) => {
10775
10772
  e.preventDefault();
10776
10773
  if (disabled) return;
@@ -10780,7 +10777,7 @@ function ControlButton({
10780
10777
  },
10781
10778
  [disabled, pressEvent, eventBus, onPress]
10782
10779
  );
10783
- const handlePointerUp = React94.useCallback(
10780
+ const handlePointerUp = React98.useCallback(
10784
10781
  (e) => {
10785
10782
  e.preventDefault();
10786
10783
  if (disabled) return;
@@ -10790,7 +10787,7 @@ function ControlButton({
10790
10787
  },
10791
10788
  [disabled, releaseEvent, eventBus, onRelease]
10792
10789
  );
10793
- const handlePointerLeave = React94.useCallback(
10790
+ const handlePointerLeave = React98.useCallback(
10794
10791
  (e) => {
10795
10792
  if (isPressed) {
10796
10793
  setIsPressed(false);
@@ -11419,8 +11416,8 @@ function XPBar({
11419
11416
  }) {
11420
11417
  const sizes = sizeMap9[size];
11421
11418
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
11422
- const [fillWidth, setFillWidth] = React94.useState(animated ? 0 : percentage);
11423
- React94.useEffect(() => {
11419
+ const [fillWidth, setFillWidth] = React98.useState(animated ? 0 : percentage);
11420
+ React98.useEffect(() => {
11424
11421
  if (!animated) {
11425
11422
  setFillWidth(percentage);
11426
11423
  return;
@@ -11928,9 +11925,9 @@ function MiniMap({
11928
11925
  viewportRect = DEFAULT_VIEWPORT,
11929
11926
  className
11930
11927
  }) {
11931
- const canvasRef = React94.useRef(null);
11932
- const frameRef = React94.useRef(0);
11933
- React94.useEffect(() => {
11928
+ const canvasRef = React98.useRef(null);
11929
+ const frameRef = React98.useRef(0);
11930
+ React98.useEffect(() => {
11934
11931
  const canvas = canvasRef.current;
11935
11932
  if (!canvas) return;
11936
11933
  const ctx = canvas.getContext("2d");
@@ -12119,7 +12116,7 @@ var init_ErrorBoundary = __esm({
12119
12116
  }
12120
12117
  );
12121
12118
  };
12122
- ErrorBoundary = class extends React94__default.Component {
12119
+ ErrorBoundary = class extends React98__default.Component {
12123
12120
  constructor(props) {
12124
12121
  super(props);
12125
12122
  __publicField(this, "reset", () => {
@@ -12430,9 +12427,8 @@ var init_Container = __esm({
12430
12427
  as: Component2 = "div"
12431
12428
  }) => {
12432
12429
  const resolvedSize = maxWidth ?? size ?? "lg";
12433
- const Comp = Component2;
12434
- return /* @__PURE__ */ jsx(
12435
- Comp,
12430
+ return React98__default.createElement(
12431
+ Component2,
12436
12432
  {
12437
12433
  className: cn(
12438
12434
  "w-full",
@@ -12440,9 +12436,9 @@ var init_Container = __esm({
12440
12436
  paddingStyles3[padding],
12441
12437
  center && "mx-auto",
12442
12438
  className
12443
- ),
12444
- children
12445
- }
12439
+ )
12440
+ },
12441
+ children
12446
12442
  );
12447
12443
  };
12448
12444
  Container.displayName = "Container";
@@ -13154,8 +13150,8 @@ function ActionButtons({
13154
13150
  disabled
13155
13151
  }) {
13156
13152
  const eventBus = useEventBus();
13157
- const [activeButtons, setActiveButtons] = React94.useState(/* @__PURE__ */ new Set());
13158
- const handlePress = React94.useCallback(
13153
+ const [activeButtons, setActiveButtons] = React98.useState(/* @__PURE__ */ new Set());
13154
+ const handlePress = React98.useCallback(
13159
13155
  (id) => {
13160
13156
  setActiveButtons((prev) => new Set(prev).add(id));
13161
13157
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -13163,7 +13159,7 @@ function ActionButtons({
13163
13159
  },
13164
13160
  [actionEvent, eventBus, onAction]
13165
13161
  );
13166
- const handleRelease = React94.useCallback(
13162
+ const handleRelease = React98.useCallback(
13167
13163
  (id) => {
13168
13164
  setActiveButtons((prev) => {
13169
13165
  const next = new Set(prev);
@@ -15662,9 +15658,37 @@ function BattleBoard({
15662
15658
  className
15663
15659
  }) {
15664
15660
  const board = boardEntity(entity) ?? {};
15665
- const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles : []);
15661
+ function asFieldObj(v) {
15662
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
15663
+ return v;
15664
+ }
15665
+ const rawTiles = propTiles ?? (Array.isArray(board.tiles) ? board.tiles.flatMap((v) => {
15666
+ const o = asFieldObj(v);
15667
+ if (o === null || typeof o.x !== "number" || typeof o.y !== "number") return [];
15668
+ const tile = { x: o.x, y: o.y };
15669
+ if (typeof o.terrain === "string") tile.terrain = o.terrain;
15670
+ if (typeof o.terrainSprite === "string") tile.terrainSprite = o.terrainSprite;
15671
+ if (typeof o.passable === "boolean") tile.passable = o.passable;
15672
+ if (typeof o.movementCost === "number") tile.movementCost = o.movementCost;
15673
+ if (typeof o.elevation === "number") tile.elevation = o.elevation;
15674
+ if (typeof o.type === "string") tile.type = o.type;
15675
+ if (typeof o.tileType === "string") tile.tileType = o.tileType;
15676
+ if (typeof o.id === "string") tile.id = o.id;
15677
+ if (typeof o.modelUrl === "string") tile.modelUrl = o.modelUrl;
15678
+ return [tile];
15679
+ }) : []);
15666
15680
  const tiles = rawTiles.length === 0 ? DEFAULT_BATTLE_TILES : rawTiles;
15667
- const features = propFeatures ?? (Array.isArray(board.features) ? board.features : []);
15681
+ const features = propFeatures ?? (Array.isArray(board.features) ? board.features.flatMap((v) => {
15682
+ const o = asFieldObj(v);
15683
+ if (o === null || typeof o.type !== "string" || typeof o.x !== "number" || typeof o.y !== "number") return [];
15684
+ const feat = { type: o.type, x: o.x, y: o.y };
15685
+ if (typeof o.id === "string") feat.id = o.id;
15686
+ if (typeof o.sprite === "string") feat.sprite = o.sprite;
15687
+ if (typeof o.color === "string") feat.color = o.color;
15688
+ if (typeof o.elevation === "number") feat.elevation = o.elevation;
15689
+ if (typeof o.assetUrl === "string") feat.assetUrl = o.assetUrl;
15690
+ return [feat];
15691
+ }) : []);
15668
15692
  const boardWidth = num(board.gridWidth ?? board.boardWidth, BATTLE_GRID_W);
15669
15693
  const boardHeight = num(board.gridHeight ?? board.boardHeight, BATTLE_GRID_H);
15670
15694
  const assetManifest = propAssetManifest ?? board.assetManifest;
@@ -15763,7 +15787,12 @@ function BattleBoard({
15763
15787
  return units.filter((u) => unitHealth(u) > 0).map((unit) => {
15764
15788
  const id = str(unit.id);
15765
15789
  const pos = movingPositions.get(id) ?? unitPosition(unit);
15766
- const unitTraits = Array.isArray(unit.traits) ? unit.traits : void 0;
15790
+ const unitTraits = Array.isArray(unit.traits) ? unit.traits.flatMap((v) => {
15791
+ const o = asFieldObj(v);
15792
+ if (o === null || typeof o.name !== "string" || typeof o.currentState !== "string" || !Array.isArray(o.states)) return [];
15793
+ const stateNames = Array.from(o.states).flatMap((s) => typeof s === "string" ? [s] : []);
15794
+ return [{ name: o.name, currentState: o.currentState, states: stateNames, cooldown: typeof o.cooldown === "number" ? o.cooldown : void 0 }];
15795
+ }) : void 0;
15767
15796
  return {
15768
15797
  id,
15769
15798
  position: pos,
@@ -16546,7 +16575,7 @@ var init_CodeBlock = __esm({
16546
16575
  };
16547
16576
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16548
16577
  HIDDEN_LINE_NUMBERS = { display: "none" };
16549
- CodeBlock = React94__default.memo(
16578
+ CodeBlock = React98__default.memo(
16550
16579
  ({
16551
16580
  code: rawCode,
16552
16581
  language = "text",
@@ -17133,7 +17162,7 @@ var init_MarkdownContent = __esm({
17133
17162
  init_Box();
17134
17163
  init_CodeBlock();
17135
17164
  init_cn();
17136
- MarkdownContent = React94__default.memo(
17165
+ MarkdownContent = React98__default.memo(
17137
17166
  ({ content, direction = "ltr", className }) => {
17138
17167
  const { t: _t } = useTranslate();
17139
17168
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18502,7 +18531,7 @@ var init_StateMachineView = __esm({
18502
18531
  style: { top: title ? 30 : 0 },
18503
18532
  children: [
18504
18533
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
18505
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React94__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18534
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React98__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18506
18535
  StateNode,
18507
18536
  {
18508
18537
  state,
@@ -19321,12 +19350,13 @@ var init_ContentRenderer = __esm({
19321
19350
  );
19322
19351
  case "orbital": {
19323
19352
  const parsed = segment.schema;
19353
+ const isFullSchema = (v) => Array.isArray(v.orbitals);
19324
19354
  const inlineTrait = {
19325
19355
  name: "inline",
19326
19356
  scope: "instance",
19327
19357
  stateMachine: parsed
19328
19358
  };
19329
- const schema = Array.isArray(parsed.orbitals) ? parsed : {
19359
+ const schema = isFullSchema(parsed) ? parsed : {
19330
19360
  name: "inline",
19331
19361
  orbitals: [{
19332
19362
  name: "inline",
@@ -20552,8 +20582,21 @@ function BuilderBoard({
20552
20582
  const resolved = boardEntity(entity);
20553
20583
  const [headerError, setHeaderError] = useState(false);
20554
20584
  const [selectedComponent, setSelectedComponent] = useState(null);
20555
- const components = Array.isArray(resolved?.components) ? resolved.components : [];
20556
- const slots = Array.isArray(resolved?.slots) ? resolved.slots : [];
20585
+ const components = rows(resolved?.components).map((r2) => ({
20586
+ id: str(r2.id),
20587
+ label: str(r2.label),
20588
+ description: str(r2.description) || void 0,
20589
+ iconEmoji: str(r2.iconEmoji) || void 0,
20590
+ iconUrl: str(r2.iconUrl) || void 0,
20591
+ category: str(r2.category) || void 0
20592
+ }));
20593
+ const slots = rows(resolved?.slots).map((r2) => ({
20594
+ id: str(r2.id),
20595
+ label: str(r2.label) || void 0,
20596
+ description: str(r2.description) || void 0,
20597
+ requiredComponentId: str(r2.requiredComponentId),
20598
+ placedComponentId: str(r2.placedComponentId) || void 0
20599
+ }));
20557
20600
  const placements = {};
20558
20601
  for (const slot of slots) {
20559
20602
  if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
@@ -22457,7 +22500,7 @@ function CardHand({
22457
22500
  className
22458
22501
  }) {
22459
22502
  const eventBus = useEventBus();
22460
- const handleClick = React94.useCallback(
22503
+ const handleClick = React98.useCallback(
22461
22504
  (card) => {
22462
22505
  if (card.disabled) return;
22463
22506
  onCardClick?.(card.id);
@@ -23204,14 +23247,15 @@ var init_CardGrid = __esm({
23204
23247
  bodyFields.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
23205
23248
  const value = getNestedValue(itemData, field);
23206
23249
  if (value === void 0 || value === null || value === "") return null;
23207
- const boolVal = asBooleanValue(value);
23250
+ const fieldValue = value;
23251
+ const boolVal = asBooleanValue(fieldValue);
23208
23252
  if (boolVal !== null) {
23209
23253
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
23210
23254
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
23211
23255
  boolVal ? /* @__PURE__ */ jsx(Badge, { variant: "success", children: t("common.yes") || "Yes" }) : /* @__PURE__ */ jsx(Badge, { variant: "neutral", children: t("common.no") || "No" })
23212
23256
  ] }, field);
23213
23257
  }
23214
- const displayValue = isDateField(field) ? formatDate(value) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
23258
+ const displayValue = isDateField(field) ? formatDate(fieldValue) : STATUS_FIELDS.has(field.toLowerCase()) ? void 0 : String(value);
23215
23259
  if (!displayValue) return null;
23216
23260
  return /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between", children: [
23217
23261
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: fieldLabel(field) }),
@@ -23596,9 +23640,9 @@ function CastleBoard({
23596
23640
  const eventBus = useEventBus();
23597
23641
  const { t } = useTranslate();
23598
23642
  const resolved = boardEntity(entity);
23599
- const tiles = propTiles ?? (Array.isArray(resolved?.tiles) ? resolved.tiles : []);
23600
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
23601
- const units = propUnits ?? (Array.isArray(resolved?.units) ? resolved.units : []);
23643
+ const tiles = propTiles ?? (resolved?.tiles ?? []);
23644
+ const features = propFeatures ?? (resolved?.features ?? []);
23645
+ const units = propUnits ?? (resolved?.units ?? []);
23602
23646
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
23603
23647
  const backgroundImage = resolved?.backgroundImage;
23604
23648
  const gold = num(resolved?.gold);
@@ -25133,8 +25177,8 @@ function ClassifierBoard({
25133
25177
  const { t } = useTranslate();
25134
25178
  const resolved = boardEntity(entity);
25135
25179
  const [headerError, setHeaderError] = useState(false);
25136
- const items = Array.isArray(resolved?.items) ? resolved.items : [];
25137
- const categories = Array.isArray(resolved?.categories) ? resolved.categories : [];
25180
+ const items = rows(resolved?.items);
25181
+ const categories = rows(resolved?.categories);
25138
25182
  const result = str(resolved?.result);
25139
25183
  const submitted = result === "win";
25140
25184
  const attempts = num(resolved?.attempts);
@@ -25935,7 +25979,7 @@ function CraftingRecipe({
25935
25979
  className
25936
25980
  }) {
25937
25981
  const eventBus = useEventBus();
25938
- const handleCraft = React94.useCallback(() => {
25982
+ const handleCraft = React98.useCallback(() => {
25939
25983
  onCraft?.();
25940
25984
  if (craftEvent) {
25941
25985
  eventBus.emit(craftEvent, { output: output.label });
@@ -25952,7 +25996,7 @@ function CraftingRecipe({
25952
25996
  children: [
25953
25997
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
25954
25998
  const hasSufficient = ingredient.available >= ingredient.required;
25955
- return /* @__PURE__ */ jsxs(React94.Fragment, { children: [
25999
+ return /* @__PURE__ */ jsxs(React98.Fragment, { children: [
25956
26000
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
25957
26001
  ItemSlot,
25958
26002
  {
@@ -26024,8 +26068,8 @@ function DPad({
26024
26068
  }) {
26025
26069
  const eventBus = useEventBus();
26026
26070
  const sizes = sizeMap15[size];
26027
- const [activeDirections, setActiveDirections] = React94.useState(/* @__PURE__ */ new Set());
26028
- const handlePress = React94.useCallback(
26071
+ const [activeDirections, setActiveDirections] = React98.useState(/* @__PURE__ */ new Set());
26072
+ const handlePress = React98.useCallback(
26029
26073
  (direction) => {
26030
26074
  setActiveDirections((prev) => new Set(prev).add(direction));
26031
26075
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -26033,7 +26077,7 @@ function DPad({
26033
26077
  },
26034
26078
  [directionEvent, eventBus, onDirection]
26035
26079
  );
26036
- const handleRelease = React94.useCallback(
26080
+ const handleRelease = React98.useCallback(
26037
26081
  (direction) => {
26038
26082
  setActiveDirections((prev) => {
26039
26083
  const next = new Set(prev);
@@ -26918,8 +26962,8 @@ var init_Menu = __esm({
26918
26962
  "bottom-end": "bottom-start"
26919
26963
  };
26920
26964
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
26921
- const triggerChild = React94__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
26922
- const triggerElement = React94__default.cloneElement(
26965
+ const triggerChild = React98__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
26966
+ const triggerElement = React98__default.cloneElement(
26923
26967
  triggerChild,
26924
26968
  {
26925
26969
  ref: triggerRef,
@@ -27014,14 +27058,14 @@ function useDataDnd(args) {
27014
27058
  const isZone = Boolean(dragGroup || accepts || sortable);
27015
27059
  const enabled = isZone || Boolean(dndRoot);
27016
27060
  const eventBus = useEventBus();
27017
- const parentRoot = React94__default.useContext(RootCtx);
27061
+ const parentRoot = React98__default.useContext(RootCtx);
27018
27062
  const isRoot = enabled && parentRoot === null;
27019
- const zoneId = React94__default.useId();
27063
+ const zoneId = React98__default.useId();
27020
27064
  const ownGroup = dragGroup ?? accepts ?? zoneId;
27021
- const [optimisticOrders, setOptimisticOrders] = React94__default.useState(() => /* @__PURE__ */ new Map());
27022
- const optimisticOrdersRef = React94__default.useRef(optimisticOrders);
27065
+ const [optimisticOrders, setOptimisticOrders] = React98__default.useState(() => /* @__PURE__ */ new Map());
27066
+ const optimisticOrdersRef = React98__default.useRef(optimisticOrders);
27023
27067
  optimisticOrdersRef.current = optimisticOrders;
27024
- const clearOptimisticOrder = React94__default.useCallback((group) => {
27068
+ const clearOptimisticOrder = React98__default.useCallback((group) => {
27025
27069
  setOptimisticOrders((prev) => {
27026
27070
  if (!prev.has(group)) return prev;
27027
27071
  const next = new Map(prev);
@@ -27044,17 +27088,20 @@ function useDataDnd(args) {
27044
27088
  }
27045
27089
  const itemIdsSignature = orderedItems.map((it, idx) => {
27046
27090
  const raw = it[dndItemIdField];
27047
- return String(raw ?? `__idx_${idx}`);
27091
+ return raw != null ? String(raw) : `__idx_${idx}`;
27048
27092
  }).join("|");
27049
- const itemIds = React94__default.useMemo(
27093
+ const itemIds = React98__default.useMemo(
27050
27094
  () => orderedItems.map((it, idx) => {
27051
27095
  const raw = it[dndItemIdField];
27052
- return raw ?? `__idx_${idx}`;
27096
+ return raw != null ? String(raw) : `__idx_${idx}`;
27053
27097
  }),
27054
27098
  [itemIdsSignature]
27055
27099
  );
27056
- const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
27057
- React94__default.useEffect(() => {
27100
+ const itemsContentSig = items.map((it, idx) => {
27101
+ const raw = it[dndItemIdField];
27102
+ return raw != null ? String(raw) : `__${idx}`;
27103
+ }).join("|");
27104
+ React98__default.useEffect(() => {
27058
27105
  const root = isRoot ? null : parentRoot;
27059
27106
  if (root) {
27060
27107
  root.clearOptimisticOrder(ownGroup);
@@ -27062,20 +27109,20 @@ function useDataDnd(args) {
27062
27109
  clearOptimisticOrder(ownGroup);
27063
27110
  }
27064
27111
  }, [itemsContentSig, ownGroup]);
27065
- const zonesRef = React94__default.useRef(/* @__PURE__ */ new Map());
27066
- const registerZone = React94__default.useCallback((zoneId2, meta2) => {
27112
+ const zonesRef = React98__default.useRef(/* @__PURE__ */ new Map());
27113
+ const registerZone = React98__default.useCallback((zoneId2, meta2) => {
27067
27114
  zonesRef.current.set(zoneId2, meta2);
27068
27115
  }, []);
27069
- const unregisterZone = React94__default.useCallback((zoneId2) => {
27116
+ const unregisterZone = React98__default.useCallback((zoneId2) => {
27070
27117
  zonesRef.current.delete(zoneId2);
27071
27118
  }, []);
27072
- const [activeDrag, setActiveDrag] = React94__default.useState(null);
27073
- const [overZoneGroup, setOverZoneGroup] = React94__default.useState(null);
27074
- const meta = React94__default.useMemo(
27119
+ const [activeDrag, setActiveDrag] = React98__default.useState(null);
27120
+ const [overZoneGroup, setOverZoneGroup] = React98__default.useState(null);
27121
+ const meta = React98__default.useMemo(
27075
27122
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
27076
27123
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
27077
27124
  );
27078
- React94__default.useEffect(() => {
27125
+ React98__default.useEffect(() => {
27079
27126
  const target = isRoot ? null : parentRoot;
27080
27127
  if (!target) {
27081
27128
  zonesRef.current.set(zoneId, meta);
@@ -27094,7 +27141,7 @@ function useDataDnd(args) {
27094
27141
  }, [parentRoot, isRoot, zoneId, meta]);
27095
27142
  const sensors = useAlmadarDndSensors(true);
27096
27143
  const collisionDetection = almadarDndCollisionDetection;
27097
- const findZoneByItem = React94__default.useCallback(
27144
+ const findZoneByItem = React98__default.useCallback(
27098
27145
  (id) => {
27099
27146
  for (const z of zonesRef.current.values()) {
27100
27147
  if (z.itemIds.includes(id)) return z;
@@ -27103,7 +27150,7 @@ function useDataDnd(args) {
27103
27150
  },
27104
27151
  []
27105
27152
  );
27106
- React94__default.useCallback(
27153
+ React98__default.useCallback(
27107
27154
  (group) => {
27108
27155
  for (const z of zonesRef.current.values()) {
27109
27156
  if (z.group === group) return z;
@@ -27112,7 +27159,7 @@ function useDataDnd(args) {
27112
27159
  },
27113
27160
  []
27114
27161
  );
27115
- const handleDragEnd = React94__default.useCallback(
27162
+ const handleDragEnd = React98__default.useCallback(
27116
27163
  (event) => {
27117
27164
  const { active, over } = event;
27118
27165
  const activeIdStr = String(active.id);
@@ -27203,8 +27250,8 @@ function useDataDnd(args) {
27203
27250
  },
27204
27251
  [eventBus]
27205
27252
  );
27206
- const sortableData = React94__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
27207
- const SortableItem = React94__default.useCallback(
27253
+ const sortableData = React98__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
27254
+ const SortableItem = React98__default.useCallback(
27208
27255
  ({ id, children }) => {
27209
27256
  const {
27210
27257
  attributes,
@@ -27244,7 +27291,7 @@ function useDataDnd(args) {
27244
27291
  id: droppableId,
27245
27292
  data: sortableData
27246
27293
  });
27247
- const ctx = React94__default.useContext(RootCtx);
27294
+ const ctx = React98__default.useContext(RootCtx);
27248
27295
  const activeDrag2 = ctx?.activeDrag ?? null;
27249
27296
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
27250
27297
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -27259,7 +27306,7 @@ function useDataDnd(args) {
27259
27306
  showForeignPlaceholder,
27260
27307
  ctxAvailable: ctx != null
27261
27308
  });
27262
- React94__default.useEffect(() => {
27309
+ React98__default.useEffect(() => {
27263
27310
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
27264
27311
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
27265
27312
  return /* @__PURE__ */ jsx(
@@ -27273,11 +27320,11 @@ function useDataDnd(args) {
27273
27320
  }
27274
27321
  );
27275
27322
  };
27276
- const rootContextValue = React94__default.useMemo(
27323
+ const rootContextValue = React98__default.useMemo(
27277
27324
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
27278
27325
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
27279
27326
  );
27280
- const handleDragStart = React94__default.useCallback((event) => {
27327
+ const handleDragStart = React98__default.useCallback((event) => {
27281
27328
  const sourceZone = findZoneByItem(event.active.id);
27282
27329
  const rect = event.active.rect.current.initial;
27283
27330
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -27296,7 +27343,7 @@ function useDataDnd(args) {
27296
27343
  isRoot
27297
27344
  });
27298
27345
  }, [findZoneByItem, isRoot, zoneId]);
27299
- const handleDragOver = React94__default.useCallback((event) => {
27346
+ const handleDragOver = React98__default.useCallback((event) => {
27300
27347
  const { active, over } = event;
27301
27348
  const overData = over?.data?.current;
27302
27349
  const overGroup = overData?.dndGroup ?? null;
@@ -27366,7 +27413,7 @@ function useDataDnd(args) {
27366
27413
  return next;
27367
27414
  });
27368
27415
  }, []);
27369
- const handleDragCancel = React94__default.useCallback((event) => {
27416
+ const handleDragCancel = React98__default.useCallback((event) => {
27370
27417
  setActiveDrag(null);
27371
27418
  setOverZoneGroup(null);
27372
27419
  dndLog.warn("dragCancel", {
@@ -27374,12 +27421,12 @@ function useDataDnd(args) {
27374
27421
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
27375
27422
  });
27376
27423
  }, []);
27377
- const handleDragEndWithCleanup = React94__default.useCallback((event) => {
27424
+ const handleDragEndWithCleanup = React98__default.useCallback((event) => {
27378
27425
  handleDragEnd(event);
27379
27426
  setActiveDrag(null);
27380
27427
  setOverZoneGroup(null);
27381
27428
  }, [handleDragEnd]);
27382
- const wrapContainer = React94__default.useCallback(
27429
+ const wrapContainer = React98__default.useCallback(
27383
27430
  (children) => {
27384
27431
  if (!enabled) return children;
27385
27432
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -27433,7 +27480,7 @@ var init_useDataDnd = __esm({
27433
27480
  init_useAlmadarDndCollision();
27434
27481
  init_Box();
27435
27482
  dndLog = createLogger("almadar:ui:dnd");
27436
- RootCtx = React94__default.createContext(null);
27483
+ RootCtx = React98__default.createContext(null);
27437
27484
  }
27438
27485
  });
27439
27486
  function renderIconInput(icon, props) {
@@ -27576,8 +27623,8 @@ function DataGrid({
27576
27623
  const hasRenderProp = typeof children === "function";
27577
27624
  useEffect(() => {
27578
27625
  if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
27579
- const renderItemRaw = schemaRenderItem;
27580
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
27626
+ const schemaArr = Array.isArray(schemaRenderItem) ? schemaRenderItem : null;
27627
+ const isFnLambda = schemaArr !== null && schemaArr.length >= 3 && (schemaArr[0] === "fn" || schemaArr[0] === "lambda");
27581
27628
  dataGridLog.warn("renderItem-unresolved", {
27582
27629
  rowCount: data.length,
27583
27630
  renderItemIsFnLambda: isFnLambda
@@ -27959,7 +28006,7 @@ function DataList({
27959
28006
  }) {
27960
28007
  const eventBus = useEventBus();
27961
28008
  const { t } = useTranslate();
27962
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize || Infinity);
28009
+ const [visibleCount, setVisibleCount] = React98__default.useState(pageSize || Infinity);
27963
28010
  const fieldDefs = fields ?? columns ?? [];
27964
28011
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
27965
28012
  const dnd = useDataDnd({
@@ -27978,21 +28025,20 @@ function DataList({
27978
28025
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
27979
28026
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
27980
28027
  const hasRenderProp = typeof children === "function";
27981
- React94__default.useEffect(() => {
28028
+ React98__default.useEffect(() => {
27982
28029
  const renderItemTypeOf = typeof schemaRenderItem;
27983
28030
  const childrenTypeOf = typeof children;
27984
28031
  if (data.length > 0 && !hasRenderProp) {
27985
28032
  const firstRow = data[0];
27986
28033
  const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
27987
- const renderItemRaw = schemaRenderItem;
27988
- const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
28034
+ const isFnLambda = Array.isArray(schemaRenderItem) && schemaRenderItem.length >= 3 && (schemaRenderItem[0] === "fn" || schemaRenderItem[0] === "lambda");
27989
28035
  dataListLog.warn("renderItem-unresolved", {
27990
28036
  rowCount: data.length,
27991
28037
  fieldsCount: fieldDefs.length,
27992
28038
  renderItemTypeOf,
27993
- renderItemIsArray: Array.isArray(renderItemRaw),
28039
+ renderItemIsArray: Array.isArray(schemaRenderItem),
27994
28040
  renderItemIsFnLambda: isFnLambda,
27995
- renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
28041
+ renderItemHead: Array.isArray(schemaRenderItem) ? String(schemaRenderItem[0]) : void 0,
27996
28042
  childrenTypeOf,
27997
28043
  sampleRowKeys: sampleKeys
27998
28044
  });
@@ -28080,10 +28126,10 @@ function DataList({
28080
28126
  const isCompact = variant === "compact";
28081
28127
  const isMessage = variant === "message";
28082
28128
  if (isMessage) {
28083
- const items2 = data.map((item) => item);
28129
+ const items2 = [...data];
28084
28130
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
28085
28131
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
28086
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
28132
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
28087
28133
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
28088
28134
  group.items.map((itemData, index) => {
28089
28135
  const id = itemData.id || `${gi}-${index}`;
@@ -28129,7 +28175,7 @@ function DataList({
28129
28175
  })
28130
28176
  ] }, gi)) });
28131
28177
  }
28132
- const items = data.map((item) => item);
28178
+ const items = [...data];
28133
28179
  const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
28134
28180
  const idFieldName = dndItemIdField ?? "id";
28135
28181
  const renderItem = (itemData, index, isLast) => {
@@ -28224,7 +28270,7 @@ function DataList({
28224
28270
  className
28225
28271
  ),
28226
28272
  children: [
28227
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
28273
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
28228
28274
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
28229
28275
  group.items.map(
28230
28276
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -29017,23 +29063,19 @@ var init_Flex = __esm({
29017
29063
  flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
29018
29064
  }
29019
29065
  }
29020
- const Comp = Component2;
29021
- return /* @__PURE__ */ jsx(
29022
- Comp,
29023
- {
29024
- className: cn(
29025
- inline ? "inline-flex" : "flex",
29026
- directionStyles[direction],
29027
- wrapStyles[wrap],
29028
- alignStyles3[align],
29029
- justifyStyles2[justify],
29030
- gapStyles6[gap],
29031
- className
29032
- ),
29033
- style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
29034
- children
29035
- }
29036
- );
29066
+ return React98__default.createElement(Component2, {
29067
+ className: cn(
29068
+ inline ? "inline-flex" : "flex",
29069
+ directionStyles[direction],
29070
+ wrapStyles[wrap],
29071
+ alignStyles3[align],
29072
+ justifyStyles2[justify],
29073
+ gapStyles6[gap],
29074
+ className
29075
+ ),
29076
+ style: Object.keys(flexStyle).length > 0 ? flexStyle : void 0,
29077
+ children
29078
+ });
29037
29079
  };
29038
29080
  Flex.displayName = "Flex";
29039
29081
  }
@@ -29140,7 +29182,7 @@ var init_Grid = __esm({
29140
29182
  as: Component2 = "div"
29141
29183
  }) => {
29142
29184
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
29143
- return React94__default.createElement(
29185
+ return React98__default.createElement(
29144
29186
  Component2,
29145
29187
  {
29146
29188
  className: cn(
@@ -29336,9 +29378,9 @@ var init_Popover = __esm({
29336
29378
  onMouseLeave: handleClose,
29337
29379
  onPointerDown: tapTriggerProps.onPointerDown
29338
29380
  };
29339
- const childElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29381
+ const childElement = React98__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29340
29382
  const childPointerDown = childElement.props.onPointerDown;
29341
- const triggerElement = React94__default.cloneElement(
29383
+ const triggerElement = React98__default.cloneElement(
29342
29384
  childElement,
29343
29385
  {
29344
29386
  ref: triggerRef,
@@ -29940,9 +29982,9 @@ var init_Tooltip = __esm({
29940
29982
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
29941
29983
  };
29942
29984
  }, []);
29943
- const triggerElement = React94__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29985
+ const triggerElement = React98__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
29944
29986
  const childPointerDown = triggerElement.props.onPointerDown;
29945
- const trigger = React94__default.cloneElement(triggerElement, {
29987
+ const trigger = React98__default.cloneElement(triggerElement, {
29946
29988
  ref: triggerRef,
29947
29989
  onMouseEnter: handleMouseEnter,
29948
29990
  onMouseLeave: handleMouseLeave,
@@ -30032,7 +30074,7 @@ var init_WizardProgress = __esm({
30032
30074
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
30033
30075
  const isActive = index === currentStep;
30034
30076
  const isCompleted = index < currentStep;
30035
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
30077
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
30036
30078
  /* @__PURE__ */ jsx(
30037
30079
  "button",
30038
30080
  {
@@ -30344,13 +30386,14 @@ var init_ViolationAlert = __esm({
30344
30386
  onNavigateToField,
30345
30387
  compact = false,
30346
30388
  className,
30347
- ...flatProps
30389
+ message
30348
30390
  }) => {
30349
30391
  const { t } = useTranslate();
30392
+ const fallbackMessage = message ?? t("violationAlert.fallbackMessage");
30350
30393
  const resolvedViolation = violation ?? {
30351
30394
  law: "",
30352
30395
  article: "",
30353
- message: flatProps.message ?? t("violationAlert.fallbackMessage"),
30396
+ message: fallbackMessage,
30354
30397
  actionType: "measure"
30355
30398
  };
30356
30399
  const effectiveSeverity = severity ?? (resolvedViolation.actionType === "measure" ? "warning" : "error");
@@ -31095,7 +31138,7 @@ function InventoryGrid({
31095
31138
  const eventBus = useEventBus();
31096
31139
  const slotCount = totalSlots ?? items.length;
31097
31140
  const emptySlotCount = Math.max(0, slotCount - items.length);
31098
- const handleSelect = React94.useCallback(
31141
+ const handleSelect = React98.useCallback(
31099
31142
  (id) => {
31100
31143
  onSelect?.(id);
31101
31144
  if (selectEvent) {
@@ -31330,31 +31373,31 @@ function GameCanvas2D({
31330
31373
  assetBaseUrl,
31331
31374
  className
31332
31375
  }) {
31333
- const canvasRef = React94.useRef(null);
31334
- const rafRef = React94.useRef(0);
31335
- const frameRef = React94.useRef(0);
31336
- const lastTimeRef = React94.useRef(0);
31337
- const imageCache = React94.useRef(/* @__PURE__ */ new Map());
31376
+ const canvasRef = React98.useRef(null);
31377
+ const rafRef = React98.useRef(0);
31378
+ const frameRef = React98.useRef(0);
31379
+ const lastTimeRef = React98.useRef(0);
31380
+ const imageCache = React98.useRef(/* @__PURE__ */ new Map());
31338
31381
  const emit = useEmitEvent();
31339
- const onDrawRef = React94.useRef(onDraw);
31382
+ const onDrawRef = React98.useRef(onDraw);
31340
31383
  onDrawRef.current = onDraw;
31341
- const onTickRef = React94.useRef(onTick);
31384
+ const onTickRef = React98.useRef(onTick);
31342
31385
  onTickRef.current = onTick;
31343
- const tickEventRef = React94.useRef(tickEvent);
31386
+ const tickEventRef = React98.useRef(tickEvent);
31344
31387
  tickEventRef.current = tickEvent;
31345
- const drawEventRef = React94.useRef(drawEvent);
31388
+ const drawEventRef = React98.useRef(drawEvent);
31346
31389
  drawEventRef.current = drawEvent;
31347
- const emitRef = React94.useRef(emit);
31390
+ const emitRef = React98.useRef(emit);
31348
31391
  emitRef.current = emit;
31349
- const assetBaseUrlRef = React94.useRef(assetBaseUrl);
31392
+ const assetBaseUrlRef = React98.useRef(assetBaseUrl);
31350
31393
  assetBaseUrlRef.current = assetBaseUrl;
31351
- const backgroundImageRef = React94.useRef(backgroundImage);
31394
+ const backgroundImageRef = React98.useRef(backgroundImage);
31352
31395
  backgroundImageRef.current = backgroundImage;
31353
- const widthRef = React94.useRef(width);
31396
+ const widthRef = React98.useRef(width);
31354
31397
  widthRef.current = width;
31355
- const heightRef = React94.useRef(height);
31398
+ const heightRef = React98.useRef(height);
31356
31399
  heightRef.current = height;
31357
- const loadImage = React94.useCallback((url) => {
31400
+ const loadImage = React98.useCallback((url) => {
31358
31401
  const base = assetBaseUrlRef.current;
31359
31402
  if (!url.startsWith("http") && !base) return null;
31360
31403
  const fullUrl = url.startsWith("http") ? url : `${base}${url}`;
@@ -31368,7 +31411,7 @@ function GameCanvas2D({
31368
31411
  }
31369
31412
  return null;
31370
31413
  }, []);
31371
- React94.useEffect(() => {
31414
+ React98.useEffect(() => {
31372
31415
  const canvas = canvasRef.current;
31373
31416
  if (!canvas) return;
31374
31417
  const ctx = canvas.getContext("2d");
@@ -31693,7 +31736,7 @@ function TurnPanel({
31693
31736
  className
31694
31737
  }) {
31695
31738
  const eventBus = useEventBus();
31696
- const handleAction = React94.useCallback(
31739
+ const handleAction = React98.useCallback(
31697
31740
  (event) => {
31698
31741
  if (event) {
31699
31742
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -31874,7 +31917,7 @@ function UnitCommandBar({
31874
31917
  className
31875
31918
  }) {
31876
31919
  const eventBus = useEventBus();
31877
- const handleCommand = React94.useCallback(
31920
+ const handleCommand = React98.useCallback(
31878
31921
  (event) => {
31879
31922
  if (event) {
31880
31923
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -32425,7 +32468,7 @@ function GameMenu({
32425
32468
  } catch {
32426
32469
  }
32427
32470
  const eventBus = eventBusProp || eventBusFromHook;
32428
- const handleOptionClick = React94.useCallback(
32471
+ const handleOptionClick = React98.useCallback(
32429
32472
  (option) => {
32430
32473
  if (option.event && eventBus) {
32431
32474
  eventBus.emit(`UI:${option.event}`, { option });
@@ -32544,7 +32587,7 @@ function GameOverScreen({
32544
32587
  } catch {
32545
32588
  }
32546
32589
  const eventBus = eventBusProp || eventBusFromHook;
32547
- const handleActionClick = React94.useCallback(
32590
+ const handleActionClick = React98.useCallback(
32548
32591
  (action) => {
32549
32592
  if (action.event && eventBus) {
32550
32593
  eventBus.emit(`UI:${action.event}`, { action });
@@ -33476,7 +33519,7 @@ var init_MapView = __esm({
33476
33519
  shadowSize: [41, 41]
33477
33520
  });
33478
33521
  L.Marker.prototype.options.icon = defaultIcon;
33479
- const { useEffect: useEffect89, useRef: useRef82, useCallback: useCallback133, useState: useState125 } = React94__default;
33522
+ const { useEffect: useEffect89, useRef: useRef82, useCallback: useCallback133, useState: useState125 } = React98__default;
33480
33523
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
33481
33524
  const { useEventBus: useEventBus4 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
33482
33525
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -34312,6 +34355,15 @@ function renderIconInput3(icon, props) {
34312
34355
  function columnLabel(col) {
34313
34356
  return col.header ?? col.label ?? col.key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
34314
34357
  }
34358
+ function asFieldValue(v) {
34359
+ if (v === void 0 || v === null) return v;
34360
+ const t = typeof v;
34361
+ if (t === "string" || t === "number" || t === "boolean") return v;
34362
+ if (v instanceof Date) return v;
34363
+ if (Array.isArray(v)) return v;
34364
+ if (t === "object") return v;
34365
+ return void 0;
34366
+ }
34315
34367
  function statusVariant4(value) {
34316
34368
  const v = value.toLowerCase();
34317
34369
  if (["active", "completed", "done", "approved", "published", "resolved", "open", "online", "ok"].includes(v)) return "success";
@@ -34382,8 +34434,8 @@ function TableView({
34382
34434
  }) {
34383
34435
  const eventBus = useEventBus();
34384
34436
  const { t } = useTranslate();
34385
- const [visibleCount, setVisibleCount] = React94__default.useState(pageSize > 0 ? pageSize : Infinity);
34386
- const [localSelected, setLocalSelected] = React94__default.useState(/* @__PURE__ */ new Set());
34437
+ const [visibleCount, setVisibleCount] = React98__default.useState(pageSize > 0 ? pageSize : Infinity);
34438
+ const [localSelected, setLocalSelected] = React98__default.useState(/* @__PURE__ */ new Set());
34387
34439
  const colDefs = columns ?? fields ?? [];
34388
34440
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
34389
34441
  const dnd = useDataDnd({
@@ -34528,7 +34580,7 @@ function TableView({
34528
34580
  }
34529
34581
  ) }),
34530
34582
  hasRenderProp ? /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
34531
- const raw = getNestedValue(row, col.field ?? col.key);
34583
+ const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
34532
34584
  const cellBase = cn(
34533
34585
  "flex items-center min-w-0",
34534
34586
  alignClass[col.align ?? "left"],
@@ -34578,12 +34630,12 @@ function TableView({
34578
34630
  ]
34579
34631
  }
34580
34632
  );
34581
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React94__default.Fragment, { children: rowInner }, id);
34633
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React98__default.Fragment, { children: rowInner }, id);
34582
34634
  };
34583
- const items = data.map((row) => row);
34635
+ const items = Array.from(data);
34584
34636
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
34585
34637
  let runningIndex = 0;
34586
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
34638
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
34587
34639
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
34588
34640
  group.items.map((row) => renderRow(row, runningIndex++))
34589
34641
  ] }, gi)) });
@@ -35940,7 +35992,7 @@ var init_StepFlow = __esm({
35940
35992
  className
35941
35993
  }) => {
35942
35994
  if (orientation === "vertical") {
35943
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
35995
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React98__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
35944
35996
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
35945
35997
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
35946
35998
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -35951,7 +36003,7 @@ var init_StepFlow = __esm({
35951
36003
  ] })
35952
36004
  ] }) }, index)) });
35953
36005
  }
35954
- 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(React94__default.Fragment, { children: [
36006
+ 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(React98__default.Fragment, { children: [
35955
36007
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
35956
36008
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
35957
36009
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -36936,7 +36988,7 @@ var init_LikertScale = __esm({
36936
36988
  md: "text-base",
36937
36989
  lg: "text-lg"
36938
36990
  };
36939
- LikertScale = React94__default.forwardRef(
36991
+ LikertScale = React98__default.forwardRef(
36940
36992
  ({
36941
36993
  question,
36942
36994
  options = DEFAULT_LIKERT_OPTIONS,
@@ -36948,7 +37000,7 @@ var init_LikertScale = __esm({
36948
37000
  variant = "radios",
36949
37001
  className
36950
37002
  }, ref) => {
36951
- const groupId = React94__default.useId();
37003
+ const groupId = React98__default.useId();
36952
37004
  const eventBus = useEventBus();
36953
37005
  const handleSelect = useCallback(
36954
37006
  (next) => {
@@ -37843,11 +37895,11 @@ function nextBlockId(prefix = "blk") {
37843
37895
  function normalizeBlocks(raw) {
37844
37896
  if (!Array.isArray(raw) || raw.length === 0) return [createBlock("paragraph")];
37845
37897
  return raw.map((row) => {
37846
- const r2 = row;
37847
- const rawType = r2.type;
37898
+ const entity = row;
37899
+ const rawType = entity.type;
37848
37900
  const type = typeof rawType === "string" && BLOCK_TYPES.has(rawType) ? rawType : "paragraph";
37849
- const id = typeof r2.id === "string" && r2.id ? r2.id : nextBlockId(type);
37850
- return { ...r2, id, type };
37901
+ const id = typeof entity.id === "string" && entity.id ? entity.id : nextBlockId(type);
37902
+ return { ...entity, id, type };
37851
37903
  });
37852
37904
  }
37853
37905
  function createBlock(type) {
@@ -39230,7 +39282,7 @@ var init_DocBreadcrumb = __esm({
39230
39282
  "aria-label": t("aria.breadcrumb"),
39231
39283
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
39232
39284
  const isLast = idx === items.length - 1;
39233
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
39285
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
39234
39286
  idx > 0 && /* @__PURE__ */ jsx(
39235
39287
  Icon,
39236
39288
  {
@@ -39894,7 +39946,7 @@ var init_PageHeader = __esm({
39894
39946
  info: "bg-info/10 text-info"
39895
39947
  };
39896
39948
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
39897
- 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(React94__default.Fragment, { children: [
39949
+ 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(React98__default.Fragment, { children: [
39898
39950
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
39899
39951
  crumb.href ? /* @__PURE__ */ jsx(
39900
39952
  "a",
@@ -40252,52 +40304,49 @@ var init_Section = __esm({
40252
40304
  as: Component2 = "section"
40253
40305
  }) => {
40254
40306
  const hasHeader = title || description || action;
40255
- const Comp = Component2;
40256
- return /* @__PURE__ */ jsxs(
40257
- Comp,
40307
+ return React98__default.createElement(
40308
+ Component2,
40258
40309
  {
40259
40310
  className: cn(
40260
40311
  paddingStyles4[padding],
40261
40312
  variantStyles9[variant],
40262
40313
  className
40263
- ),
40264
- children: [
40265
- hasHeader && /* @__PURE__ */ jsxs(
40266
- Box,
40267
- {
40268
- className: cn(
40269
- "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
40270
- divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
40271
- !divider && "mb-4",
40272
- headerClassName
40273
- ),
40274
- children: [
40275
- /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
40276
- title && /* @__PURE__ */ jsx(
40277
- Typography,
40278
- {
40279
- variant: "h4",
40280
- className: "text-foreground font-semibold",
40281
- children: title
40282
- }
40283
- ),
40284
- description && /* @__PURE__ */ jsx(
40285
- Typography,
40286
- {
40287
- variant: "body",
40288
- color: "muted",
40289
- className: "mt-1",
40290
- children: description
40291
- }
40292
- )
40293
- ] }),
40294
- action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
40295
- ]
40296
- }
40314
+ )
40315
+ },
40316
+ hasHeader && /* @__PURE__ */ jsxs(
40317
+ Box,
40318
+ {
40319
+ className: cn(
40320
+ "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 sm:gap-4",
40321
+ divider && "pb-4 mb-4 border-b-[length:var(--border-width)] border-border",
40322
+ !divider && "mb-4",
40323
+ headerClassName
40297
40324
  ),
40298
- /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
40299
- ]
40300
- }
40325
+ children: [
40326
+ /* @__PURE__ */ jsxs(Box, { className: "flex-1 min-w-0", children: [
40327
+ title && /* @__PURE__ */ jsx(
40328
+ Typography,
40329
+ {
40330
+ variant: "h4",
40331
+ className: "text-foreground font-semibold",
40332
+ children: title
40333
+ }
40334
+ ),
40335
+ description && /* @__PURE__ */ jsx(
40336
+ Typography,
40337
+ {
40338
+ variant: "body",
40339
+ color: "muted",
40340
+ className: "mt-1",
40341
+ children: description
40342
+ }
40343
+ )
40344
+ ] }),
40345
+ action && /* @__PURE__ */ jsx(Box, { className: "flex-shrink-0 flex items-center gap-2", children: action })
40346
+ ]
40347
+ }
40348
+ ),
40349
+ /* @__PURE__ */ jsx(Box, { className: contentClassName, children })
40301
40350
  );
40302
40351
  };
40303
40352
  Section.displayName = "Section";
@@ -40623,7 +40672,7 @@ var init_WizardContainer = __esm({
40623
40672
  const isCompleted = index < currentStep;
40624
40673
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
40625
40674
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
40626
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
40675
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
40627
40676
  /* @__PURE__ */ jsx(
40628
40677
  Button,
40629
40678
  {
@@ -42566,6 +42615,22 @@ var init_DataTable = __esm({
42566
42615
  DataTable.displayName = "DataTable";
42567
42616
  }
42568
42617
  });
42618
+ function toDebuggerLine(v) {
42619
+ if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
42620
+ const id = v["id"];
42621
+ const content = v["content"];
42622
+ const isBug = v["isBug"];
42623
+ if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
42624
+ const isFlagged = v["isFlagged"];
42625
+ const explanation = v["explanation"];
42626
+ return {
42627
+ id,
42628
+ content,
42629
+ isBug,
42630
+ isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
42631
+ explanation: typeof explanation === "string" ? explanation : void 0
42632
+ };
42633
+ }
42569
42634
  function DebuggerBoard({
42570
42635
  entity,
42571
42636
  completeEvent = "PUZZLE_COMPLETE",
@@ -42578,7 +42643,10 @@ function DebuggerBoard({
42578
42643
  const { t } = useTranslate();
42579
42644
  const resolved = boardEntity(entity);
42580
42645
  const [headerError, setHeaderError] = useState(false);
42581
- const lines = Array.isArray(resolved?.lines) ? resolved.lines : [];
42646
+ const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
42647
+ const l = toDebuggerLine(v);
42648
+ return l ? [l] : [];
42649
+ }) : [];
42582
42650
  const result = str(resolved?.result) || "none";
42583
42651
  const attempts = num(resolved?.attempts);
42584
42652
  const submitted = result === "win";
@@ -43183,7 +43251,7 @@ var init_DetailPanel = __esm({
43183
43251
  }
43184
43252
  });
43185
43253
  function extractTitle(children) {
43186
- if (!React94__default.isValidElement(children)) return void 0;
43254
+ if (!React98__default.isValidElement(children)) return void 0;
43187
43255
  const props = children.props;
43188
43256
  if (typeof props.title === "string") {
43189
43257
  return props.title;
@@ -43238,7 +43306,7 @@ function LinearView({
43238
43306
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
43239
43307
  const isDone = i < currentIdx;
43240
43308
  const isCurrent = i === currentIdx;
43241
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
43309
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
43242
43310
  i > 0 && /* @__PURE__ */ jsx(
43243
43311
  Typography,
43244
43312
  {
@@ -44060,12 +44128,12 @@ function evaluateFormExpression(expr, formCtx) {
44060
44128
  return evaluate(expr, ctx);
44061
44129
  }
44062
44130
  function isOrbitalEntitySchema(value) {
44063
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
44131
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
44064
44132
  const fields = value.fields;
44065
44133
  return Array.isArray(fields);
44066
44134
  }
44067
44135
  function isPlainEntityRow(value) {
44068
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
44136
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
44069
44137
  const fields = value.fields;
44070
44138
  return !Array.isArray(fields);
44071
44139
  }
@@ -44224,12 +44292,12 @@ var init_Form = __esm({
44224
44292
  const isSchemaEntity = isOrbitalEntitySchema(entity);
44225
44293
  const resolvedEntity = isSchemaEntity ? entity : void 0;
44226
44294
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
44227
- const normalizedInitialData = React94__default.useMemo(() => {
44295
+ const normalizedInitialData = React98__default.useMemo(() => {
44228
44296
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
44229
44297
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
44230
44298
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
44231
44299
  }, [entity, initialData]);
44232
- const entityDerivedFields = React94__default.useMemo(() => {
44300
+ const entityDerivedFields = React98__default.useMemo(() => {
44233
44301
  if (fields && fields.length > 0) return void 0;
44234
44302
  if (!resolvedEntity) return void 0;
44235
44303
  return resolvedEntity.fields.map(
@@ -44237,6 +44305,7 @@ var init_Form = __esm({
44237
44305
  name: f3.name,
44238
44306
  type: f3.type,
44239
44307
  required: f3.required,
44308
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
44240
44309
  defaultValue: f3.default,
44241
44310
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
44242
44311
  values: "values" in f3 ? f3.values : void 0,
@@ -44249,16 +44318,16 @@ var init_Form = __esm({
44249
44318
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
44250
44319
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
44251
44320
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
44252
- const [formData, setFormData] = React94__default.useState(
44321
+ const [formData, setFormData] = React98__default.useState(
44253
44322
  normalizedInitialData
44254
44323
  );
44255
- const [collapsedSections, setCollapsedSections] = React94__default.useState(
44324
+ const [collapsedSections, setCollapsedSections] = React98__default.useState(
44256
44325
  /* @__PURE__ */ new Set()
44257
44326
  );
44258
- const [submitError, setSubmitError] = React94__default.useState(null);
44259
- const formRef = React94__default.useRef(null);
44327
+ const [submitError, setSubmitError] = React98__default.useState(null);
44328
+ const formRef = React98__default.useRef(null);
44260
44329
  const formMode = props.mode;
44261
- const mountedRef = React94__default.useRef(false);
44330
+ const mountedRef = React98__default.useRef(false);
44262
44331
  if (!mountedRef.current) {
44263
44332
  mountedRef.current = true;
44264
44333
  debug("forms", "mount", {
@@ -44271,7 +44340,7 @@ var init_Form = __esm({
44271
44340
  });
44272
44341
  }
44273
44342
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
44274
- const evalContext = React94__default.useMemo(
44343
+ const evalContext = React98__default.useMemo(
44275
44344
  () => ({
44276
44345
  formValues: formData,
44277
44346
  globalVariables: externalContext?.globalVariables ?? {},
@@ -44280,7 +44349,7 @@ var init_Form = __esm({
44280
44349
  }),
44281
44350
  [formData, externalContext]
44282
44351
  );
44283
- React94__default.useEffect(() => {
44352
+ React98__default.useEffect(() => {
44284
44353
  debug("forms", "initialData-sync", {
44285
44354
  mode: formMode,
44286
44355
  normalizedInitialData,
@@ -44291,7 +44360,7 @@ var init_Form = __esm({
44291
44360
  setFormData(normalizedInitialData);
44292
44361
  }
44293
44362
  }, [normalizedInitialData]);
44294
- const processCalculations = React94__default.useCallback(
44363
+ const processCalculations = React98__default.useCallback(
44295
44364
  (changedFieldId, newFormData) => {
44296
44365
  if (!hiddenCalculations.length) return;
44297
44366
  const context = {
@@ -44316,7 +44385,7 @@ var init_Form = __esm({
44316
44385
  },
44317
44386
  [hiddenCalculations, externalContext, eventBus]
44318
44387
  );
44319
- const checkViolations = React94__default.useCallback(
44388
+ const checkViolations = React98__default.useCallback(
44320
44389
  (changedFieldId, newFormData) => {
44321
44390
  if (!violationTriggers.length) return;
44322
44391
  const context = {
@@ -44354,7 +44423,7 @@ var init_Form = __esm({
44354
44423
  processCalculations(name, newFormData);
44355
44424
  checkViolations(name, newFormData);
44356
44425
  };
44357
- const isFieldVisible = React94__default.useCallback(
44426
+ const isFieldVisible = React98__default.useCallback(
44358
44427
  (fieldName) => {
44359
44428
  const condition = conditionalFields[fieldName];
44360
44429
  if (!condition) return true;
@@ -44362,7 +44431,7 @@ var init_Form = __esm({
44362
44431
  },
44363
44432
  [conditionalFields, evalContext]
44364
44433
  );
44365
- const isSectionVisible = React94__default.useCallback(
44434
+ const isSectionVisible = React98__default.useCallback(
44366
44435
  (section) => {
44367
44436
  if (!section.condition) return true;
44368
44437
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -44438,7 +44507,7 @@ var init_Form = __esm({
44438
44507
  eventBus.emit(`UI:${onCancel}`);
44439
44508
  }
44440
44509
  };
44441
- const renderField = React94__default.useCallback(
44510
+ const renderField = React98__default.useCallback(
44442
44511
  (field) => {
44443
44512
  const fieldName = field.name || field.field;
44444
44513
  if (!fieldName) return null;
@@ -44459,7 +44528,7 @@ var init_Form = __esm({
44459
44528
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
44460
44529
  );
44461
44530
  const effectiveFields = entityDerivedFields ?? fields;
44462
- const normalizedFields = React94__default.useMemo(() => {
44531
+ const normalizedFields = React98__default.useMemo(() => {
44463
44532
  if (!effectiveFields || effectiveFields.length === 0) return [];
44464
44533
  return effectiveFields.map((field) => {
44465
44534
  if (typeof field === "string") {
@@ -44469,6 +44538,7 @@ var init_Form = __esm({
44469
44538
  name: field,
44470
44539
  type: entityField.type,
44471
44540
  required: entityField.required,
44541
+ // EntityField.default is typed `unknown` upstream — safe cast: schema defaults are always FieldValues.
44472
44542
  defaultValue: entityField.default,
44473
44543
  // EntityField is a discriminated union — `values` lives on Scalar/Enum, `relation` lives on Relation.
44474
44544
  values: "values" in entityField ? entityField.values : void 0,
@@ -44482,7 +44552,7 @@ var init_Form = __esm({
44482
44552
  return field;
44483
44553
  });
44484
44554
  }, [effectiveFields, resolvedEntity]);
44485
- const schemaFields = React94__default.useMemo(() => {
44555
+ const schemaFields = React98__default.useMemo(() => {
44486
44556
  if (normalizedFields.length === 0) return null;
44487
44557
  if (isDebugEnabled()) {
44488
44558
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -44492,7 +44562,7 @@ var init_Form = __esm({
44492
44562
  }
44493
44563
  return normalizedFields.map(renderField).filter(Boolean);
44494
44564
  }, [normalizedFields, renderField, entityName, conditionalFields]);
44495
- const sectionElements = React94__default.useMemo(() => {
44565
+ const sectionElements = React98__default.useMemo(() => {
44496
44566
  if (!sections || sections.length === 0) return null;
44497
44567
  return sections.map((section) => {
44498
44568
  if (!isSectionVisible(section)) {
@@ -46748,6 +46818,14 @@ var init_GameBoard3D = __esm({
46748
46818
  GameBoard3D.displayName = "GameBoard3D";
46749
46819
  }
46750
46820
  });
46821
+ function asDescriptor(v) {
46822
+ if (Array.isArray(v) || React98__default.isValidElement(v)) return null;
46823
+ const o = v;
46824
+ if (typeof o.type !== "string") return null;
46825
+ const props = o.props !== void 0 && typeof o.props === "object" && !Array.isArray(o.props) && o.props !== null ? o.props : void 0;
46826
+ const _id = typeof o._id === "string" ? o._id : void 0;
46827
+ return { type: o.type, props, _id };
46828
+ }
46751
46829
  function getSlotContentRenderer2() {
46752
46830
  if (_scr) return _scr;
46753
46831
  const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
@@ -46756,17 +46834,16 @@ function getSlotContentRenderer2() {
46756
46834
  }
46757
46835
  function resolveDescriptor(value, idPrefix) {
46758
46836
  if (value === null || value === void 0) return value;
46759
- if (React94__default.isValidElement(value)) return value;
46837
+ if (React98__default.isValidElement(value)) return value;
46760
46838
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
46761
46839
  if (Array.isArray(value)) {
46762
- return value.map((item, i) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
46840
+ return value.map((item, i) => /* @__PURE__ */ jsx(React98__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
46763
46841
  }
46764
- if (typeof value === "object") {
46765
- const rec = value;
46766
- if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
46767
- const { type, props: nestedProps, _id, ...flatProps } = rec;
46768
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46769
- const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
46842
+ if (typeof value === "object" && value !== null) {
46843
+ const desc = asDescriptor(value);
46844
+ if (desc !== null && getComponentForPattern(desc.type) !== null) {
46845
+ const resolvedProps = desc.props ?? {};
46846
+ const content = { id: desc._id ?? idPrefix, pattern: desc.type, props: resolvedProps, priority: 0 };
46770
46847
  const SCR = getSlotContentRenderer2();
46771
46848
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
46772
46849
  }
@@ -46860,16 +46937,19 @@ function getSlotContentRenderer3() {
46860
46937
  }
46861
46938
  function resolveDescriptor2(value, idPrefix) {
46862
46939
  if (value === null || value === void 0) return value;
46863
- if (React94__default.isValidElement(value)) return value;
46940
+ if (React98__default.isValidElement(value)) return value;
46864
46941
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
46865
46942
  if (Array.isArray(value)) {
46866
- return value.map((item, i) => /* @__PURE__ */ jsx(React94__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
46943
+ return value.map((item, i) => /* @__PURE__ */ jsx(React98__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
46867
46944
  }
46868
46945
  if (typeof value === "object") {
46869
46946
  const rec = value;
46870
46947
  if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
46871
- const { type, props: nestedProps, _id, ...flatProps } = rec;
46872
- const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46948
+ const type = rec.type;
46949
+ const _id = typeof rec._id === "string" ? rec._id : void 0;
46950
+ const nestedProps = rec.props !== void 0 && typeof rec.props === "object" && !Array.isArray(rec.props) && rec.props !== null ? rec.props : void 0;
46951
+ const { type: _t, props: _p, _id: _d, ...flatRest } = rec;
46952
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatRest;
46873
46953
  const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
46874
46954
  const SCR = getSlotContentRenderer3();
46875
46955
  return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
@@ -47573,7 +47653,7 @@ var init_List = __esm({
47573
47653
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
47574
47654
  return [];
47575
47655
  }, [entity]);
47576
- const getItemActions = React94__default.useCallback(
47656
+ const getItemActions = React98__default.useCallback(
47577
47657
  (item) => {
47578
47658
  if (!itemActions) return [];
47579
47659
  if (typeof itemActions === "function") {
@@ -47630,15 +47710,14 @@ var init_List = __esm({
47630
47710
  };
47631
47711
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
47632
47712
  const firstField = effectiveFieldNames[0];
47633
- const itemRecord = item;
47634
- if (!normalizedItem.title && getNestedValue(itemRecord, firstField)) {
47713
+ if (!normalizedItem.title && getNestedValue(item, firstField)) {
47635
47714
  normalizedItem.title = String(
47636
- getNestedValue(itemRecord, firstField)
47715
+ getNestedValue(item, firstField)
47637
47716
  );
47638
47717
  }
47639
47718
  normalizedItem._fields = effectiveFieldNames.reduce(
47640
47719
  (acc, field) => {
47641
- const value = getNestedValue(itemRecord, field);
47720
+ const value = getNestedValue(item, field);
47642
47721
  if (value !== void 0 && value !== null) {
47643
47722
  acc[field] = value;
47644
47723
  }
@@ -48091,16 +48170,18 @@ var init_MediaGallery = __esm({
48091
48170
  [selectable, selectedItems, selectionEvent, eventBus]
48092
48171
  );
48093
48172
  const entityData = Array.isArray(entity) ? entity : [];
48094
- const items = React94__default.useMemo(() => {
48173
+ const items = React98__default.useMemo(() => {
48095
48174
  if (propItems) return propItems;
48096
48175
  if (entityData.length === 0) return [];
48097
- return entityData.map((record, idx) => ({
48098
- id: String(record.id ?? idx),
48099
- src: String(record.src ?? record.url ?? record.image ?? ""),
48100
- alt: record.alt ? String(record.alt) : void 0,
48101
- thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
48102
- caption: record.caption ? String(record.caption) : record.title ? String(record.title) : void 0
48103
- }));
48176
+ return entityData.map((record, idx) => {
48177
+ return {
48178
+ id: String(record.id ?? idx),
48179
+ src: String(record.src ?? ("url" in record ? record.url : "") ?? ("image" in record ? record.image : "") ?? ""),
48180
+ alt: record.alt ? String(record.alt) : void 0,
48181
+ thumbnail: record.thumbnail ? String(record.thumbnail) : void 0,
48182
+ caption: record.caption ? String(record.caption) : "title" in record ? String(record.title) : void 0
48183
+ };
48184
+ });
48104
48185
  }, [propItems, entityData]);
48105
48186
  if (isLoading) {
48106
48187
  return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
@@ -48294,7 +48375,7 @@ var init_MinigolfBoard = __esm({
48294
48375
  }
48295
48376
  });
48296
48377
  function extractTitle2(children) {
48297
- if (!React94__default.isValidElement(children)) return void 0;
48378
+ if (!React98__default.isValidElement(children)) return void 0;
48298
48379
  const props = children.props;
48299
48380
  if (typeof props.title === "string") {
48300
48381
  return props.title;
@@ -48360,8 +48441,16 @@ function NegotiatorBoard({
48360
48441
  const lastPlayerAction = str(resolved?.lastPlayerAction);
48361
48442
  const lastOpponentAction = str(resolved?.lastOpponentAction);
48362
48443
  const lastPayoff = num(resolved?.lastPayoff);
48363
- const actions = Array.isArray(resolved?.actions) ? resolved.actions : [];
48364
- const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix : [];
48444
+ const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
48445
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
48446
+ return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
48447
+ return [];
48448
+ }) : [];
48449
+ const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
48450
+ if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
48451
+ return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
48452
+ return [];
48453
+ }) : [];
48365
48454
  const prevRoundRef = useRef(currentRound);
48366
48455
  useEffect(() => {
48367
48456
  if (currentRound > prevRoundRef.current && lastPlayerAction) {
@@ -49487,7 +49576,7 @@ var init_debugRegistry = __esm({
49487
49576
  }
49488
49577
  });
49489
49578
  function useDebugData() {
49490
- const [data, setData] = React94.useState(() => ({
49579
+ const [data, setData] = React98.useState(() => ({
49491
49580
  traits: [],
49492
49581
  ticks: [],
49493
49582
  guards: [],
@@ -49501,7 +49590,7 @@ function useDebugData() {
49501
49590
  },
49502
49591
  lastUpdate: Date.now()
49503
49592
  }));
49504
- React94.useEffect(() => {
49593
+ React98.useEffect(() => {
49505
49594
  const updateData = () => {
49506
49595
  setData({
49507
49596
  traits: getAllTraits(),
@@ -49610,12 +49699,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
49610
49699
  return positions;
49611
49700
  }
49612
49701
  function WalkMinimap() {
49613
- const [walkStep, setWalkStep] = React94.useState(null);
49614
- const [traits2, setTraits] = React94.useState([]);
49615
- const [coveredEdges, setCoveredEdges] = React94.useState([]);
49616
- const [completedTraits, setCompletedTraits] = React94.useState(/* @__PURE__ */ new Set());
49617
- const prevTraitRef = React94.useRef(null);
49618
- React94.useEffect(() => {
49702
+ const [walkStep, setWalkStep] = React98.useState(null);
49703
+ const [traits2, setTraits] = React98.useState([]);
49704
+ const [coveredEdges, setCoveredEdges] = React98.useState([]);
49705
+ const [completedTraits, setCompletedTraits] = React98.useState(/* @__PURE__ */ new Set());
49706
+ const prevTraitRef = React98.useRef(null);
49707
+ React98.useEffect(() => {
49619
49708
  const interval = setInterval(() => {
49620
49709
  const w = window;
49621
49710
  const step = w.__orbitalWalkStep;
@@ -50051,15 +50140,15 @@ var init_EntitiesTab = __esm({
50051
50140
  });
50052
50141
  function EventFlowTab({ events: events2 }) {
50053
50142
  const { t } = useTranslate();
50054
- const [filter, setFilter] = React94.useState("all");
50055
- const containerRef = React94.useRef(null);
50056
- const [autoScroll, setAutoScroll] = React94.useState(true);
50057
- React94.useEffect(() => {
50143
+ const [filter, setFilter] = React98.useState("all");
50144
+ const containerRef = React98.useRef(null);
50145
+ const [autoScroll, setAutoScroll] = React98.useState(true);
50146
+ React98.useEffect(() => {
50058
50147
  if (autoScroll && containerRef.current) {
50059
50148
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
50060
50149
  }
50061
50150
  }, [events2.length, autoScroll]);
50062
- const filteredEvents = React94.useMemo(() => {
50151
+ const filteredEvents = React98.useMemo(() => {
50063
50152
  if (filter === "all") return events2;
50064
50153
  return events2.filter((e) => e.type === filter);
50065
50154
  }, [events2, filter]);
@@ -50175,7 +50264,7 @@ var init_EventFlowTab = __esm({
50175
50264
  });
50176
50265
  function GuardsPanel({ guards }) {
50177
50266
  const { t } = useTranslate();
50178
- const [filter, setFilter] = React94.useState("all");
50267
+ const [filter, setFilter] = React98.useState("all");
50179
50268
  if (guards.length === 0) {
50180
50269
  return /* @__PURE__ */ jsx(
50181
50270
  EmptyState,
@@ -50188,7 +50277,7 @@ function GuardsPanel({ guards }) {
50188
50277
  }
50189
50278
  const passedCount = guards.filter((g) => g.result).length;
50190
50279
  const failedCount = guards.length - passedCount;
50191
- const filteredGuards = React94.useMemo(() => {
50280
+ const filteredGuards = React98.useMemo(() => {
50192
50281
  if (filter === "all") return guards;
50193
50282
  if (filter === "passed") return guards.filter((g) => g.result);
50194
50283
  return guards.filter((g) => !g.result);
@@ -50351,10 +50440,10 @@ function EffectBadge({ effect }) {
50351
50440
  }
50352
50441
  function TransitionTimeline({ transitions }) {
50353
50442
  const { t } = useTranslate();
50354
- const containerRef = React94.useRef(null);
50355
- const [autoScroll, setAutoScroll] = React94.useState(true);
50356
- const [expandedId, setExpandedId] = React94.useState(null);
50357
- React94.useEffect(() => {
50443
+ const containerRef = React98.useRef(null);
50444
+ const [autoScroll, setAutoScroll] = React98.useState(true);
50445
+ const [expandedId, setExpandedId] = React98.useState(null);
50446
+ React98.useEffect(() => {
50358
50447
  if (autoScroll && containerRef.current) {
50359
50448
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
50360
50449
  }
@@ -50560,18 +50649,18 @@ var init_ServerBridgeTab = __esm({
50560
50649
  });
50561
50650
  function extractPayloadFields(schema, eventName) {
50562
50651
  if (!schema) return [];
50563
- const orbitals = schema.orbitals;
50564
- if (!orbitals) return [];
50565
- for (const orbital of orbitals) {
50566
- const traits2 = orbital.traits ?? [];
50567
- for (const trait of traits2) {
50568
- const sm = trait.stateMachine;
50652
+ for (const orbital of schema.orbitals) {
50653
+ const traitRefs = orbital.traits ?? [];
50654
+ for (const traitRef of traitRefs) {
50655
+ if (!isInlineTrait(traitRef)) continue;
50656
+ const inlineTrait = traitRef;
50657
+ const sm = inlineTrait.stateMachine;
50569
50658
  if (!sm) continue;
50570
50659
  const events2 = sm.events ?? [];
50571
50660
  for (const evt of events2) {
50572
50661
  if (evt.name !== eventName) continue;
50573
- const payload = evt.payload ?? [];
50574
- return payload.map((f3) => ({
50662
+ const payloadFields = evt.payloadSchema ?? [];
50663
+ return payloadFields.map((f3) => ({
50575
50664
  name: f3.name,
50576
50665
  type: f3.type ?? "string"
50577
50666
  }));
@@ -50634,9 +50723,9 @@ function getAllEvents(traits2) {
50634
50723
  function EventDispatcherTab({ traits: traits2, schema }) {
50635
50724
  const eventBus = useEventBus();
50636
50725
  const { t } = useTranslate();
50637
- const [log15, setLog] = React94.useState([]);
50638
- const prevStatesRef = React94.useRef(/* @__PURE__ */ new Map());
50639
- React94.useEffect(() => {
50726
+ const [log15, setLog] = React98.useState([]);
50727
+ const prevStatesRef = React98.useRef(/* @__PURE__ */ new Map());
50728
+ React98.useEffect(() => {
50640
50729
  for (const trait of traits2) {
50641
50730
  const prev = prevStatesRef.current.get(trait.id);
50642
50731
  if (prev && prev !== trait.currentState) {
@@ -50805,10 +50894,10 @@ function VerifyModePanel({
50805
50894
  localCount
50806
50895
  }) {
50807
50896
  const { t } = useTranslate();
50808
- const [expanded, setExpanded] = React94.useState(true);
50809
- const scrollRef = React94.useRef(null);
50810
- const prevCountRef = React94.useRef(0);
50811
- React94.useEffect(() => {
50897
+ const [expanded, setExpanded] = React98.useState(true);
50898
+ const scrollRef = React98.useRef(null);
50899
+ const prevCountRef = React98.useRef(0);
50900
+ React98.useEffect(() => {
50812
50901
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
50813
50902
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
50814
50903
  }
@@ -50865,10 +50954,10 @@ function RuntimeDebugger({
50865
50954
  schema
50866
50955
  }) {
50867
50956
  const { t } = useTranslate();
50868
- const [isCollapsed, setIsCollapsed] = React94.useState(mode === "verify" ? true : defaultCollapsed);
50869
- const [isVisible, setIsVisible] = React94.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
50957
+ const [isCollapsed, setIsCollapsed] = React98.useState(mode === "verify" ? true : defaultCollapsed);
50958
+ const [isVisible, setIsVisible] = React98.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
50870
50959
  const debugData = useDebugData();
50871
- React94.useEffect(() => {
50960
+ React98.useEffect(() => {
50872
50961
  if (mode === "inline") return;
50873
50962
  return onDebugToggle((enabled) => {
50874
50963
  setIsVisible(enabled);
@@ -50877,7 +50966,7 @@ function RuntimeDebugger({
50877
50966
  }
50878
50967
  });
50879
50968
  }, [mode]);
50880
- React94.useEffect(() => {
50969
+ React98.useEffect(() => {
50881
50970
  if (mode === "inline") return;
50882
50971
  const handleKeyDown = (e) => {
50883
50972
  if (e.key === "`" && isVisible) {
@@ -51437,7 +51526,7 @@ function SequenceBar({
51437
51526
  onSlotRemove(index);
51438
51527
  }, [onSlotRemove, playing]);
51439
51528
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
51440
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
51529
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
51441
51530
  i > 0 && /* @__PURE__ */ jsx(
51442
51531
  Typography,
51443
51532
  {
@@ -52052,6 +52141,29 @@ var init_SimulationCanvas = __esm({
52052
52141
  SimulationCanvas.displayName = "SimulationCanvas";
52053
52142
  }
52054
52143
  });
52144
+ function readSimulatorParameters(v) {
52145
+ if (!Array.isArray(v)) return [];
52146
+ const result = [];
52147
+ for (const item of v) {
52148
+ if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
52149
+ const param = item;
52150
+ if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
52151
+ result.push({
52152
+ id: str(param.id),
52153
+ label: str(param.label),
52154
+ unit: str(param.unit),
52155
+ min: num(param.min),
52156
+ max: num(param.max),
52157
+ step: num(param.step),
52158
+ initial: num(param.initial),
52159
+ correct: num(param.correct),
52160
+ tolerance: num(param.tolerance)
52161
+ });
52162
+ }
52163
+ }
52164
+ }
52165
+ return result;
52166
+ }
52055
52167
  function SimulatorBoard({
52056
52168
  entity,
52057
52169
  completeEvent = "PUZZLE_COMPLETE",
@@ -52064,7 +52176,7 @@ function SimulatorBoard({
52064
52176
  const { emit } = useEventBus();
52065
52177
  const { t } = useTranslate();
52066
52178
  const resolved = boardEntity(entity);
52067
- const parameters = Array.isArray(resolved?.parameters) ? resolved.parameters : [];
52179
+ const parameters = readSimulatorParameters(resolved?.parameters);
52068
52180
  const [headerError, setHeaderError] = useState(false);
52069
52181
  if (!resolved) return null;
52070
52182
  const paramA = num(resolved.paramA);
@@ -52091,8 +52203,14 @@ function SimulatorBoard({
52091
52203
  const handlePlayAgain = () => {
52092
52204
  if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
52093
52205
  };
52094
- const theme = resolved.theme ?? void 0;
52095
- const themeBackground = theme?.background;
52206
+ const themeBackground = (() => {
52207
+ const t2 = resolved.theme;
52208
+ if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
52209
+ const bg = t2.background;
52210
+ return str(bg);
52211
+ }
52212
+ return "";
52213
+ })();
52096
52214
  const headerImage = str(resolved.headerImage);
52097
52215
  const hint = str(resolved.hint);
52098
52216
  const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
@@ -52497,7 +52615,7 @@ var init_StatCard = __esm({
52497
52615
  const labelToUse = propLabel ?? propTitle;
52498
52616
  const eventBus = useEventBus();
52499
52617
  const { t } = useTranslate();
52500
- const handleActionClick = React94__default.useCallback(() => {
52618
+ const handleActionClick = React98__default.useCallback(() => {
52501
52619
  if (action?.event) {
52502
52620
  eventBus.emit(`UI:${action.event}`, {});
52503
52621
  }
@@ -52508,7 +52626,7 @@ var init_StatCard = __esm({
52508
52626
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
52509
52627
  const isLoading = externalLoading ?? false;
52510
52628
  const error = externalError;
52511
- const computeMetricValue = React94__default.useCallback(
52629
+ const computeMetricValue = React98__default.useCallback(
52512
52630
  (metric, items) => {
52513
52631
  if (metric.value !== void 0) {
52514
52632
  return metric.value;
@@ -52547,7 +52665,7 @@ var init_StatCard = __esm({
52547
52665
  },
52548
52666
  []
52549
52667
  );
52550
- const schemaStats = React94__default.useMemo(() => {
52668
+ const schemaStats = React98__default.useMemo(() => {
52551
52669
  if (!metrics || metrics.length === 0) return null;
52552
52670
  return metrics.map((metric) => ({
52553
52671
  label: metric.label,
@@ -52555,7 +52673,7 @@ var init_StatCard = __esm({
52555
52673
  format: metric.format
52556
52674
  }));
52557
52675
  }, [metrics, data, computeMetricValue]);
52558
- const calculatedTrend = React94__default.useMemo(() => {
52676
+ const calculatedTrend = React98__default.useMemo(() => {
52559
52677
  if (manualTrend !== void 0) return manualTrend;
52560
52678
  if (previousValue === void 0 || currentValue === void 0)
52561
52679
  return void 0;
@@ -52898,8 +53016,25 @@ function StateArchitectBoard({
52898
53016
  const initialState = str(resolved?.initialState);
52899
53017
  const entityName = str(resolved?.entityName);
52900
53018
  const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
52901
- const testCases = Array.isArray(resolved?.testCases) ? resolved.testCases : [];
52902
- const entityTransitions = Array.isArray(resolved?.transitions) ? resolved.transitions : [];
53019
+ const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
53020
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
53021
+ const eventsField = o["events"];
53022
+ return {
53023
+ events: Array.isArray(eventsField) ? eventsField : [],
53024
+ expectedState: str(o["expectedState"]),
53025
+ label: str(o["label"])
53026
+ };
53027
+ });
53028
+ const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
53029
+ const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
53030
+ return {
53031
+ id: str(o["id"]),
53032
+ from: str(o["from"]),
53033
+ to: str(o["to"]),
53034
+ event: str(o["event"]),
53035
+ ...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
53036
+ };
53037
+ });
52903
53038
  const entityVariables = rows(resolved?.variables);
52904
53039
  const transitions = entityTransitions;
52905
53040
  const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
@@ -53744,8 +53879,8 @@ var init_SubagentTracePanel = __esm({
53744
53879
  ] });
53745
53880
  };
53746
53881
  InlineActivityStream = ({ activities, autoScroll = true, className }) => {
53747
- const endRef = React94__default.useRef(null);
53748
- React94__default.useEffect(() => {
53882
+ const endRef = React98__default.useRef(null);
53883
+ React98__default.useEffect(() => {
53749
53884
  if (!autoScroll) return;
53750
53885
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
53751
53886
  }, [activities.length, autoScroll]);
@@ -53839,7 +53974,7 @@ var init_SubagentTracePanel = __esm({
53839
53974
  };
53840
53975
  SubagentRichCard = ({ subagent }) => {
53841
53976
  const { t } = useTranslate();
53842
- const activities = React94__default.useMemo(
53977
+ const activities = React98__default.useMemo(
53843
53978
  () => subagentMessagesToActivities(subagent.messages),
53844
53979
  [subagent.messages]
53845
53980
  );
@@ -53916,8 +54051,8 @@ var init_SubagentTracePanel = __esm({
53916
54051
  ] });
53917
54052
  };
53918
54053
  CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
53919
- const endRef = React94__default.useRef(null);
53920
- React94__default.useEffect(() => {
54054
+ const endRef = React98__default.useRef(null);
54055
+ React98__default.useEffect(() => {
53921
54056
  if (!autoScroll) return;
53922
54057
  endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
53923
54058
  }, [messages.length, autoScroll]);
@@ -54388,17 +54523,12 @@ var init_Timeline = __esm({
54388
54523
  look = "vertical-spacious"
54389
54524
  }) => {
54390
54525
  const { t } = useTranslate();
54391
- const entityData = Array.isArray(entity) ? entity : [];
54392
- const items = React94__default.useMemo(() => {
54526
+ const entityData = entity ?? [];
54527
+ const items = React98__default.useMemo(() => {
54393
54528
  if (propItems) return propItems;
54394
54529
  if (entityData.length === 0) return [];
54395
54530
  return entityData.map((record, idx) => {
54396
- const resolveField = (f3) => {
54397
- if (typeof f3 === "string") return f3;
54398
- if (f3 && typeof f3 === "object" && "name" in f3) return String(f3.name);
54399
- return "";
54400
- };
54401
- const resolvedFields = fields?.map(resolveField) ?? [];
54531
+ const resolvedFields = fields ?? [];
54402
54532
  const titleField = resolvedFields[0] || "title";
54403
54533
  const descField = resolvedFields[1] || "description";
54404
54534
  const dateField = resolvedFields.find(
@@ -54496,7 +54626,7 @@ var init_Timeline = __esm({
54496
54626
  }
54497
54627
  });
54498
54628
  function extractToastProps(children) {
54499
- if (!React94__default.isValidElement(children)) {
54629
+ if (!React98__default.isValidElement(children)) {
54500
54630
  if (typeof children === "string") {
54501
54631
  return { message: children };
54502
54632
  }
@@ -54534,7 +54664,7 @@ var init_ToastSlot = __esm({
54534
54664
  eventBus.emit("UI:CLOSE");
54535
54665
  };
54536
54666
  if (!isVisible) return null;
54537
- const isCustomContent = React94__default.isValidElement(children) && !message;
54667
+ const isCustomContent = React98__default.isValidElement(children) && !message;
54538
54668
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
54539
54669
  Toast,
54540
54670
  {
@@ -55806,7 +55936,7 @@ function WorldMapBoard({
55806
55936
  const resolved = boardEntity(entity);
55807
55937
  const entityUnits = rows(resolved?.units);
55808
55938
  const entityTiles = rows(resolved?.tiles);
55809
- const features = propFeatures ?? (Array.isArray(resolved?.features) ? resolved.features : []);
55939
+ const features = propFeatures ?? rows(resolved?.features);
55810
55940
  const selectedHeroId = resolved?.selectedHeroId ?? null;
55811
55941
  const assetManifest = propAssetManifest ?? resolved?.assetManifest;
55812
55942
  const backgroundImage = resolved?.backgroundImage;
@@ -55939,7 +56069,8 @@ function WorldMapBoard({
55939
56069
  if (heroMoveEvent) {
55940
56070
  eventBus.emit(`UI:${heroMoveEvent}`, { heroId, toX: x, toY: y });
55941
56071
  }
55942
- const feature = tile ? str(tile.feature) : "";
56072
+ const tileWithFeature = tile;
56073
+ const feature = tileWithFeature ? str(tileWithFeature.feature) : "";
55943
56074
  if (feature && feature !== "none") {
55944
56075
  const tileRow = tile;
55945
56076
  onFeatureEnter?.(heroId, tileRow);
@@ -56150,7 +56281,7 @@ var init_WorldMapTemplate = __esm({
56150
56281
  }
56151
56282
  });
56152
56283
  function lazyThree(name, loader) {
56153
- const Lazy = React94__default.lazy(
56284
+ const Lazy = React98__default.lazy(
56154
56285
  () => loader().then((m) => {
56155
56286
  const Resolved = m[name];
56156
56287
  if (!Resolved) {
@@ -56162,13 +56293,13 @@ function lazyThree(name, loader) {
56162
56293
  })
56163
56294
  );
56164
56295
  function ThreeWrapper(props) {
56165
- return React94__default.createElement(
56296
+ return React98__default.createElement(
56166
56297
  ThreeBoundary,
56167
56298
  { name },
56168
- React94__default.createElement(
56169
- React94__default.Suspense,
56299
+ React98__default.createElement(
56300
+ React98__default.Suspense,
56170
56301
  { fallback: null },
56171
- React94__default.createElement(Lazy, props)
56302
+ React98__default.createElement(Lazy, props)
56172
56303
  )
56173
56304
  );
56174
56305
  }
@@ -56491,7 +56622,7 @@ var init_component_registry_generated = __esm({
56491
56622
  init_WorldMapBoard();
56492
56623
  init_WorldMapTemplate();
56493
56624
  init_XPBar();
56494
- ThreeBoundary = class extends React94__default.Component {
56625
+ ThreeBoundary = class extends React98__default.Component {
56495
56626
  constructor() {
56496
56627
  super(...arguments);
56497
56628
  __publicField(this, "state", { failed: false });
@@ -56501,7 +56632,7 @@ var init_component_registry_generated = __esm({
56501
56632
  }
56502
56633
  render() {
56503
56634
  if (this.state.failed) {
56504
- return React94__default.createElement(
56635
+ return React98__default.createElement(
56505
56636
  "div",
56506
56637
  {
56507
56638
  "data-testid": "three-unavailable",
@@ -56867,7 +56998,7 @@ function SuspenseConfigProvider({
56867
56998
  config,
56868
56999
  children
56869
57000
  }) {
56870
- return React94__default.createElement(
57001
+ return React98__default.createElement(
56871
57002
  SuspenseConfigContext.Provider,
56872
57003
  { value: config },
56873
57004
  children
@@ -56883,9 +57014,7 @@ function getComponentForPattern3(patternType) {
56883
57014
  if (!mapping) {
56884
57015
  return null;
56885
57016
  }
56886
- const name = typeof mapping === "string" ? mapping : mapping.component;
56887
- if (!name) return null;
56888
- return COMPONENT_REGISTRY[name] ?? null;
57017
+ return COMPONENT_REGISTRY[mapping] ?? null;
56889
57018
  }
56890
57019
  function enrichFormFields(fields, entityDef) {
56891
57020
  const fieldMap = new Map(entityDef.fields.map((f3) => [f3.name, f3]));
@@ -56897,7 +57026,7 @@ function enrichFormFields(fields, entityDef) {
56897
57026
  name: field,
56898
57027
  label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()),
56899
57028
  type: entityField.type,
56900
- required: entityField.required
57029
+ required: entityField.required ?? false
56901
57030
  };
56902
57031
  if (entityField.values && entityField.values.length > 0) {
56903
57032
  enriched.values = entityField.values;
@@ -56905,15 +57034,15 @@ function enrichFormFields(fields, entityDef) {
56905
57034
  enriched.values = entityField.enumValues;
56906
57035
  }
56907
57036
  if (entityField.relation) {
56908
- enriched.relation = entityField.relation;
57037
+ enriched.relation = entityField.relation.entity;
56909
57038
  }
56910
57039
  return enriched;
56911
57040
  }
56912
57041
  return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
56913
57042
  }
56914
- if (field && typeof field === "object" && !Array.isArray(field)) {
57043
+ if (field && typeof field === "object" && !Array.isArray(field) && !React98__default.isValidElement(field) && !(field instanceof Date)) {
56915
57044
  const obj = field;
56916
- const fieldName = obj.name ?? obj.field;
57045
+ const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
56917
57046
  if (!fieldName) return field;
56918
57047
  if (obj.type || obj.inputType) return field;
56919
57048
  const entityField = fieldMap.get(fieldName);
@@ -56930,7 +57059,7 @@ function enrichFormFields(fields, entityDef) {
56930
57059
  }
56931
57060
  }
56932
57061
  if (!obj.relation && entityField.relation) {
56933
- enriched.relation = entityField.relation;
57062
+ enriched.relation = entityField.relation.entity;
56934
57063
  }
56935
57064
  return enriched;
56936
57065
  }
@@ -57357,7 +57486,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
57357
57486
  const key = `${parentId}-${index}-trait:${traitName}`;
57358
57487
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
57359
57488
  }
57360
- return /* @__PURE__ */ jsx(React94__default.Fragment, { children: child }, `${parentId}-${index}`);
57489
+ return /* @__PURE__ */ jsx(React98__default.Fragment, { children: child }, `${parentId}-${index}`);
57361
57490
  }
57362
57491
  if (!child || typeof child !== "object") return null;
57363
57492
  const childId = `${parentId}-${index}`;
@@ -57397,14 +57526,14 @@ function isPatternConfig(value) {
57397
57526
  if (value === null || value === void 0) return false;
57398
57527
  if (typeof value !== "object") return false;
57399
57528
  if (Array.isArray(value)) return false;
57400
- if (React94__default.isValidElement(value)) return false;
57529
+ if (React98__default.isValidElement(value)) return false;
57401
57530
  if (value instanceof Date) return false;
57402
57531
  if (typeof value === "function") return false;
57403
57532
  const record = value;
57404
57533
  return "type" in record && typeof record.type === "string" && getComponentForPattern(record.type) !== null;
57405
57534
  }
57406
57535
  function isPlainConfigObject(value) {
57407
- if (React94__default.isValidElement(value)) return false;
57536
+ if (React98__default.isValidElement(value)) return false;
57408
57537
  if (value instanceof Date) return false;
57409
57538
  const proto = Object.getPrototypeOf(value);
57410
57539
  return proto === Object.prototype || proto === null;
@@ -57530,7 +57659,7 @@ function SlotContentRenderer({
57530
57659
  for (const slotKey of CONTENT_NODE_SLOTS) {
57531
57660
  const slotVal = restProps[slotKey];
57532
57661
  if (slotVal === void 0 || slotVal === null) continue;
57533
- if (React94__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
57662
+ if (React98__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
57534
57663
  if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
57535
57664
  nodeSlotOverrides[slotKey] = renderPatternChildren(
57536
57665
  slotVal,
@@ -57575,19 +57704,18 @@ function SlotContentRenderer({
57575
57704
  for (const [k, v] of Object.entries(nodeSlotOverrides)) {
57576
57705
  finalProps[k] = v;
57577
57706
  }
57578
- const resolvedItems = Array.isArray(
57579
- finalProps.entity
57580
- ) ? finalProps.entity : null;
57707
+ const entityVal = finalProps.entity;
57708
+ const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
57581
57709
  if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
57582
57710
  const sample = resolvedItems[0];
57583
- if (sample && typeof sample === "object") {
57711
+ if (sample && typeof sample === "object" && !Array.isArray(sample) && !React98__default.isValidElement(sample) && !(sample instanceof Date)) {
57584
57712
  const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
57585
57713
  finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
57586
57714
  }
57587
57715
  }
57588
57716
  const isFormPattern = FORM_PATTERNS.has(content.pattern) || content.pattern.includes("form");
57589
- if (isFormPattern && entityDef && Array.isArray(finalProps.fields)) {
57590
- finalProps.fields = enrichFormFields(finalProps.fields, entityDef);
57717
+ if (isFormPattern && entityDef && Array.isArray(finalProps.fields) && finalProps.fields[0] !== "fn") {
57718
+ finalProps.fields = enrichFormFields([...finalProps.fields], entityDef);
57591
57719
  }
57592
57720
  const acceptsChildren = PATTERNS_WITH_CHILDREN.has(content.pattern);
57593
57721
  return /* @__PURE__ */ jsx(
@@ -57943,7 +58071,7 @@ var AvlTransition = ({
57943
58071
  opacity = 1,
57944
58072
  className
57945
58073
  }) => {
57946
- const ids = React94__default.useMemo(() => {
58074
+ const ids = React98__default.useMemo(() => {
57947
58075
  avlTransitionId += 1;
57948
58076
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
57949
58077
  }, []);
@@ -58504,7 +58632,7 @@ var AvlStateMachine = ({
58504
58632
  color = "var(--color-primary)",
58505
58633
  animated = false
58506
58634
  }) => {
58507
- const ids = React94__default.useMemo(() => {
58635
+ const ids = React98__default.useMemo(() => {
58508
58636
  avlSmId += 1;
58509
58637
  const base = `avl-sm-${avlSmId}`;
58510
58638
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -58703,7 +58831,7 @@ var AvlOrbitalUnit = ({
58703
58831
  color = "var(--color-primary)",
58704
58832
  animated = false
58705
58833
  }) => {
58706
- const ids = React94__default.useMemo(() => {
58834
+ const ids = React98__default.useMemo(() => {
58707
58835
  avlOuId += 1;
58708
58836
  const base = `avl-ou-${avlOuId}`;
58709
58837
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -58799,7 +58927,7 @@ var AvlClosedCircuit = ({
58799
58927
  color = "var(--color-primary)",
58800
58928
  animated = false
58801
58929
  }) => {
58802
- const ids = React94__default.useMemo(() => {
58930
+ const ids = React98__default.useMemo(() => {
58803
58931
  avlCcId += 1;
58804
58932
  const base = `avl-cc-${avlCcId}`;
58805
58933
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -58954,7 +59082,7 @@ var AvlEmitListen = ({
58954
59082
  color = "var(--color-primary)",
58955
59083
  animated = false
58956
59084
  }) => {
58957
- const ids = React94__default.useMemo(() => {
59085
+ const ids = React98__default.useMemo(() => {
58958
59086
  avlElId += 1;
58959
59087
  const base = `avl-el-${avlElId}`;
58960
59088
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -59228,7 +59356,7 @@ function renderNode(node, color, glowId) {
59228
59356
  const baseR = node.type === "operator" ? 20 : 16;
59229
59357
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
59230
59358
  const nc = nodeColor(node.type, color);
59231
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
59359
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
59232
59360
  node.children.map((child, i) => {
59233
59361
  const childR = Math.max(
59234
59362
  child.type === "operator" ? 20 : 16,
@@ -59285,7 +59413,7 @@ var AvlExprTree = ({
59285
59413
  className,
59286
59414
  color = "var(--color-primary)"
59287
59415
  }) => {
59288
- const ids = React94__default.useMemo(() => {
59416
+ const ids = React98__default.useMemo(() => {
59289
59417
  avlEtId += 1;
59290
59418
  return { glow: `avl-et-${avlEtId}-glow` };
59291
59419
  }, []);
@@ -59750,9 +59878,17 @@ function getEntity(orbital) {
59750
59878
  if (typeof entity === "string") {
59751
59879
  return { name: entity, fields: [], persistence: "runtime" };
59752
59880
  }
59881
+ if ("extends" in entity) {
59882
+ const ec = entity;
59883
+ return {
59884
+ name: ec.name ?? orbital.name,
59885
+ fields: ec.fields ?? [],
59886
+ persistence: ec.persistence ?? "runtime"
59887
+ };
59888
+ }
59753
59889
  const e = entity;
59754
59890
  return {
59755
- name: e.name ?? orbital.name,
59891
+ name: e.name,
59756
59892
  fields: e.fields ?? [],
59757
59893
  persistence: e.persistence ?? "runtime"
59758
59894
  };
@@ -59761,6 +59897,7 @@ function getTraits(orbital) {
59761
59897
  if (!orbital.traits) return [];
59762
59898
  return orbital.traits.map((t) => {
59763
59899
  if (typeof t === "string") return { name: t };
59900
+ if ("ref" in t && !("stateMachine" in t)) return { name: t.name ?? t.ref };
59764
59901
  return t;
59765
59902
  });
59766
59903
  }
@@ -59768,6 +59905,7 @@ function getPages(orbital) {
59768
59905
  if (!orbital.pages) return [];
59769
59906
  return orbital.pages.map((p2) => {
59770
59907
  if (typeof p2 === "string") return { name: p2, path: `/${p2.toLowerCase()}` };
59908
+ if ("ref" in p2 && !("path" in p2)) return { name: p2.ref, path: `/${p2.ref.toLowerCase()}` };
59771
59909
  return p2;
59772
59910
  });
59773
59911
  }
@@ -59786,12 +59924,12 @@ function getEvents(sm) {
59786
59924
  function getEmits(trait) {
59787
59925
  const emits = trait.emits;
59788
59926
  if (!emits) return [];
59789
- return emits.map((e) => typeof e === "string" ? e : e.event ?? e.name ?? "");
59927
+ return emits.map((e) => e.event ?? "");
59790
59928
  }
59791
59929
  function getListens(trait) {
59792
59930
  const listens = trait.listens;
59793
59931
  if (!listens) return [];
59794
- return listens.map((l) => typeof l === "string" ? l : l.event ?? "");
59932
+ return listens.map((l) => l.event ?? "");
59795
59933
  }
59796
59934
  function parseEffectType(effect) {
59797
59935
  if (Array.isArray(effect)) {
@@ -59962,14 +60100,14 @@ function parseTraitLevel(schema, orbitalName, traitName) {
59962
60100
  if (!sm) return null;
59963
60101
  const states = getStates(sm).map((s) => ({
59964
60102
  name: s.name ?? "",
59965
- isInitial: s.isInitial ?? false,
59966
- isTerminal: s.isTerminal ?? false
60103
+ isInitial: s.isInitial ?? null,
60104
+ isTerminal: s.isTerminal ?? null
59967
60105
  }));
59968
60106
  const transitions = getTransitions(sm).map((t, i) => ({
59969
60107
  from: t.from ?? "",
59970
60108
  to: t.to ?? "",
59971
60109
  event: t.event ?? "",
59972
- guard: t.guard,
60110
+ guard: t.guard ?? null,
59973
60111
  effects: (t.effects ?? []).map(parseEffectType),
59974
60112
  index: i
59975
60113
  }));
@@ -59988,13 +60126,14 @@ function parseTransitionLevel(schema, orbitalName, traitName, transitionIndex) {
59988
60126
  if (!traitData) return null;
59989
60127
  const transition = traitData.transitions[transitionIndex];
59990
60128
  if (!transition) return null;
59991
- const guard = transition.guard ? exprToTree(transition.guard) : null;
60129
+ const guardVal = transition.guard;
60130
+ const guard = guardVal != null ? exprToTree(guardVal) : null;
59992
60131
  const effects = transition.effects.map(
59993
60132
  (e) => exprToTree([e.type, ...e.args])
59994
60133
  );
59995
60134
  const slotTargets = transition.effects.filter((e) => e.type === "render-ui").map((e) => ({
59996
60135
  name: String(e.args[0] ?? "main"),
59997
- pattern: typeof e.args[1] === "object" && e.args[1] !== null ? e.args[1].type ?? "unknown" : String(e.args[1] ?? "unknown")
60136
+ pattern: typeof e.args[1] === "object" && e.args[1] !== null && !Array.isArray(e.args[1]) ? e.args[1].type ?? "unknown" : String(e.args[1] ?? "unknown")
59998
60137
  }));
59999
60138
  return {
60000
60139
  from: transition.from,
@@ -60050,8 +60189,8 @@ function schemaToFlowGraph(schema) {
60050
60189
  data: {
60051
60190
  edgeKind: "eventWire",
60052
60191
  event: link.eventName,
60053
- fromTrait: link.emitterTrait,
60054
- toTrait: link.listenerTrait
60192
+ fromTrait: link.emitterTrait ?? null,
60193
+ toTrait: link.listenerTrait ?? null
60055
60194
  }
60056
60195
  });
60057
60196
  }
@@ -60108,9 +60247,9 @@ var SystemNode = ({ data }) => {
60108
60247
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
60109
60248
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
60110
60249
  const tc = transitionCounts[s.name] ?? 0;
60111
- const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
60112
- return /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
60113
- /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
60250
+ const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
60251
+ return /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
60252
+ /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
60114
60253
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
60115
60254
  ] }, s.name);
60116
60255
  }) }),
@@ -60143,17 +60282,17 @@ var DetailView = ({ data }) => {
60143
60282
  transitionCounts[t2.to] = (transitionCounts[t2.to] ?? 0) + 1;
60144
60283
  }
60145
60284
  const maxTC = Math.max(...Object.values(transitionCounts), 0);
60146
- const fromRole = getStateRole(transition.from, fromState?.isInitial, fromState?.isTerminal, transitionCounts[transition.from] ?? 0, maxTC);
60147
- const toRole = getStateRole(transition.to, toState?.isInitial, toState?.isTerminal, transitionCounts[transition.to] ?? 0, maxTC);
60285
+ const fromRole = getStateRole(transition.from, fromState?.isInitial ?? void 0, fromState?.isTerminal ?? void 0, transitionCounts[transition.from] ?? 0, maxTC);
60286
+ const toRole = getStateRole(transition.to, toState?.isInitial ?? void 0, toState?.isTerminal ?? void 0, transitionCounts[transition.to] ?? 0, maxTC);
60148
60287
  const hasGuard = transition.guard != null;
60149
60288
  return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-2 border-[var(--color-border)] bg-[var(--color-card)] overflow-hidden", style: { minWidth: 380, maxWidth: 500 }, children: [
60150
60289
  /* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
60151
- /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.from, role: fromRole, isInitial: fromState?.isInitial, isTerminal: fromState?.isTerminal }) }),
60290
+ /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.from, role: fromRole, isInitial: fromState?.isInitial ?? void 0, isTerminal: fromState?.isTerminal ?? void 0 }) }),
60152
60291
  /* @__PURE__ */ jsxs("svg", { width: 24, height: 16, viewBox: "0 0 24 16", children: [
60153
60292
  /* @__PURE__ */ jsx("line", { x1: 0, y1: 8, x2: 18, y2: 8, stroke: "var(--color-muted-foreground)", strokeWidth: 2 }),
60154
60293
  /* @__PURE__ */ jsx("polygon", { points: "18,4 24,8 18,12", fill: "var(--color-muted-foreground)" })
60155
60294
  ] }),
60156
- /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.to, role: toRole, isInitial: toState?.isInitial, isTerminal: toState?.isTerminal }) })
60295
+ /* @__PURE__ */ jsx("svg", { width: 90, height: 32, viewBox: "0 0 90 32", children: /* @__PURE__ */ jsx(AvlState, { x: 0, y: 0, width: 80, height: 28, name: transition.to, role: toRole, isInitial: toState?.isInitial ?? void 0, isTerminal: toState?.isTerminal ?? void 0 }) })
60157
60296
  ] }) }),
60158
60297
  /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 space-y-3", children: [
60159
60298
  /* @__PURE__ */ jsxs("div", { children: [
@@ -60490,7 +60629,7 @@ function getTraits2(orbital) {
60490
60629
  if (!orbital.traits) return [];
60491
60630
  return orbital.traits.map((t) => {
60492
60631
  if (typeof t === "string") return { name: t };
60493
- if ("ref" in t) return { name: t.ref };
60632
+ if (typeof t === "object" && t !== null && "ref" in t) return { name: t.ref };
60494
60633
  return t;
60495
60634
  });
60496
60635
  }
@@ -60519,8 +60658,8 @@ function getPages2(orbital) {
60519
60658
  if (!orbital.pages) return [];
60520
60659
  return orbital.pages.map((p2) => {
60521
60660
  if (typeof p2 === "string") return `/${p2.toLowerCase()}`;
60522
- const po = p2;
60523
- return po.path ?? `/${po.name ?? ""}`.toLowerCase();
60661
+ if ("ref" in p2) return p2.path ?? `/${p2.ref}`.toLowerCase();
60662
+ return p2.path ?? `/${p2.name}`.toLowerCase();
60524
60663
  });
60525
60664
  }
60526
60665
  function getEmits2(trait) {
@@ -60537,13 +60676,11 @@ function extractRenderUI(effects) {
60537
60676
  const patterns = [];
60538
60677
  for (const eff of effects) {
60539
60678
  if (!Array.isArray(eff)) continue;
60540
- const [type, ...args] = eff;
60541
- if (type === "render-ui" && args.length >= 2) {
60542
- const slot = args[0];
60543
- const pattern = args[1];
60544
- if (pattern !== null && pattern !== void 0 && typeof pattern === "object") {
60545
- patterns.push({ slot, pattern });
60546
- }
60679
+ if (eff[0] !== "render-ui" || eff.length < 3) continue;
60680
+ const slot = eff[1];
60681
+ const pattern = eff[2];
60682
+ if (pattern !== null && pattern !== void 0 && typeof pattern === "object" && !Array.isArray(pattern)) {
60683
+ patterns.push({ slot, pattern });
60547
60684
  }
60548
60685
  }
60549
60686
  return patterns;
@@ -60560,14 +60697,14 @@ function extractEffectTypes(effects) {
60560
60697
  function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, siblingIndex = 0) {
60561
60698
  const sources = [];
60562
60699
  if (depth > 10) return sources;
60563
- const patternType = config.type;
60564
- const event = config.event;
60565
- if (patternType && event && typeof event === "string") {
60700
+ const patternType = typeof config.type === "string" ? config.type : void 0;
60701
+ const event = typeof config.event === "string" ? config.event : void 0;
60702
+ if (patternType && event) {
60566
60703
  const positionHint = totalSiblings > 1 ? (siblingIndex + 0.5) / totalSiblings : 0.5 + depth * 0.1;
60567
60704
  sources.push({
60568
60705
  event,
60569
60706
  patternType,
60570
- label: config.label ?? config.content ?? config.text,
60707
+ label: typeof config.label === "string" ? config.label : typeof config.content === "string" ? config.content : typeof config.text === "string" ? config.text : void 0,
60571
60708
  path,
60572
60709
  positionHint: Math.min(Math.max(positionHint, 0.1), 0.9)
60573
60710
  });
@@ -60576,7 +60713,7 @@ function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, s
60576
60713
  if (Array.isArray(children)) {
60577
60714
  for (let i = 0; i < children.length; i++) {
60578
60715
  const child = children[i];
60579
- if (child && typeof child === "object") {
60716
+ if (child !== null && typeof child === "object" && !Array.isArray(child)) {
60580
60717
  sources.push(
60581
60718
  ...findEventSources(child, `${path}.children.${i}`, depth + 1, children.length, i)
60582
60719
  );
@@ -60585,7 +60722,7 @@ function findEventSources(config, path = "root", depth = 0, totalSiblings = 1, s
60585
60722
  }
60586
60723
  for (const [key, value] of Object.entries(config)) {
60587
60724
  if (key === "children" || key === "type" || key === "event") continue;
60588
- if (value && typeof value === "object" && !Array.isArray(value) && "type" in value) {
60725
+ if (value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value) {
60589
60726
  sources.push(
60590
60727
  ...findEventSources(value, `${path}.${key}`, depth + 1, totalSiblings, siblingIndex)
60591
60728
  );
@@ -60722,10 +60859,10 @@ function schemaToOverviewGraph(schema, mockData, behaviorMeta, layoutHint, orbit
60722
60859
  if (!sm) continue;
60723
60860
  const smEvents = trait.stateMachine?.events ?? [];
60724
60861
  const matchingEvent = smEvents.find((ev) => ev.key === source.event);
60725
- if (matchingEvent?.payload && Array.isArray(matchingEvent.payload)) {
60726
- source.payloadFields = matchingEvent.payload.map((p2) => ({
60727
- name: String(p2.name ?? ""),
60728
- type: String(p2.type ?? "string"),
60862
+ if (matchingEvent?.payloadSchema && Array.isArray(matchingEvent.payloadSchema)) {
60863
+ source.payloadFields = matchingEvent.payloadSchema.map((p2) => ({
60864
+ name: p2.name ?? "",
60865
+ type: p2.type ?? "string",
60729
60866
  ...p2.required ? { required: true } : {}
60730
60867
  }));
60731
60868
  break;
@@ -61261,7 +61398,7 @@ function resolveLambdaBindings(body, params, item, index) {
61261
61398
  if (Array.isArray(body)) {
61262
61399
  return body.map((b) => recur(b));
61263
61400
  }
61264
- if (body !== null && typeof body === "object" && !React94__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
61401
+ if (body !== null && typeof body === "object" && !React98__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
61265
61402
  const out = {};
61266
61403
  for (const [k, v] of Object.entries(body)) {
61267
61404
  out[k] = recur(v);
@@ -61280,7 +61417,7 @@ function getSlotContentRenderer4() {
61280
61417
  function makeLambdaFn(params, lambdaBody, callerKey) {
61281
61418
  return (item, index) => {
61282
61419
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
61283
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React94__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
61420
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React98__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
61284
61421
  return null;
61285
61422
  }
61286
61423
  const record = resolvedBody;
@@ -61299,7 +61436,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
61299
61436
  props: childProps,
61300
61437
  priority: 0
61301
61438
  };
61302
- return React94__default.createElement(SlotContentRenderer2, { content: childContent });
61439
+ return React98__default.createElement(SlotContentRenderer2, { content: childContent });
61303
61440
  };
61304
61441
  }
61305
61442
  function convertNode(node, callerKey) {
@@ -61318,7 +61455,7 @@ function convertNode(node, callerKey) {
61318
61455
  });
61319
61456
  return anyChanged ? mapped : node;
61320
61457
  }
61321
- if (typeof node === "object" && !React94__default.isValidElement(node) && !(node instanceof Date)) {
61458
+ if (typeof node === "object" && !React98__default.isValidElement(node) && !(node instanceof Date)) {
61322
61459
  return convertObjectProps(node);
61323
61460
  }
61324
61461
  return node;
@@ -62912,7 +63049,7 @@ function buildMockData(schema) {
62912
63049
  perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
62913
63050
  return result;
62914
63051
  }
62915
- function isInlineTrait2(traitRef) {
63052
+ function isInlineTrait3(traitRef) {
62916
63053
  return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
62917
63054
  }
62918
63055
  function findDataState(sm, initialStateName) {
@@ -62944,7 +63081,7 @@ function adjustSchemaForMockData(schema, mockData) {
62944
63081
  const updatedOrbitals = schema.orbitals.map((orbital) => {
62945
63082
  const traits2 = orbital.traits ?? [];
62946
63083
  const updatedTraits = traits2.map((traitRef) => {
62947
- if (!isInlineTrait2(traitRef)) return traitRef;
63084
+ if (!isInlineTrait3(traitRef)) return traitRef;
62948
63085
  const updated = rewriteTraitInitialState(traitRef, mockData);
62949
63086
  if (updated !== traitRef) changed = true;
62950
63087
  return updated;
@@ -63514,7 +63651,7 @@ function useCanvasDroppable({
63514
63651
  function defaultEmit(eventBus, drop) {
63515
63652
  const { payload, target, resolved } = drop;
63516
63653
  if (payload.kind === "pattern") {
63517
- const patternType = payload.data.type;
63654
+ const patternType = payload.data["type"];
63518
63655
  if (typeof patternType !== "string") {
63519
63656
  log13.warn("default-emit:pattern:missing-type");
63520
63657
  return;
@@ -63529,7 +63666,7 @@ function defaultEmit(eventBus, drop) {
63529
63666
  return;
63530
63667
  }
63531
63668
  if (payload.kind === "behavior") {
63532
- const behaviorName = payload.data.name;
63669
+ const behaviorName = payload.data["name"];
63533
63670
  if (typeof behaviorName !== "string") {
63534
63671
  log13.warn("default-emit:behavior:missing-name");
63535
63672
  return;
@@ -63550,8 +63687,8 @@ function CanvasDndProvider({
63550
63687
  }) {
63551
63688
  const eventBus = useEventBus();
63552
63689
  const sensors = useAlmadarDndSensors(false);
63553
- const [activePayload, setActivePayload] = React94__default.useState(null);
63554
- const handleDragStart = React94__default.useCallback((e) => {
63690
+ const [activePayload, setActivePayload] = React98__default.useState(null);
63691
+ const handleDragStart = React98__default.useCallback((e) => {
63555
63692
  const data = e.active.data.current;
63556
63693
  const payload = data?.payload;
63557
63694
  if (payload) {
@@ -63562,7 +63699,7 @@ function CanvasDndProvider({
63562
63699
  log13.warn("dragStart:missing-payload", { id: e.active.id });
63563
63700
  }
63564
63701
  }, [eventBus]);
63565
- const handleDragEnd = React94__default.useCallback((e) => {
63702
+ const handleDragEnd = React98__default.useCallback((e) => {
63566
63703
  setActivePayload(null);
63567
63704
  const activeData = e.active.data.current;
63568
63705
  const payload = activeData?.payload;
@@ -63591,7 +63728,7 @@ function CanvasDndProvider({
63591
63728
  const suppressed = onDrop ? onDrop(drop) === true : false;
63592
63729
  if (!suppressed) defaultEmit(eventBus, drop);
63593
63730
  }, [eventBus, onDrop]);
63594
- const handleDragCancel = React94__default.useCallback(() => {
63731
+ const handleDragCancel = React98__default.useCallback(() => {
63595
63732
  setActivePayload(null);
63596
63733
  log13.info("dragCancel");
63597
63734
  }, []);
@@ -64349,7 +64486,7 @@ var OrbPreviewNodeInner = (props) => {
64349
64486
  }
64350
64487
  );
64351
64488
  };
64352
- var OrbPreviewNode = React94__default.memo(OrbPreviewNodeInner);
64489
+ var OrbPreviewNode = React98__default.memo(OrbPreviewNodeInner);
64353
64490
  OrbPreviewNode.displayName = "OrbPreviewNode";
64354
64491
  orbPreviewLog.debug("export-resolved", () => ({
64355
64492
  type: typeof OrbPreviewNode,
@@ -64454,7 +64591,7 @@ var EventFlowEdgeInner = (props) => {
64454
64591
  ) })
64455
64592
  ] });
64456
64593
  };
64457
- var EventFlowEdge = React94__default.memo(EventFlowEdgeInner);
64594
+ var EventFlowEdge = React98__default.memo(EventFlowEdgeInner);
64458
64595
  EventFlowEdge.displayName = "EventFlowEdge";
64459
64596
 
64460
64597
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -64518,7 +64655,7 @@ var BehaviorComposeNodeInner = (props) => {
64518
64655
  Box,
64519
64656
  {
64520
64657
  style: { height: 3, backgroundColor: layerColor },
64521
- title: data.layer
64658
+ title: data.layer ?? void 0
64522
64659
  }
64523
64660
  ),
64524
64661
  /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 px-3 py-1.5 border-b border-border/40 drag-handle cursor-grab", children: [
@@ -64533,9 +64670,9 @@ var BehaviorComposeNodeInner = (props) => {
64533
64670
  {
64534
64671
  name: data.behaviorName,
64535
64672
  level: data.level,
64536
- domain: data.domain,
64673
+ domain: data.domain ?? void 0,
64537
64674
  stateCount: data.stateCount,
64538
- fieldCount: data.fieldCount,
64675
+ fieldCount: data.fieldCount ?? void 0,
64539
64676
  persistence: data.persistence,
64540
64677
  effectTypes: data.effectTypes,
64541
64678
  children: data.children,
@@ -64601,7 +64738,7 @@ var BehaviorComposeNodeInner = (props) => {
64601
64738
  }
64602
64739
  );
64603
64740
  };
64604
- var BehaviorComposeNode = React94__default.memo(BehaviorComposeNodeInner);
64741
+ var BehaviorComposeNode = React98__default.memo(BehaviorComposeNodeInner);
64605
64742
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
64606
64743
 
64607
64744
  // components/avl/molecules/avl-behavior-compose-converter.ts
@@ -64622,17 +64759,17 @@ function behaviorsToComposeGraph(entries, wires, layoutHint) {
64622
64759
  data: {
64623
64760
  behaviorName: entry.behaviorName,
64624
64761
  level: entry.level,
64625
- domain: entry.domain,
64626
- layer: entry.layer,
64762
+ domain: entry.domain ?? null,
64763
+ layer: entry.layer ?? null,
64627
64764
  entityName: entry.entityName,
64628
64765
  stateCount: entry.stateCount,
64629
- fieldCount: entry.fieldCount,
64630
- persistence: entry.persistence,
64631
- effectTypes: entry.effectTypes,
64632
- children: entry.children,
64633
- connections: entry.connections,
64766
+ fieldCount: entry.fieldCount ?? null,
64767
+ persistence: entry.persistence ?? null,
64768
+ effectTypes: entry.effectTypes ?? null,
64769
+ children: entry.children ?? null,
64770
+ connections: entry.connections ?? null,
64634
64771
  connectableEvents: entry.connectableEvents,
64635
- composableWith: entry.composableWith,
64772
+ composableWith: entry.composableWith ?? null,
64636
64773
  orbitalNames: entry.orbitalNames
64637
64774
  }
64638
64775
  });
@@ -64651,11 +64788,20 @@ function behaviorsToComposeGraph(entries, wires, layoutHint) {
64651
64788
  }
64652
64789
  function registryEntryToCanvasEntry(entry, orbitalNames) {
64653
64790
  const events2 = entry.connectableEvents;
64654
- const connectableEvents = events2.map((eventName, i) => ({
64655
- event: eventName,
64656
- payloadFields: entry.eventPayloads[eventName],
64657
- positionHint: events2.length > 1 ? 0.1 + i * 0.8 / (events2.length - 1) : 0.5
64658
- }));
64791
+ const connectableEvents = events2.map((eventName, i) => {
64792
+ const rawFields = entry.eventPayloads[eventName];
64793
+ const payloadFields = rawFields ? rawFields.map((f3) => ({
64794
+ name: f3.name,
64795
+ type: f3.type,
64796
+ required: f3.required ?? null,
64797
+ description: null
64798
+ })) : null;
64799
+ return {
64800
+ event: eventName,
64801
+ payloadFields,
64802
+ positionHint: events2.length > 1 ? 0.1 + i * 0.8 / (events2.length - 1) : 0.5
64803
+ };
64804
+ });
64659
64805
  return {
64660
64806
  behaviorName: entry.name,
64661
64807
  level: entry.level,
@@ -64760,28 +64906,31 @@ function findPatternInTree(root, path) {
64760
64906
  const parts = cleanPath.split(".");
64761
64907
  let current = root;
64762
64908
  for (const part of parts) {
64763
- if (current === null || current === void 0 || typeof current !== "object") return null;
64764
- const record = current;
64765
- if (part === "children") {
64766
- if (Array.isArray(record.children)) {
64767
- current = record.children;
64768
- } else {
64769
- const nestedProps = record.props;
64770
- if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
64771
- current = nestedProps.children;
64772
- } else {
64773
- return null;
64774
- }
64775
- }
64776
- } else if (Array.isArray(current)) {
64909
+ if (current === null) return null;
64910
+ if (Array.isArray(current)) {
64777
64911
  const idx = parseInt(part, 10);
64778
64912
  if (isNaN(idx) || idx < 0 || idx >= current.length) return null;
64779
- current = current[idx];
64913
+ const item = current[idx];
64914
+ current = item && typeof item === "object" && !Array.isArray(item) ? item : null;
64780
64915
  } else {
64781
- current = record[part];
64916
+ if (part === "children") {
64917
+ if (Array.isArray(current.children)) {
64918
+ current = current.children;
64919
+ } else {
64920
+ const nestedProps = current.props;
64921
+ if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
64922
+ current = nestedProps.children;
64923
+ } else {
64924
+ return null;
64925
+ }
64926
+ }
64927
+ } else {
64928
+ const rawVal = current[part];
64929
+ current = rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) ? rawVal : null;
64930
+ }
64782
64931
  }
64783
64932
  }
64784
- return typeof current === "object" && current !== null ? current : null;
64933
+ return Array.isArray(current) ? null : current;
64785
64934
  }
64786
64935
  var FIELD_TYPE_OPTIONS = FieldTypeSchema.options.map((v) => ({ value: v, label: v }));
64787
64936
  var EFFECT_TYPE_OPTIONS = Object.keys(EFFECT_TYPE_TO_CATEGORY).map((v) => ({ value: v, label: v }));
@@ -64816,7 +64965,9 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
64816
64965
  const tryEffects = (effects) => {
64817
64966
  for (const eff of effects) {
64818
64967
  if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
64819
- const found = findPatternInTree(eff[2], patternId);
64968
+ const root = eff[2];
64969
+ if (typeof root !== "object" || root === null || Array.isArray(root)) continue;
64970
+ const found = findPatternInTree(root, patternId);
64820
64971
  if (!found) continue;
64821
64972
  if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
64822
64973
  continue;
@@ -65245,9 +65396,9 @@ function OrbPatternTree({ config, depth }) {
65245
65396
  return /* @__PURE__ */ jsxs(Box, { style: { paddingLeft: depth * 12 }, children: [
65246
65397
  /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-primary font-semibold text-xs", children: type }),
65247
65398
  propEntries.slice(0, 5).map(([key, val]) => {
65248
- const display = typeof val === "string" ? val.startsWith("@") ? /* @__PURE__ */ jsx("span", { className: "text-purple-500", children: val }) : `"${val}"` : Array.isArray(val) && typeof val[0] === "string" && val[0].includes("/") ? /* @__PURE__ */ jsxs("span", { className: "text-amber-600", children: [
65399
+ const display = typeof val === "string" ? val.startsWith("@") ? /* @__PURE__ */ jsx("span", { className: "text-purple-500", children: val }) : `"${val}"` : Array.isArray(val) && val.length > 0 && typeof val[0] === "string" && val[0].includes("/") ? /* @__PURE__ */ jsxs("span", { className: "text-amber-600", children: [
65249
65400
  "(",
65250
- val.join(" "),
65401
+ val.map(String).join(" "),
65251
65402
  ")"
65252
65403
  ] }) : String(val);
65253
65404
  return /* @__PURE__ */ jsxs(Box, { className: "flex gap-1 text-xs", children: [
@@ -65613,7 +65764,7 @@ var TraitCardNodeInner = (props) => {
65613
65764
  }
65614
65765
  );
65615
65766
  };
65616
- var TraitCardNode = React94__default.memo(TraitCardNodeInner);
65767
+ var TraitCardNode = React98__default.memo(TraitCardNodeInner);
65617
65768
  TraitCardNode.displayName = "TraitCardNode";
65618
65769
 
65619
65770
  // components/avl/organisms/FlowCanvas.tsx
@@ -65686,7 +65837,7 @@ function FlowCanvasInner({
65686
65837
  initialOrbital
65687
65838
  );
65688
65839
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
65689
- const screenSizeUserOverrideRef = React94__default.useRef(false);
65840
+ const screenSizeUserOverrideRef = React98__default.useRef(false);
65690
65841
  const [screenSize, setScreenSize] = useState(
65691
65842
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
65692
65843
  );
@@ -66070,7 +66221,7 @@ var ZoomBreadcrumb = ({
66070
66221
  if (eventName && band === "detail") {
66071
66222
  segments.push({ icon: "\u26A1", label: eventName });
66072
66223
  }
66073
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
66224
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
66074
66225
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
66075
66226
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
66076
66227
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -66411,7 +66562,7 @@ var EventWireOverlay = ({
66411
66562
  containerW,
66412
66563
  containerH
66413
66564
  }) => {
66414
- const ids = React94__default.useMemo(() => {
66565
+ const ids = React98__default.useMemo(() => {
66415
66566
  avlOczWireId += 1;
66416
66567
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
66417
66568
  }, []);
@@ -66778,7 +66929,7 @@ var AvlOrbitalsCosmicZoom = ({
66778
66929
  borderRadius: 6,
66779
66930
  border: `1px solid ${color}`
66780
66931
  },
66781
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React94__default.Fragment, { children: [
66932
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React98__default.Fragment, { children: [
66782
66933
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
66783
66934
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
66784
66935
  Box,