@almadar/ui 2.28.2 → 2.29.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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React113 = require('react');
3
+ var React114 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var providers = require('@almadar/ui/providers');
6
6
  require('react-dom');
@@ -42,7 +42,7 @@ function _interopNamespace(e) {
42
42
  return Object.freeze(n);
43
43
  }
44
44
 
45
- var React113__namespace = /*#__PURE__*/_interopNamespace(React113);
45
+ var React114__namespace = /*#__PURE__*/_interopNamespace(React114);
46
46
  var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
47
47
  var L__default = /*#__PURE__*/_interopDefault(L);
48
48
  var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
@@ -154,7 +154,7 @@ var BUILT_IN_THEMES = [
154
154
  hasDarkMode: true
155
155
  }
156
156
  ];
157
- var ThemeContext = React113.createContext(void 0);
157
+ var ThemeContext = React114.createContext(void 0);
158
158
  var THEME_STORAGE_KEY = "theme";
159
159
  var MODE_STORAGE_KEY = "theme-mode";
160
160
  function getSystemMode() {
@@ -174,14 +174,14 @@ var ThemeProvider = ({
174
174
  defaultMode = "system",
175
175
  targetRef
176
176
  }) => {
177
- const availableThemes = React113.useMemo(() => {
177
+ const availableThemes = React114.useMemo(() => {
178
178
  const themeMap = /* @__PURE__ */ new Map();
179
179
  BUILT_IN_THEMES.forEach((t) => themeMap.set(t.name, t));
180
180
  themes.forEach((t) => themeMap.set(t.name, t));
181
181
  return Array.from(themeMap.values());
182
182
  }, [themes]);
183
183
  const isScoped = !!targetRef;
184
- const [theme, setThemeState] = React113.useState(() => {
184
+ const [theme, setThemeState] = React114.useState(() => {
185
185
  if (isScoped || typeof window === "undefined") return defaultTheme;
186
186
  const stored = localStorage.getItem(THEME_STORAGE_KEY);
187
187
  const validThemes = [
@@ -193,7 +193,7 @@ var ThemeProvider = ({
193
193
  }
194
194
  return defaultTheme;
195
195
  });
196
- const [mode, setModeState] = React113.useState(() => {
196
+ const [mode, setModeState] = React114.useState(() => {
197
197
  if (isScoped || typeof window === "undefined") return defaultMode;
198
198
  const stored = localStorage.getItem(MODE_STORAGE_KEY);
199
199
  if (stored === "light" || stored === "dark" || stored === "system") {
@@ -201,14 +201,14 @@ var ThemeProvider = ({
201
201
  }
202
202
  return defaultMode;
203
203
  });
204
- const [resolvedMode, setResolvedMode] = React113.useState(
204
+ const [resolvedMode, setResolvedMode] = React114.useState(
205
205
  () => resolveMode(mode)
206
206
  );
207
- const appliedTheme = React113.useMemo(
207
+ const appliedTheme = React114.useMemo(
208
208
  () => `${theme}-${resolvedMode}`,
209
209
  [theme, resolvedMode]
210
210
  );
211
- React113.useEffect(() => {
211
+ React114.useEffect(() => {
212
212
  const updateResolved = () => {
213
213
  setResolvedMode(resolveMode(mode));
214
214
  };
@@ -221,7 +221,7 @@ var ThemeProvider = ({
221
221
  }
222
222
  return void 0;
223
223
  }, [mode]);
224
- React113.useEffect(() => {
224
+ React114.useEffect(() => {
225
225
  if (isScoped) {
226
226
  if (targetRef?.current) {
227
227
  targetRef.current.setAttribute("data-theme", appliedTheme);
@@ -235,7 +235,7 @@ var ThemeProvider = ({
235
235
  root.classList.remove("light", "dark");
236
236
  root.classList.add(resolvedMode);
237
237
  }, [appliedTheme, resolvedMode, targetRef, isScoped]);
238
- const setTheme = React113.useCallback(
238
+ const setTheme = React114.useCallback(
239
239
  (newTheme) => {
240
240
  const validTheme = availableThemes.find((t) => t.name === newTheme);
241
241
  if (validTheme) {
@@ -251,17 +251,17 @@ var ThemeProvider = ({
251
251
  },
252
252
  [availableThemes]
253
253
  );
254
- const setMode = React113.useCallback((newMode) => {
254
+ const setMode = React114.useCallback((newMode) => {
255
255
  setModeState(newMode);
256
256
  if (!isScoped && typeof window !== "undefined") {
257
257
  localStorage.setItem(MODE_STORAGE_KEY, newMode);
258
258
  }
259
259
  }, []);
260
- const toggleMode = React113.useCallback(() => {
260
+ const toggleMode = React114.useCallback(() => {
261
261
  const newMode = resolvedMode === "dark" ? "light" : "dark";
262
262
  setMode(newMode);
263
263
  }, [resolvedMode, setMode]);
264
- const contextValue = React113.useMemo(
264
+ const contextValue = React114.useMemo(
265
265
  () => ({
266
266
  theme,
267
267
  mode,
@@ -285,6 +285,81 @@ var ThemeProvider = ({
285
285
  );
286
286
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue, children });
287
287
  };
288
+ var store = /* @__PURE__ */ new Map();
289
+ var storeListeners = /* @__PURE__ */ new Set();
290
+ var watchCallbacks = /* @__PURE__ */ new Map();
291
+ function advance(entityType, data) {
292
+ const prev = store.get(entityType);
293
+ const oldData = prev?.data ?? [];
294
+ store.set(entityType, { data, version: (prev?.version ?? 0) + 1 });
295
+ for (const listener of storeListeners) {
296
+ listener();
297
+ }
298
+ const cbs = watchCallbacks.get(entityType);
299
+ if (cbs) {
300
+ for (const cb of cbs) {
301
+ try {
302
+ cb(oldData, data);
303
+ } catch {
304
+ }
305
+ }
306
+ }
307
+ }
308
+ function getSnapshot(entityType) {
309
+ return store.get(entityType)?.data ?? [];
310
+ }
311
+ function getVersion(entityType) {
312
+ return store.get(entityType)?.version ?? 0;
313
+ }
314
+ function subscribeToStore(listener) {
315
+ storeListeners.add(listener);
316
+ return () => {
317
+ storeListeners.delete(listener);
318
+ };
319
+ }
320
+ function addWatch(entityType, callback) {
321
+ let cbs = watchCallbacks.get(entityType);
322
+ if (!cbs) {
323
+ cbs = /* @__PURE__ */ new Set();
324
+ watchCallbacks.set(entityType, cbs);
325
+ }
326
+ cbs.add(callback);
327
+ return () => {
328
+ cbs.delete(callback);
329
+ };
330
+ }
331
+ function useEntityRef(entityType) {
332
+ const versionRef = React114.useRef(0);
333
+ const dataRef = React114.useRef([]);
334
+ const getSnapshotStable = React114__namespace.default.useCallback(() => {
335
+ const currentVersion = getVersion(entityType);
336
+ if (currentVersion !== versionRef.current) {
337
+ versionRef.current = currentVersion;
338
+ dataRef.current = getSnapshot(entityType);
339
+ }
340
+ return dataRef.current;
341
+ }, [entityType]);
342
+ return React114.useSyncExternalStore(subscribeToStore, getSnapshotStable, () => []);
343
+ }
344
+ function useEntityWatch(entityType, callback) {
345
+ const callbackRef = React114.useRef(callback);
346
+ callbackRef.current = callback;
347
+ React114.useEffect(() => {
348
+ return addWatch(entityType, (oldData, newData) => {
349
+ callbackRef.current(oldData, newData);
350
+ });
351
+ }, [entityType]);
352
+ }
353
+ var EntityStoreContext = React114.createContext({
354
+ advance,
355
+ getSnapshot
356
+ });
357
+ function useEntityStore() {
358
+ return React114.useContext(EntityStoreContext);
359
+ }
360
+ function EntityStoreProvider({ children }) {
361
+ return /* @__PURE__ */ jsxRuntime.jsx(EntityStoreContext.Provider, { value: { advance, getSnapshot }, children });
362
+ }
288
363
  function setGlobalEventBus(bus) {
289
364
  if (typeof window !== "undefined") {
290
365
  window.__kflowEventBus = bus;
@@ -357,15 +432,15 @@ var fallbackEventBus = {
357
432
  }
358
433
  };
359
434
  function useEventBus() {
360
- const context = React113.useContext(providers.EventBusContext);
435
+ const context = React114.useContext(providers.EventBusContext);
361
436
  return context ?? getGlobalEventBus() ?? fallbackEventBus;
362
437
  }
363
- var EventBusContext2 = React113.createContext(null);
438
+ var EventBusContext2 = React114.createContext(null);
364
439
  function EventBusProvider({ children, debug: debug2 = false }) {
365
- const listenersRef = React113.useRef(/* @__PURE__ */ new Map());
366
- const anyListenersRef = React113.useRef(/* @__PURE__ */ new Set());
367
- const deprecationWarningShown = React113.useRef(false);
368
- const getSelectedEntity = React113.useCallback(() => {
440
+ const listenersRef = React114.useRef(/* @__PURE__ */ new Map());
441
+ const anyListenersRef = React114.useRef(/* @__PURE__ */ new Set());
442
+ const deprecationWarningShown = React114.useRef(false);
443
+ const getSelectedEntity = React114.useCallback(() => {
369
444
  if (!deprecationWarningShown.current) {
370
445
  console.warn(
371
446
  "[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
@@ -374,7 +449,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
374
449
  }
375
450
  return null;
376
451
  }, []);
377
- const clearSelectedEntity = React113.useCallback(() => {
452
+ const clearSelectedEntity = React114.useCallback(() => {
378
453
  if (!deprecationWarningShown.current) {
379
454
  console.warn(
380
455
  "[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
@@ -382,7 +457,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
382
457
  deprecationWarningShown.current = true;
383
458
  }
384
459
  }, []);
385
- const emit = React113.useCallback((type, payload) => {
460
+ const emit = React114.useCallback((type, payload) => {
386
461
  const event = {
387
462
  type,
388
463
  payload,
@@ -416,7 +491,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
416
491
  }
417
492
  }
418
493
  }, [debug2]);
419
- const on = React113.useCallback((type, listener) => {
494
+ const on = React114.useCallback((type, listener) => {
420
495
  if (!listenersRef.current.has(type)) {
421
496
  listenersRef.current.set(type, /* @__PURE__ */ new Set());
422
497
  }
@@ -435,18 +510,18 @@ function EventBusProvider({ children, debug: debug2 = false }) {
435
510
  }
436
511
  };
437
512
  }, [debug2]);
438
- const once = React113.useCallback((type, listener) => {
513
+ const once = React114.useCallback((type, listener) => {
439
514
  const wrappedListener = (event) => {
440
515
  listenersRef.current.get(type)?.delete(wrappedListener);
441
516
  listener(event);
442
517
  };
443
518
  return on(type, wrappedListener);
444
519
  }, [on]);
445
- const hasListeners = React113.useCallback((type) => {
520
+ const hasListeners = React114.useCallback((type) => {
446
521
  const listeners6 = listenersRef.current.get(type);
447
522
  return listeners6 !== void 0 && listeners6.size > 0;
448
523
  }, []);
449
- const onAny = React113.useCallback((listener) => {
524
+ const onAny = React114.useCallback((listener) => {
450
525
  anyListenersRef.current.add(listener);
451
526
  if (debug2) {
452
527
  console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
@@ -458,7 +533,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
458
533
  }
459
534
  };
460
535
  }, [debug2]);
461
- const contextValue = React113.useMemo(
536
+ const contextValue = React114.useMemo(
462
537
  () => ({
463
538
  emit,
464
539
  on,
@@ -470,7 +545,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
470
545
  }),
471
546
  [emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
472
547
  );
473
- React113.useEffect(() => {
548
+ React114.useEffect(() => {
474
549
  setGlobalEventBus(contextValue);
475
550
  return () => {
476
551
  setGlobalEventBus(null);
@@ -478,7 +553,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
478
553
  }, [contextValue]);
479
554
  return /* @__PURE__ */ jsxRuntime.jsx(EventBusContext2.Provider, { value: contextValue, children });
480
555
  }
481
- var SelectionContext = React113.createContext(null);
556
+ var SelectionContext = React114.createContext(null);
482
557
  var defaultCompareEntities = (a, b) => {
483
558
  if (a === b) return true;
484
559
  if (!a || !b) return false;
@@ -495,8 +570,8 @@ function SelectionProvider({
495
570
  compareEntities = defaultCompareEntities
496
571
  }) {
497
572
  const eventBus = useEventBus();
498
- const [selected, setSelectedState] = React113.useState(null);
499
- const setSelected = React113.useCallback(
573
+ const [selected, setSelectedState] = React114.useState(null);
574
+ const setSelected = React114.useCallback(
500
575
  (entity) => {
501
576
  setSelectedState(entity);
502
577
  if (debug2) {
@@ -505,19 +580,19 @@ function SelectionProvider({
505
580
  },
506
581
  [debug2]
507
582
  );
508
- const clearSelection = React113.useCallback(() => {
583
+ const clearSelection = React114.useCallback(() => {
509
584
  setSelectedState(null);
510
585
  if (debug2) {
511
586
  console.log("[SelectionProvider] Selection cleared");
512
587
  }
513
588
  }, [debug2]);
514
- const isSelected = React113.useCallback(
589
+ const isSelected = React114.useCallback(
515
590
  (entity) => {
516
591
  return compareEntities(selected, entity);
517
592
  },
518
593
  [selected, compareEntities]
519
594
  );
520
- React113.useEffect(() => {
595
+ React114.useEffect(() => {
521
596
  const handleSelect = (event) => {
522
597
  const row = event.payload?.row;
523
598
  if (row) {
@@ -555,14 +630,14 @@ function SelectionProvider({
555
630
  return /* @__PURE__ */ jsxRuntime.jsx(SelectionContext.Provider, { value: contextValue, children });
556
631
  }
557
632
  function useSelection() {
558
- const context = React113.useContext(SelectionContext);
633
+ const context = React114.useContext(SelectionContext);
559
634
  if (!context) {
560
635
  throw new Error("useSelection must be used within a SelectionProvider");
561
636
  }
562
637
  return context;
563
638
  }
564
639
  function useSelectionOptional() {
565
- const context = React113.useContext(SelectionContext);
640
+ const context = React114.useContext(SelectionContext);
566
641
  return context;
567
642
  }
568
643
  function cn(...inputs) {
@@ -705,7 +780,7 @@ var positionStyles = {
705
780
  fixed: "fixed",
706
781
  sticky: "sticky"
707
782
  };
708
- var Box = React113__namespace.default.forwardRef(
783
+ var Box = React114__namespace.default.forwardRef(
709
784
  ({
710
785
  padding,
711
786
  paddingX,
@@ -734,20 +809,20 @@ var Box = React113__namespace.default.forwardRef(
734
809
  ...rest
735
810
  }, ref) => {
736
811
  const eventBus = useEventBus();
737
- const handleClick = React113.useCallback((e) => {
812
+ const handleClick = React114.useCallback((e) => {
738
813
  if (action) {
739
814
  e.stopPropagation();
740
815
  eventBus.emit(`UI:${action}`, actionPayload ?? {});
741
816
  }
742
817
  onClick?.(e);
743
818
  }, [action, actionPayload, eventBus, onClick]);
744
- const handleMouseEnter = React113.useCallback((e) => {
819
+ const handleMouseEnter = React114.useCallback((e) => {
745
820
  if (hoverEvent) {
746
821
  eventBus.emit(`UI:${hoverEvent}`, { hovered: true });
747
822
  }
748
823
  onMouseEnter?.(e);
749
824
  }, [hoverEvent, eventBus, onMouseEnter]);
750
- const handleMouseLeave = React113.useCallback((e) => {
825
+ const handleMouseLeave = React114.useCallback((e) => {
751
826
  if (hoverEvent) {
752
827
  eventBus.emit(`UI:${hoverEvent}`, { hovered: false });
753
828
  }
@@ -976,7 +1051,7 @@ function resolveIconProp(value, sizeClass) {
976
1051
  const IconComp = value;
977
1052
  return /* @__PURE__ */ jsxRuntime.jsx(IconComp, { className: sizeClass });
978
1053
  }
979
- if (React113__namespace.default.isValidElement(value)) {
1054
+ if (React114__namespace.default.isValidElement(value)) {
980
1055
  return value;
981
1056
  }
982
1057
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -985,7 +1060,7 @@ function resolveIconProp(value, sizeClass) {
985
1060
  }
986
1061
  return value;
987
1062
  }
988
- var Button = React113__namespace.default.forwardRef(
1063
+ var Button = React114__namespace.default.forwardRef(
989
1064
  ({
990
1065
  className,
991
1066
  variant = "primary",
@@ -1081,7 +1156,7 @@ var sizeStyles3 = {
1081
1156
  md: "px-2.5 py-1 text-sm",
1082
1157
  lg: "px-3 py-1.5 text-base"
1083
1158
  };
1084
- var Badge = React113__namespace.default.forwardRef(
1159
+ var Badge = React114__namespace.default.forwardRef(
1085
1160
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
1086
1161
  const iconSizes2 = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
1087
1162
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -1108,7 +1183,7 @@ var Badge = React113__namespace.default.forwardRef(
1108
1183
  }
1109
1184
  );
1110
1185
  Badge.displayName = "Badge";
1111
- var Input = React113__namespace.default.forwardRef(
1186
+ var Input = React114__namespace.default.forwardRef(
1112
1187
  ({
1113
1188
  className,
1114
1189
  inputType,
@@ -1220,7 +1295,7 @@ var Input = React113__namespace.default.forwardRef(
1220
1295
  }
1221
1296
  );
1222
1297
  Input.displayName = "Input";
1223
- var Label = React113__namespace.default.forwardRef(
1298
+ var Label = React114__namespace.default.forwardRef(
1224
1299
  ({ className, required, children, ...props }, ref) => {
1225
1300
  return /* @__PURE__ */ jsxRuntime.jsxs(
1226
1301
  "label",
@@ -1240,7 +1315,7 @@ var Label = React113__namespace.default.forwardRef(
1240
1315
  }
1241
1316
  );
1242
1317
  Label.displayName = "Label";
1243
- var Textarea = React113__namespace.default.forwardRef(
1318
+ var Textarea = React114__namespace.default.forwardRef(
1244
1319
  ({ className, error, ...props }, ref) => {
1245
1320
  return /* @__PURE__ */ jsxRuntime.jsx(
1246
1321
  "textarea",
@@ -1263,7 +1338,7 @@ var Textarea = React113__namespace.default.forwardRef(
1263
1338
  }
1264
1339
  );
1265
1340
  Textarea.displayName = "Textarea";
1266
- var Select = React113__namespace.default.forwardRef(
1341
+ var Select = React114__namespace.default.forwardRef(
1267
1342
  ({ className, options, placeholder, error, ...props }, ref) => {
1268
1343
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
1269
1344
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1299,7 +1374,7 @@ var Select = React113__namespace.default.forwardRef(
1299
1374
  }
1300
1375
  );
1301
1376
  Select.displayName = "Select";
1302
- var Checkbox = React113__namespace.default.forwardRef(
1377
+ var Checkbox = React114__namespace.default.forwardRef(
1303
1378
  ({ className, label, id, ...props }, ref) => {
1304
1379
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
1305
1380
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
@@ -1375,7 +1450,7 @@ var shadowStyles2 = {
1375
1450
  md: "shadow",
1376
1451
  lg: "shadow-lg"
1377
1452
  };
1378
- var Card = React113__namespace.default.forwardRef(
1453
+ var Card = React114__namespace.default.forwardRef(
1379
1454
  ({
1380
1455
  className,
1381
1456
  variant = "bordered",
@@ -1411,9 +1486,9 @@ var Card = React113__namespace.default.forwardRef(
1411
1486
  }
1412
1487
  );
1413
1488
  Card.displayName = "Card";
1414
- var CardHeader = React113__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
1489
+ var CardHeader = React114__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
1415
1490
  CardHeader.displayName = "CardHeader";
1416
- var CardTitle = React113__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1491
+ var CardTitle = React114__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1417
1492
  "h3",
1418
1493
  {
1419
1494
  ref,
@@ -1426,11 +1501,11 @@ var CardTitle = React113__namespace.default.forwardRef(({ className, ...props },
1426
1501
  }
1427
1502
  ));
1428
1503
  CardTitle.displayName = "CardTitle";
1429
- var CardContent = React113__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
1504
+ var CardContent = React114__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
1430
1505
  CardContent.displayName = "CardContent";
1431
1506
  var CardBody = CardContent;
1432
1507
  CardBody.displayName = "CardBody";
1433
- var CardFooter = React113__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1508
+ var CardFooter = React114__namespace.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1434
1509
  "div",
1435
1510
  {
1436
1511
  ref,
@@ -1445,7 +1520,7 @@ var sizeStyles4 = {
1445
1520
  md: "h-6 w-6",
1446
1521
  lg: "h-8 w-8"
1447
1522
  };
1448
- var Spinner = React113__namespace.default.forwardRef(
1523
+ var Spinner = React114__namespace.default.forwardRef(
1449
1524
  ({ className, size = "md", ...props }, ref) => {
1450
1525
  return /* @__PURE__ */ jsxRuntime.jsx(
1451
1526
  "div",
@@ -1459,7 +1534,7 @@ var Spinner = React113__namespace.default.forwardRef(
1459
1534
  }
1460
1535
  );
1461
1536
  Spinner.displayName = "Spinner";
1462
- var Radio = React113__namespace.default.forwardRef(
1537
+ var Radio = React114__namespace.default.forwardRef(
1463
1538
  ({
1464
1539
  label,
1465
1540
  helperText,
@@ -1563,7 +1638,7 @@ var Radio = React113__namespace.default.forwardRef(
1563
1638
  }
1564
1639
  );
1565
1640
  Radio.displayName = "Radio";
1566
- var Switch = React113__namespace.forwardRef(
1641
+ var Switch = React114__namespace.forwardRef(
1567
1642
  ({
1568
1643
  checked,
1569
1644
  defaultChecked = false,
@@ -1574,10 +1649,10 @@ var Switch = React113__namespace.forwardRef(
1574
1649
  name,
1575
1650
  className
1576
1651
  }, ref) => {
1577
- const [isChecked, setIsChecked] = React113__namespace.useState(
1652
+ const [isChecked, setIsChecked] = React114__namespace.useState(
1578
1653
  checked !== void 0 ? checked : defaultChecked
1579
1654
  );
1580
- React113__namespace.useEffect(() => {
1655
+ React114__namespace.useEffect(() => {
1581
1656
  if (checked !== void 0) {
1582
1657
  setIsChecked(checked);
1583
1658
  }
@@ -1735,7 +1810,7 @@ var sizeStyles5 = {
1735
1810
  md: "w-2.5 h-2.5",
1736
1811
  lg: "w-3 h-3"
1737
1812
  };
1738
- var StatusDot = React113__namespace.default.forwardRef(
1813
+ var StatusDot = React114__namespace.default.forwardRef(
1739
1814
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
1740
1815
  return /* @__PURE__ */ jsxRuntime.jsx(
1741
1816
  "span",
@@ -1782,7 +1857,7 @@ var iconMap2 = {
1782
1857
  down: LucideIcons.TrendingDown,
1783
1858
  flat: LucideIcons.ArrowRight
1784
1859
  };
1785
- var TrendIndicator = React113__namespace.default.forwardRef(
1860
+ var TrendIndicator = React114__namespace.default.forwardRef(
1786
1861
  ({
1787
1862
  className,
1788
1863
  value,
@@ -1841,7 +1916,7 @@ var thumbSizes = {
1841
1916
  md: "w-4 h-4",
1842
1917
  lg: "w-5 h-5"
1843
1918
  };
1844
- var RangeSlider = React113__namespace.default.forwardRef(
1919
+ var RangeSlider = React114__namespace.default.forwardRef(
1845
1920
  ({
1846
1921
  className,
1847
1922
  min = 0,
@@ -1859,14 +1934,14 @@ var RangeSlider = React113__namespace.default.forwardRef(
1859
1934
  formatValue: formatValue5,
1860
1935
  ...props
1861
1936
  }, ref) => {
1862
- const [isDragging, setIsDragging] = React113.useState(false);
1863
- const [showTip, setShowTip] = React113.useState(false);
1864
- const inputRef = React113.useRef(null);
1937
+ const [isDragging, setIsDragging] = React114.useState(false);
1938
+ const [showTip, setShowTip] = React114.useState(false);
1939
+ const inputRef = React114.useRef(null);
1865
1940
  const eventBus = useSafeEventBus();
1866
1941
  const percentage = max !== min ? (value - min) / (max - min) * 100 : 0;
1867
1942
  const bufferedPercentage = buffered !== void 0 ? Math.min(buffered, 100) : void 0;
1868
1943
  const displayValue = formatValue5 ? formatValue5(value) : String(value);
1869
- const handleChange = React113.useCallback(
1944
+ const handleChange = React114.useCallback(
1870
1945
  (e) => {
1871
1946
  const newValue = Number(e.target.value);
1872
1947
  onChange?.(newValue);
@@ -2044,7 +2119,7 @@ var paddingClasses = {
2044
2119
  md: "py-16",
2045
2120
  lg: "py-24"
2046
2121
  };
2047
- var ContentSection = React113__namespace.default.forwardRef(
2122
+ var ContentSection = React114__namespace.default.forwardRef(
2048
2123
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
2049
2124
  return /* @__PURE__ */ jsxRuntime.jsx(
2050
2125
  Box,
@@ -2083,7 +2158,7 @@ var animatedStyles = {
2083
2158
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
2084
2159
  "none": {}
2085
2160
  };
2086
- var AnimatedReveal = React113__namespace.default.forwardRef(
2161
+ var AnimatedReveal = React114__namespace.default.forwardRef(
2087
2162
  ({
2088
2163
  trigger = "scroll",
2089
2164
  animation = "fade-up",
@@ -2098,10 +2173,10 @@ var AnimatedReveal = React113__namespace.default.forwardRef(
2098
2173
  style,
2099
2174
  ...props
2100
2175
  }, forwardedRef) => {
2101
- const [isAnimated, setIsAnimated] = React113.useState(false);
2102
- const internalRef = React113.useRef(null);
2103
- const hasAnimated = React113.useRef(false);
2104
- const setRef = React113.useCallback(
2176
+ const [isAnimated, setIsAnimated] = React114.useState(false);
2177
+ const internalRef = React114.useRef(null);
2178
+ const hasAnimated = React114.useRef(false);
2179
+ const setRef = React114.useCallback(
2105
2180
  (node) => {
2106
2181
  internalRef.current = node;
2107
2182
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -2109,7 +2184,7 @@ var AnimatedReveal = React113__namespace.default.forwardRef(
2109
2184
  },
2110
2185
  [forwardedRef]
2111
2186
  );
2112
- React113.useEffect(() => {
2187
+ React114.useEffect(() => {
2113
2188
  if (trigger !== "scroll") return;
2114
2189
  const el = internalRef.current;
2115
2190
  if (!el) return;
@@ -2135,7 +2210,7 @@ var AnimatedReveal = React113__namespace.default.forwardRef(
2135
2210
  setIsAnimated(false);
2136
2211
  }
2137
2212
  } : void 0;
2138
- React113.useEffect(() => {
2213
+ React114.useEffect(() => {
2139
2214
  if (trigger === "manual" && manualAnimate !== void 0) {
2140
2215
  setIsAnimated(manualAnimate);
2141
2216
  }
@@ -2165,9 +2240,9 @@ var AnimatedReveal = React113__namespace.default.forwardRef(
2165
2240
  );
2166
2241
  AnimatedReveal.displayName = "AnimatedReveal";
2167
2242
  function useFetchedSvg(src) {
2168
- const [svg, setSvg] = React113.useState(null);
2169
- const cache = React113.useRef({});
2170
- React113.useEffect(() => {
2243
+ const [svg, setSvg] = React114.useState(null);
2244
+ const cache = React114.useRef({});
2245
+ React114.useEffect(() => {
2171
2246
  if (!src) {
2172
2247
  setSvg(null);
2173
2248
  return;
@@ -2236,7 +2311,7 @@ function applyMorphAnimation(container, animate, duration, delay, easing) {
2236
2311
  el.style.opacity = animate ? "1" : "0";
2237
2312
  });
2238
2313
  }
2239
- var AnimatedGraphic = React113__namespace.default.forwardRef(
2314
+ var AnimatedGraphic = React114__namespace.default.forwardRef(
2240
2315
  ({
2241
2316
  src,
2242
2317
  svgContent,
@@ -2255,11 +2330,11 @@ var AnimatedGraphic = React113__namespace.default.forwardRef(
2255
2330
  children,
2256
2331
  ...props
2257
2332
  }, ref) => {
2258
- const containerRef = React113.useRef(null);
2333
+ const containerRef = React114.useRef(null);
2259
2334
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
2260
2335
  const resolvedSvg = svgContent ?? fetchedSvg;
2261
- const prevAnimateRef = React113.useRef(animate);
2262
- const setRef = React113__namespace.default.useCallback(
2336
+ const prevAnimateRef = React114.useRef(animate);
2337
+ const setRef = React114__namespace.default.useCallback(
2263
2338
  (node) => {
2264
2339
  containerRef.current = node;
2265
2340
  if (typeof ref === "function") ref(node);
@@ -2267,7 +2342,7 @@ var AnimatedGraphic = React113__namespace.default.forwardRef(
2267
2342
  },
2268
2343
  [ref]
2269
2344
  );
2270
- React113.useEffect(() => {
2345
+ React114.useEffect(() => {
2271
2346
  const el = containerRef.current;
2272
2347
  if (!el || !strokeColor) return;
2273
2348
  const paths = el.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect");
@@ -2275,7 +2350,7 @@ var AnimatedGraphic = React113__namespace.default.forwardRef(
2275
2350
  p2.style.stroke = strokeColor;
2276
2351
  });
2277
2352
  }, [resolvedSvg, strokeColor]);
2278
- React113.useEffect(() => {
2353
+ React114.useEffect(() => {
2279
2354
  const el = containerRef.current;
2280
2355
  if (!el || !resolvedSvg) return;
2281
2356
  if (animation === "draw" || animation === "fill") {
@@ -2300,7 +2375,7 @@ var AnimatedGraphic = React113__namespace.default.forwardRef(
2300
2375
  });
2301
2376
  }
2302
2377
  }, [resolvedSvg, animation]);
2303
- React113.useEffect(() => {
2378
+ React114.useEffect(() => {
2304
2379
  const el = containerRef.current;
2305
2380
  if (!el) return;
2306
2381
  const id = requestAnimationFrame(() => {
@@ -2456,7 +2531,7 @@ var en_default = {
2456
2531
  // hooks/useTranslate.ts
2457
2532
  var { $meta: _meta, ...coreMessages } = en_default;
2458
2533
  var coreLocale = coreMessages;
2459
- var I18nContext = React113.createContext({
2534
+ var I18nContext = React114.createContext({
2460
2535
  locale: "en",
2461
2536
  direction: "ltr",
2462
2537
  t: (key) => coreLocale[key] ?? key
@@ -2465,7 +2540,7 @@ var I18nContext = React113.createContext({
2465
2540
  I18nContext.displayName = "I18nContext";
2466
2541
  I18nContext.Provider;
2467
2542
  function useTranslate() {
2468
- return React113.useContext(I18nContext);
2543
+ return React114.useContext(I18nContext);
2469
2544
  }
2470
2545
  var ErrorState = ({
2471
2546
  title,
@@ -2501,7 +2576,7 @@ var ErrorState = ({
2501
2576
  );
2502
2577
  };
2503
2578
  ErrorState.displayName = "ErrorState";
2504
- var ErrorBoundary = class extends React113__namespace.default.Component {
2579
+ var ErrorBoundary = class extends React114__namespace.default.Component {
2505
2580
  constructor(props) {
2506
2581
  super(props);
2507
2582
  __publicField(this, "reset", () => {
@@ -2600,7 +2675,7 @@ function executeNotify(message, options, config) {
2600
2675
  function executeEmit(event, payload, config) {
2601
2676
  config.eventBus.emit(event, payload);
2602
2677
  }
2603
- var ClientEffectConfigContext = React113.createContext(null);
2678
+ var ClientEffectConfigContext = React114.createContext(null);
2604
2679
  ClientEffectConfigContext.Provider;
2605
2680
  var effectIdCounter = 0;
2606
2681
  function generateEffectId() {
@@ -2839,14 +2914,14 @@ var OfflineExecutor = class {
2839
2914
  }
2840
2915
  };
2841
2916
  function useOfflineExecutor(options) {
2842
- const executorRef = React113.useRef(null);
2843
- const [state, setState] = React113.useState({
2917
+ const executorRef = React114.useRef(null);
2918
+ const [state, setState] = React114.useState({
2844
2919
  isOffline: false,
2845
2920
  syncQueue: [],
2846
2921
  localEffectsProcessed: 0,
2847
2922
  effectsSynced: 0
2848
2923
  });
2849
- React113.useEffect(() => {
2924
+ React114.useEffect(() => {
2850
2925
  const executor = new OfflineExecutor({
2851
2926
  ...options,
2852
2927
  onQueueChange: (queue) => {
@@ -2861,7 +2936,7 @@ function useOfflineExecutor(options) {
2861
2936
  executorRef.current = null;
2862
2937
  };
2863
2938
  }, []);
2864
- React113.useEffect(() => {
2939
+ React114.useEffect(() => {
2865
2940
  if (!options.autoSync || !options.serverUrl) return;
2866
2941
  const handleOnline = async () => {
2867
2942
  if (executorRef.current) {
@@ -2875,13 +2950,13 @@ function useOfflineExecutor(options) {
2875
2950
  window.addEventListener("online", handleOnline);
2876
2951
  return () => window.removeEventListener("online", handleOnline);
2877
2952
  }, [options.autoSync, options.serverUrl, options.authToken]);
2878
- const executeEffects = React113.useCallback((effects) => {
2953
+ const executeEffects = React114.useCallback((effects) => {
2879
2954
  executorRef.current?.executeClientEffects(effects);
2880
2955
  if (executorRef.current) {
2881
2956
  setState(executorRef.current.getState());
2882
2957
  }
2883
2958
  }, []);
2884
- const processEventOffline = React113.useCallback(
2959
+ const processEventOffline = React114.useCallback(
2885
2960
  (event, payload, effects) => {
2886
2961
  const result = executorRef.current?.processEventOffline(event, payload, effects);
2887
2962
  if (executorRef.current) {
@@ -2891,7 +2966,7 @@ function useOfflineExecutor(options) {
2891
2966
  },
2892
2967
  []
2893
2968
  );
2894
- const sync = React113.useCallback(async () => {
2969
+ const sync = React114.useCallback(async () => {
2895
2970
  if (!executorRef.current || !options.serverUrl) return 0;
2896
2971
  const count = await executorRef.current.syncPendingEffects(
2897
2972
  options.serverUrl,
@@ -2900,7 +2975,7 @@ function useOfflineExecutor(options) {
2900
2975
  setState(executorRef.current.getState());
2901
2976
  return count;
2902
2977
  }, [options.serverUrl, options.authToken]);
2903
- const clearQueue = React113.useCallback(() => {
2978
+ const clearQueue = React114.useCallback(() => {
2904
2979
  executorRef.current?.clearQueue();
2905
2980
  if (executorRef.current) {
2906
2981
  setState(executorRef.current.getState());
@@ -2916,7 +2991,7 @@ function useOfflineExecutor(options) {
2916
2991
  clearQueue
2917
2992
  };
2918
2993
  }
2919
- React113.createContext(null);
2994
+ React114.createContext(null);
2920
2995
  var defaultIcon = L__default.default.icon({
2921
2996
  iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
2922
2997
  iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
@@ -3014,7 +3089,7 @@ function getSummary() {
3014
3089
  pending: allChecks.filter((c) => c.status === "pending").length
3015
3090
  };
3016
3091
  }
3017
- function getSnapshot() {
3092
+ function getSnapshot2() {
3018
3093
  return {
3019
3094
  checks: getAllChecks(),
3020
3095
  transitions: getTransitions(),
@@ -3030,7 +3105,7 @@ function exposeOnWindow() {
3030
3105
  if (typeof window === "undefined") return;
3031
3106
  if (!window.__orbitalVerification) {
3032
3107
  window.__orbitalVerification = {
3033
- getSnapshot,
3108
+ getSnapshot: getSnapshot2,
3034
3109
  getChecks: getAllChecks,
3035
3110
  getTransitions,
3036
3111
  getBridge: getBridgeHealth,
@@ -3094,7 +3169,7 @@ function bindTraitStateGetter(getter) {
3094
3169
  }
3095
3170
  }
3096
3171
  exposeOnWindow();
3097
- var MarkdownContent = React113__namespace.default.memo(
3172
+ var MarkdownContent = React114__namespace.default.memo(
3098
3173
  ({ content, direction, className }) => {
3099
3174
  const { t: _t } = useTranslate();
3100
3175
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -3196,7 +3271,7 @@ var MarkdownContent = React113__namespace.default.memo(
3196
3271
  (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
3197
3272
  );
3198
3273
  MarkdownContent.displayName = "MarkdownContent";
3199
- var CodeBlock = React113__namespace.default.memo(
3274
+ var CodeBlock = React114__namespace.default.memo(
3200
3275
  ({
3201
3276
  code: rawCode,
3202
3277
  language = "text",
@@ -3208,20 +3283,20 @@ var CodeBlock = React113__namespace.default.memo(
3208
3283
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
3209
3284
  const eventBus = useEventBus();
3210
3285
  const { t: _t } = useTranslate();
3211
- const scrollRef = React113.useRef(null);
3212
- const savedScrollLeftRef = React113.useRef(0);
3213
- const [copied, setCopied] = React113.useState(false);
3214
- React113.useLayoutEffect(() => {
3286
+ const scrollRef = React114.useRef(null);
3287
+ const savedScrollLeftRef = React114.useRef(0);
3288
+ const [copied, setCopied] = React114.useState(false);
3289
+ React114.useLayoutEffect(() => {
3215
3290
  const el = scrollRef.current;
3216
3291
  return () => {
3217
3292
  if (el) savedScrollLeftRef.current = el.scrollLeft;
3218
3293
  };
3219
3294
  }, [language, code]);
3220
- React113.useLayoutEffect(() => {
3295
+ React114.useLayoutEffect(() => {
3221
3296
  const el = scrollRef.current;
3222
3297
  if (el) el.scrollLeft = savedScrollLeftRef.current;
3223
3298
  }, [language, code]);
3224
- React113.useEffect(() => {
3299
+ React114.useEffect(() => {
3225
3300
  const el = scrollRef.current;
3226
3301
  if (!el) return;
3227
3302
  const handle = () => {
@@ -3307,18 +3382,18 @@ CodeBlock.displayName = "CodeBlock";
3307
3382
 
3308
3383
  // lib/debug.ts
3309
3384
  typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
3310
- React113.lazy(() => import('react-markdown'));
3311
- var GameAudioContext = React113.createContext(null);
3385
+ React114.lazy(() => import('react-markdown'));
3386
+ var GameAudioContext = React114.createContext(null);
3312
3387
  GameAudioContext.displayName = "GameAudioContext";
3313
3388
 
3314
3389
  // components/organisms/component-registry.generated.ts
3315
3390
  function lazyThree(name, loader) {
3316
- const Lazy = React113__namespace.default.lazy(() => loader().then((m) => ({ default: m[name] })));
3391
+ const Lazy = React114__namespace.default.lazy(() => loader().then((m) => ({ default: m[name] })));
3317
3392
  function ThreeWrapper(props) {
3318
- return React113__namespace.default.createElement(
3319
- React113__namespace.default.Suspense,
3393
+ return React114__namespace.default.createElement(
3394
+ React114__namespace.default.Suspense,
3320
3395
  { fallback: null },
3321
- React113__namespace.default.createElement(Lazy, props)
3396
+ React114__namespace.default.createElement(Lazy, props)
3322
3397
  );
3323
3398
  }
3324
3399
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -3339,13 +3414,13 @@ lazyThree("PhysicsObject3D", () => import('@almadar/ui/components/organisms/game
3339
3414
  lazyThree("Scene3D", () => import('@almadar/ui/components/organisms/game/three'));
3340
3415
  lazyThree("TileRenderer", () => import('@almadar/ui/components/organisms/game/three'));
3341
3416
  lazyThree("UnitRenderer", () => import('@almadar/ui/components/organisms/game/three'));
3342
- var SuspenseConfigContext = React113.createContext({ enabled: false });
3343
- React113.createContext(false);
3417
+ var SuspenseConfigContext = React114.createContext({ enabled: false });
3418
+ React114.createContext(false);
3344
3419
  function SuspenseConfigProvider({
3345
3420
  config,
3346
3421
  children
3347
3422
  }) {
3348
- return React113__namespace.default.createElement(
3423
+ return React114__namespace.default.createElement(
3349
3424
  SuspenseConfigContext.Provider,
3350
3425
  { value: config },
3351
3426
  children
@@ -3390,8 +3465,8 @@ function VerificationProvider({
3390
3465
  }) {
3391
3466
  const isEnabled = enabled ?? (typeof process !== "undefined" && process.env?.NODE_ENV !== "production");
3392
3467
  const eventBus = useEventBus();
3393
- const pendingRef = React113.useRef(/* @__PURE__ */ new Map());
3394
- React113.useEffect(() => {
3468
+ const pendingRef = React114.useRef(/* @__PURE__ */ new Map());
3469
+ React114.useEffect(() => {
3395
3470
  if (!isEnabled) return;
3396
3471
  if (!eventBus.onAny) return;
3397
3472
  const unsub = eventBus.onAny((evt) => {
@@ -3487,7 +3562,7 @@ function VerificationProvider({
3487
3562
  );
3488
3563
  return unsub;
3489
3564
  }, [isEnabled, eventBus]);
3490
- React113.useEffect(() => {
3565
+ React114.useEffect(() => {
3491
3566
  if (!isEnabled) return;
3492
3567
  if (!runtimeManager) return;
3493
3568
  runtimeManager.setObserver({
@@ -3509,11 +3584,11 @@ function VerificationProvider({
3509
3584
  "pass"
3510
3585
  );
3511
3586
  }, [isEnabled, runtimeManager]);
3512
- React113.useEffect(() => {
3587
+ React114.useEffect(() => {
3513
3588
  if (!isEnabled) return;
3514
3589
  bindEventBus(eventBus);
3515
3590
  }, [isEnabled, eventBus]);
3516
- React113.useEffect(() => {
3591
+ React114.useEffect(() => {
3517
3592
  if (!isEnabled) return;
3518
3593
  if (traitStateGetter) {
3519
3594
  bindTraitStateGetter(traitStateGetter);
@@ -3537,11 +3612,11 @@ function OrbitalProvider({
3537
3612
  suspense = false,
3538
3613
  verification
3539
3614
  }) {
3540
- const suspenseConfig = React113.useMemo(
3615
+ const suspenseConfig = React114.useMemo(
3541
3616
  () => ({ enabled: suspense }),
3542
3617
  [suspense]
3543
3618
  );
3544
- const inner = /* @__PURE__ */ jsxRuntime.jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsxRuntime.jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsxRuntime.jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsxRuntime.jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) });
3619
+ const inner = /* @__PURE__ */ jsxRuntime.jsx(EntityStoreProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(EventBusProvider, { debug: debug2, children: /* @__PURE__ */ jsxRuntime.jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsxRuntime.jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsxRuntime.jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) }) });
3545
3620
  if (skipTheme) {
3546
3621
  return inner;
3547
3622
  }
@@ -3557,43 +3632,43 @@ function OrbitalProvider({
3557
3632
  );
3558
3633
  }
3559
3634
  OrbitalProvider.displayName = "OrbitalProvider";
3560
- var FetchedDataContext = React113.createContext(null);
3635
+ var FetchedDataContext = React114.createContext(null);
3561
3636
  function FetchedDataProvider({
3562
3637
  initialData,
3563
3638
  children
3564
3639
  }) {
3565
- const [state, setState] = React113.useState(() => ({
3640
+ const [state, setState] = React114.useState(() => ({
3566
3641
  data: initialData || {},
3567
3642
  fetchedAt: {},
3568
3643
  loading: false,
3569
3644
  error: null
3570
3645
  }));
3571
- const getData = React113.useCallback(
3646
+ const getData = React114.useCallback(
3572
3647
  (entityName) => {
3573
3648
  return state.data[entityName] || [];
3574
3649
  },
3575
3650
  [state.data]
3576
3651
  );
3577
- const getById = React113.useCallback(
3652
+ const getById = React114.useCallback(
3578
3653
  (entityName, id) => {
3579
3654
  const records = state.data[entityName];
3580
3655
  return records?.find((r) => r.id === id);
3581
3656
  },
3582
3657
  [state.data]
3583
3658
  );
3584
- const hasData = React113.useCallback(
3659
+ const hasData = React114.useCallback(
3585
3660
  (entityName) => {
3586
3661
  return entityName in state.data && state.data[entityName].length > 0;
3587
3662
  },
3588
3663
  [state.data]
3589
3664
  );
3590
- const getFetchedAt = React113.useCallback(
3665
+ const getFetchedAt = React114.useCallback(
3591
3666
  (entityName) => {
3592
3667
  return state.fetchedAt[entityName];
3593
3668
  },
3594
3669
  [state.fetchedAt]
3595
3670
  );
3596
- const setData = React113.useCallback((data) => {
3671
+ const setData = React114.useCallback((data) => {
3597
3672
  const now = Date.now();
3598
3673
  setState((prev) => ({
3599
3674
  ...prev,
@@ -3612,14 +3687,14 @@ function FetchedDataProvider({
3612
3687
  error: null
3613
3688
  }));
3614
3689
  }, []);
3615
- const clearData = React113.useCallback(() => {
3690
+ const clearData = React114.useCallback(() => {
3616
3691
  setState((prev) => ({
3617
3692
  ...prev,
3618
3693
  data: {},
3619
3694
  fetchedAt: {}
3620
3695
  }));
3621
3696
  }, []);
3622
- const clearEntity = React113.useCallback((entityName) => {
3697
+ const clearEntity = React114.useCallback((entityName) => {
3623
3698
  setState((prev) => {
3624
3699
  const newData = { ...prev.data };
3625
3700
  const newFetchedAt = { ...prev.fetchedAt };
@@ -3632,13 +3707,13 @@ function FetchedDataProvider({
3632
3707
  };
3633
3708
  });
3634
3709
  }, []);
3635
- const setLoading = React113.useCallback((loading) => {
3710
+ const setLoading = React114.useCallback((loading) => {
3636
3711
  setState((prev) => ({ ...prev, loading }));
3637
3712
  }, []);
3638
- const setError = React113.useCallback((error) => {
3713
+ const setError = React114.useCallback((error) => {
3639
3714
  setState((prev) => ({ ...prev, error, loading: false }));
3640
3715
  }, []);
3641
- const contextValue = React113.useMemo(
3716
+ const contextValue = React114.useMemo(
3642
3717
  () => ({
3643
3718
  getData,
3644
3719
  getById,
@@ -3669,10 +3744,10 @@ function FetchedDataProvider({
3669
3744
  return /* @__PURE__ */ jsxRuntime.jsx(FetchedDataContext.Provider, { value: contextValue, children });
3670
3745
  }
3671
3746
  function useFetchedDataContext() {
3672
- return React113.useContext(FetchedDataContext);
3747
+ return React114.useContext(FetchedDataContext);
3673
3748
  }
3674
3749
  function useFetchedData() {
3675
- const context = React113.useContext(FetchedDataContext);
3750
+ const context = React114.useContext(FetchedDataContext);
3676
3751
  if (!context) {
3677
3752
  return {
3678
3753
  getData: () => [],
@@ -3712,15 +3787,15 @@ function useFetchedEntity(entityName) {
3712
3787
  error: context.error
3713
3788
  };
3714
3789
  }
3715
- var OfflineModeContext = React113.createContext(null);
3790
+ var OfflineModeContext = React114.createContext(null);
3716
3791
  function OfflineModeProvider({
3717
3792
  children,
3718
3793
  ...executorOptions
3719
3794
  }) {
3720
- const [forceOffline, setForceOffline] = React113.useState(false);
3795
+ const [forceOffline, setForceOffline] = React114.useState(false);
3721
3796
  const executor = useOfflineExecutor(executorOptions);
3722
3797
  const effectivelyOffline = executor.isOffline || forceOffline;
3723
- const contextValue = React113.useMemo(
3798
+ const contextValue = React114.useMemo(
3724
3799
  () => ({
3725
3800
  ...executor,
3726
3801
  forceOffline,
@@ -3732,16 +3807,18 @@ function OfflineModeProvider({
3732
3807
  return /* @__PURE__ */ jsxRuntime.jsx(OfflineModeContext.Provider, { value: contextValue, children });
3733
3808
  }
3734
3809
  function useOfflineMode() {
3735
- const context = React113.useContext(OfflineModeContext);
3810
+ const context = React114.useContext(OfflineModeContext);
3736
3811
  if (!context) {
3737
3812
  throw new Error("useOfflineMode must be used within OfflineModeProvider");
3738
3813
  }
3739
3814
  return context;
3740
3815
  }
3741
3816
  function useOptionalOfflineMode() {
3742
- return React113.useContext(OfflineModeContext);
3817
+ return React114.useContext(OfflineModeContext);
3743
3818
  }
3744
3819
 
3820
+ exports.EntityStoreContext = EntityStoreContext;
3821
+ exports.EntityStoreProvider = EntityStoreProvider;
3745
3822
  exports.EventBusContext = EventBusContext2;
3746
3823
  exports.EventBusProvider = EventBusProvider;
3747
3824
  exports.FetchedDataContext = FetchedDataContext;
@@ -3751,6 +3828,9 @@ exports.OrbitalProvider = OrbitalProvider;
3751
3828
  exports.SelectionContext = SelectionContext;
3752
3829
  exports.SelectionProvider = SelectionProvider;
3753
3830
  exports.VerificationProvider = VerificationProvider;
3831
+ exports.useEntityRef = useEntityRef;
3832
+ exports.useEntityStore = useEntityStore;
3833
+ exports.useEntityWatch = useEntityWatch;
3754
3834
  exports.useFetchedData = useFetchedData;
3755
3835
  exports.useFetchedDataContext = useFetchedDataContext;
3756
3836
  exports.useFetchedEntity = useFetchedEntity;