@ai-matrx/records-ui 0.116.59 → 0.116.61

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 (36) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/dist/{SaveToTable-2TQKEYJA.js → SaveToTable-VPLDWCSU.js} +4 -4
  3. package/dist/{chunk-AJVN4BMI.js → chunk-2YK72GHL.js} +305 -248
  4. package/dist/chunk-2YK72GHL.js.map +1 -0
  5. package/dist/{chunk-NGOPU3AJ.js → chunk-4KWCNW7V.js} +5 -4
  6. package/dist/{chunk-NGOPU3AJ.js.map → chunk-4KWCNW7V.js.map} +1 -1
  7. package/dist/{chunk-MBUW42SM.js → chunk-NBL26U5K.js} +2 -2
  8. package/dist/{chunk-4ZS4WEEE.js → chunk-TEYXG4XD.js} +73 -4
  9. package/dist/chunk-TEYXG4XD.js.map +1 -0
  10. package/dist/{chunk-HAWACXPU.js → chunk-W6FX3XVF.js} +2 -2
  11. package/dist/{chunk-Y6U5OFJX.js → chunk-WXYI4DKC.js} +3 -3
  12. package/dist/data-source.cjs +2 -1
  13. package/dist/data-source.cjs.map +1 -1
  14. package/dist/data-source.js +2 -1
  15. package/dist/data-source.js.map +1 -1
  16. package/dist/helpers.cjs +7 -7
  17. package/dist/helpers.cjs.map +1 -1
  18. package/dist/helpers.js +8 -8
  19. package/dist/helpers.js.map +1 -1
  20. package/dist/index.cjs +734 -617
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +17 -16
  23. package/dist/index.d.ts +17 -16
  24. package/dist/index.js +56 -64
  25. package/dist/index.js.map +1 -1
  26. package/dist/pickers.cjs +106 -96
  27. package/dist/pickers.cjs.map +1 -1
  28. package/dist/pickers.js +4 -4
  29. package/dist/skeleton.js +3 -3
  30. package/package.json +6 -6
  31. package/dist/chunk-4ZS4WEEE.js.map +0 -1
  32. package/dist/chunk-AJVN4BMI.js.map +0 -1
  33. /package/dist/{SaveToTable-2TQKEYJA.js.map → SaveToTable-VPLDWCSU.js.map} +0 -0
  34. /package/dist/{chunk-MBUW42SM.js.map → chunk-NBL26U5K.js.map} +0 -0
  35. /package/dist/{chunk-HAWACXPU.js.map → chunk-W6FX3XVF.js.map} +0 -0
  36. /package/dist/{chunk-Y6U5OFJX.js.map → chunk-WXYI4DKC.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  isYearValue,
6
6
  shownAsOf,
7
7
  useEmbeddedLook
8
- } from "./chunk-HAWACXPU.js";
8
+ } from "./chunk-W6FX3XVF.js";
9
9
  import {
10
10
  HtmlSampleFrame,
11
11
  HtmlSampleTokensProvider
@@ -54,7 +54,7 @@ import {
54
54
  useRecordsUi,
55
55
  useTableRights,
56
56
  withoutInternalCodes
57
- } from "./chunk-NGOPU3AJ.js";
57
+ } from "./chunk-4KWCNW7V.js";
58
58
  import {
59
59
  kindItemWords,
60
60
  kindLabel,
@@ -71,13 +71,16 @@ import {
71
71
  dateText,
72
72
  displayFormatOf,
73
73
  editorKindFor,
74
+ getPersonTimeZone,
74
75
  isDateField,
75
76
  isSignatureField,
76
77
  nextChoiceColor,
78
+ personWallNow,
77
79
  pickableTypeOf,
78
80
  storedChoiceColor,
81
+ subscribePersonTimeZone,
79
82
  systemStampOf
80
- } from "./chunk-4ZS4WEEE.js";
83
+ } from "./chunk-TEYXG4XD.js";
81
84
  import {
82
85
  ADD_FIELD_SAVE_LABEL,
83
86
  EDIT_FIELD_SAVE_LABEL,
@@ -96,55 +99,6 @@ import {
96
99
  __reExport
97
100
  } from "./chunk-HKYEHBQT.js";
98
101
 
99
- // src/personZone.ts
100
- import { setColorRuleTimeZone } from "@ai-matrx/design-system/data-table/table-style";
101
- import { globalSlot } from "@ai-matrx/kit/global-slot";
102
- var state = globalSlot("ai-matrx.records-ui.person-time-zone", () => ({
103
- zone: null,
104
- listeners: /* @__PURE__ */ new Set()
105
- }));
106
- function valid(z) {
107
- if (typeof z !== "string" || !z.trim()) return false;
108
- try {
109
- new Intl.DateTimeFormat("en-US", { timeZone: z });
110
- return true;
111
- } catch {
112
- return false;
113
- }
114
- }
115
- function setPersonTimeZone(next) {
116
- const clean = valid(next) ? next : null;
117
- if (clean === state.zone) return;
118
- state.zone = clean;
119
- setColorRuleTimeZone(clean);
120
- state.listeners.forEach((l) => l());
121
- }
122
- function getPersonTimeZone() {
123
- return state.zone;
124
- }
125
- function subscribePersonTimeZone(listener) {
126
- state.listeners.add(listener);
127
- return () => {
128
- state.listeners.delete(listener);
129
- };
130
- }
131
- function personWallNow(at = /* @__PURE__ */ new Date()) {
132
- const zone = state.zone;
133
- if (!zone) return at;
134
- const parts = new Intl.DateTimeFormat("en-US", {
135
- timeZone: zone,
136
- year: "numeric",
137
- month: "2-digit",
138
- day: "2-digit",
139
- hour: "2-digit",
140
- minute: "2-digit",
141
- second: "2-digit",
142
- hourCycle: "h23"
143
- }).formatToParts(at);
144
- const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
145
- return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
146
- }
147
-
148
102
  // src/personTime.ts
149
103
  import { useSyncExternalStore } from "react";
150
104
  function usePersonTimeZone() {
@@ -1517,12 +1471,47 @@ function useLabelWait(field2) {
1517
1471
  return field2 ? waiting(field2) : null;
1518
1472
  }
1519
1473
 
1474
+ // src/withheldNotice.ts
1475
+ var WITHHELD_WORD = "Withheld";
1476
+ function withheldNoticeOf(hidden, key) {
1477
+ const notice = hidden?.[key];
1478
+ return notice && typeof notice === "object" ? notice : null;
1479
+ }
1480
+ function withheldSentence(field2, notice) {
1481
+ const extra = notice;
1482
+ if (typeof extra.says === "string" && extra.says.trim() !== "") return extra.says.trim();
1483
+ const name = fieldName(field2);
1484
+ if (typeof extra.part === "string" && extra.part.trim() !== "" && typeof extra.who === "string" && extra.who.trim() !== "") {
1485
+ return `${name} is in ${extra.part.trim()} \u2014 ${extra.who.trim()} see it.`;
1486
+ }
1487
+ const reason = notice.reason ? ` It is ${notice.reason}` : "";
1488
+ const needs = notice.needs ? `${reason ? "," : " It"} and reading it needs ${notice.needs}` : "";
1489
+ const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
1490
+ return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
1491
+ }
1492
+
1493
+ // src/withheld.tsx
1494
+ import { jsx as jsx7 } from "react/jsx-runtime";
1495
+ function WithheldValue({ field: field2, notice }) {
1496
+ const sentence = withheldSentence(field2, notice);
1497
+ return /* @__PURE__ */ jsx7(
1498
+ "span",
1499
+ {
1500
+ "data-records-withheld": field2.key,
1501
+ title: sentence,
1502
+ "aria-label": `${WITHHELD_WORD}. ${sentence}`,
1503
+ className: "cursor-help italic text-muted-foreground",
1504
+ children: WITHHELD_WORD
1505
+ }
1506
+ );
1507
+ }
1508
+
1520
1509
  // src/PersonPicker.tsx
1521
1510
  import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef4, useState as useState6 } from "react";
1522
1511
  import { rankTypedMatches } from "@ai-matrx/records";
1523
1512
  import { useOptionalRecordsClient as useOptionalRecordsClient2 } from "@ai-matrx/records/react";
1524
1513
  import { cn as cn3 } from "@ai-matrx/design-system";
1525
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1514
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1526
1515
  function personFromRow(row) {
1527
1516
  const data = row.document ?? {};
1528
1517
  const userId = data["user_id"];
@@ -1603,7 +1592,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
1603
1592
  }, [client, personTable, picked.length, people.length]);
1604
1593
  const listed = rankTypedMatches(members ?? [], search, memberName);
