@almadar/shell-web 0.1.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/{ArbitraryClassCompiler-Mzabq-UB.d.ts → ArbitraryClassCompiler-CO_iASBn.d.ts} +99 -4
  2. package/dist/AvlGlyph-PIXU6QH5.js +5 -0
  3. package/dist/AvlStateMachine-CKGMECMG.js +8 -0
  4. package/dist/AvlTransitionDetail-QZX6G5KJ.js +10 -0
  5. package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
  6. package/dist/BehaviorView-JLZ4PKWY.js +10 -0
  7. package/dist/{EventBusProvider-CVwjkV_2.d.ts → EventBusProvider-BFFHfN4O.d.ts} +12 -0
  8. package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
  9. package/dist/FlowCanvas-RPII4V24.js +23 -0
  10. package/dist/{BehaviorValueFrame-SSEMEBTG.css → FlowCanvas-VWUPMBKB.css} +189 -191
  11. package/dist/{GameAudioProvider-Cm9BnvmP.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +5 -8
  12. package/dist/KernelEngineContext-CPeWQMAz.d.ts +46 -0
  13. package/dist/LayersPanel-M2LHWUFF.js +6 -0
  14. package/dist/ModuleCard-NJD6JQGD.js +6 -0
  15. package/dist/OrbInspector-OWWKPOBF.js +23 -0
  16. package/dist/{TraitValueFrame-4G3KOUBR.css → OrbInspector-VMTMZHNQ.css} +189 -191
  17. package/dist/{Select-mDZIwNqN.d.ts → Select-C2Uq6t86.d.ts} +17 -31
  18. package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
  19. package/dist/{FlowCanvas-3JRMNJLV.css → UISlotRenderer-BIS6KT7T.css} +189 -191
  20. package/dist/UISlotRenderer-PY7FIJXN.js +23 -0
  21. package/dist/auth/browser/index.js +1 -0
  22. package/dist/auth/react/index.d.ts +8 -1
  23. package/dist/auth/react/index.js +40 -2
  24. package/dist/avl/index.css +189 -191
  25. package/dist/avl/index.d.ts +107 -85
  26. package/dist/avl/index.js +170 -39
  27. package/dist/{chunk-P4LNHAFI.js → chunk-2WGR4TDJ.js} +465 -36
  28. package/dist/{chunk-GKIFONTE.js → chunk-3S54FWRC.js} +2 -2
  29. package/dist/{chunk-KVQS4GXU.js → chunk-4YJ53G7S.js} +18 -8
  30. package/dist/{chunk-MBQAMMSE.js → chunk-4YXBKHHM.js} +269 -658
  31. package/dist/{chunk-YDNJLLG6.js → chunk-57DC34LY.js} +19 -10
  32. package/dist/{chunk-FP3WIKTC.js → chunk-7N6ZPHQ5.js} +9 -1
  33. package/dist/{chunk-AILY3XPS.js → chunk-AE7VCQB6.js} +5 -6
  34. package/dist/{chunk-L677XGY3.js → chunk-AGVSO4WY.js} +4 -5
  35. package/dist/{chunk-FAJDTHWC.js → chunk-AGXD77SL.js} +2 -2
  36. package/dist/chunk-AU7O65OX.js +66 -0
  37. package/dist/{chunk-DFNZUYX4.js → chunk-FAKU5F62.js} +273 -29
  38. package/dist/{chunk-U6QRZASX.js → chunk-ILQXJ2AR.js} +1 -1
  39. package/dist/chunk-M74BCDBQ.js +490 -0
  40. package/dist/{chunk-GYTPOFVC.js → chunk-MS4K3K2R.js} +12095 -13329
  41. package/dist/{chunk-SGM3FASH.js → chunk-OWNG4JZI.js} +13 -12
  42. package/dist/{chunk-VFF5OO47.js → chunk-PCR37T3U.js} +15 -38
  43. package/dist/{chunk-SJGJJKBY.js → chunk-PRLHKBXG.js} +5 -3
  44. package/dist/{chunk-R5O5AUPI.js → chunk-PRXQGGCO.js} +93 -86
  45. package/dist/{chunk-42FY4RYA.js → chunk-REXYVBUO.js} +2 -2
  46. package/dist/{chunk-EQAMU2ZC.js → chunk-UTDC2NEA.js} +1 -1
  47. package/dist/{chunk-73SRAB4P.js → chunk-UU57VNS2.js} +2 -2
  48. package/dist/{chunk-TESBIVUA.js → chunk-VHC2M26B.js} +2 -2
  49. package/dist/{chunk-L2DEKY4J.js → chunk-VO2TTLS5.js} +3 -6
  50. package/dist/{chunk-2PY54Z44.js → chunk-VUIACGDU.js} +4 -5
  51. package/dist/{chunk-DLZF4PVE.js → chunk-YYIHRIDH.js} +3 -3
  52. package/dist/{chunk-DYEKAA4L.js → chunk-ZDRDJKYB.js} +243 -252
  53. package/dist/components/index.css +189 -191
  54. package/dist/components/index.d.ts +739 -289
  55. package/dist/components/index.js +25 -28
  56. package/dist/context/index.d.ts +2 -3
  57. package/dist/context/index.js +4 -3
  58. package/dist/core.d.ts +95 -19
  59. package/dist/core.js +2 -1
  60. package/dist/design-classes/index.cjs +3 -1
  61. package/dist/design-classes/index.js +3 -1
  62. package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
  63. package/dist/hooks/index.d.ts +40 -5
  64. package/dist/hooks/index.js +5 -4
  65. package/dist/index.d.ts +40 -114
  66. package/dist/index.js +174 -34
  67. package/dist/kernel-client-JW6OH5FX.js +537 -0
  68. package/dist/kernel-wire-DGAySGhX.d.ts +95 -0
  69. package/dist/lib/index.d.ts +3 -4
  70. package/dist/lib/index.js +4 -4
  71. package/dist/{prism-AIWGN2X5.js → prism-X5YWKXO5.js} +5 -3
  72. package/dist/providers/index.css +189 -191
  73. package/dist/providers/index.d.ts +41 -28
  74. package/dist/providers/index.js +19 -24
  75. package/dist/renderer/index.d.ts +0 -2
  76. package/dist/renderer/index.js +1 -0
  77. package/dist/runtime/index.css +189 -191
  78. package/dist/runtime/index.d.ts +57 -253
  79. package/dist/runtime/index.js +18 -24
  80. package/dist/ssr/index.cjs +2643 -535
  81. package/dist/ssr/index.d.cts +0 -23
  82. package/dist/ssr/index.d.ts +0 -23
  83. package/dist/ssr/index.js +2639 -535
  84. package/dist/storage/browser/index.js +1 -0
  85. package/dist/test-support.d.ts +15 -8
  86. package/dist/test-support.js +91 -24
  87. package/dist/{paintDispatch-ChW5mVuK.d.ts → verificationRegistry-oopV1J1n.d.ts} +132 -30
  88. package/package.json +14 -38
  89. package/src/core/lib/band-shapes.json +7 -0
  90. package/src/core/locales/ar.json +18 -5
  91. package/src/core/locales/en.json +18 -5
  92. package/src/core/locales/sl.json +18 -5
  93. package/tailwind-preset.cjs +30 -1
  94. package/dist/AvlGlyph-JKJOAH23.js +0 -6
  95. package/dist/AvlStateMachine-PI4YGREK.js +0 -8
  96. package/dist/AvlTransitionDetail-ZH7V24UG.js +0 -12
  97. package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +0 -13
  98. package/dist/BehaviorValueFrame-6RUJXT4A.js +0 -29
  99. package/dist/BehaviorView-RFEE5J6E.js +0 -10
  100. package/dist/Canvas3DHost-_Y-5uLM_.d.ts +0 -552
  101. package/dist/FlowCanvas-STDC4OWK.js +0 -27
  102. package/dist/KernelEngineContext-BOCQoFwk.d.ts +0 -43
  103. package/dist/LayersPanel-BBQ54IVG.js +0 -7
  104. package/dist/ModuleCard-3TT2X7IW.js +0 -7
  105. package/dist/OrbInspector-K6T6O7GI.js +0 -27
  106. package/dist/OrbInspector-MHLJ6OEE.css +0 -1756
  107. package/dist/ServerBridge-Cm1On51b.d.ts +0 -233
  108. package/dist/TraitValueFrame-2PJGLLVI.js +0 -28
  109. package/dist/UISlotRenderer-JKFSX24W.js +0 -27
  110. package/dist/UISlotRenderer-KVFO6J7R.css +0 -1756
  111. package/dist/UserContext-DqWeZkUZ.d.ts +0 -100
  112. package/dist/avl-3d-context-BIRKWpaL.d.ts +0 -204
  113. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
  114. package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
  115. package/dist/chunk-2QOH2HWM.js +0 -95
  116. package/dist/chunk-6P3MWXYE.js +0 -440
  117. package/dist/chunk-B4BU77LT.js +0 -432
  118. package/dist/chunk-DJ433ET5.js +0 -1327
  119. package/dist/chunk-DZ42OJQC.js +0 -176
  120. package/dist/chunk-EOWMARUB.js +0 -16
  121. package/dist/chunk-FIW6WN23.js +0 -508
  122. package/dist/chunk-GAR5TQ5B.js +0 -199
  123. package/dist/chunk-PC7K4SK7.js +0 -1384
  124. package/dist/chunk-ZO6MXAS3.js +0 -69
  125. package/dist/kernel-client-ZH4PSMCN.js +0 -367
  126. package/dist/kernel-wire-B4S8pnP3.d.ts +0 -65
  127. package/dist/three/index.css +0 -503
  128. package/dist/three/index.d.ts +0 -1185
  129. package/dist/three/index.js +0 -3896
  130. package/dist/useKeyboardRouter-Dsq553Ur.d.ts +0 -42
  131. package/dist/verificationRegistry-CabxhfTv.d.ts +0 -122
@@ -1,5 +1,5 @@
1
- import { perfStore, pushPerfEntry } from './chunk-DYEKAA4L.js';
2
- import { isMotionEnabled } from './chunk-MBQAMMSE.js';
1
+ import { perfStore, pushPerfEntry } from './chunk-ZDRDJKYB.js';
2
+ import { isMotionEnabled } from './chunk-4YXBKHHM.js';
3
3
  import { useRef, useLayoutEffect, useSyncExternalStore } from 'react';
4
4
  import { ENTER_DELAY_STEPS, ENTER_ANIMATIONS, isFileValue } from '@almadar/core';
5
5
  export { getNestedValue } from '@almadar/core';
@@ -514,17 +514,27 @@ function middleSnake(a, aLo, aHi, b, bLo, bHi) {
514
514
  }
515
515
  throw new Error("computeLineDiff: no middle snake \u2014 unreachable for differing texts");
516
516
  }
