@almadar/ui 5.112.0 → 5.114.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
@@ -11,6 +11,7 @@ import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCirc
11
11
  import { createPortal } from 'react-dom';
12
12
  import { UISlotProvider, useUISlots, useTheme } from '@almadar/ui/context';
13
13
  import { evaluateGuard, evaluate, createMinimalContext, executeEffects } from '@almadar/evaluator';
14
+ import { prepareSchemaForPreview, collectTraitRefsFromResolvedTrait, buildOrbitalsByTrait, collectEmbeddedTraits, wrapCallbackForEvent, pushPerfEntry, perfStart, perfEnd } from '@almadar/runtime/ui';
14
15
  import { Link, Outlet, useLocation } from 'react-router-dom';
15
16
  import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
16
17
  import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js';
@@ -35,13 +36,14 @@ import ReactMarkdown from 'react-markdown';
35
36
  import remarkGfm from 'remark-gfm';
36
37
  import remarkMath from 'remark-math';
37
38
  import rehypeKatex from 'rehype-katex';
38
- import { FieldTypeSchema, isInlineTrait, isPageReference, isEntityCall, schemaToIR, getPage, isCircuitEvent, walkSExpr, mergeEntityFrame } from '@almadar/core';
39
+ import { FieldTypeSchema, isInlineTrait, isPageReference, buildResolvedTraitConfigs, schemaToIR, getPage, isCircuitEvent, walkSExpr, mergeEntityFrame, isSExpr, isEventPayloadValue } from '@almadar/core';
39
40
  import { useDroppable, useDraggable, DndContext, DragOverlay, useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
40
41
  import { sortableKeyboardCoordinates, useSortable, arrayMove, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
42
  import { CSS } from '@dnd-kit/utilities';
42
43
  import { isDrawHostPattern, getPatternDefinition, getComponentForPattern as getComponentForPattern$1, isEntityAwarePattern } from '@almadar/core/patterns';
43
44
  import { OrbitalServerRuntime } from '@almadar/runtime/OrbitalServerRuntime';
44
- import { InMemoryPersistence, StateMachineManager, collectDeclaredConfigDefaults, createServerEffectHandlers, EffectExecutor, createContextFromBindings, createTickScheduler, isValidCronExpression, parseDurationString, normalizeCallSiteConfigToValues } from '@almadar/runtime';
45
+ import { isKnownStdOperator } from '@almadar/std/registry';
46
+ import { InMemoryPersistence, StateMachineManager, collectDeclaredConfigDefaults, resolveCallSitePayloadCaptures, createServerEffectHandlers, EffectExecutor, createContextFromBindings, createTickScheduler, isValidCronExpression, parseDurationString, normalizeCallSiteConfigToValues } from '@almadar/runtime';
45
47
 
46
48
  var __defProp = Object.defineProperty;
47
49
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -4485,41 +4487,6 @@ function kebabToPascal(name) {
4485
4487
  return part.charAt(0).toUpperCase() + part.slice(1);
4486
4488
  }).join("");
4487
4489
  }
4488
- function loadLib(key, importer) {
4489
- let p = libPromises.get(key);
4490
- if (!p) {
4491
- p = importer();
4492
- libPromises.set(key, p);
4493
- }
4494
- return p;
4495
- }
4496
- function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
4497
- const Lazy = React90__default.lazy(async () => {
4498
- const lib = await loadLib(libKey, importer);
4499
- const Comp = pick(lib);
4500
- if (!Comp) {
4501
- warnFallback(fallbackName, family);
4502
- return { default: makeLucideAdapter(fallbackName, true) };
4503
- }
4504
- return { default: Comp };
4505
- });
4506
- const Wrapped = (props) => /* @__PURE__ */ jsx(
4507
- React90__default.Suspense,
4508
- {
4509
- fallback: /* @__PURE__ */ jsx(
4510
- "span",
4511
- {
4512
- "aria-hidden": true,
4513
- className: props.className,
4514
- style: { display: "inline-block", ...props.style }
4515
- }
4516
- ),
4517
- children: /* @__PURE__ */ jsx(Lazy, { ...props })
4518
- }
4519
- );
4520
- Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
4521
- return Wrapped;
4522
- }
4523
4490
  function isComponentLike(v) {
4524
4491
  return v != null && (typeof v === "function" || typeof v === "object");
4525
4492
  }
@@ -4533,146 +4500,32 @@ function resolveLucide(name) {
4533
4500
  if (isComponentLike(asIs)) return asIs;
4534
4501
  return LucideIcons2.HelpCircle;
4535
4502
  }
