@almadar/ui 6.9.0 → 6.11.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 (35) hide show
  1. package/dist/{EntityBindingContext-Bn3ePJQC.d.cts → EntityBindingContext-D5lRu6p1.d.cts} +25 -2
  2. package/dist/{EntityBindingContext-Bn3ePJQC.d.ts → EntityBindingContext-D5lRu6p1.d.ts} +25 -2
  3. package/dist/{GameAudioProvider-Dk_Y3LN3.d.cts → GameAudioProvider-D8GynTNq.d.cts} +1 -1
  4. package/dist/{GameAudioProvider-Ctceau1s.d.ts → GameAudioProvider-Dozqx4sL.d.ts} +1 -1
  5. package/dist/avl/index.cjs +254 -108
  6. package/dist/avl/index.js +213 -67
  7. package/dist/{avl-schema-parser-DncJLEn9.d.ts → avl-schema-parser-DX-aVCCm.d.ts} +1 -1
  8. package/dist/{avl-schema-parser-FQ1474v8.d.cts → avl-schema-parser-PVu8rgsy.d.cts} +1 -1
  9. package/dist/{cn-C7fvp9gH.d.ts → cn-Do5gsPBm.d.cts} +2 -100
  10. package/dist/{cn-DnLYahyL.d.cts → cn-Do5gsPBm.d.ts} +2 -100
  11. package/dist/components/index.cjs +103 -68
  12. package/dist/components/index.d.cts +46 -22
  13. package/dist/components/index.d.ts +46 -22
  14. package/dist/components/index.js +64 -29
  15. package/dist/lib/drawable/three/index.d.cts +3 -4
  16. package/dist/lib/drawable/three/index.d.ts +3 -4
  17. package/dist/lib/index.cjs +7 -23
  18. package/dist/lib/index.d.cts +6 -28
  19. package/dist/lib/index.d.ts +6 -28
  20. package/dist/lib/index.js +5 -23
  21. package/dist/{paintDispatch-B5ObLnUv.d.ts → paintDispatch-CK5uwYEq.d.cts} +50 -3
  22. package/dist/{paintDispatch-D3R8NNmV.d.cts → paintDispatch-CK5uwYEq.d.ts} +50 -3
  23. package/dist/providers/index.cjs +158 -88
  24. package/dist/providers/index.d.cts +5 -3
  25. package/dist/providers/index.d.ts +5 -3
  26. package/dist/providers/index.js +119 -49
  27. package/dist/runtime/index.cjs +253 -107
  28. package/dist/runtime/index.d.cts +31 -7
  29. package/dist/runtime/index.d.ts +31 -7
  30. package/dist/runtime/index.js +212 -66
  31. package/dist/verificationRegistry-BLsjb1oU.d.cts +110 -0
  32. package/dist/verificationRegistry-D8bHWD8Q.d.ts +110 -0
  33. package/package.json +7 -7
  34. package/dist/types-B3nHgnMG.d.cts +0 -51
  35. package/dist/types-B3nHgnMG.d.ts +0 -51
@@ -19,6 +19,7 @@ var ELK = require('elkjs/lib/elk.bundled.js');
19
19
  var SyntaxHighlighter = require('react-syntax-highlighter/dist/esm/prism-light.js');
20
20
  var dark = require('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js');
21
21
  var syntax = require('@almadar/syntax');
22
+ var i18n = require('@almadar/core/i18n');
22
23
  var langJson = require('react-syntax-highlighter/dist/esm/languages/prism/json.js');
23
24
  var langJavascript = require('react-syntax-highlighter/dist/esm/languages/prism/javascript.js');
24
25
  var langTypescript = require('react-syntax-highlighter/dist/esm/languages/prism/typescript.js');
@@ -18284,6 +18285,15 @@ function buildLineProps(errorLines, extraClassName) {
18284
18285
  };
18285
18286
  };
18286
18287
  }
18288
+ function translateProgram(source, language, lang) {
18289
+ if (lang === "en") return source;
18290
+ if (language === "lolo") return syntax.translateLolo(source, lang);
18291
+ if (language === "orb") {
18292
+ const translated = syntax.translateOrb(source, lang);
18293
+ return typeof translated === "string" ? translated : source;
18294
+ }
18295
+ return source;
18296
+ }
18287
18297
  var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, HIGHLIGHT_CAPACITY_BYTES, MONO_FONT_FAMILY, VIEWER_LINE_NUMBER_STYLE, CodeBlock;