517
- function usePerfBuffer() {
518
- return useSyncExternalStore(perfStore.subscribe, perfStore.getSnapshot, perfStore.getSnapshot);
517
+
518
+ // src/lib/keyMapEvent.ts
519
+ function isEditableTarget(target) {
520
+ if (!(target instanceof HTMLElement)) return false;
521
+ const tag = target.tagName;
522
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
523
+ if (target.isContentEditable || target.contentEditable === "true") return true;
524
+ const attr = target.getAttribute("contenteditable");
525
+ return attr === "" || attr === "true" || attr === "plaintext-only";
526
+ }
527
+ function keyMapCode(e) {
528
+ let code = e.code;
529
+ if (e.altKey) code = `Alt+${code}`;
530
+ if (e.shiftKey) code = `Shift+${code}`;
531
+ if (e.metaKey || e.ctrlKey) code = `Mod+${code}`;
532
+ return code;
533
+ }
534
+ function resolveKeyMapEvent(map, e) {
535
+ if (!map || isEditableTarget(e.target)) return void 0;
536
+ return map[keyMapCode(e)] ?? map[e.code];
519
537
  }
520
- var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
521
- pushPerfEntry({
522
- name: `profiler:${id}:${phase}`,
523
- durationMs: actualDuration,
524
- ts: commitTime,
525
- detail: { baseDuration }
526
- });
527
- };
528
538
 
