@almadar/ui 4.13.1 → 4.14.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.
@@ -1,5 +1,5 @@
1
- import * as React115 from 'react';
2
- import React115__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, useState, Suspense, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React114 from 'react';
2
+ import React114__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
3
3
  import { EventBusContext, useTraitScope, OrbitalProvider, TraitScopeProvider, VerificationProvider } from '@almadar/ui/providers';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { clsx } from 'clsx';
@@ -1084,121 +1084,6 @@ var init_verificationRegistry = __esm({
1084
1084
  exposeOnWindow();
1085
1085
  }
1086
1086
  });
1087
- function refId(obj) {
1088
- if (obj === null || obj === void 0 || typeof obj !== "object") return null;
1089
- const existing = refIds.get(obj);
1090
- if (existing !== void 0) return existing;
1091
- const id = nextRefId++;
1092
- refIds.set(obj, id);
1093
- return id;
1094
- }
1095
- function slotEntriesInOrder(slot) {
1096
- if (!slot) return [];
1097
- const out = [];
1098
- for (const [sourceKey, entry] of Object.entries(slot)) {
1099
- if (entry.patterns.length > 0) {
1100
- out.push({ sourceKey, entry });
1101
- }
1102
- }
1103
- return out;
1104
- }
1105
- function SlotsProvider({ children }) {
1106
- const [slots, setSlots] = useState({});
1107
- const setSlotPatterns = useCallback((slot, patterns, source) => {
1108
- const sourceKey = source?.trait ?? DEFAULT_SOURCE_KEY;
1109
- const entityProp = patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.entity : void 0;
1110
- const firstPatternType = patterns[0]?.pattern && typeof patterns[0].pattern === "object" ? patterns[0].pattern.type : void 0;
1111
- slotLog.debug("setSlotPatterns", {
1112
- slot,
1113
- sourceKey,
1114
- patternCount: patterns.length,
1115
- firstPatternType,
1116
- entityRefId: refId(entityProp)
1117
- });
1118
- if (source?.trait) {
1119
- xOrbitalLog.info("slot-set", {
1120
- slot,
1121
- sourceTrait: source.trait,
1122
- patternCount: patterns.length,
1123
- firstPatternType,
1124
- state: source.state
1125
- });
1126
- }
1127
- setSlots((prev) => {
1128
- const prevSlot = prev[slot] ?? {};
1129
- return {
1130
- ...prev,
1131
- [slot]: {
1132
- ...prevSlot,
1133
- [sourceKey]: { patterns, source }
1134
- }
1135
- };
1136
- });
1137
- }, []);
1138
- const clearSlot = useCallback((slot) => {
1139
- setSlots((prev) => {
1140
- const existing = prev[slot];
1141
- if (existing && Object.keys(existing).length === 0) {
1142
- return prev;
1143
- }
1144
- return { ...prev, [slot]: {} };
1145
- });
1146
- }, []);
1147
- const clearSlotForSource = useCallback((slot, sourceTrait) => {
1148
- xOrbitalLog.info("slot-clear-source", { slot, sourceTrait });
1149
- setSlots((prev) => {
1150
- const existing = prev[slot];
1151
- if (!existing || !(sourceTrait in existing)) return prev;
1152
- const next = { ...existing };
1153
- delete next[sourceTrait];
1154
- return { ...prev, [slot]: next };
1155
- });
1156
- }, []);
1157
- const clearAllSlots = useCallback(() => {
1158
- setSlots({});
1159
- }, []);
1160
- const actionsRef = useRef({
1161
- setSlotPatterns,
1162
- clearSlot,
1163
- clearSlotForSource,
1164
- clearAllSlots
1165
- });
1166
- actionsRef.current = { setSlotPatterns, clearSlot, clearSlotForSource, clearAllSlots };
1167
- const [stableActions] = useState(() => ({
1168
- setSlotPatterns: (...args) => actionsRef.current.setSlotPatterns(...args),
1169
- clearSlot: (...args) => actionsRef.current.clearSlot(...args),
1170
- clearSlotForSource: (...args) => actionsRef.current.clearSlotForSource(...args),
1171
- clearAllSlots: () => actionsRef.current.clearAllSlots()
1172
- }));
1173
- return /* @__PURE__ */ jsx(SlotsActionsContext.Provider, { value: stableActions, children: /* @__PURE__ */ jsx(SlotsStateContext.Provider, { value: slots, children }) });
1174
- }
1175
- function useSlots() {
1176
- return useContext(SlotsStateContext);
1177
- }
1178
- function useSlotContent(slotName) {
1179
- const slots = useContext(SlotsStateContext);
1180
- return slots[slotName] || null;
1181
- }
1182
- function useSlotsActions() {
1183
- const actions = useContext(SlotsActionsContext);
1184
- if (!actions) {
1185
- throw new Error("useSlotsActions must be used within a SlotsProvider");
1186
- }
1187
- return actions;
1188
- }
1189
- var slotLog, xOrbitalLog, refIds, nextRefId, DEFAULT_SOURCE_KEY, SlotsStateContext, SlotsActionsContext;
1190
- var init_SlotsContext = __esm({
1191
- "runtime/ui/SlotsContext.tsx"() {
1192
- init_logger();
1193
- slotLog = createLogger("almadar:ui:slot-render");
1194
- xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
1195
- refIds = /* @__PURE__ */ new WeakMap();
1196
- nextRefId = 1;
1197
- DEFAULT_SOURCE_KEY = "__default__";
1198
- SlotsStateContext = createContext({});
1199
- SlotsActionsContext = createContext(null);
1200
- }
1201
- });
1202
1087
  function cn(...inputs) {
1203
1088
  return twMerge(clsx(inputs));
1204
1089
  }
