@almadar/ui 5.22.2 → 5.23.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.
package/dist/avl/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React97 from 'react';
3
- import React97__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
2
+ import * as React93 from 'react';
3
+ import React93__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
4
+ import { OrbitalProvider, EventBusContext, useTraitScope, VerificationProvider, TraitScopeProvider } from '@almadar/ui/providers';
4
5
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
6
  import ELK from 'elkjs/lib/elk.bundled.js';
6
7
  import { MarkerType, useReactFlow, Handle, Position, getBezierPath, EdgeLabelRenderer, useNodeId, ReactFlowProvider, BaseEdge, useNodesState, useEdgesState, ReactFlow, Controls, Background, BackgroundVariant } from '@xyflow/react';
@@ -12,6 +13,7 @@ import * as TablerIcons from '@tabler/icons-react';
12
13
  import * as FaIcons from 'react-icons/fa';
13
14
  import { createPortal } from 'react-dom';
14
15
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
16
+ import { UISlotProvider, useUISlots } from '@almadar/ui/context';
15
17
  import { Link, Outlet, useLocation } from 'react-router-dom';
16
18
  import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
17
19
  import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js';
@@ -3240,177 +3242,6 @@ var init_Typography = __esm({
3240
3242
  Text.displayName = "Text";
3241
3243
  }
3242
3244
  });
3243
- function captureSubscriberTag(listener) {
3244
- const fnName = listener.name;
3245
- if (typeof fnName === "string" && fnName.length > 0 && fnName !== "listener") {
3246
- return fnName;
3247
- }
3248
- const stack = new Error().stack ?? "";
3249
- const lines = stack.split("\n");
3250
- for (const raw of lines.slice(2)) {
3251
- const line = raw.trim();
3252
- if (!line) continue;
3253
- if (line.includes("EventBusProvider") || line.includes("useEventBus")) continue;
3254
- if (line.includes("captureSubscriberTag")) continue;
3255
- const match = line.match(/([^/\\)]+\.(?:tsx?|jsx?))(?::(\d+))?/);
3256
- if (match) return match[2] ? `${match[1]}:${match[2]}` : match[1];
3257
- return line.slice(0, 120);
3258
- }
3259
- return "unknown";
3260
- }
3261
- function EventBusProvider({ children, isolated = false }) {
3262
- const listenersRef = useRef(/* @__PURE__ */ new Map());
3263
- const anyListenersRef = useRef(/* @__PURE__ */ new Set());
3264
- const deprecationWarningShown = useRef(false);
3265
- const getSelectedEntity = useCallback(() => {
3266
- if (!deprecationWarningShown.current) {
3267
- busLog.warn("deprecated:getSelectedEntity", {
3268
- migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3269
- });
3270
- deprecationWarningShown.current = true;
3271
- }
3272
- return null;
3273
- }, []);
3274
- const clearSelectedEntity = useCallback(() => {
3275
- if (!deprecationWarningShown.current) {
3276
- busLog.warn("deprecated:clearSelectedEntity", {
3277
- migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3278
- });
3279
- deprecationWarningShown.current = true;
3280
- }
3281
- }, []);
3282
- const emit = useCallback((type, payload, source) => {
3283
- const event = {
3284
- type,
3285
- payload,
3286
- timestamp: Date.now(),
3287
- source
3288
- };
3289
- const listeners7 = listenersRef.current.get(type);
3290
- const listenerCount = (listeners7?.size ?? 0) + anyListenersRef.current.size;
3291
- busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
3292
- if (listenerCount === 0) {
3293
- busLog.warn("emit:no-listeners", { type });
3294
- }
3295
- if (listeners7) {
3296
- const listenersCopy = Array.from(listeners7);
3297
- for (let i = 0; i < listenersCopy.length; i++) {
3298
- const listener = listenersCopy[i];
3299
- busLog.debug("emit:listener", {
3300
- type,
3301
- kind: "specific",
3302
- index: i,
3303
- tag: listenerTags.get(listener) ?? "untagged"
3304
- });
3305
- try {
3306
- listener(event);
3307
- } catch (error) {
3308
- busLog.error("listener-threw", { type, error: error instanceof Error ? error : String(error) });
3309
- }
3310
- }
3311
- }
3312
- const anyListeners = Array.from(anyListenersRef.current);
3313
- for (let i = 0; i < anyListeners.length; i++) {
3314
- const listener = anyListeners[i];
3315
- busLog.debug("emit:listener", {
3316
- type,
3317
- kind: "onAny",
3318
- index: i,
3319
- tag: listenerTags.get(listener) ?? "untagged"
3320
- });
3321
- try {
3322
- listener(event);
3323
- } catch (error) {
3324
- busLog.error("onAny-listener-threw", { type, error: error instanceof Error ? error : String(error) });
3325
- }
3326
- }
3327
- }, []);
3328
- const on = useCallback((type, listener) => {
3329
- if (!listenersRef.current.has(type)) {
3330
- listenersRef.current.set(type, /* @__PURE__ */ new Set());
3331
- }
3332
- const listeners7 = listenersRef.current.get(type);
3333
- listeners7.add(listener);
3334
- if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3335
- subLog.debug("subscribe", { type, totalListeners: listeners7.size, tag: listenerTags.get(listener) });
3336
- return () => {
3337
- listeners7.delete(listener);
3338
- subLog.debug("unsubscribe", { type, remaining: listeners7.size });
3339
- if (listeners7.size === 0) {
3340
- listenersRef.current.delete(type);
3341
- }
3342
- };
3343
- }, []);
3344
- const once = useCallback((type, listener) => {
3345
- const wrappedListener = (event) => {
3346
- listenersRef.current.get(type)?.delete(wrappedListener);
3347
- listener(event);
3348
- };
3349
- return on(type, wrappedListener);
3350
- }, [on]);
3351
- const hasListeners = useCallback((type) => {
3352
- const listeners7 = listenersRef.current.get(type);
3353
- return listeners7 !== void 0 && listeners7.size > 0;
3354
- }, []);
3355
- const onAny = useCallback((listener) => {
3356
- anyListenersRef.current.add(listener);
3357
- if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3358
- subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
3359
- return () => {
3360
- anyListenersRef.current.delete(listener);
3361
- subLog.debug("unsubscribe:any", { remaining: anyListenersRef.current.size });
3362
- };
3363
- }, []);
3364
- const contextValue = useMemo(
3365
- () => ({
3366
- emit,
3367
- on,
3368
- once,
3369
- hasListeners,
3370
- onAny,
3371
- getSelectedEntity,
3372
- clearSelectedEntity
3373
- }),
3374
- [emit, on, once, hasListeners, onAny, getSelectedEntity, clearSelectedEntity]
3375
- );
3376
- useEffect(() => {
3377
- if (isolated) return;
3378
- setGlobalEventBus(contextValue);
3379
- return () => {
3380
- setGlobalEventBus(null);
3381
- };
3382
- }, [contextValue, isolated]);
3383
- return /* @__PURE__ */ jsx(EventBusContext.Provider, { value: contextValue, children });
3384
- }
3385
- var busLog, subLog, EventBusContext, listenerTags;
3386
- var init_EventBusProvider = __esm({
3387
- "providers/EventBusProvider.tsx"() {
3388
- "use client";
3389
- init_useEventBus();
3390
- busLog = createLogger("almadar:eventbus");
3391
- subLog = createLogger("almadar:eventbus:subscribe");
3392
- EventBusContext = createContext(null);
3393
- listenerTags = /* @__PURE__ */ new WeakMap();
3394
- }
3395
- });
3396
- function TraitScopeProvider({
3397
- orbital,
3398
- trait,
3399
- children
3400
- }) {
3401
- const value = useMemo(() => ({ orbital, trait }), [orbital, trait]);
3402
- return /* @__PURE__ */ jsx(TraitScopeContext.Provider, { value, children });
3403
- }
3404
- function useTraitScope() {
3405
- return useContext(TraitScopeContext);
3406
- }
3407
- var TraitScopeContext;
3408
- var init_TraitScopeProvider = __esm({
3409
- "providers/TraitScopeProvider.tsx"() {
3410
- "use client";
3411
- TraitScopeContext = createContext(null);
3412
- }
3413
- });
3414
3245
 
3415
3246
  // hooks/useEventBus.ts
3416
3247
  var useEventBus_exports = {};
@@ -3495,14 +3326,12 @@ function useEmitEvent() {
3495
3326
  [eventBus]
3496
3327
  );
3497
3328
  }