529
539
  // src/lib/lessonSegmentUtils.ts
530
540
  function parseMarkdownWithCodeBlocks(content) {
@@ -560,6 +570,414 @@ function resolveImageUrl(value) {
560
570
  }
561
571
  return void 0;
562
572
  }
573
+ var log = createLogger("almadar:bridge");
574
+ var MAX_TRANSITIONS = 500;
575
+ function getState() {
576
+ if (typeof window !== "undefined") {
577
+ const w = window;
578
+ if (!w.__verificationRegistryState) {
579
+ w.__verificationRegistryState = {
580
+ checks: /* @__PURE__ */ new Map(),
581
+ transitions: [],
582
+ bridgeHealth: null,
583
+ listeners: /* @__PURE__ */ new Set(),
584
+ traitSnapshots: /* @__PURE__ */ new Map()
585
+ };
586
+ }
587
+ return w.__verificationRegistryState;
588
+ }
589
+ return {
590
+ checks: /* @__PURE__ */ new Map(),
591
+ transitions: [],
592
+ bridgeHealth: null,
593
+ listeners: /* @__PURE__ */ new Set(),
594
+ traitSnapshots: /* @__PURE__ */ new Map()
595
+ };
596
+ }
597
+ function notifyListeners() {
598
+ getState().listeners.forEach((l) => l());
599
+ exposeOnWindow();
600
+ }
601
+ function registerCheck(id, label, status = "pending", details) {
602
+ getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
603
+ notifyListeners();
604
+ }
605
+ function updateCheck(id, status, details) {
606
+ const check = getState().checks.get(id);
607
+ if (check) {
608
+ check.status = status;
609
+ if (details !== void 0) check.details = details;
610
+ check.updatedAt = Date.now();
611
+ } else {
612
+ getState().checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
613
+ }
614
+ notifyListeners();
615
+ }
616
+ function getAllChecks() {
617
+ return Array.from(getState().checks.values());
618
+ }
619
+ function recordTransition(trace) {
620
+ const entry = {
621
+ ...trace,
622
+ id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
623
+ };
624
+ log.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
625
+ getState().transitions.push(entry);
626
+ if (getState().transitions.length > MAX_TRANSITIONS) {
627
+ getState().transitions.shift();
628
+ }
629
+ if (entry.event === "INIT") {
630
+ const hasFetch = entry.effects.some((e) => e.type === "fetch");
631
+ const hasEntitySeed = entry.effects.some(
632
+ (e) => e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
633
+ );
634
+ const checkId = `init-fetch-${entry.traitName}`;
635
+ if (hasFetch || hasEntitySeed) {
636
+ registerCheck(
637
+ checkId,
638
+ `INIT transition for "${entry.traitName}" has fetch or entity-seed effect`,
639
+ "pass"
640
+ );
641
+ } else {
642
+ const rendersEntityData = entry.effects.some(
643
+ (e) => e.type === "render-ui" && JSON.stringify(e.args).includes("@entity.")
644
+ );
645
+ if (rendersEntityData) {
646
+ const siblingSeeds = getState().transitions.some(
647
+ (t) => t.event === "INIT" && t.effects.some(
648
+ (e) => e.type === "fetch" || e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
649
+ )
650
+ );
651
+ if (siblingSeeds) {
652
+ registerCheck(
653
+ checkId,
654
+ `INIT transition for "${entry.traitName}" has sibling entity-seed (shared entity)`,
655
+ "pass"
656
+ );
657
+ } else {
658
+ registerCheck(
659
+ checkId,
660
+ `INIT transition for "${entry.traitName}" missing fetch effect`,
661
+ "fail",
662
+ "Entity-bound render-ui without a fetch effect will show empty data"
663
+ );
664
+ }
665
+ }
666
+ }
667
+ }
668
+ const failedEffects = entry.effects.filter((e) => e.status === "failed");
669
+ if (failedEffects.length > 0) {
670
+ registerCheck(
671
+ `effects-${entry.id}`,
672
+ `Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
673
+ "fail",
674
+ failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
675
+ );
676
+ }
677
+ notifyListeners();
678
+ }
679
+ function getTransitions() {
680
+ return [...getState().transitions];
681
+ }
682
+ function getTransitionsForTrait(traitName) {
683
+ return getState().transitions.filter((t) => t.traitName === traitName);
684
+ }
685
+ function recordServerResponse(orbitalName, event, response) {
686
+ const { effectResults, ...responseFields } = response;
687
+ const serverResponse = {
688
+ ...responseFields,
689
+ orbitalName,
690
+ timestamp: Date.now()
691
+ };
692
+ const entry = {
693
+ id: `srv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
694
+ traitName: `server:${orbitalName}`,
695
+ from: "server",
696
+ to: "server",
697
+ event,
698
+ effects: effectResults ?? [],
699
+ serverResponse,
700
+ timestamp: Date.now()
701
+ };
702
+ getState().transitions.push(entry);
703
+ if (getState().transitions.length > MAX_TRANSITIONS) {
704
+ getState().transitions.shift();
705
+ }
706
+ if (!response.success && response.error) {
707
+ registerCheck(
708
+ `server-error-${entry.id}`,
709
+ `Server error for ${orbitalName}:${event}`,
710
+ "fail",
711
+ response.error
712
+ );
713
+ }
714
+ notifyListeners();
715
+ }
716
+ function serverEffectTraces(results) {
717
+ if (!results) return [];
718
+ return results.map((r) => {
719
+ const resultId = typeof r.data === "object" && r.data !== null && !Array.isArray(r.data) && "id" in r.data && typeof r.data.id === "string" ? r.data.id : void 0;
720
+ const outcome = r.denied ? "denied" : r.success ? "success" : "failed";
721
+ return {
722
+ type: r.effect,
723
+ ...r.entityType !== void 0 ? { entityName: r.entityType } : {},
724
+ ...r.action === "create" || r.action === "update" || r.action === "delete" || r.action === "batch" ? { action: r.action } : {},
725
+ ...resultId !== void 0 ? { resultId } : {},
726
+ outcome,
727
+ args: [],
728
+ status: outcome === "success" ? "executed" : "failed",
729
+ ...r.error !== void 0 ? { error: r.error } : {},
730
+ ...r.target !== void 0 ? { target: r.target } : {},
731
+ ...r.routed !== void 0 ? { routed: r.routed } : {}
732
+ };
733
+ });
734
+ }
735
+ function recordOrbitalResponse(orbitalName, request, response) {
736
+ recordServerResponse(orbitalName, request.event, {
737
+ success: response.success,
738
+ transitioned: response.transitioned,
739
+ emitted: response.emittedEvents.map((e) => ({ event: e.event, ...e.payload !== void 0 ? { payload: e.payload } : {} })),
740
+ emittedEvents: response.emittedEvents.map((e) => e.event),
741
+ clientEffects: response.clientEffectsByTrait?.length ?? 0,
742
+ dataEntities: Object.fromEntries(Object.entries(response.data ?? {}).map(([name, rows]) => [name, rows.length])),
743
+ ...response.error !== void 0 ? { error: response.error } : {},
744
+ effectResults: serverEffectTraces(response.effectResults)
745
+ });
746
+ }
747
+ function recordingTransport(transport) {
748
+ const subscribe = transport.subscribe?.bind(transport);
749
+ const subscribeHostDispatches = transport.subscribeHostDispatches?.bind(transport);
750
+ return {
751
+ ...transport.hostsBrowserStore !== void 0 ? { hostsBrowserStore: transport.hostsBrowserStore } : {},
752
+ register: (schema) => transport.register(schema),
753
+ unregister: () => transport.unregister(),
754
+ send: async (orbitalName, request) => {
755
+ const response = await transport.send(orbitalName, request);
756
+ recordOrbitalResponse(orbitalName, request, response);
757
+ return response;
758
+ },
759
+ ...subscribe !== void 0 ? { subscribe } : {},
760
+ ...subscribeHostDispatches !== void 0 ? { subscribeHostDispatches } : {}
761
+ };
762
+ }
763
+ function updateBridgeHealth(health) {
764
+ getState().bridgeHealth = { ...health };
765
+ const checkId = "server-bridge";
766
+ if (health.connected) {
767
+ registerCheck(checkId, "Server bridge connected", "pass");
768
+ } else {
769
+ registerCheck(
770
+ checkId,
771
+ "Server bridge disconnected",
772
+ "fail",
773
+ health.lastError || "Bridge is not connected"
774
+ );
775
+ }
776
+ notifyListeners();
777
+ }
778
+ function getBridgeHealth() {
779
+ const bh = getState().bridgeHealth;
780
+ return bh ? { ...bh } : null;
781
+ }
782
+ function getSummary() {
783
+ const allChecks = getAllChecks();
784
+ return {
785
+ totalChecks: allChecks.length,
786
+ passed: allChecks.filter((c) => c.status === "pass").length,
787
+ failed: allChecks.filter((c) => c.status === "fail").length,
788
+ warnings: allChecks.filter((c) => c.status === "warn").length,
789
+ pending: allChecks.filter((c) => c.status === "pending").length
790
+ };
791
+ }
792
+ function getSnapshot() {
793
+ return {
794
+ checks: getAllChecks(),
795
+ transitions: getTransitions(),
796
+ bridge: getBridgeHealth(),
797
+ summary: getSummary(),
798
+ traits: getTraitSnapshots()
799
+ };
800
+ }
801
+ function getTraitSnapshots() {
802
+ const snapshots = [];
803
+ for (const [traitName, getter] of getState().traitSnapshots.entries()) {
804
+ try {
805
+ snapshots.push(getter());
806
+ } catch (err) {
807
+ log.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
808
+ }
809
+ }
810
+ return snapshots;
811
+ }
812
+ function subscribeToVerification(listener) {
813
+ getState().listeners.add(listener);
814
+ return () => getState().listeners.delete(listener);
815
+ }
816
+ function defaultGetTraitState(traitName) {
817
+ const getter = getState().traitSnapshots.get(traitName);
818
+ if (getter === void 0) return void 0;
819
+ try {
820
+ return getter().currentState;
821
+ } catch {
822
+ return void 0;
823
+ }
824
+ }
825
+ function verifierAttached() {
826
+ return typeof window !== "undefined" && window.__ALMADAR_VERIFY__ === true;
827
+ }
828
+ function exposeOnWindow() {
829
+ if (typeof window === "undefined") return;
830
+ if (!window.__orbitalVerification) {
831
+ window.__orbitalVerification = {
832
+ getSnapshot,
833
+ getChecks: getAllChecks,
834
+ getTransitions,
835
+ getBridge: getBridgeHealth,
836
+ getSummary,
837
+ waitForTransition,
838
+ getTraitSnapshots,
839
+ getTraitState: defaultGetTraitState
840
+ };
841
+ } else {
842
+ if (!window.__orbitalVerification.getTraitSnapshots) {
843
+ window.__orbitalVerification.getTraitSnapshots = getTraitSnapshots;
844
+ }
845
+ if (!window.__orbitalVerification.getTraitState) {
846
+ window.__orbitalVerification.getTraitState = defaultGetTraitState;
847
+ }
848
+ }
849
+ }
850
+ function waitForTransition(event, timeoutMs = 1e4) {
851
+ return new Promise((resolve) => {
852
+ const existing = getState().transitions.find((t) => t.event === event);
853
+ if (existing) {
854
+ resolve(existing);
855
+ return;
856
+ }
857
+ const timeout = setTimeout(() => {
858
+ unsub();
859
+ resolve(null);
860
+ }, timeoutMs);
861
+ const unsub = subscribeToVerification(() => {
862
+ const found = getState().transitions.find((t) => t.event === event);
863
+ if (found) {
864
+ clearTimeout(timeout);
865
+ unsub();
866
+ resolve(found);
867
+ }
868
+ });
869
+ });
870
+ }
871
+ function bindEventBus(eventBus) {
872
+ if (typeof window === "undefined") return;
873
+ log.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
874
+ exposeOnWindow();
875
+ if (window.__orbitalVerification) {
876
+ window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
877
+ const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
878
+ log.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
879
+ eventBus.emit(prefixed, payload);
880
+ };
881
+ const MAX_EVENT_LOG = 5e3;
882
+ const eventLog = [];
883
+ let eventLogDropped = 0;
884
+ const bumpEpoch = () => {
885
+ window.__orbitalVerification.eventLogEpoch = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
886
+ };
887
+ window.__orbitalVerification.eventLog = eventLog;
888
+ window.__orbitalVerification.eventLogDropped = 0;
889
+ bumpEpoch();
890
+ window.__orbitalVerification.clearEventLog = () => {
891
+ eventLog.length = 0;
892
+ eventLogDropped = 0;
893
+ window.__orbitalVerification.eventLogDropped = 0;
894
+ bumpEpoch();
895
+ };
896
+ if (eventBus.onAny) {
897
+ const verificationRegistryEventLogger = (event) => {
898
+ eventLog.push({
899
+ type: event.type,
900
+ payload: event.payload,
901
+ ...event.source === void 0 ? {} : { source: event.source },
902
+ timestamp: Date.now()
903
+ });
904
+ if (eventLog.length > MAX_EVENT_LOG) {
905
+ eventLog.shift();
906
+ eventLogDropped += 1;
907
+ window.__orbitalVerification.eventLogDropped = eventLogDropped;
908
+ }
909
+ };
910
+ Object.defineProperty(verificationRegistryEventLogger, "name", {
911
+ value: "verificationRegistry:eventLog"
912
+ });
913
+ eventBus.onAny(verificationRegistryEventLogger);
914
+ }
915
+ }
916
+ }
917
+ function bindConfigApplier(applyConfig) {
918
+ if (typeof window === "undefined") return () => {
919
+ };
920
+ exposeOnWindow();
921
+ const bridge = window.__orbitalVerification;
922
+ if (!bridge) return () => {
923
+ };
924
+ bridge.applyConfig = applyConfig;
925
+ return () => {
926
+ if (bridge.applyConfig === applyConfig) delete bridge.applyConfig;
927
+ };
928
+ }
929
+ function bindTraitStateGetter(getter) {
930
+ if (typeof window === "undefined") return;
931
+ exposeOnWindow();
932
+ if (window.__orbitalVerification) {
933
+ window.__orbitalVerification.getTraitState = getter;
934
+ }
935
+ }
936
+ function registerTraitSnapshot(traitName, getter) {
937
+ if (typeof window === "undefined") return () => {
938
+ };
939
+ getState().traitSnapshots.set(traitName, getter);
940
+ exposeOnWindow();
941
+ notifyListeners();
942
+ return () => {
943
+ const s = getState();
944
+ if (s.traitSnapshots.get(traitName) === getter) {
945
+ s.traitSnapshots.delete(traitName);
946
+ notifyListeners();
947
+ }
948
+ };
949
+ }
950
+ function bindCanvasCapture(captureFn) {
951
+ if (typeof window === "undefined") return;
952
+ exposeOnWindow();
953
+ if (window.__orbitalVerification) {
954
+ window.__orbitalVerification.captureFrame = captureFn;
955
+ }
956
+ }
957
+ function bindLastDrawables(getDrawables) {
958
+ if (typeof window === "undefined") return;
959
+ exposeOnWindow();
960
+ if (window.__orbitalVerification) {
961
+ window.__orbitalVerification.getLastDrawables = getDrawables;
962
+ }
963
+ }
964
+ function updateAssetStatus(url, status) {
965
+ if (typeof window === "undefined") return;
966
+ exposeOnWindow();
967
+ if (window.__orbitalVerification) {
968
+ if (!window.__orbitalVerification.assetStatus) {
969
+ window.__orbitalVerification.assetStatus = {};
970
+ }
971
+ window.__orbitalVerification.assetStatus[url] = status;
972
+ }
973
+ }
974
+ function clearVerification() {
975
+ getState().checks.clear();
976
+ getState().transitions.length = 0;
977
+ getState().bridgeHealth = null;
978
+ notifyListeners();
979
+ }
980
+ exposeOnWindow();
563
981
 