4536
- function resolvePhosphor(name, weight, family) {
4537
- const target = phosphorAliases[name] ?? kebabToPascal(name);
4538
- return lazyFamilyIcon(
4539
- "phosphor",
4540
- () => import('@phosphor-icons/react'),
4541
- (lib) => {
4542
- const PhosphorComp = lib[target];
4543
- if (!PhosphorComp) return null;
4544
- const Component = PhosphorComp;
4545
- const Adapter = (props) => /* @__PURE__ */ jsx(
4546
- Component,
4547
- {
4548
- weight,
4549
- className: props.className,
4550
- style: props.style,
4551
- size: props.size ?? "1em"
4552
- }
4553
- );
4554
- Adapter.displayName = `Phosphor.${target}.${weight}`;
4555
- return Adapter;
4556
- },
4557
- name,
4558
- family
4559
- );
4560
- }
4561
- function resolveTabler(name, family) {
4562
- const suffix = tablerAliases[name] ?? kebabToPascal(name);
4563
- const target = `Icon${suffix}`;
4564
- return lazyFamilyIcon(
4565
- "tabler",
4566
- () => import('@tabler/icons-react'),
4567
- (lib) => {
4568
- const TablerComp = lib[target];
4569
- if (!TablerComp) return null;
4570
- const Component = TablerComp;
4571
- const Adapter = (props) => /* @__PURE__ */ jsx(
4572
- Component,
4573
- {
4574
- stroke: props.strokeWidth ?? 1.5,
4575
- className: props.className,
4576
- style: props.style,
4577
- size: props.size ?? 24
4578
- }
4579
- );
4580
- Adapter.displayName = `Tabler.${target}`;
4581
- return Adapter;
4582
- },
4583
- name,
4584
- family
4585
- );
4586
- }
4587
- function resolveFa(name, family) {
4588
- const suffix = faAliases[name] ?? kebabToPascal(name);
4589
- const target = `Fa${suffix}`;
4590
- return lazyFamilyIcon(
4591
- "fa",
4592
- () => import('react-icons/fa'),
4593
- (lib) => {
4594
- const FaComp = lib[target];
4595
- if (!FaComp) return null;
4596
- const Component = FaComp;
4597
- const Adapter = (props) => /* @__PURE__ */ jsx(
4598
- Component,
4599
- {
4600
- className: props.className,
4601
- style: props.style,
4602
- size: props.size ?? "1em"
4603
- }
4604
- );
4605
- Adapter.displayName = `Fa.${target}`;
4606
- return Adapter;
4607
- },
4608
- name,
4609
- family
4610
- );
4611
- }
4612
- function warnFallback(name, family) {
4613
- const key = `${family}::${name}`;
4614
- if (warned.has(key)) return;
4615
- warned.add(key);
4616
- if (typeof console !== "undefined") {
4617
- console.warn(
4618
- `[iconFamily] No '${name}' mapping in family '${family}'; falling back to lucide. Add an alias in lib/iconFamily.ts.`
4619
- );
4620
- }
4621
- }
4622
- function makeLucideAdapter(name, isFallback = false) {
4503
+ function makeLucideAdapter(name) {
4623
4504
  const LucideComp = resolveLucide(name);
4624
- const Adapter = (props) => {
4625
- const stroke = props.strokeWidth ?? (isFallback ? 2 : void 0);
4626
- const style = isFallback ? { ...props.style ?? {}, strokeWidth: stroke ?? 2 } : props.style;
4627
- return /* @__PURE__ */ jsx(
4628
- LucideComp,
4629
- {
4630
- className: props.className,
4631
- strokeWidth: stroke,
4632
- style,
4633
- size: props.size
4634
- }
4635
- );
4636
- };
4637
- Adapter.displayName = `Lucide.${name}${isFallback ? ".fallback" : ""}`;
4505
+ const Adapter = (props) => /* @__PURE__ */ jsx(
4506
+ LucideComp,
4507
+ {
4508
+ className: props.className,
4509
+ strokeWidth: props.strokeWidth,
4510
+ style: props.style,
4511
+ size: props.size
4512
+ }
4513
+ );
4514
+ Adapter.displayName = `Lucide.${name}`;
4638
4515
  return Adapter;
4639
4516
  }
4640
- function resolveIconForFamily(name, family) {
4641
- switch (family) {
4642
- case "lucide":
4643
- return makeLucideAdapter(name, false);
4644
- // Non-lucide families resolve to a lazy, Suspense-wrapped component that
4645
- // dynamic-imports the library on first render and falls back to lucide
4646
- // internally when the family lacks the icon (see lazyFamilyIcon).
4647
- case "phosphor-outline":
4648
- return resolvePhosphor(name, "regular", family);
4649
- case "phosphor-fill":
4650
- return resolvePhosphor(name, "fill", family);
4651
- case "phosphor-duotone":
4652
- return resolvePhosphor(name, "duotone", family);
4653
- case "tabler":
4654
- return resolveTabler(name, family);
4655
- case "fa-solid":
4656
- return resolveFa(name, family);
4657
- }
4658
- }
4659
- var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, libPromises, lucideAliases, phosphorAliases, tablerAliases, faAliases, warned;
4517
+ function resolveIconForFamily(name, _family) {
4518
+ return makeLucideAdapter(name);
4519
+ }
4520
+ var DEFAULT_FAMILY, VALID_FAMILIES, cachedFamily, listeners, observer, lucideAliases;
4660
4521
  var init_iconFamily = __esm({
4661
4522
  "lib/iconFamily.tsx"() {
4662
4523
  "use client";
4663
4524
  DEFAULT_FAMILY = "lucide";
4664
- VALID_FAMILIES = [
4665
- "lucide",
4666
- "phosphor-outline",
4667
- "phosphor-fill",
4668
- "phosphor-duotone",
4669
- "tabler",
4670
- "fa-solid"
4671
- ];
4525
+ VALID_FAMILIES = [DEFAULT_FAMILY];
4672
4526
  cachedFamily = null;
4673
4527
  listeners = /* @__PURE__ */ new Set();
4674
4528
  observer = null;
4675
- libPromises = /* @__PURE__ */ new Map();
4676
4529
  lucideAliases = {
4677
4530
  close: LucideIcons2.X,
4678
4531
  trash: LucideIcons2.Trash2,
@@ -4685,478 +4538,6 @@ var init_iconFamily = __esm({
4685
4538
  "sort-asc": LucideIcons2.ArrowUpNarrowWide,
4686
4539
  "sort-desc": LucideIcons2.ArrowDownNarrowWide
4687
4540
  };
4688
- phosphorAliases = {
4689
- // lucide name → phosphor PascalCase name
4690
- // Actions
4691
- plus: "Plus",
4692
- minus: "Minus",
4693
- x: "X",
4694
- check: "Check",
4695
- close: "X",
4696
- edit: "PencilSimple",
4697
- pencil: "PencilSimple",
4698
- trash: "Trash",
4699
- save: "FloppyDisk",
4700
- copy: "Copy",
4701
- share: "Share",
4702
- send: "PaperPlaneRight",
4703
- download: "DownloadSimple",
4704
- upload: "UploadSimple",
4705
- archive: "Archive",
4706
- refresh: "ArrowsClockwise",
4707
- loader: "CircleNotch",
4708
- link: "Link",
4709
- paperclip: "Paperclip",
4710
- // Navigation
4711
- "chevron-down": "CaretDown",
4712
- "chevron-up": "CaretUp",
4713
- "chevron-left": "CaretLeft",
4714
- "chevron-right": "CaretRight",
4715
- "arrow-up": "ArrowUp",
4716
- "arrow-down": "ArrowDown",
4717
- "arrow-left": "ArrowLeft",
4718
- "arrow-right": "ArrowRight",
4719
- menu: "List",
4720
- more: "DotsThree",
4721
- "more-vertical": "DotsThreeVertical",
4722
- "more-horizontal": "DotsThree",
4723
- external: "ArrowSquareOut",
4724
- "external-link": "ArrowSquareOut",
4725
- // Files
4726
- file: "File",
4727
- "file-text": "FileText",
4728
- "file-plus": "FilePlus",
4729
- "file-minus": "FileMinus",
4730
- folder: "Folder",
4731
- "folder-open": "FolderOpen",
4732
- document: "FileText",
4733
- // Charts
4734
- "bar-chart": "ChartBar",
4735
- "bar-chart-2": "ChartBar",
4736
- "bar-chart-3": "ChartBar",
4737
- "line-chart": "ChartLine",
4738
- "pie-chart": "ChartPie",
4739
- activity: "Pulse",
4740
- "trending-up": "TrendUp",
4741
- "trending-down": "TrendDown",
4742
- // Messages
4743
- message: "ChatCircle",
4744
- "message-circle": "ChatCircle",
4745
- "message-square": "ChatText",
4746
- "messages-square": "ChatsCircle",
4747
- comment: "ChatCircle",
4748
- comments: "ChatsCircle",
4749
- inbox: "Tray",
4750
- mail: "Envelope",
4751
- envelope: "Envelope",
4752
- // Status
4753
- "alert-circle": "WarningCircle",
4754
- "alert-triangle": "Warning",
4755
- "check-circle": "CheckCircle",
4756
- "x-circle": "XCircle",
4757
- info: "Info",
4758
- "help-circle": "Question",
4759
- "life-buoy": "Lifebuoy",
4760
- lifebuoy: "Lifebuoy",
4761
- warning: "Warning",
4762
- error: "WarningCircle",
4763
- // Media
4764
- image: "Image",
4765
- video: "VideoCamera",
4766
- film: "FilmStrip",
4767
- camera: "Camera",
4768
- music: "MusicNote",
4769
- play: "Play",
4770
- pause: "Pause",
4771
- stop: "Stop",
4772
- "skip-forward": "SkipForward",
4773
- "skip-back": "SkipBack",
4774
- volume: "SpeakerHigh",
4775
- "volume-2": "SpeakerHigh",
4776
- "volume-x": "SpeakerX",
4777
- mic: "Microphone",
4778
- "mic-off": "MicrophoneSlash",
4779
- // People
4780
- user: "User",
4781
- users: "Users",
4782
- "user-plus": "UserPlus",
4783
- "user-check": "UserCheck",
4784
- // Time
4785
- calendar: "Calendar",
4786
- clock: "Clock",
4787
- timer: "Timer",
4788
- // Location
4789
- map: "MapTrifold",
4790
- "map-pin": "MapPin",
4791
- navigation: "NavigationArrow",
4792
- compass: "Compass",
4793
- globe: "Globe",
4794
- target: "Target",
4795
- // Project / layout
4796
- kanban: "Kanban",
4797
- list: "List",
4798
- table: "Table",
4799
- grid: "GridFour",
4800
- layout: "Layout",
4801
- columns: "Columns",
4802
- rows: "Rows",
4803
- // Misc
4804
- bell: "Bell",
4805
- bookmark: "Bookmark",
4806
- briefcase: "Briefcase",
4807
- flag: "Flag",
4808
- tag: "Tag",
4809
- tags: "Tag",
4810
- star: "Star",
4811
- heart: "Heart",
4812
- home: "House",
4813
- settings: "Gear",
4814
- eye: "Eye",
4815
- "eye-off": "EyeSlash",
4816
- lock: "Lock",
4817
- unlock: "LockOpen",
4818
- key: "Key",
4819
- shield: "Shield",
4820
- search: "MagnifyingGlass",
4821
- filter: "Funnel",
4822
- "sort-asc": "SortAscending",
4823
- "sort-desc": "SortDescending",
4824
- zap: "Lightning",
4825
- sparkles: "Sparkle",
4826
- // Code
4827
- code: "Code",
4828
- terminal: "Terminal",
4829
- database: "Database",
4830
- server: "HardDrives",
4831
- cloud: "Cloud",
4832
- wifi: "WifiHigh",
4833
- package: "Package",
4834
- box: "Package",
4835
- // Theme
4836
- sun: "Sun",
4837
- moon: "Moon",
4838
- // Phone
4839
- phone: "Phone",
4840
- printer: "Printer",
4841
- // Hierarchy
4842
- tree: "Tree",
4843
- network: "Network"
4844
- };
4845
- tablerAliases = {
4846
- // lucide name → tabler suffix (after the `Icon` prefix)
4847
- // Actions
4848
- plus: "Plus",
4849
- minus: "Minus",
4850
- x: "X",
4851
- check: "Check",
4852
- close: "X",
4853
- edit: "Pencil",
4854
- pencil: "Pencil",
4855
- trash: "Trash",
4856
- save: "DeviceFloppy",
4857
- copy: "Copy",
4858
- share: "Share",
4859
- send: "Send",
4860
- download: "Download",
4861
- upload: "Upload",
4862
- archive: "Archive",
4863
- refresh: "Refresh",
4864
- loader: "Loader2",
4865
- link: "Link",
4866
- paperclip: "Paperclip",
4867
- external: "ExternalLink",
4868
- "external-link": "ExternalLink",
4869
- // Navigation
4870
- "chevron-down": "ChevronDown",
4871
- "chevron-up": "ChevronUp",
4872
- "chevron-left": "ChevronLeft",
4873
- "chevron-right": "ChevronRight",
4874
- "arrow-down": "ArrowDown",
4875
- "arrow-up": "ArrowUp",
4876
- "arrow-left": "ArrowLeft",
4877
- "arrow-right": "ArrowRight",
4878
- menu: "Menu2",
4879
- more: "Dots",
4880
- "more-vertical": "DotsVertical",
4881
- // Files
4882
- file: "File",
4883
- "file-text": "FileText",
4884
- "file-plus": "FilePlus",
4885
- "file-check": "FileCheck",
4886
- "file-minus": "FileMinus",
4887
- folder: "Folder",
4888
- "folder-open": "FolderOpen",
4889
- document: "FileText",
4890
- // Charts
4891
- "bar-chart": "ChartBar",
4892
- "bar-chart-2": "ChartBar",
4893
- "bar-chart-3": "ChartBar",
4894
- "line-chart": "ChartLine",
4895
- "pie-chart": "ChartPie",
4896
- activity: "Activity",
4897
- "trending-up": "TrendingUp",
4898
- "trending-down": "TrendingDown",
4899
- // Messages
4900
- message: "Message",
4901
- "message-circle": "MessageCircle",
4902
- "message-square": "Message2",
4903
- "messages-square": "Messages",
4904
- comment: "Message",
4905
- comments: "Messages",
4906
- inbox: "Inbox",
4907
- mail: "Mail",
4908
- envelope: "Mail",
4909
- // Status
4910
- "alert-circle": "AlertCircle",
4911
- "alert-triangle": "AlertTriangle",
4912
- "check-circle": "CircleCheck",
4913
- "x-circle": "CircleX",
4914
- info: "InfoCircle",
4915
- "help-circle": "HelpCircle",
4916
- "life-buoy": "Lifebuoy",
4917
- warning: "AlertTriangle",
4918
- error: "AlertOctagon",
4919
- // Media
4920
- image: "Photo",
4921
- video: "Video",
4922
- camera: "Camera",
4923
- music: "Music",
4924
- play: "PlayerPlay",
4925
- pause: "PlayerPause",
4926
- stop: "PlayerStop",
4927
- "skip-forward": "PlayerSkipForward",
4928
- "skip-back": "PlayerSkipBack",
4929
- volume: "Volume",
4930
- "volume-2": "Volume",
4931
- "volume-x": "VolumeOff",
4932
- mic: "Microphone",
4933
- "mic-off": "MicrophoneOff",
4934
- // People
4935
- user: "User",
4936
- users: "Users",
4937
- "user-plus": "UserPlus",
4938
- "user-check": "UserCheck",
4939
- // Time
4940
- calendar: "Calendar",
4941
- clock: "Clock",
4942
- timer: "Hourglass",
4943
- // Location
4944
- map: "Map",
4945
- "map-pin": "MapPin",
4946
- navigation: "Navigation",
4947
- compass: "Compass",
4948
- globe: "World",
4949
- target: "Target",
4950
- // Project / layout
4951
- kanban: "LayoutKanban",
4952
- list: "List",
4953
- table: "Table",
4954
- grid: "LayoutGrid",
4955
- layout: "Layout",
4956
- columns: "LayoutColumns",
4957
- rows: "LayoutRows",
4958
- // Misc
4959
- bell: "Bell",
4960
- bookmark: "Bookmark",
4961
- briefcase: "Briefcase",
4962
- flag: "Flag",
4963
- tag: "Tag",
4964
- tags: "Tags",
4965
- star: "Star",
4966
- heart: "Heart",
4967
- home: "Home",
4968
- settings: "Settings",
4969
- eye: "Eye",
4970
- "eye-off": "EyeOff",
4971
- lock: "Lock",
4972
- unlock: "LockOpen",
4973
- key: "Key",
4974
- shield: "Shield",
4975
- search: "Search",
4976
- filter: "Filter",
4977
- "sort-asc": "SortAscending",
4978
- "sort-desc": "SortDescending",
4979
- zap: "Bolt",
4980
- sparkles: "Sparkles",
4981
- // Code / data
4982
- code: "Code",
4983
- terminal: "Terminal",
4984
- database: "Database",
4985
- server: "Server",
4986
- cloud: "Cloud",
4987
- wifi: "Wifi",
4988
- package: "Package",
4989
- box: "Box",
4990
- // Theme
4991
- sun: "Sun",
4992
- moon: "Moon",
4993
- // Phone
4994
- phone: "Phone",
4995
- printer: "Printer",
4996
- // Hierarchy
4997
- tree: "Hierarchy",
4998
- network: "Network"
4999
- };
5000
- faAliases = {
5001
- // lucide name → fa-solid suffix (after the `Fa` prefix).
5002
- // react-icons/fa ships FontAwesome 5 — names like `FaFileText` don't exist
5003
- // (FA renamed to `FaFileAlt`). When you see a console.warn from
5004
- // [iconFamily] about an unmapped lucide name in this family, add the
5005
- // closest FA5 sibling here so the fallback stays in-family.
5006
- search: "Search",
5007
- close: "Times",
5008
- x: "Times",
5009
- loader: "Spinner",
5010
- refresh: "Sync",
5011
- "sort-asc": "SortAmountUp",
5012
- "sort-desc": "SortAmountDown",
5013
- "chevron-down": "ChevronDown",
5014
- "chevron-up": "ChevronUp",
5015
- "chevron-left": "ChevronLeft",
5016
- "chevron-right": "ChevronRight",
5017
- "help-circle": "QuestionCircle",
5018
- "alert-triangle": "ExclamationTriangle",
5019
- "alert-circle": "ExclamationCircle",
5020
- "check-circle": "CheckCircle",
5021
- "x-circle": "TimesCircle",
5022
- edit: "Edit",
5023
- pencil: "PencilAlt",
5024
- trash: "Trash",
5025
- send: "PaperPlane",
5026
- share: "ShareAlt",
5027
- external: "ExternalLinkAlt",
5028
- plus: "Plus",
5029
- minus: "Minus",
5030
- check: "Check",
5031
- star: "Star",
5032
- heart: "Heart",
5033
- home: "Home",
5034
- user: "User",
5035
- users: "Users",
5036
- "user-plus": "UserPlus",
5037
- "user-check": "UserCheck",
5038
- settings: "Cog",
5039
- menu: "Bars",
5040
- "arrow-up": "ArrowUp",
5041
- "arrow-down": "ArrowDown",
5042
- "arrow-left": "ArrowLeft",
5043
- "arrow-right": "ArrowRight",
5044
- copy: "Copy",
5045
- download: "Download",
5046
- upload: "Upload",
5047
- filter: "Filter",
5048
- calendar: "Calendar",
5049
- clock: "Clock",
5050
- bell: "Bell",
5051
- mail: "Envelope",
5052
- envelope: "Envelope",
5053
- lock: "Lock",
5054
- unlock: "LockOpen",
5055
- eye: "Eye",
5056
- "eye-off": "EyeSlash",
5057
- more: "EllipsisH",
5058
- "more-vertical": "EllipsisV",
5059
- info: "InfoCircle",
5060
- warning: "ExclamationTriangle",
5061
- error: "ExclamationCircle",
5062
- // Time
5063
- timer: "Hourglass",
5064
- // Files (FA renamed FileText → FileAlt)
5065
- file: "File",
5066
- "file-text": "FileAlt",
5067
- "file-plus": "FileMedical",
5068
- "file-minus": "FileExcel",
5069
- "file-check": "FileSignature",
5070
- document: "FileAlt",
5071
- // Charts (lucide BarChart2 / BarChart3 → FA ChartBar)
5072
- "bar-chart": "ChartBar",
5073
- "bar-chart-2": "ChartBar",
5074
- "bar-chart-3": "ChartBar",
5075
- "line-chart": "ChartLine",
5076
- "pie-chart": "ChartPie",
5077
- activity: "ChartLine",
5078
- "trending-up": "ChartLine",
5079
- "trending-down": "ChartLine",
5080
- // Messages (lucide MessageCircle/MessageSquare → FA CommentDots/CommentAlt)
5081
- message: "Comment",
5082
- "message-circle": "CommentDots",
5083
- "message-square": "CommentAlt",
5084
- "messages-square": "Comments",
5085
- comment: "Comment",
5086
- comments: "Comments",
5087
- inbox: "Inbox",
5088
- // Support / help
5089
- "life-buoy": "LifeRing",
5090
- lifebuoy: "LifeRing",
5091
- // Project / kanban (FA has no kanban; closest semantic is Tasks/Columns)
5092
- kanban: "Tasks",
5093
- columns: "Columns",
5094
- rows: "Bars",
5095
- layout: "ThLarge",
5096
- grid: "Th",
5097
- list: "List",
5098
- table: "Table",
5099
- // Storage / folders
5100
- folder: "Folder",
5101
- "folder-open": "FolderOpen",
5102
- archive: "Archive",
5103
- bookmark: "Bookmark",
5104
- briefcase: "Briefcase",
5105
- package: "Box",
5106
- box: "Box",
5107
- // Map / location
5108
- map: "Map",
5109
- "map-pin": "MapMarkerAlt",
5110
- navigation: "LocationArrow",
5111
- compass: "Compass",
5112
- globe: "Globe",
5113
- target: "Bullseye",
5114
- // Media
5115
- image: "Image",
5116
- video: "Video",
5117
- film: "Film",
5118
- camera: "Camera",
5119
- music: "Music",
5120
- play: "Play",
5121
- pause: "Pause",
5122
- stop: "Stop",
5123
- "skip-forward": "Forward",
5124
- "skip-back": "Backward",
5125
- volume: "VolumeUp",
5126
- "volume-2": "VolumeUp",
5127
- "volume-x": "VolumeMute",
5128
- mic: "Microphone",
5129
- "mic-off": "MicrophoneSlash",
5130
- phone: "Phone",
5131
- // Code / data
5132
- code: "Code",
5133
- terminal: "Terminal",
5134
- database: "Database",
5135
- server: "Server",
5136
- cloud: "Cloud",
5137
- wifi: "Wifi",
5138
- // Security
5139
- shield: "ShieldAlt",
5140
- key: "Key",
5141
- // Misc actions
5142
- printer: "Print",
5143
- save: "Save",
5144
- link: "Link",
5145
- unlink: "Unlink",
5146
- paperclip: "Paperclip",
5147
- flag: "Flag",
5148
- tag: "Tag",
5149
- tags: "Tags",
5150
- zap: "Bolt",
5151
- sparkles: "Magic",
5152
- // Theme
5153
- sun: "Sun",
5154
- moon: "Moon",
5155
- // Hierarchy (FA has no Tree icon for hierarchies; Sitemap is the org-chart icon)
5156
- tree: "Sitemap",
5157
- network: "NetworkWired"
5158
- };
5159
- warned = /* @__PURE__ */ new Set();
5160
4541
  }
5161
4542
  });
5162
4543
  function kebabToPascal2(name) {
@@ -5237,7 +4618,7 @@ var init_Icon = __esm({
5237
4618
  const family = useIconFamily();
5238
4619
  const RenderedComponent = React90__default.useMemo(() => {
5239
4620
  if (directIcon) return null;
5240
- return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
4621
+ return effectiveName ? resolveIconForFamily(effectiveName) : null;
5241
4622
  }, [directIcon, effectiveName, family]);
5242
4623
  const effectiveStrokeWidth = strokeWidth ?? void 0;
5243
4624
  const inlineStyle = {
@@ -5616,7 +4997,7 @@ var init_Button = __esm({
5616
4997
  ref,
5617
4998
  disabled: disabled || isLoading,
5618
4999
  className: cn(
5619
- "inline-flex items-center justify-center gap-2",
5000
+ "relative inline-flex items-center justify-center gap-2",
5620
5001
  "font-medium",
5621
5002
  "rounded-sm",
5622
5003
  "cursor-pointer",
@@ -7266,6 +6647,7 @@ var init_Input = __esm({
7266
6647
  icon: iconProp,
7267
6648
  clearable,
7268
6649
  onClear,
6650
+ action,
7269
6651
  value,
7270
6652
  options,
7271
6653
  rows = 3,
@@ -7315,6 +6697,11 @@ var init_Input = __esm({
7315
6697
  onClear?.();
7316
6698
  }
7317
6699
  };
6700
+ const handleKeyDown = (e) => {
6701
+ if (action && e.key === "Enter") {
6702
+ eventBus.emit(`UI:${action}`, { value: e.currentTarget.value });
6703
+ }
6704
+ };
7318
6705
  const wrapField = (field) => /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
7319
6706
  label && /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-foreground mb-1", children: label }),
7320
6707
  field,
@@ -7388,6 +6775,7 @@ var init_Input = __esm({
7388
6775
  type,
7389
6776
  value,
7390
6777
  onChange: handleChange,
6778
+ onKeyDown: handleKeyDown,
7391
6779
  className: baseClassName,
7392
6780
  ...props
7393
6781
  }
@@ -7920,7 +7308,7 @@ var init_Card = __esm({
7920
7308
  });
7921
7309
  function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
7922
7310
  const px = typeof size === "number" ? size : sizeMap[size];
7923
- const family = useIconFamily();
7311
+ useIconFamily();
7924
7312
  if (assetUrl?.url) {
7925
7313
  return /* @__PURE__ */ jsx(
7926
7314
  AtlasImage,
@@ -7932,7 +7320,7 @@ function GameIcon({ assetUrl, icon, size = "md", alt, className }) {
7932
7320
  }
7933
7321
  );
7934
7322
  }
7935
- const I = typeof icon === "string" ? resolveIconForFamily(icon, family) : icon;
7323
+ const I = typeof icon === "string" ? resolveIconForFamily(icon) : icon;
7936
7324
  return /* @__PURE__ */ jsx(I, { width: px, height: px, className: cn("flex-shrink-0", className) });
7937
7325
  }
7938
7326
  var sizeMap;
@@ -10279,8 +9667,8 @@ function Seigaiha({ size, color, strokeWidth }) {
10279
9667
  [s, s * 0.1]
10280
9668
  ];
10281
9669
  for (const [cx, cy] of centers) {
10282
- for (let ring2 = 1; ring2 <= 3; ring2++) {
10283
- const cr = r2 * (ring2 / 3);
9670
+ for (let ring = 1; ring <= 3; ring++) {
9671
+ const cr = r2 * (ring / 3);
10284
9672
  paths.push(
10285
9673
  `M ${f(cx - cr)},${f(cy)} A ${f(cr)} ${f(cr)} 0 0 1 ${f(cx + cr)},${f(cy)}`
10286
9674
  );
@@ -10377,8 +9765,8 @@ function Arch({ size, color, strokeWidth }) {
10377
9765
  const h = size * 1.5;
10378
9766
  const cx = w / 2;
10379
9767
  const paths = [];
10380
- for (let ring2 = 0; ring2 < 4; ring2++) {
10381
- const scale = 1 - ring2 * 0.2;
9768
+ for (let ring = 0; ring < 4; ring++) {
9769
+ const scale = 1 - ring * 0.2;
10382
9770
  const archW = w * 0.48 * scale;
10383
9771
  const archH = h * 0.7 * scale;
10384
9772
  const baseY = h * 0.85;
@@ -10393,7 +9781,7 @@ function Arch({ size, color, strokeWidth }) {
10393
9781
  paths.push(
10394
9782
  `M ${f(lx)},${f(baseY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(cx)},${f(tipY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(rx)},${f(baseY)}`
10395
9783
  );
10396
- if (ring2 === 0) {
9784
+ if (ring === 0) {
10397
9785
  paths.push(`M ${f(lx)},${f(baseY)} L ${f(rx)},${f(baseY)}`);
10398
9786
  }
10399
9787
  }
@@ -12908,9 +12296,9 @@ var init_webPainter2d = __esm({
12908
12296
  // lib/drawable/projector.ts
12909
12297
  function create2DProjector(opts) {
12910
12298
  const { scale, baseOffsetX, layout } = opts;
12911
- const tileWidth = TILE_WIDTH * scale;
12912
- const floorHeight = FLOOR_HEIGHT * scale;
12913
- const diamondTopY = (opts.diamondTopY ?? DIAMOND_TOP_Y) * scale;
12299
+ const tileWidth = layout === "free" ? 1 : TILE_WIDTH * scale;
12300
+ const floorHeight = layout === "free" ? 1 : FLOOR_HEIGHT * scale;
12301
+ const diamondTopY = layout === "free" ? 0 : (opts.diamondTopY ?? DIAMOND_TOP_Y) * scale;
12914
12302
  const squareGrid = layout === "flat" || layout === "free";
12915
12303
  const project = (pos) => layout === "free" ? { x: pos.x, y: pos.y } : isoToScreen(pos.x, pos.y, scale, baseOffsetX, layout);
12916
12304
  const anchorPoint = (pos, anchor) => {
@@ -12951,6 +12339,15 @@ var init_projector = __esm({
12951
12339
  }
12952
12340
  });
12953
12341
 
12342
+ // lib/drawable/contract.ts
12343
+ function isValidScenePos(pos) {
12344
+ return Number.isFinite(pos?.x) && Number.isFinite(pos?.y);
12345
+ }
12346
+ var init_contract = __esm({
12347
+ "lib/drawable/contract.ts"() {
12348
+ }
12349
+ });
12350
+
12954
12351
  // components/game/atoms/DrawSprite.tsx
12955
12352
  function DrawSprite(_props) {
12956
12353
  return null;
@@ -12960,10 +12357,12 @@ var init_DrawSprite = __esm({
12960
12357
  "components/game/atoms/DrawSprite.tsx"() {
12961
12358
  "use client";
12962
12359
  init_atlasSlice();
12360
+ init_contract();
12963
12361
  paintSprite = (painter, node, dctx) => {
12362
+ if (!node.asset?.url || !isValidScenePos(node.position)) return;
12964
12363
  const tex = painter.resolveTexture(node.asset.url);
12965
12364
  if (!tex) return;
12966
- let src = node.frame;
12365
+ let src = typeof node.frame === "object" ? node.frame : void 0;
12967
12366
  if (!src && isAtlasAsset(node.asset)) {
12968
12367
  const atlas = getAtlas(node.asset.atlas, dctx.invalidate);
12969
12368
  if (!atlas) return;
@@ -13008,7 +12407,9 @@ var paintShape;
13008
12407
  var init_DrawShape = __esm({
13009
12408
  "components/game/atoms/DrawShape.tsx"() {
13010
12409
  "use client";
12410
+ init_contract();
13011
12411
  paintShape = (painter, node, dctx) => {
12412
+ if (!isValidScenePos(node.position)) return;
13012
12413
  painter.save();
13013
12414
  if (node.opacity !== void 0 && node.opacity !== 1) painter.setAlpha(node.opacity);
13014
12415
  switch (node.shape) {
@@ -13062,7 +12463,9 @@ var paintText;
13062
12463
  var init_DrawText = __esm({
13063
12464
  "components/game/atoms/DrawText.tsx"() {
13064
12465
  "use client";
12466
+ init_contract();
13065
12467
  paintText = (painter, node, dctx) => {
12468
+ if (!isValidScenePos(node.position)) return;
13066
12469
  const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "center");
13067
12470
  const x = p.x + (node.offsetX ?? 0);
13068
12471
  const y = p.y + (node.offsetY ?? 0);
@@ -13167,12 +12570,14 @@ function collectDrawnItems(nodes) {
13167
12570
  case "draw-sprite":
13168
12571
  case "draw-shape":
13169
12572
  case "draw-text":
13170
- out.push({ pos: n.position, id: n.id });
12573
+ if (isValidScenePos(n.position)) out.push({ pos: n.position, id: n.id });
13171
12574
  break;
13172
12575
  case "draw-sprite-layer":
13173
12576
  case "draw-shape-layer":
13174
12577
  case "draw-text-layer":
13175
- for (const it of n.items) out.push({ pos: it.position, id: it.id });
12578
+ for (const it of n.items) {
12579
+ if (isValidScenePos(it.position)) out.push({ pos: it.position, id: it.id });
12580
+ }
13176
12581
  break;
13177
12582
  }
13178
12583
  }
@@ -13187,6 +12592,7 @@ function buildHitIndex(items) {
13187
12592
  }
13188
12593
  var init_hitTest = __esm({
13189
12594
  "lib/drawable/hitTest.ts"() {
12595
+ init_contract();
13190
12596
  }
13191
12597
  });
13192
12598
  function normalizeBackdrop(bg) {
@@ -13212,14 +12618,16 @@ function Canvas2D({
13212
12618
  cameraPos,
13213
12619
  bgColor
13214
12620
  }) {
12621
+ const instanceId = useMemo(() => Math.random().toString(36).slice(2, 8), []);
12622
+ function isDrawableLayer(node) {
12623
+ return node.type === "draw-sprite-layer" || node.type === "draw-shape-layer" || node.type === "draw-text-layer";
12624
+ }
13215
12625
  const layerSummaries = drawables?.map((d) => {
13216
- if (!d || typeof d !== "object") return d;
13217
- const rec = d;
13218
- return { type: rec.type, itemsLen: Array.isArray(rec.items) ? rec.items.length : void 0, firstItem: Array.isArray(rec.items) ? rec.items[0] : void 0 };
12626
+ if (!isDrawableLayer(d)) return { type: d.type };
12627
+ return { type: d.type, itemsLen: d.items.length, firstItem: d.items[0] };
13219
12628
  });
13220
- console.error("[debug:Canvas2D] " + JSON.stringify({ projection, scale, cameraMode: camera, cameraPos, drawablesCount: drawables?.length, layerSummaries }));
12629
+ canvas2DLog.debug("Canvas2D render", { instanceId, projection, scale, cameraMode: camera, cameraPos: cameraPos ? JSON.stringify(cameraPos) : void 0, drawablesCount: drawables?.length, layerSummaries: layerSummaries ? JSON.stringify(layerSummaries) : void 0 });
13221
12630
  const backgroundImage = normalizeBackdrop(backgroundImageRaw);
13222
- const instanceId = useMemo(() => Math.random().toString(36).slice(2, 8), []);
13223
12631
  const isFree = projection === "free";
13224
12632
  const squareGrid = projection === "flat" || isFree || projection === "side";
13225
12633
  const layout = projection === "side" ? "free" : projection;
@@ -13354,7 +12762,7 @@ function Canvas2D({
13354
12762
  }
13355
12763
  const containerRect = containerRef.current?.getBoundingClientRect();
13356
12764
  const canvasRect = canvas.getBoundingClientRect();
13357
- console.error("[debug:Canvas2D:draw:" + instanceId + "] " + JSON.stringify({ viewportSize, baseOffsetX, cam: { x: cam.x, y: cam.y, zoom: cam.zoom }, cameraPos, containerRect: containerRect ? { width: containerRect.width, height: containerRect.height } : null, canvasRect: canvasRect ? { width: canvasRect.width, height: canvasRect.height } : null }));
12765
+ canvas2DLog.debug("Canvas2D draw", { instanceId, viewportSize, baseOffsetX, cam: { x: cam.x, y: cam.y, zoom: cam.zoom }, cameraPos: cameraPos ? JSON.stringify(cameraPos) : void 0, containerRect: containerRect ? { width: containerRect.width, height: containerRect.height } : null, canvasRect: canvasRect ? { width: canvasRect.width, height: canvasRect.height } : null });
13358
12766
  const painter = createWebPainter(ctx, bumpAtlas);
13359
12767
  painter.save();
13360
12768
  painter.translate(viewportSize.width / 2, viewportSize.height / 2);
@@ -13566,6 +12974,7 @@ function Canvas2D({
13566
12974
  }
13567
12975
  );
13568
12976
  }
12977
+ var canvas2DLog;
13569
12978
  var init_Canvas2D = __esm({
13570
12979
  "components/game/molecules/Canvas2D.tsx"() {
13571
12980
  "use client";
@@ -13587,6 +12996,7 @@ var init_Canvas2D = __esm({
13587
12996
  init_paintDispatch();
13588
12997
  init_hitTest();
13589
12998
  init_isometric();
12999
+ canvas2DLog = createLogger("almadar:ui:game-canvas");
13590
13000
  Canvas2D.displayName = "Canvas2D";
13591
13001
  }
13592
13002
  });
@@ -13625,7 +13035,7 @@ function Canvas({
13625
13035
  keyMap,
13626
13036
  keyUpMap
13627
13037
  }) {
13628
- console.error("[debug:Canvas] " + JSON.stringify({ mode, drawablesCount: drawables?.length, projection, camera }));
13038
+ canvasLog.debug("Canvas render", { mode, drawablesCount: drawables?.length, projection, camera: camera ? JSON.stringify(camera) : void 0 });
13629
13039
  const zoom = camera?.zoom;
13630
13040
  if (mode === "3d") {
13631
13041
  const props3d = {
@@ -13678,7 +13088,7 @@ function Canvas({
13678
13088
  }
13679
13089
  );
13680
13090
  }
13681
- var Canvas3DHost;
13091
+ var Canvas3DHost, canvasLog;
13682
13092
  var init_Canvas = __esm({
13683
13093
  "components/game/molecules/Canvas.tsx"() {
13684
13094
  "use client";
@@ -13686,6 +13096,7 @@ var init_Canvas = __esm({
13686
13096
  Canvas3DHost = lazy(
13687
13097
  () => import('@almadar/ui/components/molecules/game/three').then((m) => ({ default: m.Canvas3DHost }))
13688
13098
  );
13099
+ canvasLog = createLogger("almadar:ui:game-canvas");
13689
13100
  Canvas.displayName = "Canvas";
13690
13101
  }
13691
13102
  });
@@ -15221,21 +14632,6 @@ var init_renderer = __esm({
15221
14632
  init_slot_definitions();
15222
14633
  }
15223
14634
  });
15224
-
15225
- // lib/wrapCallbackForEvent.ts
15226
- function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
15227
- const argNames = (callbackArgs ?? []).map((a) => a.name);
15228
- if (argNames.length === 0) {
15229
- return () => emit(qualifiedEvent);
15230
- }
15231
- return (...args) => {
15232
- const payload = {};
15233
- for (let i = 0; i < argNames.length; i += 1) {
15234
- payload[argNames[i]] = args[i];
15235
- }
15236
- emit(qualifiedEvent, payload);
15237
- };
15238
- }
15239
14635
  var init_wrapCallbackForEvent = __esm({
15240
14636
  "lib/wrapCallbackForEvent.ts"() {
15241
14637
  }
@@ -25430,7 +24826,8 @@ function DataGrid({
25430
24826
  const { t } = useTranslate();
25431
24827
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
25432
24828
  const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
25433
- const fieldDefs = fields ?? columns ?? [];
24829
+ const fieldDefs = (Array.isArray(fields) ? fields : void 0) ?? (Array.isArray(columns) ? columns : void 0) ?? [];
24830
+ const actionDefs = Array.isArray(itemActions) ? itemActions : [];
25434
24831
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
25435
24832
  const dnd = useDataDnd({
25436
24833
  items: allDataRaw,
@@ -25474,8 +24871,8 @@ function DataGrid({
25474
24871
  const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
25475
24872
  const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
25476
24873
  const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
25477
- const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
25478
- const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
24874
+ const primaryActions = actionDefs.filter((a) => a.variant !== "danger");
24875
+ const dangerActions = actionDefs.filter((a) => a.variant === "danger");
25479
24876
  const handleActionClick = (action, itemData) => (e) => {
25480
24877
  e.stopPropagation();
25481
24878
  const payload = {
@@ -37798,7 +37195,7 @@ function measureLabelWidth(text) {
37798
37195
  if (typeof document === "undefined") return text.length * 6;
37799
37196
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
37800
37197
  if (!labelMeasureCtx) return text.length * 6;
37801
- labelMeasureCtx.font = "10px system-ui";
37198
+ labelMeasureCtx.font = "12px system-ui";
37802
37199
  return labelMeasureCtx.measureText(text).width;
37803
37200
  }
37804
37201
  function getGroupColor(group, groups) {
@@ -37844,6 +37241,7 @@ var init_GraphCanvas = __esm({
37844
37241
  actions,
37845
37242
  onNodeClick,
37846
37243
  onNodeDoubleClick,
37244
+ onBadgeClick,
37847
37245
  nodeClickEvent,
37848
37246
  selectedNodeId,
37849
37247
  repulsion = 800,
@@ -37991,7 +37389,9 @@ var init_GraphCanvas = __esm({
37991
37389
  const dx = target.x - source.x;
37992
37390
  const dy = target.y - source.y;
37993
37391
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
37994
- const force = (dist - linkDistance) * 0.05;
37392
+ const w2 = edge.weight ?? 1;
37393
+ const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
37394
+ const force = (dist - linkTarget) * 0.05;
37995
37395
  const fx = dx / dist * force;
37996
37396
  const fy = dy / dist * force;
37997
37397
  source.fx += fx;
@@ -38013,7 +37413,7 @@ var init_GraphCanvas = __esm({
38013
37413
  node.y = Math.max(30, Math.min(h - 30, node.y));
38014
37414
  }
38015
37415
  const LABEL_GAP = 12;
38016
- const LABEL_H = 12;
37416
+ const LABEL_H = 16;
38017
37417
  const pad = nodeSpacing / 2;
38018
37418
  for (let i = 0; i < nodes.length; i++) {
38019
37419
  for (let j = i + 1; j < nodes.length; j++) {
@@ -38034,13 +37434,13 @@ var init_GraphCanvas = __esm({
38034
37434
  const overlapY = Math.min(aBot, bBot) - Math.max(aTop, bTop);
38035
37435
  if (overlapX > 0 && overlapY > 0) {
38036
37436
  if (overlapX <= overlapY) {
38037
- const push2 = overlapX / 2 * (b.x >= a.x ? 1 : -1);
38038
- a.x = Math.max(30, Math.min(w - 30, a.x - push2));
38039
- b.x = Math.max(30, Math.min(w - 30, b.x + push2));
37437
+ const push = overlapX / 2 * (b.x >= a.x ? 1 : -1);
37438
+ a.x = Math.max(30, Math.min(w - 30, a.x - push));
37439
+ b.x = Math.max(30, Math.min(w - 30, b.x + push));
38040
37440
  } else {
38041
- const push2 = overlapY / 2 * (bTop + bBot >= aTop + aBot ? 1 : -1);
38042
- a.y = Math.max(30, Math.min(h - 30, a.y - push2));
38043
- b.y = Math.max(30, Math.min(h - 30, b.y + push2));
37441
+ const push = overlapY / 2 * (bTop + bBot >= aTop + aBot ? 1 : -1);
37442
+ a.y = Math.max(30, Math.min(h - 30, a.y - push));
37443
+ b.y = Math.max(30, Math.min(h - 30, b.y + push));
38044
37444
  }
38045
37445
  }
38046
37446
  }
@@ -38068,6 +37468,11 @@ var init_GraphCanvas = __esm({
38068
37468
  const h = height;
38069
37469
  const nodes = nodesRef.current;
38070
37470
  const accentColor = resolveColor3("var(--color-accent)", canvas);
37471
+ const fontFamily = resolveColor3("var(--font-family)", canvas) || "system-ui";
37472
+ const fgColor = resolveColor3("var(--color-foreground)", canvas);
37473
+ const mutedColor = resolveColor3("var(--color-muted-foreground)", canvas) || fgColor;
37474
+ const bgColor = resolveColor3("var(--color-background)", canvas) || "#ffffff";
37475
+ const accentFg = resolveColor3("var(--color-accent-foreground)", canvas) || "#ffffff";
38071
37476
  const dpr = typeof window !== "undefined" && window.devicePixelRatio || 1;
38072
37477
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
38073
37478
  ctx.clearRect(0, 0, w, h);
@@ -38087,19 +37492,21 @@ var init_GraphCanvas = __esm({
38087
37492
  const target = nodes.find((n) => n.id === edge.target);
38088
37493
  if (!source || !target) continue;
38089
37494
  const incident = !!hoveredNode && (edge.source === hoveredNode || edge.target === hoveredNode);
38090
- ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity;
37495
+ const w2 = edge.weight ?? 1;
37496
+ ctx.globalAlpha = hoveredNode ? incident ? 1 : 0.05 : linkOpacity * w2;
38091
37497
  ctx.beginPath();
38092
37498
  ctx.moveTo(source.x, source.y);
38093
37499
  ctx.lineTo(target.x, target.y);
38094
37500
  ctx.strokeStyle = incident ? accentColor : edge.color || "#888888";
38095
- ctx.lineWidth = incident ? 2 : edge.weight ? Math.max(1, edge.weight) : 1;
37501
+ ctx.lineWidth = incident ? 2 : Math.max(0.75, w2);
38096
37502
  ctx.stroke();
38097
37503
  if (edge.label && showLabels) {
38098
37504
  const mx = (source.x + target.x) / 2;
38099
37505
  const my = (source.y + target.y) / 2;
38100
- ctx.fillStyle = "#888888";
38101
- ctx.font = "9px system-ui";
37506
+ ctx.fillStyle = mutedColor;
37507
+ ctx.font = `9px ${fontFamily}`;
38102
37508
  ctx.textAlign = "center";
37509
+ ctx.textBaseline = "alphabetic";
38103
37510
  ctx.fillText(edge.label, mx, my - 4);
38104
37511
  }
38105
37512
  }
@@ -38124,10 +37531,33 @@ var init_GraphCanvas = __esm({
38124
37531
  }
38125
37532
  ctx.stroke();
38126
37533
  if (showLabels && node.label) {
38127
- ctx.fillStyle = "#666666";
38128
- ctx.font = `${isSelected || isHovered ? "bold " : ""}10px system-ui`;
37534
+ ctx.font = `${isSelected || isHovered ? "600" : "500"} 12px ${fontFamily}`;
37535
+ ctx.textAlign = "center";
37536
+ ctx.textBaseline = "middle";
37537
+ const ly = node.y + radius + 14;
37538
+ ctx.lineWidth = 3;
37539
+ ctx.lineJoin = "round";
37540
+ ctx.strokeStyle = bgColor;
37541
+ ctx.strokeText(node.label, node.x, ly);
37542
+ ctx.fillStyle = isSelected || isHovered ? fgColor : mutedColor;
37543
+ ctx.fillText(node.label, node.x, ly);
37544
+ }
37545
+ if (node.badge && node.badge > 1) {
37546
+ const bx = node.x + radius * 0.7;
37547
+ const by = node.y - radius * 0.7;
37548
+ const br = Math.max(7, Math.min(11, radius * 0.45));
37549
+ ctx.beginPath();
37550
+ ctx.arc(bx, by, br, 0, Math.PI * 2);
37551
+ ctx.fillStyle = accentColor;
37552
+ ctx.fill();
37553
+ ctx.strokeStyle = bgColor;
37554
+ ctx.lineWidth = 2;
37555
+ ctx.stroke();
37556
+ ctx.fillStyle = accentFg;
37557
+ ctx.font = `600 9px ${fontFamily}`;
38129
37558
  ctx.textAlign = "center";
38130
- ctx.fillText(node.label, node.x, node.y + radius + 12);
37559
+ ctx.textBaseline = "middle";
37560
+ ctx.fillText(String(node.badge), bx, by + 0.5);
38131
37561
  }
38132
37562
  }
38133
37563
  ctx.restore();
@@ -38220,11 +37650,21 @@ var init_GraphCanvas = __esm({
38220
37650
  if (!coords) return;
38221
37651
  const node = nodeAt(coords.graphX, coords.graphY);
38222
37652
  if (node) {
37653
+ if (node.badge && node.badge > 1 && onBadgeClick) {
37654
+ const r2 = (node.size || 8) + (selectedNodeId === node.id ? 4 : 0);
37655
+ const bx = node.x + r2 * 0.7;
37656
+ const by = node.y - r2 * 0.7;
37657
+ const br = Math.max(7, Math.min(11, r2 * 0.45)) + 3;
37658
+ if (Math.hypot(coords.graphX - bx, coords.graphY - by) <= br) {
37659
+ onBadgeClick(node);
37660
+ return;
37661
+ }
37662
+ }
38223
37663
  handleNodeClick(node);
38224
37664
  }
38225
37665
  }
38226
37666
  },
38227
- [toCoords, nodeAt, handleNodeClick]
37667
+ [toCoords, nodeAt, handleNodeClick, onBadgeClick, selectedNodeId]
38228
37668
  );
38229
37669
  const handlePointerLeave = useCallback(() => {
38230
37670
  setHoveredNode(null);
@@ -42745,7 +42185,7 @@ function getAllEvents(traits2) {
42745
42185
  function EventDispatcherTab({ traits: traits2, schema }) {
42746
42186
  const eventBus = useEventBus();
42747
42187
  const { t } = useTranslate();
42748
- const [log12, setLog] = React90.useState([]);
42188
+ const [log11, setLog] = React90.useState([]);
42749
42189
  const prevStatesRef = React90.useRef(/* @__PURE__ */ new Map());
42750
42190
  React90.useEffect(() => {
42751
42191
  for (const trait of traits2) {
@@ -42809,9 +42249,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
42809
42249
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.otherEvents") }),
42810
42250
  /* @__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)) })
42811
42251
  ] }),
42812
- log12.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
42252
+ log11.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
42813
42253
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: t("debug.recentTransitions") }),
42814
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log12.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42254
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log11.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42815
42255
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
42816
42256
  " ",
42817
42257
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -49815,85 +49255,12 @@ function useResolvedSchema(schema, pageName) {
49815
49255
  }, [ir, pageName, loading, error, schema]);
49816
49256
  return result;
49817
49257
  }
49818
-
49819
- // lib/embedded-traits.ts
49820
- var TRAIT_BINDING_PREFIX = "@trait.";
49821
- function collectTraitRefsFromValue(value, into) {
49822
- if (value === null || value === void 0) return;
49823
- if (typeof value === "string") {
49824
- if (value.startsWith(TRAIT_BINDING_PREFIX)) {
49825
- const rest = value.slice(TRAIT_BINDING_PREFIX.length);
49826
- const dot = rest.indexOf(".");
49827
- const traitName = dot === -1 ? rest : rest.slice(0, dot);
49828
- if (traitName.length > 0) into.add(traitName);
49829
- }
49830
- return;
49831
- }
49832
- if (Array.isArray(value)) {
49833
- for (const item of value) collectTraitRefsFromValue(item, into);
49834
- return;
49835
- }
49836
- if (typeof value === "object") {
49837
- for (const v of Object.values(value)) {
49838
- collectTraitRefsFromValue(v, into);
49839
- }
49840
- }
49841
- }
49842
- function collectTraitRefsFromEffects(effects, into) {
49843
- if (!effects) return;
49844
- for (const effect of effects) {
49845
- if (!Array.isArray(effect)) continue;
49846
- if (effect[0] === "render-ui" && effect.length >= 3) {
49847
- collectTraitRefsFromValue(effect[2], into);
49848
- continue;
49849
- }
49850
- for (let i = 1; i < effect.length; i++) {
49851
- const arg = effect[i];
49852
- if (Array.isArray(arg)) collectTraitRefsFromEffects([arg], into);
49853
- else collectTraitRefsFromValue(arg, into);
49854
- }
49855
- }
49856
- }
49857
- function collectTraitRefsFromResolvedTrait(trait) {
49858
- const out = /* @__PURE__ */ new Set();
49859
- for (const transition of trait.transitions ?? []) {
49860
- collectTraitRefsFromEffects(transition.effects, out);
49861
- }
49862
- for (const tick of trait.ticks ?? []) {
49863
- collectTraitRefsFromEffects(tick.effects, out);
49864
- }
49865
- return out;
49866
- }
49867
- function collectEmbeddedTraits(schema) {
49868
- const out = /* @__PURE__ */ new Set();
49869
- if (!schema?.orbitals) return out;
49870
- for (const orbital of schema.orbitals) {
49871
- const traits2 = orbital.traits;
49872
- if (!Array.isArray(traits2)) continue;
49873
- for (const traitRef of traits2) {
49874
- if (!traitRef || typeof traitRef !== "object") continue;
49875
- const resolved = traitRef._resolved;
49876
- const target = resolved && typeof resolved === "object" ? resolved : traitRef;
49877
- if (target.config) {
49878
- collectTraitRefsFromValue(target.config, out);
49879
- }
49880
- const transitions = target.stateMachine?.transitions;
49881
- if (!Array.isArray(transitions)) continue;
49882
- for (const t of transitions) {
49883
- collectTraitRefsFromEffects(t.effects, out);
49884
- }
49885
- collectTraitRefsFromEffects(target.initialEffects, out);
49886
- const ticks2 = target.ticks;
49887
- if (Array.isArray(ticks2)) {
49888
- for (const tick of ticks2) {
49889
- collectTraitRefsFromEffects(tick.effects, out);
49890
- }
49891
- }
49892
- }
49893
- }
49894
- return out;
49895
- }
49896
49258
  var lambdaLog = createLogger("almadar:ui:fn-form-lambda");
49259
+ function isOperatorCall(value) {
49260
+ const first = value[0];
49261
+ if (typeof first !== "string") return false;
49262
+ return isKnownStdOperator(first) || first.includes("/") || first === "lambda" || first === "let";
49263
+ }
49897
49264
  function isFnFormLambda(value) {
49898
49265
  if (!Array.isArray(value)) return false;
49899
49266
  const arr = value;
@@ -49933,7 +49300,14 @@ function resolveLambdaBindings(body, params, item, index) {
49933
49300
  return body;
49934
49301
  }
49935
49302
  if (Array.isArray(body)) {
49936
- return body.map((b) => recur(b));
49303
+ if (isFnFormLambda(body)) return body;
49304
+ const arr = body;
49305
+ const substituted = arr.map((b) => recur(b));
49306
+ if (isOperatorCall(substituted) && isSExpr(substituted)) {
49307
+ const evaluated = evaluate(substituted, createMinimalContext());
49308
+ return isEventPayloadValue(evaluated) ? evaluated : String(evaluated);
49309
+ }
49310
+ return substituted;
49937
49311
  }
49938
49312
  if (body !== null && typeof body === "object" && !React90__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
49939
49313
  const out = {};
@@ -50026,27 +49400,27 @@ var log7 = createLogger("almadar:ui:shared-entity-store");
50026
49400
  var EMPTY_ENTITY_STATE = {};
50027
49401
  function createSharedEntityStore() {
50028
49402
  const states = /* @__PURE__ */ new Map();
50029
- const subscribers2 = /* @__PURE__ */ new Map();
49403
+ const subscribers = /* @__PURE__ */ new Map();
50030
49404
  const getSnapshot2 = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
50031
49405
  const subscribe = (entityId, callback) => {
50032
- let set = subscribers2.get(entityId);
49406
+ let set = subscribers.get(entityId);
50033
49407
  if (!set) {
50034
49408
  set = /* @__PURE__ */ new Set();
50035
- subscribers2.set(entityId, set);
49409
+ subscribers.set(entityId, set);
50036
49410
  }
50037
49411
  set.add(callback);
50038
49412
  return () => {
50039
- const current = subscribers2.get(entityId);
49413
+ const current = subscribers.get(entityId);
50040
49414
  if (!current) return;
50041
49415
  current.delete(callback);
50042
49416
  if (current.size === 0) {
50043
- subscribers2.delete(entityId);
49417
+ subscribers.delete(entityId);
50044
49418
  }
50045
49419
  };
50046
49420
  };
50047
49421
  const commit = (entityId, nextState) => {
50048
49422
  states.set(entityId, nextState);
50049
- const set = subscribers2.get(entityId);
49423
+ const set = subscribers.get(entityId);
50050
49424
  if (!set) return;
50051
49425
  set.forEach((callback) => {
50052
49426
  try {
@@ -50148,6 +49522,8 @@ var flushLog = createLogger("almadar:ui:slot-flush");
50148
49522
  var stateLog = createLogger("almadar:ui:state-transitions");
50149
49523
  var tickLog = createLogger("almadar:ui:tick-effects");
50150
49524
  setNamespaceLevel("almadar:ui:tick-effects", "WARN");
49525
+ var sharedEntityLog = createLogger("almadar:ui:shared-entity");
49526
+ setNamespaceLevel("almadar:ui:shared-entity", "WARN");
50151
49527
  var SYNC_TICK_OPERATORS = /* @__PURE__ */ new Set([
50152
49528
  "set",
50153
49529
  "emit",
@@ -50242,14 +49618,14 @@ function createSharedEntityWriter(binding, tick, traitStatesRef, emit) {
50242
49618
  function getBindingConfig(binding) {
50243
49619
  const raw = binding.config;
50244
49620
  const normalized = normalizeCallSiteConfigToValues(raw);
50245
- console.log("[debug:getBindingConfig]", binding.trait.name, "raw keys=", raw ? Object.keys(raw) : "undefined", "has tiles=", raw ? "tiles" in raw : false);
49621
+ sharedEntityLog.debug("getBindingConfig", { traitName: binding.trait.name, rawKeys: raw ? Object.keys(raw) : void 0, hasTiles: raw ? "tiles" in raw : false });
50246
49622
  return normalized;
50247
49623
  }
50248
49624
  function evalFieldDefault(value) {
50249
49625
  if (!Array.isArray(value) || value.length === 0) return value;
50250
49626
  const head = value[0];
50251
- const isSExpr = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
50252
- if (!isSExpr) return value;
49627
+ const isSExpr2 = typeof head === "string" && (head.includes("/") || head === "let" || head === "if" || head === "lambda");
49628
+ if (!isSExpr2) return value;
50253
49629
  try {
50254
49630
  return evaluate(value, createMinimalContext({}, {}, ""));
50255
49631
  } catch {
@@ -50257,7 +49633,7 @@ function evalFieldDefault(value) {
50257
49633
  }
50258
49634
  }
50259
49635
  function useTraitStateMachine(traitBindings, uiSlots, options) {
50260
- console.log("[debug:useTraitStateMachine] start, traitBindings count=", traitBindings.length, "names=", traitBindings.map((b) => b.trait.name).join(","));
49636
+ sharedEntityLog.debug("useTraitStateMachine start", { traitBindingsCount: traitBindings.length, traitNames: traitBindings.map((b) => b.trait.name) });
50261
49637
  const eventBus = useEventBus();
50262
49638
  const { entities } = useEntitySchema();
50263
49639
  const traitConfigsByName = options?.traitConfigsByName;
@@ -50276,10 +49652,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50276
49652
  if (!group) {
50277
49653
  let defaults;
50278
49654
  for (const field of entityDef.fields) {
50279
- if (field.default !== void 0) {
49655
+ if (field.default !== void 0 && field.default !== null) {
50280
49656
  const evaluated = evalFieldDefault(field.default);
50281
49657
  if (field.name === "tiles") {
50282
- console.log(`[debug:seed] ${linkedEntityName}.tiles seed type=`, typeof evaluated, Array.isArray(evaluated) ? "len=" + evaluated?.length : "", "head=", Array.isArray(evaluated) && evaluated.length > 0 ? JSON.stringify(evaluated[0]).slice(0, 80) : "n/a");
49658
+ sharedEntityLog.debug("seed tiles", {
49659
+ linkedEntityName,
49660
+ type: typeof evaluated,
49661
+ length: Array.isArray(evaluated) ? evaluated?.length : void 0,
49662
+ head: Array.isArray(evaluated) && evaluated.length > 0 ? JSON.stringify(evaluated[0]).slice(0, 80) : void 0
49663
+ });
50283
49664
  }
50284
49665
  (defaults ?? (defaults = {}))[field.name] = evaluated;
50285
49666
  }
@@ -50296,7 +49677,12 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50296
49677
  for (const group of sharedGroups.values()) {
50297
49678
  if (group.defaults) {
50298
49679
  sharedEntityStore.seed(group.storeKey, group.defaults);
50299
- console.log("[debug:shared-seed]", group.storeKey, "writers=", group.writerBindings.map((b) => b.trait.name).join(","), "renderers=", group.renderBindings.map((b) => b.trait.name).join(","), "defaults.tiles=", Array.isArray(group.defaults.tiles) ? group.defaults.tiles.length : group.defaults.tiles);
49680
+ sharedEntityLog.debug("shared-seed", {
49681
+ storeKey: group.storeKey,
49682
+ writers: group.writerBindings.map((b) => b.trait.name),
49683
+ renderers: group.renderBindings.map((b) => b.trait.name),
49684
+ tilesLength: Array.isArray(group.defaults.tiles) ? group.defaults.tiles.length : group.defaults.tiles
49685
+ });
50300
49686
  }
50301
49687
  }
50302
49688
  const sharedKeyByTraitNameRef = useRef(/* @__PURE__ */ new Map());
@@ -50307,13 +49693,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50307
49693
  for (const binding of group.renderBindings) map.set(binding.trait.name, group.storeKey);
50308
49694
  }
50309
49695
  sharedKeyByTraitNameRef.current = map;
50310
- console.log("[debug:shared-map]", Array.from(map.entries()).map(([k, v]) => `${k}->${v}`).join(","));
49696
+ sharedEntityLog.debug("shared-map", { map: Array.from(map.entries()).map(([k, v]) => `${k}->${v}`) });
50311
49697
  }, [sharedGroups]);
50312
49698
  const manager = useMemo(() => {
50313
49699
  const traitDefs = traitBindings.map(toTraitDefinition);
50314
49700
  const m = new StateMachineManager(traitDefs);
50315
49701
  for (const binding of traitBindings) {
50316
- const cfg = getBindingConfig(binding) ?? traitConfigsByName?.[binding.trait.name];
49702
+ const rawCfg = getBindingConfig(binding);
49703
+ const resolvedCfg = traitConfigsByName?.[binding.trait.name];
49704
+ const cfg = rawCfg || resolvedCfg ? { ...rawCfg ?? {}, ...resolvedCfg ?? {} } : void 0;
50317
49705
  if (cfg !== void 0) {
50318
49706
  m.setTraitConfig(binding.trait.name, cfg);
50319
49707
  }
@@ -50491,13 +49879,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50491
49879
  };
50492
49880
  }, [traitBindings]);
50493
49881
  const executeTransitionEffects = useCallback(async (params) => {
50494
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log12 } = params;
49882
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log11 } = params;
50495
49883
  const traitName = binding.trait.name;
50496
49884
  const linkedEntity = binding.linkedEntity || "";
50497
49885
  const entityId = payload?.entityId;
50498
49886
  const sharedKey = sharedKeyByTraitNameRef.current.get(traitName);
50499
49887
  if (traitName === "Hero" || traitName === "Authority") {
50500
- console.log(`[debug:executeTransitionEffects] ${traitName} sharedKey=`, sharedKey, "store tiles=", sharedKey ? sharedEntityStore.getSnapshot(sharedKey).tiles?.length : "n/a");
49888
+ sharedEntityLog.debug("executeTransitionEffects sharedKey", { traitName, sharedKey, storeTilesLength: sharedKey ? sharedEntityStore.getSnapshot(sharedKey).tiles?.length : void 0 });
50501
49889
  }
50502
49890
  let liveEntity;
50503
49891
  if (sharedKey !== void 0) {
@@ -50524,10 +49912,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50524
49912
  addPattern: (slot, pattern, props) => {
50525
49913
  if (traitName === "Hero" && slot === "main" && props && typeof props === "object") {
50526
49914
  const canvasChild = Array.isArray(props.children) ? props.children[0] : null;
50527
- const grandChildren = canvasChild && typeof canvasChild === "object" ? canvasChild.children : null;
49915
+ const grandChildren = canvasChild && typeof canvasChild === "object" && !Array.isArray(canvasChild) ? canvasChild.children : null;
50528
49916
  const firstLayer = Array.isArray(grandChildren) && grandChildren.length > 0 ? grandChildren[0] : null;
50529
- const firstLayerItems = firstLayer && typeof firstLayer === "object" ? firstLayer.items : null;
50530
- console.log(`[debug:render-ui] ${traitName} slot=${slot} canvasChild=`, canvasChild ? canvasChild.type : "none", "firstLayerItems=", Array.isArray(firstLayerItems) ? firstLayerItems.length : firstLayerItems);
49917
+ const firstLayerItems = firstLayer && typeof firstLayer === "object" && !Array.isArray(firstLayer) ? firstLayer.items : null;
49918
+ sharedEntityLog.debug("render-ui main slot", {
49919
+ traitName,
49920
+ slot,
49921
+ canvasChildType: canvasChild && typeof canvasChild === "object" && !Array.isArray(canvasChild) ? canvasChild.type : "none",
49922
+ firstLayerItemsLength: Array.isArray(firstLayerItems) ? firstLayerItems.length : firstLayerItems
49923
+ });
50531
49924
  }
50532
49925
  const existing = pendingSlots.get(slot) || [];
50533
49926
  existing.push({ pattern, props: props || {} });
@@ -50560,10 +49953,20 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50560
49953
  state: previousState
50561
49954
  };
50562
49955
  const sharedDeclared = collectDeclaredConfigDefaults(binding.trait);
50563
- const sharedCallSite = getBindingConfig(binding);
50564
- if (sharedDeclared || sharedCallSite) {
49956
+ const sharedResolved = traitConfigsByName?.[traitName];
49957
+ const sharedCallSiteRaw = getBindingConfig(binding);
49958
+ const sharedCallSite = sharedCallSiteRaw ? resolveCallSitePayloadCaptures(
49959
+ Object.fromEntries(
49960
+ Object.entries(sharedCallSiteRaw).filter(
49961
+ ([, v]) => !(typeof v === "string" && v.startsWith("@config."))
49962
+ )
49963
+ ),
49964
+ payload || {}
49965
+ ) : void 0;
49966
+ if (sharedDeclared || sharedResolved || sharedCallSite) {
50565
49967
  sharedBindings.config = {
50566
49968
  ...sharedDeclared ?? {},
49969
+ ...sharedResolved ?? {},
50567
49970
  ...sharedCallSite ?? {}
50568
49971
  };
50569
49972
  }
@@ -50597,7 +50000,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50597
50000
  ...handlers,
50598
50001
  set: async (targetId, field, value) => {
50599
50002
  if (baseSet) await baseSet(targetId, field, value);
50600
- log12.debug("set:write", {
50003
+ log11.debug("set:write", {
50601
50004
  traitName,
50602
50005
  field,
50603
50006
  value: JSON.stringify(value),
@@ -50611,15 +50014,30 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50611
50014
  state: previousState
50612
50015
  };
50613
50016
  const declaredDefaults = collectDeclaredConfigDefaults(binding.trait);
50017
+ const resolvedDefaults = traitConfigsByName?.[traitName];
50614
50018
  const callSiteConfig = getBindingConfig(binding);
50615
- if (declaredDefaults || callSiteConfig) {
50019
+ const callSiteOverrides = callSiteConfig ? resolveCallSitePayloadCaptures(
50020
+ Object.fromEntries(
50021
+ Object.entries(callSiteConfig).filter(
50022
+ ([, v]) => !(typeof v === "string" && v.startsWith("@config."))
50023
+ )
50024
+ ),
50025
+ payload || {}
50026
+ ) : void 0;
50027
+ if (declaredDefaults || resolvedDefaults || callSiteOverrides) {
50616
50028
  bindingCtx.config = {
50617
50029
  ...declaredDefaults ?? {},
50618
- ...callSiteConfig ?? {}
50030
+ ...resolvedDefaults ?? {},
50031
+ ...callSiteOverrides ?? {}
50619
50032
  };
50620
50033
  }
50621
50034
  if (traitName === "Authority" || traitName === "Hero") {
50622
- console.log(`[debug:executeTransitionEffects] ${traitName} config tiles type=`, typeof bindingCtx.config?.tiles, Array.isArray(bindingCtx.config?.tiles) ? "len=" + bindingCtx.config?.tiles?.length : "", "keys=", bindingCtx.config ? Object.keys(bindingCtx.config) : "none");
50035
+ sharedEntityLog.debug("executeTransitionEffects config tiles", {
50036
+ traitName,
50037
+ tilesType: typeof bindingCtx.config?.tiles,
50038
+ tilesLength: Array.isArray(bindingCtx.config?.tiles) ? bindingCtx.config?.tiles?.length : void 0,
50039
+ configKeys: bindingCtx.config ? Object.keys(bindingCtx.config) : void 0
50040
+ });
50623
50041
  }
50624
50042
  const effectContext = {
50625
50043
  traitName,
@@ -50638,18 +50056,28 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50638
50056
  }
50639
50057
  };
50640
50058
  if (traitName === "Hero") {
50641
- console.log(`[debug:executeTransitionEffects] ${traitName} effects count=${effects.length} hasRenderUI=${typeof handlers.renderUI === "function"} effect heads=${effects.map((e) => Array.isArray(e) ? String(e[0]) : "??").join(",")}`);
50059
+ sharedEntityLog.debug("executeTransitionEffects effects summary", {
50060
+ traitName,
50061
+ effectsCount: effects.length,
50062
+ hasRenderUI: typeof handlers.renderUI === "function",
50063
+ effectHeads: effects.map((e) => Array.isArray(e) ? String(e[0]) : "??")
50064
+ });
50642
50065
  }
50643
50066
  const executor = new EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
50644
50067
  try {
50645
50068
  await executor.executeAll(effects);
50646
50069
  if (traitName === "Authority" || traitName === "Hero") {
50647
- console.log(`[debug:executeTransitionEffects] ${traitName} after executeAll liveEntity.tiles type=`, typeof liveEntity.tiles, Array.isArray(liveEntity.tiles) ? "len=" + liveEntity.tiles?.length : "", "firstTilePos=", Array.isArray(liveEntity.tiles) && liveEntity.tiles.length > 0 ? JSON.stringify(liveEntity.tiles[0]).slice(0, 120) : "n/a");
50070
+ sharedEntityLog.debug("executeTransitionEffects after executeAll", {
50071
+ traitName,
50072
+ tilesType: typeof liveEntity.tiles,
50073
+ tilesLength: Array.isArray(liveEntity.tiles) ? liveEntity.tiles?.length : void 0,
50074
+ firstTilePos: Array.isArray(liveEntity.tiles) && liveEntity.tiles.length > 0 ? JSON.stringify(liveEntity.tiles[0]).slice(0, 120) : void 0
50075
+ });
50648
50076
  }
50649
50077
  if (sharedKey !== void 0) {
50650
50078
  sharedEntityStore.commit(sharedKey, liveEntity);
50651
50079
  }
50652
- log12.debug("effects:executed", () => ({
50080
+ log11.debug("effects:executed", () => ({
50653
50081
  traitName,
50654
50082
  transition: `${previousState}->${newState}`,
50655
50083
  event: flushEvent,
@@ -50659,7 +50087,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50659
50087
  slotsTouched: Array.from(pendingSlots.keys()).join(",")
50660
50088
  }));
50661
50089
  for (const [slot, patterns] of pendingSlots) {
50662
- log12.debug("flush:slot", {
50090
+ log11.debug("flush:slot", {
50663
50091
  traitName,
50664
50092
  slot,
50665
50093
  patternCount: patterns.length,
@@ -50674,7 +50102,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50674
50102
  });
50675
50103
  }
50676
50104
  } catch (error) {
50677
- log12.error("effects:error", {
50105
+ log11.error("effects:error", {
50678
50106
  traitName,
50679
50107
  transition: `${previousState}->${newState}`,
50680
50108
  event: flushEvent,
@@ -50696,7 +50124,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
50696
50124
  payload: {},
50697
50125
  state: currentState
50698
50126
  };
50699
- const bindingCfg = getBindingConfig(binding);
50127
+ const bindingCfg = getBindingConfig(binding) ?? traitConfigsByName?.[traitName];
50700
50128
  if (bindingCfg) {
50701
50129
  guardCtx.config = bindingCfg;
50702
50130
  }
@@ -51059,17 +50487,19 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51059
50487
  }, [traitBindings, eventBus, enqueueAndDrain]);
51060
50488
  useEffect(() => {
51061
50489
  const mgr = managerRef.current;
51062
- const inited = initedTraitsRef.current;
50490
+ const eventsToFire = /* @__PURE__ */ new Set();
51063
50491
  for (const binding of traitBindings) {
51064
50492
  const traitName = binding.trait.name;
51065
- if (inited.has(traitName)) continue;
51066
50493
  const lifecycleEvent = LIFECYCLE_EVENTS.find(
51067
50494
  (evt) => mgr.canHandleEvent(traitName, evt)
51068
50495
  );
51069
- if (lifecycleEvent === void 0) continue;
51070
- inited.add(traitName);
51071
- stateLog.debug("mount:fire-lifecycle", { traitName, event: lifecycleEvent });
51072
- enqueueAndDrain(lifecycleEvent, {});
50496
+ if (lifecycleEvent !== void 0) {
50497
+ eventsToFire.add(lifecycleEvent);
50498
+ }
50499
+ }
50500
+ for (const event of eventsToFire) {
50501
+ stateLog.debug("mount:fire-lifecycle", { event, traitCount: traitBindings.length });
50502
+ enqueueAndDrain(event, {});
51073
50503
  }
51074
50504
  return () => {
51075
50505
  initedTraitsRef.current = /* @__PURE__ */ new Set();
@@ -51083,228 +50513,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
51083
50513
  };
51084
50514
  }
51085
50515
 
51086
- // lib/orbitalsByTrait.ts
51087
- function buildOrbitalsByTrait(schema, resolvedPages = []) {
51088
- const map = {};
51089
- if (!schema?.orbitals) return map;
51090
- const pagePathToOrbital = {};
51091
- for (const orb of schema.orbitals) {
51092
- for (const traitRef of orb.traits ?? []) {
51093
- let traitName;
51094
- if (typeof traitRef === "string") {
51095
- const parts = traitRef.split(".");
51096
- traitName = parts[parts.length - 1];
51097
- } else if (typeof traitRef.ref === "string") {
51098
- const parts = traitRef.ref.split(".");
51099
- traitName = traitRef.name ?? parts[parts.length - 1];
51100
- } else if (typeof traitRef.name === "string") {
51101
- traitName = traitRef.name;
51102
- }
51103
- if (traitName) map[traitName] = orb.name;
51104
- }
51105
- for (const pg of orb.pages ?? []) {
51106
- const path = typeof pg === "string" ? pg : pg?.path;
51107
- if (path) pagePathToOrbital[path] = orb.name;
51108
- }
51109
- }
51110
- for (const page of resolvedPages) {
51111
- const orbital = page.path ? pagePathToOrbital[page.path] : void 0;
51112
- if (!orbital) continue;
51113
- for (const traitName of page.traitNames) {
51114
- if (traitName && !(traitName in map)) map[traitName] = orbital;
51115
- }
51116
- }
51117
- return map;
51118
- }
51119
-
51120
50516
  // runtime/OrbPreview.tsx
51121
50517
  init_verificationRegistry();
51122
- var PERF_NAMESPACE = "almadar:perf:canvas";
51123
- var log9 = createLogger(PERF_NAMESPACE);
51124
- var RING_SIZE = 50;
51125
- var ring = [];
51126
- var writeIdx = 0;
51127
- var subscribers = /* @__PURE__ */ new Set();
51128
- var notifyScheduled = false;
51129
- function scheduleNotify() {
51130
- if (notifyScheduled) return;
51131
- notifyScheduled = true;
51132
- queueMicrotask(() => {
51133
- notifyScheduled = false;
51134
- for (const fn of subscribers) fn();
51135
- });
51136
- }
51137
- function push(entry) {
51138
- if (ring.length < RING_SIZE) {
51139
- ring.push(entry);
51140
- } else {
51141
- ring[writeIdx] = entry;
51142
- }
51143
- writeIdx = (writeIdx + 1) % RING_SIZE;
51144
- scheduleNotify();
51145
- }
51146
- function isEnabled() {
51147
- return isLogLevelEnabled("DEBUG", PERF_NAMESPACE);
51148
- }
51149
- function now() {
51150
- return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
51151
- }
51152
- function perfStart(name) {
51153
- if (!isEnabled()) return -1;
51154
- if (typeof performance !== "undefined" && typeof performance.mark === "function") {
51155
- try {
51156
- performance.mark(`${name}-start`);
51157
- } catch {
51158
- }
51159
- }
51160
- return now();
51161
- }
51162
- function perfEnd(name, startToken, detail) {
51163
- if (startToken < 0 || !isEnabled()) return;
51164
- const endTs = now();
51165
- const durationMs = endTs - startToken;
51166
- if (typeof performance !== "undefined" && typeof performance.measure === "function") {
51167
- try {
51168
- performance.mark(`${name}-end`);
51169
- performance.measure(name, `${name}-start`, `${name}-end`);
51170
- } catch {
51171
- }
51172
- }
51173
- push({ name, durationMs, ts: endTs, detail });
51174
- log9.debug(name, () => ({ durationMs, ...detail ?? {} }));
51175
- }
51176
- var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
51177
- if (!isEnabled()) return;
51178
- push({
51179
- name: `profiler:${id}:${phase}`,
51180
- durationMs: actualDuration,
51181
- ts: commitTime,
51182
- detail: { baseDuration }
51183
- });
51184
- log9.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
51185
- };
51186
-
51187
- // lib/prepareSchemaForPreview.ts
51188
- function generateEntityRow(entity, idx) {
51189
- const row = { id: String(idx) };
51190
- for (const f3 of entity.fields) {
51191
- if (f3.name === void 0 || f3.name === "id") continue;
51192
- row[f3.name] = generateFieldValue(entity.name, f3, idx);
51193
- }
51194
- return row;
51195
- }
51196
- function generateFieldValue(entityName, field, idx) {
51197
- if ("values" in field && field.values && field.values.length > 0) {
51198
- return field.values[(idx - 1) % field.values.length];
51199
- }
51200
- const fieldName = field.name ?? "";
51201
- switch (field.type) {
51202
- case "string":
51203
- return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
51204
- case "number":
51205
- return idx * 10;
51206
- case "boolean":
51207
- return idx % 2 === 0;
51208
- default:
51209
- return field.default ?? null;
51210
- }
51211
- }
51212
- function buildMockData(schema) {
51213
- const t = perfStart("build-mock-data");
51214
- const result = {};
51215
- for (const orbital of schema.orbitals) {
51216
- const entity = orbital.entity;
51217
- if (!entity || typeof entity === "string") continue;
51218
- if (isEntityCall(entity)) continue;
51219
- const entityName = entity.name;
51220
- if (!entityName) continue;
51221
- if (entity.instances && entity.instances.length > 0) {
51222
- result[entityName] = entity.instances;
51223
- continue;
51224
- }
51225
- const rows = Array.from(
51226
- { length: 10 },
51227
- (_, i) => generateEntityRow(entity, i + 1)
51228
- );
51229
- result[entityName] = rows;
51230
- }
51231
- for (const orbital of schema.orbitals) {
51232
- for (const traitRef of orbital.traits ?? []) {
51233
- if (!isInlineTrait3(traitRef)) continue;
51234
- const trait = traitRef;
51235
- const sourceEntity = trait.sourceEntityDefinition;
51236
- if (!sourceEntity || isEntityCall(sourceEntity)) continue;
51237
- const sourceName = sourceEntity.name;
51238
- if (!sourceName) continue;
51239
- if (!result[sourceName]) {
51240
- result[sourceName] = sourceEntity.instances && sourceEntity.instances.length > 0 ? sourceEntity.instances : Array.from(
51241
- { length: 10 },
51242
- (_, i) => generateEntityRow(sourceEntity, i + 1)
51243
- );
51244
- }
51245
- const reboundName = trait.linkedEntity;
51246
- if (!reboundName || reboundName === sourceName) continue;
51247
- const reboundRows = result[reboundName];
51248
- if (!reboundRows || reboundRows.length === 0) continue;
51249
- reboundRows.forEach((row, i) => {
51250
- for (const f3 of sourceEntity.fields) {
51251
- if (f3.name === void 0 || f3.name === "id") continue;
51252
- if (row[f3.name] !== void 0) continue;
51253
- row[f3.name] = generateFieldValue(sourceName, f3, i + 1);
51254
- }
51255
- });
51256
- }
51257
- }
51258
- perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
51259
- return result;
51260
- }
51261
- function isInlineTrait3(traitRef) {
51262
- return typeof traitRef === "object" && traitRef !== null && "stateMachine" in traitRef;
51263
- }
51264
- function findDataState(sm, initialStateName) {
51265
- return sm.states.find((s) => {
51266
- if (s.name === initialStateName) return false;
51267
- return sm.transitions.some(
51268
- (t) => t.event === "INIT" && (t.from === s.name || Array.isArray(t.from) && t.from.includes(s.name))
51269
- );
51270
- });
51271
- }
51272
- function rewriteTraitInitialState(trait, mockData) {
51273
- const sm = trait.stateMachine;
51274
- if (!sm) return trait;
51275
- const linkedEntity = trait.linkedEntity;
51276
- if (!linkedEntity || !mockData[linkedEntity]?.length) return trait;
51277
- const initialStateName = sm.states.find((s) => s.isInitial)?.name ?? sm.states[0]?.name;
51278
- if (!initialStateName) return trait;
51279
- const dataState = findDataState(sm, initialStateName);
51280
- if (!dataState) return trait;
51281
- const updatedStates = sm.states.map((s) => {
51282
- if (s.name === initialStateName) return { ...s, isInitial: false };
51283
- if (s.name === dataState.name) return { ...s, isInitial: true };
51284
- return s;
51285
- });
51286
- return { ...trait, stateMachine: { ...sm, states: updatedStates } };
51287
- }
51288
- function adjustSchemaForMockData(schema, mockData) {
51289
- let changed = false;
51290
- const updatedOrbitals = schema.orbitals.map((orbital) => {
51291
- const traits2 = orbital.traits ?? [];
51292
- const updatedTraits = traits2.map((traitRef) => {
51293
- if (!isInlineTrait3(traitRef)) return traitRef;
51294
- const updated = rewriteTraitInitialState(traitRef, mockData);
51295
- if (updated !== traitRef) changed = true;
51296
- return updated;
51297
- });
51298
- return changed ? { ...orbital, traits: updatedTraits } : orbital;
51299
- });
51300
- return changed ? { ...schema, orbitals: updatedOrbitals } : schema;
51301
- }
51302
- function prepareSchemaForPreview(input) {
51303
- const parsed = typeof input === "string" ? JSON.parse(input) : input;
51304
- const mockData = buildMockData(parsed);
51305
- const schema = adjustSchemaForMockData(parsed, mockData);
51306
- return { schema, mockData };
51307
- }
51308
50518
  var xOrbitalLog = createLogger("almadar:runtime:cross-orbital");
51309
50519
  var navLog = createLogger("almadar:runtime:navigation");
51310
50520
  function normalizeChild(child) {
@@ -51392,6 +50602,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51392
50602
  hadPrev: prevTraitsRef.current !== void 0
51393
50603
  }));
51394
50604
  if (refChanged) {
50605
+ navLog.info("page:traits-reset", { traitsCount: Array.isArray(traits2) ? traits2.length : -1 });
51395
50606
  uiSlots.clearAll();
51396
50607
  initSentRef.current = false;
51397
50608
  }
@@ -51537,24 +50748,10 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
51537
50748
  pageOrbitalNames: pageOrbitalNames.join(",")
51538
50749
  });
51539
50750
  }, [pageName, allPageTraits, orbitalsByTrait, pageOrbitalNames]);
51540
- const traitConfigsByName = useMemo(() => {
51541
- const map = {};
51542
- const orbitals = schema?.orbitals;
51543
- if (!orbitals) return map;
51544
- for (const orb of orbitals) {
51545
- const traitRefs = orb.traits;
51546
- if (!traitRefs) continue;
51547
- for (const t of traitRefs) {
51548
- if (typeof t === "string") continue;
51549
- const name = t.name ?? t.ref;
51550
- const config = t.config;
51551
- if (typeof name === "string" && config !== void 0) {
51552
- map[name] = config;
51553
- }
51554
- }
51555
- }
51556
- return map;
51557
- }, [schema]);
50751
+ const traitConfigsByName = useMemo(
50752
+ () => buildResolvedTraitConfigs(schema),
50753
+ [schema]
50754
+ );
51558
50755
  const embeddedTraits = useMemo(() => {
51559
50756
  const set = collectEmbeddedTraits(schema);
51560
50757
  xOrbitalLog.info("SchemaRunner:embeddedTraits", {
@@ -51823,7 +51020,7 @@ init_useEventBus();
51823
51020
  // components/avl/hooks/useCanvasDnd.tsx
51824
51021
  init_useEventBus();
51825
51022
  init_useAlmadarDndCollision();
51826
- var log10 = createLogger("almadar:ui:canvas-dnd");
51023
+ var log9 = createLogger("almadar:ui:canvas-dnd");
51827
51024
  function useCanvasDraggable({
51828
51025
  id,
51829
51026
  payload,
@@ -51862,7 +51059,7 @@ function defaultEmit(eventBus, drop) {
51862
51059
  if (payload.kind === "pattern") {
51863
51060
  const patternType = payload.data["type"];
51864
51061
  if (typeof patternType !== "string") {
51865
- log10.warn("default-emit:pattern:missing-type");
51062
+ log9.warn("default-emit:pattern:missing-type");
51866
51063
  return;
51867
51064
  }
51868
51065
  const out = { patternType, containerNode: target.containerNode };
@@ -51871,23 +51068,23 @@ function defaultEmit(eventBus, drop) {
51871
51068
  out.index = resolved.index;
51872
51069
  }
51873
51070
  eventBus.emit("UI:PATTERN_DROP", out);
51874
- log10.info("default-emit:pattern", { patternType, level: target.level });
51071
+ log9.info("default-emit:pattern", { patternType, level: target.level });
51875
51072
  return;
51876
51073
  }
51877
51074
  if (payload.kind === "behavior") {
51878
51075
  const behaviorName = payload.data["name"];
51879
51076
  if (typeof behaviorName !== "string") {
51880
- log10.warn("default-emit:behavior:missing-name");
51077
+ log9.warn("default-emit:behavior:missing-name");
51881
51078
  return;
51882
51079
  }
51883
51080
  eventBus.emit("UI:BEHAVIOR_DROP", {
51884
51081
  behaviorName,
51885
51082
  containerNode: target.containerNode
51886
51083
  });
51887
- log10.info("default-emit:behavior", { behaviorName, level: target.level });
51084
+ log9.info("default-emit:behavior", { behaviorName, level: target.level });
51888
51085
  return;
51889
51086
  }
51890
- log10.debug("default-emit:unhandled-kind", { kind: payload.kind });
51087
+ log9.debug("default-emit:unhandled-kind", { kind: payload.kind });
51891
51088
  }
51892
51089
  function CanvasDndProvider({
51893
51090
  children,
@@ -51903,9 +51100,9 @@ function CanvasDndProvider({
51903
51100
  if (payload) {
51904
51101
  setActivePayload(payload);
51905
51102
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
51906
- log10.info("dragStart", { id: e.active.id, kind: payload.kind });
51103
+ log9.info("dragStart", { id: e.active.id, kind: payload.kind });
51907
51104
  } else {
51908
- log10.warn("dragStart:missing-payload", { id: e.active.id });
51105
+ log9.warn("dragStart:missing-payload", { id: e.active.id });
51909
51106
  }
51910
51107
  }, [eventBus]);
51911
51108
  const handleDragEnd = React90__default.useCallback((e) => {
@@ -51915,7 +51112,7 @@ function CanvasDndProvider({
51915
51112
  const overData = e.over?.data.current;
51916
51113
  const target = overData?.target;
51917
51114
  const accepts = overData?.accepts;
51918
- log10.info("dragEnd", {
51115
+ log9.info("dragEnd", {
51919
51116
  activeId: e.active.id,
51920
51117
  overId: e.over?.id,
51921
51118
  hasPayload: !!payload,
@@ -51927,7 +51124,7 @@ function CanvasDndProvider({
51927
51124
  }
51928
51125
  if (!payload || !target) return;
51929
51126
  if (accepts && !accepts.includes(payload.kind)) {
51930
- log10.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
51127
+ log9.debug("dragEnd:rejected:kind", { kind: payload.kind, accepts: [...accepts] });
51931
51128
  return;
51932
51129
  }
51933
51130
  const activator = e.activatorEvent;
@@ -51939,7 +51136,7 @@ function CanvasDndProvider({
51939
51136
  }, [eventBus, onDrop]);
51940
51137
  const handleDragCancel = React90__default.useCallback(() => {
51941
51138
  setActivePayload(null);
51942
- log10.info("dragCancel");
51139
+ log9.info("dragCancel");
51943
51140
  }, []);
51944
51141
  return /* @__PURE__ */ jsxs(
51945
51142
  DndContext,
@@ -53772,7 +52969,7 @@ init_AvlTransitionLane();
53772
52969
  init_AvlSwimLane();
53773
52970
  init_avl_atom_types();
53774
52971
  init_avl_elk_layout();
53775
- var log11 = createLogger("almadar:ui:avl:trait-scene");
52972
+ var log10 = createLogger("almadar:ui:avl:trait-scene");
53776
52973
  var SWIM_GUTTER2 = 120;
53777
52974
  var CENTER_W2 = 360;
53778
52975
  var AvlTraitScene = ({
@@ -53785,7 +52982,7 @@ var AvlTraitScene = ({
53785
52982
  const dataKey = useMemo(() => JSON.stringify(data), [data]);
53786
52983
  useEffect(() => {
53787
52984
  computeTraitLayout(data).then(setLayout).catch((error) => {
53788
- log11.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
52985
+ log10.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
53789
52986
  });
53790
52987
  }, [dataKey]);
53791
52988
  if (!layout) {
@@ -53978,6 +53175,14 @@ TraitCardNode.displayName = "TraitCardNode";
53978
53175
 
53979
53176
  // components/avl/organisms/FlowCanvas.tsx
53980
53177
  init_useEventBus();
53178
+ var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
53179
+ pushPerfEntry({
53180
+ name: `profiler:${id}:${phase}`,
53181
+ durationMs: actualDuration,
53182
+ ts: commitTime,
53183
+ detail: { baseDuration }
53184
+ });
53185
+ };
53981
53186
  var flowCanvasLog = createLogger("almadar:ui:flow-canvas");
53982
53187
  var NODE_TYPES = {
53983
53188
  preview: OrbPreviewNode,