18288
18298
  var init_CodeBlock = __esm({
18289
18299
  "components/core/molecules/markdown/CodeBlock.tsx"() {
@@ -18549,6 +18559,7 @@ var init_CodeBlock = __esm({
18549
18559
  showLineNumbers = false,
18550
18560
  wordWrap = false,
18551
18561
  files,
18562
+ naturalLanguages,
18552
18563
  actions,
18553
18564
  isLoading = false,
18554
18565
  error,
@@ -18595,7 +18606,48 @@ var init_CodeBlock = __esm({
18595
18606
  "replace"
18596
18607
  ]
18597
18608
  }) => {
18598
- const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18609
+ const englishCode = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18610
+ const naturalTabs = !editable && naturalLanguages && naturalLanguages.length > 1 ? naturalLanguages : void 0;
18611
+ const [naturalLanguage, setNaturalLanguage] = React89.useState(() => naturalTabs?.[0] ?? "en");
18612
+ const activeNaturalLanguage = naturalTabs?.includes(naturalLanguage) === true ? naturalLanguage : naturalTabs?.[0] ?? "en";
18613
+ const translationCache = React89.useMemo(() => /* @__PURE__ */ new Map(), [englishCode, files]);
18614
+ const translateFor = React89.useCallback(
18615
+ (source, sourceLanguage, cacheKey) => {
18616
+ if (activeNaturalLanguage === "en") return source;
18617
+ const key = `${cacheKey}|${sourceLanguage}|${activeNaturalLanguage}`;
18618
+ const hit = translationCache.get(key);
18619
+ if (hit !== void 0) return hit;
18620
+ const translated = translateProgram(source, sourceLanguage, activeNaturalLanguage);
18621
+ translationCache.set(key, translated);
18622
+ return translated;
18623
+ },
18624
+ [translationCache, activeNaturalLanguage]
18625
+ );
18626
+ const code = translateFor(englishCode, language, "code");
18627
+ const naturalTabItems = naturalTabs?.map((lang) => ({
18628
+ id: `lang-${lang}`,
18629
+ label: i18n.coreTables[lang].meta.name,
18630
+ content: null
18631
+ }));
18632
+ const naturalTabStrip = naturalTabs && naturalTabItems ? /* @__PURE__ */ jsxRuntime.jsx(
18633
+ Box,
18634
+ {
18635
+ className: "border-b border-border",
18636
+ dir: i18n.coreTables[activeNaturalLanguage].meta.rtl ? "rtl" : "ltr",
18637
+ "data-testid": "codeblock-language-tabs",
18638
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18639
+ Tabs,
18640
+ {
18641
+ tabs: naturalTabItems,
18642
+ activeTab: `lang-${activeNaturalLanguage}`,
18643
+ onTabChange: (id) => {
18644
+ const next = naturalTabs.find((lang) => `lang-${lang}` === id);
18645
+ if (next) setNaturalLanguage(next);
18646
+ }
18647
+ }
18648
+ )
18649
+ }
18650
+ ) : null;
18599
18651
  const activeStyle = resolveHighlightStyle(language);
18600
18652
  const overCapacity = code.length > HIGHLIGHT_CAPACITY_BYTES;
18601
18653
  const plainCodeColor = plainCodeColorOf(activeStyle);
@@ -18608,8 +18660,8 @@ var init_CodeBlock = __esm({
18608
18660
  const [wrap, setWrap] = React89.useState(wordWrap);
18609
18661
  const [activeFileIndex, setActiveFileIndex] = React89.useState(0);
18610
18662
  const activeFile = files?.[activeFileIndex];
18611
- const activeCode = activeFile?.code ?? code;
18612
18663
  const activeLanguage = activeFile?.language ?? language;
18664
+ const activeCode = activeFile ? translateFor(activeFile.code, activeLanguage, `file-${activeFileIndex}`) : code;
18613
18665
  const languageReady = useLanguageReady(activeLanguage);
18614
18666
  const viewerStyle = resolveHighlightStyle(activeLanguage);
18615
18667
  const viewerPlainCodeColor = plainCodeColorOf(viewerStyle);
@@ -19094,6 +19146,7 @@ var init_CodeBlock = __esm({
19094
19146
  content: null
19095
19147
  }));
19096
19148
  return /* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
19149
+ naturalTabStrip,
19097
19150
  tabItems && tabItems.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
19098
19151
  Tabs,
19099
19152
  {
@@ -19155,7 +19208,7 @@ var init_CodeBlock = __esm({
19155
19208
  ]
19156
19209
  }
19157
19210
  ),
19158
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19211
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, dir: "ltr", children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19159
19212
  ] }) });
19160
19213
  }
19161
19214
  const hasHeader = showLanguageBadge || effectiveCopy;
@@ -19182,6 +19235,7 @@ var init_CodeBlock = __esm({
19182
19235
  ]
19183
19236
  }
19184
19237
  ),
19238
+ naturalTabStrip,
19185
19239
  editable ? (
19186
19240
  /* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
19187
19241
  top of a Prism-highlighted SyntaxHighlighter overlay.
@@ -19333,6 +19387,7 @@ var init_CodeBlock = __esm({
19333
19387
  {
19334
19388
  ref: scrollRef,
19335
19389
  onCopy: handleSelectionCopy,
19390
+ dir: "ltr",
19336
19391
  style: {
19337
19392
  flex: 1,
19338
19393
  minHeight: 0,
@@ -19351,7 +19406,7 @@ var init_CodeBlock = __esm({
19351
19406
  )
19352
19407
  ] });
19353
19408
  },
19354
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19409
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.naturalLanguages === next.naturalLanguages && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19355
19410
  );
19356
19411
  CodeBlock.displayName = "CodeBlock";
19357
19412
  }
@@ -23046,26 +23101,6 @@ var init_ButtonGroup = __esm({
23046
23101
  ButtonGroup.displayName = "ButtonGroup";
23047
23102
  }
23048
23103
  });
23049
- function getNestedValue(obj, path) {
23050
- if (obj === null || obj === void 0 || !path) {
23051
- return void 0;
23052
- }
23053
- if (!path.includes(".")) {
23054
- return obj[path];
23055
- }
23056
- const parts = path.split(".");
23057
- let value = obj;
23058
- for (const part of parts) {
23059
- if (value === null || value === void 0) {
23060
- return void 0;
23061
- }
23062
- if (typeof value !== "object" || Array.isArray(value)) {
23063
- return void 0;
23064
- }
23065
- value = value[part];
23066
- }
23067
- return value;
23068
- }
23069
23104
  function resolveImageUrl(value) {
23070
23105
  if (typeof value === "string") {
23071
23106
  return value;
@@ -23193,11 +23228,11 @@ function getWeekDays(start) {
23193
23228
  return days;
23194
23229
  }
23195
23230
  function eventStartDate(event, startField) {
23196
- const raw = getNestedValue(event, startField);
23231
+ const raw = core.getNestedValue(event, startField);
23197
23232
  return new Date(raw ?? "");
23198
23233
  }
23199
23234
  function eventEndDate(event, endField) {
23200
- const raw = getNestedValue(event, endField);
23235
+ const raw = core.getNestedValue(event, endField);
23201
23236
  if (raw === void 0 || raw === null || raw === "") return null;
23202
23237
  const end = new Date(raw);
23203
23238
  return Number.isNaN(end.getTime()) ? null : end;
@@ -23332,8 +23367,8 @@ function CalendarGrid({
23332
23367
  }, [longPressEvent, longPressPayload, eventBus]);
23333
23368
  const renderChip = children ?? renderItem;
23334
23369
  const renderEvent = (event) => {
23335
- const color = getNestedValue(event, colorField);
23336
- const label = String(getNestedValue(event, titleField) ?? "");
23370
+ const color = core.getNestedValue(event, colorField);
23371
+ const label = String(core.getNestedValue(event, titleField) ?? "");
23337
23372
  const eventIndex = evs.indexOf(event);
23338
23373
  return /* @__PURE__ */ jsxRuntime.jsx(
23339
23374
  Box,
@@ -23454,7 +23489,7 @@ function CalendarGrid({
23454
23489
  children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
23455
23490
  slotEvents.map(renderEvent),
23456
23491
  continuingEvents.map((event) => {
23457
- const color = getNestedValue(event, colorField);
23492
+ const color = core.getNestedValue(event, colorField);
23458
23493
  return /* @__PURE__ */ jsxRuntime.jsx(
23459
23494
  Box,
23460
23495
  {
@@ -23772,7 +23807,7 @@ var init_CardGrid = __esm({
23772
23807
  e.stopPropagation();
23773
23808
  if (action.navigatesTo) {
23774
23809
  const url = action.navigatesTo.replace(/\{\{row\.(\w+(?:\.\w+)*)\}\}/g, (_, field) => {
23775
- const value = getNestedValue(itemData, field);
23810
+ const value = core.getNestedValue(itemData, field);
23776
23811
  return value !== void 0 && value !== null ? String(value) : "";
23777
23812
  });
23778
23813
  eventBus.emit("UI:NAVIGATE", { url, row: itemData });
@@ -23805,8 +23840,8 @@ var init_CardGrid = __esm({
23805
23840
  return normalizedData.map((item, index) => {
23806
23841
  const itemData = item;
23807
23842
  const id = itemData.id || String(index);
23808
- const titleValue = titleField ? getNestedValue(itemData, titleField) : void 0;
23809
- const statusValue = statusField ? getNestedValue(itemData, statusField) : void 0;
23843
+ const titleValue = titleField ? core.getNestedValue(itemData, titleField) : void 0;
23844
+ const statusValue = statusField ? core.getNestedValue(itemData, statusField) : void 0;
23810
23845
  return /* @__PURE__ */ jsxRuntime.jsxs(
23811
23846
  Box,
23812
23847
  {
@@ -23821,7 +23856,7 @@ var init_CardGrid = __esm({
23821
23856
  actionPayload: { row: itemData },
23822
23857
  children: [
23823
23858
  imageField && (() => {
23824
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
23859
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
23825
23860
  if (!imgUrl) return null;
23826
23861
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
23827
23862
  "img",
@@ -23853,7 +23888,7 @@ var init_CardGrid = __esm({
23853
23888
  )) })
23854
23889
  ] }) }),
23855
23890
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
23856
- const value = getNestedValue(itemData, field);
23891
+ const value = core.getNestedValue(itemData, field);
23857
23892
  if (value === void 0 || value === null || value === "") return null;
23858
23893
  const fieldValue = value;
23859
23894
  const boolVal = asBooleanValue(fieldValue);
@@ -28014,7 +28049,7 @@ function DataGrid({
28014
28049
  )
28015
28050
  );
28016
28051
  }
28017
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
28052
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
28018
28053
  return wrapDnd(
28019
28054
  /* @__PURE__ */ jsxRuntime.jsxs(
28020
28055
  Box,
@@ -28033,7 +28068,7 @@ function DataGrid({
28033
28068
  ),
28034
28069
  children: [
28035
28070
  imageField && (() => {
28036
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
28071
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
28037
28072
  if (!imgUrl) return null;
28038
28073
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
28039
28074
  "img",
@@ -28070,7 +28105,7 @@ function DataGrid({
28070
28105
  )
28071
28106
  ] }),
28072
28107
  badgeFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
28073
- const val = getNestedValue(itemData, field.name);
28108
+ const val = core.getNestedValue(itemData, field.name);
28074
28109
  if (val === void 0 || val === null || val === "") return null;
28075
28110
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
28076
28111
  field.icon && renderIconInput(field.icon, { size: "xs" }),
@@ -28111,12 +28146,12 @@ function DataGrid({
28111
28146
  ] }) }),
28112
28147
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 pt-2 pb-4 flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
28113
28148
  bodyFields.filter((f3) => f3.variant === "caption" && f3.format !== "boolean").map((field) => {
28114
- const value = getNestedValue(itemData, field.name);
28149
+ const value = core.getNestedValue(itemData, field.name);
28115
28150
  if (value === void 0 || value === null || value === "") return null;
28116
28151
  return /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", className: "line-clamp-2", children: formatValue(value, field.format) }, field.name);
28117
28152
  }),
28118
28153
  /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: "flex-wrap gap-y-1", children: bodyFields.filter((f3) => f3.variant !== "caption" || f3.format === "boolean").map((field) => {
28119
- const value = getNestedValue(itemData, field.name);
28154
+ const value = core.getNestedValue(itemData, field.name);
28120
28155
  if (value === void 0 || value === null || value === "") return null;
28121
28156
  if (field.format === "boolean") {
28122
28157
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
@@ -28234,7 +28269,7 @@ function formatValue2(value, format, boolLabels) {
28234
28269
  function groupData(items, field) {
28235
28270
  const groups = /* @__PURE__ */ new Map();
28236
28271
  for (const item of items) {
28237
- const key = String(getNestedValue(item, field) ?? "");
28272
+ const key = String(core.getNestedValue(item, field) ?? "");
28238
28273
  const group = groups.get(key);
28239
28274
  if (group) group.push(item);
28240
28275
  else groups.set(key, [item]);
@@ -28427,7 +28462,7 @@ function DataList({
28427
28462
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
28428
28463
  const senderLabel = (itemData, raw) => {
28429
28464
  if (!senderLabelField) return raw;
28430
- const v = getNestedValue(itemData, senderLabelField);
28465
+ const v = core.getNestedValue(itemData, senderLabelField);
28431
28466
  return v === void 0 || v === null || v === "" ? raw : String(v);
28432
28467
  };
28433
28468
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
@@ -28435,11 +28470,11 @@ function DataList({
28435
28470
  group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
28436
28471
  group.items.map((itemData, index) => {
28437
28472
  const id = itemData.id || `${gi}-${index}`;
28438
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
28473
+ const sender = senderField ? String(core.getNestedValue(itemData, senderField) ?? "") : "";
28439
28474
  const isSent = Boolean(currentUser && sender === currentUser);
28440
- const content = getNestedValue(itemData, contentField);
28475
+ const content = core.getNestedValue(itemData, contentField);
28441
28476
  const timestampField = fieldDefs.find((f3) => f3.format === "date");
28442
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
28477
+ const timestamp = timestampField ? core.getNestedValue(itemData, timestampField.name) : null;
28443
28478
  const metaFields = fieldDefs.filter(
28444
28479
  (f3) => f3.name !== contentField && f3.name !== timestampField?.name
28445
28480
  );
@@ -28465,7 +28500,7 @@ function DataList({
28465
28500
  !isSent && senderField && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
28466
28501
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
28467
28502
  metaFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
28468
- const v = getNestedValue(itemData, f3.name);
28503
+ const v = core.getNestedValue(itemData, f3.name);
28469
28504
  if (v === void 0 || v === null || v === "") return null;
28470
28505
  return f3.variant === "badge" ? (
28471
28506
  // `format` applies here too — a boolean field badged
@@ -28553,7 +28588,7 @@ function DataList({
28553
28588
  );
28554
28589
  }
28555
28590
  const id = itemData.id || String(index);
28556
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
28591
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
28557
28592
  return wrapDnd(
28558
28593
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-entity-row": true, "data-entity-id": id, onClick: rowClickEvent ? handleRowClick(itemData) : void 0, className: cn(rowClickEvent && "cursor-pointer"), children: [
28559
28594
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -28582,7 +28617,7 @@ function DataList({
28582
28617
  }
28583
28618
  ),
28584
28619
  badgeFields.map((field) => {
28585
- const val = getNestedValue(itemData, field.name);
28620
+ const val = core.getNestedValue(itemData, field.name);
28586
28621
  if (val === void 0 || val === null) return null;
28587
28622
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
28588
28623
  field.icon && renderIconInput2(field.icon, { size: "xs" }),
@@ -28591,7 +28626,7 @@ function DataList({
28591
28626
  })
28592
28627
  ] }),
28593
28628
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: cn("flex-wrap", isCompact ? "mt-0.5" : "mt-1.5"), children: bodyFields.map((field) => {
28594
- const value = getNestedValue(itemData, field.name);
28629
+ const value = core.getNestedValue(itemData, field.name);
28595
28630
  if (value === void 0 || value === null || value === "") return null;
28596
28631
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
28597
28632
  field.icon && renderIconInput2(field.icon, { size: "xs", className: "text-muted-foreground" }),
@@ -28611,7 +28646,7 @@ function DataList({
28611
28646
  ] }, field.name);
28612
28647
  }) }),
28613
28648
  progressFields.map((field) => {
28614
- const value = getNestedValue(itemData, field.name);
28649
+ const value = core.getNestedValue(itemData, field.name);
28615
28650
  if (typeof value !== "number") return null;
28616
28651
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "mt-2 max-w-xs", children: [
28617
28652
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
@@ -35060,7 +35095,7 @@ function statusVariant4(value) {
35060
35095
  function groupData2(items, field) {
35061
35096
  const groups = /* @__PURE__ */ new Map();
35062
35097
  for (const item of items) {
35063
- const key = String(getNestedValue(item, field) ?? "");
35098
+ const key = String(core.getNestedValue(item, field) ?? "");
35064
35099
  const group = groups.get(key);
35065
35100
  if (group) group.push(item);
35066
35101
  else groups.set(key, [item]);
@@ -35176,7 +35211,7 @@ function TableView({
35176
35211
  const colFloors = React89__namespace.default.useMemo(
35177
35212
  () => colDefs.map((col) => {
35178
35213
  const longest = data.reduce((widest, row) => {
35179
- const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
35214
+ const cell = formatCell(asFieldValue(core.getNestedValue(row, col.field ?? col.key)), col.format);
35180
35215
  return Math.max(widest, cell.length);
35181
35216
  }, columnLabel(col).length);
35182
35217
  const chrome = col.format === "badge" ? BADGE_CHROME_CH : 0;
@@ -35268,7 +35303,7 @@ function TableView({
35268
35303
  }
35269
35304
  ) }),
35270
35305
  hasRenderProp ? /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
35271
- const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
35306
+ const raw = asFieldValue(core.getNestedValue(row, col.field ?? col.key));
35272
35307
  const cellBase = cn(
35273
35308
  "flex items-center min-w-0",
35274
35309
  alignClass[col.align ?? "left"],
@@ -39335,7 +39370,7 @@ function DocumentDetails({
39335
39370
  };
39336
39371
  const renderValue = (field) => {
39337
39372
  const name = fieldName(field);
39338
- const raw = getNestedValue(entity ?? {}, name);
39373
+ const raw = core.getNestedValue(entity ?? {}, name);
39339
39374
  const kind = fieldKind(field, raw);
39340
39375
  const label = field.label ?? field.header ?? humanizeFieldName(name);
39341
39376
  if (kind === "image") {
@@ -42042,11 +42077,11 @@ var init_WizardContainer = __esm({
42042
42077
  });
42043
42078
  function calculateComplexity(schema) {
42044
42079
  if (!schema) return 1;
42045
- const entities = schema.dataEntities?.length || 0;
42080
+ const entities = schema.dataEntities || 0;
42046
42081
  const pages = schema.ui?.pages?.length || 0;
42047
- const traits2 = schema.traits?.length || 0;
42082
+ const traits2 = schema.traits || 0;
42048
42083
  const sections = schema.ui?.pages?.reduce(
42049
- (acc, page) => acc + (page.sections?.length || 0),
42084
+ (acc, page) => acc + (page.sections || 0),
42050
42085
  0
42051
42086
  ) || 0;
42052
42087
  return entities * 3 + pages * 2 + traits2 * 2 + sections * 1;
@@ -44364,7 +44399,7 @@ function DataTable({
44364
44399
  }
44365
44400
  ) }),
44366
44401
  normalizedColumns.map((col) => {
44367
- const cellValue = getNestedValue(
44402
+ const cellValue = core.getNestedValue(
44368
44403
  row,
44369
44404
  String(col.key)
44370
44405
  );
@@ -44807,7 +44842,7 @@ var init_DetailPanel = __esm({
44807
44842
  ...section,
44808
44843
  fields: section.fields.map((field) => {
44809
44844
  if (typeof field === "string") {
44810
- const value = getNestedValue(normalizedData, field);
44845
+ const value = core.getNestedValue(normalizedData, field);
44811
44846
  return {
44812
44847
  label: labelFor(field),
44813
44848
  value: formatFieldValue2(value, field)
@@ -44847,7 +44882,7 @@ var init_DetailPanel = __esm({
44847
44882
  if (otherFields.length > 0) {
44848
44883
  const overviewFields = [];
44849
44884
  otherFields.forEach((field) => {
44850
- const value = getNestedValue(normalizedData, field);
44885
+ const value = core.getNestedValue(normalizedData, field);
44851
44886
  if (value !== void 0 && value !== null) {
44852
44887
  overviewFields.push({
44853
44888
  label: labelFor(field),
@@ -44862,7 +44897,7 @@ var init_DetailPanel = __esm({
44862
44897
  if (progressFields.length > 0 || metricFields.length > 0) {
44863
44898
  const metricsFields = [];
44864
44899
  [...progressFields, ...metricFields].forEach((field) => {
44865
- const value = getNestedValue(normalizedData, field);
44900
+ const value = core.getNestedValue(normalizedData, field);
44866
44901
  if (value !== void 0 && value !== null) {
44867
44902
  metricsFields.push({
44868
44903
  label: labelFor(field),
@@ -44877,7 +44912,7 @@ var init_DetailPanel = __esm({
44877
44912
  if (dateFields.length > 0) {
44878
44913
  const timelineFields = [];
44879
44914
  dateFields.forEach((field) => {
44880
- const value = getNestedValue(normalizedData, field);
44915
+ const value = core.getNestedValue(normalizedData, field);
44881
44916
  if (value !== void 0 && value !== null) {
44882
44917
  timelineFields.push({
44883
44918
  label: labelFor(field),
@@ -44892,7 +44927,7 @@ var init_DetailPanel = __esm({
44892
44927
  if (descriptionFields.length > 0) {
44893
44928
  const descFields = [];
44894
44929
  descriptionFields.forEach((field) => {
44895
- const value = getNestedValue(normalizedData, field);
44930
+ const value = core.getNestedValue(normalizedData, field);
44896
44931
  if (value !== void 0 && value !== null) {
44897
44932
  descFields.push({
44898
44933
  label: labelFor(field),
@@ -44949,7 +44984,7 @@ var init_DetailPanel = __esm({
44949
44984
  for (const section of sections) {
44950
44985
  for (const field of section.fields) {
44951
44986
  if (typeof field === "string") {
44952
- const value = normalizedData ? getNestedValue(normalizedData, field) : void 0;
44987
+ const value = normalizedData ? core.getNestedValue(normalizedData, field) : void 0;
44953
44988
  allFields.push({
44954
44989
  label: labelFor(field),
44955
44990
  value: renderRichFieldValue(value, field, fieldTypeMap[field], metaFor(field))
@@ -44968,7 +45003,7 @@ var init_DetailPanel = __esm({
44968
45003
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
44969
45004
  (f3) => f3.toLowerCase().includes("status") || f3.toLowerCase().includes("priority")
44970
45005
  ).map((field) => {
44971
- const value = getNestedValue(normalizedData, field);
45006
+ const value = core.getNestedValue(normalizedData, field);
44972
45007
  if (!value) return null;
44973
45008
  return /* @__PURE__ */ jsxRuntime.jsx(
44974
45009
  Badge,
@@ -45099,7 +45134,7 @@ var init_DetailPanel = __esm({
45099
45134
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
45100
45135
  (f3) => f3.toLowerCase().includes("progress") || f3.toLowerCase().includes("percent")
45101
45136
  ).map((field) => {
45102
- const value = getNestedValue(normalizedData, field);
45137
+ const value = core.getNestedValue(normalizedData, field);
45103
45138
  if (value === void 0 || value === null || typeof value !== "number")
45104
45139
  return null;
45105
45140
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", className: "w-full", children: [
@@ -46921,14 +46956,14 @@ var init_List = __esm({
46921
46956
  };
46922
46957
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
46923
46958
  const firstField = effectiveFieldNames[0];
46924
- if (!normalizedItem.title && getNestedValue(item, firstField)) {
46959
+ if (!normalizedItem.title && core.getNestedValue(item, firstField)) {
46925
46960
  normalizedItem.title = String(
46926
- getNestedValue(item, firstField)
46961
+ core.getNestedValue(item, firstField)
46927
46962
  );
46928
46963
  }
46929
46964
  normalizedItem._fields = effectiveFieldNames.reduce(
46930
46965
  (acc, field) => {
46931
- const value = getNestedValue(item, field);
46966
+ const value = core.getNestedValue(item, field);
46932
46967
  if (value !== void 0 && value !== null) {
46933
46968
  acc[field] = value;
46934
46969
  }
@@ -53015,6 +53050,29 @@ function parseLifecycleEvent(type) {
53015
53050
  }
53016
53051
  return null;
53017
53052
  }
53053
+ function mapServerEffectResults(effectResults) {
53054
+ return effectResults.map((er) => {
53055
+ const target = er["entityType"] ?? er["entity"] ?? er["service"];
53056
+ const entityName = typeof target === "string" && target !== "" ? target : void 0;
53057
+ const rawAction = er["action"];
53058
+ const action = rawAction === "create" || rawAction === "update" || rawAction === "delete" || rawAction === "batch" ? rawAction : void 0;
53059
+ const data = er["data"];
53060
+ const resultId = data !== null && typeof data === "object" && !Array.isArray(data) && typeof data["id"] === "string" ? data["id"] : void 0;
53061
+ const denied = er["denied"] === true;
53062
+ const success = er["success"] !== false;
53063
+ const outcome = denied ? "denied" : success ? "success" : "failed";
53064
+ return {
53065
+ type: String(er["type"] ?? er["effect"] ?? "server-effect"),
53066
+ ...entityName !== void 0 ? { entityName } : {},
53067
+ ...action !== void 0 ? { action } : {},
53068
+ ...resultId !== void 0 ? { resultId } : {},
53069
+ outcome,
53070
+ args: entityName !== void 0 ? [entityName] : [],
53071
+ status: outcome === "success" ? "executed" : "failed",
53072
+ error: er["error"]
53073
+ };
53074
+ });
53075
+ }
53018
53076
  function VerificationProvider({
53019
53077
  children,
53020
53078
  enabled,
@@ -53052,16 +53110,8 @@ function VerificationProvider({
53052
53110
  args: Array.isArray(e["args"]) ? e["args"] : [],
53053
53111
  status: "executed"
53054
53112
  }));
53055
- const effectResults = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
53056
- for (const er of effectResults) {
53057
- const target = er["entity"] ?? er["service"];
53058
- effects.push({
53059
- type: String(er["type"] ?? er["effect"] ?? "server-effect"),
53060
- args: typeof target === "string" && target !== "" ? [target] : [],
53061
- status: er["error"] ? "failed" : "executed",
53062
- error: er["error"]
53063
- });
53064
- }
53113
+ const effectResultsRaw = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
53114
+ effects.push(...mapServerEffectResults(effectResultsRaw));
53065
53115
  const dataEntities = {};
53066
53116
  const responseData = payload["data"];
53067
53117
  if (responseData && typeof responseData === "object") {
@@ -53946,13 +53996,19 @@ function deriveEventsUrl(serverUrl) {
53946
53996
  const apiRoot = trimmed.replace(/\/[^/]*$/, "");
53947
53997
  return `${apiRoot}/events`;
53948
53998
  }
53949
- function createHttpTransport(serverUrl) {
53999
+ async function authHeaders(getAccessToken) {
54000
+ const headers = { "Content-Type": "application/json" };
54001
+ const token = getAccessToken ? await getAccessToken() : void 0;
54002
+ if (token) headers.Authorization = `Bearer ${token}`;
54003
+ return headers;
54004
+ }
54005
+ function createHttpTransport(serverUrl, getAccessToken) {
53950
54006
  return {
53951
54007
  register: async (schema) => {
53952
54008
  try {
53953
54009
  const res = await fetch(`${serverUrl}/register`, {
53954
54010
  method: "POST",
53955
- headers: { "Content-Type": "application/json" },
54011
+ headers: await authHeaders(getAccessToken),
53956
54012
  body: JSON.stringify({ schema })
53957
54013
  });
53958
54014
  const result = await res.json();
@@ -53968,7 +54024,7 @@ function createHttpTransport(serverUrl) {
53968
54024
  },
53969
54025
  unregister: async () => {
53970
54026
  try {
53971
- await fetch(`${serverUrl}/unregister`, { method: "DELETE" });
54027
+ await fetch(`${serverUrl}/unregister`, { method: "DELETE", headers: await authHeaders(getAccessToken) });
53972
54028
  } catch {
53973
54029
  }
53974
54030
  },
@@ -53976,7 +54032,7 @@ function createHttpTransport(serverUrl) {
53976
54032
  const body = { event, payload, clientId, tick, sourceTrait };
53977
54033
  const res = await fetch(`${serverUrl}/${orbitalName}/events`, {
53978
54034
  method: "POST",
53979
- headers: { "Content-Type": "application/json" },
54035
+ headers: await authHeaders(getAccessToken),
53980
54036
  body: JSON.stringify(body)
53981
54037
  });
53982
54038
  return res.json();
@@ -53996,6 +54052,7 @@ function ServerBridgeProvider({
53996
54052
  schema,
53997
54053
  serverUrl,
53998
54054
  transport: customTransport,
54055
+ getAccessToken,
53999
54056
  children
54000
54057
  }) {
54001
54058
  if (!serverUrl && !customTransport) {
@@ -54007,8 +54064,8 @@ function ServerBridgeProvider({
54007
54064
  const eventBus = useEventBus();
54008
54065
  const [connected, setConnected] = React89.useState(false);
54009
54066
  const transport = React89.useMemo(
54010
- () => customTransport ?? createHttpTransport(serverUrl),
54011
- [serverUrl, customTransport]
54067
+ () => customTransport ?? createHttpTransport(serverUrl, getAccessToken),
54068
+ [serverUrl, customTransport, getAccessToken]
54012
54069
  );
54013
54070
  const registerSchema = React89.useCallback(
54014
54071
  async () => transport.register(schema),
@@ -54056,6 +54113,7 @@ function ServerBridgeProvider({
54056
54113
  dataEntities,
54057
54114
  data: responseData,
54058
54115
  emittedEvents: result.emittedEvents?.map((e) => e.event) ?? [],
54116
+ effectResults: result.effectResults,
54059
54117
  error: result.error
54060
54118
  };
54061
54119
  if (result.success) {
@@ -54145,16 +54203,28 @@ function ServerBridgeProvider({
54145
54203
  React89.useEffect(() => {
54146
54204
  if (!serverUrl) return;
54147
54205
  if (typeof EventSource === "undefined") return;
54148
- const url = `${deriveEventsUrl(serverUrl)}?clientId=${encodeURIComponent(getTabClientId())}`;
54149
- return acquirePushChannel(url, (parsed) => {
54206
+ let release;
54207
+ let cancelled = false;
54208
+ const subscribe = (parsed) => {
54150
54209
  serverBridgeLog.debug("push:received", {
54151
54210
  event: parsed.event,
54152
54211
  sourceOrbital: parsed.source?.orbital,
54153
54212
  sourceTrait: parsed.source?.trait
54154
54213
  });
54155
54214
  reEmitServerEvent(eventBus, parsed, "push");
54156
- });
54157
- }, [serverUrl, eventBus]);
54215
+ };
54216
+ void (async () => {
54217
+ const token = getAccessToken ? await getAccessToken() : void 0;
54218
+ if (cancelled) return;
54219
+ const params = new URLSearchParams({ clientId: getTabClientId() });
54220
+ if (token) params.set("access_token", token);
54221
+ release = acquirePushChannel(`${deriveEventsUrl(serverUrl)}?${params.toString()}`, subscribe);
54222
+ })();
54223
+ return () => {
54224
+ cancelled = true;
54225
+ release?.();
54226
+ };
54227
+ }, [serverUrl, eventBus, getAccessToken]);
54158
54228
  return /* @__PURE__ */ jsxRuntime.jsx(ServerBridgeContext.Provider, { value: { connected, sendEvent }, children });
54159
54229
  }
54160
54230
  var log13 = logger.createLogger("almadar:ui:trait-provider");