564
982
  // src/lib/parseContentSegments.ts
565
983
  function tryParseOrbitalSchema(code) {
@@ -628,7 +1046,7 @@ function parseContentSegments(content) {
628
1046
  return segments;
629
1047
  }
630
1048
  var NAMESPACE = "almadar:ui:debug";
631
- var log = createLogger(NAMESPACE);
1049
+ var log2 = createLogger(NAMESPACE);
632
1050
  var inputLog = createLogger("almadar:ui:debug:input");
633
1051
  var collisionLog = createLogger("almadar:ui:debug:collision");
634
1052
  var physicsLog = createLogger("almadar:ui:debug:physics");
@@ -644,9 +1062,9 @@ function debug(...args) {
644
1062
  const [first, ...rest] = args;
645
1063
  const message = typeof first === "string" ? first : "<debug>";
646
1064
  if (rest.length === 0 && typeof first === "string") {
647
- log.debug(message);
1065
+ log2.debug(message);
648
1066
  } else {
649
- log.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
1067
+ log2.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
650
1068
  }
651
1069
  }
652
1070
  function debugGroup(label) {
@@ -659,13 +1077,13 @@ function debugWarn(...args) {
659
1077
  if (!gateEnabled("WARN")) return;
660
1078
  const [first, ...rest] = args;
661
1079
  const message = typeof first === "string" ? first : "<warn>";
662
- log.warn(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
1080
+ log2.warn(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
663
1081
  }
664
1082
  function debugError(...args) {
665
1083
  if (!gateEnabled("ERROR")) return;
666
1084
  const [first, ...rest] = args;
667
1085
  const message = typeof first === "string" ? first : "<error>";
668
- log.error(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
1086
+ log2.error(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
669
1087
  }
670
1088
  function debugTable(data) {
671
1089
  if (gateEnabled("DEBUG")) console.table(data);
@@ -715,19 +1133,19 @@ function toLogMetaValue(v) {
715
1133
  // src/lib/traitRegistry.ts
716
1134
  var traits = /* @__PURE__ */ new Map();
717
1135
  var listeners = /* @__PURE__ */ new Set();
718
- function notifyListeners() {
1136
+ function notifyListeners2() {
719
1137
  listeners.forEach((listener) => listener());
720
1138
  }
721
1139
  function registerTrait(info) {
722
1140
  traits.set(info.id, info);
723
- notifyListeners();
1141
+ notifyListeners2();
724
1142
  }
725
1143
  function updateTraitState(id, newState) {
726
1144
  const trait = traits.get(id);
727
1145
  if (trait) {
728
1146
  trait.currentState = newState;
729
1147
  trait.transitionCount++;
730
- notifyListeners();
1148
+ notifyListeners2();
731
1149
  }
732
1150
  }
733
1151
  function updateGuardResult(traitId, guardName, result) {
@@ -736,13 +1154,13 @@ function updateGuardResult(traitId, guardName, result) {
736
1154
  const guard = trait.guards.find((g) => g.name === guardName);
737
1155
  if (guard) {
738
1156
  guard.lastResult = result;
739
- notifyListeners();
1157
+ notifyListeners2();
740
1158
  }
741
1159
  }
742
1160
  }
743
1161
  function unregisterTrait(id) {
744
1162
  traits.delete(id);
745
- notifyListeners();
1163
+ notifyListeners2();
746
1164
  }
747
1165
  function getAllTraits() {
748
1166
  return Array.from(traits.values());
@@ -756,18 +1174,29 @@ function subscribeToTraitChanges(listener) {
756
1174
  }
757
1175
  function clearTraits() {
758
1176
  traits.clear();
759
- notifyListeners();
1177
+ notifyListeners2();
760
1178
  }
1179
+ function usePerfBuffer() {
1180
+ return useSyncExternalStore(perfStore.subscribe, perfStore.getSnapshot, perfStore.getSnapshot);
1181
+ }
1182
+ var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
1183
+ pushPerfEntry({
1184
+ name: `profiler:${id}:${phase}`,
1185
+ durationMs: actualDuration,
1186
+ ts: commitTime,
1187
+ detail: { baseDuration }
1188
+ });
1189
+ };
761
1190
 
762
1191
  // src/lib/tickRegistry.ts
763
1192
  var ticks = /* @__PURE__ */ new Map();
764
1193
  var listeners2 = /* @__PURE__ */ new Set();
765
- function notifyListeners2() {
1194
+ function notifyListeners3() {
766
1195
  listeners2.forEach((listener) => listener());
767
1196
  }
768
1197
  function registerTick(tick) {
769
1198
  ticks.set(tick.id, tick);
770
- notifyListeners2();
1199
+ notifyListeners3();
771
1200
  }
772
1201
  function updateTickExecution(id, timestamp) {
773
1202
  const tick = ticks.get(id);
@@ -775,19 +1204,19 @@ function updateTickExecution(id, timestamp) {
775
1204
  tick.lastExecuted = timestamp;
776
1205
  tick.nextExecution = timestamp + tick.interval;
777
1206
  tick.executionCount++;
778
- notifyListeners2();
1207
+ notifyListeners3();
779
1208
  }
780
1209
  }
781
1210
  function setTickActive(id, isActive) {
782
1211
  const tick = ticks.get(id);
783
1212
  if (tick) {
784
1213
  tick.isActive = isActive;
785
- notifyListeners2();
1214
+ notifyListeners3();
786
1215
  }
787
1216
  }
788
1217
  function unregisterTick(id) {
789
1218
  ticks.delete(id);
790
- notifyListeners2();
1219
+ notifyListeners3();
791
1220
  }
792
1221
  function getAllTicks() {
793
1222
  return Array.from(ticks.values());
@@ -801,14 +1230,14 @@ function subscribeToTickChanges(listener) {
801
1230
  }
802
1231
  function clearTicks() {
803
1232
  ticks.clear();
804
- notifyListeners2();
1233
+ notifyListeners3();
805
1234
  }
806
1235
 
807
1236
  // src/lib/guardRegistry.ts
808
1237
  var guardHistory = [];
809
1238
  var listeners3 = /* @__PURE__ */ new Set();
810
1239
  var MAX_HISTORY = 100;
811
- function notifyListeners3() {
1240
+ function notifyListeners4() {
812
1241
  listeners3.forEach((listener) => listener());
813
1242
  }
814
1243
  function recordGuardEvaluation(evaluation) {
@@ -821,7 +1250,7 @@ function recordGuardEvaluation(evaluation) {
821
1250
  if (guardHistory.length > MAX_HISTORY) {
822
1251
  guardHistory.pop();
823
1252
  }
824
- notifyListeners3();
1253
+ notifyListeners4();
825
1254
  }
826
1255
  function getGuardHistory() {
827
1256
  return [...guardHistory];
@@ -838,7 +1267,7 @@ function subscribeToGuardChanges(listener) {
838
1267
  }
839
1268
  function clearGuardHistory() {
840
1269
  guardHistory.length = 0;
841
- notifyListeners3();
1270
+ notifyListeners4();
842
1271
  }
843
1272
 
844
1273
  // src/lib/entityDebug.ts
@@ -880,7 +1309,7 @@ function getEntitiesByType(type) {
880
1309
  var events = [];
881
1310
  var listeners4 = /* @__PURE__ */ new Set();
882
1311
  var MAX_EVENTS = 500;
883
- function notifyListeners4() {
1312
+ function notifyListeners5() {
884
1313
  listeners4.forEach((listener) => listener());
885
1314
  }
886
1315
  function logDebugEvent(type, source, message, data) {
@@ -896,7 +1325,7 @@ function logDebugEvent(type, source, message, data) {
896
1325
  if (events.length > MAX_EVENTS) {
897
1326
  events.pop();
898
1327
  }
899
- notifyListeners4();
1328
+ notifyListeners5();
900
1329
  }
901
1330
  function logStateChange(source, from, to, event) {
902
1331
  logDebugEvent("state-change", source, `${from} \u2192 ${to}`, { from, to, event: event ?? null });
@@ -934,7 +1363,7 @@ function subscribeToDebugEvents(listener) {
934
1363
  }
935
1364
  function clearDebugEvents() {
936
1365
  events.length = 0;
937
- notifyListeners4();
1366
+ notifyListeners5();
938
1367
  }
939
1368
 
940
1369
  // src/lib/debugUtils.ts
@@ -1048,4 +1477,4 @@ function parseLessonSegments(lesson) {
1048
1477
  return segments;
1049
1478
  }
1050
1479
 
1051
- export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, applyMotion, applyOperator, asEnterAnimation, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, enterClassName, getAllTicks, getAllTraits, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditorMotion, isEditorOperator, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, profilerOnRender, recordGuardEvaluation, registerTick, registerTrait, resolveImageUrl, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, useSlotEnterRestart };
1480
+ export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, applyMotion, applyOperator, asEnterAnimation, bindCanvasCapture, bindConfigApplier, bindEventBus, bindLastDrawables, bindTraitStateGetter, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, clearVerification, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, enterClassName, getAllChecks, getAllTicks, getAllTraits, getBridgeHealth, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getSnapshot, getSummary, getTick, getTrait, getTraitSnapshots, getTransitions, getTransitionsForTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditableTarget, isEditorMotion, isEditorOperator, keyMapCode, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, profilerOnRender, recordGuardEvaluation, recordOrbitalResponse, recordServerResponse, recordTransition, recordingTransport, registerCheck, registerTick, registerTrait, registerTraitSnapshot, resolveImageUrl, resolveKeyMapEvent, serverEffectTraces, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, subscribeToVerification, toggleDebug, unregisterTick, unregisterTrait, updateAssetStatus, updateBridgeHealth, updateCheck, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, useSlotEnterRestart, verifierAttached, waitForTransition };
@@ -1,5 +1,5 @@
1
- import { FileTree } from './chunk-YDNJLLG6.js';
2
- import { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, traitTransitionRenderUi } from './chunk-VFF5OO47.js';
1
+ import { FileTree } from './chunk-57DC34LY.js';
2
+ import { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, traitTransitionRenderUi } from './chunk-PCR37T3U.js';
3
3
  import { useMemo } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5