1605
1594
  if (!membersPort || !client) {
1606
- return /* @__PURE__ */ jsx7("p", { className: cn3("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
1595
+ return /* @__PURE__ */ jsx8("p", { className: cn3("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
1607
1596
  }
1608
1597
  if (!personTable) {
1609
1598
  return /* @__PURE__ */ jsxs5("p", { className: cn3("text-xs text-muted-foreground", className), children: [
@@ -1656,14 +1645,14 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
1656
1645
  picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
1657
1646
  );
1658
1647
  const anchored = autoOpen === true;
1659
- const cellChips = picked.map((recordId) => /* @__PURE__ */ jsx7(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
1648
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ jsx8(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
1660
1649
  return /* @__PURE__ */ jsxs5("div", { className: cn3("flex flex-wrap items-center gap-1", className), children: [
1661
1650
  anchored && !disabled ? null : cellChips,
1662
1651
  disabled ? null : (
1663
1652
  // THE ONE "PICK OR ADD" BUILDER (lane CELL-EDITORS, 2026-10-06): the person list used to carry
1664
1653
  // its own copy of the list's layout and keys; it now draws the same rows, ticks, highlight and
1665
1654
  // head chips as every other picker, and in a grid cell hangs from the cell.
1666
- /* @__PURE__ */ jsx7(
1655
+ /* @__PURE__ */ jsx8(
1667
1656
  PickOrAdd,
1668
1657
  {
1669
1658
  ...anchored && onCancel ? { onEscape: onCancel } : {},
@@ -1692,10 +1681,10 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
1692
1681
  if (member && !busy) void pick(member);
1693
1682
  },
1694
1683
  notice: /* @__PURE__ */ jsxs5(Fragment2, { children: [
1695
- error ? /* @__PURE__ */ jsx7(RefusalLine, { error, className: "p-2" }) : null,
1696
- members === null ? /* @__PURE__ */ jsx7("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
1684
+ error ? /* @__PURE__ */ jsx8(RefusalLine, { error, className: "p-2" }) : null,
1685
+ members === null ? /* @__PURE__ */ jsx8("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
1697
1686
  ] }),
1698
- empty: members !== null ? /* @__PURE__ */ jsx7("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
1687
+ empty: members !== null ? /* @__PURE__ */ jsx8("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
1699
1688
  children: anchored ? cellChips : null
1700
1689
  }
1701
1690
  )
@@ -1719,7 +1708,7 @@ import {
1719
1708
  BasicInput as BasicInput2,
1720
1709
  cn as cn4
1721
1710
  } from "@ai-matrx/design-system";
1722
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1711
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1723
1712
  var DEFAULT_SEPARATOR = " ";
1724
1713
  var NEW_TABLE = "__records_ui_new_table__";
1725
1714
  var LINK_TARGET_FIELDS = [
@@ -1836,7 +1825,7 @@ function ReferenceBuilder({
1836
1825
  onChange({ targetTableId: id, display: null });
1837
1826
  };
1838
1827
  const mayMakeTable = doorReady(client.config, DOORS.tableFind) && doorReady(client.config, DOORS.tableEnsure);
1839
- const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ jsx8(
1828
+ const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ jsx9(
1840
1829
  Button3,
1841
1830
  {
1842
1831
  type: "button",
@@ -1869,12 +1858,12 @@ function ReferenceBuilder({
1869
1858
  return /* @__PURE__ */ jsxs6("div", { className: cn4("flex max-w-[26rem] flex-col gap-3", className), children: [
1870
1859
  !lockTarget && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
1871
1860
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
1872
- /* @__PURE__ */ jsx8(Label, { className: "text-xs", children: "The table it points at" }),
1873
- /* @__PURE__ */ jsx8(ShowListsToggle, { count: picking.listCount, on: showLists, onChange: setShowLists })
1861
+ /* @__PURE__ */ jsx9(Label, { className: "text-xs", children: "The table it points at" }),
1862
+ /* @__PURE__ */ jsx9(ShowListsToggle, { count: picking.listCount, on: showLists, onChange: setShowLists })
1874
1863
  ] }),
1875
1864
  naming !== null ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", "data-new-link-table": "", children: [
1876
1865
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
1877
- /* @__PURE__ */ jsx8(
1866
+ /* @__PURE__ */ jsx9(
1878
1867
  BasicInput2,
1879
1868
  {
1880
1869
  autoFocus: true,
@@ -1897,7 +1886,7 @@ function ReferenceBuilder({
1897
1886
  className: "h-7 text-xs"
1898
1887
  }
1899
1888
  ),
1900
- /* @__PURE__ */ jsx8(
1889
+ /* @__PURE__ */ jsx9(
1901
1890
  Button3,
1902
1891
  {
1903
1892
  type: "button",
@@ -1907,7 +1896,7 @@ function ReferenceBuilder({
1907
1896
  children: making ? "Creating\u2026" : "Create"
1908
1897
  }
1909
1898
  ),
1910
- /* @__PURE__ */ jsx8(
1899
+ /* @__PURE__ */ jsx9(
1911
1900
  Button3,
1912
1901
  {
1913
1902
  type: "button",
@@ -1922,9 +1911,9 @@ function ReferenceBuilder({
1922
1911
  }
1923
1912
  )
1924
1913
  ] }),
1925
- refused ? /* @__PURE__ */ jsx8(RefusalNotice, { error: refused }) : null
1926
- ] }) : tables.loading && offered.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "Reading your tables\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1927
- /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "No tables yet." }),
1914
+ refused ? /* @__PURE__ */ jsx9(RefusalNotice, { error: refused }) : null
1915
+ ] }) : tables.loading && offered.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Reading your tables\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1916
+ /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "No tables yet." }),
1928
1917
  newTableButton
1929
1918
  ] }) : /* @__PURE__ */ jsxs6(
1930
1919
  Select2,
@@ -1939,13 +1928,13 @@ function ReferenceBuilder({
1939
1928
  onChange({ targetTableId: next, display: null });
1940
1929
  },
1941
1930
  children: [
1942
- /* @__PURE__ */ jsx8(SelectTrigger2, { size: "sm", "aria-label": "The table this column points at", children: /* @__PURE__ */ jsx8(SelectValue2, { placeholder: "Choose a table" }) }),
1931
+ /* @__PURE__ */ jsx9(SelectTrigger2, { size: "sm", "aria-label": "The table this column points at", children: /* @__PURE__ */ jsx9(SelectValue2, { placeholder: "Choose a table" }) }),
1943
1932
  /* @__PURE__ */ jsxs6(SelectContent2, { children: [
1944
1933
  offered.map((t) => /* @__PURE__ */ jsxs6(SelectItem2, { value: t.id, children: [
1945
1934
  t.label,
1946
1935
  t.id === tableId ? " \u2014 this table" : ""
1947
1936
  ] }, t.id)),
1948
- mayMakeTable ? /* @__PURE__ */ jsx8(SelectItem2, { value: NEW_TABLE, children: "New table\u2026" }) : null
1937
+ mayMakeTable ? /* @__PURE__ */ jsx9(SelectItem2, { value: NEW_TABLE, children: "New table\u2026" }) : null
1949
1938
  ] })
1950
1939
  ]
1951
1940
  }
@@ -1953,11 +1942,11 @@ function ReferenceBuilder({
1953
1942
  ] }),
1954
1943
  target && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
1955
1944
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1956
- /* @__PURE__ */ jsx8(Label, { className: "text-xs", children: "Shown as" }),
1957
- /* @__PURE__ */ jsx8("span", { className: "text-[11px] text-muted-foreground", children: titleField ? `${titleField} \u2014 what ${targetTable ? tableName(targetTable) : "that table"} is titled by` : "whatever each record is named by" })
1945
+ /* @__PURE__ */ jsx9(Label, { className: "text-xs", children: "Shown as" }),
1946
+ /* @__PURE__ */ jsx9("span", { className: "text-[11px] text-muted-foreground", children: titleField ? `${titleField} \u2014 what ${targetTable ? tableName(targetTable) : "that table"} is titled by` : "whatever each record is named by" })
1958
1947
  ] }),
1959
1948
  /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-[11px] text-muted-foreground", children: [
1960
- /* @__PURE__ */ jsx8(
1949
+ /* @__PURE__ */ jsx9(
1961
1950
  Checkbox,
1962
1951
  {
1963
1952
  checked: overriding,
@@ -1972,8 +1961,8 @@ function ReferenceBuilder({
1972
1961
  "Show different columns, or more than one"
1973
1962
  ] })
1974
1963
  ] }),
1975
- target && overriding && /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-2 rounded-md border border-border p-2", children: columns.loading ? /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : columns.keys.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "That table has no columns to show yet. Give it one, then come back \u2014 until then this column shows whatever each record is named by." }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
1976
- /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-1", children: columns.keys.map((key) => {
1964
+ target && overriding && /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-2 rounded-md border border-border p-2", children: columns.loading ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : columns.keys.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "That table has no columns to show yet. Give it one, then come back \u2014 until then this column shows whatever each record is named by." }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
1965
+ /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap gap-1", children: columns.keys.map((key) => {
1977
1966
  const on = chosen.includes(key);
1978
1967
  return /* @__PURE__ */ jsxs6(
1979
1968
  Button3,
@@ -1992,10 +1981,10 @@ function ReferenceBuilder({
1992
1981
  );
1993
1982
  }) }),
1994
1983
  chosen.length > 1 && /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-1", children: [
1995
- /* @__PURE__ */ jsx8("span", { className: "text-[11px] text-muted-foreground", children: "Order" }),
1984
+ /* @__PURE__ */ jsx9("span", { className: "text-[11px] text-muted-foreground", children: "Order" }),
1996
1985
  chosen.map((key, at) => /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-0.5", children: [
1997
- /* @__PURE__ */ jsx8("span", { className: "text-[11px]", children: key }),
1998
- /* @__PURE__ */ jsx8(
1986
+ /* @__PURE__ */ jsx9("span", { className: "text-[11px]", children: key }),
1987
+ /* @__PURE__ */ jsx9(
1999
1988
  Button3,
2000
1989
  {
2001
1990
  type: "button",
@@ -2007,7 +1996,7 @@ function ReferenceBuilder({
2007
1996
  children: "\u2190"
2008
1997
  }
2009
1998
  ),
2010
- /* @__PURE__ */ jsx8(
1999
+ /* @__PURE__ */ jsx9(
2011
2000
  Button3,
2012
2001
  {
2013
2002
  type: "button",
@@ -2022,8 +2011,8 @@ function ReferenceBuilder({
2022
2011
  ] }, key))
2023
2012
  ] }),
2024
2013
  chosen.length > 1 && /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
2025
- /* @__PURE__ */ jsx8(Label, { className: "text-xs whitespace-nowrap", children: "Joined by" }),
2026
- /* @__PURE__ */ jsx8(
2014
+ /* @__PURE__ */ jsx9(Label, { className: "text-xs whitespace-nowrap", children: "Joined by" }),
2015
+ /* @__PURE__ */ jsx9(
2027
2016
  BasicInput2,
2028
2017
  {
2029
2018
  value: separator,
@@ -2032,12 +2021,12 @@ function ReferenceBuilder({
2032
2021
  className: "h-7 w-28 text-xs"
2033
2022
  }
2034
2023
  ),
2035
- /* @__PURE__ */ jsx8("span", { className: "text-[11px] text-muted-foreground", children: "a space by default" })
2024
+ /* @__PURE__ */ jsx9("span", { className: "text-[11px] text-muted-foreground", children: "a space by default" })
2036
2025
  ] })
2037
2026
  ] }) }),
2038
2027
  target && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-0.5", children: [
2039
- /* @__PURE__ */ jsx8(Label, { className: "text-xs", children: "It will read" }),
2040
- preview.loading ? /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "Reading a few of its records\u2026" }) : (preview.data?.rows?.length ?? 0) === 0 ? /* @__PURE__ */ jsx8("p", { className: "text-[11px] text-muted-foreground", children: "That table has no records yet, so there is nothing to show here \u2014 this column will still work, and the first record added is the first thing it offers." }) : /* @__PURE__ */ jsx8("ul", { className: "flex flex-col gap-0.5", children: (preview.data?.rows ?? []).map((row) => /* @__PURE__ */ jsx8("li", { className: "truncate text-[11px] text-foreground", children: previewWords(
2028
+ /* @__PURE__ */ jsx9(Label, { className: "text-xs", children: "It will read" }),
2029
+ preview.loading ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "Reading a few of its records\u2026" }) : (preview.data?.rows?.length ?? 0) === 0 ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: "That table has no records yet, so there is nothing to show here \u2014 this column will still work, and the first record added is the first thing it offers." }) : /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", children: (preview.data?.rows ?? []).map((row) => /* @__PURE__ */ jsx9("li", { className: "truncate text-[11px] text-foreground", children: previewWords(
2041
2030
  row.document,
2042
2031
  display,
2043
2032
  titleField
@@ -2070,7 +2059,7 @@ import { STYLE_COLORS as STYLE_COLORS2, STYLE_COLOR_LABELS as STYLE_COLOR_LABELS
2070
2059
  import { useState as useState8 } from "react";
2071
2060
  import { useOptionalRecordsClient as useOptionalRecordsClient3 } from "@ai-matrx/records/react";
2072
2061
  import { Button as Button4, Popover, PopoverContent, PopoverTrigger } from "@ai-matrx/design-system";
2073
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2062
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
2074
2063
  function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
2075
2064
  const client = useOptionalRecordsClient3();
2076
2065
  const [open, setOpen] = useState8(false);
@@ -2094,12 +2083,12 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
2094
2083
  onAdded();
2095
2084
  };
2096
2085
  return /* @__PURE__ */ jsxs7(Popover, { open, onOpenChange: setOpen, children: [
2097
- /* @__PURE__ */ jsx9(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(Button4, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", disabled, "data-records-add-choices": "", children: "Add choices" }) }),
2086
+ /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(Button4, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", disabled, "data-records-add-choices": "", children: "Add choices" }) }),
2098
2087
  /* @__PURE__ */ jsxs7(PopoverContent, { className: "w-72 space-y-2 p-3", align: "start", children: [
2099
- /* @__PURE__ */ jsx9(ChoiceListEditor, { isNew: true, rows, onRows: setRows }),
2100
- missing ? /* @__PURE__ */ jsx9("p", { className: "text-[11px] text-muted-foreground", children: missing }) : null,
2101
- refused ? /* @__PURE__ */ jsx9(RefusalLine, { error: refused }) : null,
2102
- /* @__PURE__ */ jsx9(Button4, { type: "button", size: "sm", className: "h-7 text-xs", disabled: saving || words.length === 0 || missing !== null, onClick: () => void save(), children: "Save choices" })
2088
+ /* @__PURE__ */ jsx10(ChoiceListEditor, { isNew: true, rows, onRows: setRows }),
2089
+ missing ? /* @__PURE__ */ jsx10("p", { className: "text-[11px] text-muted-foreground", children: missing }) : null,
2090
+ refused ? /* @__PURE__ */ jsx10(RefusalLine, { error: refused }) : null,
2091
+ /* @__PURE__ */ jsx10(Button4, { type: "button", size: "sm", className: "h-7 text-xs", disabled: saving || words.length === 0 || missing !== null, onClick: () => void save(), children: "Save choices" })
2103
2092
  ] })
2104
2093
  ] });
2105
2094
  }
@@ -2146,28 +2135,28 @@ import {
2146
2135
  } from "@ai-matrx/records";
2147
2136
  import { BasicInput as BasicInput3, cn as cn5 } from "@ai-matrx/design-system";
2148
2137
  import { OutboundLink } from "@ai-matrx/kit/outbound-react";
2149
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2138
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
2150
2139
  var own = (event) => event.stopPropagation();
2151
2140
  function newerKindValue(field2, value, opts = {}) {
2152
2141
  switch (newerKindOf(field2)) {
2153
2142
  case "duration": {
2154
2143
  const words = durationText(value);
2155
- return words === null ? void 0 : /* @__PURE__ */ jsx10("span", { className: "tabular-nums", "data-records-duration": "", children: words });
2144
+ return words === null ? void 0 : /* @__PURE__ */ jsx11("span", { className: "tabular-nums", "data-records-duration": "", children: words });
2156
2145
  }
2157
2146
  case "created_by":
2158
2147
  case "modified_by":
2159
- return isPersonStamp(value) ? /* @__PURE__ */ jsx10(PersonStampChip, { stamp: value }) : void 0;
2148
+ return isPersonStamp(value) ? /* @__PURE__ */ jsx11(PersonStampChip, { stamp: value }) : void 0;
2160
2149
  case "address":
2161
- return isAddressValue(value) || typeof value === "string" ? /* @__PURE__ */ jsx10(AddressLink, { value }) : void 0;
2150
+ return isAddressValue(value) || typeof value === "string" ? /* @__PURE__ */ jsx11(AddressLink, { value }) : void 0;
2162
2151
  case "barcode":
2163
2152
  return typeof value === "string" ? /* @__PURE__ */ jsxs8("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
2164
- /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
2165
- /* @__PURE__ */ jsx10("span", { className: "truncate", children: value })
2153
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
2154
+ /* @__PURE__ */ jsx11("span", { className: "truncate", children: value })
2166
2155
  ] }) : void 0;
2167
2156
  case "rich_text":
2168
- return typeof value === "string" ? /* @__PURE__ */ jsx10(SafeMarkdown, { text: value, clipped: opts.inCell === true }) : void 0;
2157
+ return typeof value === "string" ? /* @__PURE__ */ jsx11(SafeMarkdown, { text: value, clipped: opts.inCell === true }) : void 0;
2169
2158
  case "count":
2170
- return typeof value === "number" ? /* @__PURE__ */ jsx10("span", { className: "tabular-nums", children: value.toLocaleString() }) : void 0;
2159
+ return typeof value === "number" ? /* @__PURE__ */ jsx11("span", { className: "tabular-nums", children: value.toLocaleString() }) : void 0;
2171
2160
  default:
2172
2161
  return void 0;
2173
2162
  }
@@ -2178,7 +2167,7 @@ function PersonStampChip({ stamp }) {
2178
2167
  const name = tier === "user" ? stamp.name : null;
2179
2168
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
2180
2169
  return /* @__PURE__ */ jsxs8("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-person-stamp": tier, children: [
2181
- /* @__PURE__ */ jsx10(
2170
+ /* @__PURE__ */ jsx11(
2182
2171
  "span",
2183
2172
  {
2184
2173
  "aria-hidden": "true",
@@ -2186,13 +2175,13 @@ function PersonStampChip({ stamp }) {
2186
2175
  children: initial
2187
2176
  }
2188
2177
  ),
2189
- /* @__PURE__ */ jsx10("span", { className: cn5("truncate", tier === "user" && !name ? "italic text-muted-foreground" : ""), children: words })
2178
+ /* @__PURE__ */ jsx11("span", { className: cn5("truncate", tier === "user" && !name ? "italic text-muted-foreground" : ""), children: words })
2190
2179
  ] });
2191
2180
  }
2192
2181
  function AddressLink({ value }) {
2193
2182
  const words = addressValueText(value);
2194
2183
  const href = addressMapUrl(value);
2195
- if (!words || !href) return /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "\u2014" });
2184
+ if (!words || !href) return /* @__PURE__ */ jsx11("span", { className: "text-muted-foreground", children: "\u2014" });
2196
2185
  return /* @__PURE__ */ jsxs8(
2197
2186
  OutboundLink,
2198
2187
  {
@@ -2202,8 +2191,8 @@ function AddressLink({ value }) {
2202
2191
  "data-records-address": "",
2203
2192
  onClick: own,
2204
2193
  children: [
2205
- /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2316" }),
2206
- /* @__PURE__ */ jsx10("span", { className: "truncate", children: words })
2194
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\u2316" }),
2195
+ /* @__PURE__ */ jsx11("span", { className: "truncate", children: words })
2207
2196
  ]
2208
2197
  }
2209
2198
  );
@@ -2223,7 +2212,7 @@ function inline(text, key) {
2223
2212
  for (const r of findInlineCodeSpans(text)) {
2224
2213
  if (r.start < at) continue;
2225
2214
  if (r.start > at) out.push(...marks(text.slice(at, r.start), `${key}-m${n++}`));
2226
- out.push(/* @__PURE__ */ jsx10("code", { className: "rounded bg-muted px-1 font-mono text-[0.9em]", children: codeSpanText(text.slice(r.start, r.end)) }, `${key}-c${n++}`));
2215
+ out.push(/* @__PURE__ */ jsx11("code", { className: "rounded bg-muted px-1 font-mono text-[0.9em]", children: codeSpanText(text.slice(r.start, r.end)) }, `${key}-c${n++}`));
2227
2216
  at = r.end;
2228
2217
  }
2229
2218
  if (at < text.length) out.push(...marks(text.slice(at), `${key}-m${n++}`));
@@ -2239,14 +2228,14 @@ function marks(text, key) {
2239
2228
  if (at > last) out.push(text.slice(last, at));
2240
2229
  const tok = m[0];
2241
2230
  const k = `${key}-${i++}`;
2242
- if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ jsx10("strong", { children: tok.slice(2, -2) }, k));
2231
+ if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ jsx11("strong", { children: tok.slice(2, -2) }, k));
2243
2232
  else if (tok.startsWith("[")) {
2244
2233
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
2245
2234
  const href = safeLinkHref(link?.[2] ?? "");
2246
2235
  out.push(
2247
- href ? /* @__PURE__ */ jsx10(OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
2236
+ href ? /* @__PURE__ */ jsx11(OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
2248
2237
  );
2249
- } else out.push(/* @__PURE__ */ jsx10("em", { children: tok.slice(1, -1) }, k));
2238
+ } else out.push(/* @__PURE__ */ jsx11("em", { children: tok.slice(1, -1) }, k));
2250
2239
  last = at + tok.length;
2251
2240
  }
2252
2241
  if (last < text.length) out.push(text.slice(last));
@@ -2259,15 +2248,15 @@ function SafeMarkdown({ text, clipped }) {
2259
2248
  let para = [];
2260
2249
  const flushPara = () => {
2261
2250
  if (para.length > 0) {
2262
- blocks.push(/* @__PURE__ */ jsx10("p", { children: inline(para.join(" "), `p${blocks.length}`) }, `p${blocks.length}`));
2251
+ blocks.push(/* @__PURE__ */ jsx11("p", { children: inline(para.join(" "), `p${blocks.length}`) }, `p${blocks.length}`));
2263
2252
  para = [];
2264
2253
  }
2265
2254
  };
2266
2255
  const flushList = () => {
2267
2256
  if (list) {
2268
- const items = list.items.map((item, i) => /* @__PURE__ */ jsx10("li", { children: inline(item, `l${blocks.length}-${i}`) }, i));
2257
+ const items = list.items.map((item, i) => /* @__PURE__ */ jsx11("li", { children: inline(item, `l${blocks.length}-${i}`) }, i));
2269
2258
  blocks.push(
2270
- list.ordered ? /* @__PURE__ */ jsx10("ol", { className: "ml-4 list-decimal", children: items }, `o${blocks.length}`) : /* @__PURE__ */ jsx10("ul", { className: "ml-4 list-disc", children: items }, `u${blocks.length}`)
2259
+ list.ordered ? /* @__PURE__ */ jsx11("ol", { className: "ml-4 list-decimal", children: items }, `o${blocks.length}`) : /* @__PURE__ */ jsx11("ul", { className: "ml-4 list-disc", children: items }, `u${blocks.length}`)
2271
2260
  );
2272
2261
  list = null;
2273
2262
  }
@@ -2286,7 +2275,7 @@ function SafeMarkdown({ text, clipped }) {
2286
2275
  } else if (heading) {
2287
2276
  flushPara();
2288
2277
  flushList();
2289
- blocks.push(/* @__PURE__ */ jsx10("p", { className: "font-semibold", children: inline(heading[2], `h${blocks.length}`) }, `h${blocks.length}`));
2278
+ blocks.push(/* @__PURE__ */ jsx11("p", { className: "font-semibold", children: inline(heading[2], `h${blocks.length}`) }, `h${blocks.length}`));
2290
2279
  } else if (line.trim() === "") {
2291
2280
  flushPara();
2292
2281
  flushList();
@@ -2297,7 +2286,7 @@ function SafeMarkdown({ text, clipped }) {
2297
2286
  }
2298
2287
  flushPara();
2299
2288
  flushList();
2300
- return /* @__PURE__ */ jsx10(
2289
+ return /* @__PURE__ */ jsx11(
2301
2290
  "span",
2302
2291
  {
2303
2292
  className: cn5("block min-w-0 space-y-1 whitespace-normal text-sm", clipped ? "max-h-[4.5em] overflow-hidden" : ""),
@@ -2309,15 +2298,15 @@ function SafeMarkdown({ text, clipped }) {
2309
2298
  function newerKindControl(props) {
2310
2299
  switch (newerKindOf(props.field)) {
2311
2300
  case "duration":
2312
- return /* @__PURE__ */ jsx10(DurationControl, { ...props });
2301
+ return /* @__PURE__ */ jsx11(DurationControl, { ...props });
2313
2302
  case "address":
2314
- return /* @__PURE__ */ jsx10(AddressControl, { ...props });
2303
+ return /* @__PURE__ */ jsx11(AddressControl, { ...props });
2315
2304
  case "barcode":
2316
- return /* @__PURE__ */ jsx10(BarcodeControl, { ...props });
2305
+ return /* @__PURE__ */ jsx11(BarcodeControl, { ...props });
2317
2306
  case "created_by":
2318
2307
  case "modified_by":
2319
2308
  case "count":
2320
- return /* @__PURE__ */ jsx10("div", { id: props.id, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: props.value === null || props.value === void 0 ? "\u2014" : newerKindValue(props.field, props.value) });
2309
+ return /* @__PURE__ */ jsx11("div", { id: props.id, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: props.value === null || props.value === void 0 ? "\u2014" : newerKindValue(props.field, props.value) });
2321
2310
  default:
2322
2311
  return void 0;
2323
2312
  }
@@ -2329,7 +2318,7 @@ function DurationControl({ value, onChange, disabled, id }) {
2329
2318
  setText(durationText(value) ?? "");
2330
2319
  }, [value]);
2331
2320
  return /* @__PURE__ */ jsxs8("span", { className: "flex flex-col gap-1", children: [
2332
- /* @__PURE__ */ jsx10(
2321
+ /* @__PURE__ */ jsx11(
2333
2322
  BasicInput3,
2334
2323
  {
2335
2324
  id,
@@ -2355,7 +2344,7 @@ function DurationControl({ value, onChange, disabled, id }) {
2355
2344
  }
2356
2345
  }
2357
2346
  ),
2358
- wrong ? /* @__PURE__ */ jsx10("span", { className: "text-[11px] text-destructive", children: "Write it like 45 min, 1:30 or 1h 30m." }) : null
2347
+ wrong ? /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-destructive", children: "Write it like 45 min, 1:30 or 1h 30m." }) : null
2359
2348
  ] });
2360
2349
  }
2361
2350
  var ADDRESS_LABELS = {
@@ -2379,7 +2368,7 @@ function AddressControl({ value, onChange, disabled, id }) {
2379
2368
  const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
2380
2369
  onChange(Object.keys(kept).length === 0 ? null : kept);
2381
2370
  };
2382
- return /* @__PURE__ */ jsx10("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: ADDRESS_PARTS.map((part) => /* @__PURE__ */ jsx10(
2371
+ return /* @__PURE__ */ jsx11("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: ADDRESS_PARTS.map((part) => /* @__PURE__ */ jsx11(
2383
2372
  BasicInput3,
2384
2373
  {
2385
2374
  "aria-label": ADDRESS_LABELS[part],
@@ -2403,7 +2392,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
2403
2392
  const Detect = barcodeDetector();
2404
2393
  return /* @__PURE__ */ jsxs8("span", { className: "flex flex-col gap-1", children: [
2405
2394
  /* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-1.5", children: [
2406
- /* @__PURE__ */ jsx10(
2395
+ /* @__PURE__ */ jsx11(
2407
2396
  BasicInput3,
2408
2397
  {
2409
2398
  id,
@@ -2415,7 +2404,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
2415
2404
  }
2416
2405
  ),
2417
2406
  Detect && !disabled ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
2418
- /* @__PURE__ */ jsx10(
2407
+ /* @__PURE__ */ jsx11(
2419
2408
  "button",
2420
2409
  {
2421
2410
  type: "button",
@@ -2424,7 +2413,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
2424
2413
  children: "Scan"
2425
2414
  }
2426
2415
  ),
2427
- /* @__PURE__ */ jsx10(
2416
+ /* @__PURE__ */ jsx11(
2428
2417
  "input",
2429
2418
  {
2430
2419
  ref: file,
@@ -2450,7 +2439,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
2450
2439
  )
2451
2440
  ] }) : null
2452
2441
  ] }),
2453
- said2 ? /* @__PURE__ */ jsx10("span", { className: "text-[11px] text-muted-foreground", children: said2 }) : null
2442
+ said2 ? /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: said2 }) : null
2454
2443
  ] });
2455
2444
  }
2456
2445
 
@@ -2497,7 +2486,7 @@ function tellApart(rows, nameOf3) {
2497
2486
  }
2498
2487
 
2499
2488
  // src/RelationPicker.tsx
2500
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2489
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2501
2490
  function withoutSelf(rows, selfId) {
2502
2491
  return selfId ? rows.filter((row) => row.id !== selfId) : rows;
2503
2492
  }
@@ -2587,7 +2576,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2587
2576
  return (
2588
2577
  // The Field's own name is already printed above this control by
2589
2578
  // `FieldLabel`, so the sentence does not say it a second time.
2590
- /* @__PURE__ */ jsx11("p", { id, className: cn6("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON })
2579
+ /* @__PURE__ */ jsx12("p", { id, className: cn6("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON })
2591
2580
  );
2592
2581
  }
2593
2582
  if (!field2.relation_target) {
@@ -2651,7 +2640,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2651
2640
  const apart = tellApart(rows ?? [], titleOf);
2652
2641
  const visible = rankTypedMatches2(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
2653
2642
  const anchored = autoOpen === true;
2654
- const cellChips = picked.map((recordId) => /* @__PURE__ */ jsx11(
2643
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ jsx12(
2655
2644
  RecordChip,
2656
2645
  {
2657
2646
  title: titleOf(recordId),
@@ -2666,7 +2655,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2666
2655
  disabled ? null : (
2667
2656
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
2668
2657
  // In a grid cell it hangs from the cell's own chips; what is picked heads the list with its ×.
2669
- /* @__PURE__ */ jsx11(
2658
+ /* @__PURE__ */ jsx12(
2670
2659
  PickOrAdd,
2671
2660
  {
2672
2661
  anchored,
@@ -2690,8 +2679,8 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2690
2679
  })),
2691
2680
  onPick: toggle,
2692
2681
  notice: /* @__PURE__ */ jsxs9(Fragment5, { children: [
2693
- refusal ? /* @__PURE__ */ jsx11(RefusalLine, { error: refusal, className: "p-2" }) : null,
2694
- !rows && !refusal ? /* @__PURE__ */ jsx11("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
2682
+ refusal ? /* @__PURE__ */ jsx12(RefusalLine, { error: refusal, className: "p-2" }) : null,
2683
+ !rows && !refusal ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
2695
2684
  full ? /* @__PURE__ */ jsxs9("p", { className: "p-2 text-xs text-muted-foreground", children: [
2696
2685
  fieldName(field2),
2697
2686
  " can point at ",
@@ -2699,7 +2688,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2699
2688
  " at most. Remove one to add another."
2700
2689
  ] }) : null
2701
2690
  ] }),
2702
- empty: rows ? /* @__PURE__ */ jsx11("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
2691
+ empty: rows ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
2703
2692
  add: allowCreate && !full && !targetRefusal && target && !creating ? {
2704
2693
  label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
2705
2694
  disabled: busy,
@@ -2714,8 +2703,8 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2714
2703
  }
2715
2704
  }
2716
2705
  } : null,
2717
- foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ jsx11(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ jsx11("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 p-1", children: [
2718
- /* @__PURE__ */ jsx11(
2706
+ foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ jsx12(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 p-1", children: [
2707
+ /* @__PURE__ */ jsx12(
2719
2708
  BasicInput4,
2720
2709
  {
2721
2710
  autoFocus: true,
@@ -2732,7 +2721,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2732
2721
  "aria-label": `Name the new ${targetWord}`
2733
2722
  }
2734
2723
  ),
2735
- /* @__PURE__ */ jsx11(
2724
+ /* @__PURE__ */ jsx12(
2736
2725
  Button5,
2737
2726
  {
2738
2727
  type: "button",
@@ -2747,7 +2736,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2747
2736
  footNote: allowCreate && !full && createRefusal ? (
2748
2737
  // The typed title is still in the search box: the notice owns the
2749
2738
  // two doors out (lane REFUSAL-SWEEP).
2750
- /* @__PURE__ */ jsx11(
2739
+ /* @__PURE__ */ jsx12(
2751
2740
  RefusalNotice,
2752
2741
  {
2753
2742
  error: createRefusal,
@@ -2787,7 +2776,7 @@ import { useOptionalRecordsClient as useOptionalRecordsClient11, useTable as use
2787
2776
  // src/gridOpen.tsx
2788
2777
  import { createContext as createContext2 } from "react";
2789
2778
  import { openOutbound } from "@ai-matrx/kit/outbound";
2790
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2779
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
2791
2780
  var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
2792
2781
  var TitleCellOpensContext = createContext2(false);
2793
2782
  var OpenRecordHereContext = createContext2(null);
@@ -2831,8 +2820,8 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
2831
2820
  },
2832
2821
  onDoubleClick: (event) => event.stopPropagation(),
2833
2822
  children: [
2834
- /* @__PURE__ */ jsx12("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx12("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
2835
- /* @__PURE__ */ jsx12("span", { className: "[@media(hover:none)]:sr-only", children: "Open" })
2823
+ /* @__PURE__ */ jsx13("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx13("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
2824
+ /* @__PURE__ */ jsx13("span", { className: "[@media(hover:none)]:sr-only", children: "Open" })
2836
2825
  ]
2837
2826
  }
2838
2827
  );
@@ -2844,7 +2833,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
2844
2833
  };
2845
2834
  return {
2846
2835
  ...column,
2847
- cell: (row, rowIndex) => /* @__PURE__ */ jsx12(
2836
+ cell: (row, rowIndex) => /* @__PURE__ */ jsx13(
2848
2837
  "span",
2849
2838
  {
2850
2839
  className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
@@ -2857,7 +2846,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
2857
2846
  },
2858
2847
  children: index === 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
2859
2848
  place === "start" ? handle(row) : null,
2860
- /* @__PURE__ */ jsx12(
2849
+ /* @__PURE__ */ jsx13(
2861
2850
  "span",
2862
2851
  {
2863
2852
  className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
@@ -2872,7 +2861,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
2872
2861
  event.stopPropagation();
2873
2862
  openFrom(row, event);
2874
2863
  },
2875
- children: /* @__PURE__ */ jsx12(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
2864
+ children: /* @__PURE__ */ jsx13(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
2876
2865
  }
2877
2866
  ),
2878
2867
  place === "end" ? handle(row) : null
@@ -2951,7 +2940,7 @@ import {
2951
2940
 
2952
2941
  // src/WatchFieldsPicker.tsx
2953
2942
  import { Checkbox as Checkbox2, Label as Label2 } from "@ai-matrx/design-system";
2954
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2943
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2955
2944
  function watchedFieldsOf(field2) {
2956
2945
  const list = field2?.config?.["only_fields"];
2957
2946
  return Array.isArray(list) ? list.filter((k) => typeof k === "string") : [];
@@ -2968,14 +2957,14 @@ function watchable(field2) {
2968
2957
  function WatchFieldsPicker({ fields, value, onChange }) {
2969
2958
  const choices = fields.filter(watchable);
2970
2959
  return /* @__PURE__ */ jsxs11("fieldset", { className: "flex flex-col gap-1", "data-records-watch-fields": "", children: [
2971
- /* @__PURE__ */ jsx13(Label2, { className: "text-xs", children: "Changes to" }),
2960
+ /* @__PURE__ */ jsx14(Label2, { className: "text-xs", children: "Changes to" }),
2972
2961
  /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: [
2973
2962
  /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5 text-sm", children: [
2974
- /* @__PURE__ */ jsx13(Checkbox2, { checked: value.length === 0, "aria-label": "Any field", onCheckedChange: (v) => v === true && onChange([]) }),
2975
- /* @__PURE__ */ jsx13("span", { children: "Any field" })
2963
+ /* @__PURE__ */ jsx14(Checkbox2, { checked: value.length === 0, "aria-label": "Any field", onCheckedChange: (v) => v === true && onChange([]) }),
2964
+ /* @__PURE__ */ jsx14("span", { children: "Any field" })
2976
2965
  ] }),
2977
2966
  choices.map((f) => /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1.5 text-sm", children: [
2978
- /* @__PURE__ */ jsx13(
2967
+ /* @__PURE__ */ jsx14(
2979
2968
  Checkbox2,
2980
2969
  {
2981
2970
  checked: value.includes(f.key),
@@ -2984,7 +2973,7 @@ function WatchFieldsPicker({ fields, value, onChange }) {
2984
2973
  onCheckedChange: (v) => onChange(v === true ? [...value.filter((k) => k !== f.key), f.key] : value.filter((k) => k !== f.key))
2985
2974
  }
2986
2975
  ),
2987
- /* @__PURE__ */ jsx13("span", { children: f.label })
2976
+ /* @__PURE__ */ jsx14("span", { children: f.label })
2988
2977
  ] }, f.id))
2989
2978
  ] })
2990
2979
  ] });
@@ -2995,7 +2984,7 @@ import { useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useSta
2995
2984
  import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
2996
2985
  import { RULE_NODE_KINDS } from "@ai-matrx/records";
2997
2986
  import { BasicTextarea as BasicTextarea2, Button as Button6, Label as Label3, cn as cn7 } from "@ai-matrx/design-system";
2998
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2987
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2999
2988
  var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
3000
2989
  "fx.add",
3001
2990
  "fx.sub",
@@ -3105,8 +3094,8 @@ function FormulaTextEditor({
3105
3094
  }, [parsed]);
3106
3095
  return /* @__PURE__ */ jsxs12("div", { "data-records-formula-editor": "", className: cn7("flex flex-col gap-1.5", className), children: [
3107
3096
  /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
3108
- /* @__PURE__ */ jsx14(Label3, { className: "text-xs", children: "The formula" }),
3109
- host.formulaHelp ? /* @__PURE__ */ jsx14("span", { "data-records-formula-help": "", className: "ml-auto", children: host.formulaHelp({
3097
+ /* @__PURE__ */ jsx15(Label3, { className: "text-xs", children: "The formula" }),
3098
+ host.formulaHelp ? /* @__PURE__ */ jsx15("span", { "data-records-formula-help": "", className: "ml-auto", children: host.formulaHelp({
3110
3099
  tableId,
3111
3100
  text,
3112
3101
  columns,
@@ -3116,7 +3105,7 @@ function FormulaTextEditor({
3116
3105
  ...purpose ? { purpose } : {}
3117
3106
  }) }) : null
3118
3107
  ] }),
3119
- /* @__PURE__ */ jsx14(
3108
+ /* @__PURE__ */ jsx15(
3120
3109
  BasicTextarea2,
3121
3110
  {
3122
3111
  ref: box,
@@ -3140,24 +3129,24 @@ function FormulaTextEditor({
3140
3129
  sampleRecordId ? "This record" : "First row",
3141
3130
  ": "
3142
3131
  ] }),
3143
- /* @__PURE__ */ jsx14("span", { className: cn7("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
3132
+ /* @__PURE__ */ jsx15("span", { className: cn7("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
3144
3133
  ] }) : null,
3145
3134
  parsed && !parsed.ok ? (
3146
3135
  // NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
3147
3136
  // text as it stands, drawn the way the panel draws what Save is still waiting for.
3148
3137
  /* @__PURE__ */ jsxs12("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
3149
- /* @__PURE__ */ jsx14("p", { children: parsed.error }),
3138
+ /* @__PURE__ */ jsx15("p", { children: parsed.error }),
3150
3139
  where ? /* @__PURE__ */ jsxs12("p", { className: "mt-0.5 font-mono text-foreground", children: [
3151
3140
  where.before,
3152
- /* @__PURE__ */ jsx14("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
3141
+ /* @__PURE__ */ jsx15("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
3153
3142
  where.after
3154
3143
  ] }) : null
3155
3144
  ] })
3156
3145
  ) : null,
3157
- error ? /* @__PURE__ */ jsx14(RefusalLine, { error }) : null,
3146
+ error ? /* @__PURE__ */ jsx15(RefusalLine, { error }) : null,
3158
3147
  /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", children: [
3159
- /* @__PURE__ */ jsx14("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
3160
- columns.map((f) => /* @__PURE__ */ jsx14(Button6, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
3148
+ /* @__PURE__ */ jsx15("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
3149
+ columns.map((f) => /* @__PURE__ */ jsx15(Button6, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
3161
3150
  ] }),
3162
3151
  STORE_FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ jsxs12("details", { className: "text-[11px] text-muted-foreground", children: [
3163
3152
  /* @__PURE__ */ jsxs12("summary", { className: "cursor-pointer", children: [
@@ -3165,7 +3154,7 @@ function FormulaTextEditor({
3165
3154
  STORE_FORMULA_FUNCTION_NAMES.length,
3166
3155
  ")"
3167
3156
  ] }),
3168
- /* @__PURE__ */ jsx14("div", { className: "mt-1 flex flex-wrap gap-1", children: STORE_FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx14(Button6, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
3157
+ /* @__PURE__ */ jsx15("div", { className: "mt-1 flex flex-wrap gap-1", children: STORE_FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx15(Button6, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
3169
3158
  ] }) : null
3170
3159
  ] });
3171
3160
  }
@@ -3174,7 +3163,7 @@ function FormulaTextEditor({
3174
3163
  import { useMemo as useMemo6, useState as useState12 } from "react";
3175
3164
  import { useEntityReferenceKinds } from "@ai-matrx/records/react";
3176
3165
  import { Badge, BasicInput as BasicInput5, Checkbox as Checkbox3, Label as Label4, Skeleton, cn as cn8 } from "@ai-matrx/design-system";
3177
- import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3166
+ import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
3178
3167
  var ENTITY_REFERENCE_KINDS_MISSING = "Choose at least one kind of thing this column points at.";
3179
3168
  function entityReferenceSpec(input) {
3180
3169
  const seen = /* @__PURE__ */ new Set();
@@ -3226,10 +3215,10 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
3226
3215
  else onChange(value.filter((t) => t !== token));
3227
3216
  };
3228
3217
  return /* @__PURE__ */ jsxs13("div", { className: cn8("flex flex-col gap-2", className), children: [
3229
- /* @__PURE__ */ jsx15(Label4, { className: "text-xs", children: "What it points at" }),
3230
- value.length > 0 ? /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", "aria-label": "Chosen kinds", children: value.map((token) => /* @__PURE__ */ jsxs13(Badge, { variant: "secondary", className: "gap-1 text-[11px]", children: [
3218
+ /* @__PURE__ */ jsx16(Label4, { className: "text-xs", children: "What it points at" }),
3219
+ value.length > 0 ? /* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-1", "aria-label": "Chosen kinds", children: value.map((token) => /* @__PURE__ */ jsxs13(Badge, { variant: "secondary", className: "gap-1 text-[11px]", children: [
3231
3220
  labelOf.get(token) ?? token,
3232
- locked ? null : /* @__PURE__ */ jsx15(
3221
+ locked ? null : /* @__PURE__ */ jsx16(
3233
3222
  "button",
3234
3223
  {
3235
3224
  type: "button",
@@ -3240,8 +3229,8 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
3240
3229
  }
3241
3230
  )
3242
3231
  ] }, token)) }) : null,
3243
- locked ? /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-muted-foreground", children: "The kinds an existing column points at are kept as they are; add a new column to point at others." }) : error ? /* @__PURE__ */ jsx15(RefusalNotice, { error }) : loading ? /* @__PURE__ */ jsx15(Skeleton, { className: "h-24 w-full" }) : /* @__PURE__ */ jsxs13(Fragment7, { children: [
3244
- /* @__PURE__ */ jsx15(
3232
+ locked ? /* @__PURE__ */ jsx16("p", { className: "text-[11px] text-muted-foreground", children: "The kinds an existing column points at are kept as they are; add a new column to point at others." }) : error ? /* @__PURE__ */ jsx16(RefusalNotice, { error }) : loading ? /* @__PURE__ */ jsx16(Skeleton, { className: "h-24 w-full" }) : /* @__PURE__ */ jsxs13(Fragment7, { children: [
3233
+ /* @__PURE__ */ jsx16(
3245
3234
  BasicInput5,
3246
3235
  {
3247
3236
  "aria-label": "Find a kind of thing",
@@ -3251,14 +3240,14 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
3251
3240
  onChange: (e) => setQuery(e.target.value)
3252
3241
  }
3253
3242
  ),
3254
- /* @__PURE__ */ jsx15("div", { className: "max-h-56 overflow-y-auto rounded-md border border-border p-2", role: "group", "aria-label": "Kinds of thing", children: groups.length === 0 ? /* @__PURE__ */ jsxs13("p", { className: "text-[11px] text-muted-foreground", children: [
3243
+ /* @__PURE__ */ jsx16("div", { className: "max-h-56 overflow-y-auto rounded-md border border-border p-2", role: "group", "aria-label": "Kinds of thing", children: groups.length === 0 ? /* @__PURE__ */ jsxs13("p", { className: "text-[11px] text-muted-foreground", children: [
3255
3244
  "No kind of thing matches \u201C",
3256
3245
  query.trim(),
3257
3246
  "\u201D."
3258
3247
  ] }) : groups.map(([category, kinds]) => /* @__PURE__ */ jsxs13("div", { className: "mb-2 last:mb-0", children: [
3259
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: category }),
3260
- /* @__PURE__ */ jsx15("div", { className: "grid grid-cols-1 gap-1 sm:grid-cols-2", children: kinds.map((k) => /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5 text-xs", children: [
3261
- /* @__PURE__ */ jsx15(
3248
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: category }),
3249
+ /* @__PURE__ */ jsx16("div", { className: "grid grid-cols-1 gap-1 sm:grid-cols-2", children: kinds.map((k) => /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1.5 text-xs", children: [
3250
+ /* @__PURE__ */ jsx16(
3262
3251
  Checkbox3,
3263
3252
  {
3264
3253
  checked: chosen.has(k.token),
@@ -3269,7 +3258,7 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
3269
3258
  k.label
3270
3259
  ] }, k.token)) })
3271
3260
  ] }, category)) }),
3272
- value.length === 0 ? /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_KINDS_MISSING }) : null
3261
+ value.length === 0 ? /* @__PURE__ */ jsx16("p", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_KINDS_MISSING }) : null
3273
3262
  ] })
3274
3263
  ] });
3275
3264
  }
@@ -3287,43 +3276,6 @@ function withoutLeadingBlank(text) {
3287
3276
  // src/values.tsx
3288
3277
  import { SWATCH_CLASS, formatColumnValue } from "@ai-matrx/design-system/data-table";
3289
3278
  import { formatFieldValue as formatFieldValue3 } from "@ai-matrx/design-system/field-formats";
3290
-
3291
- // src/withheldNotice.ts
3292
- var WITHHELD_WORD = "Withheld";
3293
- function withheldNoticeOf(hidden, key) {
3294
- const notice = hidden?.[key];
3295
- return notice && typeof notice === "object" ? notice : null;
3296
- }
3297
- function withheldSentence(field2, notice) {
3298
- const extra = notice;
3299
- if (typeof extra.says === "string" && extra.says.trim() !== "") return extra.says.trim();
3300
- const name = fieldName(field2);
3301
- if (typeof extra.part === "string" && extra.part.trim() !== "" && typeof extra.who === "string" && extra.who.trim() !== "") {
3302
- return `${name} is in ${extra.part.trim()} \u2014 ${extra.who.trim()} see it.`;
3303
- }
3304
- const reason = notice.reason ? ` It is ${notice.reason}` : "";
3305
- const needs = notice.needs ? `${reason ? "," : " It"} and reading it needs ${notice.needs}` : "";
3306
- const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
3307
- return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
3308
- }
3309
-
3310
- // src/withheld.tsx
3311
- import { jsx as jsx16 } from "react/jsx-runtime";
3312
- function WithheldValue({ field: field2, notice }) {
3313
- const sentence = withheldSentence(field2, notice);
3314
- return /* @__PURE__ */ jsx16(
3315
- "span",
3316
- {
3317
- "data-records-withheld": field2.key,
3318
- title: sentence,
3319
- "aria-label": `${WITHHELD_WORD}. ${sentence}`,
3320
- className: "cursor-help italic text-muted-foreground",
3321
- children: WITHHELD_WORD
3322
- }
3323
- );
3324
- }
3325
-
3326
- // src/values.tsx
3327
3279
  import { Badge as Badge6, cn as cn15 } from "@ai-matrx/design-system";
3328
3280
 
3329
3281
  // src/EntityReferenceControl.tsx
@@ -4431,8 +4383,8 @@ function formulaSourceArchived(field2, document2) {
4431
4383
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
4432
4384
  if (!Array.isArray(keys) || !document2) return null;
4433
4385
  for (const key of keys) {
4434
- const state2 = sourceArchivedOf(document2[String(key)]);
4435
- if (state2) return state2;
4386
+ const state = sourceArchivedOf(document2[String(key)]);
4387
+ if (state) return state;
4436
4388
  }
4437
4389
  return null;
4438
4390
  }
@@ -4793,8 +4745,9 @@ import { PropertyRow } from "@ai-matrx/design-system/controls";
4793
4745
  import { AlchemyMenu } from "@ai-matrx/alchemy/react";
4794
4746
  import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4795
4747
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4748
+ import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
4796
4749
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
4797
- var SaveToTable = lazy(() => import("./SaveToTable-2TQKEYJA.js").then((m) => ({ default: m.SaveToTable })));
4750
+ var SaveToTable = lazy(() => import("./SaveToTable-VPLDWCSU.js").then((m) => ({ default: m.SaveToTable })));
4798
4751
  var LONGEST_READ = 5e5;
4799
4752
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4800
4753
  function isPlainObject(v) {
@@ -4901,7 +4854,7 @@ function dateWords(v) {
4901
4854
  return Number.isNaN(local.getTime()) ? null : local.toLocaleDateString(void 0, { dateStyle: "medium" });
4902
4855
  }
4903
4856
  const at = new Date(v);
4904
- return Number.isNaN(at.getTime()) ? null : at.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
4857
+ return Number.isNaN(at.getTime()) ? null : at.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short", ...momentZoneOptions(v) });
4905
4858
  }
4906
4859
  function stop(event) {
4907
4860
  event.stopPropagation();
@@ -5160,12 +5113,12 @@ function computedEmptyOf(field2, document2) {
5160
5113
  return { kind: "formula" };
5161
5114
  }
5162
5115
  var SOURCE_ARCHIVED_WORDS = "Source archived";
5163
- function sourceArchivedSentence(state2) {
5164
- if (!state2.label) return "A column it reads is archived";
5165
- return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
5116
+ function sourceArchivedSentence(state) {
5117
+ if (!state.label) return "A column it reads is archived";
5118
+ return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
5166
5119
  }
5167
- function SourceArchivedValue({ state: state2 }) {
5168
- return /* @__PURE__ */ jsx27("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
5120
+ function SourceArchivedValue({ state }) {
5121
+ return /* @__PURE__ */ jsx27("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
5169
5122
  }
5170
5123
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
5171
5124
  var NOT_STRUCTURE_KINDS = /* @__PURE__ */ new Set(["relation", "entity_reference", "member", "select", "multi_select", "attachment", "signature", "button"]);
@@ -5478,12 +5431,12 @@ function cardWords(record, field2, labels) {
5478
5431
 
5479
5432
  // src/SourceArchivedNotice.tsx
5480
5433
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
5481
- function bringBackLabel(state2) {
5482
- return state2.label ? `Bring back ${state2.label}` : "Bring it back";
5434
+ function bringBackLabel(state) {
5435
+ return state.label ? `Bring back ${state.label}` : "Bring it back";
5483
5436
  }
5484
5437
  function SourceArchivedNotice({ fieldId, tableId }) {
5485
5438
  const client = useRecordsClient5();
5486
- const [state2, setState] = useState21(null);
5439
+ const [state, setState] = useState21(null);
5487
5440
  const [busy, setBusy] = useState21(false);
5488
5441
  const [refused, setRefused] = useState21(null);
5489
5442
  const read = useCallback5(async () => {
@@ -5494,19 +5447,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
5494
5447
  useEffect13(() => {
5495
5448
  void read();
5496
5449
  }, [read]);
5497
- if (refused && !state2) return /* @__PURE__ */ jsx28(RefusalNotice, { error: refused });
5498
- if (!state2) return null;
5450
+ if (refused && !state) return /* @__PURE__ */ jsx28(RefusalNotice, { error: refused });
5451
+ if (!state) return null;
5499
5452
  const restore = async () => {
5500
- if (!state2.field_id) return;
5453
+ if (!state.field_id) return;
5501
5454
  setBusy(true);
5502
5455
  setRefused(null);
5503
- const done = await client.fieldRestore({ field_id: state2.field_id });
5456
+ const done = await client.fieldRestore({ field_id: state.field_id });
5504
5457
  setBusy(false);
5505
5458
  if (!done.ok) {
5506
5459
  setRefused(done.error);
5507
5460
  return;
5508
5461
  }
5509
- if (state2.table_id) tableShapeChanged(state2.table_id);
5462
+ if (state.table_id) tableShapeChanged(state.table_id);
5510
5463
  tableShapeChanged(tableId);
5511
5464
  await read();
5512
5465
  };
@@ -5515,13 +5468,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
5515
5468
  {
5516
5469
  className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
5517
5470
  "data-testid": "source-archived-notice",
5518
- "data-field-id": state2.field_id ?? "",
5471
+ "data-field-id": state.field_id ?? "",
5519
5472
  children: [
5520
5473
  /* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 flex-1 flex-col", children: [
5521
5474
  /* @__PURE__ */ jsx28("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
5522
- /* @__PURE__ */ jsx28("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
5475
+ /* @__PURE__ */ jsx28("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state) })
5523
5476
  ] }),
5524
- state2.field_id ? /* @__PURE__ */ jsx28(Button11, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
5477
+ state.field_id ? /* @__PURE__ */ jsx28(Button11, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state) }) : null,
5525
5478
  refused ? /* @__PURE__ */ jsx28(RefusalNotice, { error: refused, className: "basis-full" }) : null
5526
5479
  ]
5527
5480
  }
@@ -7237,6 +7190,103 @@ function inColumnWords(error, fields) {
7237
7190
  return { ...error, message: say(error.message) ?? error.message, ...error.hint ? { hint: say(error.hint) ?? error.hint } : {} };
7238
7191
  }
7239
7192
 
7193
+ // src/fileExport.ts
7194
+ import { exportCsv, exportMarkdown, toAoa, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
7195
+ import { formatFieldValue as formatFieldValue4 } from "@ai-matrx/design-system/field-formats";
7196
+ var SHEET_EPOCH_DAYS = 25569;
7197
+ function serialOfWall(y, mo, d, h = 0, mi = 0, s = 0) {
7198
+ return Date.UTC(y, mo, d, h, mi, s) / 864e5 + SHEET_EPOCH_DAYS;
7199
+ }
7200
+ function typedDate(field2, value) {
7201
+ if (!isDateField(field2)) return null;
7202
+ const format = dateFormatFor(field2, value);
7203
+ if (!format) return null;
7204
+ if (typeof value === "string") {
7205
+ const bare = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00(?::00(?:\.0+)?)?)?$/.exec(value.trim());
7206
+ if (bare) return { t: "n", v: serialOfWall(Number(bare[1]), Number(bare[2]) - 1, Number(bare[3])), z: "yyyy-mm-dd" };
7207
+ }
7208
+ if (typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) return null;
7209
+ const at = value instanceof Date ? value : new Date(value);
7210
+ if (Number.isNaN(at.getTime())) return null;
7211
+ if (format.id === "date") {
7212
+ const day = personWallNow(at);
7213
+ return { t: "n", v: serialOfWall(day.getFullYear(), day.getMonth(), day.getDate()), z: "yyyy-mm-dd" };
7214
+ }
7215
+ const w = personWallNow(at);
7216
+ return { t: "n", v: serialOfWall(w.getFullYear(), w.getMonth(), w.getDate(), w.getHours(), w.getMinutes(), w.getSeconds()), z: "yyyy-mm-dd hh:mm" };
7217
+ }
7218
+ function fileCellExtras(field2, stored, shown2) {
7219
+ if (shown2 === null || shown2 === void 0 || shown2 === "") return {};
7220
+ const typed = typedDate(field2, stored);
7221
+ if (typed) {
7222
+ const words = dateText(field2, stored);
7223
+ return { typed, ...words !== null ? { text: words } : {} };
7224
+ }
7225
+ if (Array.isArray(shown2) && shown2.every((v) => v === null || ["string", "number", "boolean"].includes(typeof v))) {
7226
+ return { text: shown2.filter((v) => v !== null).map(String).join(", ") };
7227
+ }
7228
+ if (typeof shown2 === "number" && Number.isFinite(shown2)) {
7229
+ const look = shownAsOf(field2);
7230
+ const words = look && !registeredLook(look) ? formatFieldValue4(shown2, look) : null;
7231
+ return { typed: { t: "n", v: shown2 }, ...words && words.ok && !words.empty ? { text: words.text } : {} };
7232
+ }
7233
+ return {};
7234
+ }
7235
+ function displayRows(rows) {
7236
+ return rows.map(
7237
+ (row) => Object.fromEntries(
7238
+ Object.entries(row).map(([key, cell]) => {
7239
+ const text = cell?.text;
7240
+ return [key, cell && text !== void 0 && !cell.absent_reason ? { ...cell, value: text } : cell];
7241
+ })
7242
+ )
7243
+ );
7244
+ }
7245
+ function fileCsv(fields, rows) {
7246
+ return exportCsv(fields, displayRows(rows));
7247
+ }
7248
+ function fileMarkdown(fields, rows) {
7249
+ return exportMarkdown(fields, displayRows(rows));
7250
+ }
7251
+ async function fileXlsx(fields, rows, sheetLabel = "Records") {
7252
+ const { writeWorkbookBytes } = await import("@ai-matrx/print/xlsx");
7253
+ const words = toAoa(fields, displayRows(rows));
7254
+ const sheet = words.map(
7255
+ (line, at) => line.map((text, col) => {
7256
+ if (at === 0) return text;
7257
+ const cell = rows[at - 1]?.[fields[col].key];
7258
+ const typed = cell && !cell.absent_reason ? cell.typed : void 0;
7259
+ return typed ? { t: typed.t, v: typed.v, ...typed.z ? { z: typed.z } : {} } : text;
7260
+ })
7261
+ );
7262
+ const name = sheetLabel.replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
7263
+ return writeWorkbookBytes({ sheets: [{ name, rows: sheet }] });
7264
+ }
7265
+ function toRows(fields, records, labels) {
7266
+ return records.map((record) => {
7267
+ const document2 = record.document ?? {};
7268
+ const envelopes = document2["_values"] ?? {};
7269
+ const row = {};
7270
+ for (const field2 of fields) {
7271
+ const envelope = envelopes[field2.key];
7272
+ const withheld = withheldNoticeOf(record.hidden, field2.key);
7273
+ const held = withheld && (document2[field2.key] ?? null) === null;
7274
+ const shown2 = held ? `${WITHHELD_WORD}: ${withheldSentence(field2, withheld)}` : shownValue(field2, document2[field2.key] ?? null, labels);
7275
+ row[field2.key] = {
7276
+ field_key: field2.key,
7277
+ value: shown2,
7278
+ // The words the grid shows and the sheet cell, for the human files (`fileExport.ts`).
7279
+ ...held ? {} : fileCellExtras(field2, document2[field2.key] ?? null, shown2),
7280
+ absent_reason: envelope?.absent ?? null,
7281
+ // A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
7282
+ // (`withWholeValues`), never the first words passed off as the value.
7283
+ source: wholeValueOf2(document2, field2.key)
7284
+ };
7285
+ }
7286
+ return row;
7287
+ });
7288
+ }
7289
+
7240
7290
  // src/tableJson.ts
7241
7291
  import { exportCellText } from "@ai-matrx/records/core";
7242
7292
  import { toDelimited } from "@ai-matrx/kit/delimited";
@@ -7455,6 +7505,12 @@ function gridCopyConfig(args) {
7455
7505
  ...viewRows ? { export: () => {
7456
7506
  const visible = viewRows();
7457
7507
  return {
7508
+ // THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
7509
+ // words the rail writes (`fileExport.ts`): the value as the grid SHOWS it, a date in her zone.
7510
+ sheetColumns: () => fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
7511
+ sheetRows: () => displayRows(toRows([...fields], viewRows(), labels)).map(
7512
+ (row) => Object.fromEntries(fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]))
7513
+ ),
7458
7514
  items: [
7459
7515
  { id: "csv-row-ids", label: "CSV with row IDs", build: () => ({ content: exportCsvWithRowIds(fields, stored(visible), ids(visible)), extension: "csv", mime: "text/csv;charset=utf-8", filename: `${tableName2} with row IDs` }) },
7460
7516
  { id: "table-json", label: "JSON with row IDs", build: () => ({ content: exportJson(fields, stored(visible), ids(visible)), extension: "json", mime: "application/json;charset=utf-8", filename: tableName2 }) },
@@ -9232,12 +9288,12 @@ function sourceKindOf(field2) {
9232
9288
  if (kind === "attachment") return "file";
9233
9289
  return null;
9234
9290
  }
9235
- function whatIsMissing(state2) {
9236
- const noun = state2.noun ?? "column";
9237
- const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
9238
- const relationTarget = state2.relationTarget ?? "";
9291
+ function whatIsMissing(state) {
9292
+ const noun = state.noun ?? "column";
9293
+ const { type, label, via, pick, agg, of, relations, formulaFields } = state;
9294
+ const relationTarget = state.relationTarget ?? "";
9239
9295
  if (label.trim() === "") return `Give the ${noun} a name.`;
9240
- if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
9296
+ if (type === "entity_reference") return whatIsMissingForEntityReference(state.allowedTypes ?? []);
9241
9297
  if (type === "relation") {
9242
9298
  if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
9243
9299
  return null;
@@ -10013,7 +10069,7 @@ function formatControl(args) {
10013
10069
  // src/typedDateHelper.tsx
10014
10070
  import { useState as useState31 } from "react";
10015
10071
  import { Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn19 } from "@ai-matrx/design-system";
10016
- import { readTypedDate, readTypedTime, typedDateText, typedTimeText } from "@ai-matrx/records";
10072
+ import { readTypedDate, readTypedTime, typedDateText, typedTimeText, wallPartsInZone } from "@ai-matrx/records";
10017
10073
  import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
10018
10074
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
10019
10075
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -10030,8 +10086,8 @@ function readBox(text, kind) {
10030
10086
  const read = readTypedDate(text, { withTime: kind === "datetime" });
10031
10087
  if (!read.ok) return { day: null, time: null };
10032
10088
  if (kind === "datetime" && read.instant) {
10033
- const at = new Date(read.instant);
10034
- return { day: read.day, time: { h: at.getHours(), m: at.getMinutes() } };
10089
+ const wall = wallPartsInZone(new Date(read.instant));
10090
+ return { day: read.day, time: { h: wall.hour, m: wall.minute } };
10035
10091
  }
10036
10092
  return { day: read.day, time: null };
10037
10093
  }
@@ -11444,11 +11500,11 @@ function ChoiceSwatch({ words, color, onColor }) {
11444
11500
  }
11445
11501
 
11446
11502
  // src/dataSource.ts
11447
- import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
11503
+ import { globalSlot } from "@ai-matrx/kit/global-slot";
11448
11504
  function personActor(userId) {
11449
11505
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
11450
11506
  }
11451
- var dataSources = globalSlot2("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
11507
+ var dataSources = globalSlot("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
11452
11508
  function recordsDataSource(client, fallbackSchema = "custom") {
11453
11509
  let bySchema = dataSources.get(client);
11454
11510
  if (!bySchema) {
@@ -11562,6 +11618,7 @@ function sameParts(a, b) {
11562
11618
  import { useEffect as useEffect25, useMemo as useMemo11, useState as useState34 } from "react";
11563
11619
  import { RecordsProvider as RecordsProvider2, useFields as useFields5, useRecords as useRecords3, useTable as useTable4 } from "@ai-matrx/records/react";
11564
11620
  import { Button as Button19, CreatablePicker } from "@ai-matrx/design-system";
11621
+ import { momentZoneOptions as momentZoneOptions2 } from "@ai-matrx/design-system/field-formats";
11565
11622
  import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
11566
11623
  var SHARED_FOR_MS = 5e3;
11567
11624
  var sharedReads = /* @__PURE__ */ new WeakMap();
@@ -11594,7 +11651,7 @@ function readTablesAnywhere(dataSource) {
11594
11651
  return read;
11595
11652
  }
11596
11653
  function useTablesAnywhere(dataSource) {
11597
- const [state2, setState] = useState34({ loading: true, error: null, rows: [] });
11654
+ const [state, setState] = useState34({ loading: true, error: null, rows: [] });
11598
11655
  useEffect25(() => {
11599
11656
  let live = true;
11600
11657
  void readTablesAnywhere(dataSource).then((result) => {
@@ -11604,7 +11661,7 @@ function useTablesAnywhere(dataSource) {
11604
11661
  live = false;
11605
11662
  };
11606
11663
  }, [dataSource]);
11607
- return state2;
11664
+ return state;
11608
11665
  }
11609
11666
  function TablePicker({ dataSource, value, onChange, disabled, tables }) {
11610
11667
  const own3 = useTablesAnywhere(dataSource);
@@ -11621,7 +11678,7 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
11621
11678
  const pickerOptions = options.map((t) => {
11622
11679
  const twin = (sameName.get(`${t.organization_id}|${t.table_name.trim().toLowerCase()}`) ?? 0) > 1;
11623
11680
  const row = t;
11624
- const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString()}` : null].filter(Boolean).join(" \xB7 ");
11681
+ const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString(void 0, momentZoneOptions2(r.updated_at))}` : null].filter(Boolean).join(" \xB7 ");
11625
11682
  const base = secondOf(row);
11626
11683
  const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base).length;
11627
11684
  const second = alike > 1 ? [base, `#${t.table_id.slice(0, 4)}`].filter(Boolean).join(" \xB7 ") : base;
@@ -12156,10 +12213,6 @@ function Decision({
12156
12213
 
12157
12214
  export {
12158
12215
  REVERSE_COLUMN_PREFIX,
12159
- setPersonTimeZone,
12160
- getPersonTimeZone,
12161
- subscribePersonTimeZone,
12162
- personWallNow,
12163
12216
  usePersonTimeZone,
12164
12217
  sortRefusal,
12165
12218
  sortAndFilterRefusal,
@@ -12207,6 +12260,14 @@ export {
12207
12260
  RecordLabelProvider,
12208
12261
  useRecordLabels,
12209
12262
  useLabelWait,
12263
+ WITHHELD_WORD,
12264
+ withheldNoticeOf,
12265
+ withheldSentence,
12266
+ WithheldValue,
12267
+ fileCsv,
12268
+ fileMarkdown,
12269
+ fileXlsx,
12270
+ toRows,
12210
12271
  exportJson,
12211
12272
  exportFullSchema,
12212
12273
  settingsOfTable,
@@ -12252,10 +12313,6 @@ export {
12252
12313
  whatIsMissingForEntityReference,
12253
12314
  EntityReferenceKindPicker,
12254
12315
  withoutLeadingBlank,
12255
- WITHHELD_WORD,
12256
- withheldNoticeOf,
12257
- withheldSentence,
12258
- WithheldValue,
12259
12316
  WHOLE_VALUE_NOT_EDITABLE_HERE,
12260
12317
  wholeValueOpening,
12261
12318
  useWholeText,
@@ -12338,4 +12395,4 @@ export {
12338
12395
  RecordNameText,
12339
12396
  HeldChangeDecision
12340
12397
  };
12341
- //# sourceMappingURL=chunk-AJVN4BMI.js.map
12398
+ //# sourceMappingURL=chunk-2YK72GHL.js.map