@@ -1314,7 +1199,7 @@ var init_Box = __esm({
1314
1199
  fixed: "fixed",
1315
1200
  sticky: "sticky"
1316
1201
  };
1317
- Box = React115__default.forwardRef(
1202
+ Box = React114__default.forwardRef(
1318
1203
  ({
1319
1204
  padding,
1320
1205
  paddingX,
@@ -2097,7 +1982,7 @@ function resolveIconProp(value, sizeClass) {
2097
1982
  const IconComp = value;
2098
1983
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
2099
1984
  }
2100
- if (React115__default.isValidElement(value)) {
1985
+ if (React114__default.isValidElement(value)) {
2101
1986
  return value;
2102
1987
  }
2103
1988
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -2173,7 +2058,7 @@ var init_Button = __esm({
2173
2058
  md: "h-4 w-4",
2174
2059
  lg: "h-5 w-5"
2175
2060
  };
2176
- Button = React115__default.forwardRef(
2061
+ Button = React114__default.forwardRef(
2177
2062
  ({
2178
2063
  className,
2179
2064
  variant = "primary",
@@ -2276,7 +2161,7 @@ var init_Badge = __esm({
2276
2161
  md: "px-2.5 py-1 text-sm",
2277
2162
  lg: "px-3 py-1.5 text-base"
2278
2163
  };
2279
- Badge = React115__default.forwardRef(
2164
+ Badge = React114__default.forwardRef(
2280
2165
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
2281
2166
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
2282
2167
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2413,11 +2298,30 @@ var init_Toast = __esm({
2413
2298
  Toast.displayName = "Toast";
2414
2299
  }
2415
2300
  });
2301
+
2302
+ // runtime/ui/slot-types.ts
2303
+ function refId(obj) {
2304
+ if (obj === null || obj === void 0 || typeof obj !== "object") return null;
2305
+ const existing = refIds.get(obj);
2306
+ if (existing !== void 0) return existing;
2307
+ const id = nextRefId++;
2308
+ refIds.set(obj, id);
2309
+ return id;
2310
+ }
2311
+ var slotLog, refIds, nextRefId;
2312
+ var init_slot_types = __esm({
2313
+ "runtime/ui/slot-types.ts"() {
2314
+ init_logger();
2315
+ slotLog = createLogger("almadar:ui:slot-render");
2316
+ refIds = /* @__PURE__ */ new WeakMap();
2317
+ nextRefId = 1;
2318
+ }
2319
+ });
2416
2320
  var Input;
2417
2321
  var init_Input = __esm({
2418
2322
  "components/atoms/Input.tsx"() {
2419
2323
  init_cn();
2420
- Input = React115__default.forwardRef(
2324
+ Input = React114__default.forwardRef(
2421
2325
  ({
2422
2326
  className,
2423
2327
  inputType,
@@ -2535,7 +2439,7 @@ var Label;
2535
2439
  var init_Label = __esm({
2536
2440
  "components/atoms/Label.tsx"() {
2537
2441
  init_cn();
2538
- Label = React115__default.forwardRef(
2442
+ Label = React114__default.forwardRef(
2539
2443
  ({ className, required, children, ...props }, ref) => {
2540
2444
  return /* @__PURE__ */ jsxs(
2541
2445
  "label",
@@ -2561,7 +2465,7 @@ var Textarea;
2561
2465
  var init_Textarea = __esm({
2562
2466
  "components/atoms/Textarea.tsx"() {
2563
2467
  init_cn();
2564
- Textarea = React115__default.forwardRef(
2468
+ Textarea = React114__default.forwardRef(
2565
2469
  ({ className, error, ...props }, ref) => {
2566
2470
  return /* @__PURE__ */ jsx(
2567
2471
  "textarea",
@@ -2590,7 +2494,7 @@ var Select;
2590
2494
  var init_Select = __esm({
2591
2495
  "components/atoms/Select.tsx"() {
2592
2496
  init_cn();
2593
- Select = React115__default.forwardRef(
2497
+ Select = React114__default.forwardRef(
2594
2498
  ({ className, options, placeholder, error, ...props }, ref) => {
2595
2499
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2596
2500
  /* @__PURE__ */ jsxs(
@@ -2632,7 +2536,7 @@ var Checkbox;
2632
2536
  var init_Checkbox = __esm({
2633
2537
  "components/atoms/Checkbox.tsx"() {
2634
2538
  init_cn();
2635
- Checkbox = React115__default.forwardRef(
2539
+ Checkbox = React114__default.forwardRef(
2636
2540
  ({ className, label, id, ...props }, ref) => {
2637
2541
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2638
2542
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2714,7 +2618,7 @@ var init_Card = __esm({
2714
2618
  md: "shadow",
2715
2619
  lg: "shadow-lg"
2716
2620
  };
2717
- Card = React115__default.forwardRef(
2621
+ Card = React114__default.forwardRef(
2718
2622
  ({
2719
2623
  className,
2720
2624
  variant = "bordered",
@@ -2750,9 +2654,9 @@ var init_Card = __esm({
2750
2654
  }
2751
2655
  );
2752
2656
  Card.displayName = "Card";
2753
- CardHeader = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2657
+ CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2754
2658
  CardHeader.displayName = "CardHeader";
2755
- CardTitle = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2659
+ CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2756
2660
  "h3",
2757
2661
  {
2758
2662
  ref,
@@ -2765,11 +2669,11 @@ var init_Card = __esm({
2765
2669
  }
2766
2670
  ));
2767
2671
  CardTitle.displayName = "CardTitle";
2768
- CardContent = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2672
+ CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2769
2673
  CardContent.displayName = "CardContent";
2770
2674
  CardBody = CardContent;
2771
2675
  CardBody.displayName = "CardBody";
2772
- CardFooter = React115__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2676
+ CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2773
2677
  "div",
2774
2678
  {
2775
2679
  ref,
@@ -2790,7 +2694,7 @@ var init_Spinner = __esm({
2790
2694
  md: "h-6 w-6",
2791
2695
  lg: "h-8 w-8"
2792
2696
  };
2793
- Spinner = React115__default.forwardRef(
2697
+ Spinner = React114__default.forwardRef(
2794
2698
  ({ className, size = "md", ...props }, ref) => {
2795
2699
  return /* @__PURE__ */ jsx(
2796
2700
  "div",
@@ -3238,7 +3142,7 @@ var Radio;
3238
3142
  var init_Radio = __esm({
3239
3143
  "components/atoms/Radio.tsx"() {
3240
3144
  init_cn();
3241
- Radio = React115__default.forwardRef(
3145
+ Radio = React114__default.forwardRef(
3242
3146
  ({
3243
3147
  label,
3244
3148
  helperText,
@@ -3349,7 +3253,7 @@ var init_Switch = __esm({
3349
3253
  "components/atoms/Switch.tsx"() {
3350
3254
  "use client";
3351
3255
  init_cn();
3352
- Switch = React115.forwardRef(
3256
+ Switch = React114.forwardRef(
3353
3257
  ({
3354
3258
  checked,
3355
3259
  defaultChecked = false,
@@ -3360,10 +3264,10 @@ var init_Switch = __esm({
3360
3264
  name,
3361
3265
  className
3362
3266
  }, ref) => {
3363
- const [isChecked, setIsChecked] = React115.useState(
3267
+ const [isChecked, setIsChecked] = React114.useState(
3364
3268
  checked !== void 0 ? checked : defaultChecked
3365
3269
  );
3366
- React115.useEffect(() => {
3270
+ React114.useEffect(() => {
3367
3271
  if (checked !== void 0) {
3368
3272
  setIsChecked(checked);
3369
3273
  }
@@ -3914,8 +3818,8 @@ var init_LawReferenceTooltip = __esm({
3914
3818
  position = "top",
3915
3819
  className
3916
3820
  }) => {
3917
- const [isVisible, setIsVisible] = React115__default.useState(false);
3918
- const timeoutRef = React115__default.useRef(null);
3821
+ const [isVisible, setIsVisible] = React114__default.useState(false);
3822
+ const timeoutRef = React114__default.useRef(null);
3919
3823
  const handleMouseEnter = () => {
3920
3824
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3921
3825
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -3924,7 +3828,7 @@ var init_LawReferenceTooltip = __esm({
3924
3828
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3925
3829
  setIsVisible(false);
3926
3830
  };
3927
- React115__default.useEffect(() => {
3831
+ React114__default.useEffect(() => {
3928
3832
  return () => {
3929
3833
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3930
3834
  };
@@ -4134,7 +4038,7 @@ var init_StatusDot = __esm({
4134
4038
  md: "w-2.5 h-2.5",
4135
4039
  lg: "w-3 h-3"
4136
4040
  };
4137
- StatusDot = React115__default.forwardRef(
4041
+ StatusDot = React114__default.forwardRef(
4138
4042
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4139
4043
  return /* @__PURE__ */ jsx(
4140
4044
  "span",
@@ -4187,7 +4091,7 @@ var init_TrendIndicator = __esm({
4187
4091
  down: TrendingDown,
4188
4092
  flat: ArrowRight
4189
4093
  };
4190
- TrendIndicator = React115__default.forwardRef(
4094
+ TrendIndicator = React114__default.forwardRef(
4191
4095
  ({
4192
4096
  className,
4193
4097
  value,
@@ -4254,7 +4158,7 @@ var init_RangeSlider = __esm({
4254
4158
  md: "w-4 h-4",
4255
4159
  lg: "w-5 h-5"
4256
4160
  };
4257
- RangeSlider = React115__default.forwardRef(
4161
+ RangeSlider = React114__default.forwardRef(
4258
4162
  ({
4259
4163
  className,
4260
4164
  min = 0,
@@ -4815,7 +4719,7 @@ var init_ContentSection = __esm({
4815
4719
  md: "py-16",
4816
4720
  lg: "py-24"
4817
4721
  };
4818
- ContentSection = React115__default.forwardRef(
4722
+ ContentSection = React114__default.forwardRef(
4819
4723
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4820
4724
  return /* @__PURE__ */ jsx(
4821
4725
  Box,
@@ -5349,7 +5253,7 @@ var init_AnimatedReveal = __esm({
5349
5253
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5350
5254
  "none": {}
5351
5255
  };
5352
- AnimatedReveal = React115__default.forwardRef(
5256
+ AnimatedReveal = React114__default.forwardRef(
5353
5257
  ({
5354
5258
  trigger = "scroll",
5355
5259
  animation = "fade-up",
@@ -5509,7 +5413,7 @@ var init_AnimatedGraphic = __esm({
5509
5413
  "components/atoms/AnimatedGraphic.tsx"() {
5510
5414
  "use client";
5511
5415
  init_cn();
5512
- AnimatedGraphic = React115__default.forwardRef(
5416
+ AnimatedGraphic = React114__default.forwardRef(
5513
5417
  ({
5514
5418
  src,
5515
5419
  svgContent,
@@ -5532,7 +5436,7 @@ var init_AnimatedGraphic = __esm({
5532
5436
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5533
5437
  const resolvedSvg = svgContent ?? fetchedSvg;
5534
5438
  const prevAnimateRef = useRef(animate);
5535
- const setRef = React115__default.useCallback(
5439
+ const setRef = React114__default.useCallback(
5536
5440
  (node) => {
5537
5441
  containerRef.current = node;
5538
5442
  if (typeof ref === "function") ref(node);
@@ -5750,9 +5654,9 @@ function ScoreDisplay({
5750
5654
  ...rest
5751
5655
  }) {
5752
5656
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
5753
- const [displayValue, setDisplayValue] = React115.useState(resolvedValue);
5754
- const [isAnimating, setIsAnimating] = React115.useState(false);
5755
- React115.useEffect(() => {
5657
+ const [displayValue, setDisplayValue] = React114.useState(resolvedValue);
5658
+ const [isAnimating, setIsAnimating] = React114.useState(false);
5659
+ React114.useEffect(() => {
5756
5660
  if (!animated || displayValue === resolvedValue) {
5757
5661
  setDisplayValue(resolvedValue);
5758
5662
  return;
@@ -5822,9 +5726,9 @@ function ControlButton({
5822
5726
  className
5823
5727
  }) {
5824
5728
  const eventBus = useEventBus();
5825
- const [isPressed, setIsPressed] = React115.useState(false);
5729
+ const [isPressed, setIsPressed] = React114.useState(false);
5826
5730
  const actualPressed = pressed ?? isPressed;
5827
- const handlePointerDown = React115.useCallback(
5731
+ const handlePointerDown = React114.useCallback(
5828
5732
  (e) => {
5829
5733
  e.preventDefault();
5830
5734
  if (disabled) return;
@@ -5834,7 +5738,7 @@ function ControlButton({
5834
5738
  },
5835
5739
  [disabled, pressEvent, eventBus, onPress]
5836
5740
  );
5837
- const handlePointerUp = React115.useCallback(
5741
+ const handlePointerUp = React114.useCallback(
5838
5742
  (e) => {
5839
5743
  e.preventDefault();
5840
5744
  if (disabled) return;
@@ -5844,7 +5748,7 @@ function ControlButton({
5844
5748
  },
5845
5749
  [disabled, releaseEvent, eventBus, onRelease]
5846
5750
  );
5847
- const handlePointerLeave = React115.useCallback(
5751
+ const handlePointerLeave = React114.useCallback(
5848
5752
  (e) => {
5849
5753
  if (isPressed) {
5850
5754
  setIsPressed(false);
@@ -6742,9 +6646,9 @@ function MiniMap({
6742
6646
  viewportRect,
6743
6647
  className
6744
6648
  }) {
6745
- const canvasRef = React115.useRef(null);
6746
- const frameRef = React115.useRef(0);
6747
- React115.useEffect(() => {
6649
+ const canvasRef = React114.useRef(null);
6650
+ const frameRef = React114.useRef(0);
6651
+ React114.useEffect(() => {
6748
6652
  const canvas = canvasRef.current;
6749
6653
  if (!canvas) return;
6750
6654
  const ctx = canvas.getContext("2d");
@@ -6952,7 +6856,7 @@ var init_ErrorBoundary = __esm({
6952
6856
  "use client";
6953
6857
  init_cn();
6954
6858
  init_ErrorState();
6955
- ErrorBoundary = class extends React115__default.Component {
6859
+ ErrorBoundary = class extends React114__default.Component {
6956
6860
  constructor(props) {
6957
6861
  super(props);
6958
6862
  __publicField(this, "reset", () => {
@@ -7425,8 +7329,8 @@ var init_Tooltip = __esm({
7425
7329
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7426
7330
  };
7427
7331
  }, []);
7428
- const triggerElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7429
- const trigger = React115__default.cloneElement(triggerElement, {
7332
+ const triggerElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7333
+ const trigger = React114__default.cloneElement(triggerElement, {
7430
7334
  ref: triggerRef,
7431
7335
  onMouseEnter: handleMouseEnter,
7432
7336
  onMouseLeave: handleMouseLeave,
@@ -7547,8 +7451,8 @@ var init_Popover = __esm({
7547
7451
  onMouseEnter: handleOpen,
7548
7452
  onMouseLeave: handleClose
7549
7453
  };
7550
- const childElement = React115__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7551
- const triggerElement = React115__default.cloneElement(
7454
+ const childElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7455
+ const triggerElement = React114__default.cloneElement(
7552
7456
  childElement,
7553
7457
  {
7554
7458
  ref: triggerRef,
@@ -7665,8 +7569,8 @@ var init_Menu = __esm({
7665
7569
  "bottom-start": "top-full left-0 mt-2",
7666
7570
  "bottom-end": "top-full right-0 mt-2"
7667
7571
  };
7668
- const triggerChild = React115__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7669
- const triggerElement = React115__default.cloneElement(
7572
+ const triggerChild = React114__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7573
+ const triggerElement = React114__default.cloneElement(
7670
7574
  triggerChild,
7671
7575
  {
7672
7576
  ref: triggerRef,
@@ -8185,12 +8089,12 @@ var init_MapView = __esm({
8185
8089
  shadowSize: [41, 41]
8186
8090
  });
8187
8091
  L.Marker.prototype.options.icon = defaultIcon;
8188
- const { useEffect: useEffect70, useRef: useRef65, useCallback: useCallback110, useState: useState103 } = React115__default;
8092
+ const { useEffect: useEffect70, useRef: useRef64, useCallback: useCallback109, useState: useState102 } = React114__default;
8189
8093
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8190
8094
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8191
8095
  function MapUpdater({ centerLat, centerLng, zoom }) {
8192
8096
  const map = useMap();
8193
- const prevRef = useRef65({ centerLat, centerLng, zoom });
8097
+ const prevRef = useRef64({ centerLat, centerLng, zoom });
8194
8098
  useEffect70(() => {
8195
8099
  const prev = prevRef.current;
8196
8100
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -8229,8 +8133,8 @@ var init_MapView = __esm({
8229
8133
  showAttribution = true
8230
8134
  }) {
8231
8135
  const eventBus = useEventBus2();
8232
- const [clickedPosition, setClickedPosition] = useState103(null);
8233
- const handleMapClick = useCallback110((lat, lng) => {
8136
+ const [clickedPosition, setClickedPosition] = useState102(null);
8137
+ const handleMapClick = useCallback109((lat, lng) => {
8234
8138
  if (showClickedPin) {
8235
8139
  setClickedPosition({ lat, lng });
8236
8140
  }
@@ -8239,7 +8143,7 @@ var init_MapView = __esm({
8239
8143
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
8240
8144
  }
8241
8145
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
8242
- const handleMarkerClick = useCallback110((marker) => {
8146
+ const handleMarkerClick = useCallback109((marker) => {
8243
8147
  onMarkerClick?.(marker);
8244
8148
  if (markerClickEvent) {
8245
8149
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -8416,7 +8320,7 @@ function InputPattern({
8416
8320
  fieldName
8417
8321
  }) {
8418
8322
  const { emit } = useEventBus();
8419
- const [localValue, setLocalValue] = React115__default.useState(value);
8323
+ const [localValue, setLocalValue] = React114__default.useState(value);
8420
8324
  const handleChange = (e) => {
8421
8325
  setLocalValue(e.target.value);
8422
8326
  if (onChange) {
@@ -8454,7 +8358,7 @@ function TextareaPattern({
8454
8358
  fieldName
8455
8359
  }) {
8456
8360
  const { emit } = useEventBus();
8457
- const [localValue, setLocalValue] = React115__default.useState(value);
8361
+ const [localValue, setLocalValue] = React114__default.useState(value);
8458
8362
  const handleChange = (e) => {
8459
8363
  setLocalValue(e.target.value);
8460
8364
  if (onChange) {
@@ -8486,7 +8390,7 @@ function SelectPattern({
8486
8390
  fieldName
8487
8391
  }) {
8488
8392
  const { emit } = useEventBus();
8489
- const [localValue, setLocalValue] = React115__default.useState(value);
8393
+ const [localValue, setLocalValue] = React114__default.useState(value);
8490
8394
  const handleChange = (e) => {
8491
8395
  setLocalValue(e.target.value);
8492
8396
  if (onChange) {
@@ -8515,7 +8419,7 @@ function CheckboxPattern({
8515
8419
  className
8516
8420
  }) {
8517
8421
  const { emit } = useEventBus();
8518
- const [localChecked, setLocalChecked] = React115__default.useState(checked);
8422
+ const [localChecked, setLocalChecked] = React114__default.useState(checked);
8519
8423
  const handleChange = (e) => {
8520
8424
  setLocalChecked(e.target.checked);
8521
8425
  if (onChange) {
@@ -8746,8 +8650,8 @@ function ActionButtons({
8746
8650
  disabled
8747
8651
  }) {
8748
8652
  const eventBus = useEventBus();
8749
- const [activeButtons, setActiveButtons] = React115.useState(/* @__PURE__ */ new Set());
8750
- const handlePress = React115.useCallback(
8653
+ const [activeButtons, setActiveButtons] = React114.useState(/* @__PURE__ */ new Set());
8654
+ const handlePress = React114.useCallback(
8751
8655
  (id) => {
8752
8656
  setActiveButtons((prev) => new Set(prev).add(id));
8753
8657
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8755,7 +8659,7 @@ function ActionButtons({
8755
8659
  },
8756
8660
  [actionEvent, eventBus, onAction]
8757
8661
  );
8758
- const handleRelease = React115.useCallback(
8662
+ const handleRelease = React114.useCallback(
8759
8663
  (id) => {
8760
8664
  setActiveButtons((prev) => {
8761
8665
  const next = new Set(prev);
@@ -10559,7 +10463,7 @@ var init_MarkdownContent = __esm({
10559
10463
  init_Box();
10560
10464
  init_useTranslate();
10561
10465
  init_cn();
10562
- MarkdownContent = React115__default.memo(
10466
+ MarkdownContent = React114__default.memo(
10563
10467
  ({ content, direction, className }) => {
10564
10468
  const { t: _t } = useTranslate();
10565
10469
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -10776,7 +10680,7 @@ var init_CodeBlock = __esm({
10776
10680
  loloStyle = { ...dark, ...loloStyleOverrides };
10777
10681
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
10778
10682
  HIDDEN_LINE_NUMBERS = { display: "none" };
10779
- CodeBlock = React115__default.memo(
10683
+ CodeBlock = React114__default.memo(
10780
10684
  ({
10781
10685
  code: rawCode,
10782
10686
  language = "text",
@@ -12035,7 +11939,7 @@ var init_StateMachineView = __esm({
12035
11939
  style: { top: title ? 30 : 0 },
12036
11940
  children: [
12037
11941
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
12038
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React115__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11942
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React114__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
12039
11943
  StateNode,
12040
11944
  {
12041
11945
  state,
@@ -17751,7 +17655,7 @@ function CraftingRecipe({
17751
17655
  className
17752
17656
  }) {
17753
17657
  const eventBus = useEventBus();
17754
- const handleCraft = React115.useCallback(() => {
17658
+ const handleCraft = React114.useCallback(() => {
17755
17659
  onCraft?.();
17756
17660
  if (craftEvent) {
17757
17661
  eventBus.emit(craftEvent, { output: output.label });
@@ -17768,7 +17672,7 @@ function CraftingRecipe({
17768
17672
  children: [
17769
17673
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
17770
17674
  const hasSufficient = ingredient.available >= ingredient.required;
17771
- return /* @__PURE__ */ jsxs(React115.Fragment, { children: [
17675
+ return /* @__PURE__ */ jsxs(React114.Fragment, { children: [
17772
17676
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
17773
17677
  ItemSlot,
17774
17678
  {
@@ -18062,8 +17966,8 @@ function DPad({
18062
17966
  }) {
18063
17967
  const eventBus = useEventBus();
18064
17968
  const sizes = sizeMap15[size];
18065
- const [activeDirections, setActiveDirections] = React115.useState(/* @__PURE__ */ new Set());
18066
- const handlePress = React115.useCallback(
17969
+ const [activeDirections, setActiveDirections] = React114.useState(/* @__PURE__ */ new Set());
17970
+ const handlePress = React114.useCallback(
18067
17971
  (direction) => {
18068
17972
  setActiveDirections((prev) => new Set(prev).add(direction));
18069
17973
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -18071,7 +17975,7 @@ function DPad({
18071
17975
  },
18072
17976
  [directionEvent, eventBus, onDirection]
18073
17977
  );
18074
- const handleRelease = React115.useCallback(
17978
+ const handleRelease = React114.useCallback(
18075
17979
  (direction) => {
18076
17980
  setActiveDirections((prev) => {
18077
17981
  const next = new Set(prev);
@@ -18957,7 +18861,7 @@ function DataList({
18957
18861
  }) {
18958
18862
  const eventBus = useEventBus();
18959
18863
  const { t } = useTranslate();
18960
- const [visibleCount, setVisibleCount] = React115__default.useState(pageSize || Infinity);
18864
+ const [visibleCount, setVisibleCount] = React114__default.useState(pageSize || Infinity);
18961
18865
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18962
18866
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18963
18867
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
@@ -18997,7 +18901,7 @@ function DataList({
18997
18901
  const items2 = data.map((item) => item);
18998
18902
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
18999
18903
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
19000
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
18904
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
19001
18905
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
19002
18906
  group.items.map((itemData, index) => {
19003
18907
  const id = itemData.id || `${gi}-${index}`;
@@ -19044,7 +18948,7 @@ function DataList({
19044
18948
  ] }, gi)) });
19045
18949
  }
19046
18950
  const hasRenderProp = typeof children === "function";
19047
- React115__default.useEffect(() => {
18951
+ React114__default.useEffect(() => {
19048
18952
  const renderItemTypeOf = typeof schemaRenderItem;
19049
18953
  const childrenTypeOf = typeof children;
19050
18954
  if (data.length > 0 && !hasRenderProp) {
@@ -19209,7 +19113,7 @@ function DataList({
19209
19113
  className
19210
19114
  ),
19211
19115
  children: [
19212
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
19116
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
19213
19117
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
19214
19118
  group.items.map(
19215
19119
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -20421,7 +20325,7 @@ var init_WizardProgress = __esm({
20421
20325
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
20422
20326
  const isActive = index === currentStep;
20423
20327
  const isCompleted = index < currentStep;
20424
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
20328
+ return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
20425
20329
  /* @__PURE__ */ jsx(
20426
20330
  "button",
20427
20331
  {
@@ -21332,7 +21236,7 @@ function InventoryGrid({
21332
21236
  const eventBus = useEventBus();
21333
21237
  const slotCount = totalSlots ?? items.length;
21334
21238
  const emptySlotCount = Math.max(0, slotCount - items.length);
21335
- const handleSelect = React115.useCallback(
21239
+ const handleSelect = React114.useCallback(
21336
21240
  (id) => {
21337
21241
  onSelect?.(id);
21338
21242
  if (selectEvent) {
@@ -21545,15 +21449,15 @@ function GameCanvas2D({
21545
21449
  fps = 60,
21546
21450
  className
21547
21451
  }) {
21548
- const canvasRef = React115.useRef(null);
21549
- const rafRef = React115.useRef(0);
21550
- const frameRef = React115.useRef(0);
21551
- const lastTimeRef = React115.useRef(0);
21552
- const onDrawRef = React115.useRef(onDraw);
21452
+ const canvasRef = React114.useRef(null);
21453
+ const rafRef = React114.useRef(0);
21454
+ const frameRef = React114.useRef(0);
21455
+ const lastTimeRef = React114.useRef(0);
21456
+ const onDrawRef = React114.useRef(onDraw);
21553
21457
  onDrawRef.current = onDraw;
21554
- const onTickRef = React115.useRef(onTick);
21458
+ const onTickRef = React114.useRef(onTick);
21555
21459
  onTickRef.current = onTick;
21556
- React115.useEffect(() => {
21460
+ React114.useEffect(() => {
21557
21461
  const canvas = canvasRef.current;
21558
21462
  if (!canvas) return;
21559
21463
  const ctx = canvas.getContext("2d");
@@ -21842,7 +21746,7 @@ function TurnPanel({
21842
21746
  className
21843
21747
  }) {
21844
21748
  const eventBus = useEventBus();
21845
- const handleAction = React115.useCallback(
21749
+ const handleAction = React114.useCallback(
21846
21750
  (event) => {
21847
21751
  if (event) {
21848
21752
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -21988,7 +21892,7 @@ function UnitCommandBar({
21988
21892
  className
21989
21893
  }) {
21990
21894
  const eventBus = useEventBus();
21991
- const handleCommand = React115.useCallback(
21895
+ const handleCommand = React114.useCallback(
21992
21896
  (event) => {
21993
21897
  if (event) {
21994
21898
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -22473,7 +22377,7 @@ function GameMenu({
22473
22377
  } catch {
22474
22378
  }
22475
22379
  const eventBus = eventBusProp || eventBusFromHook;
22476
- const handleOptionClick = React115.useCallback(
22380
+ const handleOptionClick = React114.useCallback(
22477
22381
  (option) => {
22478
22382
  if (option.event && eventBus) {
22479
22383
  eventBus.emit(`UI:${option.event}`, { option });
@@ -22587,7 +22491,7 @@ function GameOverScreen({
22587
22491
  } catch {
22588
22492
  }
22589
22493
  const eventBus = eventBusProp || eventBusFromHook;
22590
- const handleActionClick = React115.useCallback(
22494
+ const handleActionClick = React114.useCallback(
22591
22495
  (action) => {
22592
22496
  if (action.event && eventBus) {
22593
22497
  eventBus.emit(`UI:${action.event}`, { action });
@@ -25553,7 +25457,7 @@ var init_StepFlow = __esm({
25553
25457
  className
25554
25458
  }) => {
25555
25459
  if (orientation === "vertical") {
25556
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React115__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
25460
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React114__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
25557
25461
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
25558
25462
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25559
25463
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -25564,7 +25468,7 @@ var init_StepFlow = __esm({
25564
25468
  ] })
25565
25469
  ] }) }, index)) });
25566
25470
  }
25567
- 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(React115__default.Fragment, { children: [
25471
+ 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(React114__default.Fragment, { children: [
25568
25472
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
25569
25473
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25570
25474
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27678,7 +27582,7 @@ var init_DocumentViewer = __esm({
27678
27582
  }
27679
27583
  });
27680
27584
  function extractTitle(children) {
27681
- if (!React115__default.isValidElement(children)) return void 0;
27585
+ if (!React114__default.isValidElement(children)) return void 0;
27682
27586
  const props = children.props;
27683
27587
  if (typeof props.title === "string") {
27684
27588
  return props.title;
@@ -27733,7 +27637,7 @@ function LinearView({
27733
27637
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
27734
27638
  const isDone = i < currentIdx;
27735
27639
  const isCurrent = i === currentIdx;
27736
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
27640
+ return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
27737
27641
  i > 0 && /* @__PURE__ */ jsx(
27738
27642
  Typography,
27739
27643
  {
@@ -28517,12 +28421,12 @@ var init_Form = __esm({
28517
28421
  const isSchemaEntity = isOrbitalEntitySchema(entity);
28518
28422
  const resolvedEntity = isSchemaEntity ? entity : void 0;
28519
28423
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28520
- const normalizedInitialData = React115__default.useMemo(() => {
28424
+ const normalizedInitialData = React114__default.useMemo(() => {
28521
28425
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28522
28426
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28523
28427
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28524
28428
  }, [entity, initialData]);
28525
- const entityDerivedFields = React115__default.useMemo(() => {
28429
+ const entityDerivedFields = React114__default.useMemo(() => {
28526
28430
  if (fields && fields.length > 0) return void 0;
28527
28431
  if (!resolvedEntity) return void 0;
28528
28432
  return resolvedEntity.fields.map(
@@ -28541,14 +28445,14 @@ var init_Form = __esm({
28541
28445
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
28542
28446
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
28543
28447
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
28544
- const [formData, setFormData] = React115__default.useState(
28448
+ const [formData, setFormData] = React114__default.useState(
28545
28449
  normalizedInitialData
28546
28450
  );
28547
- const [collapsedSections, setCollapsedSections] = React115__default.useState(
28451
+ const [collapsedSections, setCollapsedSections] = React114__default.useState(
28548
28452
  /* @__PURE__ */ new Set()
28549
28453
  );
28550
28454
  const formMode = props.mode;
28551
- const mountedRef = React115__default.useRef(false);
28455
+ const mountedRef = React114__default.useRef(false);
28552
28456
  if (!mountedRef.current) {
28553
28457
  mountedRef.current = true;
28554
28458
  debug("forms", "mount", {
@@ -28561,7 +28465,7 @@ var init_Form = __esm({
28561
28465
  });
28562
28466
  }
28563
28467
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
28564
- const evalContext = React115__default.useMemo(
28468
+ const evalContext = React114__default.useMemo(
28565
28469
  () => ({
28566
28470
  formValues: formData,
28567
28471
  globalVariables: externalContext?.globalVariables ?? {},
@@ -28570,7 +28474,7 @@ var init_Form = __esm({
28570
28474
  }),
28571
28475
  [formData, externalContext]
28572
28476
  );
28573
- React115__default.useEffect(() => {
28477
+ React114__default.useEffect(() => {
28574
28478
  debug("forms", "initialData-sync", {
28575
28479
  mode: formMode,
28576
28480
  normalizedInitialData,
@@ -28581,7 +28485,7 @@ var init_Form = __esm({
28581
28485
  setFormData(normalizedInitialData);
28582
28486
  }
28583
28487
  }, [normalizedInitialData]);
28584
- const processCalculations = React115__default.useCallback(
28488
+ const processCalculations = React114__default.useCallback(
28585
28489
  (changedFieldId, newFormData) => {
28586
28490
  if (!hiddenCalculations.length) return;
28587
28491
  const context = {
@@ -28606,7 +28510,7 @@ var init_Form = __esm({
28606
28510
  },
28607
28511
  [hiddenCalculations, externalContext, eventBus]
28608
28512
  );
28609
- const checkViolations = React115__default.useCallback(
28513
+ const checkViolations = React114__default.useCallback(
28610
28514
  (changedFieldId, newFormData) => {
28611
28515
  if (!violationTriggers.length) return;
28612
28516
  const context = {
@@ -28644,7 +28548,7 @@ var init_Form = __esm({
28644
28548
  processCalculations(name, newFormData);
28645
28549
  checkViolations(name, newFormData);
28646
28550
  };
28647
- const isFieldVisible = React115__default.useCallback(
28551
+ const isFieldVisible = React114__default.useCallback(
28648
28552
  (fieldName) => {
28649
28553
  const condition = conditionalFields[fieldName];
28650
28554
  if (!condition) return true;
@@ -28652,7 +28556,7 @@ var init_Form = __esm({
28652
28556
  },
28653
28557
  [conditionalFields, evalContext]
28654
28558
  );
28655
- const isSectionVisible = React115__default.useCallback(
28559
+ const isSectionVisible = React114__default.useCallback(
28656
28560
  (section) => {
28657
28561
  if (!section.condition) return true;
28658
28562
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -28696,7 +28600,7 @@ var init_Form = __esm({
28696
28600
  eventBus.emit(`UI:${onCancel}`);
28697
28601
  }
28698
28602
  };
28699
- const renderField = React115__default.useCallback(
28603
+ const renderField = React114__default.useCallback(
28700
28604
  (field) => {
28701
28605
  const fieldName = field.name || field.field;
28702
28606
  if (!fieldName) return null;
@@ -28717,7 +28621,7 @@ var init_Form = __esm({
28717
28621
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
28718
28622
  );
28719
28623
  const effectiveFields = entityDerivedFields ?? fields;
28720
- const normalizedFields = React115__default.useMemo(() => {
28624
+ const normalizedFields = React114__default.useMemo(() => {
28721
28625
  if (!effectiveFields || effectiveFields.length === 0) return [];
28722
28626
  return effectiveFields.map((field) => {
28723
28627
  if (typeof field === "string") {
@@ -28739,7 +28643,7 @@ var init_Form = __esm({
28739
28643
  return field;
28740
28644
  });
28741
28645
  }, [effectiveFields, resolvedEntity]);
28742
- const schemaFields = React115__default.useMemo(() => {
28646
+ const schemaFields = React114__default.useMemo(() => {
28743
28647
  if (normalizedFields.length === 0) return null;
28744
28648
  if (isDebugEnabled()) {
28745
28649
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -28749,7 +28653,7 @@ var init_Form = __esm({
28749
28653
  }
28750
28654
  return normalizedFields.map(renderField).filter(Boolean);
28751
28655
  }, [normalizedFields, renderField, entityName, conditionalFields]);
28752
- const sectionElements = React115__default.useMemo(() => {
28656
+ const sectionElements = React114__default.useMemo(() => {
28753
28657
  if (!sections || sections.length === 0) return null;
28754
28658
  return sections.map((section) => {
28755
28659
  if (!isSectionVisible(section)) {
@@ -30273,7 +30177,7 @@ var init_List = __esm({
30273
30177
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
30274
30178
  return [];
30275
30179
  }, [entity]);
30276
- const getItemActions = React115__default.useCallback(
30180
+ const getItemActions = React114__default.useCallback(
30277
30181
  (item) => {
30278
30182
  if (!itemActions) return [];
30279
30183
  if (typeof itemActions === "function") {
@@ -30710,7 +30614,7 @@ var init_MediaGallery = __esm({
30710
30614
  [selectable, selectedItems, selectionEvent, eventBus]
30711
30615
  );
30712
30616
  const entityData = Array.isArray(entity) ? entity : [];
30713
- const items = React115__default.useMemo(() => {
30617
+ const items = React114__default.useMemo(() => {
30714
30618
  if (propItems) return propItems;
30715
30619
  if (entityData.length === 0) return [];
30716
30620
  return entityData.map((record, idx) => ({
@@ -30874,7 +30778,7 @@ var init_MediaGallery = __esm({
30874
30778
  }
30875
30779
  });
30876
30780
  function extractTitle2(children) {
30877
- if (!React115__default.isValidElement(children)) return void 0;
30781
+ if (!React114__default.isValidElement(children)) return void 0;
30878
30782
  const props = children.props;
30879
30783
  if (typeof props.title === "string") {
30880
30784
  return props.title;
@@ -31587,7 +31491,7 @@ var init_PageHeader = __esm({
31587
31491
  info: "bg-info/10 text-info"
31588
31492
  };
31589
31493
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
31590
- 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(React115__default.Fragment, { children: [
31494
+ 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(React114__default.Fragment, { children: [
31591
31495
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
31592
31496
  crumb.href ? /* @__PURE__ */ jsx(
31593
31497
  "a",
@@ -31745,7 +31649,7 @@ var init_debugRegistry = __esm({
31745
31649
  }
31746
31650
  });
31747
31651
  function useDebugData() {
31748
- const [data, setData] = React115.useState(() => ({
31652
+ const [data, setData] = React114.useState(() => ({
31749
31653
  traits: [],
31750
31654
  ticks: [],
31751
31655
  guards: [],
@@ -31759,7 +31663,7 @@ function useDebugData() {
31759
31663
  },
31760
31664
  lastUpdate: Date.now()
31761
31665
  }));
31762
- React115.useEffect(() => {
31666
+ React114.useEffect(() => {
31763
31667
  const updateData = () => {
31764
31668
  setData({
31765
31669
  traits: getAllTraits(),
@@ -31868,12 +31772,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
31868
31772
  return positions;
31869
31773
  }
31870
31774
  function WalkMinimap() {
31871
- const [walkStep, setWalkStep] = React115.useState(null);
31872
- const [traits2, setTraits] = React115.useState([]);
31873
- const [coveredEdges, setCoveredEdges] = React115.useState([]);
31874
- const [completedTraits, setCompletedTraits] = React115.useState(/* @__PURE__ */ new Set());
31875
- const prevTraitRef = React115.useRef(null);
31876
- React115.useEffect(() => {
31775
+ const [walkStep, setWalkStep] = React114.useState(null);
31776
+ const [traits2, setTraits] = React114.useState([]);
31777
+ const [coveredEdges, setCoveredEdges] = React114.useState([]);
31778
+ const [completedTraits, setCompletedTraits] = React114.useState(/* @__PURE__ */ new Set());
31779
+ const prevTraitRef = React114.useRef(null);
31780
+ React114.useEffect(() => {
31877
31781
  const interval = setInterval(() => {
31878
31782
  const w = window;
31879
31783
  const step = w.__orbitalWalkStep;
@@ -32320,15 +32224,15 @@ var init_EntitiesTab = __esm({
32320
32224
  }
32321
32225
  });
32322
32226
  function EventFlowTab({ events: events2 }) {
32323
- const [filter, setFilter] = React115.useState("all");
32324
- const containerRef = React115.useRef(null);
32325
- const [autoScroll, setAutoScroll] = React115.useState(true);
32326
- React115.useEffect(() => {
32227
+ const [filter, setFilter] = React114.useState("all");
32228
+ const containerRef = React114.useRef(null);
32229
+ const [autoScroll, setAutoScroll] = React114.useState(true);
32230
+ React114.useEffect(() => {
32327
32231
  if (autoScroll && containerRef.current) {
32328
32232
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32329
32233
  }
32330
32234
  }, [events2.length, autoScroll]);
32331
- const filteredEvents = React115.useMemo(() => {
32235
+ const filteredEvents = React114.useMemo(() => {
32332
32236
  if (filter === "all") return events2;
32333
32237
  return events2.filter((e) => e.type === filter);
32334
32238
  }, [events2, filter]);
@@ -32447,7 +32351,7 @@ var init_EventFlowTab = __esm({
32447
32351
  }
32448
32352
  });
32449
32353
  function GuardsPanel({ guards }) {
32450
- const [filter, setFilter] = React115.useState("all");
32354
+ const [filter, setFilter] = React114.useState("all");
32451
32355
  if (guards.length === 0) {
32452
32356
  return /* @__PURE__ */ jsx(
32453
32357
  EmptyState,
@@ -32460,7 +32364,7 @@ function GuardsPanel({ guards }) {
32460
32364
  }
32461
32365
  const passedCount = guards.filter((g) => g.result).length;
32462
32366
  const failedCount = guards.length - passedCount;
32463
- const filteredGuards = React115.useMemo(() => {
32367
+ const filteredGuards = React114.useMemo(() => {
32464
32368
  if (filter === "all") return guards;
32465
32369
  if (filter === "passed") return guards.filter((g) => g.result);
32466
32370
  return guards.filter((g) => !g.result);
@@ -32621,10 +32525,10 @@ function EffectBadge({ effect }) {
32621
32525
  ] });
32622
32526
  }
32623
32527
  function TransitionTimeline({ transitions }) {
32624
- const containerRef = React115.useRef(null);
32625
- const [autoScroll, setAutoScroll] = React115.useState(true);
32626
- const [expandedId, setExpandedId] = React115.useState(null);
32627
- React115.useEffect(() => {
32528
+ const containerRef = React114.useRef(null);
32529
+ const [autoScroll, setAutoScroll] = React114.useState(true);
32530
+ const [expandedId, setExpandedId] = React114.useState(null);
32531
+ React114.useEffect(() => {
32628
32532
  if (autoScroll && containerRef.current) {
32629
32533
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32630
32534
  }
@@ -32910,9 +32814,9 @@ function getAllEvents(traits2) {
32910
32814
  }
32911
32815
  function EventDispatcherTab({ traits: traits2, schema }) {
32912
32816
  const eventBus = useEventBus();
32913
- const [log3, setLog] = React115.useState([]);
32914
- const prevStatesRef = React115.useRef(/* @__PURE__ */ new Map());
32915
- React115.useEffect(() => {
32817
+ const [log3, setLog] = React114.useState([]);
32818
+ const prevStatesRef = React114.useRef(/* @__PURE__ */ new Map());
32819
+ React114.useEffect(() => {
32916
32820
  for (const trait of traits2) {
32917
32821
  const prev = prevStatesRef.current.get(trait.id);
32918
32822
  if (prev && prev !== trait.currentState) {
@@ -33082,10 +32986,10 @@ function VerifyModePanel({
33082
32986
  serverCount,
33083
32987
  localCount
33084
32988
  }) {
33085
- const [expanded, setExpanded] = React115.useState(true);
33086
- const scrollRef = React115.useRef(null);
33087
- const prevCountRef = React115.useRef(0);
33088
- React115.useEffect(() => {
32989
+ const [expanded, setExpanded] = React114.useState(true);
32990
+ const scrollRef = React114.useRef(null);
32991
+ const prevCountRef = React114.useRef(0);
32992
+ React114.useEffect(() => {
33089
32993
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
33090
32994
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
33091
32995
  }
@@ -33151,10 +33055,10 @@ function RuntimeDebugger({
33151
33055
  defaultTab,
33152
33056
  schema
33153
33057
  }) {
33154
- const [isCollapsed, setIsCollapsed] = React115.useState(mode === "verify" ? true : defaultCollapsed);
33155
- const [isVisible, setIsVisible] = React115.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33058
+ const [isCollapsed, setIsCollapsed] = React114.useState(mode === "verify" ? true : defaultCollapsed);
33059
+ const [isVisible, setIsVisible] = React114.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33156
33060
  const debugData = useDebugData();
33157
- React115.useEffect(() => {
33061
+ React114.useEffect(() => {
33158
33062
  if (mode === "inline") return;
33159
33063
  return onDebugToggle((enabled) => {
33160
33064
  setIsVisible(enabled);
@@ -33163,7 +33067,7 @@ function RuntimeDebugger({
33163
33067
  }
33164
33068
  });
33165
33069
  }, [mode]);
33166
- React115.useEffect(() => {
33070
+ React114.useEffect(() => {
33167
33071
  if (mode === "inline") return;
33168
33072
  const handleKeyDown = (e) => {
33169
33073
  if (e.key === "`" && isVisible) {
@@ -33712,7 +33616,7 @@ function SequenceBar({
33712
33616
  onSlotRemove(index);
33713
33617
  }, [onSlotRemove, playing]);
33714
33618
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
33715
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
33619
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
33716
33620
  i > 0 && /* @__PURE__ */ jsx(
33717
33621
  Typography,
33718
33622
  {
@@ -35057,7 +34961,7 @@ var init_StatCard2 = __esm({
35057
34961
  const labelToUse = propLabel ?? propTitle;
35058
34962
  const eventBus = useEventBus();
35059
34963
  const { t } = useTranslate();
35060
- const handleActionClick = React115__default.useCallback(() => {
34964
+ const handleActionClick = React114__default.useCallback(() => {
35061
34965
  if (action?.event) {
35062
34966
  eventBus.emit(`UI:${action.event}`, {});
35063
34967
  }
@@ -35068,7 +34972,7 @@ var init_StatCard2 = __esm({
35068
34972
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
35069
34973
  const isLoading = externalLoading ?? false;
35070
34974
  const error = externalError;
35071
- const computeMetricValue = React115__default.useCallback(
34975
+ const computeMetricValue = React114__default.useCallback(
35072
34976
  (metric, items) => {
35073
34977
  if (metric.value !== void 0) {
35074
34978
  return metric.value;
@@ -35107,7 +35011,7 @@ var init_StatCard2 = __esm({
35107
35011
  },
35108
35012
  []
35109
35013
  );
35110
- const schemaStats = React115__default.useMemo(() => {
35014
+ const schemaStats = React114__default.useMemo(() => {
35111
35015
  if (!metrics || metrics.length === 0) return null;
35112
35016
  return metrics.map((metric) => ({
35113
35017
  label: metric.label,
@@ -35115,7 +35019,7 @@ var init_StatCard2 = __esm({
35115
35019
  format: metric.format
35116
35020
  }));
35117
35021
  }, [metrics, data, computeMetricValue]);
35118
- const calculatedTrend = React115__default.useMemo(() => {
35022
+ const calculatedTrend = React114__default.useMemo(() => {
35119
35023
  if (manualTrend !== void 0) return manualTrend;
35120
35024
  if (previousValue === void 0 || currentValue === void 0)
35121
35025
  return void 0;
@@ -36099,7 +36003,7 @@ var init_Timeline = __esm({
36099
36003
  }) => {
36100
36004
  const { t } = useTranslate();
36101
36005
  const entityData = Array.isArray(entity) ? entity : [];
36102
- const items = React115__default.useMemo(() => {
36006
+ const items = React114__default.useMemo(() => {
36103
36007
  if (propItems) return propItems;
36104
36008
  if (entityData.length === 0) return [];
36105
36009
  return entityData.map((record, idx) => {
@@ -36206,7 +36110,7 @@ var init_Timeline = __esm({
36206
36110
  }
36207
36111
  });
36208
36112
  function extractToastProps(children) {
36209
- if (!React115__default.isValidElement(children)) {
36113
+ if (!React114__default.isValidElement(children)) {
36210
36114
  if (typeof children === "string") {
36211
36115
  return { message: children };
36212
36116
  }
@@ -36244,7 +36148,7 @@ var init_ToastSlot = __esm({
36244
36148
  eventBus.emit("UI:CLOSE");
36245
36149
  };
36246
36150
  if (!isVisible) return null;
36247
- const isCustomContent = React115__default.isValidElement(children) && !message;
36151
+ const isCustomContent = React114__default.isValidElement(children) && !message;
36248
36152
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
36249
36153
  Toast,
36250
36154
  {
@@ -36513,7 +36417,7 @@ var init_WizardContainer = __esm({
36513
36417
  const isCompleted = index < currentStep;
36514
36418
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36515
36419
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36516
- return /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
36420
+ return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
36517
36421
  /* @__PURE__ */ jsx(
36518
36422
  Button,
36519
36423
  {
@@ -36895,12 +36799,12 @@ var init_WorldMapTemplate = __esm({
36895
36799
  }
36896
36800
  });
36897
36801
  function lazyThree(name, loader) {
36898
- const Lazy = React115__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36802
+ const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36899
36803
  function ThreeWrapper(props) {
36900
- return React115__default.createElement(
36901
- React115__default.Suspense,
36804
+ return React114__default.createElement(
36805
+ React114__default.Suspense,
36902
36806
  { fallback: null },
36903
- React115__default.createElement(Lazy, props)
36807
+ React114__default.createElement(Lazy, props)
36904
36808
  );
36905
36809
  }
36906
36810
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -37388,7 +37292,7 @@ function SuspenseConfigProvider({
37388
37292
  config,
37389
37293
  children
37390
37294
  }) {
37391
- return React115__default.createElement(
37295
+ return React114__default.createElement(
37392
37296
  SuspenseConfigContext.Provider,
37393
37297
  { value: config },
37394
37298
  children
@@ -37871,7 +37775,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37871
37775
  const key = `${parentId}-${index}-trait:${traitName}`;
37872
37776
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
37873
37777
  }
37874
- return /* @__PURE__ */ jsx(React115__default.Fragment, { children: child }, `${parentId}-${index}`);
37778
+ return /* @__PURE__ */ jsx(React114__default.Fragment, { children: child }, `${parentId}-${index}`);
37875
37779
  }
37876
37780
  if (!child || typeof child !== "object") return null;
37877
37781
  const childId = `${parentId}-${index}`;
@@ -38084,7 +37988,7 @@ var init_UISlotRenderer = __esm({
38084
37988
  init_Box();
38085
37989
  init_Typography();
38086
37990
  init_useEventBus();
38087
- init_SlotsContext();
37991
+ init_slot_types();
38088
37992
  init_cn();
38089
37993
  init_ErrorBoundary();
38090
37994
  init_logger();
@@ -38235,6 +38139,7 @@ init_EntitySchemaContext();
38235
38139
  init_traitRegistry();
38236
38140
  init_verificationRegistry();
38237
38141
  var crossTraitLog = createLogger("almadar:ui:cross-trait");
38142
+ var flushLog = createLogger("almadar:ui:slot-flush");
38238
38143
  function toTraitDefinition(binding) {
38239
38144
  return {
38240
38145
  name: binding.trait.name,
@@ -38246,7 +38151,7 @@ function toTraitDefinition(binding) {
38246
38151
  function normalizeEventKey(eventKey) {
38247
38152
  return eventKey.startsWith("UI:") ? eventKey.slice(3) : eventKey;
38248
38153
  }
38249
- function useTraitStateMachine(traitBindings, slotsActions, options) {
38154
+ function useTraitStateMachine(traitBindings, uiSlots, options) {
38250
38155
  const eventBus = useEventBus();
38251
38156
  const { entities } = useEntitySchema();
38252
38157
  const traitConfigsByName = options?.traitConfigsByName;
@@ -38269,7 +38174,8 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38269
38174
  const processingRef = useRef(false);
38270
38175
  const traitBindingsRef = useRef(traitBindings);
38271
38176
  const managerRef = useRef(manager);
38272
- const slotsActionsRef = useRef(slotsActions);
38177
+ const uiSlotsRef = useRef(uiSlots);
38178
+ const embeddedTraitsRef = useRef(options?.embeddedTraits);
38273
38179
  const optionsRef = useRef(options);
38274
38180
  useEffect(() => {
38275
38181
  traitBindingsRef.current = traitBindings;
@@ -38279,8 +38185,59 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38279
38185
  setTraitStates(manager.getAllStates());
38280
38186
  }, [manager]);
38281
38187
  useEffect(() => {
38282
- slotsActionsRef.current = slotsActions;
38283
- }, [slotsActions]);
38188
+ uiSlotsRef.current = uiSlots;
38189
+ }, [uiSlots]);
38190
+ useEffect(() => {
38191
+ embeddedTraitsRef.current = options?.embeddedTraits;
38192
+ }, [options?.embeddedTraits]);
38193
+ const flushSlot = useCallback(
38194
+ (traitName, slot, patterns) => {
38195
+ const slots = uiSlotsRef.current;
38196
+ const embedded = embeddedTraitsRef.current;
38197
+ if (patterns.length === 0) {
38198
+ flushLog.info("clear", { traitName, slot });
38199
+ slots.clearBySource(slot, traitName);
38200
+ return;
38201
+ }
38202
+ const last = patterns[patterns.length - 1];
38203
+ const record = last.pattern ?? {};
38204
+ const { type: patternType, children: nested, ...inlineProps } = record;
38205
+ const props = {
38206
+ ...inlineProps,
38207
+ ...last.props,
38208
+ ...nested !== void 0 ? { children: nested } : {}
38209
+ };
38210
+ const isEmbedded = embedded?.has(traitName) ?? false;
38211
+ if (isEmbedded) {
38212
+ flushLog.info("embed-route", {
38213
+ traitName,
38214
+ slot,
38215
+ patternType: typeof patternType === "string" ? patternType : void 0,
38216
+ embeddedSize: embedded?.size ?? 0
38217
+ });
38218
+ slots.updateTraitContent(traitName, {
38219
+ pattern: patternType,
38220
+ props,
38221
+ priority: 0,
38222
+ animation: "fade"
38223
+ });
38224
+ return;
38225
+ }
38226
+ flushLog.info("slot-render", {
38227
+ traitName,
38228
+ slot,
38229
+ patternType: typeof patternType === "string" ? patternType : void 0,
38230
+ embedded: Array.from(embedded ?? [])
38231
+ });
38232
+ slots.render({
38233
+ target: slot,
38234
+ pattern: patternType,
38235
+ props,
38236
+ sourceTrait: traitName
38237
+ });
38238
+ },
38239
+ []
38240
+ );
38284
38241
  useEffect(() => {
38285
38242
  optionsRef.current = options;
38286
38243
  }, [options]);
@@ -38373,7 +38330,6 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38373
38330
  };
38374
38331
  }, [traitBindings]);
38375
38332
  const runTickEffects = useCallback((tick, binding) => {
38376
- const actions = slotsActionsRef.current;
38377
38333
  const currentState = traitStatesRef.current.get(binding.trait.name)?.currentState ?? "";
38378
38334
  if (tick.appliesTo.length > 0 && !tick.appliesTo.includes(currentState)) return;
38379
38335
  const bindingCtx = { entity: {}, payload: {}, state: currentState };
@@ -38386,13 +38342,12 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38386
38342
  if (!passed) return;
38387
38343
  }
38388
38344
  const pendingSlots = /* @__PURE__ */ new Map();
38389
- const slotSource = {
38345
+ ({
38390
38346
  trait: binding.trait.name,
38391
- state: currentState,
38392
38347
  transition: `${currentState}->tick:${tick.name}`,
38393
38348
  effects: tick.effects,
38394
38349
  traitDefinition: binding.trait
38395
- };
38350
+ });
38396
38351
  for (const effect of tick.effects) {
38397
38352
  if (!Array.isArray(effect)) continue;
38398
38353
  const op = effect[0];
@@ -38411,13 +38366,9 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38411
38366
  }
38412
38367
  }
38413
38368
  for (const [slot, patterns] of pendingSlots) {
38414
- if (patterns.length === 0) {
38415
- actions.clearSlot(slot);
38416
- } else {
38417
- actions.setSlotPatterns(slot, patterns, slotSource);
38418
- }
38369
+ flushSlot(binding.trait.name, slot, patterns);
38419
38370
  }
38420
- }, []);
38371
+ }, [flushSlot]);
38421
38372
  useEffect(() => {
38422
38373
  const hasFrameTicks = traitBindingsRef.current.some(
38423
38374
  (b) => b.trait.ticks?.some((t) => t.interval === "frame")
@@ -38460,7 +38411,6 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38460
38411
  const normalizedEvent = normalizeEventKey(eventKey);
38461
38412
  const bindings = traitBindingsRef.current;
38462
38413
  const currentManager = managerRef.current;
38463
- const actions = slotsActionsRef.current;
38464
38414
  console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
38465
38415
  crossTraitLog.debug("processEvent:enter", {
38466
38416
  event: normalizedEvent,
@@ -38611,12 +38561,9 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38611
38561
  "[TraitStateMachine] After executeAll, pendingSlots:",
38612
38562
  Object.fromEntries(pendingSlots.entries())
38613
38563
  );
38564
+ void slotSource;
38614
38565
  for (const [slot, patterns] of pendingSlots) {
38615
- if (patterns.length === 0) {
38616
- actions.clearSlot(slot);
38617
- } else {
38618
- actions.setSlotPatterns(slot, patterns, slotSource);
38619
- }
38566
+ flushSlot(traitName, slot, patterns);
38620
38567
  }
38621
38568
  } catch (error) {
38622
38569
  console.error(
@@ -38968,9 +38915,6 @@ function useTrait(traitName) {
38968
38915
  return context.getTrait(traitName);
38969
38916
  }
38970
38917
 
38971
- // runtime/index.ts
38972
- init_SlotsContext();
38973
-
38974
38918
  // runtime/OrbPreview.tsx
38975
38919
  init_Box();
38976
38920
  init_Typography();
@@ -39048,13 +38992,12 @@ function collectEmbeddedTraits(schema) {
39048
38992
  }
39049
38993
 
39050
38994
  // runtime/OrbPreview.tsx
39051
- init_SlotsContext();
39052
38995
  init_EntitySchemaContext();
39053
38996
 
39054
38997
  // runtime/ServerBridge.tsx
39055
38998
  init_useEventBus();
39056
38999
  init_logger();
39057
- var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
39000
+ var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
39058
39001
  function createHttpTransport(serverUrl) {
39059
39002
  return {
39060
39003
  register: async (schema) => {
@@ -39160,14 +39103,14 @@ function ServerBridgeProvider({
39160
39103
  for (const emitted of result.emittedEvents) {
39161
39104
  const evTrait = emitted.source?.trait;
39162
39105
  if (!evTrait) {
39163
- xOrbitalLog2.warn("emit:dropped-no-source", {
39106
+ xOrbitalLog.warn("emit:dropped-no-source", {
39164
39107
  event: emitted.event,
39165
39108
  dispatchOrbital: orbitalName
39166
39109
  });
39167
39110
  continue;
39168
39111
  }
39169
39112
  const key = emitted.source?.orbital ? `UI:${emitted.source.orbital}.${evTrait}.${emitted.event}` : `UI:${evTrait}.${emitted.event}`;
39170
- xOrbitalLog2.info("emit:rebroadcast", {
39113
+ xOrbitalLog.info("emit:rebroadcast", {
39171
39114
  busKey: key,
39172
39115
  sourceOrbital: emitted.source?.orbital,
39173
39116
  sourceTrait: evTrait,
@@ -39177,7 +39120,7 @@ function ServerBridgeProvider({
39177
39120
  }
39178
39121
  }
39179
39122
  } else if (result.error) {
39180
- xOrbitalLog2.warn("response:fail", {
39123
+ xOrbitalLog.warn("response:fail", {
39181
39124
  orbital: orbitalName,
39182
39125
  event,
39183
39126
  error: result.error
@@ -39185,7 +39128,7 @@ function ServerBridgeProvider({
39185
39128
  }
39186
39129
  return { effects, meta };
39187
39130
  } catch (err) {
39188
- xOrbitalLog2.error("response:network", {
39131
+ xOrbitalLog.error("response:network", {
39189
39132
  orbital: orbitalName,
39190
39133
  event,
39191
39134
  error: err instanceof Error ? err.message : String(err)
@@ -39305,7 +39248,7 @@ function prepareSchemaForPreview(input) {
39305
39248
 
39306
39249
  // runtime/OrbPreview.tsx
39307
39250
  init_logger();
39308
- var xOrbitalLog3 = createLogger("almadar:runtime:cross-orbital");
39251
+ var xOrbitalLog2 = createLogger("almadar:runtime:cross-orbital");
39309
39252
  function normalizeChild(child) {
39310
39253
  if (typeof child === "string") return child;
39311
39254
  if (child === null || typeof child !== "object" || Array.isArray(child)) {
@@ -39318,98 +39261,6 @@ function normalizeChild(child) {
39318
39261
  props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
39319
39262
  };
39320
39263
  }
39321
- function SlotBridge({ embeddedTraits }) {
39322
- const slots = useSlots();
39323
- const { render, clear, updateTraitContent } = useUISlots();
39324
- useEffect(() => {
39325
- slotLog.debug("SlotBridge:effect-fired", {
39326
- slotCount: Object.keys(slots).length,
39327
- slots: Object.keys(slots)
39328
- });
39329
- for (const [slotName, slotState] of Object.entries(slots)) {
39330
- const allEntries = slotEntriesInOrder(slotState);
39331
- const entries = [];
39332
- for (const e of allEntries) {
39333
- const traitName = e.entry.source?.trait;
39334
- if (traitName && embeddedTraits?.has(traitName)) {
39335
- const last = e.entry.patterns[e.entry.patterns.length - 1];
39336
- if (last?.pattern && typeof last.pattern === "object") {
39337
- const record = last.pattern;
39338
- const { type: patternType, children: nested, ...inlineProps } = record;
39339
- const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
39340
- updateTraitContent(traitName, {
39341
- pattern: patternType,
39342
- props: {
39343
- ...inlineProps,
39344
- ...last.props,
39345
- ...normalizedNested !== void 0 ? { children: normalizedNested } : {}
39346
- },
39347
- priority: 0,
39348
- animation: "fade"
39349
- });
39350
- }
39351
- continue;
39352
- }
39353
- entries.push(e);
39354
- }
39355
- if (entries.length === 0) {
39356
- if (allEntries.length === 0) {
39357
- clear(slotName);
39358
- } else {
39359
- slotLog.debug("SlotBridge:embed-only-skip", {
39360
- slot: slotName,
39361
- embeddedCount: allEntries.length
39362
- });
39363
- }
39364
- continue;
39365
- }
39366
- const children = entries.map(({ entry }) => entry.patterns[entry.patterns.length - 1]).filter((p2) => Boolean(p2)).map((entry) => {
39367
- const record = entry.pattern;
39368
- const { type: patternType, children: nested, ...inlineProps } = record;
39369
- const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
39370
- return {
39371
- type: patternType,
39372
- ...inlineProps,
39373
- ...entry.props,
39374
- ...normalizedNested !== void 0 ? { children: normalizedNested } : {}
39375
- };
39376
- });
39377
- if (children.length === 1) {
39378
- const only = children[0];
39379
- const { type, children: nested, ...rest } = only;
39380
- const lastEntry = entries[entries.length - 1];
39381
- slotLog.debug("SlotBridge:render-single", {
39382
- slot: slotName,
39383
- patternType: type,
39384
- entityRefId: refId(rest.entity),
39385
- sourceTrait: lastEntry.entry.source?.trait
39386
- });
39387
- render({
39388
- target: slotName,
39389
- pattern: type,
39390
- props: {
39391
- ...rest,
39392
- ...nested !== void 0 ? { children: nested } : {}
39393
- },
39394
- sourceTrait: lastEntry.entry.source?.trait
39395
- });
39396
- } else {
39397
- const lastEntry = entries[entries.length - 1];
39398
- render({
39399
- target: slotName,
39400
- pattern: "stack",
39401
- props: {
39402
- direction: "vertical",
39403
- gap: "lg",
39404
- children
39405
- },
39406
- sourceTrait: lastEntry.entry.source?.trait
39407
- });
39408
- }
39409
- }
39410
- }, [slots, render, clear, updateTraitContent, embeddedTraits]);
39411
- return null;
39412
- }
39413
39264
  function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
39414
39265
  for (const eff of effects) {
39415
39266
  if (eff.type === "render-ui" && eff.slot && eff.pattern) {
@@ -39423,7 +39274,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
39423
39274
  ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
39424
39275
  };
39425
39276
  if (isEmbedded) {
39426
- xOrbitalLog3.info("slot:embed-routed", {
39277
+ xOrbitalLog2.info("slot:embed-routed", {
39427
39278
  sourceTrait,
39428
39279
  slot: eff.slot,
39429
39280
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -39435,7 +39286,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
39435
39286
  animation: "fade"
39436
39287
  });
39437
39288
  } else {
39438
- xOrbitalLog3.info("slot-write", {
39289
+ xOrbitalLog2.info("slot-write", {
39439
39290
  slot: eff.slot,
39440
39291
  sourceTrait,
39441
39292
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -39453,13 +39304,12 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
39453
39304
  }
39454
39305
  }
39455
39306
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits }) {
39456
- const slotsActions = useSlotsActions();
39457
39307
  const bridge = useServerBridge();
39458
39308
  const uiSlots = useUISlots();
39459
39309
  const onEventProcessed = useCallback(async (event, payload, dispatchedOrbitals) => {
39460
39310
  if (!bridge.connected || !orbitalNames?.length) return;
39461
39311
  const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
39462
- xOrbitalLog3.info("TraitInitializer:fanout", {
39312
+ xOrbitalLog2.info("TraitInitializer:fanout", {
39463
39313
  event,
39464
39314
  sentTo: targets,
39465
39315
  skipped: orbitalNames.filter((n) => !targets.includes(n)),
@@ -39471,8 +39321,8 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
39471
39321
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits);
39472
39322
  }
39473
39323
  }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, embeddedTraits]);
39474
- const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait };
39475
- const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
39324
+ const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, traitConfigsByName, orbitalsByTrait, embeddedTraits } : { navigate: onNavigate, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits };
39325
+ const { sendEvent } = useTraitStateMachine(traits2, uiSlots, opts);
39476
39326
  const initSentRef = useRef(false);
39477
39327
  useEffect(() => {
39478
39328
  if (!orbitalNames?.length) {
@@ -39594,7 +39444,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
39594
39444
  const orb = orbitalsByTrait[name];
39595
39445
  if (orb) orbitalsByTraitForPage[name] = orb;
39596
39446
  }
39597
- xOrbitalLog3.info("SchemaRunner:mount", {
39447
+ xOrbitalLog2.info("SchemaRunner:mount", {
39598
39448
  pageName,
39599
39449
  traitNames,
39600
39450
  orbitalsByTraitForPage,
@@ -39620,9 +39470,15 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
39620
39470
  return map;
39621
39471
  }, [schema]);
39622
39472
  const embeddedTraits = useMemo(() => {
39623
- return collectEmbeddedTraits(schema);
39624
- }, [schema]);
39625
- const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(SlotsProvider, { children: /* @__PURE__ */ jsxs(
39473
+ const set = collectEmbeddedTraits(schema);
39474
+ xOrbitalLog2.info("SchemaRunner:embeddedTraits", {
39475
+ pageName,
39476
+ embedded: Array.from(set),
39477
+ embeddedCount: set.size
39478
+ });
39479
+ return set;
39480
+ }, [schema, pageName]);
39481
+ const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsxs(
39626
39482
  EntitySchemaProvider,
39627
39483
  {
39628
39484
  entities: entitiesArray,
@@ -39642,11 +39498,10 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
39642
39498
  persistence
39643
39499
  }
39644
39500
  ),
39645
- /* @__PURE__ */ jsx(SlotBridge, { embeddedTraits }),
39646
39501
  /* @__PURE__ */ jsx(Box, { className: "h-full p-4", children: /* @__PURE__ */ jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) })
39647
39502
  ]
39648
39503
  }
39649
- ) }) });
39504
+ ) });
39650
39505
  if (serverUrl || transport) {
39651
39506
  return /* @__PURE__ */ jsx(ServerBridgeProvider, { schema, serverUrl, transport, children: inner });
39652
39507
  }
@@ -39818,4 +39673,4 @@ function BrowserPlayground({
39818
39673
  );
39819
39674
  }
39820
39675
 
39821
- export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider, SlotsProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useSlotContent, useSlots, useSlotsActions, useTrait, useTraitContext, useTraitStateMachine };
39676
+ export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useTrait, useTraitContext, useTraitStateMachine };