@almadar/ui 4.15.2 → 4.15.4

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 React114 from 'react';
2
- import React114__default, { createContext, useContext, useMemo, useRef, useEffect, useCallback, Suspense, useState, useLayoutEffect, lazy, useId } from 'react';
1
+ import * as React113 from 'react';
2
+ import React113__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';
@@ -36,7 +36,7 @@ import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
36
36
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
37
37
  import { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, isInlineTrait } from '@almadar/core';
38
38
  import '@tanstack/react-query';
39
- import { StateMachineManager, createContextFromBindings, interpolateValue, createServerEffectHandlers, EffectExecutor, InMemoryPersistence } from '@almadar/runtime';
39
+ import { StateMachineManager, createContextFromBindings, interpolateValue, collectDeclaredConfigDefaults, createServerEffectHandlers, EffectExecutor, InMemoryPersistence } from '@almadar/runtime';
40
40
  import { OrbitalServerRuntime } from '@almadar/runtime/OrbitalServerRuntime';
41
41
 
42
42
  var __defProp = Object.defineProperty;
@@ -817,278 +817,95 @@ var init_EntitySchemaContext = __esm({
817
817
  EntitySchemaContext = createContext(null);
818
818
  }
819
819
  });
820
-
821
- // lib/traitRegistry.ts
822
- function notifyListeners() {
823
- listeners.forEach((listener) => listener());
824
- }
825
- function registerTrait(info) {
826
- traits.set(info.id, info);
827
- notifyListeners();
828
- }
829
- function updateTraitState(id, newState) {
830
- const trait = traits.get(id);
831
- if (trait) {
832
- trait.currentState = newState;
833
- trait.transitionCount++;
834
- notifyListeners();
835
- }
836
- }
837
- function unregisterTrait(id) {
838
- traits.delete(id);
839
- notifyListeners();
840
- }
841
- function getAllTraits() {
842
- return Array.from(traits.values());
843
- }
844
- function subscribeToTraitChanges(listener) {
845
- listeners.add(listener);
846
- return () => listeners.delete(listener);
820
+ function cn(...inputs) {
821
+ return twMerge(clsx(inputs));
847
822
  }
848
- var traits, listeners;
849
- var init_traitRegistry = __esm({
850
- "lib/traitRegistry.ts"() {
851
- traits = /* @__PURE__ */ new Map();
852
- listeners = /* @__PURE__ */ new Set();
823
+ var init_cn = __esm({
824
+ "lib/cn.ts"() {
853
825
  }
854
826
  });
855
-
856
- // lib/verificationRegistry.ts
857
- function getState() {
858
- if (typeof window !== "undefined") {
859
- const w = window;
860
- if (!w.__verificationRegistryState) {
861
- w.__verificationRegistryState = {
862
- checks: /* @__PURE__ */ new Map(),
863
- transitions: [],
864
- bridgeHealth: null,
865
- listeners: /* @__PURE__ */ new Set(),
866
- traitSnapshots: /* @__PURE__ */ new Map()
867
- };
868
- }
869
- return w.__verificationRegistryState;
870
- }
871
- return {
872
- checks: /* @__PURE__ */ new Map(),
873
- transitions: [],
874
- bridgeHealth: null,
875
- listeners: /* @__PURE__ */ new Set(),
876
- traitSnapshots: /* @__PURE__ */ new Map()
877
- };
878
- }
879
- function notifyListeners2() {
880
- getState().listeners.forEach((l) => l());
881
- exposeOnWindow();
827
+ function kebabToPascal(name) {
828
+ return name.split("-").map((part) => {
829
+ if (/^\d+$/.test(part)) return part;
830
+ return part.charAt(0).toUpperCase() + part.slice(1);
831
+ }).join("");
882
832
  }
883
- function registerCheck(id, label, status = "pending", details) {
884
- getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
885
- notifyListeners2();
833
+ function resolveIcon(name) {
834
+ const cached = resolvedCache.get(name);
835
+ if (cached) return cached;
836
+ const resolved = doResolve(name);
837
+ resolvedCache.set(name, resolved);
838
+ return resolved;
886
839
  }
887
- function getAllChecks() {
888
- return Array.from(getState().checks.values());
840
+ function doResolve(name) {
841
+ if (iconAliases[name]) return iconAliases[name];
842
+ const pascalName = kebabToPascal(name);
843
+ const directLookup = LucideIcons[pascalName];
844
+ if (directLookup && typeof directLookup === "object") return directLookup;
845
+ const asIs = LucideIcons[name];
846
+ if (asIs && typeof asIs === "object") return asIs;
847
+ return LucideIcons.HelpCircle;
889
848
  }
890
- function recordTransition(trace) {
891
- const entry = {
892
- ...trace,
893
- id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
894
- };
895
- log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
896
- getState().transitions.push(entry);
897
- if (getState().transitions.length > MAX_TRANSITIONS) {
898
- getState().transitions.shift();
899
- }
900
- if (entry.event === "INIT") {
901
- const hasFetch = entry.effects.some((e) => e.type === "fetch");
902
- const checkId = `init-fetch-${entry.traitName}`;
903
- if (hasFetch) {
904
- registerCheck(
905
- checkId,
906
- `INIT transition for "${entry.traitName}" has fetch effect`,
907
- "pass"
849
+ var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
850
+ var init_Icon = __esm({
851
+ "components/atoms/Icon.tsx"() {
852
+ init_cn();
853
+ iconAliases = {
854
+ "close": LucideIcons.X,
855
+ "trash": LucideIcons.Trash2,
856
+ "loader": LucideIcons.Loader2,
857
+ "stop": LucideIcons.Square,
858
+ "volume": LucideIcons.Volume2,
859
+ "volume-off": LucideIcons.VolumeX,
860
+ "refresh": LucideIcons.RefreshCw,
861
+ "share": LucideIcons.Share2,
862
+ "sort-asc": LucideIcons.ArrowUpNarrowWide,
863
+ "sort-desc": LucideIcons.ArrowDownNarrowWide
864
+ };
865
+ resolvedCache = /* @__PURE__ */ new Map();
866
+ sizeClasses = {
867
+ xs: "w-3 h-3",
868
+ sm: "w-4 h-4",
869
+ md: "w-5 h-5",
870
+ lg: "w-6 h-6",
871
+ xl: "w-8 h-8"
872
+ };
873
+ animationClasses = {
874
+ none: "",
875
+ spin: "animate-spin",
876
+ pulse: "animate-pulse"
877
+ };
878
+ Icon = ({
879
+ icon,
880
+ name,
881
+ size = "md",
882
+ color,
883
+ animation = "none",
884
+ className,
885
+ strokeWidth,
886
+ style
887
+ }) => {
888
+ const IconComponent = icon ?? (name ? resolveIcon(name) : LucideIcons.HelpCircle);
889
+ const effectiveStrokeWidth = strokeWidth ?? void 0;
890
+ return /* @__PURE__ */ jsx(
891
+ IconComponent,
892
+ {
893
+ className: cn(
894
+ sizeClasses[size],
895
+ animationClasses[animation],
896
+ // Use theme's icon color or provided color
897
+ color ? color : "text-[var(--icon-color,currentColor)]",
898
+ className
899
+ ),
900
+ strokeWidth: effectiveStrokeWidth,
901
+ style: {
902
+ ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
903
+ ...style
904
+ }
905
+ }
908
906
  );
909
- } else {
910
- const hasRenderUI = entry.effects.some((e) => e.type === "render-ui");
911
- if (hasRenderUI) {
912
- registerCheck(
913
- checkId,
914
- `INIT transition for "${entry.traitName}" missing fetch effect`,
915
- "fail",
916
- "Entity-bound render-ui without a fetch effect will show empty data"
917
- );
918
- }
919
- }
920
- }
921
- const failedEffects = entry.effects.filter((e) => e.status === "failed");
922
- if (failedEffects.length > 0) {
923
- registerCheck(
924
- `effects-${entry.id}`,
925
- `Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
926
- "fail",
927
- failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
928
- );
929
- }
930
- notifyListeners2();
931
- }
932
- function getTransitions() {
933
- return [...getState().transitions];
934
- }
935
- function recordServerResponse(orbitalName, event, response) {
936
- const serverResponse = {
937
- ...response,
938
- orbitalName,
939
- timestamp: Date.now()
940
- };
941
- const entry = {
942
- id: `srv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
943
- traitName: `server:${orbitalName}`,
944
- from: "server",
945
- to: "server",
946
- event,
947
- effects: [],
948
- serverResponse,
949
- timestamp: Date.now()
950
- };
951
- getState().transitions.push(entry);
952
- if (getState().transitions.length > MAX_TRANSITIONS) {
953
- getState().transitions.shift();
954
- }
955
- if (!response.success && response.error) {
956
- registerCheck(
957
- `server-error-${entry.id}`,
958
- `Server error for ${orbitalName}:${event}`,
959
- "fail",
960
- response.error
961
- );
962
- }
963
- notifyListeners2();
964
- }
965
- function getBridgeHealth() {
966
- const bh = getState().bridgeHealth;
967
- return bh ? { ...bh } : null;
968
- }
969
- function getSummary() {
970
- const allChecks = getAllChecks();
971
- return {
972
- totalChecks: allChecks.length,
973
- passed: allChecks.filter((c) => c.status === "pass").length,
974
- failed: allChecks.filter((c) => c.status === "fail").length,
975
- warnings: allChecks.filter((c) => c.status === "warn").length,
976
- pending: allChecks.filter((c) => c.status === "pending").length
977
- };
978
- }
979
- function getSnapshot2() {
980
- return {
981
- checks: getAllChecks(),
982
- transitions: getTransitions(),
983
- bridge: getBridgeHealth(),
984
- summary: getSummary(),
985
- traits: getTraitSnapshots()
986
- };
987
- }
988
- function getTraitSnapshots() {
989
- const snapshots = [];
990
- for (const [traitName, getter] of getState().traitSnapshots.entries()) {
991
- try {
992
- snapshots.push(getter());
993
- } catch (err) {
994
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
995
- }
996
- }
997
- return snapshots;
998
- }
999
- function subscribeToVerification(listener) {
1000
- getState().listeners.add(listener);
1001
- return () => getState().listeners.delete(listener);
1002
- }
1003
- function exposeOnWindow() {
1004
- if (typeof window === "undefined") return;
1005
- if (!window.__orbitalVerification) {
1006
- window.__orbitalVerification = {
1007
- getSnapshot: getSnapshot2,
1008
- getChecks: getAllChecks,
1009
- getTransitions,
1010
- getBridge: getBridgeHealth,
1011
- getSummary,
1012
- waitForTransition,
1013
- getTraitSnapshots
1014
907
  };
1015
- } else if (!window.__orbitalVerification.getTraitSnapshots) {
1016
- window.__orbitalVerification.getTraitSnapshots = getTraitSnapshots;
1017
- }
1018
- }
1019
- function waitForTransition(event, timeoutMs = 1e4) {
1020
- return new Promise((resolve) => {
1021
- const existing = getState().transitions.find((t) => t.event === event);
1022
- if (existing) {
1023
- resolve(existing);
1024
- return;
1025
- }
1026
- const timeout = setTimeout(() => {
1027
- unsub();
1028
- resolve(null);
1029
- }, timeoutMs);
1030
- const unsub = subscribeToVerification(() => {
1031
- const found = getState().transitions.find((t) => t.event === event);
1032
- if (found) {
1033
- clearTimeout(timeout);
1034
- unsub();
1035
- resolve(found);
1036
- }
1037
- });
1038
- });
1039
- }
1040
- function bindTraitStateGetter(getter) {
1041
- if (typeof window === "undefined") return;
1042
- exposeOnWindow();
1043
- if (window.__orbitalVerification) {
1044
- window.__orbitalVerification.getTraitState = getter;
1045
- }
1046
- }
1047
- function registerTraitSnapshot(traitName, getter) {
1048
- if (typeof window === "undefined") return () => {
1049
- };
1050
- getState().traitSnapshots.set(traitName, getter);
1051
- exposeOnWindow();
1052
- notifyListeners2();
1053
- return () => {
1054
- const s = getState();
1055
- if (s.traitSnapshots.get(traitName) === getter) {
1056
- s.traitSnapshots.delete(traitName);
1057
- notifyListeners2();
1058
- }
1059
- };
1060
- }
1061
- function bindCanvasCapture(captureFn) {
1062
- if (typeof window === "undefined") return;
1063
- exposeOnWindow();
1064
- if (window.__orbitalVerification) {
1065
- window.__orbitalVerification.captureFrame = captureFn;
1066
- }
1067
- }
1068
- function updateAssetStatus(url, status) {
1069
- if (typeof window === "undefined") return;
1070
- exposeOnWindow();
1071
- if (window.__orbitalVerification) {
1072
- if (!window.__orbitalVerification.assetStatus) {
1073
- window.__orbitalVerification.assetStatus = {};
1074
- }
1075
- window.__orbitalVerification.assetStatus[url] = status;
1076
- }
1077
- }
1078
- var log2, MAX_TRANSITIONS;
1079
- var init_verificationRegistry = __esm({
1080
- "lib/verificationRegistry.ts"() {
1081
- init_logger();
1082
- log2 = createLogger("almadar:bridge");
1083
- MAX_TRANSITIONS = 500;
1084
- exposeOnWindow();
1085
- }
1086
- });
1087
- function cn(...inputs) {
1088
- return twMerge(clsx(inputs));
1089
- }
1090
- var init_cn = __esm({
1091
- "lib/cn.ts"() {
908
+ Icon.displayName = "Icon";
1092
909
  }
1093
910
  });
1094
911
  var paddingStyles, paddingXStyles, paddingYStyles, marginStyles, marginXStyles, marginYStyles, bgStyles, roundedStyles, shadowStyles, displayStyles, overflowStyles, positionStyles, Box;
@@ -1199,7 +1016,7 @@ var init_Box = __esm({
1199
1016
  fixed: "fixed",
1200
1017
  sticky: "sticky"
1201
1018
  };
1202
- Box = React114__default.forwardRef(
1019
+ Box = React113__default.forwardRef(
1203
1020
  ({
1204
1021
  padding,
1205
1022
  paddingX,
@@ -1458,90 +1275,6 @@ var init_Typography = __esm({
1458
1275
  Text.displayName = "Text";
1459
1276
  }
1460
1277
  });
1461
- function kebabToPascal(name) {
1462
- return name.split("-").map((part) => {
1463
- if (/^\d+$/.test(part)) return part;
1464
- return part.charAt(0).toUpperCase() + part.slice(1);
1465
- }).join("");
1466
- }
1467
- function resolveIcon(name) {
1468
- const cached = resolvedCache.get(name);
1469
- if (cached) return cached;
1470
- const resolved = doResolve(name);
1471
- resolvedCache.set(name, resolved);
1472
- return resolved;
1473
- }
1474
- function doResolve(name) {
1475
- if (iconAliases[name]) return iconAliases[name];
1476
- const pascalName = kebabToPascal(name);
1477
- const directLookup = LucideIcons[pascalName];
1478
- if (directLookup && typeof directLookup === "object") return directLookup;
1479
- const asIs = LucideIcons[name];
1480
- if (asIs && typeof asIs === "object") return asIs;
1481
- return LucideIcons.HelpCircle;
1482
- }
1483
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
1484
- var init_Icon = __esm({
1485
- "components/atoms/Icon.tsx"() {
1486
- init_cn();
1487
- iconAliases = {
1488
- "close": LucideIcons.X,
1489
- "trash": LucideIcons.Trash2,
1490
- "loader": LucideIcons.Loader2,
1491
- "stop": LucideIcons.Square,
1492
- "volume": LucideIcons.Volume2,
1493
- "volume-off": LucideIcons.VolumeX,
1494
- "refresh": LucideIcons.RefreshCw,
1495
- "share": LucideIcons.Share2,
1496
- "sort-asc": LucideIcons.ArrowUpNarrowWide,
1497
- "sort-desc": LucideIcons.ArrowDownNarrowWide
1498
- };
1499
- resolvedCache = /* @__PURE__ */ new Map();
1500
- sizeClasses = {
1501
- xs: "w-3 h-3",
1502
- sm: "w-4 h-4",
1503
- md: "w-5 h-5",
1504
- lg: "w-6 h-6",
1505
- xl: "w-8 h-8"
1506
- };
1507
- animationClasses = {
1508
- none: "",
1509
- spin: "animate-spin",
1510
- pulse: "animate-pulse"
1511
- };
1512
- Icon = ({
1513
- icon,
1514
- name,
1515
- size = "md",
1516
- color,
1517
- animation = "none",
1518
- className,
1519
- strokeWidth,
1520
- style
1521
- }) => {
1522
- const IconComponent = icon ?? (name ? resolveIcon(name) : LucideIcons.HelpCircle);
1523
- const effectiveStrokeWidth = strokeWidth ?? void 0;
1524
- return /* @__PURE__ */ jsx(
1525
- IconComponent,
1526
- {
1527
- className: cn(
1528
- sizeClasses[size],
1529
- animationClasses[animation],
1530
- // Use theme's icon color or provided color
1531
- color ? color : "text-[var(--icon-color,currentColor)]",
1532
- className
1533
- ),
1534
- strokeWidth: effectiveStrokeWidth,
1535
- style: {
1536
- ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
1537
- ...style
1538
- }
1539
- }
1540
- );
1541
- };
1542
- Icon.displayName = "Icon";
1543
- }
1544
- });
1545
1278
  var Overlay;
1546
1279
  var init_Overlay = __esm({
1547
1280
  "components/atoms/Overlay.tsx"() {
@@ -1982,7 +1715,7 @@ function resolveIconProp(value, sizeClass) {
1982
1715
  const IconComp = value;
1983
1716
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
1984
1717
  }
1985
- if (React114__default.isValidElement(value)) {
1718
+ if (React113__default.isValidElement(value)) {
1986
1719
  return value;
1987
1720
  }
1988
1721
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -2058,7 +1791,7 @@ var init_Button = __esm({
2058
1791
  md: "h-4 w-4",
2059
1792
  lg: "h-5 w-5"
2060
1793
  };
2061
- Button = React114__default.forwardRef(
1794
+ Button = React113__default.forwardRef(
2062
1795
  ({
2063
1796
  className,
2064
1797
  variant = "primary",
@@ -2161,7 +1894,7 @@ var init_Badge = __esm({
2161
1894
  md: "px-2.5 py-1 text-sm",
2162
1895
  lg: "px-3 py-1.5 text-base"
2163
1896
  };
2164
- Badge = React114__default.forwardRef(
1897
+ Badge = React113__default.forwardRef(
2165
1898
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
2166
1899
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
2167
1900
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -2321,7 +2054,7 @@ var Input;
2321
2054
  var init_Input = __esm({
2322
2055
  "components/atoms/Input.tsx"() {
2323
2056
  init_cn();
2324
- Input = React114__default.forwardRef(
2057
+ Input = React113__default.forwardRef(
2325
2058
  ({
2326
2059
  className,
2327
2060
  inputType,
@@ -2439,7 +2172,7 @@ var Label;
2439
2172
  var init_Label = __esm({
2440
2173
  "components/atoms/Label.tsx"() {
2441
2174
  init_cn();
2442
- Label = React114__default.forwardRef(
2175
+ Label = React113__default.forwardRef(
2443
2176
  ({ className, required, children, ...props }, ref) => {
2444
2177
  return /* @__PURE__ */ jsxs(
2445
2178
  "label",
@@ -2465,7 +2198,7 @@ var Textarea;
2465
2198
  var init_Textarea = __esm({
2466
2199
  "components/atoms/Textarea.tsx"() {
2467
2200
  init_cn();
2468
- Textarea = React114__default.forwardRef(
2201
+ Textarea = React113__default.forwardRef(
2469
2202
  ({ className, error, ...props }, ref) => {
2470
2203
  return /* @__PURE__ */ jsx(
2471
2204
  "textarea",
@@ -2494,7 +2227,7 @@ var Select;
2494
2227
  var init_Select = __esm({
2495
2228
  "components/atoms/Select.tsx"() {
2496
2229
  init_cn();
2497
- Select = React114__default.forwardRef(
2230
+ Select = React113__default.forwardRef(
2498
2231
  ({ className, options, placeholder, error, ...props }, ref) => {
2499
2232
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2500
2233
  /* @__PURE__ */ jsxs(
@@ -2536,7 +2269,7 @@ var Checkbox;
2536
2269
  var init_Checkbox = __esm({
2537
2270
  "components/atoms/Checkbox.tsx"() {
2538
2271
  init_cn();
2539
- Checkbox = React114__default.forwardRef(
2272
+ Checkbox = React113__default.forwardRef(
2540
2273
  ({ className, label, id, ...props }, ref) => {
2541
2274
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
2542
2275
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -2618,7 +2351,7 @@ var init_Card = __esm({
2618
2351
  md: "shadow",
2619
2352
  lg: "shadow-lg"
2620
2353
  };
2621
- Card = React114__default.forwardRef(
2354
+ Card = React113__default.forwardRef(
2622
2355
  ({
2623
2356
  className,
2624
2357
  variant = "bordered",
@@ -2654,9 +2387,9 @@ var init_Card = __esm({
2654
2387
  }
2655
2388
  );
2656
2389
  Card.displayName = "Card";
2657
- CardHeader = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2390
+ CardHeader = React113__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
2658
2391
  CardHeader.displayName = "CardHeader";
2659
- CardTitle = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2392
+ CardTitle = React113__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2660
2393
  "h3",
2661
2394
  {
2662
2395
  ref,
@@ -2669,11 +2402,11 @@ var init_Card = __esm({
2669
2402
  }
2670
2403
  ));
2671
2404
  CardTitle.displayName = "CardTitle";
2672
- CardContent = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2405
+ CardContent = React113__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
2673
2406
  CardContent.displayName = "CardContent";
2674
2407
  CardBody = CardContent;
2675
2408
  CardBody.displayName = "CardBody";
2676
- CardFooter = React114__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2409
+ CardFooter = React113__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2677
2410
  "div",
2678
2411
  {
2679
2412
  ref,
@@ -2694,7 +2427,7 @@ var init_Spinner = __esm({
2694
2427
  md: "h-6 w-6",
2695
2428
  lg: "h-8 w-8"
2696
2429
  };
2697
- Spinner = React114__default.forwardRef(
2430
+ Spinner = React113__default.forwardRef(
2698
2431
  ({ className, size = "md", ...props }, ref) => {
2699
2432
  return /* @__PURE__ */ jsx(
2700
2433
  "div",
@@ -3142,7 +2875,7 @@ var Radio;
3142
2875
  var init_Radio = __esm({
3143
2876
  "components/atoms/Radio.tsx"() {
3144
2877
  init_cn();
3145
- Radio = React114__default.forwardRef(
2878
+ Radio = React113__default.forwardRef(
3146
2879
  ({
3147
2880
  label,
3148
2881
  helperText,
@@ -3253,7 +2986,7 @@ var init_Switch = __esm({
3253
2986
  "components/atoms/Switch.tsx"() {
3254
2987
  "use client";
3255
2988
  init_cn();
3256
- Switch = React114.forwardRef(
2989
+ Switch = React113.forwardRef(
3257
2990
  ({
3258
2991
  checked,
3259
2992
  defaultChecked = false,
@@ -3264,10 +2997,10 @@ var init_Switch = __esm({
3264
2997
  name,
3265
2998
  className
3266
2999
  }, ref) => {
3267
- const [isChecked, setIsChecked] = React114.useState(
3000
+ const [isChecked, setIsChecked] = React113.useState(
3268
3001
  checked !== void 0 ? checked : defaultChecked
3269
3002
  );
3270
- React114.useEffect(() => {
3003
+ React113.useEffect(() => {
3271
3004
  if (checked !== void 0) {
3272
3005
  setIsChecked(checked);
3273
3006
  }
@@ -3818,8 +3551,8 @@ var init_LawReferenceTooltip = __esm({
3818
3551
  position = "top",
3819
3552
  className
3820
3553
  }) => {
3821
- const [isVisible, setIsVisible] = React114__default.useState(false);
3822
- const timeoutRef = React114__default.useRef(null);
3554
+ const [isVisible, setIsVisible] = React113__default.useState(false);
3555
+ const timeoutRef = React113__default.useRef(null);
3823
3556
  const handleMouseEnter = () => {
3824
3557
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3825
3558
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -3828,7 +3561,7 @@ var init_LawReferenceTooltip = __esm({
3828
3561
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3829
3562
  setIsVisible(false);
3830
3563
  };
3831
- React114__default.useEffect(() => {
3564
+ React113__default.useEffect(() => {
3832
3565
  return () => {
3833
3566
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
3834
3567
  };
@@ -4038,7 +3771,7 @@ var init_StatusDot = __esm({
4038
3771
  md: "w-2.5 h-2.5",
4039
3772
  lg: "w-3 h-3"
4040
3773
  };
4041
- StatusDot = React114__default.forwardRef(
3774
+ StatusDot = React113__default.forwardRef(
4042
3775
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
4043
3776
  return /* @__PURE__ */ jsx(
4044
3777
  "span",
@@ -4091,7 +3824,7 @@ var init_TrendIndicator = __esm({
4091
3824
  down: TrendingDown,
4092
3825
  flat: ArrowRight
4093
3826
  };
4094
- TrendIndicator = React114__default.forwardRef(
3827
+ TrendIndicator = React113__default.forwardRef(
4095
3828
  ({
4096
3829
  className,
4097
3830
  value,
@@ -4158,7 +3891,7 @@ var init_RangeSlider = __esm({
4158
3891
  md: "w-4 h-4",
4159
3892
  lg: "w-5 h-5"
4160
3893
  };
4161
- RangeSlider = React114__default.forwardRef(
3894
+ RangeSlider = React113__default.forwardRef(
4162
3895
  ({
4163
3896
  className,
4164
3897
  min = 0,
@@ -4719,7 +4452,7 @@ var init_ContentSection = __esm({
4719
4452
  md: "py-16",
4720
4453
  lg: "py-24"
4721
4454
  };
4722
- ContentSection = React114__default.forwardRef(
4455
+ ContentSection = React113__default.forwardRef(
4723
4456
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
4724
4457
  return /* @__PURE__ */ jsx(
4725
4458
  Box,
@@ -5253,7 +4986,7 @@ var init_AnimatedReveal = __esm({
5253
4986
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
5254
4987
  "none": {}
5255
4988
  };
5256
- AnimatedReveal = React114__default.forwardRef(
4989
+ AnimatedReveal = React113__default.forwardRef(
5257
4990
  ({
5258
4991
  trigger = "scroll",
5259
4992
  animation = "fade-up",
@@ -5413,7 +5146,7 @@ var init_AnimatedGraphic = __esm({
5413
5146
  "components/atoms/AnimatedGraphic.tsx"() {
5414
5147
  "use client";
5415
5148
  init_cn();
5416
- AnimatedGraphic = React114__default.forwardRef(
5149
+ AnimatedGraphic = React113__default.forwardRef(
5417
5150
  ({
5418
5151
  src,
5419
5152
  svgContent,
@@ -5436,7 +5169,7 @@ var init_AnimatedGraphic = __esm({
5436
5169
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
5437
5170
  const resolvedSvg = svgContent ?? fetchedSvg;
5438
5171
  const prevAnimateRef = useRef(animate);
5439
- const setRef = React114__default.useCallback(
5172
+ const setRef = React113__default.useCallback(
5440
5173
  (node) => {
5441
5174
  containerRef.current = node;
5442
5175
  if (typeof ref === "function") ref(node);
@@ -5661,9 +5394,9 @@ function ScoreDisplay({
5661
5394
  ...rest
5662
5395
  }) {
5663
5396
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
5664
- const [displayValue, setDisplayValue] = React114.useState(resolvedValue);
5665
- const [isAnimating, setIsAnimating] = React114.useState(false);
5666
- React114.useEffect(() => {
5397
+ const [displayValue, setDisplayValue] = React113.useState(resolvedValue);
5398
+ const [isAnimating, setIsAnimating] = React113.useState(false);
5399
+ React113.useEffect(() => {
5667
5400
  if (!animated || displayValue === resolvedValue) {
5668
5401
  setDisplayValue(resolvedValue);
5669
5402
  return;
@@ -5733,9 +5466,9 @@ function ControlButton({
5733
5466
  className
5734
5467
  }) {
5735
5468
  const eventBus = useEventBus();
5736
- const [isPressed, setIsPressed] = React114.useState(false);
5469
+ const [isPressed, setIsPressed] = React113.useState(false);
5737
5470
  const actualPressed = pressed ?? isPressed;
5738
- const handlePointerDown = React114.useCallback(
5471
+ const handlePointerDown = React113.useCallback(
5739
5472
  (e) => {
5740
5473
  e.preventDefault();
5741
5474
  if (disabled) return;
@@ -5745,7 +5478,7 @@ function ControlButton({
5745
5478
  },
5746
5479
  [disabled, pressEvent, eventBus, onPress]
5747
5480
  );
5748
- const handlePointerUp = React114.useCallback(
5481
+ const handlePointerUp = React113.useCallback(
5749
5482
  (e) => {
5750
5483
  e.preventDefault();
5751
5484
  if (disabled) return;
@@ -5755,7 +5488,7 @@ function ControlButton({
5755
5488
  },
5756
5489
  [disabled, releaseEvent, eventBus, onRelease]
5757
5490
  );
5758
- const handlePointerLeave = React114.useCallback(
5491
+ const handlePointerLeave = React113.useCallback(
5759
5492
  (e) => {
5760
5493
  if (isPressed) {
5761
5494
  setIsPressed(false);
@@ -6653,9 +6386,9 @@ function MiniMap({
6653
6386
  viewportRect,
6654
6387
  className
6655
6388
  }) {
6656
- const canvasRef = React114.useRef(null);
6657
- const frameRef = React114.useRef(0);
6658
- React114.useEffect(() => {
6389
+ const canvasRef = React113.useRef(null);
6390
+ const frameRef = React113.useRef(0);
6391
+ React113.useEffect(() => {
6659
6392
  const canvas = canvasRef.current;
6660
6393
  if (!canvas) return;
6661
6394
  const ctx = canvas.getContext("2d");
@@ -6863,7 +6596,7 @@ var init_ErrorBoundary = __esm({
6863
6596
  "use client";
6864
6597
  init_cn();
6865
6598
  init_ErrorState();
6866
- ErrorBoundary = class extends React114__default.Component {
6599
+ ErrorBoundary = class extends React113__default.Component {
6867
6600
  constructor(props) {
6868
6601
  super(props);
6869
6602
  __publicField(this, "reset", () => {
@@ -7336,8 +7069,8 @@ var init_Tooltip = __esm({
7336
7069
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
7337
7070
  };
7338
7071
  }, []);
7339
- const triggerElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7340
- const trigger = React114__default.cloneElement(triggerElement, {
7072
+ const triggerElement = React113__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7073
+ const trigger = React113__default.cloneElement(triggerElement, {
7341
7074
  ref: triggerRef,
7342
7075
  onMouseEnter: handleMouseEnter,
7343
7076
  onMouseLeave: handleMouseLeave,
@@ -7458,8 +7191,8 @@ var init_Popover = __esm({
7458
7191
  onMouseEnter: handleOpen,
7459
7192
  onMouseLeave: handleClose
7460
7193
  };
7461
- const childElement = React114__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7462
- const triggerElement = React114__default.cloneElement(
7194
+ const childElement = React113__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
7195
+ const triggerElement = React113__default.cloneElement(
7463
7196
  childElement,
7464
7197
  {
7465
7198
  ref: triggerRef,
@@ -7576,8 +7309,8 @@ var init_Menu = __esm({
7576
7309
  "bottom-start": "top-full left-0 mt-2",
7577
7310
  "bottom-end": "top-full right-0 mt-2"
7578
7311
  };
7579
- const triggerChild = React114__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7580
- const triggerElement = React114__default.cloneElement(
7312
+ const triggerChild = React113__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx("span", { children: trigger });
7313
+ const triggerElement = React113__default.cloneElement(
7581
7314
  triggerChild,
7582
7315
  {
7583
7316
  ref: triggerRef,
@@ -8096,7 +7829,7 @@ var init_MapView = __esm({
8096
7829
  shadowSize: [41, 41]
8097
7830
  });
8098
7831
  L.Marker.prototype.options.icon = defaultIcon;
8099
- const { useEffect: useEffect70, useRef: useRef64, useCallback: useCallback109, useState: useState102 } = React114__default;
7832
+ const { useEffect: useEffect70, useRef: useRef64, useCallback: useCallback109, useState: useState102 } = React113__default;
8100
7833
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
8101
7834
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
8102
7835
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -8327,7 +8060,7 @@ function InputPattern({
8327
8060
  fieldName
8328
8061
  }) {
8329
8062
  const { emit } = useEventBus();
8330
- const [localValue, setLocalValue] = React114__default.useState(value);
8063
+ const [localValue, setLocalValue] = React113__default.useState(value);
8331
8064
  const handleChange = (e) => {
8332
8065
  setLocalValue(e.target.value);
8333
8066
  if (onChange) {
@@ -8365,7 +8098,7 @@ function TextareaPattern({
8365
8098
  fieldName
8366
8099
  }) {
8367
8100
  const { emit } = useEventBus();
8368
- const [localValue, setLocalValue] = React114__default.useState(value);
8101
+ const [localValue, setLocalValue] = React113__default.useState(value);
8369
8102
  const handleChange = (e) => {
8370
8103
  setLocalValue(e.target.value);
8371
8104
  if (onChange) {
@@ -8397,7 +8130,7 @@ function SelectPattern({
8397
8130
  fieldName
8398
8131
  }) {
8399
8132
  const { emit } = useEventBus();
8400
- const [localValue, setLocalValue] = React114__default.useState(value);
8133
+ const [localValue, setLocalValue] = React113__default.useState(value);
8401
8134
  const handleChange = (e) => {
8402
8135
  setLocalValue(e.target.value);
8403
8136
  if (onChange) {
@@ -8426,7 +8159,7 @@ function CheckboxPattern({
8426
8159
  className
8427
8160
  }) {
8428
8161
  const { emit } = useEventBus();
8429
- const [localChecked, setLocalChecked] = React114__default.useState(checked);
8162
+ const [localChecked, setLocalChecked] = React113__default.useState(checked);
8430
8163
  const handleChange = (e) => {
8431
8164
  setLocalChecked(e.target.checked);
8432
8165
  if (onChange) {
@@ -8657,8 +8390,8 @@ function ActionButtons({
8657
8390
  disabled
8658
8391
  }) {
8659
8392
  const eventBus = useEventBus();
8660
- const [activeButtons, setActiveButtons] = React114.useState(/* @__PURE__ */ new Set());
8661
- const handlePress = React114.useCallback(
8393
+ const [activeButtons, setActiveButtons] = React113.useState(/* @__PURE__ */ new Set());
8394
+ const handlePress = React113.useCallback(
8662
8395
  (id) => {
8663
8396
  setActiveButtons((prev) => new Set(prev).add(id));
8664
8397
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -8666,7 +8399,7 @@ function ActionButtons({
8666
8399
  },
8667
8400
  [actionEvent, eventBus, onAction]
8668
8401
  );
8669
- const handleRelease = React114.useCallback(
8402
+ const handleRelease = React113.useCallback(
8670
8403
  (id) => {
8671
8404
  setActiveButtons((prev) => {
8672
8405
  const next = new Set(prev);
@@ -9051,6 +8784,238 @@ var init_LoadingState = __esm({
9051
8784
  LoadingState.displayName = "LoadingState";
9052
8785
  }
9053
8786
  });
8787
+
8788
+ // lib/verificationRegistry.ts
8789
+ function getState() {
8790
+ if (typeof window !== "undefined") {
8791
+ const w = window;
8792
+ if (!w.__verificationRegistryState) {
8793
+ w.__verificationRegistryState = {
8794
+ checks: /* @__PURE__ */ new Map(),
8795
+ transitions: [],
8796
+ bridgeHealth: null,
8797
+ listeners: /* @__PURE__ */ new Set(),
8798
+ traitSnapshots: /* @__PURE__ */ new Map()
8799
+ };
8800
+ }
8801
+ return w.__verificationRegistryState;
8802
+ }
8803
+ return {
8804
+ checks: /* @__PURE__ */ new Map(),
8805
+ transitions: [],
8806
+ bridgeHealth: null,
8807
+ listeners: /* @__PURE__ */ new Set(),
8808
+ traitSnapshots: /* @__PURE__ */ new Map()
8809
+ };
8810
+ }
8811
+ function notifyListeners() {
8812
+ getState().listeners.forEach((l) => l());
8813
+ exposeOnWindow();
8814
+ }
8815
+ function registerCheck(id, label, status = "pending", details) {
8816
+ getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
8817
+ notifyListeners();
8818
+ }
8819
+ function getAllChecks() {
8820
+ return Array.from(getState().checks.values());
8821
+ }
8822
+ function recordTransition(trace) {
8823
+ const entry = {
8824
+ ...trace,
8825
+ id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
8826
+ };
8827
+ log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
8828
+ getState().transitions.push(entry);
8829
+ if (getState().transitions.length > MAX_TRANSITIONS) {
8830
+ getState().transitions.shift();
8831
+ }
8832
+ if (entry.event === "INIT") {
8833
+ const hasFetch = entry.effects.some((e) => e.type === "fetch");
8834
+ const checkId = `init-fetch-${entry.traitName}`;
8835
+ if (hasFetch) {
8836
+ registerCheck(
8837
+ checkId,
8838
+ `INIT transition for "${entry.traitName}" has fetch effect`,
8839
+ "pass"
8840
+ );
8841
+ } else {
8842
+ const hasRenderUI = entry.effects.some((e) => e.type === "render-ui");
8843
+ if (hasRenderUI) {
8844
+ registerCheck(
8845
+ checkId,
8846
+ `INIT transition for "${entry.traitName}" missing fetch effect`,
8847
+ "fail",
8848
+ "Entity-bound render-ui without a fetch effect will show empty data"
8849
+ );
8850
+ }
8851
+ }
8852
+ }
8853
+ const failedEffects = entry.effects.filter((e) => e.status === "failed");
8854
+ if (failedEffects.length > 0) {
8855
+ registerCheck(
8856
+ `effects-${entry.id}`,
8857
+ `Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
8858
+ "fail",
8859
+ failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
8860
+ );
8861
+ }
8862
+ notifyListeners();
8863
+ }
8864
+ function getTransitions() {
8865
+ return [...getState().transitions];
8866
+ }
8867
+ function recordServerResponse(orbitalName, event, response) {
8868
+ const serverResponse = {
8869
+ ...response,
8870
+ orbitalName,
8871
+ timestamp: Date.now()
8872
+ };
8873
+ const entry = {
8874
+ id: `srv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
8875
+ traitName: `server:${orbitalName}`,
8876
+ from: "server",
8877
+ to: "server",
8878
+ event,
8879
+ effects: [],
8880
+ serverResponse,
8881
+ timestamp: Date.now()
8882
+ };
8883
+ getState().transitions.push(entry);
8884
+ if (getState().transitions.length > MAX_TRANSITIONS) {
8885
+ getState().transitions.shift();
8886
+ }
8887
+ if (!response.success && response.error) {
8888
+ registerCheck(
8889
+ `server-error-${entry.id}`,
8890
+ `Server error for ${orbitalName}:${event}`,
8891
+ "fail",
8892
+ response.error
8893
+ );
8894
+ }
8895
+ notifyListeners();
8896
+ }
8897
+ function getBridgeHealth() {
8898
+ const bh = getState().bridgeHealth;
8899
+ return bh ? { ...bh } : null;
8900
+ }
8901
+ function getSummary() {
8902
+ const allChecks = getAllChecks();
8903
+ return {
8904
+ totalChecks: allChecks.length,
8905
+ passed: allChecks.filter((c) => c.status === "pass").length,
8906
+ failed: allChecks.filter((c) => c.status === "fail").length,
8907
+ warnings: allChecks.filter((c) => c.status === "warn").length,
8908
+ pending: allChecks.filter((c) => c.status === "pending").length
8909
+ };
8910
+ }
8911
+ function getSnapshot2() {
8912
+ return {
8913
+ checks: getAllChecks(),
8914
+ transitions: getTransitions(),
8915
+ bridge: getBridgeHealth(),
8916
+ summary: getSummary(),
8917
+ traits: getTraitSnapshots()
8918
+ };
8919
+ }
8920
+ function getTraitSnapshots() {
8921
+ const snapshots = [];
8922
+ for (const [traitName, getter] of getState().traitSnapshots.entries()) {
8923
+ try {
8924
+ snapshots.push(getter());
8925
+ } catch (err) {
8926
+ log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
8927
+ }
8928
+ }
8929
+ return snapshots;
8930
+ }
8931
+ function subscribeToVerification(listener) {
8932
+ getState().listeners.add(listener);
8933
+ return () => getState().listeners.delete(listener);
8934
+ }
8935
+ function exposeOnWindow() {
8936
+ if (typeof window === "undefined") return;
8937
+ if (!window.__orbitalVerification) {
8938
+ window.__orbitalVerification = {
8939
+ getSnapshot: getSnapshot2,
8940
+ getChecks: getAllChecks,
8941
+ getTransitions,
8942
+ getBridge: getBridgeHealth,
8943
+ getSummary,
8944
+ waitForTransition,
8945
+ getTraitSnapshots
8946
+ };
8947
+ } else if (!window.__orbitalVerification.getTraitSnapshots) {
8948
+ window.__orbitalVerification.getTraitSnapshots = getTraitSnapshots;
8949
+ }
8950
+ }
8951
+ function waitForTransition(event, timeoutMs = 1e4) {
8952
+ return new Promise((resolve) => {
8953
+ const existing = getState().transitions.find((t) => t.event === event);
8954
+ if (existing) {
8955
+ resolve(existing);
8956
+ return;
8957
+ }
8958
+ const timeout = setTimeout(() => {
8959
+ unsub();
8960
+ resolve(null);
8961
+ }, timeoutMs);
8962
+ const unsub = subscribeToVerification(() => {
8963
+ const found = getState().transitions.find((t) => t.event === event);
8964
+ if (found) {
8965
+ clearTimeout(timeout);
8966
+ unsub();
8967
+ resolve(found);
8968
+ }
8969
+ });
8970
+ });
8971
+ }
8972
+ function bindTraitStateGetter(getter) {
8973
+ if (typeof window === "undefined") return;
8974
+ exposeOnWindow();
8975
+ if (window.__orbitalVerification) {
8976
+ window.__orbitalVerification.getTraitState = getter;
8977
+ }
8978
+ }
8979
+ function registerTraitSnapshot(traitName, getter) {
8980
+ if (typeof window === "undefined") return () => {
8981
+ };
8982
+ getState().traitSnapshots.set(traitName, getter);
8983
+ exposeOnWindow();
8984
+ notifyListeners();
8985
+ return () => {
8986
+ const s = getState();
8987
+ if (s.traitSnapshots.get(traitName) === getter) {
8988
+ s.traitSnapshots.delete(traitName);
8989
+ notifyListeners();
8990
+ }
8991
+ };
8992
+ }
8993
+ function bindCanvasCapture(captureFn) {
8994
+ if (typeof window === "undefined") return;
8995
+ exposeOnWindow();
8996
+ if (window.__orbitalVerification) {
8997
+ window.__orbitalVerification.captureFrame = captureFn;
8998
+ }
8999
+ }
9000
+ function updateAssetStatus(url, status) {
9001
+ if (typeof window === "undefined") return;
9002
+ exposeOnWindow();
9003
+ if (window.__orbitalVerification) {
9004
+ if (!window.__orbitalVerification.assetStatus) {
9005
+ window.__orbitalVerification.assetStatus = {};
9006
+ }
9007
+ window.__orbitalVerification.assetStatus[url] = status;
9008
+ }
9009
+ }
9010
+ var log2, MAX_TRANSITIONS;
9011
+ var init_verificationRegistry = __esm({
9012
+ "lib/verificationRegistry.ts"() {
9013
+ init_logger();
9014
+ log2 = createLogger("almadar:bridge");
9015
+ MAX_TRANSITIONS = 500;
9016
+ exposeOnWindow();
9017
+ }
9018
+ });
9054
9019
  function useImageCache(urls) {
9055
9020
  const cacheRef = useRef(/* @__PURE__ */ new Map());
9056
9021
  const loadingRef = useRef(/* @__PURE__ */ new Set());
@@ -10470,7 +10435,7 @@ var init_MarkdownContent = __esm({
10470
10435
  init_Box();
10471
10436
  init_useTranslate();
10472
10437
  init_cn();
10473
- MarkdownContent = React114__default.memo(
10438
+ MarkdownContent = React113__default.memo(
10474
10439
  ({ content, direction, className }) => {
10475
10440
  const { t: _t } = useTranslate();
10476
10441
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -10687,7 +10652,7 @@ var init_CodeBlock = __esm({
10687
10652
  loloStyle = { ...dark, ...loloStyleOverrides };
10688
10653
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
10689
10654
  HIDDEN_LINE_NUMBERS = { display: "none" };
10690
- CodeBlock = React114__default.memo(
10655
+ CodeBlock = React113__default.memo(
10691
10656
  ({
10692
10657
  code: rawCode,
10693
10658
  language = "text",
@@ -11946,7 +11911,7 @@ var init_StateMachineView = __esm({
11946
11911
  style: { top: title ? 30 : 0 },
11947
11912
  children: [
11948
11913
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
11949
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React114__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11914
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React113__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
11950
11915
  StateNode,
11951
11916
  {
11952
11917
  state,
@@ -17662,7 +17627,7 @@ function CraftingRecipe({
17662
17627
  className
17663
17628
  }) {
17664
17629
  const eventBus = useEventBus();
17665
- const handleCraft = React114.useCallback(() => {
17630
+ const handleCraft = React113.useCallback(() => {
17666
17631
  onCraft?.();
17667
17632
  if (craftEvent) {
17668
17633
  eventBus.emit(craftEvent, { output: output.label });
@@ -17679,7 +17644,7 @@ function CraftingRecipe({
17679
17644
  children: [
17680
17645
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
17681
17646
  const hasSufficient = ingredient.available >= ingredient.required;
17682
- return /* @__PURE__ */ jsxs(React114.Fragment, { children: [
17647
+ return /* @__PURE__ */ jsxs(React113.Fragment, { children: [
17683
17648
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
17684
17649
  ItemSlot,
17685
17650
  {
@@ -17973,8 +17938,8 @@ function DPad({
17973
17938
  }) {
17974
17939
  const eventBus = useEventBus();
17975
17940
  const sizes = sizeMap15[size];
17976
- const [activeDirections, setActiveDirections] = React114.useState(/* @__PURE__ */ new Set());
17977
- const handlePress = React114.useCallback(
17941
+ const [activeDirections, setActiveDirections] = React113.useState(/* @__PURE__ */ new Set());
17942
+ const handlePress = React113.useCallback(
17978
17943
  (direction) => {
17979
17944
  setActiveDirections((prev) => new Set(prev).add(direction));
17980
17945
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -17982,7 +17947,7 @@ function DPad({
17982
17947
  },
17983
17948
  [directionEvent, eventBus, onDirection]
17984
17949
  );
17985
- const handleRelease = React114.useCallback(
17950
+ const handleRelease = React113.useCallback(
17986
17951
  (direction) => {
17987
17952
  setActiveDirections((prev) => {
17988
17953
  const next = new Set(prev);
@@ -18535,25 +18500,15 @@ function DataGrid({
18535
18500
  }
18536
18501
  const hasRenderProp = typeof children === "function";
18537
18502
  useEffect(() => {
18538
- const renderItemTypeOf = typeof schemaRenderItem;
18539
- const childrenTypeOf = typeof children;
18540
- if (data.length > 0 && !hasRenderProp) {
18541
- const firstRow = data[0];
18542
- const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
18503
+ if (data.length > 0 && !hasRenderProp && (!fields || fields.length === 0)) {
18543
18504
  const renderItemRaw = schemaRenderItem;
18544
18505
  const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
18545
18506
  dataGridLog.warn("renderItem-unresolved", {
18546
18507
  rowCount: data.length,
18547
- fieldsCount: fields?.length ?? 0,
18548
- renderItemTypeOf,
18549
- renderItemIsArray: Array.isArray(renderItemRaw),
18550
- renderItemIsFnLambda: isFnLambda,
18551
- renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
18552
- childrenTypeOf,
18553
- sampleRowKeys: sampleKeys
18508
+ renderItemIsFnLambda: isFnLambda
18554
18509
  });
18555
18510
  }
18556
- }, [data, hasRenderProp, schemaRenderItem, children, fields]);
18511
+ }, [data, hasRenderProp, schemaRenderItem, fields]);
18557
18512
  const allIds = data.map((item, i) => item.id || String(i));
18558
18513
  const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
18559
18514
  const someSelected = selectedIds.size > 0;
@@ -18868,7 +18823,7 @@ function DataList({
18868
18823
  }) {
18869
18824
  const eventBus = useEventBus();
18870
18825
  const { t } = useTranslate();
18871
- const [visibleCount, setVisibleCount] = React114__default.useState(pageSize || Infinity);
18826
+ const [visibleCount, setVisibleCount] = React113__default.useState(pageSize || Infinity);
18872
18827
  const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
18873
18828
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
18874
18829
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
@@ -18908,7 +18863,7 @@ function DataList({
18908
18863
  const items2 = data.map((item) => item);
18909
18864
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
18910
18865
  const contentField = titleField?.name ?? fields[0]?.name ?? "";
18911
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
18866
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
18912
18867
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
18913
18868
  group.items.map((itemData, index) => {
18914
18869
  const id = itemData.id || `${gi}-${index}`;
@@ -18955,7 +18910,7 @@ function DataList({
18955
18910
  ] }, gi)) });
18956
18911
  }
18957
18912
  const hasRenderProp = typeof children === "function";
18958
- React114__default.useEffect(() => {
18913
+ React113__default.useEffect(() => {
18959
18914
  const renderItemTypeOf = typeof schemaRenderItem;
18960
18915
  const childrenTypeOf = typeof children;
18961
18916
  if (data.length > 0 && !hasRenderProp) {
@@ -19120,7 +19075,7 @@ function DataList({
19120
19075
  className
19121
19076
  ),
19122
19077
  children: [
19123
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
19078
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
19124
19079
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
19125
19080
  group.items.map(
19126
19081
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -20332,7 +20287,7 @@ var init_WizardProgress = __esm({
20332
20287
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
20333
20288
  const isActive = index === currentStep;
20334
20289
  const isCompleted = index < currentStep;
20335
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
20290
+ return /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
20336
20291
  /* @__PURE__ */ jsx(
20337
20292
  "button",
20338
20293
  {
@@ -21243,7 +21198,7 @@ function InventoryGrid({
21243
21198
  const eventBus = useEventBus();
21244
21199
  const slotCount = totalSlots ?? items.length;
21245
21200
  const emptySlotCount = Math.max(0, slotCount - items.length);
21246
- const handleSelect = React114.useCallback(
21201
+ const handleSelect = React113.useCallback(
21247
21202
  (id) => {
21248
21203
  onSelect?.(id);
21249
21204
  if (selectEvent) {
@@ -21456,15 +21411,15 @@ function GameCanvas2D({
21456
21411
  fps = 60,
21457
21412
  className
21458
21413
  }) {
21459
- const canvasRef = React114.useRef(null);
21460
- const rafRef = React114.useRef(0);
21461
- const frameRef = React114.useRef(0);
21462
- const lastTimeRef = React114.useRef(0);
21463
- const onDrawRef = React114.useRef(onDraw);
21414
+ const canvasRef = React113.useRef(null);
21415
+ const rafRef = React113.useRef(0);
21416
+ const frameRef = React113.useRef(0);
21417
+ const lastTimeRef = React113.useRef(0);
21418
+ const onDrawRef = React113.useRef(onDraw);
21464
21419
  onDrawRef.current = onDraw;
21465
- const onTickRef = React114.useRef(onTick);
21420
+ const onTickRef = React113.useRef(onTick);
21466
21421
  onTickRef.current = onTick;
21467
- React114.useEffect(() => {
21422
+ React113.useEffect(() => {
21468
21423
  const canvas = canvasRef.current;
21469
21424
  if (!canvas) return;
21470
21425
  const ctx = canvas.getContext("2d");
@@ -21753,7 +21708,7 @@ function TurnPanel({
21753
21708
  className
21754
21709
  }) {
21755
21710
  const eventBus = useEventBus();
21756
- const handleAction = React114.useCallback(
21711
+ const handleAction = React113.useCallback(
21757
21712
  (event) => {
21758
21713
  if (event) {
21759
21714
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -21899,7 +21854,7 @@ function UnitCommandBar({
21899
21854
  className
21900
21855
  }) {
21901
21856
  const eventBus = useEventBus();
21902
- const handleCommand = React114.useCallback(
21857
+ const handleCommand = React113.useCallback(
21903
21858
  (event) => {
21904
21859
  if (event) {
21905
21860
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -22384,7 +22339,7 @@ function GameMenu({
22384
22339
  } catch {
22385
22340
  }
22386
22341
  const eventBus = eventBusProp || eventBusFromHook;
22387
- const handleOptionClick = React114.useCallback(
22342
+ const handleOptionClick = React113.useCallback(
22388
22343
  (option) => {
22389
22344
  if (option.event && eventBus) {
22390
22345
  eventBus.emit(`UI:${option.event}`, { option });
@@ -22498,7 +22453,7 @@ function GameOverScreen({
22498
22453
  } catch {
22499
22454
  }
22500
22455
  const eventBus = eventBusProp || eventBusFromHook;
22501
- const handleActionClick = React114.useCallback(
22456
+ const handleActionClick = React113.useCallback(
22502
22457
  (action) => {
22503
22458
  if (action.event && eventBus) {
22504
22459
  eventBus.emit(`UI:${action.event}`, { action });
@@ -25464,7 +25419,7 @@ var init_StepFlow = __esm({
25464
25419
  className
25465
25420
  }) => {
25466
25421
  if (orientation === "vertical") {
25467
- 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: [
25422
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React113__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
25468
25423
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
25469
25424
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25470
25425
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -25475,7 +25430,7 @@ var init_StepFlow = __esm({
25475
25430
  ] })
25476
25431
  ] }) }, index)) });
25477
25432
  }
25478
- 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: [
25433
+ 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(React113__default.Fragment, { children: [
25479
25434
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
25480
25435
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
25481
25436
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -27589,7 +27544,7 @@ var init_DocumentViewer = __esm({
27589
27544
  }
27590
27545
  });
27591
27546
  function extractTitle(children) {
27592
- if (!React114__default.isValidElement(children)) return void 0;
27547
+ if (!React113__default.isValidElement(children)) return void 0;
27593
27548
  const props = children.props;
27594
27549
  if (typeof props.title === "string") {
27595
27550
  return props.title;
@@ -27644,7 +27599,7 @@ function LinearView({
27644
27599
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
27645
27600
  const isDone = i < currentIdx;
27646
27601
  const isCurrent = i === currentIdx;
27647
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
27602
+ return /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
27648
27603
  i > 0 && /* @__PURE__ */ jsx(
27649
27604
  Typography,
27650
27605
  {
@@ -28428,12 +28383,12 @@ var init_Form = __esm({
28428
28383
  const isSchemaEntity = isOrbitalEntitySchema(entity);
28429
28384
  const resolvedEntity = isSchemaEntity ? entity : void 0;
28430
28385
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28431
- const normalizedInitialData = React114__default.useMemo(() => {
28386
+ const normalizedInitialData = React113__default.useMemo(() => {
28432
28387
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28433
28388
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28434
28389
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28435
28390
  }, [entity, initialData]);
28436
- const entityDerivedFields = React114__default.useMemo(() => {
28391
+ const entityDerivedFields = React113__default.useMemo(() => {
28437
28392
  if (fields && fields.length > 0) return void 0;
28438
28393
  if (!resolvedEntity) return void 0;
28439
28394
  return resolvedEntity.fields.map(
@@ -28452,14 +28407,14 @@ var init_Form = __esm({
28452
28407
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
28453
28408
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
28454
28409
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
28455
- const [formData, setFormData] = React114__default.useState(
28410
+ const [formData, setFormData] = React113__default.useState(
28456
28411
  normalizedInitialData
28457
28412
  );
28458
- const [collapsedSections, setCollapsedSections] = React114__default.useState(
28413
+ const [collapsedSections, setCollapsedSections] = React113__default.useState(
28459
28414
  /* @__PURE__ */ new Set()
28460
28415
  );
28461
28416
  const formMode = props.mode;
28462
- const mountedRef = React114__default.useRef(false);
28417
+ const mountedRef = React113__default.useRef(false);
28463
28418
  if (!mountedRef.current) {
28464
28419
  mountedRef.current = true;
28465
28420
  debug("forms", "mount", {
@@ -28472,7 +28427,7 @@ var init_Form = __esm({
28472
28427
  });
28473
28428
  }
28474
28429
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
28475
- const evalContext = React114__default.useMemo(
28430
+ const evalContext = React113__default.useMemo(
28476
28431
  () => ({
28477
28432
  formValues: formData,
28478
28433
  globalVariables: externalContext?.globalVariables ?? {},
@@ -28481,7 +28436,7 @@ var init_Form = __esm({
28481
28436
  }),
28482
28437
  [formData, externalContext]
28483
28438
  );
28484
- React114__default.useEffect(() => {
28439
+ React113__default.useEffect(() => {
28485
28440
  debug("forms", "initialData-sync", {
28486
28441
  mode: formMode,
28487
28442
  normalizedInitialData,
@@ -28492,7 +28447,7 @@ var init_Form = __esm({
28492
28447
  setFormData(normalizedInitialData);
28493
28448
  }
28494
28449
  }, [normalizedInitialData]);
28495
- const processCalculations = React114__default.useCallback(
28450
+ const processCalculations = React113__default.useCallback(
28496
28451
  (changedFieldId, newFormData) => {
28497
28452
  if (!hiddenCalculations.length) return;
28498
28453
  const context = {
@@ -28517,7 +28472,7 @@ var init_Form = __esm({
28517
28472
  },
28518
28473
  [hiddenCalculations, externalContext, eventBus]
28519
28474
  );
28520
- const checkViolations = React114__default.useCallback(
28475
+ const checkViolations = React113__default.useCallback(
28521
28476
  (changedFieldId, newFormData) => {
28522
28477
  if (!violationTriggers.length) return;
28523
28478
  const context = {
@@ -28555,7 +28510,7 @@ var init_Form = __esm({
28555
28510
  processCalculations(name, newFormData);
28556
28511
  checkViolations(name, newFormData);
28557
28512
  };
28558
- const isFieldVisible = React114__default.useCallback(
28513
+ const isFieldVisible = React113__default.useCallback(
28559
28514
  (fieldName) => {
28560
28515
  const condition = conditionalFields[fieldName];
28561
28516
  if (!condition) return true;
@@ -28563,7 +28518,7 @@ var init_Form = __esm({
28563
28518
  },
28564
28519
  [conditionalFields, evalContext]
28565
28520
  );
28566
- const isSectionVisible = React114__default.useCallback(
28521
+ const isSectionVisible = React113__default.useCallback(
28567
28522
  (section) => {
28568
28523
  if (!section.condition) return true;
28569
28524
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -28607,7 +28562,7 @@ var init_Form = __esm({
28607
28562
  eventBus.emit(`UI:${onCancel}`);
28608
28563
  }
28609
28564
  };
28610
- const renderField = React114__default.useCallback(
28565
+ const renderField = React113__default.useCallback(
28611
28566
  (field) => {
28612
28567
  const fieldName = field.name || field.field;
28613
28568
  if (!fieldName) return null;
@@ -28628,7 +28583,7 @@ var init_Form = __esm({
28628
28583
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
28629
28584
  );
28630
28585
  const effectiveFields = entityDerivedFields ?? fields;
28631
- const normalizedFields = React114__default.useMemo(() => {
28586
+ const normalizedFields = React113__default.useMemo(() => {
28632
28587
  if (!effectiveFields || effectiveFields.length === 0) return [];
28633
28588
  return effectiveFields.map((field) => {
28634
28589
  if (typeof field === "string") {
@@ -28650,7 +28605,7 @@ var init_Form = __esm({
28650
28605
  return field;
28651
28606
  });
28652
28607
  }, [effectiveFields, resolvedEntity]);
28653
- const schemaFields = React114__default.useMemo(() => {
28608
+ const schemaFields = React113__default.useMemo(() => {
28654
28609
  if (normalizedFields.length === 0) return null;
28655
28610
  if (isDebugEnabled()) {
28656
28611
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -28660,7 +28615,7 @@ var init_Form = __esm({
28660
28615
  }
28661
28616
  return normalizedFields.map(renderField).filter(Boolean);
28662
28617
  }, [normalizedFields, renderField, entityName, conditionalFields]);
28663
- const sectionElements = React114__default.useMemo(() => {
28618
+ const sectionElements = React113__default.useMemo(() => {
28664
28619
  if (!sections || sections.length === 0) return null;
28665
28620
  return sections.map((section) => {
28666
28621
  if (!isSectionVisible(section)) {
@@ -30184,7 +30139,7 @@ var init_List = __esm({
30184
30139
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
30185
30140
  return [];
30186
30141
  }, [entity]);
30187
- const getItemActions = React114__default.useCallback(
30142
+ const getItemActions = React113__default.useCallback(
30188
30143
  (item) => {
30189
30144
  if (!itemActions) return [];
30190
30145
  if (typeof itemActions === "function") {
@@ -30621,7 +30576,7 @@ var init_MediaGallery = __esm({
30621
30576
  [selectable, selectedItems, selectionEvent, eventBus]
30622
30577
  );
30623
30578
  const entityData = Array.isArray(entity) ? entity : [];
30624
- const items = React114__default.useMemo(() => {
30579
+ const items = React113__default.useMemo(() => {
30625
30580
  if (propItems) return propItems;
30626
30581
  if (entityData.length === 0) return [];
30627
30582
  return entityData.map((record, idx) => ({
@@ -30785,7 +30740,7 @@ var init_MediaGallery = __esm({
30785
30740
  }
30786
30741
  });
30787
30742
  function extractTitle2(children) {
30788
- if (!React114__default.isValidElement(children)) return void 0;
30743
+ if (!React113__default.isValidElement(children)) return void 0;
30789
30744
  const props = children.props;
30790
30745
  if (typeof props.title === "string") {
30791
30746
  return props.title;
@@ -31498,7 +31453,7 @@ var init_PageHeader = __esm({
31498
31453
  info: "bg-info/10 text-info"
31499
31454
  };
31500
31455
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
31501
- 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: [
31456
+ 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(React113__default.Fragment, { children: [
31502
31457
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
31503
31458
  crumb.href ? /* @__PURE__ */ jsx(
31504
31459
  "a",
@@ -31586,6 +31541,41 @@ var init_PageHeader = __esm({
31586
31541
  }
31587
31542
  });
31588
31543
 
31544
+ // lib/traitRegistry.ts
31545
+ function notifyListeners2() {
31546
+ listeners.forEach((listener) => listener());
31547
+ }
31548
+ function registerTrait(info) {
31549
+ traits.set(info.id, info);
31550
+ notifyListeners2();
31551
+ }
31552
+ function updateTraitState(id, newState) {
31553
+ const trait = traits.get(id);
31554
+ if (trait) {
31555
+ trait.currentState = newState;
31556
+ trait.transitionCount++;
31557
+ notifyListeners2();
31558
+ }
31559
+ }
31560
+ function unregisterTrait(id) {
31561
+ traits.delete(id);
31562
+ notifyListeners2();
31563
+ }
31564
+ function getAllTraits() {
31565
+ return Array.from(traits.values());
31566
+ }
31567
+ function subscribeToTraitChanges(listener) {
31568
+ listeners.add(listener);
31569
+ return () => listeners.delete(listener);
31570
+ }
31571
+ var traits, listeners;
31572
+ var init_traitRegistry = __esm({
31573
+ "lib/traitRegistry.ts"() {
31574
+ traits = /* @__PURE__ */ new Map();
31575
+ listeners = /* @__PURE__ */ new Set();
31576
+ }
31577
+ });
31578
+
31589
31579
  // lib/tickRegistry.ts
31590
31580
  function getAllTicks() {
31591
31581
  return Array.from(ticks.values());
@@ -31656,7 +31646,7 @@ var init_debugRegistry = __esm({
31656
31646
  }
31657
31647
  });
31658
31648
  function useDebugData() {
31659
- const [data, setData] = React114.useState(() => ({
31649
+ const [data, setData] = React113.useState(() => ({
31660
31650
  traits: [],
31661
31651
  ticks: [],
31662
31652
  guards: [],
@@ -31670,7 +31660,7 @@ function useDebugData() {
31670
31660
  },
31671
31661
  lastUpdate: Date.now()
31672
31662
  }));
31673
- React114.useEffect(() => {
31663
+ React113.useEffect(() => {
31674
31664
  const updateData = () => {
31675
31665
  setData({
31676
31666
  traits: getAllTraits(),
@@ -31779,12 +31769,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
31779
31769
  return positions;
31780
31770
  }
31781
31771
  function WalkMinimap() {
31782
- const [walkStep, setWalkStep] = React114.useState(null);
31783
- const [traits2, setTraits] = React114.useState([]);
31784
- const [coveredEdges, setCoveredEdges] = React114.useState([]);
31785
- const [completedTraits, setCompletedTraits] = React114.useState(/* @__PURE__ */ new Set());
31786
- const prevTraitRef = React114.useRef(null);
31787
- React114.useEffect(() => {
31772
+ const [walkStep, setWalkStep] = React113.useState(null);
31773
+ const [traits2, setTraits] = React113.useState([]);
31774
+ const [coveredEdges, setCoveredEdges] = React113.useState([]);
31775
+ const [completedTraits, setCompletedTraits] = React113.useState(/* @__PURE__ */ new Set());
31776
+ const prevTraitRef = React113.useRef(null);
31777
+ React113.useEffect(() => {
31788
31778
  const interval = setInterval(() => {
31789
31779
  const w = window;
31790
31780
  const step = w.__orbitalWalkStep;
@@ -32231,15 +32221,15 @@ var init_EntitiesTab = __esm({
32231
32221
  }
32232
32222
  });
32233
32223
  function EventFlowTab({ events: events2 }) {
32234
- const [filter, setFilter] = React114.useState("all");
32235
- const containerRef = React114.useRef(null);
32236
- const [autoScroll, setAutoScroll] = React114.useState(true);
32237
- React114.useEffect(() => {
32224
+ const [filter, setFilter] = React113.useState("all");
32225
+ const containerRef = React113.useRef(null);
32226
+ const [autoScroll, setAutoScroll] = React113.useState(true);
32227
+ React113.useEffect(() => {
32238
32228
  if (autoScroll && containerRef.current) {
32239
32229
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32240
32230
  }
32241
32231
  }, [events2.length, autoScroll]);
32242
- const filteredEvents = React114.useMemo(() => {
32232
+ const filteredEvents = React113.useMemo(() => {
32243
32233
  if (filter === "all") return events2;
32244
32234
  return events2.filter((e) => e.type === filter);
32245
32235
  }, [events2, filter]);
@@ -32358,7 +32348,7 @@ var init_EventFlowTab = __esm({
32358
32348
  }
32359
32349
  });
32360
32350
  function GuardsPanel({ guards }) {
32361
- const [filter, setFilter] = React114.useState("all");
32351
+ const [filter, setFilter] = React113.useState("all");
32362
32352
  if (guards.length === 0) {
32363
32353
  return /* @__PURE__ */ jsx(
32364
32354
  EmptyState,
@@ -32371,7 +32361,7 @@ function GuardsPanel({ guards }) {
32371
32361
  }
32372
32362
  const passedCount = guards.filter((g) => g.result).length;
32373
32363
  const failedCount = guards.length - passedCount;
32374
- const filteredGuards = React114.useMemo(() => {
32364
+ const filteredGuards = React113.useMemo(() => {
32375
32365
  if (filter === "all") return guards;
32376
32366
  if (filter === "passed") return guards.filter((g) => g.result);
32377
32367
  return guards.filter((g) => !g.result);
@@ -32532,10 +32522,10 @@ function EffectBadge({ effect }) {
32532
32522
  ] });
32533
32523
  }
32534
32524
  function TransitionTimeline({ transitions }) {
32535
- const containerRef = React114.useRef(null);
32536
- const [autoScroll, setAutoScroll] = React114.useState(true);
32537
- const [expandedId, setExpandedId] = React114.useState(null);
32538
- React114.useEffect(() => {
32525
+ const containerRef = React113.useRef(null);
32526
+ const [autoScroll, setAutoScroll] = React113.useState(true);
32527
+ const [expandedId, setExpandedId] = React113.useState(null);
32528
+ React113.useEffect(() => {
32539
32529
  if (autoScroll && containerRef.current) {
32540
32530
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
32541
32531
  }
@@ -32821,9 +32811,9 @@ function getAllEvents(traits2) {
32821
32811
  }
32822
32812
  function EventDispatcherTab({ traits: traits2, schema }) {
32823
32813
  const eventBus = useEventBus();
32824
- const [log3, setLog] = React114.useState([]);
32825
- const prevStatesRef = React114.useRef(/* @__PURE__ */ new Map());
32826
- React114.useEffect(() => {
32814
+ const [log3, setLog] = React113.useState([]);
32815
+ const prevStatesRef = React113.useRef(/* @__PURE__ */ new Map());
32816
+ React113.useEffect(() => {
32827
32817
  for (const trait of traits2) {
32828
32818
  const prev = prevStatesRef.current.get(trait.id);
32829
32819
  if (prev && prev !== trait.currentState) {
@@ -32993,10 +32983,10 @@ function VerifyModePanel({
32993
32983
  serverCount,
32994
32984
  localCount
32995
32985
  }) {
32996
- const [expanded, setExpanded] = React114.useState(true);
32997
- const scrollRef = React114.useRef(null);
32998
- const prevCountRef = React114.useRef(0);
32999
- React114.useEffect(() => {
32986
+ const [expanded, setExpanded] = React113.useState(true);
32987
+ const scrollRef = React113.useRef(null);
32988
+ const prevCountRef = React113.useRef(0);
32989
+ React113.useEffect(() => {
33000
32990
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
33001
32991
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
33002
32992
  }
@@ -33062,10 +33052,10 @@ function RuntimeDebugger({
33062
33052
  defaultTab,
33063
33053
  schema
33064
33054
  }) {
33065
- const [isCollapsed, setIsCollapsed] = React114.useState(mode === "verify" ? true : defaultCollapsed);
33066
- const [isVisible, setIsVisible] = React114.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33055
+ const [isCollapsed, setIsCollapsed] = React113.useState(mode === "verify" ? true : defaultCollapsed);
33056
+ const [isVisible, setIsVisible] = React113.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
33067
33057
  const debugData = useDebugData();
33068
- React114.useEffect(() => {
33058
+ React113.useEffect(() => {
33069
33059
  if (mode === "inline") return;
33070
33060
  return onDebugToggle((enabled) => {
33071
33061
  setIsVisible(enabled);
@@ -33074,7 +33064,7 @@ function RuntimeDebugger({
33074
33064
  }
33075
33065
  });
33076
33066
  }, [mode]);
33077
- React114.useEffect(() => {
33067
+ React113.useEffect(() => {
33078
33068
  if (mode === "inline") return;
33079
33069
  const handleKeyDown = (e) => {
33080
33070
  if (e.key === "`" && isVisible) {
@@ -33623,7 +33613,7 @@ function SequenceBar({
33623
33613
  onSlotRemove(index);
33624
33614
  }, [onSlotRemove, playing]);
33625
33615
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
33626
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
33616
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
33627
33617
  i > 0 && /* @__PURE__ */ jsx(
33628
33618
  Typography,
33629
33619
  {
@@ -34968,7 +34958,7 @@ var init_StatCard2 = __esm({
34968
34958
  const labelToUse = propLabel ?? propTitle;
34969
34959
  const eventBus = useEventBus();
34970
34960
  const { t } = useTranslate();
34971
- const handleActionClick = React114__default.useCallback(() => {
34961
+ const handleActionClick = React113__default.useCallback(() => {
34972
34962
  if (action?.event) {
34973
34963
  eventBus.emit(`UI:${action.event}`, {});
34974
34964
  }
@@ -34979,7 +34969,7 @@ var init_StatCard2 = __esm({
34979
34969
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
34980
34970
  const isLoading = externalLoading ?? false;
34981
34971
  const error = externalError;
34982
- const computeMetricValue = React114__default.useCallback(
34972
+ const computeMetricValue = React113__default.useCallback(
34983
34973
  (metric, items) => {
34984
34974
  if (metric.value !== void 0) {
34985
34975
  return metric.value;
@@ -35018,7 +35008,7 @@ var init_StatCard2 = __esm({
35018
35008
  },
35019
35009
  []
35020
35010
  );
35021
- const schemaStats = React114__default.useMemo(() => {
35011
+ const schemaStats = React113__default.useMemo(() => {
35022
35012
  if (!metrics || metrics.length === 0) return null;
35023
35013
  return metrics.map((metric) => ({
35024
35014
  label: metric.label,
@@ -35026,7 +35016,7 @@ var init_StatCard2 = __esm({
35026
35016
  format: metric.format
35027
35017
  }));
35028
35018
  }, [metrics, data, computeMetricValue]);
35029
- const calculatedTrend = React114__default.useMemo(() => {
35019
+ const calculatedTrend = React113__default.useMemo(() => {
35030
35020
  if (manualTrend !== void 0) return manualTrend;
35031
35021
  if (previousValue === void 0 || currentValue === void 0)
35032
35022
  return void 0;
@@ -36010,7 +36000,7 @@ var init_Timeline = __esm({
36010
36000
  }) => {
36011
36001
  const { t } = useTranslate();
36012
36002
  const entityData = Array.isArray(entity) ? entity : [];
36013
- const items = React114__default.useMemo(() => {
36003
+ const items = React113__default.useMemo(() => {
36014
36004
  if (propItems) return propItems;
36015
36005
  if (entityData.length === 0) return [];
36016
36006
  return entityData.map((record, idx) => {
@@ -36117,7 +36107,7 @@ var init_Timeline = __esm({
36117
36107
  }
36118
36108
  });
36119
36109
  function extractToastProps(children) {
36120
- if (!React114__default.isValidElement(children)) {
36110
+ if (!React113__default.isValidElement(children)) {
36121
36111
  if (typeof children === "string") {
36122
36112
  return { message: children };
36123
36113
  }
@@ -36155,7 +36145,7 @@ var init_ToastSlot = __esm({
36155
36145
  eventBus.emit("UI:CLOSE");
36156
36146
  };
36157
36147
  if (!isVisible) return null;
36158
- const isCustomContent = React114__default.isValidElement(children) && !message;
36148
+ const isCustomContent = React113__default.isValidElement(children) && !message;
36159
36149
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
36160
36150
  Toast,
36161
36151
  {
@@ -36424,7 +36414,7 @@ var init_WizardContainer = __esm({
36424
36414
  const isCompleted = index < currentStep;
36425
36415
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
36426
36416
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
36427
- return /* @__PURE__ */ jsxs(React114__default.Fragment, { children: [
36417
+ return /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
36428
36418
  /* @__PURE__ */ jsx(
36429
36419
  Button,
36430
36420
  {
@@ -36806,12 +36796,12 @@ var init_WorldMapTemplate = __esm({
36806
36796
  }
36807
36797
  });
36808
36798
  function lazyThree(name, loader) {
36809
- const Lazy = React114__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36799
+ const Lazy = React113__default.lazy(() => loader().then((m) => ({ default: m[name] })));
36810
36800
  function ThreeWrapper(props) {
36811
- return React114__default.createElement(
36812
- React114__default.Suspense,
36801
+ return React113__default.createElement(
36802
+ React113__default.Suspense,
36813
36803
  { fallback: null },
36814
- React114__default.createElement(Lazy, props)
36804
+ React113__default.createElement(Lazy, props)
36815
36805
  );
36816
36806
  }
36817
36807
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -37299,7 +37289,7 @@ function SuspenseConfigProvider({
37299
37289
  config,
37300
37290
  children
37301
37291
  }) {
37302
- return React114__default.createElement(
37292
+ return React113__default.createElement(
37303
37293
  SuspenseConfigContext.Provider,
37304
37294
  { value: config },
37305
37295
  children
@@ -37782,7 +37772,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37782
37772
  const key = `${parentId}-${index}-trait:${traitName}`;
37783
37773
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
37784
37774
  }
37785
- return /* @__PURE__ */ jsx(React114__default.Fragment, { children: child }, `${parentId}-${index}`);
37775
+ return /* @__PURE__ */ jsx(React113__default.Fragment, { children: child }, `${parentId}-${index}`);
37786
37776
  }
37787
37777
  if (!child || typeof child !== "object") return null;
37788
37778
  const childId = `${parentId}-${index}`;
@@ -37817,40 +37807,6 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37817
37807
  function isPatternConfig(value) {
37818
37808
  return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
37819
37809
  }
37820
- function isFnFormLambda(value) {
37821
- return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
37822
- }
37823
- function resolveLambdaBindings(body, argName, arg) {
37824
- const prefix = `@${argName}.`;
37825
- const lookup = (path) => {
37826
- let cur = arg;
37827
- for (const seg of path.split(".")) {
37828
- if (cur === null || cur === void 0) return void 0;
37829
- if (typeof cur !== "object") return void 0;
37830
- cur = cur[seg];
37831
- }
37832
- return cur;
37833
- };
37834
- if (typeof body === "string") {
37835
- if (body === `@${argName}`) return arg;
37836
- if (body.startsWith(prefix)) {
37837
- const v = lookup(body.slice(prefix.length));
37838
- return v === void 0 || v === null ? "" : v;
37839
- }
37840
- return body;
37841
- }
37842
- if (Array.isArray(body)) {
37843
- return body.map((b) => resolveLambdaBindings(b, argName, arg));
37844
- }
37845
- if (body !== null && typeof body === "object") {
37846
- const out = {};
37847
- for (const [k, v] of Object.entries(body)) {
37848
- out[k] = resolveLambdaBindings(v, argName, arg);
37849
- }
37850
- return out;
37851
- }
37852
- return body;
37853
- }
37854
37810
  function renderPatternProps(props, onDismiss) {
37855
37811
  const rendered = {};
37856
37812
  for (const [key, value] of Object.entries(props)) {
@@ -37866,26 +37822,6 @@ function renderPatternProps(props, onDismiss) {
37866
37822
  priority: 0
37867
37823
  };
37868
37824
  rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
37869
- } else if (isFnFormLambda(value)) {
37870
- const [, argName, body] = value;
37871
- const lambdaBody = body;
37872
- const fn = (item, index) => {
37873
- const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
37874
- if (!isPatternConfig(resolvedBody)) {
37875
- return null;
37876
- }
37877
- const childContent = {
37878
- id: `lambda-${key}-${index}`,
37879
- pattern: resolvedBody.type,
37880
- props: Object.fromEntries(
37881
- Object.entries(resolvedBody).filter(([k]) => k !== "type")
37882
- ),
37883
- priority: 0
37884
- };
37885
- return /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
37886
- };
37887
- const targetKey = key === "renderItem" ? "children" : key;
37888
- rendered[targetKey] = fn;
37889
37825
  } else {
37890
37826
  rendered[key] = value;
37891
37827
  }
@@ -37929,7 +37865,10 @@ function SlotContentRenderer({
37929
37865
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0;
37930
37866
  const myPath = patternPath ?? "root";
37931
37867
  const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait) : void 0;
37932
- const { children: _childrenConfig, ...restProps } = content.props;
37868
+ const incomingChildren = content.props.children;
37869
+ const childrenIsRenderFn = typeof incomingChildren === "function";
37870
+ const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
37871
+ const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
37933
37872
  const renderedProps = renderPatternProps(restProps, onDismiss);
37934
37873
  const finalProps = renderedProps;
37935
37874
  const resolvedItems = Array.isArray(
@@ -38195,6 +38134,114 @@ function createClientEffectHandlers(options) {
38195
38134
  };
38196
38135
  }
38197
38136
 
38137
+ // runtime/fn-form-lambda.ts
38138
+ init_logger();
38139
+ var lambdaLog = createLogger("almadar:ui:fn-form-lambda");
38140
+ function isFnFormLambda(value) {
38141
+ return Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string" && value[2] !== null && typeof value[2] === "object";
38142
+ }
38143
+ function resolveLambdaBindings(body, argName, arg) {
38144
+ const prefix = `@${argName}.`;
38145
+ const lookup = (path) => {
38146
+ let cur = arg;
38147
+ for (const seg of path.split(".")) {
38148
+ if (cur === null || cur === void 0) return void 0;
38149
+ if (typeof cur !== "object") return void 0;
38150
+ cur = cur[seg];
38151
+ }
38152
+ return cur;
38153
+ };
38154
+ if (typeof body === "string") {
38155
+ if (body === `@${argName}`) return arg;
38156
+ if (body.startsWith(prefix)) {
38157
+ const v = lookup(body.slice(prefix.length));
38158
+ return v === void 0 || v === null ? "" : v;
38159
+ }
38160
+ return body;
38161
+ }
38162
+ if (Array.isArray(body)) {
38163
+ return body.map((b) => resolveLambdaBindings(b, argName, arg));
38164
+ }
38165
+ if (body !== null && typeof body === "object") {
38166
+ const out = {};
38167
+ for (const [k, v] of Object.entries(body)) {
38168
+ out[k] = resolveLambdaBindings(v, argName, arg);
38169
+ }
38170
+ return out;
38171
+ }
38172
+ return body;
38173
+ }
38174
+ var _slotContentRenderer2 = null;
38175
+ function getSlotContentRenderer2() {
38176
+ if (_slotContentRenderer2) return _slotContentRenderer2;
38177
+ const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
38178
+ _slotContentRenderer2 = mod.SlotContentRenderer;
38179
+ return _slotContentRenderer2;
38180
+ }
38181
+ function makeLambdaFn(argName, lambdaBody, callerKey) {
38182
+ return (item, index) => {
38183
+ const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
38184
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
38185
+ return null;
38186
+ }
38187
+ const record = resolvedBody;
38188
+ if (typeof record.type !== "string") {
38189
+ return null;
38190
+ }
38191
+ const SlotContentRenderer2 = getSlotContentRenderer2();
38192
+ const childContent = {
38193
+ id: `lambda-${callerKey}-${index}`,
38194
+ pattern: record.type,
38195
+ props: Object.fromEntries(
38196
+ Object.entries(record).filter(([k]) => k !== "type")
38197
+ ),
38198
+ priority: 0
38199
+ };
38200
+ return React113__default.createElement(SlotContentRenderer2, { content: childContent });
38201
+ };
38202
+ }
38203
+ function convertNode(node, callerKey) {
38204
+ if (node === null || node === void 0) return node;
38205
+ if (Array.isArray(node)) {
38206
+ if (isFnFormLambda(node)) {
38207
+ const [, argName, body] = node;
38208
+ return makeLambdaFn(argName, body, callerKey);
38209
+ }
38210
+ let anyChanged = false;
38211
+ const mapped = node.map((item, i) => {
38212
+ const next = convertNode(item, `${callerKey}[${i}]`);
38213
+ if (next !== item) anyChanged = true;
38214
+ return next;
38215
+ });
38216
+ return anyChanged ? mapped : node;
38217
+ }
38218
+ if (typeof node === "object") {
38219
+ return convertObjectProps(node);
38220
+ }
38221
+ return node;
38222
+ }
38223
+ function convertObjectProps(props) {
38224
+ let convertedAny = false;
38225
+ const out = {};
38226
+ for (const [key, value] of Object.entries(props)) {
38227
+ if (isFnFormLambda(value)) {
38228
+ convertedAny = true;
38229
+ const [, argName, body] = value;
38230
+ const targetKey = key === "renderItem" ? "children" : key;
38231
+ out[targetKey] = makeLambdaFn(argName, body, key);
38232
+ lambdaLog.debug(`convert key=${key} \u2192 ${targetKey}`);
38233
+ continue;
38234
+ }
38235
+ const next = convertNode(value, key);
38236
+ if (next !== value) convertedAny = true;
38237
+ out[key] = next;
38238
+ }
38239
+ return convertedAny ? out : props;
38240
+ }
38241
+ function convertFnFormLambdasInProps(props) {
38242
+ return convertObjectProps(props);
38243
+ }
38244
+
38198
38245
  // runtime/useTraitStateMachine.ts
38199
38246
  init_EntitySchemaContext();
38200
38247
  init_traitRegistry();
@@ -38263,11 +38310,12 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
38263
38310
  const last = patterns[patterns.length - 1];
38264
38311
  const record = last.pattern ?? {};
38265
38312
  const { type: patternType, children: nested, ...inlineProps } = record;
38266
- const props = {
38313
+ const rawProps = {
38267
38314
  ...inlineProps,
38268
38315
  ...last.props,
38269
38316
  ...nested !== void 0 ? { children: nested } : {}
38270
38317
  };
38318
+ const props = convertFnFormLambdasInProps(rawProps);
38271
38319
  const isEmbedded = embedded?.has(traitName) ?? false;
38272
38320
  if (isEmbedded) {
38273
38321
  flushLog.info("embed-route", {
@@ -38560,8 +38608,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
38560
38608
  payload: payload || {},
38561
38609
  state: result.previousState
38562
38610
  };
38563
- if (binding.config) {
38564
- sharedBindings.config = binding.config;
38611
+ const sharedDeclared = collectDeclaredConfigDefaults(
38612
+ binding.trait
38613
+ );
38614
+ const sharedCallSite = binding.config;
38615
+ if (sharedDeclared || sharedCallSite) {
38616
+ sharedBindings.config = {
38617
+ ...sharedDeclared ?? {},
38618
+ ...sharedCallSite ?? {}
38619
+ };
38565
38620
  }
38566
38621
  const serverHandlers = createServerEffectHandlers({
38567
38622
  persistence,
@@ -38595,8 +38650,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
38595
38650
  payload: payload || {},
38596
38651
  state: result.previousState
38597
38652
  };
38598
- if (binding.config) {
38599
- bindingCtx.config = binding.config;
38653
+ const declaredDefaults = collectDeclaredConfigDefaults(
38654
+ binding.trait
38655
+ );
38656
+ const callSiteConfig = binding.config;
38657
+ if (declaredDefaults || callSiteConfig) {
38658
+ bindingCtx.config = {
38659
+ ...declaredDefaults ?? {},
38660
+ ...callSiteConfig ?? {}
38661
+ };
38600
38662
  }
38601
38663
  const effectContext = {
38602
38664
  traitName: binding.trait.name,
@@ -39330,10 +39392,11 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
39330
39392
  const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
39331
39393
  const sourceTrait = eff.traitName ?? "server";
39332
39394
  const isEmbedded = embeddedTraits?.has(sourceTrait) ?? false;
39333
- const props = {
39395
+ const rawProps = {
39334
39396
  ...inlineProps,
39335
39397
  ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
39336
39398
  };
39399
+ const props = convertFnFormLambdasInProps(rawProps);
39337
39400
  if (isEmbedded) {
39338
39401
  xOrbitalLog2.info("slot:embed-routed", {
39339
39402
  sourceTrait,