3498
- var log, subLog2, scopeLog, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
3329
+ var log, subLog, scopeLog, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
3499
3330
  var init_useEventBus = __esm({
3500
3331
  "hooks/useEventBus.ts"() {
3501
3332
  "use client";
3502
- init_EventBusProvider();
3503
- init_TraitScopeProvider();
3504
3333
  log = createLogger("almadar:eventbus");
3505
- subLog2 = createLogger("almadar:eventbus:subscribe");
3334
+ subLog = createLogger("almadar:eventbus:subscribe");
3506
3335
  scopeLog = createLogger("almadar:ui:trait-scope");
3507
3336
  fallbackListeners = /* @__PURE__ */ new Map();
3508
3337
  fallbackAnyListeners = /* @__PURE__ */ new Set();
@@ -3538,7 +3367,7 @@ var init_useEventBus = __esm({
3538
3367
  fallbackListeners.set(type, /* @__PURE__ */ new Set());
3539
3368
  }
3540
3369
  fallbackListeners.get(type).add(listener);
3541
- subLog2.debug("subscribe", { type, totalListeners: fallbackListeners.get(type).size });
3370
+ subLog.debug("subscribe", { type, totalListeners: fallbackListeners.get(type).size });
3542
3371
  return () => {
3543
3372
  const handlers = fallbackListeners.get(type);
3544
3373
  if (handlers) {
@@ -3562,7 +3391,7 @@ var init_useEventBus = __esm({
3562
3391
  },
3563
3392
  onAny: (listener) => {
3564
3393
  fallbackAnyListeners.add(listener);
3565
- subLog2.debug("subscribe:any", { totalAnyListeners: fallbackAnyListeners.size });
3394
+ subLog.debug("subscribe:any", { totalAnyListeners: fallbackAnyListeners.size });
3566
3395
  return () => {
3567
3396
  fallbackAnyListeners.delete(listener);
3568
3397
  };
@@ -3680,7 +3509,7 @@ var init_Box = __esm({
3680
3509
  fixed: "fixed",
3681
3510
  sticky: "sticky"
3682
3511
  };
3683
- Box = React97__default.forwardRef(
3512
+ Box = React93__default.forwardRef(
3684
3513
  ({
3685
3514
  padding,
3686
3515
  paddingX,
@@ -3730,7 +3559,7 @@ var init_Box = __esm({
3730
3559
  onMouseLeave?.(e);
3731
3560
  }, [hoverEvent, eventBus, onMouseLeave]);
3732
3561
  const isClickable = action || onClick;
3733
- return React97__default.createElement(
3562
+ return React93__default.createElement(
3734
3563
  Component,
3735
3564
  {
3736
3565
  ref,
@@ -4320,7 +4149,7 @@ var init_MiniStateMachine = __esm({
4320
4149
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4321
4150
  const tc = transitionCounts[s.name] ?? 0;
4322
4151
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
4323
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
4152
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
4324
4153
  /* @__PURE__ */ jsx(
4325
4154
  AvlState,
4326
4155
  {
@@ -4591,312 +4420,6 @@ var init_BehaviorView = __esm({
4591
4420
  BehaviorView.displayName = "BehaviorView";
4592
4421
  }
4593
4422
  });
4594
- function getSystemMode() {
4595
- if (typeof window === "undefined") return "light";
4596
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
4597
- }
4598
- function resolveMode(mode) {
4599
- if (mode === "system") {
4600
- return getSystemMode();
4601
- }
4602
- return mode;
4603
- }
4604
- function useTheme() {
4605
- const context = useContext(ThemeContext);
4606
- if (context === void 0) {
4607
- return {
4608
- theme: "wireframe",
4609
- mode: "light",
4610
- resolvedMode: "light",
4611
- setTheme: () => {
4612
- },
4613
- setMode: () => {
4614
- },
4615
- toggleMode: () => {
4616
- },
4617
- availableThemes: BUILT_IN_THEMES,
4618
- appliedTheme: "wireframe-light"
4619
- };
4620
- }
4621
- return context;
4622
- }
4623
- var log3, BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
4624
- var init_ThemeContext = __esm({
4625
- "context/ThemeContext.tsx"() {
4626
- "use client";
4627
- log3 = createLogger("almadar:ui:theme");
4628
- BUILT_IN_THEMES = [
4629
- {
4630
- name: "wireframe",
4631
- displayName: "Wireframe",
4632
- hasLightMode: true,
4633
- hasDarkMode: true
4634
- },
4635
- {
4636
- name: "minimalist",
4637
- displayName: "Minimalist",
4638
- hasLightMode: true,
4639
- hasDarkMode: true
4640
- },
4641
- {
4642
- name: "almadar",
4643
- displayName: "Almadar",
4644
- hasLightMode: true,
4645
- hasDarkMode: true
4646
- },
4647
- {
4648
- name: "trait-wars",
4649
- displayName: "Trait Wars",
4650
- hasLightMode: false,
4651
- hasDarkMode: true
4652
- },
4653
- // Extended themes
4654
- {
4655
- name: "ocean",
4656
- displayName: "Ocean",
4657
- hasLightMode: true,
4658
- hasDarkMode: true
4659
- },
4660
- {
4661
- name: "forest",
4662
- displayName: "Forest",
4663
- hasLightMode: true,
4664
- hasDarkMode: true
4665
- },
4666
- {
4667
- name: "sunset",
4668
- displayName: "Sunset",
4669
- hasLightMode: true,
4670
- hasDarkMode: true
4671
- },
4672
- {
4673
- name: "lavender",
4674
- displayName: "Lavender",
4675
- hasLightMode: true,
4676
- hasDarkMode: true
4677
- },
4678
- {
4679
- name: "rose",
4680
- displayName: "Rose",
4681
- hasLightMode: true,
4682
- hasDarkMode: true
4683
- },
4684
- {
4685
- name: "slate",
4686
- displayName: "Slate",
4687
- hasLightMode: true,
4688
- hasDarkMode: true
4689
- },
4690
- {
4691
- name: "ember",
4692
- displayName: "Ember",
4693
- hasLightMode: true,
4694
- hasDarkMode: true
4695
- },
4696
- {
4697
- name: "midnight",
4698
- displayName: "Midnight",
4699
- hasLightMode: true,
4700
- hasDarkMode: true
4701
- },
4702
- {
4703
- name: "sand",
4704
- displayName: "Sand",
4705
- hasLightMode: true,
4706
- hasDarkMode: true
4707
- },
4708
- {
4709
- name: "neon",
4710
- displayName: "Neon",
4711
- hasLightMode: true,
4712
- hasDarkMode: true
4713
- },
4714
- {
4715
- name: "arctic",
4716
- displayName: "Arctic",
4717
- hasLightMode: true,
4718
- hasDarkMode: true
4719
- },
4720
- {
4721
- name: "copper",
4722
- displayName: "Copper",
4723
- hasLightMode: true,
4724
- hasDarkMode: true
4725
- },
4726
- // Layer 1 skin axes — truly-unique themes (compact tech / editorial / brutalist dense / display-heavy / touch-first)
4727
- {
4728
- name: "prism",
4729
- displayName: "Prism",
4730
- hasLightMode: true,
4731
- hasDarkMode: true
4732
- },
4733
- {
4734
- name: "gazette",
4735
- displayName: "Gazette",
4736
- hasLightMode: true,
4737
- hasDarkMode: true
4738
- },
4739
- {
4740
- name: "terminal",
4741
- displayName: "Terminal",
4742
- hasLightMode: true,
4743
- hasDarkMode: true
4744
- },
4745
- {
4746
- name: "atelier",
4747
- displayName: "Atelier",
4748
- hasLightMode: true,
4749
- hasDarkMode: true
4750
- },
4751
- {
4752
- name: "kiosk",
4753
- displayName: "Kiosk",
4754
- hasLightMode: true,
4755
- hasDarkMode: true
4756
- },
4757
- {
4758
- name: "linear-clean",
4759
- displayName: "Linear Clean",
4760
- hasLightMode: true,
4761
- hasDarkMode: true
4762
- },
4763
- {
4764
- name: "notion-editorial",
4765
- displayName: "Notion Editorial",
4766
- hasLightMode: true,
4767
- hasDarkMode: true
4768
- },
4769
- {
4770
- name: "bloomberg-dense",
4771
- displayName: "Bloomberg Dense",
4772
- hasLightMode: true,
4773
- hasDarkMode: true
4774
- }
4775
- ];
4776
- ThemeContext = createContext(void 0);
4777
- THEME_STORAGE_KEY = "theme";
4778
- MODE_STORAGE_KEY = "theme-mode";
4779
- ThemeProvider = ({
4780
- children,
4781
- themes = [],
4782
- defaultTheme = "wireframe",
4783
- defaultMode = "system",
4784
- targetRef
4785
- }) => {
4786
- const availableThemes = useMemo(() => {
4787
- const themeMap = /* @__PURE__ */ new Map();
4788
- BUILT_IN_THEMES.forEach((t) => themeMap.set(t.name, t));
4789
- themes.forEach((t) => themeMap.set(t.name, t));
4790
- return Array.from(themeMap.values());
4791
- }, [themes]);
4792
- const isScoped = !!targetRef;
4793
- const [theme, setThemeState] = useState(() => {
4794
- if (isScoped || typeof window === "undefined") return defaultTheme;
4795
- const stored = localStorage.getItem(THEME_STORAGE_KEY);
4796
- const validThemes = [
4797
- ...BUILT_IN_THEMES.map((t) => t.name),
4798
- ...themes.map((t) => t.name)
4799
- ];
4800
- if (stored && validThemes.includes(stored)) {
4801
- return stored;
4802
- }
4803
- return defaultTheme;
4804
- });
4805
- const [mode, setModeState] = useState(() => {
4806
- if (isScoped || typeof window === "undefined") return defaultMode;
4807
- const stored = localStorage.getItem(MODE_STORAGE_KEY);
4808
- if (stored === "light" || stored === "dark" || stored === "system") {
4809
- return stored;
4810
- }
4811
- return defaultMode;
4812
- });
4813
- const [resolvedMode, setResolvedMode] = useState(
4814
- () => resolveMode(mode)
4815
- );
4816
- const appliedTheme = useMemo(
4817
- () => `${theme}-${resolvedMode}`,
4818
- [theme, resolvedMode]
4819
- );
4820
- useEffect(() => {
4821
- const updateResolved = () => {
4822
- setResolvedMode(resolveMode(mode));
4823
- };
4824
- updateResolved();
4825
- if (mode === "system") {
4826
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
4827
- const handleChange = () => updateResolved();
4828
- mediaQuery.addEventListener("change", handleChange);
4829
- return () => mediaQuery.removeEventListener("change", handleChange);
4830
- }
4831
- return void 0;
4832
- }, [mode]);
4833
- useEffect(() => {
4834
- if (isScoped) {
4835
- if (targetRef?.current) {
4836
- targetRef.current.setAttribute("data-theme", appliedTheme);
4837
- targetRef.current.classList.remove("light", "dark");
4838
- targetRef.current.classList.add(resolvedMode);
4839
- }
4840
- return;
4841
- }
4842
- const root = document.documentElement;
4843
- root.setAttribute("data-theme", appliedTheme);
4844
- root.classList.remove("light", "dark");
4845
- root.classList.add(resolvedMode);
4846
- }, [appliedTheme, resolvedMode, targetRef, isScoped]);
4847
- const setTheme = useCallback(
4848
- (newTheme) => {
4849
- const validTheme = availableThemes.find((t) => t.name === newTheme);
4850
- if (validTheme) {
4851
- setThemeState(newTheme);
4852
- if (!isScoped && typeof window !== "undefined") {
4853
- localStorage.setItem(THEME_STORAGE_KEY, newTheme);
4854
- }
4855
- } else {
4856
- log3.warn("Theme not found", {
4857
- theme: newTheme,
4858
- available: availableThemes.map((t) => t.name)
4859
- });
4860
- }
4861
- },
4862
- [availableThemes]
4863
- );
4864
- const setMode = useCallback((newMode) => {
4865
- setModeState(newMode);
4866
- if (!isScoped && typeof window !== "undefined") {
4867
- localStorage.setItem(MODE_STORAGE_KEY, newMode);
4868
- }
4869
- }, []);
4870
- const toggleMode = useCallback(() => {
4871
- const newMode = resolvedMode === "dark" ? "light" : "dark";
4872
- setMode(newMode);
4873
- }, [resolvedMode, setMode]);
4874
- const contextValue = useMemo(
4875
- () => ({
4876
- theme,
4877
- mode,
4878
- resolvedMode,
4879
- setTheme,
4880
- setMode,
4881
- toggleMode,
4882
- availableThemes,
4883
- appliedTheme
4884
- }),
4885
- [
4886
- theme,
4887
- mode,
4888
- resolvedMode,
4889
- setTheme,
4890
- setMode,
4891
- toggleMode,
4892
- availableThemes,
4893
- appliedTheme
4894
- ]
4895
- );
4896
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children });
4897
- };
4898
- }
4899
- });
4900
4423
  function EntitySchemaProvider({
4901
4424
  entities,
4902
4425
  traitLinkedEntities,
@@ -4942,380 +4465,6 @@ var init_EntitySchemaContext = __esm({
4942
4465
  EntitySchemaContext = createContext(null);
4943
4466
  }
4944
4467
  });
4945
- function generateId() {
4946
- return `slot-content-${++idCounter}-${Date.now()}`;
4947
- }
4948
- function aggregateSlot(sources) {
4949
- if (!sources) return null;
4950
- const entries = Object.entries(sources);
4951
- if (entries.length === 0) return null;
4952
- if (entries.length === 1) return entries[0][1];
4953
- const children = entries.map(([, entry]) => ({
4954
- type: entry.pattern,
4955
- ...entry.props
4956
- }));
4957
- const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
4958
- return {
4959
- id: stackId,
4960
- pattern: "stack",
4961
- props: {
4962
- direction: "vertical",
4963
- gap: "lg",
4964
- children
4965
- },
4966
- priority: 0,
4967
- animation: "fade",
4968
- sourceTrait: MULTI_SOURCE_STACK_TRAIT
4969
- };
4970
- }
4971
- function useUISlotManager() {
4972
- const [sources, setSources] = useState(DEFAULT_SOURCES);
4973
- const subscribersRef = useRef(/* @__PURE__ */ new Set());
4974
- const timersRef = useRef(/* @__PURE__ */ new Map());
4975
- const traitIndexRef = useRef(/* @__PURE__ */ new Map());
4976
- const traitSubscribersRef = useRef(/* @__PURE__ */ new Map());
4977
- const slots = useMemo(() => {
4978
- const out = { ...DEFAULT_SLOTS };
4979
- for (const slot of ALL_SLOTS) {
4980
- out[slot] = aggregateSlot(sources[slot]);
4981
- }
4982
- return out;
4983
- }, [sources]);
4984
- useEffect(() => {
4985
- return () => {
4986
- timersRef.current.forEach((timer) => clearTimeout(timer));
4987
- timersRef.current.clear();
4988
- };
4989
- }, []);
4990
- const notifySubscribers = useCallback((slot, content) => {
4991
- subscribersRef.current.forEach((callback) => {
4992
- try {
4993
- callback(slot, content);
4994
- } catch (error) {
4995
- log5.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
4996
- }
4997
- });
4998
- }, []);
4999
- const notifyTraitSubscribers = useCallback(
5000
- (traitName, content) => {
5001
- const subs = traitSubscribersRef.current.get(traitName);
5002
- if (!subs) return;
5003
- subs.forEach((callback) => {
5004
- try {
5005
- callback(content);
5006
- } catch (error) {
5007
- log5.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
5008
- }
5009
- });
5010
- },
5011
- []
5012
- );
5013
- const indexTraitRender = useCallback(
5014
- (traitName, content) => {
5015
- traitIndexRef.current.set(traitName, content);
5016
- },
5017
- []
5018
- );
5019
- const unindexTrait = useCallback((traitName) => {
5020
- traitIndexRef.current.delete(traitName);
5021
- }, []);
5022
- const render = useCallback(
5023
- (config) => {
5024
- const id = generateId();
5025
- const sourceKey = config.sourceTrait ?? DEFAULT_SOURCE_KEY;
5026
- const content = {
5027
- id,
5028
- pattern: config.pattern,
5029
- props: config.props ?? {},
5030
- priority: config.priority ?? 0,
5031
- animation: config.animation ?? "fade",
5032
- onDismiss: config.onDismiss,
5033
- sourceTrait: config.sourceTrait,
5034
- slot: config.target,
5035
- transitionEvent: config.transitionEvent,
5036
- fromState: config.fromState,
5037
- entity: config.entity
5038
- };
5039
- if (config.autoDismissMs && config.autoDismissMs > 0) {
5040
- content.autoDismissAt = Date.now() + config.autoDismissMs;
5041
- const timer = setTimeout(() => {
5042
- setSources((prev) => {
5043
- const slotSources = prev[config.target];
5044
- if (slotSources && slotSources[sourceKey]?.id === id) {
5045
- content.onDismiss?.();
5046
- const next = { ...slotSources };
5047
- delete next[sourceKey];
5048
- const updated = { ...prev, [config.target]: next };
5049
- notifySubscribers(config.target, aggregateSlot(next));
5050
- return updated;
5051
- }
5052
- return prev;
5053
- });
5054
- timersRef.current.delete(id);
5055
- }, config.autoDismissMs);
5056
- timersRef.current.set(id, timer);
5057
- }
5058
- setSources((prev) => {
5059
- const slotSources = prev[config.target] ?? {};
5060
- const existing = slotSources[sourceKey];
5061
- if (existing && existing.priority > content.priority) {
5062
- log5.warn("Slot already has higher priority content", {
5063
- slot: config.target,
5064
- sourceKey,
5065
- existingPriority: existing.priority,
5066
- newPriority: content.priority
5067
- });
5068
- return prev;
5069
- }
5070
- const nextSources = {
5071
- ...slotSources,
5072
- [sourceKey]: content
5073
- };
5074
- const nextAll = { ...prev, [config.target]: nextSources };
5075
- if (content.sourceTrait) {
5076
- indexTraitRender(content.sourceTrait, content);
5077
- notifyTraitSubscribers(content.sourceTrait, content);
5078
- }
5079
- log5.info("slot:written", {
5080
- slot: config.target,
5081
- sourceKey,
5082
- sourceTrait: content.sourceTrait,
5083
- patternType: content.pattern,
5084
- priority: content.priority
5085
- });
5086
- notifySubscribers(config.target, aggregateSlot(nextSources));
5087
- return nextAll;
5088
- });
5089
- return id;
5090
- },
5091
- [notifySubscribers, notifyTraitSubscribers, indexTraitRender]
5092
- );
5093
- const clear = useCallback(
5094
- (slot) => {
5095
- setSources((prev) => {
5096
- const slotSources = prev[slot];
5097
- if (!slotSources || Object.keys(slotSources).length === 0) {
5098
- return prev;
5099
- }
5100
- for (const content of Object.values(slotSources)) {
5101
- const timer = timersRef.current.get(content.id);
5102
- if (timer) {
5103
- clearTimeout(timer);
5104
- timersRef.current.delete(content.id);
5105
- }
5106
- content.onDismiss?.();
5107
- if (content.sourceTrait) {
5108
- unindexTrait(content.sourceTrait);
5109
- notifyTraitSubscribers(content.sourceTrait, null);
5110
- }
5111
- }
5112
- notifySubscribers(slot, null);
5113
- return { ...prev, [slot]: {} };
5114
- });
5115
- },
5116
- [notifySubscribers, notifyTraitSubscribers, unindexTrait]
5117
- );
5118
- const clearBySource = useCallback(
5119
- (slot, sourceTrait) => {
5120
- const sourceKey = sourceTrait;
5121
- setSources((prev) => {
5122
- const slotSources = prev[slot];
5123
- if (!slotSources || !(sourceKey in slotSources)) {
5124
- log5.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
5125
- return prev;
5126
- }
5127
- const content = slotSources[sourceKey];
5128
- const timer = timersRef.current.get(content.id);
5129
- if (timer) {
5130
- clearTimeout(timer);
5131
- timersRef.current.delete(content.id);
5132
- }
5133
- content.onDismiss?.();
5134
- if (content.sourceTrait) {
5135
- unindexTrait(content.sourceTrait);
5136
- notifyTraitSubscribers(content.sourceTrait, null);
5137
- }
5138
- const nextSources = { ...slotSources };
5139
- delete nextSources[sourceKey];
5140
- log5.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
5141
- notifySubscribers(slot, aggregateSlot(nextSources));
5142
- return { ...prev, [slot]: nextSources };
5143
- });
5144
- },
5145
- [notifySubscribers, notifyTraitSubscribers, unindexTrait]
5146
- );
5147
- const clearById = useCallback(
5148
- (id) => {
5149
- setSources((prev) => {
5150
- for (const slot of ALL_SLOTS) {
5151
- const slotSources = prev[slot];
5152
- if (!slotSources) continue;
5153
- const matchKey = Object.keys(slotSources).find(
5154
- (k) => slotSources[k].id === id
5155
- );
5156
- if (!matchKey) continue;
5157
- const content = slotSources[matchKey];
5158
- const timer = timersRef.current.get(id);
5159
- if (timer) {
5160
- clearTimeout(timer);
5161
- timersRef.current.delete(id);
5162
- }
5163
- content.onDismiss?.();
5164
- if (content.sourceTrait) {
5165
- unindexTrait(content.sourceTrait);
5166
- notifyTraitSubscribers(content.sourceTrait, null);
5167
- }
5168
- const nextSources = { ...slotSources };
5169
- delete nextSources[matchKey];
5170
- notifySubscribers(slot, aggregateSlot(nextSources));
5171
- return { ...prev, [slot]: nextSources };
5172
- }
5173
- return prev;
5174
- });
5175
- },
5176
- [notifySubscribers, notifyTraitSubscribers, unindexTrait]
5177
- );
5178
- const clearAll = useCallback(() => {
5179
- timersRef.current.forEach((timer) => clearTimeout(timer));
5180
- timersRef.current.clear();
5181
- setSources((prev) => {
5182
- for (const slot of ALL_SLOTS) {
5183
- const slotSources = prev[slot];
5184
- if (!slotSources) continue;
5185
- for (const content of Object.values(slotSources)) {
5186
- content.onDismiss?.();
5187
- if (content.sourceTrait) {
5188
- notifyTraitSubscribers(content.sourceTrait, null);
5189
- }
5190
- }
5191
- notifySubscribers(slot, null);
5192
- }
5193
- return DEFAULT_SOURCES;
5194
- });
5195
- traitIndexRef.current.clear();
5196
- }, [notifySubscribers, notifyTraitSubscribers]);
5197
- const subscribe = useCallback((callback) => {
5198
- subscribersRef.current.add(callback);
5199
- return () => {
5200
- subscribersRef.current.delete(callback);
5201
- };
5202
- }, []);
5203
- const hasContent = useCallback(
5204
- (slot) => slots[slot] !== null,
5205
- [slots]
5206
- );
5207
- const getContent = useCallback(
5208
- (slot) => slots[slot],
5209
- [slots]
5210
- );
5211
- const getTraitContent = useCallback(
5212
- (traitName) => traitIndexRef.current.get(traitName) ?? null,
5213
- []
5214
- );
5215
- const subscribeTrait = useCallback(
5216
- (traitName, callback) => {
5217
- let set = traitSubscribersRef.current.get(traitName);
5218
- if (!set) {
5219
- set = /* @__PURE__ */ new Set();
5220
- traitSubscribersRef.current.set(traitName, set);
5221
- }
5222
- set.add(callback);
5223
- return () => {
5224
- const s = traitSubscribersRef.current.get(traitName);
5225
- if (!s) return;
5226
- s.delete(callback);
5227
- if (s.size === 0) {
5228
- traitSubscribersRef.current.delete(traitName);
5229
- }
5230
- };
5231
- },
5232
- []
5233
- );
5234
- const updateTraitContent = useCallback(
5235
- (traitName, content) => {
5236
- const id = generateId();
5237
- const fullContent = { ...content, id, sourceTrait: traitName };
5238
- indexTraitRender(traitName, fullContent);
5239
- notifyTraitSubscribers(traitName, fullContent);
5240
- return id;
5241
- },
5242
- [indexTraitRender, notifyTraitSubscribers]
5243
- );
5244
- return {
5245
- slots,
5246
- render,
5247
- clear,
5248
- clearBySource,
5249
- clearById,
5250
- clearAll,
5251
- subscribe,
5252
- hasContent,
5253
- getContent,
5254
- getTraitContent,
5255
- subscribeTrait,
5256
- updateTraitContent
5257
- };
5258
- }
5259
- var log5, DEFAULT_SOURCE_KEY, MULTI_SOURCE_STACK_TRAIT, ALL_SLOTS, DEFAULT_SLOTS, DEFAULT_SOURCES, idCounter;
5260
- var init_useUISlots = __esm({
5261
- "hooks/useUISlots.ts"() {
5262
- "use client";
5263
- log5 = createLogger("almadar:ui:ui-slots");
5264
- DEFAULT_SOURCE_KEY = "__default__";
5265
- MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
5266
- ALL_SLOTS = [
5267
- "main",
5268
- "sidebar",
5269
- "modal",
5270
- "drawer",
5271
- "overlay",
5272
- "center",
5273
- "toast",
5274
- "hud-top",
5275
- "hud-bottom",
5276
- "hud-left",
5277
- "hud-right",
5278
- "floating"
5279
- ];
5280
- DEFAULT_SLOTS = ALL_SLOTS.reduce(
5281
- (acc, slot) => {
5282
- acc[slot] = null;
5283
- return acc;
5284
- },
5285
- {}
5286
- );
5287
- DEFAULT_SOURCES = ALL_SLOTS.reduce(
5288
- (acc, slot) => {
5289
- acc[slot] = {};
5290
- return acc;
5291
- },
5292
- {}
5293
- );
5294
- idCounter = 0;
5295
- }
5296
- });
5297
- function UISlotProvider({ children }) {
5298
- const slotManager = useUISlotManager();
5299
- const contextValue = useMemo(() => slotManager, [slotManager]);
5300
- return /* @__PURE__ */ jsx(UISlotContext.Provider, { value: contextValue, children });
5301
- }
5302
- function useUISlots() {
5303
- const context = useContext(UISlotContext);
5304
- if (!context) {
5305
- throw new Error(
5306
- "useUISlots must be used within a UISlotProvider. Make sure your component tree is wrapped with <UISlotProvider>."
5307
- );
5308
- }
5309
- return context;
5310
- }
5311
- var UISlotContext;
5312
- var init_UISlotContext = __esm({
5313
- "context/UISlotContext.tsx"() {
5314
- "use client";
5315
- init_useUISlots();
5316
- UISlotContext = createContext(null);
5317
- }
5318
- });
5319
4468
  function getCurrentIconFamily() {
5320
4469
  if (typeof window === "undefined" || typeof document === "undefined") {
5321
4470
  return DEFAULT_FAMILY;
@@ -6063,7 +5212,7 @@ var init_Icon = __esm({
6063
5212
  const directIcon = typeof icon === "string" ? void 0 : icon;
6064
5213
  const effectiveName = typeof icon === "string" ? icon : name;
6065
5214
  const family = useIconFamily();
6066
- const RenderedComponent = React97__default.useMemo(() => {
5215
+ const RenderedComponent = React93__default.useMemo(() => {
6067
5216
  if (directIcon) return null;
6068
5217
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
6069
5218
  }, [directIcon, effectiveName, family]);
@@ -6121,7 +5270,7 @@ function resolveIconProp(value, sizeClass) {
6121
5270
  const IconComp = value;
6122
5271
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
6123
5272
  }
6124
- if (React97__default.isValidElement(value)) {
5273
+ if (React93__default.isValidElement(value)) {
6125
5274
  return value;
6126
5275
  }
6127
5276
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -6197,7 +5346,7 @@ var init_Button = __esm({
6197
5346
  md: "h-icon-default w-icon-default",
6198
5347
  lg: "h-icon-default w-icon-default"
6199
5348
  };
6200
- Button = React97__default.forwardRef(
5349
+ Button = React93__default.forwardRef(
6201
5350
  ({
6202
5351
  className,
6203
5352
  variant = "primary",
@@ -6262,7 +5411,7 @@ var Dialog;
6262
5411
  var init_Dialog = __esm({
6263
5412
  "components/core/atoms/Dialog.tsx"() {
6264
5413
  init_cn();
6265
- Dialog = React97__default.forwardRef(
5414
+ Dialog = React93__default.forwardRef(
6266
5415
  ({
6267
5416
  role = "dialog",
6268
5417
  "aria-modal": ariaModal = true,
@@ -6765,7 +5914,7 @@ var init_Badge = __esm({
6765
5914
  md: "px-2.5 py-1 text-sm",
6766
5915
  lg: "px-3 py-1.5 text-base"
6767
5916
  };
6768
- Badge = React97__default.forwardRef(
5917
+ Badge = React93__default.forwardRef(
6769
5918
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
6770
5919
  const iconSizes3 = {
6771
5920
  sm: "h-icon-default w-icon-default",
@@ -7081,7 +6230,7 @@ var init_SvgFlow = __esm({
7081
6230
  opacity = 1,
7082
6231
  className
7083
6232
  }) => {
7084
- const markerId = React97__default.useMemo(() => {
6233
+ const markerId = React93__default.useMemo(() => {
7085
6234
  flowIdCounter += 1;
7086
6235
  return `almadar-flow-arrow-${flowIdCounter}`;
7087
6236
  }, []);
@@ -7624,7 +6773,7 @@ var init_SvgRing = __esm({
7624
6773
  className,
7625
6774
  label
7626
6775
  }) => {
7627
- const gradientId = React97__default.useMemo(() => {
6776
+ const gradientId = React93__default.useMemo(() => {
7628
6777
  ringIdCounter += 1;
7629
6778
  return `almadar-ring-glow-${ringIdCounter}`;
7630
6779
  }, []);
@@ -7786,7 +6935,7 @@ var init_Input = __esm({
7786
6935
  "components/core/atoms/Input.tsx"() {
7787
6936
  init_cn();
7788
6937
  init_Icon();
7789
- Input = React97__default.forwardRef(
6938
+ Input = React93__default.forwardRef(
7790
6939
  ({
7791
6940
  className,
7792
6941
  inputType,
@@ -7907,7 +7056,7 @@ var Label;
7907
7056
  var init_Label = __esm({
7908
7057
  "components/core/atoms/Label.tsx"() {
7909
7058
  init_cn();
7910
- Label = React97__default.forwardRef(
7059
+ Label = React93__default.forwardRef(
7911
7060
  ({ className, required, children, ...props }, ref) => {
7912
7061
  return /* @__PURE__ */ jsxs(
7913
7062
  "label",
@@ -7933,7 +7082,7 @@ var Textarea;
7933
7082
  var init_Textarea = __esm({
7934
7083
  "components/core/atoms/Textarea.tsx"() {
7935
7084
  init_cn();
7936
- Textarea = React97__default.forwardRef(
7085
+ Textarea = React93__default.forwardRef(
7937
7086
  ({ className, error, ...props }, ref) => {
7938
7087
  return /* @__PURE__ */ jsx(
7939
7088
  "textarea",
@@ -7963,7 +7112,7 @@ var init_Select = __esm({
7963
7112
  "components/core/atoms/Select.tsx"() {
7964
7113
  init_cn();
7965
7114
  init_Icon();
7966
- Select = React97__default.forwardRef(
7115
+ Select = React93__default.forwardRef(
7967
7116
  ({ className, options, placeholder, error, ...props }, ref) => {
7968
7117
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7969
7118
  /* @__PURE__ */ jsxs(
@@ -8005,7 +7154,7 @@ var Checkbox;
8005
7154
  var init_Checkbox = __esm({
8006
7155
  "components/core/atoms/Checkbox.tsx"() {
8007
7156
  init_cn();
8008
- Checkbox = React97__default.forwardRef(
7157
+ Checkbox = React93__default.forwardRef(
8009
7158
  ({ className, label, id, ...props }, ref) => {
8010
7159
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
8011
7160
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -8096,7 +7245,7 @@ var init_Card = __esm({
8096
7245
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
8097
7246
  "tile-image-first": "p-0 overflow-hidden"
8098
7247
  };
8099
- Card = React97__default.forwardRef(
7248
+ Card = React93__default.forwardRef(
8100
7249
  ({
8101
7250
  className,
8102
7251
  variant = "bordered",
@@ -8134,9 +7283,9 @@ var init_Card = __esm({
8134
7283
  }
8135
7284
  );
8136
7285
  Card.displayName = "Card";
8137
- CardHeader = React97__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7286
+ CardHeader = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
8138
7287
  CardHeader.displayName = "CardHeader";
8139
- CardTitle = React97__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7288
+ CardTitle = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
8140
7289
  "h3",
8141
7290
  {
8142
7291
  ref,
@@ -8149,11 +7298,11 @@ var init_Card = __esm({
8149
7298
  }
8150
7299
  ));
8151
7300
  CardTitle.displayName = "CardTitle";
8152
- CardContent = React97__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7301
+ CardContent = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
8153
7302
  CardContent.displayName = "CardContent";
8154
7303
  CardBody = CardContent;
8155
7304
  CardBody.displayName = "CardBody";
8156
- CardFooter = React97__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7305
+ CardFooter = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
8157
7306
  "div",
8158
7307
  {
8159
7308
  ref,
@@ -8208,7 +7357,7 @@ var init_FilterPill = __esm({
8208
7357
  md: "w-3.5 h-3.5",
8209
7358
  lg: "w-4 h-4"
8210
7359
  };
8211
- FilterPill = React97__default.forwardRef(
7360
+ FilterPill = React93__default.forwardRef(
8212
7361
  ({
8213
7362
  className,
8214
7363
  variant = "default",
@@ -8285,7 +7434,7 @@ var init_Spinner = __esm({
8285
7434
  md: "h-6 w-6",
8286
7435
  lg: "h-8 w-8"
8287
7436
  };
8288
- Spinner = React97__default.forwardRef(
7437
+ Spinner = React93__default.forwardRef(
8289
7438
  ({ className, size = "md", ...props }, ref) => {
8290
7439
  return /* @__PURE__ */ jsx(
8291
7440
  "div",
@@ -8747,7 +7896,7 @@ var init_Radio = __esm({
8747
7896
  md: "w-2.5 h-2.5",
8748
7897
  lg: "w-3 h-3"
8749
7898
  };
8750
- Radio = React97__default.forwardRef(
7899
+ Radio = React93__default.forwardRef(
8751
7900
  ({
8752
7901
  label,
8753
7902
  helperText,
@@ -8764,12 +7913,12 @@ var init_Radio = __esm({
8764
7913
  onChange,
8765
7914
  ...props
8766
7915
  }, ref) => {
8767
- const reactId = React97__default.useId();
7916
+ const reactId = React93__default.useId();
8768
7917
  const baseId = id || `radio-${reactId}`;
8769
7918
  const hasError = !!error;
8770
7919
  const eventBus = useEventBus();
8771
- const [selected, setSelected] = React97__default.useState(value);
8772
- React97__default.useEffect(() => {
7920
+ const [selected, setSelected] = React93__default.useState(value);
7921
+ React93__default.useEffect(() => {
8773
7922
  if (value !== void 0) setSelected(value);
8774
7923
  }, [value]);
8775
7924
  const pick = (next, e) => {
@@ -8951,7 +8100,7 @@ var init_Switch = __esm({
8951
8100
  "components/core/atoms/Switch.tsx"() {
8952
8101
  "use client";
8953
8102
  init_cn();
8954
- Switch = React97.forwardRef(
8103
+ Switch = React93.forwardRef(
8955
8104
  ({
8956
8105
  checked,
8957
8106
  defaultChecked = false,
@@ -8962,10 +8111,10 @@ var init_Switch = __esm({
8962
8111
  name,
8963
8112
  className
8964
8113
  }, ref) => {
8965
- const [isChecked, setIsChecked] = React97.useState(
8114
+ const [isChecked, setIsChecked] = React93.useState(
8966
8115
  checked !== void 0 ? checked : defaultChecked
8967
8116
  );
8968
- React97.useEffect(() => {
8117
+ React93.useEffect(() => {
8969
8118
  if (checked !== void 0) {
8970
8119
  setIsChecked(checked);
8971
8120
  }
@@ -9134,6 +8283,181 @@ var init_TextHighlight = __esm({
9134
8283
  TextHighlight.displayName = "TextHighlight";
9135
8284
  }
9136
8285
  });
8286
+ function useTheme() {
8287
+ const context = useContext(ThemeContext);
8288
+ if (context === void 0) {
8289
+ return {
8290
+ theme: "wireframe",
8291
+ mode: "light",
8292
+ resolvedMode: "light",
8293
+ setTheme: () => {
8294
+ },
8295
+ setMode: () => {
8296
+ },
8297
+ toggleMode: () => {
8298
+ },
8299
+ availableThemes: BUILT_IN_THEMES,
8300
+ appliedTheme: "wireframe-light"
8301
+ };
8302
+ }
8303
+ return context;
8304
+ }
8305
+ var BUILT_IN_THEMES, ThemeContext;
8306
+ var init_ThemeContext = __esm({
8307
+ "context/ThemeContext.tsx"() {
8308
+ "use client";
8309
+ createLogger("almadar:ui:theme");
8310
+ BUILT_IN_THEMES = [
8311
+ {
8312
+ name: "wireframe",
8313
+ displayName: "Wireframe",
8314
+ hasLightMode: true,
8315
+ hasDarkMode: true
8316
+ },
8317
+ {
8318
+ name: "minimalist",
8319
+ displayName: "Minimalist",
8320
+ hasLightMode: true,
8321
+ hasDarkMode: true
8322
+ },
8323
+ {
8324
+ name: "almadar",
8325
+ displayName: "Almadar",
8326
+ hasLightMode: true,
8327
+ hasDarkMode: true
8328
+ },
8329
+ {
8330
+ name: "trait-wars",
8331
+ displayName: "Trait Wars",
8332
+ hasLightMode: false,
8333
+ hasDarkMode: true
8334
+ },
8335
+ // Extended themes
8336
+ {
8337
+ name: "ocean",
8338
+ displayName: "Ocean",
8339
+ hasLightMode: true,
8340
+ hasDarkMode: true
8341
+ },
8342
+ {
8343
+ name: "forest",
8344
+ displayName: "Forest",
8345
+ hasLightMode: true,
8346
+ hasDarkMode: true
8347
+ },
8348
+ {
8349
+ name: "sunset",
8350
+ displayName: "Sunset",
8351
+ hasLightMode: true,
8352
+ hasDarkMode: true
8353
+ },
8354
+ {
8355
+ name: "lavender",
8356
+ displayName: "Lavender",
8357
+ hasLightMode: true,
8358
+ hasDarkMode: true
8359
+ },
8360
+ {
8361
+ name: "rose",
8362
+ displayName: "Rose",
8363
+ hasLightMode: true,
8364
+ hasDarkMode: true
8365
+ },
8366
+ {
8367
+ name: "slate",
8368
+ displayName: "Slate",
8369
+ hasLightMode: true,
8370
+ hasDarkMode: true
8371
+ },
8372
+ {
8373
+ name: "ember",
8374
+ displayName: "Ember",
8375
+ hasLightMode: true,
8376
+ hasDarkMode: true
8377
+ },
8378
+ {
8379
+ name: "midnight",
8380
+ displayName: "Midnight",
8381
+ hasLightMode: true,
8382
+ hasDarkMode: true
8383
+ },
8384
+ {
8385
+ name: "sand",
8386
+ displayName: "Sand",
8387
+ hasLightMode: true,
8388
+ hasDarkMode: true
8389
+ },
8390
+ {
8391
+ name: "neon",
8392
+ displayName: "Neon",
8393
+ hasLightMode: true,
8394
+ hasDarkMode: true
8395
+ },
8396
+ {
8397
+ name: "arctic",
8398
+ displayName: "Arctic",
8399
+ hasLightMode: true,
8400
+ hasDarkMode: true
8401
+ },
8402
+ {
8403
+ name: "copper",
8404
+ displayName: "Copper",
8405
+ hasLightMode: true,
8406
+ hasDarkMode: true
8407
+ },
8408
+ // Layer 1 skin axes — truly-unique themes (compact tech / editorial / brutalist dense / display-heavy / touch-first)
8409
+ {
8410
+ name: "prism",
8411
+ displayName: "Prism",
8412
+ hasLightMode: true,
8413
+ hasDarkMode: true
8414
+ },
8415
+ {
8416
+ name: "gazette",
8417
+ displayName: "Gazette",
8418
+ hasLightMode: true,
8419
+ hasDarkMode: true
8420
+ },
8421
+ {
8422
+ name: "terminal",
8423
+ displayName: "Terminal",
8424
+ hasLightMode: true,
8425
+ hasDarkMode: true
8426
+ },
8427
+ {
8428
+ name: "atelier",
8429
+ displayName: "Atelier",
8430
+ hasLightMode: true,
8431
+ hasDarkMode: true
8432
+ },
8433
+ {
8434
+ name: "kiosk",
8435
+ displayName: "Kiosk",
8436
+ hasLightMode: true,
8437
+ hasDarkMode: true
8438
+ },
8439
+ {
8440
+ name: "linear-clean",
8441
+ displayName: "Linear Clean",
8442
+ hasLightMode: true,
8443
+ hasDarkMode: true
8444
+ },
8445
+ {
8446
+ name: "notion-editorial",
8447
+ displayName: "Notion Editorial",
8448
+ hasLightMode: true,
8449
+ hasDarkMode: true
8450
+ },
8451
+ {
8452
+ name: "bloomberg-dense",
8453
+ displayName: "Bloomberg Dense",
8454
+ hasLightMode: true,
8455
+ hasDarkMode: true
8456
+ }
8457
+ ];
8458
+ ThemeContext = createContext(void 0);
8459
+ }
8460
+ });
9137
8461
  var sizeClasses5, iconSizes2, ThemeToggle;
9138
8462
  var init_ThemeToggle = __esm({
9139
8463
  "components/core/atoms/ThemeToggle.tsx"() {
@@ -9235,7 +8559,7 @@ var Aside;
9235
8559
  var init_Aside = __esm({
9236
8560
  "components/core/atoms/Aside.tsx"() {
9237
8561
  init_cn();
9238
- Aside = React97__default.forwardRef(
8562
+ Aside = React93__default.forwardRef(
9239
8563
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
9240
8564
  );
9241
8565
  Aside.displayName = "Aside";
@@ -9313,8 +8637,8 @@ var init_LawReferenceTooltip = __esm({
9313
8637
  className
9314
8638
  }) => {
9315
8639
  const { t } = useTranslate();
9316
- const [isVisible, setIsVisible] = React97__default.useState(false);
9317
- const timeoutRef = React97__default.useRef(null);
8640
+ const [isVisible, setIsVisible] = React93__default.useState(false);
8641
+ const timeoutRef = React93__default.useRef(null);
9318
8642
  const handleMouseEnter = () => {
9319
8643
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
9320
8644
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -9323,7 +8647,7 @@ var init_LawReferenceTooltip = __esm({
9323
8647
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
9324
8648
  setIsVisible(false);
9325
8649
  };
9326
- React97__default.useEffect(() => {
8650
+ React93__default.useEffect(() => {
9327
8651
  return () => {
9328
8652
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
9329
8653
  };
@@ -9533,7 +8857,7 @@ var init_StatusDot = __esm({
9533
8857
  md: "w-2.5 h-2.5",
9534
8858
  lg: "w-3 h-3"
9535
8859
  };
9536
- StatusDot = React97__default.forwardRef(
8860
+ StatusDot = React93__default.forwardRef(
9537
8861
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
9538
8862
  return /* @__PURE__ */ jsx(
9539
8863
  "span",
@@ -9587,7 +8911,7 @@ var init_TrendIndicator = __esm({
9587
8911
  down: "trending-down",
9588
8912
  flat: "arrow-right"
9589
8913
  };
9590
- TrendIndicator = React97__default.forwardRef(
8914
+ TrendIndicator = React93__default.forwardRef(
9591
8915
  ({
9592
8916
  className,
9593
8917
  value,
@@ -9654,7 +8978,7 @@ var init_RangeSlider = __esm({
9654
8978
  md: "w-4 h-4",
9655
8979
  lg: "w-5 h-5"
9656
8980
  };
9657
- RangeSlider = React97__default.forwardRef(
8981
+ RangeSlider = React93__default.forwardRef(
9658
8982
  ({
9659
8983
  className,
9660
8984
  min = 0,
@@ -10162,7 +9486,7 @@ var init_ContentSection = __esm({
10162
9486
  md: "py-16",
10163
9487
  lg: "py-24"
10164
9488
  };
10165
- ContentSection = React97__default.forwardRef(
9489
+ ContentSection = React93__default.forwardRef(
10166
9490
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
10167
9491
  return /* @__PURE__ */ jsx(
10168
9492
  Box,
@@ -10696,7 +10020,7 @@ var init_AnimatedReveal = __esm({
10696
10020
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
10697
10021
  "none": {}
10698
10022
  };
10699
- AnimatedReveal = React97__default.forwardRef(
10023
+ AnimatedReveal = React93__default.forwardRef(
10700
10024
  ({
10701
10025
  trigger = "scroll",
10702
10026
  animation = "fade-up",
@@ -10856,7 +10180,7 @@ var init_AnimatedGraphic = __esm({
10856
10180
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10857
10181
  "use client";
10858
10182
  init_cn();
10859
- AnimatedGraphic = React97__default.forwardRef(
10183
+ AnimatedGraphic = React93__default.forwardRef(
10860
10184
  ({
10861
10185
  src,
10862
10186
  svgContent,
@@ -10879,7 +10203,7 @@ var init_AnimatedGraphic = __esm({
10879
10203
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10880
10204
  const resolvedSvg = svgContent ?? fetchedSvg;
10881
10205
  const prevAnimateRef = useRef(animate);
10882
- const setRef = React97__default.useCallback(
10206
+ const setRef = React93__default.useCallback(
10883
10207
  (node) => {
10884
10208
  containerRef.current = node;
10885
10209
  if (typeof ref === "function") ref(node);
@@ -11015,8 +10339,6 @@ function getSlotContentRenderer() {
11015
10339
  var _slotContentRenderer;
11016
10340
  var init_TraitFrame = __esm({
11017
10341
  "components/core/atoms/TraitFrame.tsx"() {
11018
- init_UISlotContext();
11019
- init_TraitScopeProvider();
11020
10342
  init_EntitySchemaContext();
11021
10343
  TraitFrame.displayName = "TraitFrame";
11022
10344
  _slotContentRenderer = null;
@@ -11106,9 +10428,9 @@ function ScoreDisplay({
11106
10428
  ...rest
11107
10429
  }) {
11108
10430
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
11109
- const [displayValue, setDisplayValue] = React97.useState(resolvedValue);
11110
- const [isAnimating, setIsAnimating] = React97.useState(false);
11111
- React97.useEffect(() => {
10431
+ const [displayValue, setDisplayValue] = React93.useState(resolvedValue);
10432
+ const [isAnimating, setIsAnimating] = React93.useState(false);
10433
+ React93.useEffect(() => {
11112
10434
  if (!animated || displayValue === resolvedValue) {
11113
10435
  setDisplayValue(resolvedValue);
11114
10436
  return;
@@ -11178,9 +10500,9 @@ function ControlButton({
11178
10500
  className
11179
10501
  }) {
11180
10502
  const eventBus = useEventBus();
11181
- const [isPressed, setIsPressed] = React97.useState(false);
10503
+ const [isPressed, setIsPressed] = React93.useState(false);
11182
10504
  const actualPressed = pressed ?? isPressed;
11183
- const handlePointerDown = React97.useCallback(
10505
+ const handlePointerDown = React93.useCallback(
11184
10506
  (e) => {
11185
10507
  e.preventDefault();
11186
10508
  if (disabled) return;
@@ -11190,7 +10512,7 @@ function ControlButton({
11190
10512
  },
11191
10513
  [disabled, pressEvent, eventBus, onPress]
11192
10514
  );
11193
- const handlePointerUp = React97.useCallback(
10515
+ const handlePointerUp = React93.useCallback(
11194
10516
  (e) => {
11195
10517
  e.preventDefault();
11196
10518
  if (disabled) return;
@@ -11200,7 +10522,7 @@ function ControlButton({
11200
10522
  },
11201
10523
  [disabled, releaseEvent, eventBus, onRelease]
11202
10524
  );
11203
- const handlePointerLeave = React97.useCallback(
10525
+ const handlePointerLeave = React93.useCallback(
11204
10526
  (e) => {
11205
10527
  if (isPressed) {
11206
10528
  setIsPressed(false);
@@ -12106,9 +11428,9 @@ function MiniMap({
12106
11428
  viewportRect,
12107
11429
  className
12108
11430
  }) {
12109
- const canvasRef = React97.useRef(null);
12110
- const frameRef = React97.useRef(0);
12111
- React97.useEffect(() => {
11431
+ const canvasRef = React93.useRef(null);
11432
+ const frameRef = React93.useRef(0);
11433
+ React93.useEffect(() => {
12112
11434
  const canvas = canvasRef.current;
12113
11435
  if (!canvas) return;
12114
11436
  const ctx = canvas.getContext("2d");
@@ -12282,7 +11604,7 @@ var init_ErrorBoundary = __esm({
12282
11604
  }
12283
11605
  );
12284
11606
  };
12285
- ErrorBoundary = class extends React97__default.Component {
11607
+ ErrorBoundary = class extends React93__default.Component {
12286
11608
  constructor(props) {
12287
11609
  super(props);
12288
11610
  __publicField(this, "reset", () => {
@@ -13348,8 +12670,8 @@ var init_Tooltip = __esm({
13348
12670
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
13349
12671
  };
13350
12672
  }, []);
13351
- const triggerElement = React97__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
13352
- const trigger = React97__default.cloneElement(triggerElement, {
12673
+ const triggerElement = React93__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12674
+ const trigger = React93__default.cloneElement(triggerElement, {
13353
12675
  ref: triggerRef,
13354
12676
  onMouseEnter: handleMouseEnter,
13355
12677
  onMouseLeave: handleMouseLeave,
@@ -13504,8 +12826,8 @@ var init_Popover = __esm({
13504
12826
  onMouseEnter: handleOpen,
13505
12827
  onMouseLeave: handleClose
13506
12828
  };
13507
- const childElement = React97__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
13508
- const triggerElement = React97__default.cloneElement(
12829
+ const childElement = React93__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12830
+ const triggerElement = React93__default.cloneElement(
13509
12831
  childElement,
13510
12832
  {
13511
12833
  ref: triggerRef,
@@ -13632,8 +12954,8 @@ var init_Menu = __esm({
13632
12954
  };
13633
12955
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
13634
12956
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
13635
- const triggerChild = React97__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
13636
- const triggerElement = React97__default.cloneElement(
12957
+ const triggerChild = React93__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
12958
+ const triggerElement = React93__default.cloneElement(
13637
12959
  triggerChild,
13638
12960
  {
13639
12961
  ref: triggerRef,
@@ -14040,13 +13362,13 @@ var init_MapView = __esm({
14040
13362
  shadowSize: [41, 41]
14041
13363
  });
14042
13364
  L.Marker.prototype.options.icon = defaultIcon;
14043
- const { useEffect: useEffect79, useRef: useRef71, useCallback: useCallback123, useState: useState113 } = React97__default;
13365
+ const { useEffect: useEffect75, useRef: useRef68, useCallback: useCallback120, useState: useState111 } = React93__default;
14044
13366
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
14045
13367
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
14046
13368
  function MapUpdater({ centerLat, centerLng, zoom }) {
14047
13369
  const map = useMap();
14048
- const prevRef = useRef71({ centerLat, centerLng, zoom });
14049
- useEffect79(() => {
13370
+ const prevRef = useRef68({ centerLat, centerLng, zoom });
13371
+ useEffect75(() => {
14050
13372
  const prev = prevRef.current;
14051
13373
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
14052
13374
  map.setView([centerLat, centerLng], zoom);
@@ -14057,7 +13379,7 @@ var init_MapView = __esm({
14057
13379
  }
14058
13380
  function MapClickHandler({ onMapClick }) {
14059
13381
  const map = useMap();
14060
- useEffect79(() => {
13382
+ useEffect75(() => {
14061
13383
  if (!onMapClick) return;
14062
13384
  const handler = (e) => {
14063
13385
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -14085,8 +13407,8 @@ var init_MapView = __esm({
14085
13407
  showAttribution = true
14086
13408
  }) {
14087
13409
  const eventBus = useEventBus3();
14088
- const [clickedPosition, setClickedPosition] = useState113(null);
14089
- const handleMapClick = useCallback123((lat, lng) => {
13410
+ const [clickedPosition, setClickedPosition] = useState111(null);
13411
+ const handleMapClick = useCallback120((lat, lng) => {
14090
13412
  if (showClickedPin) {
14091
13413
  setClickedPosition({ lat, lng });
14092
13414
  }
@@ -14095,7 +13417,7 @@ var init_MapView = __esm({
14095
13417
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
14096
13418
  }
14097
13419
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
14098
- const handleMarkerClick = useCallback123((marker) => {
13420
+ const handleMarkerClick = useCallback120((marker) => {
14099
13421
  onMarkerClick?.(marker);
14100
13422
  if (markerClickEvent) {
14101
13423
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -14286,7 +13608,7 @@ function InputPattern({
14286
13608
  fieldName
14287
13609
  }) {
14288
13610
  const { emit } = useEventBus();
14289
- const [localValue, setLocalValue] = React97__default.useState(value);
13611
+ const [localValue, setLocalValue] = React93__default.useState(value);
14290
13612
  const handleChange = (e) => {
14291
13613
  setLocalValue(e.target.value);
14292
13614
  if (onChange) {
@@ -14324,7 +13646,7 @@ function TextareaPattern({
14324
13646
  fieldName
14325
13647
  }) {
14326
13648
  const { emit } = useEventBus();
14327
- const [localValue, setLocalValue] = React97__default.useState(value);
13649
+ const [localValue, setLocalValue] = React93__default.useState(value);
14328
13650
  const handleChange = (e) => {
14329
13651
  setLocalValue(e.target.value);
14330
13652
  if (onChange) {
@@ -14356,7 +13678,7 @@ function SelectPattern({
14356
13678
  fieldName
14357
13679
  }) {
14358
13680
  const { emit } = useEventBus();
14359
- const [localValue, setLocalValue] = React97__default.useState(value);
13681
+ const [localValue, setLocalValue] = React93__default.useState(value);
14360
13682
  const handleChange = (e) => {
14361
13683
  setLocalValue(e.target.value);
14362
13684
  if (onChange) {
@@ -14385,7 +13707,7 @@ function CheckboxPattern({
14385
13707
  className
14386
13708
  }) {
14387
13709
  const { emit } = useEventBus();
14388
- const [localChecked, setLocalChecked] = React97__default.useState(checked);
13710
+ const [localChecked, setLocalChecked] = React93__default.useState(checked);
14389
13711
  const handleChange = (e) => {
14390
13712
  setLocalChecked(e.target.checked);
14391
13713
  if (onChange) {
@@ -14616,8 +13938,8 @@ function ActionButtons({
14616
13938
  disabled
14617
13939
  }) {
14618
13940
  const eventBus = useEventBus();
14619
- const [activeButtons, setActiveButtons] = React97.useState(/* @__PURE__ */ new Set());
14620
- const handlePress = React97.useCallback(
13941
+ const [activeButtons, setActiveButtons] = React93.useState(/* @__PURE__ */ new Set());
13942
+ const handlePress = React93.useCallback(
14621
13943
  (id) => {
14622
13944
  setActiveButtons((prev) => new Set(prev).add(id));
14623
13945
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -14625,7 +13947,7 @@ function ActionButtons({
14625
13947
  },
14626
13948
  [actionEvent, eventBus, onAction]
14627
13949
  );
14628
- const handleRelease = React97.useCallback(
13950
+ const handleRelease = React93.useCallback(
14629
13951
  (id) => {
14630
13952
  setActiveButtons((prev) => {
14631
13953
  const next = new Set(prev);
@@ -15129,7 +14451,7 @@ function recordTransition(trace) {
15129
14451
  ...trace,
15130
14452
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
15131
14453
  };
15132
- log7.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
14454
+ log5.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
15133
14455
  getState().transitions.push(entry);
15134
14456
  if (getState().transitions.length > MAX_TRANSITIONS) {
15135
14457
  getState().transitions.shift();
@@ -15228,7 +14550,7 @@ function getTraitSnapshots() {
15228
14550
  try {
15229
14551
  snapshots.push(getter());
15230
14552
  } catch (err) {
15231
- log7.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
14553
+ log5.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
15232
14554
  }
15233
14555
  }
15234
14556
  return snapshots;
@@ -15289,38 +14611,6 @@ function waitForTransition(event, timeoutMs = 1e4) {
15289
14611
  });
15290
14612
  });
15291
14613
  }
15292
- function bindEventBus(eventBus) {
15293
- if (typeof window === "undefined") return;
15294
- log7.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
15295
- exposeOnWindow();
15296
- if (window.__orbitalVerification) {
15297
- window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
15298
- const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
15299
- log7.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
15300
- eventBus.emit(prefixed, payload);
15301
- };
15302
- const eventLog = [];
15303
- window.__orbitalVerification.eventLog = eventLog;
15304
- window.__orbitalVerification.clearEventLog = () => {
15305
- eventLog.length = 0;
15306
- };
15307
- if (eventBus.onAny) {
15308
- const verificationRegistryEventLogger = (event) => {
15309
- if (eventLog.length < 200) {
15310
- eventLog.push({
15311
- type: event.type,
15312
- payload: event.payload,
15313
- timestamp: Date.now()
15314
- });
15315
- }
15316
- };
15317
- Object.defineProperty(verificationRegistryEventLogger, "name", {
15318
- value: "verificationRegistry:eventLog"
15319
- });
15320
- eventBus.onAny(verificationRegistryEventLogger);
15321
- }
15322
- }
15323
- }
15324
14614
  function bindTraitStateGetter(getter) {
15325
14615
  if (typeof window === "undefined") return;
15326
14616
  exposeOnWindow();
@@ -15359,10 +14649,10 @@ function updateAssetStatus(url, status) {
15359
14649
  window.__orbitalVerification.assetStatus[url] = status;
15360
14650
  }
15361
14651
  }
15362
- var log7, MAX_TRANSITIONS;
14652
+ var log5, MAX_TRANSITIONS;
15363
14653
  var init_verificationRegistry = __esm({
15364
14654
  "lib/verificationRegistry.ts"() {
15365
- log7 = createLogger("almadar:bridge");
14655
+ log5 = createLogger("almadar:bridge");
15366
14656
  MAX_TRANSITIONS = 500;
15367
14657
  exposeOnWindow();
15368
14658
  }
@@ -16855,7 +16145,7 @@ function computeFoldRegions(code) {
16855
16145
  }
16856
16146
  return regions.sort((a, b) => a.start - b.start);
16857
16147
  }
16858
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16148
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log6, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16859
16149
  var init_CodeBlock = __esm({
16860
16150
  "components/core/molecules/markdown/CodeBlock.tsx"() {
16861
16151
  init_Box();
@@ -16932,10 +16222,10 @@ var init_CodeBlock = __esm({
16932
16222
  "lolo-op-async": { color: ORB_COLORS.dark.async }
16933
16223
  };
16934
16224
  loloStyle = { ...dark, ...loloStyleOverrides };
16935
- log8 = createLogger("almadar:ui:markdown-code");
16225
+ log6 = createLogger("almadar:ui:markdown-code");
16936
16226
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16937
16227
  HIDDEN_LINE_NUMBERS = { display: "none" };
16938
- CodeBlock = React97__default.memo(
16228
+ CodeBlock = React93__default.memo(
16939
16229
  ({
16940
16230
  code: rawCode,
16941
16231
  language = "text",
@@ -17133,7 +16423,7 @@ var init_CodeBlock = __esm({
17133
16423
  eventBus.emit("UI:COPY_CODE", { language, success: true });
17134
16424
  setTimeout(() => setCopied(false), 2e3);
17135
16425
  } catch (err) {
17136
- log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
16426
+ log6.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
17137
16427
  eventBus.emit("UI:COPY_CODE", { language, success: false });
17138
16428
  }
17139
16429
  };
@@ -17372,7 +16662,7 @@ var init_MarkdownContent = __esm({
17372
16662
  init_Box();
17373
16663
  init_CodeBlock();
17374
16664
  init_cn();
17375
- MarkdownContent = React97__default.memo(
16665
+ MarkdownContent = React93__default.memo(
17376
16666
  ({ content, direction, className }) => {
17377
16667
  const { t: _t } = useTranslate();
17378
16668
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -18468,7 +17758,7 @@ var init_StateMachineView = __esm({
18468
17758
  style: { top: title ? 30 : 0 },
18469
17759
  children: [
18470
17760
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
18471
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React97__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
17761
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React93__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18472
17762
  StateNode,
18473
17763
  {
18474
17764
  state,
@@ -20073,7 +19363,7 @@ var init_Grid = __esm({
20073
19363
  as: Component = "div"
20074
19364
  }) => {
20075
19365
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
20076
- return React97__default.createElement(
19366
+ return React93__default.createElement(
20077
19367
  Component,
20078
19368
  {
20079
19369
  className: cn(
@@ -20954,14 +20244,14 @@ function useSafeEventBus2() {
20954
20244
  } };
20955
20245
  }
20956
20246
  }
20957
- var log9, lookStyles4, ButtonGroup;
20247
+ var log7, lookStyles4, ButtonGroup;
20958
20248
  var init_ButtonGroup = __esm({
20959
20249
  "components/core/molecules/ButtonGroup.tsx"() {
20960
20250
  "use client";
20961
20251
  init_cn();
20962
20252
  init_atoms2();
20963
20253
  init_useEventBus();
20964
- log9 = createLogger("almadar:ui:button-group");
20254
+ log7 = createLogger("almadar:ui:button-group");
20965
20255
  lookStyles4 = {
20966
20256
  "right-aligned-buttons": "",
20967
20257
  "floating-bar": "fixed bottom-section left-1/2 -translate-x-1/2 shadow-elevation-toast bg-card p-card-sm rounded-container",
@@ -21042,7 +20332,7 @@ var init_ButtonGroup = __esm({
21042
20332
  {
21043
20333
  variant: "ghost",
21044
20334
  onClick: () => {
21045
- log9.debug("Filter clicked", { field: filter.field });
20335
+ log7.debug("Filter clicked", { field: filter.field });
21046
20336
  },
21047
20337
  children: filter.label
21048
20338
  },
@@ -25433,7 +24723,7 @@ function CraftingRecipe({
25433
24723
  className
25434
24724
  }) {
25435
24725
  const eventBus = useEventBus();
25436
- const handleCraft = React97.useCallback(() => {
24726
+ const handleCraft = React93.useCallback(() => {
25437
24727
  onCraft?.();
25438
24728
  if (craftEvent) {
25439
24729
  eventBus.emit(craftEvent, { output: output.label });
@@ -25450,7 +24740,7 @@ function CraftingRecipe({
25450
24740
  children: [
25451
24741
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
25452
24742
  const hasSufficient = ingredient.available >= ingredient.required;
25453
- return /* @__PURE__ */ jsxs(React97.Fragment, { children: [
24743
+ return /* @__PURE__ */ jsxs(React93.Fragment, { children: [
25454
24744
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
25455
24745
  ItemSlot,
25456
24746
  {
@@ -25513,8 +24803,8 @@ function DPad({
25513
24803
  }) {
25514
24804
  const eventBus = useEventBus();
25515
24805
  const sizes = sizeMap15[size];
25516
- const [activeDirections, setActiveDirections] = React97.useState(/* @__PURE__ */ new Set());
25517
- const handlePress = React97.useCallback(
24806
+ const [activeDirections, setActiveDirections] = React93.useState(/* @__PURE__ */ new Set());
24807
+ const handlePress = React93.useCallback(
25518
24808
  (direction) => {
25519
24809
  setActiveDirections((prev) => new Set(prev).add(direction));
25520
24810
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -25522,7 +24812,7 @@ function DPad({
25522
24812
  },
25523
24813
  [directionEvent, eventBus, onDirection]
25524
24814
  );
25525
- const handleRelease = React97.useCallback(
24815
+ const handleRelease = React93.useCallback(
25526
24816
  (direction) => {
25527
24817
  setActiveDirections((prev) => {
25528
24818
  const next = new Set(prev);
@@ -26208,14 +25498,14 @@ function useDataDnd(args) {
26208
25498
  const isZone = Boolean(dragGroup || accepts || sortable);
26209
25499
  const enabled = isZone || Boolean(dndRoot);
26210
25500
  const eventBus = useEventBus();
26211
- const parentRoot = React97__default.useContext(RootCtx);
25501
+ const parentRoot = React93__default.useContext(RootCtx);
26212
25502
  const isRoot = enabled && parentRoot === null;
26213
- const zoneId = React97__default.useId();
25503
+ const zoneId = React93__default.useId();
26214
25504
  const ownGroup = dragGroup ?? accepts ?? zoneId;
26215
- const [optimisticOrders, setOptimisticOrders] = React97__default.useState(() => /* @__PURE__ */ new Map());
26216
- const optimisticOrdersRef = React97__default.useRef(optimisticOrders);
25505
+ const [optimisticOrders, setOptimisticOrders] = React93__default.useState(() => /* @__PURE__ */ new Map());
25506
+ const optimisticOrdersRef = React93__default.useRef(optimisticOrders);
26217
25507
  optimisticOrdersRef.current = optimisticOrders;
26218
- const clearOptimisticOrder = React97__default.useCallback((group) => {
25508
+ const clearOptimisticOrder = React93__default.useCallback((group) => {
26219
25509
  setOptimisticOrders((prev) => {
26220
25510
  if (!prev.has(group)) return prev;
26221
25511
  const next = new Map(prev);
@@ -26240,7 +25530,7 @@ function useDataDnd(args) {
26240
25530
  const raw = it[dndItemIdField];
26241
25531
  return String(raw ?? `__idx_${idx}`);
26242
25532
  }).join("|");
26243
- const itemIds = React97__default.useMemo(
25533
+ const itemIds = React93__default.useMemo(
26244
25534
  () => orderedItems.map((it, idx) => {
26245
25535
  const raw = it[dndItemIdField];
26246
25536
  return raw ?? `__idx_${idx}`;
@@ -26248,7 +25538,7 @@ function useDataDnd(args) {
26248
25538
  [itemIdsSignature]
26249
25539
  );
26250
25540
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
26251
- React97__default.useEffect(() => {
25541
+ React93__default.useEffect(() => {
26252
25542
  const root = isRoot ? null : parentRoot;
26253
25543
  if (root) {
26254
25544
  root.clearOptimisticOrder(ownGroup);
@@ -26256,20 +25546,20 @@ function useDataDnd(args) {
26256
25546
  clearOptimisticOrder(ownGroup);
26257
25547
  }
26258
25548
  }, [itemsContentSig, ownGroup]);
26259
- const zonesRef = React97__default.useRef(/* @__PURE__ */ new Map());
26260
- const registerZone = React97__default.useCallback((zoneId2, meta2) => {
25549
+ const zonesRef = React93__default.useRef(/* @__PURE__ */ new Map());
25550
+ const registerZone = React93__default.useCallback((zoneId2, meta2) => {
26261
25551
  zonesRef.current.set(zoneId2, meta2);
26262
25552
  }, []);
26263
- const unregisterZone = React97__default.useCallback((zoneId2) => {
25553
+ const unregisterZone = React93__default.useCallback((zoneId2) => {
26264
25554
  zonesRef.current.delete(zoneId2);
26265
25555
  }, []);
26266
- const [activeDrag, setActiveDrag] = React97__default.useState(null);
26267
- const [overZoneGroup, setOverZoneGroup] = React97__default.useState(null);
26268
- const meta = React97__default.useMemo(
25556
+ const [activeDrag, setActiveDrag] = React93__default.useState(null);
25557
+ const [overZoneGroup, setOverZoneGroup] = React93__default.useState(null);
25558
+ const meta = React93__default.useMemo(
26269
25559
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
26270
25560
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
26271
25561
  );
26272
- React97__default.useEffect(() => {
25562
+ React93__default.useEffect(() => {
26273
25563
  const target = isRoot ? null : parentRoot;
26274
25564
  if (!target) {
26275
25565
  zonesRef.current.set(zoneId, meta);
@@ -26288,7 +25578,7 @@ function useDataDnd(args) {
26288
25578
  }, [parentRoot, isRoot, zoneId, meta]);
26289
25579
  const sensors = useAlmadarDndSensors(true);
26290
25580
  const collisionDetection = almadarDndCollisionDetection;
26291
- const findZoneByItem = React97__default.useCallback(
25581
+ const findZoneByItem = React93__default.useCallback(
26292
25582
  (id) => {
26293
25583
  for (const z of zonesRef.current.values()) {
26294
25584
  if (z.itemIds.includes(id)) return z;
@@ -26297,7 +25587,7 @@ function useDataDnd(args) {
26297
25587
  },
26298
25588
  []
26299
25589
  );
26300
- React97__default.useCallback(
25590
+ React93__default.useCallback(
26301
25591
  (group) => {
26302
25592
  for (const z of zonesRef.current.values()) {
26303
25593
  if (z.group === group) return z;
@@ -26306,7 +25596,7 @@ function useDataDnd(args) {
26306
25596
  },
26307
25597
  []
26308
25598
  );
26309
- const handleDragEnd = React97__default.useCallback(
25599
+ const handleDragEnd = React93__default.useCallback(
26310
25600
  (event) => {
26311
25601
  const { active, over } = event;
26312
25602
  const activeIdStr = String(active.id);
@@ -26397,8 +25687,8 @@ function useDataDnd(args) {
26397
25687
  },
26398
25688
  [eventBus]
26399
25689
  );
26400
- const sortableData = React97__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
26401
- const SortableItem = React97__default.useCallback(
25690
+ const sortableData = React93__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25691
+ const SortableItem = React93__default.useCallback(
26402
25692
  ({ id, children }) => {
26403
25693
  const {
26404
25694
  attributes,
@@ -26438,7 +25728,7 @@ function useDataDnd(args) {
26438
25728
  id: droppableId,
26439
25729
  data: sortableData
26440
25730
  });
26441
- const ctx = React97__default.useContext(RootCtx);
25731
+ const ctx = React93__default.useContext(RootCtx);
26442
25732
  const activeDrag2 = ctx?.activeDrag ?? null;
26443
25733
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
26444
25734
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -26453,7 +25743,7 @@ function useDataDnd(args) {
26453
25743
  showForeignPlaceholder,
26454
25744
  ctxAvailable: ctx != null
26455
25745
  });
26456
- React97__default.useEffect(() => {
25746
+ React93__default.useEffect(() => {
26457
25747
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
26458
25748
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
26459
25749
  return /* @__PURE__ */ jsx(
@@ -26467,11 +25757,11 @@ function useDataDnd(args) {
26467
25757
  }
26468
25758
  );
26469
25759
  };
26470
- const rootContextValue = React97__default.useMemo(
25760
+ const rootContextValue = React93__default.useMemo(
26471
25761
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
26472
25762
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
26473
25763
  );
26474
- const handleDragStart = React97__default.useCallback((event) => {
25764
+ const handleDragStart = React93__default.useCallback((event) => {
26475
25765
  const sourceZone = findZoneByItem(event.active.id);
26476
25766
  const rect = event.active.rect.current.initial;
26477
25767
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -26490,7 +25780,7 @@ function useDataDnd(args) {
26490
25780
  isRoot
26491
25781
  });
26492
25782
  }, [findZoneByItem, isRoot, zoneId]);
26493
- const handleDragOver = React97__default.useCallback((event) => {
25783
+ const handleDragOver = React93__default.useCallback((event) => {
26494
25784
  const { active, over } = event;
26495
25785
  const overData = over?.data?.current;
26496
25786
  const overGroup = overData?.dndGroup ?? null;
@@ -26560,7 +25850,7 @@ function useDataDnd(args) {
26560
25850
  return next;
26561
25851
  });
26562
25852
  }, []);
26563
- const handleDragCancel = React97__default.useCallback((event) => {
25853
+ const handleDragCancel = React93__default.useCallback((event) => {
26564
25854
  setActiveDrag(null);
26565
25855
  setOverZoneGroup(null);
26566
25856
  dndLog.warn("dragCancel", {
@@ -26568,12 +25858,12 @@ function useDataDnd(args) {
26568
25858
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
26569
25859
  });
26570
25860
  }, []);
26571
- const handleDragEndWithCleanup = React97__default.useCallback((event) => {
25861
+ const handleDragEndWithCleanup = React93__default.useCallback((event) => {
26572
25862
  handleDragEnd(event);
26573
25863
  setActiveDrag(null);
26574
25864
  setOverZoneGroup(null);
26575
25865
  }, [handleDragEnd]);
26576
- const wrapContainer = React97__default.useCallback(
25866
+ const wrapContainer = React93__default.useCallback(
26577
25867
  (children) => {
26578
25868
  if (!enabled) return children;
26579
25869
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -26627,7 +25917,7 @@ var init_useDataDnd = __esm({
26627
25917
  init_useAlmadarDndCollision();
26628
25918
  init_Box();
26629
25919
  dndLog = createLogger("almadar:ui:dnd");
26630
- RootCtx = React97__default.createContext(null);
25920
+ RootCtx = React93__default.createContext(null);
26631
25921
  }
26632
25922
  });
26633
25923
  function fieldLabel2(key) {
@@ -27147,7 +26437,7 @@ function DataList({
27147
26437
  }) {
27148
26438
  const eventBus = useEventBus();
27149
26439
  const { t } = useTranslate();
27150
- const [visibleCount, setVisibleCount] = React97__default.useState(pageSize || Infinity);
26440
+ const [visibleCount, setVisibleCount] = React93__default.useState(pageSize || Infinity);
27151
26441
  const fieldDefs = fields ?? columns ?? [];
27152
26442
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
27153
26443
  const dnd = useDataDnd({
@@ -27166,7 +26456,7 @@ function DataList({
27166
26456
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
27167
26457
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
27168
26458
  const hasRenderProp = typeof children === "function";
27169
- React97__default.useEffect(() => {
26459
+ React93__default.useEffect(() => {
27170
26460
  const renderItemTypeOf = typeof schemaRenderItem;
27171
26461
  const childrenTypeOf = typeof children;
27172
26462
  if (data.length > 0 && !hasRenderProp) {
@@ -27271,7 +26561,7 @@ function DataList({
27271
26561
  const items2 = data.map((item) => item);
27272
26562
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
27273
26563
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
27274
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
26564
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
27275
26565
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
27276
26566
  group.items.map((itemData, index) => {
27277
26567
  const id = itemData.id || `${gi}-${index}`;
@@ -27419,7 +26709,7 @@ function DataList({
27419
26709
  className
27420
26710
  ),
27421
26711
  children: [
27422
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
26712
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
27423
26713
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
27424
26714
  group.items.map(
27425
26715
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -28307,9 +27597,9 @@ function debug(...args) {
28307
27597
  const [first, ...rest] = args;
28308
27598
  const message = typeof first === "string" ? first : "<debug>";
28309
27599
  if (rest.length === 0 && typeof first === "string") {
28310
- log10.debug(message);
27600
+ log8.debug(message);
28311
27601
  } else {
28312
- log10.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
27602
+ log8.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
28313
27603
  }
28314
27604
  }
28315
27605
  function debugGroup(label) {
@@ -28337,11 +27627,11 @@ function toLogMetaValue(v) {
28337
27627
  }
28338
27628
  return String(v);
28339
27629
  }
28340
- var NAMESPACE, log10;
27630
+ var NAMESPACE, log8;
28341
27631
  var init_debug = __esm({
28342
27632
  "lib/debug.ts"() {
28343
27633
  NAMESPACE = "almadar:ui:debug";
28344
- log10 = createLogger(NAMESPACE);
27634
+ log8 = createLogger(NAMESPACE);
28345
27635
  createLogger("almadar:ui:debug:input");
28346
27636
  createLogger("almadar:ui:debug:collision");
28347
27637
  createLogger("almadar:ui:debug:physics");
@@ -28793,7 +28083,7 @@ var init_WizardProgress = __esm({
28793
28083
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
28794
28084
  const isActive = index === currentStep;
28795
28085
  const isCompleted = index < currentStep;
28796
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
28086
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
28797
28087
  /* @__PURE__ */ jsx(
28798
28088
  "button",
28799
28089
  {
@@ -29848,7 +29138,7 @@ function InventoryGrid({
29848
29138
  const eventBus = useEventBus();
29849
29139
  const slotCount = totalSlots ?? items.length;
29850
29140
  const emptySlotCount = Math.max(0, slotCount - items.length);
29851
- const handleSelect = React97.useCallback(
29141
+ const handleSelect = React93.useCallback(
29852
29142
  (id) => {
29853
29143
  onSelect?.(id);
29854
29144
  if (selectEvent) {
@@ -30065,31 +29355,31 @@ function GameCanvas2D({
30065
29355
  assetBaseUrl = "",
30066
29356
  className
30067
29357
  }) {
30068
- const canvasRef = React97.useRef(null);
30069
- const rafRef = React97.useRef(0);
30070
- const frameRef = React97.useRef(0);
30071
- const lastTimeRef = React97.useRef(0);
30072
- const imageCache = React97.useRef(/* @__PURE__ */ new Map());
29358
+ const canvasRef = React93.useRef(null);
29359
+ const rafRef = React93.useRef(0);
29360
+ const frameRef = React93.useRef(0);
29361
+ const lastTimeRef = React93.useRef(0);
29362
+ const imageCache = React93.useRef(/* @__PURE__ */ new Map());
30073
29363
  const emit = useEmitEvent();
30074
- const onDrawRef = React97.useRef(onDraw);
29364
+ const onDrawRef = React93.useRef(onDraw);
30075
29365
  onDrawRef.current = onDraw;
30076
- const onTickRef = React97.useRef(onTick);
29366
+ const onTickRef = React93.useRef(onTick);
30077
29367
  onTickRef.current = onTick;
30078
- const tickEventRef = React97.useRef(tickEvent);
29368
+ const tickEventRef = React93.useRef(tickEvent);
30079
29369
  tickEventRef.current = tickEvent;
30080
- const drawEventRef = React97.useRef(drawEvent);
29370
+ const drawEventRef = React93.useRef(drawEvent);
30081
29371
  drawEventRef.current = drawEvent;
30082
- const emitRef = React97.useRef(emit);
29372
+ const emitRef = React93.useRef(emit);
30083
29373
  emitRef.current = emit;
30084
- const assetBaseUrlRef = React97.useRef(assetBaseUrl);
29374
+ const assetBaseUrlRef = React93.useRef(assetBaseUrl);
30085
29375
  assetBaseUrlRef.current = assetBaseUrl;
30086
- const backgroundImageRef = React97.useRef(backgroundImage);
29376
+ const backgroundImageRef = React93.useRef(backgroundImage);
30087
29377
  backgroundImageRef.current = backgroundImage;
30088
- const widthRef = React97.useRef(width);
29378
+ const widthRef = React93.useRef(width);
30089
29379
  widthRef.current = width;
30090
- const heightRef = React97.useRef(height);
29380
+ const heightRef = React93.useRef(height);
30091
29381
  heightRef.current = height;
30092
- const loadImage = React97.useCallback((url) => {
29382
+ const loadImage = React93.useCallback((url) => {
30093
29383
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
30094
29384
  const cached = imageCache.current.get(fullUrl);
30095
29385
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -30101,7 +29391,7 @@ function GameCanvas2D({
30101
29391
  }
30102
29392
  return null;
30103
29393
  }, []);
30104
- React97.useEffect(() => {
29394
+ React93.useEffect(() => {
30105
29395
  const canvas = canvasRef.current;
30106
29396
  if (!canvas) return;
30107
29397
  const ctx = canvas.getContext("2d");
@@ -30404,7 +29694,7 @@ function TurnPanel({
30404
29694
  className
30405
29695
  }) {
30406
29696
  const eventBus = useEventBus();
30407
- const handleAction = React97.useCallback(
29697
+ const handleAction = React93.useCallback(
30408
29698
  (event) => {
30409
29699
  if (event) {
30410
29700
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -30550,7 +29840,7 @@ function UnitCommandBar({
30550
29840
  className
30551
29841
  }) {
30552
29842
  const eventBus = useEventBus();
30553
- const handleCommand = React97.useCallback(
29843
+ const handleCommand = React93.useCallback(
30554
29844
  (event) => {
30555
29845
  if (event) {
30556
29846
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -31035,7 +30325,7 @@ function GameMenu({
31035
30325
  } catch {
31036
30326
  }
31037
30327
  const eventBus = eventBusProp || eventBusFromHook;
31038
- const handleOptionClick = React97.useCallback(
30328
+ const handleOptionClick = React93.useCallback(
31039
30329
  (option) => {
31040
30330
  if (option.event && eventBus) {
31041
30331
  eventBus.emit(`UI:${option.event}`, { option });
@@ -31149,7 +30439,7 @@ function GameOverScreen({
31149
30439
  } catch {
31150
30440
  }
31151
30441
  const eventBus = eventBusProp || eventBusFromHook;
31152
- const handleActionClick = React97.useCallback(
30442
+ const handleActionClick = React93.useCallback(
31153
30443
  (action) => {
31154
30444
  if (action.event && eventBus) {
31155
30445
  eventBus.emit(`UI:${action.event}`, { action });
@@ -32626,8 +31916,8 @@ function TableView({
32626
31916
  }) {
32627
31917
  const eventBus = useEventBus();
32628
31918
  const { t } = useTranslate();
32629
- const [visibleCount, setVisibleCount] = React97__default.useState(pageSize > 0 ? pageSize : Infinity);
32630
- const [localSelected, setLocalSelected] = React97__default.useState(/* @__PURE__ */ new Set());
31919
+ const [visibleCount, setVisibleCount] = React93__default.useState(pageSize > 0 ? pageSize : Infinity);
31920
+ const [localSelected, setLocalSelected] = React93__default.useState(/* @__PURE__ */ new Set());
32631
31921
  const colDefs = columns ?? fields ?? [];
32632
31922
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
32633
31923
  const dnd = useDataDnd({
@@ -32822,12 +32112,12 @@ function TableView({
32822
32112
  ]
32823
32113
  }
32824
32114
  );
32825
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React97__default.Fragment, { children: rowInner }, id);
32115
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React93__default.Fragment, { children: rowInner }, id);
32826
32116
  };
32827
32117
  const items = data.map((row) => row);
32828
32118
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
32829
32119
  let runningIndex = 0;
32830
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
32120
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
32831
32121
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
32832
32122
  group.items.map((row) => renderRow(row, runningIndex++))
32833
32123
  ] }, gi)) });
@@ -34179,7 +33469,7 @@ var init_StepFlow = __esm({
34179
33469
  className
34180
33470
  }) => {
34181
33471
  if (orientation === "vertical") {
34182
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React97__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
33472
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React93__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
34183
33473
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
34184
33474
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34185
33475
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -34190,7 +33480,7 @@ var init_StepFlow = __esm({
34190
33480
  ] })
34191
33481
  ] }) }, index)) });
34192
33482
  }
34193
- 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(React97__default.Fragment, { children: [
33483
+ 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(React93__default.Fragment, { children: [
34194
33484
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
34195
33485
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
34196
33486
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -35166,7 +34456,7 @@ var init_LikertScale = __esm({
35166
34456
  md: "text-base",
35167
34457
  lg: "text-lg"
35168
34458
  };
35169
- LikertScale = React97__default.forwardRef(
34459
+ LikertScale = React93__default.forwardRef(
35170
34460
  ({
35171
34461
  question,
35172
34462
  options = DEFAULT_LIKERT_OPTIONS,
@@ -35178,7 +34468,7 @@ var init_LikertScale = __esm({
35178
34468
  variant = "radios",
35179
34469
  className
35180
34470
  }, ref) => {
35181
- const groupId = React97__default.useId();
34471
+ const groupId = React93__default.useId();
35182
34472
  const eventBus = useEventBus();
35183
34473
  const handleSelect = useCallback(
35184
34474
  (next) => {
@@ -37483,7 +36773,7 @@ var init_DocBreadcrumb = __esm({
37483
36773
  "aria-label": t("aria.breadcrumb"),
37484
36774
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
37485
36775
  const isLast = idx === items.length - 1;
37486
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
36776
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
37487
36777
  idx > 0 && /* @__PURE__ */ jsx(
37488
36778
  Icon,
37489
36779
  {
@@ -38242,7 +37532,7 @@ var init_PageHeader = __esm({
38242
37532
  info: "bg-info/10 text-info"
38243
37533
  };
38244
37534
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
38245
- 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(React97__default.Fragment, { children: [
37535
+ 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(React93__default.Fragment, { children: [
38246
37536
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
38247
37537
  crumb.href ? /* @__PURE__ */ jsx(
38248
37538
  "a",
@@ -38979,7 +38269,7 @@ var init_WizardContainer = __esm({
38979
38269
  const isCompleted = index < currentStep;
38980
38270
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
38981
38271
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
38982
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
38272
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
38983
38273
  /* @__PURE__ */ jsx(
38984
38274
  Button,
38985
38275
  {
@@ -41264,7 +40554,7 @@ var init_DetailPanel = __esm({
41264
40554
  }
41265
40555
  });
41266
40556
  function extractTitle(children) {
41267
- if (!React97__default.isValidElement(children)) return void 0;
40557
+ if (!React93__default.isValidElement(children)) return void 0;
41268
40558
  const props = children.props;
41269
40559
  if (typeof props.title === "string") {
41270
40560
  return props.title;
@@ -41319,7 +40609,7 @@ function LinearView({
41319
40609
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
41320
40610
  const isDone = i < currentIdx;
41321
40611
  const isCurrent = i === currentIdx;
41322
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
40612
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
41323
40613
  i > 0 && /* @__PURE__ */ jsx(
41324
40614
  Typography,
41325
40615
  {
@@ -42277,12 +41567,12 @@ var init_Form = __esm({
42277
41567
  const isSchemaEntity = isOrbitalEntitySchema(entity);
42278
41568
  const resolvedEntity = isSchemaEntity ? entity : void 0;
42279
41569
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
42280
- const normalizedInitialData = React97__default.useMemo(() => {
41570
+ const normalizedInitialData = React93__default.useMemo(() => {
42281
41571
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
42282
41572
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
42283
41573
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
42284
41574
  }, [entity, initialData]);
42285
- const entityDerivedFields = React97__default.useMemo(() => {
41575
+ const entityDerivedFields = React93__default.useMemo(() => {
42286
41576
  if (fields && fields.length > 0) return void 0;
42287
41577
  if (!resolvedEntity) return void 0;
42288
41578
  return resolvedEntity.fields.map(
@@ -42302,16 +41592,16 @@ var init_Form = __esm({
42302
41592
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
42303
41593
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
42304
41594
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
42305
- const [formData, setFormData] = React97__default.useState(
41595
+ const [formData, setFormData] = React93__default.useState(
42306
41596
  normalizedInitialData
42307
41597
  );
42308
- const [collapsedSections, setCollapsedSections] = React97__default.useState(
41598
+ const [collapsedSections, setCollapsedSections] = React93__default.useState(
42309
41599
  /* @__PURE__ */ new Set()
42310
41600
  );
42311
- const [submitError, setSubmitError] = React97__default.useState(null);
42312
- const formRef = React97__default.useRef(null);
41601
+ const [submitError, setSubmitError] = React93__default.useState(null);
41602
+ const formRef = React93__default.useRef(null);
42313
41603
  const formMode = props.mode;
42314
- const mountedRef = React97__default.useRef(false);
41604
+ const mountedRef = React93__default.useRef(false);
42315
41605
  if (!mountedRef.current) {
42316
41606
  mountedRef.current = true;
42317
41607
  debug("forms", "mount", {
@@ -42324,7 +41614,7 @@ var init_Form = __esm({
42324
41614
  });
42325
41615
  }
42326
41616
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
42327
- const evalContext = React97__default.useMemo(
41617
+ const evalContext = React93__default.useMemo(
42328
41618
  () => ({
42329
41619
  formValues: formData,
42330
41620
  globalVariables: externalContext?.globalVariables ?? {},
@@ -42333,7 +41623,7 @@ var init_Form = __esm({
42333
41623
  }),
42334
41624
  [formData, externalContext]
42335
41625
  );
42336
- React97__default.useEffect(() => {
41626
+ React93__default.useEffect(() => {
42337
41627
  debug("forms", "initialData-sync", {
42338
41628
  mode: formMode,
42339
41629
  normalizedInitialData,
@@ -42344,7 +41634,7 @@ var init_Form = __esm({
42344
41634
  setFormData(normalizedInitialData);
42345
41635
  }
42346
41636
  }, [normalizedInitialData]);
42347
- const processCalculations = React97__default.useCallback(
41637
+ const processCalculations = React93__default.useCallback(
42348
41638
  (changedFieldId, newFormData) => {
42349
41639
  if (!hiddenCalculations.length) return;
42350
41640
  const context = {
@@ -42369,7 +41659,7 @@ var init_Form = __esm({
42369
41659
  },
42370
41660
  [hiddenCalculations, externalContext, eventBus]
42371
41661
  );
42372
- const checkViolations = React97__default.useCallback(
41662
+ const checkViolations = React93__default.useCallback(
42373
41663
  (changedFieldId, newFormData) => {
42374
41664
  if (!violationTriggers.length) return;
42375
41665
  const context = {
@@ -42407,7 +41697,7 @@ var init_Form = __esm({
42407
41697
  processCalculations(name, newFormData);
42408
41698
  checkViolations(name, newFormData);
42409
41699
  };
42410
- const isFieldVisible = React97__default.useCallback(
41700
+ const isFieldVisible = React93__default.useCallback(
42411
41701
  (fieldName) => {
42412
41702
  const condition = conditionalFields[fieldName];
42413
41703
  if (!condition) return true;
@@ -42415,7 +41705,7 @@ var init_Form = __esm({
42415
41705
  },
42416
41706
  [conditionalFields, evalContext]
42417
41707
  );
42418
- const isSectionVisible = React97__default.useCallback(
41708
+ const isSectionVisible = React93__default.useCallback(
42419
41709
  (section) => {
42420
41710
  if (!section.condition) return true;
42421
41711
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -42491,7 +41781,7 @@ var init_Form = __esm({
42491
41781
  eventBus.emit(`UI:${onCancel}`);
42492
41782
  }
42493
41783
  };
42494
- const renderField = React97__default.useCallback(
41784
+ const renderField = React93__default.useCallback(
42495
41785
  (field) => {
42496
41786
  const fieldName = field.name || field.field;
42497
41787
  if (!fieldName) return null;
@@ -42512,7 +41802,7 @@ var init_Form = __esm({
42512
41802
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
42513
41803
  );
42514
41804
  const effectiveFields = entityDerivedFields ?? fields;
42515
- const normalizedFields = React97__default.useMemo(() => {
41805
+ const normalizedFields = React93__default.useMemo(() => {
42516
41806
  if (!effectiveFields || effectiveFields.length === 0) return [];
42517
41807
  return effectiveFields.map((field) => {
42518
41808
  if (typeof field === "string") {
@@ -42535,7 +41825,7 @@ var init_Form = __esm({
42535
41825
  return field;
42536
41826
  });
42537
41827
  }, [effectiveFields, resolvedEntity]);
42538
- const schemaFields = React97__default.useMemo(() => {
41828
+ const schemaFields = React93__default.useMemo(() => {
42539
41829
  if (normalizedFields.length === 0) return null;
42540
41830
  if (isDebugEnabled()) {
42541
41831
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -42545,7 +41835,7 @@ var init_Form = __esm({
42545
41835
  }
42546
41836
  return normalizedFields.map(renderField).filter(Boolean);
42547
41837
  }, [normalizedFields, renderField, entityName, conditionalFields]);
42548
- const sectionElements = React97__default.useMemo(() => {
41838
+ const sectionElements = React93__default.useMemo(() => {
42549
41839
  if (!sections || sections.length === 0) return null;
42550
41840
  return sections.map((section) => {
42551
41841
  if (!isSectionVisible(section)) {
@@ -43820,7 +43110,7 @@ var init_List = __esm({
43820
43110
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
43821
43111
  return [];
43822
43112
  }, [entity]);
43823
- const getItemActions = React97__default.useCallback(
43113
+ const getItemActions = React93__default.useCallback(
43824
43114
  (item) => {
43825
43115
  if (!itemActions) return [];
43826
43116
  if (typeof itemActions === "function") {
@@ -44296,7 +43586,7 @@ var init_MediaGallery = __esm({
44296
43586
  [selectable, selectedItems, selectionEvent, eventBus]
44297
43587
  );
44298
43588
  const entityData = Array.isArray(entity) ? entity : [];
44299
- const items = React97__default.useMemo(() => {
43589
+ const items = React93__default.useMemo(() => {
44300
43590
  if (propItems) return propItems;
44301
43591
  if (entityData.length === 0) return [];
44302
43592
  return entityData.map((record, idx) => ({
@@ -44457,7 +43747,7 @@ var init_MediaGallery = __esm({
44457
43747
  }
44458
43748
  });
44459
43749
  function extractTitle2(children) {
44460
- if (!React97__default.isValidElement(children)) return void 0;
43750
+ if (!React93__default.isValidElement(children)) return void 0;
44461
43751
  const props = children.props;
44462
43752
  if (typeof props.title === "string") {
44463
43753
  return props.title;
@@ -44888,7 +44178,7 @@ var init_debugRegistry = __esm({
44888
44178
  }
44889
44179
  });
44890
44180
  function useDebugData() {
44891
- const [data, setData] = React97.useState(() => ({
44181
+ const [data, setData] = React93.useState(() => ({
44892
44182
  traits: [],
44893
44183
  ticks: [],
44894
44184
  guards: [],
@@ -44902,7 +44192,7 @@ function useDebugData() {
44902
44192
  },
44903
44193
  lastUpdate: Date.now()
44904
44194
  }));
44905
- React97.useEffect(() => {
44195
+ React93.useEffect(() => {
44906
44196
  const updateData = () => {
44907
44197
  setData({
44908
44198
  traits: getAllTraits(),
@@ -45011,12 +44301,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
45011
44301
  return positions;
45012
44302
  }
45013
44303
  function WalkMinimap() {
45014
- const [walkStep, setWalkStep] = React97.useState(null);
45015
- const [traits2, setTraits] = React97.useState([]);
45016
- const [coveredEdges, setCoveredEdges] = React97.useState([]);
45017
- const [completedTraits, setCompletedTraits] = React97.useState(/* @__PURE__ */ new Set());
45018
- const prevTraitRef = React97.useRef(null);
45019
- React97.useEffect(() => {
44304
+ const [walkStep, setWalkStep] = React93.useState(null);
44305
+ const [traits2, setTraits] = React93.useState([]);
44306
+ const [coveredEdges, setCoveredEdges] = React93.useState([]);
44307
+ const [completedTraits, setCompletedTraits] = React93.useState(/* @__PURE__ */ new Set());
44308
+ const prevTraitRef = React93.useRef(null);
44309
+ React93.useEffect(() => {
45020
44310
  const interval = setInterval(() => {
45021
44311
  const w = window;
45022
44312
  const step = w.__orbitalWalkStep;
@@ -45452,15 +44742,15 @@ var init_EntitiesTab = __esm({
45452
44742
  });
45453
44743
  function EventFlowTab({ events: events2 }) {
45454
44744
  const { t } = useTranslate();
45455
- const [filter, setFilter] = React97.useState("all");
45456
- const containerRef = React97.useRef(null);
45457
- const [autoScroll, setAutoScroll] = React97.useState(true);
45458
- React97.useEffect(() => {
44745
+ const [filter, setFilter] = React93.useState("all");
44746
+ const containerRef = React93.useRef(null);
44747
+ const [autoScroll, setAutoScroll] = React93.useState(true);
44748
+ React93.useEffect(() => {
45459
44749
  if (autoScroll && containerRef.current) {
45460
44750
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
45461
44751
  }
45462
44752
  }, [events2.length, autoScroll]);
45463
- const filteredEvents = React97.useMemo(() => {
44753
+ const filteredEvents = React93.useMemo(() => {
45464
44754
  if (filter === "all") return events2;
45465
44755
  return events2.filter((e) => e.type === filter);
45466
44756
  }, [events2, filter]);
@@ -45576,7 +44866,7 @@ var init_EventFlowTab = __esm({
45576
44866
  });
45577
44867
  function GuardsPanel({ guards }) {
45578
44868
  const { t } = useTranslate();
45579
- const [filter, setFilter] = React97.useState("all");
44869
+ const [filter, setFilter] = React93.useState("all");
45580
44870
  if (guards.length === 0) {
45581
44871
  return /* @__PURE__ */ jsx(
45582
44872
  EmptyState,
@@ -45589,7 +44879,7 @@ function GuardsPanel({ guards }) {
45589
44879
  }
45590
44880
  const passedCount = guards.filter((g) => g.result).length;
45591
44881
  const failedCount = guards.length - passedCount;
45592
- const filteredGuards = React97.useMemo(() => {
44882
+ const filteredGuards = React93.useMemo(() => {
45593
44883
  if (filter === "all") return guards;
45594
44884
  if (filter === "passed") return guards.filter((g) => g.result);
45595
44885
  return guards.filter((g) => !g.result);
@@ -45752,10 +45042,10 @@ function EffectBadge({ effect }) {
45752
45042
  }
45753
45043
  function TransitionTimeline({ transitions }) {
45754
45044
  const { t } = useTranslate();
45755
- const containerRef = React97.useRef(null);
45756
- const [autoScroll, setAutoScroll] = React97.useState(true);
45757
- const [expandedId, setExpandedId] = React97.useState(null);
45758
- React97.useEffect(() => {
45045
+ const containerRef = React93.useRef(null);
45046
+ const [autoScroll, setAutoScroll] = React93.useState(true);
45047
+ const [expandedId, setExpandedId] = React93.useState(null);
45048
+ React93.useEffect(() => {
45759
45049
  if (autoScroll && containerRef.current) {
45760
45050
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
45761
45051
  }
@@ -46035,9 +45325,9 @@ function getAllEvents(traits2) {
46035
45325
  function EventDispatcherTab({ traits: traits2, schema }) {
46036
45326
  const eventBus = useEventBus();
46037
45327
  const { t } = useTranslate();
46038
- const [log16, setLog] = React97.useState([]);
46039
- const prevStatesRef = React97.useRef(/* @__PURE__ */ new Map());
46040
- React97.useEffect(() => {
45328
+ const [log13, setLog] = React93.useState([]);
45329
+ const prevStatesRef = React93.useRef(/* @__PURE__ */ new Map());
45330
+ React93.useEffect(() => {
46041
45331
  for (const trait of traits2) {
46042
45332
  const prev = prevStatesRef.current.get(trait.id);
46043
45333
  if (prev && prev !== trait.currentState) {
@@ -46099,9 +45389,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
46099
45389
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
46100
45390
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
46101
45391
  ] }),
46102
- log16.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
45392
+ log13.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
46103
45393
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
46104
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log16.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
45394
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log13.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
46105
45395
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
46106
45396
  " ",
46107
45397
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46206,10 +45496,10 @@ function VerifyModePanel({
46206
45496
  localCount
46207
45497
  }) {
46208
45498
  const { t } = useTranslate();
46209
- const [expanded, setExpanded] = React97.useState(true);
46210
- const scrollRef = React97.useRef(null);
46211
- const prevCountRef = React97.useRef(0);
46212
- React97.useEffect(() => {
45499
+ const [expanded, setExpanded] = React93.useState(true);
45500
+ const scrollRef = React93.useRef(null);
45501
+ const prevCountRef = React93.useRef(0);
45502
+ React93.useEffect(() => {
46213
45503
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
46214
45504
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
46215
45505
  }
@@ -46266,10 +45556,10 @@ function RuntimeDebugger({
46266
45556
  schema
46267
45557
  }) {
46268
45558
  const { t } = useTranslate();
46269
- const [isCollapsed, setIsCollapsed] = React97.useState(mode === "verify" ? true : defaultCollapsed);
46270
- const [isVisible, setIsVisible] = React97.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
45559
+ const [isCollapsed, setIsCollapsed] = React93.useState(mode === "verify" ? true : defaultCollapsed);
45560
+ const [isVisible, setIsVisible] = React93.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
46271
45561
  const debugData = useDebugData();
46272
- React97.useEffect(() => {
45562
+ React93.useEffect(() => {
46273
45563
  if (mode === "inline") return;
46274
45564
  return onDebugToggle((enabled) => {
46275
45565
  setIsVisible(enabled);
@@ -46278,7 +45568,7 @@ function RuntimeDebugger({
46278
45568
  }
46279
45569
  });
46280
45570
  }, [mode]);
46281
- React97.useEffect(() => {
45571
+ React93.useEffect(() => {
46282
45572
  if (mode === "inline") return;
46283
45573
  const handleKeyDown = (e) => {
46284
45574
  if (e.key === "`" && isVisible) {
@@ -46727,7 +46017,7 @@ function SequenceBar({
46727
46017
  onSlotRemove(index);
46728
46018
  }, [onSlotRemove, playing]);
46729
46019
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
46730
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
46020
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
46731
46021
  i > 0 && /* @__PURE__ */ jsx(
46732
46022
  Typography,
46733
46023
  {
@@ -47706,7 +46996,7 @@ var init_StatCard = __esm({
47706
46996
  const labelToUse = propLabel ?? propTitle;
47707
46997
  const eventBus = useEventBus();
47708
46998
  const { t } = useTranslate();
47709
- const handleActionClick = React97__default.useCallback(() => {
46999
+ const handleActionClick = React93__default.useCallback(() => {
47710
47000
  if (action?.event) {
47711
47001
  eventBus.emit(`UI:${action.event}`, {});
47712
47002
  }
@@ -47717,7 +47007,7 @@ var init_StatCard = __esm({
47717
47007
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
47718
47008
  const isLoading = externalLoading ?? false;
47719
47009
  const error = externalError;
47720
- const computeMetricValue = React97__default.useCallback(
47010
+ const computeMetricValue = React93__default.useCallback(
47721
47011
  (metric, items) => {
47722
47012
  if (metric.value !== void 0) {
47723
47013
  return metric.value;
@@ -47756,7 +47046,7 @@ var init_StatCard = __esm({
47756
47046
  },
47757
47047
  []
47758
47048
  );
47759
- const schemaStats = React97__default.useMemo(() => {
47049
+ const schemaStats = React93__default.useMemo(() => {
47760
47050
  if (!metrics || metrics.length === 0) return null;
47761
47051
  return metrics.map((metric) => ({
47762
47052
  label: metric.label,
@@ -47764,7 +47054,7 @@ var init_StatCard = __esm({
47764
47054
  format: metric.format
47765
47055
  }));
47766
47056
  }, [metrics, data, computeMetricValue]);
47767
- const calculatedTrend = React97__default.useMemo(() => {
47057
+ const calculatedTrend = React93__default.useMemo(() => {
47768
47058
  if (manualTrend !== void 0) return manualTrend;
47769
47059
  if (previousValue === void 0 || currentValue === void 0)
47770
47060
  return void 0;
@@ -48698,7 +47988,7 @@ var init_Timeline = __esm({
48698
47988
  }) => {
48699
47989
  const { t } = useTranslate();
48700
47990
  const entityData = Array.isArray(entity) ? entity : [];
48701
- const items = React97__default.useMemo(() => {
47991
+ const items = React93__default.useMemo(() => {
48702
47992
  if (propItems) return propItems;
48703
47993
  if (entityData.length === 0) return [];
48704
47994
  return entityData.map((record, idx) => {
@@ -48805,7 +48095,7 @@ var init_Timeline = __esm({
48805
48095
  }
48806
48096
  });
48807
48097
  function extractToastProps(children) {
48808
- if (!React97__default.isValidElement(children)) {
48098
+ if (!React93__default.isValidElement(children)) {
48809
48099
  if (typeof children === "string") {
48810
48100
  return { message: children };
48811
48101
  }
@@ -48843,7 +48133,7 @@ var init_ToastSlot = __esm({
48843
48133
  eventBus.emit("UI:CLOSE");
48844
48134
  };
48845
48135
  if (!isVisible) return null;
48846
- const isCustomContent = React97__default.isValidElement(children) && !message;
48136
+ const isCustomContent = React93__default.isValidElement(children) && !message;
48847
48137
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
48848
48138
  Toast,
48849
48139
  {
@@ -49353,12 +48643,12 @@ var init_WorldMapTemplate = __esm({
49353
48643
  }
49354
48644
  });
49355
48645
  function lazyThree(name, loader) {
49356
- const Lazy = React97__default.lazy(() => loader().then((m) => ({ default: m[name] })));
48646
+ const Lazy = React93__default.lazy(() => loader().then((m) => ({ default: m[name] })));
49357
48647
  function ThreeWrapper(props) {
49358
- return React97__default.createElement(
49359
- React97__default.Suspense,
48648
+ return React93__default.createElement(
48649
+ React93__default.Suspense,
49360
48650
  { fallback: null },
49361
- React97__default.createElement(Lazy, props)
48651
+ React93__default.createElement(Lazy, props)
49362
48652
  );
49363
48653
  }
49364
48654
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -49974,7 +49264,7 @@ function SuspenseConfigProvider({
49974
49264
  config,
49975
49265
  children
49976
49266
  }) {
49977
- return React97__default.createElement(
49267
+ return React93__default.createElement(
49978
49268
  SuspenseConfigContext.Provider,
49979
49269
  { value: config },
49980
49270
  children
@@ -50459,7 +49749,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
50459
49749
  const key = `${parentId}-${index}-trait:${traitName}`;
50460
49750
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
50461
49751
  }
50462
- return /* @__PURE__ */ jsx(React97__default.Fragment, { children: child }, `${parentId}-${index}`);
49752
+ return /* @__PURE__ */ jsx(React93__default.Fragment, { children: child }, `${parentId}-${index}`);
50463
49753
  }
50464
49754
  if (!child || typeof child !== "object") return null;
50465
49755
  const childId = `${parentId}-${index}`;
@@ -50499,14 +49789,14 @@ function isPatternConfig(value) {
50499
49789
  if (value === null || value === void 0) return false;
50500
49790
  if (typeof value !== "object") return false;
50501
49791
  if (Array.isArray(value)) return false;
50502
- if (React97__default.isValidElement(value)) return false;
49792
+ if (React93__default.isValidElement(value)) return false;
50503
49793
  if (value instanceof Date) return false;
50504
49794
  if (typeof value === "function") return false;
50505
49795
  const record = value;
50506
49796
  return "type" in record && typeof record.type === "string";
50507
49797
  }
50508
49798
  function isPlainConfigObject(value) {
50509
- if (React97__default.isValidElement(value)) return false;
49799
+ if (React93__default.isValidElement(value)) return false;
50510
49800
  if (value instanceof Date) return false;
50511
49801
  const proto = Object.getPrototypeOf(value);
50512
49802
  return proto === Object.prototype || proto === null;
@@ -50764,8 +50054,6 @@ var init_UISlotRenderer = __esm({
50764
50054
  "components/core/organisms/UISlotRenderer.tsx"() {
50765
50055
  "use client";
50766
50056
  init_EntitySchemaContext();
50767
- init_TraitScopeProvider();
50768
- init_UISlotContext();
50769
50057
  init_Modal();
50770
50058
  init_Drawer();
50771
50059
  init_Toast();
@@ -50996,7 +50284,7 @@ var AvlTransition = ({
50996
50284
  opacity = 1,
50997
50285
  className
50998
50286
  }) => {
50999
- const ids = React97__default.useMemo(() => {
50287
+ const ids = React93__default.useMemo(() => {
51000
50288
  avlTransitionId += 1;
51001
50289
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
51002
50290
  }, []);
@@ -51557,7 +50845,7 @@ var AvlStateMachine = ({
51557
50845
  color = "var(--color-primary)",
51558
50846
  animated = false
51559
50847
  }) => {
51560
- const ids = React97__default.useMemo(() => {
50848
+ const ids = React93__default.useMemo(() => {
51561
50849
  avlSmId += 1;
51562
50850
  const base = `avl-sm-${avlSmId}`;
51563
50851
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -51756,7 +51044,7 @@ var AvlOrbitalUnit = ({
51756
51044
  color = "var(--color-primary)",
51757
51045
  animated = false
51758
51046
  }) => {
51759
- const ids = React97__default.useMemo(() => {
51047
+ const ids = React93__default.useMemo(() => {
51760
51048
  avlOuId += 1;
51761
51049
  const base = `avl-ou-${avlOuId}`;
51762
51050
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -51852,7 +51140,7 @@ var AvlClosedCircuit = ({
51852
51140
  color = "var(--color-primary)",
51853
51141
  animated = false
51854
51142
  }) => {
51855
- const ids = React97__default.useMemo(() => {
51143
+ const ids = React93__default.useMemo(() => {
51856
51144
  avlCcId += 1;
51857
51145
  const base = `avl-cc-${avlCcId}`;
51858
51146
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -52007,7 +51295,7 @@ var AvlEmitListen = ({
52007
51295
  color = "var(--color-primary)",
52008
51296
  animated = false
52009
51297
  }) => {
52010
- const ids = React97__default.useMemo(() => {
51298
+ const ids = React93__default.useMemo(() => {
52011
51299
  avlElId += 1;
52012
51300
  const base = `avl-el-${avlElId}`;
52013
51301
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -52281,7 +51569,7 @@ function renderNode(node, color, glowId) {
52281
51569
  const baseR = node.type === "operator" ? 20 : 16;
52282
51570
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
52283
51571
  const nc = nodeColor(node.type, color);
52284
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
51572
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
52285
51573
  node.children.map((child, i) => {
52286
51574
  const childR = Math.max(
52287
51575
  child.type === "operator" ? 20 : 16,
@@ -52338,7 +51626,7 @@ var AvlExprTree = ({
52338
51626
  className,
52339
51627
  color = "var(--color-primary)"
52340
51628
  }) => {
52341
- const ids = React97__default.useMemo(() => {
51629
+ const ids = React93__default.useMemo(() => {
52342
51630
  avlEtId += 1;
52343
51631
  return { glow: `avl-et-${avlEtId}-glow` };
52344
51632
  }, []);
@@ -53162,7 +52450,7 @@ var SystemNode = ({ data }) => {
53162
52450
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
53163
52451
  const tc = transitionCounts[s.name] ?? 0;
53164
52452
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
53165
- return /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
52453
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
53166
52454
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
53167
52455
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
53168
52456
  ] }, s.name);
@@ -54101,323 +53389,6 @@ init_Typography();
54101
53389
  // runtime/OrbPreview.tsx
54102
53390
  init_Box();
54103
53391
  init_Typography();
54104
-
54105
- // providers/OrbitalProvider.tsx
54106
- init_ThemeContext();
54107
- init_EventBusProvider();
54108
-
54109
- // providers/SelectionProvider.tsx
54110
- init_useEventBus();
54111
- var log4 = createLogger("almadar:ui:selection");
54112
- var SelectionContext = createContext(null);
54113
- var defaultCompareEntities = (a, b) => {
54114
- if (a === b) return true;
54115
- if (!a || !b) return false;
54116
- if (typeof a === "object" && typeof b === "object") {
54117
- const aId = a.id;
54118
- const bId = b.id;
54119
- return aId !== void 0 && aId === bId;
54120
- }
54121
- return false;
54122
- };
54123
- function SelectionProvider({
54124
- children,
54125
- debug: debug2 = false,
54126
- compareEntities = defaultCompareEntities
54127
- }) {
54128
- const eventBus = useEventBus();
54129
- const [selected, setSelectedState] = useState(null);
54130
- const setSelected = useCallback(
54131
- (entity) => {
54132
- setSelectedState(entity);
54133
- if (debug2) {
54134
- log4.debug("Selection set", () => ({
54135
- hasEntity: entity !== null && entity !== void 0,
54136
- entityId: entity && typeof entity === "object" ? String(entity.id ?? "") : ""
54137
- }));
54138
- }
54139
- },
54140
- [debug2]
54141
- );
54142
- const clearSelection = useCallback(() => {
54143
- setSelectedState(null);
54144
- if (debug2) {
54145
- log4.debug("Selection cleared");
54146
- }
54147
- }, [debug2]);
54148
- const isSelected = useCallback(
54149
- (entity) => {
54150
- return compareEntities(selected, entity);
54151
- },
54152
- [selected, compareEntities]
54153
- );
54154
- useEffect(() => {
54155
- const handleSelect = (event) => {
54156
- const row = event.payload?.row;
54157
- if (row) {
54158
- setSelected(row);
54159
- if (debug2) {
54160
- log4.debug("event received", () => ({
54161
- type: event.type,
54162
- rowId: row && typeof row === "object" ? String(row.id ?? "") : ""
54163
- }));
54164
- }
54165
- }
54166
- };
54167
- const handleDeselect = (event) => {
54168
- clearSelection();
54169
- if (debug2) {
54170
- log4.debug("event received - clearing selection", { type: event.type });
54171
- }
54172
- };
54173
- const unsubView = eventBus.on("UI:VIEW", handleSelect);
54174
- const unsubSelect = eventBus.on("UI:SELECT", handleSelect);
54175
- const unsubClose = eventBus.on("UI:CLOSE", handleDeselect);
54176
- const unsubDeselect = eventBus.on("UI:DESELECT", handleDeselect);
54177
- const unsubCancel = eventBus.on("UI:CANCEL", handleDeselect);
54178
- return () => {
54179
- unsubView();
54180
- unsubSelect();
54181
- unsubClose();
54182
- unsubDeselect();
54183
- unsubCancel();
54184
- };
54185
- }, [eventBus, setSelected, clearSelection, debug2]);
54186
- const contextValue = {
54187
- selected,
54188
- setSelected,
54189
- clearSelection,
54190
- isSelected
54191
- };
54192
- return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: contextValue, children });
54193
- }
54194
-
54195
- // providers/OrbitalProvider.tsx
54196
- init_UISlotRenderer();
54197
-
54198
- // providers/VerificationProvider.tsx
54199
- init_useEventBus();
54200
- init_verificationRegistry();
54201
- var log11 = createLogger("almadar:verify");
54202
- var DISPATCH_SUFFIX = ":DISPATCH";
54203
- var SUCCESS_SUFFIX = ":SUCCESS";
54204
- var ERROR_SUFFIX = ":ERROR";
54205
- function parseLifecycleEvent(type) {
54206
- if (type.endsWith(DISPATCH_SUFFIX)) {
54207
- const traitName = type.slice(0, -DISPATCH_SUFFIX.length);
54208
- if (traitName) return { kind: "dispatch", traitName };
54209
- } else if (type.endsWith(SUCCESS_SUFFIX)) {
54210
- const rest = type.slice(0, -SUCCESS_SUFFIX.length);
54211
- const colonIdx = rest.indexOf(":");
54212
- if (colonIdx > 0) {
54213
- return {
54214
- kind: "success",
54215
- traitName: rest.slice(0, colonIdx),
54216
- event: rest.slice(colonIdx + 1)
54217
- };
54218
- }
54219
- } else if (type.endsWith(ERROR_SUFFIX)) {
54220
- const rest = type.slice(0, -ERROR_SUFFIX.length);
54221
- const colonIdx = rest.indexOf(":");
54222
- if (colonIdx > 0) {
54223
- return {
54224
- kind: "error",
54225
- traitName: rest.slice(0, colonIdx),
54226
- event: rest.slice(colonIdx + 1)
54227
- };
54228
- }
54229
- }
54230
- return null;
54231
- }
54232
- function VerificationProvider({
54233
- children,
54234
- enabled,
54235
- runtimeManager,
54236
- traitStateGetter
54237
- }) {
54238
- const verifyFlag = typeof window !== "undefined" && window.__ALMADAR_VERIFY__ === true;
54239
- const isEnabled2 = enabled ?? (verifyFlag || typeof process !== "undefined" && process.env?.NODE_ENV !== "production");
54240
- const eventBus = useEventBus();
54241
- const pendingRef = useRef(/* @__PURE__ */ new Map());
54242
- useEffect(() => {
54243
- if (!isEnabled2) return;
54244
- if (!eventBus.onAny) return;
54245
- const verificationProviderLifecycleListener = (evt) => {
54246
- const parsed = parseLifecycleEvent(evt.type);
54247
- if (!parsed) return;
54248
- log11.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
54249
- const payload = evt.payload ?? {};
54250
- if (parsed.kind === "dispatch") {
54251
- const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
54252
- pendingRef.current.set(key, {
54253
- traitName: parsed.traitName,
54254
- event: String(payload["event"] ?? ""),
54255
- from: payload["currentState"],
54256
- timestamp: evt.timestamp
54257
- });
54258
- } else if (parsed.kind === "success" && parsed.event) {
54259
- const key = `${parsed.traitName}:${parsed.event}`;
54260
- const pending = pendingRef.current.get(key);
54261
- pendingRef.current.delete(key);
54262
- const newState = payload["newState"] ?? payload["state"] ?? "unknown";
54263
- const clientEffectsArr = Array.isArray(payload["clientEffects"]) ? payload["clientEffects"] : [];
54264
- const effects = clientEffectsArr.map((e) => ({
54265
- type: String(e["type"] ?? "unknown"),
54266
- args: Array.isArray(e["args"]) ? e["args"] : [],
54267
- status: "executed"
54268
- }));
54269
- const effectResults = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
54270
- for (const er of effectResults) {
54271
- effects.push({
54272
- type: String(er["type"] ?? er["effect"] ?? "server-effect"),
54273
- args: [er["entity"] ?? er["service"] ?? ""].filter(Boolean),
54274
- status: er["error"] ? "failed" : "executed",
54275
- error: er["error"]
54276
- });
54277
- }
54278
- const dataEntities = {};
54279
- const responseData = payload["data"];
54280
- if (responseData && typeof responseData === "object") {
54281
- for (const [entityName, records] of Object.entries(responseData)) {
54282
- dataEntities[entityName] = Array.isArray(records) ? records.length : 0;
54283
- }
54284
- }
54285
- const emittedEventsRaw = Array.isArray(payload["emittedEvents"]) ? payload["emittedEvents"] : [];
54286
- const emittedEvents = emittedEventsRaw.map((e) => typeof e.event === "string" ? e.event : null).filter((e) => e !== null);
54287
- recordTransition({
54288
- traitName: parsed.traitName,
54289
- from: pending?.from ?? payload["currentState"] ?? newState,
54290
- to: newState,
54291
- event: parsed.event,
54292
- effects,
54293
- serverResponse: {
54294
- orbitalName: parsed.traitName,
54295
- success: true,
54296
- clientEffects: clientEffectsArr.length,
54297
- dataEntities,
54298
- emittedEvents,
54299
- timestamp: Date.now()
54300
- },
54301
- timestamp: Date.now()
54302
- });
54303
- log11.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
54304
- } else if (parsed.kind === "error" && parsed.event) {
54305
- const key = `${parsed.traitName}:${parsed.event}`;
54306
- const pending = pendingRef.current.get(key);
54307
- pendingRef.current.delete(key);
54308
- const errorMsg = payload["error"] ?? "Unknown error";
54309
- const fromState = pending?.from ?? payload["currentState"] ?? "unknown";
54310
- recordTransition({
54311
- traitName: parsed.traitName,
54312
- from: fromState,
54313
- to: fromState,
54314
- // state didn't change on error
54315
- event: parsed.event,
54316
- effects: [{
54317
- type: "server-call",
54318
- args: [],
54319
- status: "failed",
54320
- error: errorMsg
54321
- }],
54322
- serverResponse: {
54323
- orbitalName: parsed.traitName,
54324
- success: false,
54325
- clientEffects: 0,
54326
- dataEntities: {},
54327
- emittedEvents: [],
54328
- error: errorMsg,
54329
- timestamp: Date.now()
54330
- },
54331
- timestamp: Date.now()
54332
- });
54333
- log11.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
54334
- }
54335
- };
54336
- Object.defineProperty(verificationProviderLifecycleListener, "name", {
54337
- value: "VerificationProvider:lifecycle"
54338
- });
54339
- const unsub = eventBus.onAny(verificationProviderLifecycleListener);
54340
- registerCheck(
54341
- "verification-provider",
54342
- "VerificationProvider active (compiled path)",
54343
- "pass"
54344
- );
54345
- return unsub;
54346
- }, [isEnabled2, eventBus]);
54347
- useEffect(() => {
54348
- if (!isEnabled2) return;
54349
- if (!runtimeManager) return;
54350
- runtimeManager.setObserver({
54351
- onTransition(trace) {
54352
- recordTransition({
54353
- traitName: trace.traitName,
54354
- from: trace.from,
54355
- to: trace.to,
54356
- event: trace.event,
54357
- guardResult: trace.guardResult,
54358
- effects: trace.effects,
54359
- timestamp: Date.now()
54360
- });
54361
- }
54362
- });
54363
- registerCheck(
54364
- "verification-provider",
54365
- "VerificationProvider active (runtime path)",
54366
- "pass"
54367
- );
54368
- }, [isEnabled2, runtimeManager]);
54369
- useEffect(() => {
54370
- if (!isEnabled2) return;
54371
- bindEventBus(eventBus);
54372
- }, [isEnabled2, eventBus]);
54373
- useEffect(() => {
54374
- if (!isEnabled2) return;
54375
- if (traitStateGetter) {
54376
- bindTraitStateGetter(traitStateGetter);
54377
- } else if (runtimeManager?.getState) {
54378
- const mgr = runtimeManager;
54379
- bindTraitStateGetter((traitName) => mgr.getState(traitName));
54380
- }
54381
- }, [isEnabled2, traitStateGetter, runtimeManager]);
54382
- return /* @__PURE__ */ jsx(Fragment, { children });
54383
- }
54384
- VerificationProvider.displayName = "VerificationProvider";
54385
- function OrbitalProvider({
54386
- children,
54387
- themes,
54388
- defaultTheme = "wireframe",
54389
- defaultMode = "system",
54390
- targetRef,
54391
- skipTheme = false,
54392
- debug: debug2 = false,
54393
- initialData,
54394
- suspense = false,
54395
- verification,
54396
- isolated = false
54397
- }) {
54398
- const suspenseConfig = useMemo(
54399
- () => ({ enabled: suspense }),
54400
- [suspense]
54401
- );
54402
- const inner = /* @__PURE__ */ jsx(EventBusProvider, { debug: debug2, isolated, children: /* @__PURE__ */ jsx(VerificationProvider, { enabled: verification, children: /* @__PURE__ */ jsx(SelectionProvider, { debug: debug2, children: /* @__PURE__ */ jsx(SuspenseConfigProvider, { config: suspenseConfig, children }) }) }) });
54403
- if (skipTheme) {
54404
- return inner;
54405
- }
54406
- return /* @__PURE__ */ jsx(
54407
- ThemeProvider,
54408
- {
54409
- themes,
54410
- defaultTheme,
54411
- defaultMode,
54412
- targetRef,
54413
- children: inner
54414
- }
54415
- );
54416
- }
54417
- OrbitalProvider.displayName = "OrbitalProvider";
54418
-
54419
- // runtime/OrbPreview.tsx
54420
- init_UISlotContext();
54421
53392
  init_UISlotRenderer();
54422
53393
  init_useEventBus();
54423
53394
  var resolvedSchemaLog = createLogger("almadar:ui:resolved-schema");
@@ -54631,7 +53602,7 @@ function resolveLambdaBindings(body, params, item, index) {
54631
53602
  if (Array.isArray(body)) {
54632
53603
  return body.map((b) => recur(b));
54633
53604
  }
54634
- if (body !== null && typeof body === "object" && !React97__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
53605
+ if (body !== null && typeof body === "object" && !React93__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
54635
53606
  const out = {};
54636
53607
  for (const [k, v] of Object.entries(body)) {
54637
53608
  out[k] = recur(v);
@@ -54650,7 +53621,7 @@ function getSlotContentRenderer2() {
54650
53621
  function makeLambdaFn(params, lambdaBody, callerKey) {
54651
53622
  return (item, index) => {
54652
53623
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
54653
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React97__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
53624
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React93__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
54654
53625
  return null;
54655
53626
  }
54656
53627
  const record = resolvedBody;
@@ -54669,7 +53640,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
54669
53640
  props: childProps,
54670
53641
  priority: 0
54671
53642
  };
54672
- return React97__default.createElement(SlotContentRenderer2, { content: childContent });
53643
+ return React93__default.createElement(SlotContentRenderer2, { content: childContent });
54673
53644
  };
54674
53645
  }
54675
53646
  function convertNode(node, callerKey) {
@@ -54688,7 +53659,7 @@ function convertNode(node, callerKey) {
54688
53659
  });
54689
53660
  return anyChanged ? mapped : node;
54690
53661
  }
54691
- if (typeof node === "object" && !React97__default.isValidElement(node) && !(node instanceof Date)) {
53662
+ if (typeof node === "object" && !React93__default.isValidElement(node) && !(node instanceof Date)) {
54692
53663
  return convertObjectProps(node);
54693
53664
  }
54694
53665
  return node;
@@ -54715,7 +53686,7 @@ function convertObjectProps(props) {
54715
53686
  function convertFnFormLambdasInProps(props) {
54716
53687
  return convertObjectProps(props);
54717
53688
  }
54718
- var log12 = createLogger("almadar:ui:effects:client-handlers");
53689
+ var log9 = createLogger("almadar:ui:effects:client-handlers");
54719
53690
  function createClientEffectHandlers(options) {
54720
53691
  const { eventBus, slotSetter, navigate, notify, callService } = options;
54721
53692
  return {
@@ -54724,10 +53695,10 @@ function createClientEffectHandlers(options) {
54724
53695
  eventBus.emit(prefixedEvent, payload);
54725
53696
  },
54726
53697
  persist: async () => {
54727
- log12.warn("persist is server-side only, ignored on client");
53698
+ log9.warn("persist is server-side only, ignored on client");
54728
53699
  },
54729
53700
  set: () => {
54730
- log12.warn("set is server-side only, ignored on client");
53701
+ log9.warn("set is server-side only, ignored on client");
54731
53702
  },
54732
53703
  callService: async (service, action, params) => {
54733
53704
  if (callService) return callService(service, action, params);
@@ -54756,10 +53727,10 @@ function createClientEffectHandlers(options) {
54756
53727
  slotSetter.addPattern(slot, pattern, props);
54757
53728
  },
54758
53729
  navigate: navigate ?? ((path) => {
54759
- log12.warn("No navigate handler, ignoring", { path });
53730
+ log9.warn("No navigate handler, ignoring", { path });
54760
53731
  }),
54761
53732
  notify: notify ?? ((msg, type) => {
54762
- log12.debug("notify", { type, message: msg });
53733
+ log9.debug("notify", { type, message: msg });
54763
53734
  })
54764
53735
  };
54765
53736
  }
@@ -55924,7 +54895,7 @@ OrbitalThemeProvider.displayName = "OrbitalThemeProvider";
55924
54895
  init_navigation();
55925
54896
  init_verificationRegistry();
55926
54897
  var PERF_NAMESPACE = "almadar:perf:canvas";
55927
- var log13 = createLogger(PERF_NAMESPACE);
54898
+ var log10 = createLogger(PERF_NAMESPACE);
55928
54899
  var RING_SIZE = 50;
55929
54900
  var ring = [];
55930
54901
  var writeIdx = 0;
@@ -55975,7 +54946,7 @@ function perfEnd(name, startToken, detail) {
55975
54946
  }
55976
54947
  }
55977
54948
  push({ name, durationMs, ts: endTs, detail });
55978
- log13.debug(name, () => ({ durationMs, ...detail ?? {} }));
54949
+ log10.debug(name, () => ({ durationMs, ...detail ?? {} }));
55979
54950
  }
55980
54951
  var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
55981
54952
  if (!isEnabled()) return;
@@ -55985,7 +54956,7 @@ var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, com
55985
54956
  ts: commitTime,
55986
54957
  detail: { baseDuration }
55987
54958
  });
55988
- log13.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
54959
+ log10.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
55989
54960
  };
55990
54961
 
55991
54962
  // runtime/prepareSchemaForPreview.ts
@@ -56628,7 +55599,7 @@ init_useEventBus();
56628
55599
  // components/avl/molecules/useCanvasDnd.tsx
56629
55600
  init_useEventBus();
56630
55601
  init_useAlmadarDndCollision();
56631
- var log14 = createLogger("almadar:ui:canvas-dnd");
55602
+ var log11 = createLogger("almadar:ui:canvas-dnd");
56632
55603
  function useCanvasDraggable({
56633
55604
  id,
56634
55605
  payload,
@@ -56667,7 +55638,7 @@ function defaultEmit(eventBus, drop) {
56667
55638
  if (payload.kind === "pattern") {
56668
55639
  const patternType = payload.data.type;
56669
55640
  if (typeof patternType !== "string") {
56670
- log14.warn("default-emit:pattern:missing-type");
55641
+ log11.warn("default-emit:pattern:missing-type");
56671
55642
  return;
56672
55643
  }
56673
55644
  const out = { patternType, containerNode: target.containerNode };
@@ -56676,23 +55647,23 @@ function defaultEmit(eventBus, drop) {
56676
55647
  out.index = resolved.index;
56677
55648
  }
56678
55649
  eventBus.emit("UI:PATTERN_DROP", out);
56679
- log14.info("default-emit:pattern", { patternType, level: target.level });
55650
+ log11.info("default-emit:pattern", { patternType, level: target.level });
56680
55651
  return;
56681
55652
  }
56682
55653
  if (payload.kind === "behavior") {
56683
55654
  const behaviorName = payload.data.name;
56684
55655
  if (typeof behaviorName !== "string") {
56685
- log14.warn("default-emit:behavior:missing-name");
55656
+ log11.warn("default-emit:behavior:missing-name");
56686
55657
  return;
56687
55658
  }
56688
55659
  eventBus.emit("UI:BEHAVIOR_DROP", {
56689
55660
  behaviorName,
56690
55661
  containerNode: target.containerNode
56691
55662
  });
56692
- log14.info("default-emit:behavior", { behaviorName, level: target.level });
55663
+ log11.info("default-emit:behavior", { behaviorName, level: target.level });
56693
55664
  return;
56694
55665
  }
56695
- log14.debug("default-emit:unhandled-kind", { kind: payload.kind });
55666
+ log11.debug("default-emit:unhandled-kind", { kind: payload.kind });
56696
55667
  }
56697
55668
  function CanvasDndProvider({
56698
55669
  children,
@@ -56701,26 +55672,26 @@ function CanvasDndProvider({
56701
55672
  }) {
56702
55673
  const eventBus = useEventBus();
56703
55674
  const sensors = useAlmadarDndSensors(false);
56704
- const [activePayload, setActivePayload] = React97__default.useState(null);
56705
- const handleDragStart = React97__default.useCallback((e) => {
55675
+ const [activePayload, setActivePayload] = React93__default.useState(null);
55676
+ const handleDragStart = React93__default.useCallback((e) => {
56706
55677
  const data = e.active.data.current;
56707
55678
  const payload = data?.payload;
56708
55679
  if (payload) {
56709
55680
  setActivePayload(payload);
56710
55681
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
56711
- log14.info("dragStart", { id: e.active.id, kind: payload.kind });
55682
+ log11.info("dragStart", { id: e.active.id, kind: payload.kind });
56712
55683
  } else {
56713
- log14.warn("dragStart:missing-payload", { id: e.active.id });
55684
+ log11.warn("dragStart:missing-payload", { id: e.active.id });
56714
55685
  }
56715
55686
  }, [eventBus]);
56716
- const handleDragEnd = React97__default.useCallback((e) => {
55687
+ const handleDragEnd = React93__default.useCallback((e) => {
56717
55688
  setActivePayload(null);
56718
55689
  const activeData = e.active.data.current;
56719
55690
  const payload = activeData?.payload;
56720
55691
  const overData = e.over?.data.current;
56721
55692
  const target = overData?.target;
56722
55693
  const accepts = overData?.accepts;
56723
- log14.info("dragEnd", {
55694
+ log11.info("dragEnd", {
56724
55695
  activeId: e.active.id,
56725
55696
  overId: e.over?.id,
56726
55697
  hasPayload: !!payload,
@@ -56732,7 +55703,7 @@ function CanvasDndProvider({
56732
55703
  }
56733
55704
  if (!payload || !target) return;
56734
55705
  if (accepts && !accepts.includes(payload.kind)) {
56735
- log14.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
55706
+ log11.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
56736
55707
  return;
56737
55708
  }
56738
55709
  const activator = e.activatorEvent;
@@ -56742,9 +55713,9 @@ function CanvasDndProvider({
56742
55713
  const suppressed = onDrop ? onDrop(drop) === true : false;
56743
55714
  if (!suppressed) defaultEmit(eventBus, drop);
56744
55715
  }, [eventBus, onDrop]);
56745
- const handleDragCancel = React97__default.useCallback(() => {
55716
+ const handleDragCancel = React93__default.useCallback(() => {
56746
55717
  setActivePayload(null);
56747
- log14.info("dragCancel");
55718
+ log11.info("dragCancel");
56748
55719
  }, []);
56749
55720
  return /* @__PURE__ */ jsxs(
56750
55721
  DndContext,
@@ -57496,7 +56467,7 @@ var OrbPreviewNodeInner = (props) => {
57496
56467
  }
57497
56468
  );
57498
56469
  };
57499
- var OrbPreviewNode = React97__default.memo(OrbPreviewNodeInner);
56470
+ var OrbPreviewNode = React93__default.memo(OrbPreviewNodeInner);
57500
56471
  OrbPreviewNode.displayName = "OrbPreviewNode";
57501
56472
  orbPreviewLog.debug("export-resolved", () => ({
57502
56473
  type: typeof OrbPreviewNode,
@@ -57601,7 +56572,7 @@ var EventFlowEdgeInner = (props) => {
57601
56572
  ) })
57602
56573
  ] });
57603
56574
  };
57604
- var EventFlowEdge = React97__default.memo(EventFlowEdgeInner);
56575
+ var EventFlowEdge = React93__default.memo(EventFlowEdgeInner);
57605
56576
  EventFlowEdge.displayName = "EventFlowEdge";
57606
56577
 
57607
56578
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -57748,7 +56719,7 @@ var BehaviorComposeNodeInner = (props) => {
57748
56719
  }
57749
56720
  );
57750
56721
  };
57751
- var BehaviorComposeNode = React97__default.memo(BehaviorComposeNodeInner);
56722
+ var BehaviorComposeNode = React93__default.memo(BehaviorComposeNodeInner);
57752
56723
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
57753
56724
 
57754
56725
  // components/avl/molecules/avl-behavior-compose-converter.ts
@@ -58559,7 +57530,7 @@ init_AvlTransitionLane();
58559
57530
  init_AvlSwimLane();
58560
57531
  init_types();
58561
57532
  init_avl_elk_layout();
58562
- var log15 = createLogger("almadar:ui:avl:trait-scene");
57533
+ var log12 = createLogger("almadar:ui:avl:trait-scene");
58563
57534
  var SWIM_GUTTER2 = 120;
58564
57535
  var CENTER_W2 = 360;
58565
57536
  var AvlTraitScene = ({
@@ -58572,7 +57543,7 @@ var AvlTraitScene = ({
58572
57543
  const dataKey = useMemo(() => JSON.stringify(data), [data]);
58573
57544
  useEffect(() => {
58574
57545
  computeTraitLayout(data).then(setLayout).catch((error) => {
58575
- log15.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
57546
+ log12.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
58576
57547
  });
58577
57548
  }, [dataKey]);
58578
57549
  if (!layout) {
@@ -58760,7 +57731,7 @@ var TraitCardNodeInner = (props) => {
58760
57731
  }
58761
57732
  );
58762
57733
  };
58763
- var TraitCardNode = React97__default.memo(TraitCardNodeInner);
57734
+ var TraitCardNode = React93__default.memo(TraitCardNodeInner);
58764
57735
  TraitCardNode.displayName = "TraitCardNode";
58765
57736
 
58766
57737
  // components/avl/organisms/FlowCanvas.tsx
@@ -58833,7 +57804,7 @@ function FlowCanvasInner({
58833
57804
  initialOrbital
58834
57805
  );
58835
57806
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
58836
- const screenSizeUserOverrideRef = React97__default.useRef(false);
57807
+ const screenSizeUserOverrideRef = React93__default.useRef(false);
58837
57808
  const [screenSize, setScreenSize] = useState(
58838
57809
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
58839
57810
  );
@@ -59217,7 +58188,7 @@ var ZoomBreadcrumb = ({
59217
58188
  if (eventName && band === "detail") {
59218
58189
  segments.push({ icon: "\u26A1", label: eventName });
59219
58190
  }
59220
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
58191
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
59221
58192
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
59222
58193
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
59223
58194
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -59558,7 +58529,7 @@ var EventWireOverlay = ({
59558
58529
  containerW,
59559
58530
  containerH
59560
58531
  }) => {
59561
- const ids = React97__default.useMemo(() => {
58532
+ const ids = React93__default.useMemo(() => {
59562
58533
  avlOczWireId += 1;
59563
58534
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
59564
58535
  }, []);
@@ -59925,7 +58896,7 @@ var AvlOrbitalsCosmicZoom = ({
59925
58896
  borderRadius: 6,
59926
58897
  border: `1px solid ${color}`
59927
58898
  },
59928
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React97__default.Fragment, { children: [
58899
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
59929
58900
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
59930
58901
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
59931
58902
  Box,