@ai-matrx/records-ui 0.115.70 → 0.115.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -564,6 +564,7 @@ __export(src_exports, {
564
564
  styleFromDecorations: () => styleFromDecorations,
565
565
  submissionStamp: () => import_forms8.submissionStamp,
566
566
  subscribeCalendarAction: () => subscribeCalendarAction,
567
+ subscribePersonTimeZone: () => subscribePersonTimeZone,
567
568
  surfaceChosen: () => surfaceChosen,
568
569
  tableActions: () => tableActions,
569
570
  tableLink: () => tableLink,
@@ -726,8 +727,7 @@ function lockedStructure(base2) {
726
727
  return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
727
728
  }
728
729
 
729
- // src/host.tsx
730
- var import_jsx_runtime = require("react/jsx-runtime");
730
+ // src/tableRights.ts
731
731
  function tableRights(may, overallReason) {
732
732
  return {
733
733
  ...may,
@@ -739,6 +739,9 @@ var NO_RIGHTS = tableRights(NOT_ANSWERED_YET);
739
739
  function tableRightsAt(level) {
740
740
  return tableRights(whatYouMayDo(level, true));
741
741
  }
742
+
743
+ // src/host.tsx
744
+ var import_jsx_runtime = require("react/jsx-runtime");
742
745
  var NO_SAVED_VIEWS_REASON = "There are no saved views here yet, so there is nothing to be told about. Save a view of this table first and it will be offered here.";
743
746
  var NO_MEMBERS_REASON = "This app cannot offer the people in your organization on this screen yet, so there is nobody to pick. Type the person's name into a text field for now, and tell us \u2014 it is on our list, not yours.";
744
747
  var NO_SHARE_REASON = "Sharing is not available on this screen, so there is no Share button here rather than one that opens nothing. Share this table from the tables list instead.";
@@ -1269,13 +1272,18 @@ var REVERSE_COLUMN_PREFIX = "linked:";
1269
1272
 
1270
1273
  // src/gridPage.ts
1271
1274
  var import_records6 = require("@ai-matrx/records");
1272
- var import_data_table2 = require("@ai-matrx/design-system/data-table");
1275
+ var import_data_table = require("@ai-matrx/design-system/data-table");
1273
1276
 
1274
1277
  // src/personTime.ts
1275
1278
  var import_react4 = require("react");
1279
+
1280
+ // src/personZone.ts
1276
1281
  var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
1277
- var zone = null;
1278
- var listeners = /* @__PURE__ */ new Set();
1282
+ var import_global_slot = require("@ai-matrx/kit/global-slot");
1283
+ var state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
1284
+ zone: null,
1285
+ listeners: /* @__PURE__ */ new Set()
1286
+ }));
1279
1287
  function valid(z) {
1280
1288
  if (typeof z !== "string" || !z.trim()) return false;
1281
1289
  try {
@@ -1287,25 +1295,22 @@ function valid(z) {
1287
1295
  }
1288
1296
  function setPersonTimeZone(next) {
1289
1297
  const clean = valid(next) ? next : null;
1290
- if (clean === zone) return;
1291
- zone = clean;
1298
+ if (clean === state.zone) return;
1299
+ state.zone = clean;
1292
1300
  (0, import_table_style.setColorRuleTimeZone)(clean);
1293
- listeners.forEach((l) => l());
1301
+ state.listeners.forEach((l) => l());
1294
1302
  }
1295
1303
  function getPersonTimeZone() {
1296
- return zone;
1304
+ return state.zone;
1297
1305
  }
1298
- function usePersonTimeZone() {
1299
- return (0, import_react4.useSyncExternalStore)(
1300
- (cb) => {
1301
- listeners.add(cb);
1302
- return () => listeners.delete(cb);
1303
- },
1304
- () => zone,
1305
- () => null
1306
- );
1306
+ function subscribePersonTimeZone(listener) {
1307
+ state.listeners.add(listener);
1308
+ return () => {
1309
+ state.listeners.delete(listener);
1310
+ };
1307
1311
  }
1308
1312
  function personWallNow(at = /* @__PURE__ */ new Date()) {
1313
+ const zone = state.zone;
1309
1314
  if (!zone) return at;
1310
1315
  const parts = new Intl.DateTimeFormat("en-US", {
1311
1316
  timeZone: zone,
@@ -1321,9 +1326,18 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
1321
1326
  return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
1322
1327
  }
1323
1328
 
1329
+ // src/personTime.ts
1330
+ function usePersonTimeZone() {
1331
+ return (0, import_react4.useSyncExternalStore)(
1332
+ subscribePersonTimeZone,
1333
+ getPersonTimeZone,
1334
+ () => null
1335
+ );
1336
+ }
1337
+
1324
1338
  // src/choiceLooks.ts
1325
1339
  var import_records2 = require("@ai-matrx/records");
1326
- var import_data_table = require("@ai-matrx/design-system/data-table");
1340
+ var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
1327
1341
  function displayFormatOf(field2) {
1328
1342
  const raw = field2.display_format;
1329
1343
  if (!raw || typeof raw !== "object") return null;
@@ -1333,7 +1347,7 @@ function displayFormatOf(field2) {
1333
1347
  return { id, options: options && typeof options === "object" ? options : {} };
1334
1348
  }
1335
1349
  function isStyleColor(v) {
1336
- return typeof v === "string" && import_data_table.STYLE_COLORS.includes(v);
1350
+ return typeof v === "string" && import_table_style2.STYLE_COLORS.includes(v);
1337
1351
  }
1338
1352
  function choiceLooksOf(field2) {
1339
1353
  const display = displayFormatOf(field2);
@@ -1397,9 +1411,9 @@ function nextChoiceColor(worn) {
1397
1411
  function choiceChipLookOf(field2, ...words2) {
1398
1412
  for (const word of words2) {
1399
1413
  const color = storedChoiceColor(field2, word);
1400
- if (color) return { className: import_data_table.CHOICE_CHIP_CLASS[color], color };
1414
+ if (color) return { className: import_table_style2.CHOICE_CHIP_CLASS[color], color };
1401
1415
  }
1402
- return { className: import_data_table.NEUTRAL_CHIP_CLASS, color: null };
1416
+ return { className: import_table_style2.NEUTRAL_CHIP_CLASS, color: null };
1403
1417
  }
1404
1418
 
1405
1419
  // src/parity.ts
@@ -1664,10 +1678,10 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
1664
1678
  return { rule: value.negated ? not(range) : range };
1665
1679
  }
1666
1680
  case "date": {
1667
- const zone2 = getPersonTimeZone() ?? void 0;
1668
- const moments = (0, import_data_table2.dateFilterBounds)(value.preset ? { ...value, anchor: now.toISOString() } : value, now, zone2);
1681
+ const zone = getPersonTimeZone() ?? void 0;
1682
+ const moments = (0, import_data_table.dateFilterBounds)(value.preset ? { ...value, anchor: now.toISOString() } : value, now, zone);
1669
1683
  const holdsDays = String((f.config ?? {})["kind"] ?? "") === "date";
1670
- const bounds = holdsDays ? (0, import_data_table2.dateFilterDayBounds)(moments, zone2) : moments;
1684
+ const bounds = holdsDays ? (0, import_data_table.dateFilterDayBounds)(moments, zone) : moments;
1671
1685
  if (bounds.since === void 0 && bounds.until === void 0) return null;
1672
1686
  return {
1673
1687
  flat: {
@@ -1683,7 +1697,7 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
1683
1697
  }
1684
1698
  }
1685
1699
  function dayWindow(day2, holdsDays) {
1686
- if (!holdsDays) return (0, import_data_table2.dayInstantWindow)(day2, getPersonTimeZone() ?? void 0);
1700
+ if (!holdsDays) return (0, import_data_table.dayInstantWindow)(day2, getPersonTimeZone() ?? void 0);
1687
1701
  const [y, m, d] = day2.split("-").map(Number);
1688
1702
  const ymd = (t) => `${t.getUTCFullYear()}-${String(t.getUTCMonth() + 1).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`;
1689
1703
  return { from: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, d ?? 1))), to: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, (d ?? 1) + 1))) };
@@ -3735,7 +3749,8 @@ var import_react16 = require("react");
3735
3749
  var import_records10 = require("@ai-matrx/records");
3736
3750
  var import_react17 = require("@ai-matrx/records/react");
3737
3751
  var import_design_system9 = require("@ai-matrx/design-system");
3738
- var import_jsx_runtime11 = require("react/jsx-runtime");
3752
+
3753
+ // src/tablePickerEntries.ts
3739
3754
  var PLATFORM_TABLE_PREFIX = "records_ui_";
3740
3755
  function keptByPlatform(table) {
3741
3756
  return table.platform_owned === true || table.kept_by_the_app === true;
@@ -3779,6 +3794,9 @@ function madeOn(stamp) {
3779
3794
  if (Number.isNaN(at.getTime())) return null;
3780
3795
  return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
3781
3796
  }
3797
+
3798
+ // src/tablePicking.tsx
3799
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3782
3800
  function usePickerTables() {
3783
3801
  const client = (0, import_react17.useRecordsClient)();
3784
3802
  const tables = (0, import_react17.useTables)();
@@ -4342,8 +4360,7 @@ var import_react67 = require("@ai-matrx/records/react");
4342
4360
  var import_design_system38 = require("@ai-matrx/design-system");
4343
4361
 
4344
4362
  // src/presentation.ts
4345
- var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
4346
- var import_data_table3 = require("@ai-matrx/design-system/data-table");
4363
+ var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
4347
4364
  var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
4348
4365
  var import_records12 = require("@ai-matrx/records");
4349
4366
 
@@ -4487,8 +4504,8 @@ function parseGridPresentation(raw) {
4487
4504
  }
4488
4505
  if (!isRecord(value)) return {};
4489
4506
  const out = {};
4490
- const style = (0, import_table_style2.parseTableStyle)(value["style"]);
4491
- if (!(0, import_table_style2.tableStyleIsEmpty)(style)) out.style = style;
4507
+ const style = (0, import_table_style3.parseTableStyle)(value["style"]);
4508
+ if (!(0, import_table_style3.tableStyleIsEmpty)(style)) out.style = style;
4492
4509
  if (isRecord(value["formats"])) {
4493
4510
  const formats = {};
4494
4511
  for (const [key, cfg] of Object.entries(value["formats"])) {
@@ -4633,7 +4650,7 @@ function parseGrouping(raw) {
4633
4650
  return out;
4634
4651
  }
4635
4652
  function presentationIsEmpty(p) {
4636
- return (p.style === void 0 || (0, import_table_style2.tableStyleIsEmpty)(p.style)) && Object.keys(p.formats ?? {}).length === 0 && (p.frozen?.length ?? 0) === 0 && p.grouping === void 0 && Object.keys(p.widths ?? {}).length === 0 && p.rowHeight === void 0 && (p.hiddenFields?.length ?? 0) === 0 && p.cardHidden === void 0 && (p.columnOrder?.length ?? 0) === 0 && p.gallerySize === void 0 && p.boardSize === void 0 && p.boardPreview === void 0 && p.boardHideEmpty === void 0 && p.boardColorColumns === void 0 && p.boardCounts === void 0 && (p.boardLanesShut?.length ?? 0) === 0 && p.locked === void 0 && p.wrap === void 0 && p.fit === void 0 && p.freezeFirst === void 0 && p.footer === void 0 && Object.keys(p.summaries ?? {}).length === 0 && p.gantt === void 0;
4653
+ return (p.style === void 0 || (0, import_table_style3.tableStyleIsEmpty)(p.style)) && Object.keys(p.formats ?? {}).length === 0 && (p.frozen?.length ?? 0) === 0 && p.grouping === void 0 && Object.keys(p.widths ?? {}).length === 0 && p.rowHeight === void 0 && (p.hiddenFields?.length ?? 0) === 0 && p.cardHidden === void 0 && (p.columnOrder?.length ?? 0) === 0 && p.gallerySize === void 0 && p.boardSize === void 0 && p.boardPreview === void 0 && p.boardHideEmpty === void 0 && p.boardColorColumns === void 0 && p.boardCounts === void 0 && (p.boardLanesShut?.length ?? 0) === 0 && p.locked === void 0 && p.wrap === void 0 && p.fit === void 0 && p.freezeFirst === void 0 && p.footer === void 0 && Object.keys(p.summaries ?? {}).length === 0 && p.gantt === void 0;
4637
4654
  }
4638
4655
  function presentationDocument(p) {
4639
4656
  return presentationIsEmpty(p) ? "" : JSON.stringify(p);
@@ -4707,7 +4724,7 @@ var colorFromTheValue = (_fieldKey, value) => {
4707
4724
  for (let i = 0; i < text.length; i += 1) {
4708
4725
  hash = hash * 31 + text.charCodeAt(i) >>> 0;
4709
4726
  }
4710
- return import_data_table3.COLOR_ROTATION[hash % import_data_table3.COLOR_ROTATION.length];
4727
+ return import_table_style3.COLOR_ROTATION[hash % import_table_style3.COLOR_ROTATION.length];
4711
4728
  };
4712
4729
  function styleFromDecorations(decorations, fields) {
4713
4730
  if (!decorations) return { version: 1 };
@@ -4781,7 +4798,7 @@ var import_react22 = require("react");
4781
4798
  var import_records13 = require("@ai-matrx/records");
4782
4799
  var import_react23 = require("@ai-matrx/records/react");
4783
4800
  var import_design_system12 = require("@ai-matrx/design-system");
4784
- var import_data_table4 = require("@ai-matrx/design-system/data-table");
4801
+ var import_data_table2 = require("@ai-matrx/design-system/data-table");
4785
4802
  var import_jsx_runtime14 = require("react/jsx-runtime");
4786
4803
  var rowSeed = 0;
4787
4804
  var nextRow = () => `new-${rowSeed += 1}`;
@@ -4999,12 +5016,12 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
4999
5016
  "button",
5000
5017
  {
5001
5018
  type: "button",
5002
- "aria-label": `Colour for ${words2}: ${color ? import_data_table4.STYLE_COLOR_LABELS[color] : "none"}`,
5003
- title: color ? import_data_table4.STYLE_COLOR_LABELS[color] : "No colour",
5019
+ "aria-label": `Colour for ${words2}: ${color ? import_data_table2.STYLE_COLOR_LABELS[color] : "none"}`,
5020
+ title: color ? import_data_table2.STYLE_COLOR_LABELS[color] : "No colour",
5004
5021
  "data-records-choice-swatch": color ?? "none",
5005
5022
  className: (0, import_design_system12.cn)(
5006
5023
  "h-4 w-4 shrink-0 rounded-full",
5007
- color ? import_data_table4.SWATCH_CLASS[color] : "border border-border bg-background"
5024
+ color ? import_data_table2.SWATCH_CLASS[color] : "border border-border bg-background"
5008
5025
  )
5009
5026
  }
5010
5027
  ) }),
@@ -5021,17 +5038,17 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
5021
5038
  className: (0, import_design_system12.cn)("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
5022
5039
  }
5023
5040
  ),
5024
- import_data_table4.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5041
+ import_data_table2.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5025
5042
  "button",
5026
5043
  {
5027
5044
  type: "button",
5028
5045
  role: "radio",
5029
5046
  "aria-checked": color === c,
5030
- "aria-label": import_data_table4.STYLE_COLOR_LABELS[c],
5031
- title: import_data_table4.STYLE_COLOR_LABELS[c],
5047
+ "aria-label": import_data_table2.STYLE_COLOR_LABELS[c],
5048
+ title: import_data_table2.STYLE_COLOR_LABELS[c],
5032
5049
  "data-records-choice-color": `${words2}:${c}`,
5033
5050
  onClick: () => pick(c),
5034
- className: (0, import_design_system12.cn)("h-5 w-5 rounded-full", import_data_table4.SWATCH_CLASS[c], color === c && "ring-2 ring-ring ring-offset-1")
5051
+ className: (0, import_design_system12.cn)("h-5 w-5 rounded-full", import_data_table2.SWATCH_CLASS[c], color === c && "ring-2 ring-ring ring-offset-1")
5035
5052
  },
5036
5053
  c
5037
5054
  ))
@@ -5715,7 +5732,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
5715
5732
  // src/buttonCell.tsx
5716
5733
  var import_react54 = require("react");
5717
5734
  var import_design_system34 = require("@ai-matrx/design-system");
5718
- var import_data_table9 = require("@ai-matrx/design-system/data-table");
5735
+ var import_data_table7 = require("@ai-matrx/design-system/data-table");
5719
5736
  var import_records29 = require("@ai-matrx/records");
5720
5737
  var import_react55 = require("@ai-matrx/records/react");
5721
5738
 
@@ -6053,11 +6070,10 @@ var import_design_system27 = require("@ai-matrx/design-system");
6053
6070
  var import_react45 = require("@ai-matrx/records/react");
6054
6071
 
6055
6072
  // src/values.tsx
6056
- var import_data_table6 = require("@ai-matrx/design-system/data-table");
6073
+ var import_data_table4 = require("@ai-matrx/design-system/data-table");
6057
6074
  var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
6058
6075
 
6059
- // src/withheld.tsx
6060
- var import_jsx_runtime20 = require("react/jsx-runtime");
6076
+ // src/withheldNotice.ts
6061
6077
  var WITHHELD_WORD = "Withheld";
6062
6078
  function withheldNoticeOf(hidden, key) {
6063
6079
  const notice = hidden?.[key];
@@ -6075,6 +6091,9 @@ function withheldSentence(field2, notice) {
6075
6091
  const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
6076
6092
  return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
6077
6093
  }
6094
+
6095
+ // src/withheld.tsx
6096
+ var import_jsx_runtime20 = require("react/jsx-runtime");
6078
6097
  function WithheldValue({ field: field2, notice }) {
6079
6098
  const sentence2 = withheldSentence(field2, notice);
6080
6099
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
@@ -6534,7 +6553,7 @@ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
6534
6553
 
6535
6554
  // src/formattedValue.tsx
6536
6555
  var import_react37 = require("react");
6537
- var import_data_table5 = require("@ai-matrx/design-system/data-table");
6556
+ var import_data_table3 = require("@ai-matrx/design-system/data-table");
6538
6557
  var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
6539
6558
  var import_design_system20 = require("@ai-matrx/design-system");
6540
6559
  var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
@@ -6671,8 +6690,8 @@ function FormattedValue({
6671
6690
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
6672
6691
  }
6673
6692
  const result = (0, import_field_formats3.formatFieldValue)(value, format);
6674
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table5.FormattedCell, { result });
6675
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table5.FormattedCell, { result });
6693
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table3.FormattedCell, { result });
6694
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table3.FormattedCell, { result });
6676
6695
  }
6677
6696
  function linkChipText(raw) {
6678
6697
  try {
@@ -7317,8 +7336,8 @@ function formulaSourceArchived(field2, document2) {
7317
7336
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
7318
7337
  if (!Array.isArray(keys) || !document2) return null;
7319
7338
  for (const key of keys) {
7320
- const state = (0, import_records19.sourceArchivedOf)(document2[String(key)]);
7321
- if (state) return state;
7339
+ const state2 = (0, import_records19.sourceArchivedOf)(document2[String(key)]);
7340
+ if (state2) return state2;
7322
7341
  }
7323
7342
  return null;
7324
7343
  }
@@ -7548,12 +7567,12 @@ function computedEmptyOf(field2, document2) {
7548
7567
  return { kind: "formula" };
7549
7568
  }
7550
7569
  var SOURCE_ARCHIVED_WORDS = "Source archived";
7551
- function sourceArchivedSentence(state) {
7552
- if (!state.label) return "A column it reads is archived";
7553
- return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
7570
+ function sourceArchivedSentence(state2) {
7571
+ if (!state2.label) return "A column it reads is archived";
7572
+ return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
7554
7573
  }
7555
- function SourceArchivedValue({ state }) {
7556
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
7574
+ function SourceArchivedValue({ state: state2 }) {
7575
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
7557
7576
  }
7558
7577
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
7559
7578
  function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
@@ -7598,7 +7617,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
7598
7617
  const chosen = kind === "select" || kind === "multi_select";
7599
7618
  const chipOf = (item) => {
7600
7619
  const chipLook = choiceChipLookOf(field2, item, scalarText(field2, item, labels));
7601
- return { className: chipLook.className, tinted: chipLook.color !== null, dot: import_data_table6.SWATCH_CLASS[chipLook.color ?? "gray"] };
7620
+ return { className: chipLook.className, tinted: chipLook.color !== null, dot: import_data_table4.SWATCH_CLASS[chipLook.color ?? "gray"] };
7602
7621
  };
7603
7622
  if (chosen) {
7604
7623
  const items = Array.isArray(value) ? value : [value];
@@ -7766,7 +7785,7 @@ function RecordValue({
7766
7785
  const shown5 = format ?? formatForField(field2);
7767
7786
  const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
7768
7787
  const dated = shape ? { ...shape, ...shown5?.options ? { options: shown5.options } : {} } : void 0;
7769
- const formatted = shown5 ? (0, import_data_table6.formatColumnValue)({ format: dated ?? shown5 }, value) : null;
7788
+ const formatted = shown5 ? (0, import_data_table4.formatColumnValue)({ format: dated ?? shown5 }, value) : null;
7770
7789
  if (formatted && !(embeddedLook?.blankEmpty && formatted.empty)) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FormattedValue, { value, format: dated ?? shown5 });
7771
7790
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: renderValue(field2, value, document2, labels, stillWaitingFor, embeddedLook) });
7772
7791
  }
@@ -7791,12 +7810,12 @@ function cardWords(record, field2, labels) {
7791
7810
 
7792
7811
  // src/SourceArchivedNotice.tsx
7793
7812
  var import_jsx_runtime31 = require("react/jsx-runtime");
7794
- function bringBackLabel(state) {
7795
- return state.label ? `Bring back ${state.label}` : "Bring it back";
7813
+ function bringBackLabel(state2) {
7814
+ return state2.label ? `Bring back ${state2.label}` : "Bring it back";
7796
7815
  }
7797
7816
  function SourceArchivedNotice({ fieldId, tableId }) {
7798
7817
  const client = (0, import_react45.useRecordsClient)();
7799
- const [state, setState] = (0, import_react44.useState)(null);
7818
+ const [state2, setState] = (0, import_react44.useState)(null);
7800
7819
  const [busy, setBusy] = (0, import_react44.useState)(false);
7801
7820
  const [refused, setRefused] = (0, import_react44.useState)(null);
7802
7821
  const read = (0, import_react44.useCallback)(async () => {
@@ -7807,19 +7826,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7807
7826
  (0, import_react44.useEffect)(() => {
7808
7827
  void read();
7809
7828
  }, [read]);
7810
- if (refused && !state) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: refused });
7811
- if (!state) return null;
7829
+ if (refused && !state2) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: refused });
7830
+ if (!state2) return null;
7812
7831
  const restore = async () => {
7813
- if (!state.field_id) return;
7832
+ if (!state2.field_id) return;
7814
7833
  setBusy(true);
7815
7834
  setRefused(null);
7816
- const done = await client.fieldRestore({ field_id: state.field_id });
7835
+ const done = await client.fieldRestore({ field_id: state2.field_id });
7817
7836
  setBusy(false);
7818
7837
  if (!done.ok) {
7819
7838
  setRefused(done.error);
7820
7839
  return;
7821
7840
  }
7822
- if (state.table_id) (0, import_react45.tableShapeChanged)(state.table_id);
7841
+ if (state2.table_id) (0, import_react45.tableShapeChanged)(state2.table_id);
7823
7842
  (0, import_react45.tableShapeChanged)(tableId);
7824
7843
  await read();
7825
7844
  };
@@ -7828,13 +7847,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7828
7847
  {
7829
7848
  className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
7830
7849
  "data-testid": "source-archived-notice",
7831
- "data-field-id": state.field_id ?? "",
7850
+ "data-field-id": state2.field_id ?? "",
7832
7851
  children: [
7833
7852
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
7834
7853
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
7835
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state) })
7854
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
7836
7855
  ] }),
7837
- state.field_id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system27.Button, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state) }) : null,
7856
+ state2.field_id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system27.Button, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
7838
7857
  refused ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: refused, className: "basis-full" }) : null
7839
7858
  ]
7840
7859
  }
@@ -7872,10 +7891,10 @@ var RELATIVE_DAY_TERMS = [
7872
7891
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
7873
7892
  ];
7874
7893
  function relativeDayNode(fieldId, kind, days) {
7875
- const zone2 = getPersonTimeZone();
7894
+ const zone = getPersonTimeZone();
7876
7895
  const window2 = { relative: kind };
7877
7896
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
7878
- if (zone2) window2["tz"] = zone2;
7897
+ if (zone) window2["tz"] = zone;
7879
7898
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
7880
7899
  }
7881
7900
  function relativeDayOf(expr) {
@@ -8904,14 +8923,14 @@ var import_records27 = require("@ai-matrx/records");
8904
8923
  // src/ButtonSettings.tsx
8905
8924
  var import_react50 = require("react");
8906
8925
  var import_design_system32 = require("@ai-matrx/design-system");
8907
- var import_data_table8 = require("@ai-matrx/design-system/data-table");
8926
+ var import_data_table6 = require("@ai-matrx/design-system/data-table");
8908
8927
  var import_records26 = require("@ai-matrx/records");
8909
8928
  var import_react51 = require("@ai-matrx/records/react");
8910
8929
 
8911
8930
  // src/AccentSwatches.tsx
8912
8931
  var import_records25 = require("@ai-matrx/records");
8913
8932
  var import_design_system31 = require("@ai-matrx/design-system");
8914
- var import_data_table7 = require("@ai-matrx/design-system/data-table");
8933
+ var import_data_table5 = require("@ai-matrx/design-system/data-table");
8915
8934
  var import_jsx_runtime36 = require("react/jsx-runtime");
8916
8935
  function AccentSwatches({ value, onChange, options = import_records25.PORTAL_ACCENTS, noneLabel = "App colour" }) {
8917
8936
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
@@ -8935,10 +8954,10 @@ function AccentSwatches({ value, onChange, options = import_records25.PORTAL_ACC
8935
8954
  type: "button",
8936
8955
  role: "radio",
8937
8956
  "aria-checked": value === c,
8938
- "aria-label": import_data_table7.STYLE_COLOR_LABELS[c],
8939
- title: import_data_table7.STYLE_COLOR_LABELS[c],
8957
+ "aria-label": import_data_table5.STYLE_COLOR_LABELS[c],
8958
+ title: import_data_table5.STYLE_COLOR_LABELS[c],
8940
8959
  onClick: () => onChange(c),
8941
- className: (0, import_design_system31.cn)("h-7 w-7 rounded-full border-2", import_data_table7.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
8960
+ className: (0, import_design_system31.cn)("h-7 w-7 rounded-full border-2", import_data_table5.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
8942
8961
  },
8943
8962
  c
8944
8963
  ))
@@ -9018,7 +9037,7 @@ function ButtonSettingsEditor({
9018
9037
  AccentSwatches,
9019
9038
  {
9020
9039
  value: value.color ?? "",
9021
- options: import_data_table8.STYLE_COLORS,
9040
+ options: import_data_table6.STYLE_COLORS,
9022
9041
  noneLabel: "Plain",
9023
9042
  onChange: (next) => set({ color: next === "" ? void 0 : next })
9024
9043
  }
@@ -10088,12 +10107,12 @@ function sourceKindOf(field2) {
10088
10107
  if (kind === "attachment") return "file";
10089
10108
  return null;
10090
10109
  }
10091
- function whatIsMissing(state) {
10092
- const noun = state.noun ?? "column";
10093
- const { type, label, via, pick, agg, of, relations, formulaFields } = state;
10094
- const relationTarget = state.relationTarget ?? "";
10110
+ function whatIsMissing(state2) {
10111
+ const noun = state2.noun ?? "column";
10112
+ const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
10113
+ const relationTarget = state2.relationTarget ?? "";
10095
10114
  if (label.trim() === "") return `Give the ${noun} a name.`;
10096
- if (type === "entity_reference") return whatIsMissingForEntityReference(state.allowedTypes ?? []);
10115
+ if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
10097
10116
  if (type === "relation") {
10098
10117
  if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
10099
10118
  return null;
@@ -10468,7 +10487,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
10468
10487
  const [said2, setSaid] = (0, import_react54.useState)(null);
10469
10488
  const [settingUp, setSettingUp] = (0, import_react54.useState)(false);
10470
10489
  if (!b) return null;
10471
- const color = (0, import_data_table9.isStyleColor)(b.color) ? import_data_table9.CHOICE_CHIP_CLASS[b.color] : import_data_table9.NEUTRAL_CHIP_CLASS;
10490
+ const color = (0, import_data_table7.isStyleColor)(b.color) ? import_data_table7.CHOICE_CHIP_CLASS[b.color] : import_data_table7.NEUTRAL_CHIP_CLASS;
10472
10491
  const needs = (0, import_records29.buttonNeeds)(b);
10473
10492
  const tableId = field2.entity_definition_id;
10474
10493
  const press = async () => {
@@ -12816,7 +12835,7 @@ function GridCell({
12816
12835
  else cancelSinglePress();
12817
12836
  };
12818
12837
  const value = editing ? editing.valueFor(row, field2) : row.document?.[field2.key];
12819
- const state = editing ? editing.stateOf(row.id, field2.key) : null;
12838
+ const state2 = editing ? editing.stateOf(row.id, field2.key) : null;
12820
12839
  const refusal3 = editing ? editing.refusalOf(row.id, field2.key) : null;
12821
12840
  const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
12822
12841
  if (open && editing) {
@@ -12877,7 +12896,7 @@ function GridCell({
12877
12896
  disabled: !editable,
12878
12897
  "aria-label": editable ? `${fieldName(field2)} \u2014 press Space to ${value === true ? "untick" : "tick"}` : fieldName(field2),
12879
12898
  title: editable ? answered ? `${fieldName(field2)} \u2014 press Space to change` : `${fieldName(field2)} \u2014 nobody has answered this yet` : whyNot ?? `${fieldName(field2)} \u2014 you cannot change this record`,
12880
- className: (0, import_design_system38.cn)(state === "saving" ? "opacity-60" : "", state === "refused" ? "ring-1 ring-destructive" : ""),
12899
+ className: (0, import_design_system38.cn)(state2 === "saving" ? "opacity-60" : "", state2 === "refused" ? "ring-1 ring-destructive" : ""),
12881
12900
  onCheckedChange: (next) => editing?.setCell(row.id, field2.key, next === true)
12882
12901
  }
12883
12902
  ),
@@ -12888,7 +12907,7 @@ function GridCell({
12888
12907
  if (editable && format?.id === "rating") {
12889
12908
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
12890
12909
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
12891
- state === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12910
+ state2 === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12892
12911
  refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
12893
12912
  ] });
12894
12913
  }
@@ -12950,8 +12969,8 @@ function GridCell({
12950
12969
  // table cell, and a click there is a row click.
12951
12970
  "block w-full min-w-0 flex-1 truncate rounded px-1 py-0.5",
12952
12971
  editable ? "cursor-text hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : "",
12953
- state === "saving" ? "opacity-60" : "",
12954
- state === "refused" ? "ring-1 ring-destructive" : ""
12972
+ state2 === "saving" ? "opacity-60" : "",
12973
+ state2 === "refused" ? "ring-1 ring-destructive" : ""
12955
12974
  ),
12956
12975
  onMouseDown: onPointerDown,
12957
12976
  onClickCapture: onLinkClickCapture,
@@ -13010,7 +13029,7 @@ function GridCell({
13010
13029
  }
13011
13030
  ) : null
13012
13031
  ] }),
13013
- state === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
13032
+ state2 === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
13014
13033
  refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
13015
13034
  ]
13016
13035
  }
@@ -13369,7 +13388,7 @@ function rememberLayout(tableId, layout) {
13369
13388
  // src/RecordsSkeleton.tsx
13370
13389
  var import_react68 = require("react");
13371
13390
  var import_design_system39 = require("@ai-matrx/design-system");
13372
- var import_data_table10 = require("@ai-matrx/design-system/data-table");
13391
+ var import_data_table8 = require("@ai-matrx/design-system/data-table");
13373
13392
  var import_jsx_runtime46 = require("react/jsx-runtime");
13374
13393
  var NEVER = () => () => {
13375
13394
  };
@@ -13414,7 +13433,7 @@ var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
13414
13433
  var NO_ROWS2 = [];
13415
13434
  function GridSkeleton({ embedded, rows }) {
13416
13435
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
13417
- import_data_table10.MatrxDataTable,
13436
+ import_data_table8.MatrxDataTable,
13418
13437
  {
13419
13438
  ...embedded ? {} : { className: "min-h-0 flex-1" },
13420
13439
  data: NO_ROWS2,
@@ -13572,7 +13591,7 @@ var import_react143 = require("react");
13572
13591
  var import_react144 = require("@ai-matrx/records/react");
13573
13592
  var import_records46 = require("@ai-matrx/records");
13574
13593
  var import_records47 = require("@ai-matrx/records");
13575
- var import_data_table16 = require("@ai-matrx/design-system/data-table");
13594
+ var import_data_table14 = require("@ai-matrx/design-system/data-table");
13576
13595
  var import_core18 = require("@ai-matrx/records/core");
13577
13596
 
13578
13597
  // src/tableDecorations.ts
@@ -13580,7 +13599,7 @@ var import_react71 = require("react");
13580
13599
  var import_react72 = require("@ai-matrx/records/react");
13581
13600
  function useTableDecorations(tableId, revision) {
13582
13601
  const client = (0, import_react72.useRecordsClient)();
13583
- const [state, setState] = (0, import_react71.useState)({ data: null, loading: Boolean(tableId) });
13602
+ const [state2, setState] = (0, import_react71.useState)({ data: null, loading: Boolean(tableId) });
13584
13603
  const seen = (0, import_react71.useRef)({ tableId: void 0, revision: void 0 });
13585
13604
  const ticket = (0, import_react71.useRef)(0);
13586
13605
  (0, import_react71.useEffect)(() => {
@@ -13606,7 +13625,7 @@ function useTableDecorations(tableId, revision) {
13606
13625
  ticket.current += 1;
13607
13626
  }, []);
13608
13627
  const apply = (0, import_react71.useCallback)((next) => setState({ data: next, loading: false }), []);
13609
- return { ...state, apply };
13628
+ return { ...state2, apply };
13610
13629
  }
13611
13630
 
13612
13631
  // src/emptyState.tsx
@@ -13717,7 +13736,7 @@ var import_core10 = require("@ai-matrx/records/core");
13717
13736
  var import_react101 = require("react");
13718
13737
  var import_react102 = require("@ai-matrx/records/react");
13719
13738
  var import_design_system55 = require("@ai-matrx/design-system");
13720
- var import_data_table12 = require("@ai-matrx/design-system/data-table");
13739
+ var import_data_table10 = require("@ai-matrx/design-system/data-table");
13721
13740
  var import_format4 = require("@ai-matrx/kit/format");
13722
13741
 
13723
13742
  // src/MergeRecordDialog.tsx
@@ -14258,42 +14277,13 @@ var import_design_system43 = require("@ai-matrx/design-system");
14258
14277
 
14259
14278
  // src/RecordsMount.tsx
14260
14279
  var import_react78 = require("react");
14261
- var import_react79 = require("@ai-matrx/records/react");
14262
- var import_jsx_runtime50 = require("react/jsx-runtime");
14263
- var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
14264
- function storeDecidesRights(_table) {
14265
- return NO_RIGHTS;
14266
- }
14267
- function RecordsMount({
14268
- config,
14269
- host,
14270
- letTheStoreDecideRights,
14271
- children
14272
- }) {
14273
- const bound2 = useShallowStableHost(host);
14274
- void letTheStoreDecideRights;
14275
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react79.RecordsProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordLabelProvider, { children }) }) });
14276
- }
14277
- function useShallowStableHost(host) {
14278
- const held = (0, import_react78.useRef)(null);
14279
- const next = host ?? {};
14280
- const previous = held.current;
14281
- if (previous !== null && sameParts(previous, next)) return previous;
14282
- const bound2 = { ...next };
14283
- held.current = bound2;
14284
- return bound2;
14285
- }
14286
- function sameParts(a, b) {
14287
- const aKeys = Object.keys(a);
14288
- const bKeys = Object.keys(b);
14289
- if (aKeys.length !== bKeys.length) return false;
14290
- for (const key of aKeys) if (a[key] !== b[key]) return false;
14291
- return true;
14292
- }
14280
+
14281
+ // src/dataSource.ts
14282
+ var import_global_slot2 = require("@ai-matrx/kit/global-slot");
14293
14283
  function personActor(userId) {
14294
14284
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
14295
14285
  }
14296
- var dataSources = /* @__PURE__ */ new WeakMap();
14286
+ var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
14297
14287
  function recordsDataSource(client, fallbackSchema = "custom") {
14298
14288
  let bySchema = dataSources.get(client);
14299
14289
  if (!bySchema) {
@@ -14339,6 +14329,40 @@ async function hasSession(getSession) {
14339
14329
  }
14340
14330
  }
14341
14331
 
14332
+ // src/RecordsMount.tsx
14333
+ var import_react79 = require("@ai-matrx/records/react");
14334
+ var import_jsx_runtime50 = require("react/jsx-runtime");
14335
+ var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
14336
+ function storeDecidesRights(_table) {
14337
+ return NO_RIGHTS;
14338
+ }
14339
+ function RecordsMount({
14340
+ config,
14341
+ host,
14342
+ letTheStoreDecideRights,
14343
+ children
14344
+ }) {
14345
+ const bound2 = useShallowStableHost(host);
14346
+ void letTheStoreDecideRights;
14347
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react79.RecordsProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordLabelProvider, { children }) }) });
14348
+ }
14349
+ function useShallowStableHost(host) {
14350
+ const held = (0, import_react78.useRef)(null);
14351
+ const next = host ?? {};
14352
+ const previous = held.current;
14353
+ if (previous !== null && sameParts(previous, next)) return previous;
14354
+ const bound2 = { ...next };
14355
+ held.current = bound2;
14356
+ return bound2;
14357
+ }
14358
+ function sameParts(a, b) {
14359
+ const aKeys = Object.keys(a);
14360
+ const bKeys = Object.keys(b);
14361
+ if (aKeys.length !== bKeys.length) return false;
14362
+ for (const key of aKeys) if (a[key] !== b[key]) return false;
14363
+ return true;
14364
+ }
14365
+
14342
14366
  // src/TablePickers.tsx
14343
14367
  var import_jsx_runtime51 = require("react/jsx-runtime");
14344
14368
  var SHARED_FOR_MS = 5e3;
@@ -14372,7 +14396,7 @@ function readTablesAnywhere(dataSource) {
14372
14396
  return read;
14373
14397
  }
14374
14398
  function useTablesAnywhere(dataSource) {
14375
- const [state, setState] = (0, import_react80.useState)({ loading: true, error: null, rows: [] });
14399
+ const [state2, setState] = (0, import_react80.useState)({ loading: true, error: null, rows: [] });
14376
14400
  (0, import_react80.useEffect)(() => {
14377
14401
  let live = true;
14378
14402
  void readTablesAnywhere(dataSource).then((result) => {
@@ -14382,7 +14406,7 @@ function useTablesAnywhere(dataSource) {
14382
14406
  live = false;
14383
14407
  };
14384
14408
  }, [dataSource]);
14385
- return state;
14409
+ return state2;
14386
14410
  }
14387
14411
  function TablePicker({ dataSource, value, onChange, disabled, tables }) {
14388
14412
  const own3 = useTablesAnywhere(dataSource);
@@ -14737,7 +14761,7 @@ var import_react84 = require("react");
14737
14761
  var import_records34 = require("@ai-matrx/records");
14738
14762
  var import_react85 = require("@ai-matrx/records/react");
14739
14763
  var import_design_system45 = require("@ai-matrx/design-system");
14740
- var import_data_table11 = require("@ai-matrx/design-system/data-table");
14764
+ var import_data_table9 = require("@ai-matrx/design-system/data-table");
14741
14765
  var import_jsx_runtime53 = require("react/jsx-runtime");
14742
14766
  function isChoiceField(field2) {
14743
14767
  const kind = String(editorKindFor(field2));
@@ -14794,7 +14818,7 @@ function useChoiceOptions(fields, keys) {
14794
14818
  }
14795
14819
  function lookOf(option) {
14796
14820
  const raw = option.data?.["color"];
14797
- const color = typeof raw === "string" && import_data_table11.STYLE_COLORS.includes(raw) ? raw : void 0;
14821
+ const color = typeof raw === "string" && import_data_table9.STYLE_COLORS.includes(raw) ? raw : void 0;
14798
14822
  return { id: String(option.id), key: (0, import_records34.optionKey)(option), label: (0, import_records34.optionLabel)(option), ...color ? { color } : {} };
14799
14823
  }
14800
14824
  function paintByOption(style, _fields, index, lookup) {
@@ -14853,12 +14877,12 @@ function rulesLeaf(drafts, fields) {
14853
14877
  const out = [];
14854
14878
  for (const d of drafts) {
14855
14879
  const field2 = fields.find((f) => f.key === d.field);
14856
- if (!field2 || import_data_table11.COLOR_RULE_DATE_OPS.includes(d.op)) continue;
14880
+ if (!field2 || import_data_table9.COLOR_RULE_DATE_OPS.includes(d.op)) continue;
14857
14881
  out.push({
14858
14882
  ...d.id ? { id: d.id } : {},
14859
14883
  field: field2.id,
14860
14884
  op: d.op,
14861
- ...import_data_table11.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
14885
+ ...import_data_table9.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
14862
14886
  color: d.color,
14863
14887
  target: d.target
14864
14888
  });
@@ -14873,7 +14897,7 @@ function viewRulesFrom(drafts) {
14873
14897
  id: d.id ?? `rule-${Date.now().toString(36)}-${i}`,
14874
14898
  field: d.field,
14875
14899
  op: d.op,
14876
- ...import_data_table11.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
14900
+ ...import_data_table9.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
14877
14901
  color: d.color,
14878
14902
  target: d.target
14879
14903
  }));
@@ -14883,9 +14907,9 @@ function isDateField2(field2) {
14883
14907
  }
14884
14908
  function swatches(prefix, current, write) {
14885
14909
  return [
14886
- ...import_data_table11.STYLE_COLORS.map((color) => ({
14910
+ ...import_data_table9.STYLE_COLORS.map((color) => ({
14887
14911
  id: `${prefix}-${color}`,
14888
- label: color === current ? `${import_data_table11.STYLE_COLOR_LABELS[color]} (now)` : import_data_table11.STYLE_COLOR_LABELS[color],
14912
+ label: color === current ? `${import_data_table9.STYLE_COLOR_LABELS[color]} (now)` : import_data_table9.STYLE_COLOR_LABELS[color],
14889
14913
  onSelect: () => write(color)
14890
14914
  })),
14891
14915
  ...current ? [{ id: `${prefix}-none`, label: "No highlight", onSelect: () => write(null) }] : []
@@ -14951,11 +14975,11 @@ function useGridColours(args) {
14951
14975
  },
14952
14976
  {
14953
14977
  id: "col-highlight",
14954
- label: column ? `Highlight column (${import_data_table11.STYLE_COLOR_LABELS[column]})` : "Highlight column",
14978
+ label: column ? `Highlight column (${import_data_table9.STYLE_COLOR_LABELS[column]})` : "Highlight column",
14955
14979
  submenu: swatches(
14956
14980
  "col-highlight",
14957
14981
  column,
14958
- (color) => void write(["columns", field2.id], color, color ? `${name} is highlighted ${import_data_table11.STYLE_COLOR_LABELS[color].toLowerCase()}.` : `${name} is no longer highlighted.`)
14982
+ (color) => void write(["columns", field2.id], color, color ? `${name} is highlighted ${import_data_table9.STYLE_COLOR_LABELS[color].toLowerCase()}.` : `${name} is no longer highlighted.`)
14959
14983
  )
14960
14984
  }
14961
14985
  ]
@@ -15084,7 +15108,7 @@ function useGridColours(args) {
15084
15108
  }
15085
15109
  var SELECT2 = "h-8";
15086
15110
  var CHOICE_OPS = ["is", "is_not", "is_empty", "not_empty"].filter(
15087
- (op2) => import_data_table11.COLOR_RULE_OPS.includes(op2)
15111
+ (op2) => import_data_table9.COLOR_RULE_OPS.includes(op2)
15088
15112
  );
15089
15113
  function ColourRulesDialog({
15090
15114
  open,
@@ -15105,7 +15129,7 @@ function ColourRulesDialog({
15105
15129
  const field2 = fields.find((f) => f.key === key);
15106
15130
  if (choicesOf(key)) return CHOICE_OPS;
15107
15131
  const dateTests = scope === "view" && isDateField2(field2);
15108
- return import_data_table11.COLOR_RULE_OPS.filter((op2) => dateTests || !import_data_table11.COLOR_RULE_DATE_OPS.includes(op2));
15132
+ return import_data_table9.COLOR_RULE_OPS.filter((op2) => dateTests || !import_data_table9.COLOR_RULE_DATE_OPS.includes(op2));
15109
15133
  };
15110
15134
  const rows = drafts ?? held;
15111
15135
  const set = (i, patch) => setDrafts(
@@ -15174,11 +15198,11 @@ function ColourRulesDialog({
15174
15198
  onChange: (picked) => set(i, { op: picked }),
15175
15199
  options: opsFor(rule.field).map((op2) => ({
15176
15200
  value: op2,
15177
- label: import_data_table11.COLOR_RULE_OP_LABELS[op2]
15201
+ label: import_data_table9.COLOR_RULE_OP_LABELS[op2]
15178
15202
  }))
15179
15203
  }
15180
15204
  ),
15181
- import_data_table11.OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15205
+ import_data_table9.OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15182
15206
  PickOne,
15183
15207
  {
15184
15208
  label: "Choice",
@@ -15189,7 +15213,7 @@ function ColourRulesDialog({
15189
15213
  onChange: (picked) => set(i, { value: picked }),
15190
15214
  options: choicesOf(rule.field).map((option) => ({ value: option.id, label: option.label }))
15191
15215
  }
15192
- ) : import_data_table11.OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15216
+ ) : import_data_table9.OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15193
15217
  "input",
15194
15218
  {
15195
15219
  "aria-label": "Value",
@@ -15221,7 +15245,7 @@ function ColourRulesDialog({
15221
15245
  className: SELECT2,
15222
15246
  value: rule.color,
15223
15247
  onChange: (picked) => set(i, { color: picked }),
15224
- options: import_data_table11.STYLE_COLORS.map((c) => ({ value: c, label: import_data_table11.STYLE_COLOR_LABELS[c] }))
15248
+ options: import_data_table9.STYLE_COLORS.map((c) => ({ value: c, label: import_data_table9.STYLE_COLOR_LABELS[c] }))
15225
15249
  }
15226
15250
  ),
15227
15251
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system45.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
@@ -17914,7 +17938,7 @@ function useMergedGridControls(args) {
17914
17938
  const row = rows.find((r) => r.id === rowId);
17915
17939
  if (!row) return null;
17916
17940
  const doc = row.document ?? {};
17917
- return (0, import_data_table12.gridToTsv)([order.filter((k) => !hidden.includes(k)).map((k) => doc[k])]);
17941
+ return (0, import_data_table10.gridToTsv)([order.filter((k) => !hidden.includes(k)).map((k) => doc[k])]);
17918
17942
  },
17919
17943
  [rows, order, hidden]
17920
17944
  );
@@ -18393,7 +18417,7 @@ function CustomFieldsSection({
18393
18417
  });
18394
18418
  (0, import_react103.useEffect)(() => {
18395
18419
  if (!agentDoor) return;
18396
- const state = () => {
18420
+ const state2 = () => {
18397
18421
  const now = live.current;
18398
18422
  return {
18399
18423
  entityToken,
@@ -18410,7 +18434,7 @@ function CustomFieldsSection({
18410
18434
  };
18411
18435
  };
18412
18436
  const check = (requests) => {
18413
- const now = state();
18437
+ const now = state2();
18414
18438
  if (now.mayAdd === false) {
18415
18439
  return [now.refusal ?? "This person may not add a field here."];
18416
18440
  }
@@ -18475,7 +18499,7 @@ function CustomFieldsSection({
18475
18499
  live.current.reload();
18476
18500
  return { ok: true, written };
18477
18501
  };
18478
- return agentDoor({ entityToken, recordId, state, check, addField, checkValues, setValues });
18502
+ return agentDoor({ entityToken, recordId, state: state2, check, addField, checkValues, setValues });
18479
18503
  }, [agentDoor, client, entityToken, recordId]);
18480
18504
  if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
18481
18505
  const storeReason = rights.data?.reason ?? null;
@@ -19293,12 +19317,12 @@ function NewRecordControl({
19293
19317
  var import_react113 = require("react");
19294
19318
  var import_react114 = require("@ai-matrx/records/react");
19295
19319
  var import_records39 = require("@ai-matrx/records");
19296
- var import_data_table14 = require("@ai-matrx/design-system/data-table");
19320
+ var import_data_table12 = require("@ai-matrx/design-system/data-table");
19297
19321
 
19298
19322
  // src/drillLevel.ts
19299
19323
  var import_react111 = require("react");
19300
19324
  var import_react112 = require("@ai-matrx/records/react");
19301
- var import_data_table13 = require("@ai-matrx/design-system/data-table");
19325
+ var import_data_table11 = require("@ai-matrx/design-system/data-table");
19302
19326
  var askId = (ask2) => `${ask2.outer ?? ""}|${ask2.fact}`;
19303
19327
  function valueOf(v) {
19304
19328
  return v === null || v === void 0 || v === "" ? null : String(v);
@@ -19306,11 +19330,11 @@ function valueOf(v) {
19306
19330
  function drillLevelAsks(args) {
19307
19331
  const { question, dimensions, answers, where } = args;
19308
19332
  const known = (k) => dimensions.some((d) => d.key === k);
19309
- const dim = (ref) => dimensions.find((d) => d.key === (0, import_data_table13.parseDimensionRef)(ref).key);
19333
+ const dim = (ref) => dimensions.find((d) => d.key === (0, import_data_table11.parseDimensionRef)(ref).key);
19310
19334
  const outer2 = question.by[0] ?? null;
19311
- const groupsOf2 = (ref) => (answers[(0, import_data_table13.drillRequestKey)(question.by.slice(0, question.by.indexOf(ref) + 1))] ?? []).map((r) => r.groups[ref] ?? null).filter((v) => typeof v === "string" && v !== "");
19335
+ const groupsOf2 = (ref) => (answers[(0, import_data_table11.drillRequestKey)(question.by.slice(0, question.by.indexOf(ref) + 1))] ?? []).map((r) => r.groups[ref] ?? null).filter((v) => typeof v === "string" && v !== "");
19312
19336
  const attributes = [];
19313
- if (outer2 && !question.across && !(0, import_data_table13.parseDimensionRef)(outer2).grain) {
19337
+ if (outer2 && !question.across && !(0, import_data_table11.parseDimensionRef)(outer2).grain) {
19314
19338
  const groups = groupsOf2(outer2);
19315
19339
  if (groups.length > 0) {
19316
19340
  for (const fact of dim(outer2)?.level?.attributes ?? []) {
@@ -19319,9 +19343,9 @@ function drillLevelAsks(args) {
19319
19343
  }
19320
19344
  }
19321
19345
  const focus = [];
19322
- const at = (0, import_data_table13.drillFocus)(question);
19323
- if (at && !(0, import_data_table13.parseDimensionRef)(at.dim).grain) {
19324
- const filtered = new Set(question.where.map((w) => (0, import_data_table13.parseDimensionRef)(w.dim).key));
19346
+ const at = (0, import_data_table11.drillFocus)(question);
19347
+ if (at && !(0, import_data_table11.parseDimensionRef)(at.dim).grain) {
19348
+ const filtered = new Set(question.where.map((w) => (0, import_data_table11.parseDimensionRef)(w.dim).key));
19325
19349
  for (const fact of dim(at.dim)?.level?.attributes ?? []) {
19326
19350
  if (!filtered.has(fact) && known(fact)) focus.push({ outer: null, fact, where });
19327
19351
  }
@@ -19329,7 +19353,7 @@ function drillLevelAsks(args) {
19329
19353
  const names = [];
19330
19354
  for (const ref of question.by) {
19331
19355
  const d = dim(ref);
19332
- if (!d?.labelFrom || (0, import_data_table13.parseDimensionRef)(ref).grain || !known(d.labelFrom)) continue;
19356
+ if (!d?.labelFrom || (0, import_data_table11.parseDimensionRef)(ref).grain || !known(d.labelFrom)) continue;
19333
19357
  const groups = groupsOf2(ref);
19334
19358
  if (groups.length > 0) names.push({ outer: d.key, fact: d.labelFrom, where: { ...where, [d.key]: groups } });
19335
19359
  }
@@ -19366,7 +19390,7 @@ function useDrillLevelReads(args) {
19366
19390
  const asks = drillLevelAsks({ question, dimensions, answers, where });
19367
19391
  const all = [...asks.attributes, ...asks.focus, ...asks.names];
19368
19392
  const key = JSON.stringify({ source, all, window: args.window ?? null, lane: args.lane ?? null });
19369
- const [state, setState] = (0, import_react111.useState)({ key: "", held: {}, failed: {} });
19393
+ const [state2, setState] = (0, import_react111.useState)({ key: "", held: {}, failed: {} });
19370
19394
  (0, import_react111.useEffect)(() => {
19371
19395
  if (!enabled || !source || all.length === 0) return;
19372
19396
  let cancelled = false;
@@ -19401,12 +19425,12 @@ function useDrillLevelReads(args) {
19401
19425
  cancelled = true;
19402
19426
  };
19403
19427
  }, [client, key, enabled]);
19404
- const ready = state.key === key;
19428
+ const ready = state2.key === key;
19405
19429
  const dim = (k) => dimensions.find((d) => d.key === k);
19406
19430
  const outer2 = question.by[0] ?? null;
19407
19431
  const attributes = asks.attributes.length === 0 || !outer2 ? void 0 : asks.attributes.map((ask2) => {
19408
19432
  const d = dim(ask2.fact);
19409
- const why = ready ? state.failed[askId(ask2)] : void 0;
19433
+ const why = ready ? state2.failed[askId(ask2)] : void 0;
19410
19434
  return {
19411
19435
  key: ask2.fact,
19412
19436
  label: d?.label ?? ask2.fact,
@@ -19415,17 +19439,17 @@ function useDrillLevelReads(args) {
19415
19439
  read: (groups) => {
19416
19440
  if (!ready) return void 0;
19417
19441
  const g = groups[outer2];
19418
- return g ? drillFactWords(state.held[askId(ask2)]?.[g], d) : null;
19442
+ return g ? drillFactWords(state2.held[askId(ask2)]?.[g], d) : null;
19419
19443
  }
19420
19444
  };
19421
19445
  });
19422
19446
  const focusAttributes = asks.focus.length === 0 ? void 0 : asks.focus.map((ask2) => {
19423
19447
  const d = dim(ask2.fact);
19424
- const why = ready ? state.failed[askId(ask2)] : void 0;
19448
+ const why = ready ? state2.failed[askId(ask2)] : void 0;
19425
19449
  return {
19426
19450
  key: ask2.fact,
19427
19451
  label: d?.label ?? ask2.fact,
19428
- value: ready ? drillFactWords(state.held[askId(ask2)]?.["\0"], d) : void 0,
19452
+ value: ready ? drillFactWords(state2.held[askId(ask2)]?.["\0"], d) : void 0,
19429
19453
  ...why ? { error: why } : {}
19430
19454
  };
19431
19455
  });
@@ -19434,7 +19458,7 @@ function useDrillLevelReads(args) {
19434
19458
  for (const ask2 of asks.names) {
19435
19459
  if (!ask2.outer) continue;
19436
19460
  const out = names.get(ask2.outer) ?? /* @__PURE__ */ new Map();
19437
- for (const [value, facts] of Object.entries(state.held[askId(ask2)] ?? {})) {
19461
+ for (const [value, facts] of Object.entries(state2.held[askId(ask2)] ?? {})) {
19438
19462
  const words2 = drillFactWords(facts, dim(ask2.fact));
19439
19463
  if (words2 && words2 !== "Several") out.set(value, words2);
19440
19464
  }
@@ -19488,7 +19512,7 @@ function definitionOf(raw) {
19488
19512
  function useDrillDefinition(source) {
19489
19513
  const client = (0, import_react114.useRecordsClient)();
19490
19514
  const key = source ? JSON.stringify(source) : null;
19491
- const [state, setState] = (0, import_react113.useState)({ key: null, def: null, error: null });
19515
+ const [state2, setState] = (0, import_react113.useState)({ key: null, def: null, error: null });
19492
19516
  (0, import_react113.useEffect)(() => {
19493
19517
  if (!key) return;
19494
19518
  let cancelled = false;
@@ -19508,12 +19532,12 @@ function useDrillDefinition(source) {
19508
19532
  cancelled = true;
19509
19533
  };
19510
19534
  }, [client, key]);
19511
- return state.key === key ? { def: state.def, error: state.error } : { def: null, error: null };
19535
+ return state2.key === key ? { def: state2.def, error: state2.error } : { def: null, error: null };
19512
19536
  }
19513
19537
  function drillWhere(base2, trail, booleans) {
19514
19538
  const where = { ...base2 ?? {} };
19515
19539
  for (const w of trail) {
19516
- const { key, grain } = (0, import_data_table14.parseDimensionRef)(w.dim);
19540
+ const { key, grain } = (0, import_data_table12.parseDimensionRef)(w.dim);
19517
19541
  if (grain) where[w.dim] = w.value;
19518
19542
  else if (booleans.has(key) && (w.value === "true" || w.value === "false")) where[key] = w.value === "true";
19519
19543
  else where[key] = w.value;
@@ -19568,7 +19592,7 @@ function useDrillAnswers(args) {
19568
19592
  (0, import_react113.useEffect)(() => {
19569
19593
  if (!enabled || !source || question.by.length === 0) return;
19570
19594
  const asked3 = JSON.parse(askKey2);
19571
- const range = asked3.window && asked3.windowKey ? (0, import_data_table14.drillWindowRange)(asked3.window) : null;
19595
+ const range = asked3.window && asked3.windowKey ? (0, import_data_table12.drillWindowRange)(asked3.window) : null;
19572
19596
  const compare = asked3.compare && range && asked3.windowKey ? {
19573
19597
  against: asked3.compare,
19574
19598
  from: range.from,
@@ -19578,12 +19602,12 @@ function useDrillAnswers(args) {
19578
19602
  let cancelled = false;
19579
19603
  setAnswers({});
19580
19604
  setError(null);
19581
- const requests = (0, import_data_table14.drillRequests)({ by: asked3.by, across: asked3.across, show: asked3.show, where: [] });
19605
+ const requests = (0, import_data_table12.drillRequests)({ by: asked3.by, across: asked3.across, show: asked3.show, where: [] });
19582
19606
  void Promise.all(
19583
19607
  requests.map(async (request) => {
19584
19608
  if (asked3.rule && asked3.source.kind === "table") {
19585
- const time = request.by.find((ref) => (0, import_data_table14.parseDimensionRef)(ref).grain !== null) ?? null;
19586
- const t = time ? (0, import_data_table14.parseDimensionRef)(time) : null;
19609
+ const time = request.by.find((ref) => (0, import_data_table12.parseDimensionRef)(ref).grain !== null) ?? null;
19610
+ const t = time ? (0, import_data_table12.parseDimensionRef)(time) : null;
19587
19611
  const measures = asked3.show.map(storeMeasure).filter((m) => m !== null);
19588
19612
  if (t?.grain === "hour") return { request, error: "This table's periods start at a day; it cannot be read by the hour." };
19589
19613
  const got2 = await client.recordAggregate({
@@ -19673,7 +19697,7 @@ function useDrillAnswers(args) {
19673
19697
  }
19674
19698
  function drillQuestionFor(question, def) {
19675
19699
  if (!def) return question;
19676
- const known = (ref) => def.dimensions.some((d) => d.key === (0, import_data_table14.parseDimensionRef)(ref).key);
19700
+ const known = (ref) => def.dimensions.some((d) => d.key === (0, import_data_table12.parseDimensionRef)(ref).key);
19677
19701
  const show = question.show.filter((key) => def.measures.some((m) => m.key === key));
19678
19702
  return {
19679
19703
  ...question,
@@ -19710,7 +19734,7 @@ function useDrill(args) {
19710
19734
  });
19711
19735
  const hostDims = args.dimensions;
19712
19736
  const plain2 = (0, import_react113.useMemo)(() => drillDimensionsOf(def, labels, hostDims), [def, labels, hostDims]);
19713
- const range = question.window && windowKey ? (0, import_data_table14.drillWindowRange)(question.window) : null;
19737
+ const range = question.window && windowKey ? (0, import_data_table12.drillWindowRange)(question.window) : null;
19714
19738
  const level = useDrillLevelReads({
19715
19739
  source: args.source,
19716
19740
  question,
@@ -19779,7 +19803,7 @@ function useAddressDrill(args) {
19779
19803
  () => ({ by: [], across: null, show: [], where: [], ...startWindow ? { window: startWindow } : {} }),
19780
19804
  [startWindow]
19781
19805
  );
19782
- const url = (0, import_data_table14.useDrillUrlState)({ fallback, prefix: prefix ?? "drill" });
19806
+ const url = (0, import_data_table12.useDrillUrlState)({ fallback, prefix: prefix ?? "drill" });
19783
19807
  const question = (0, import_react113.useMemo)(
19784
19808
  () => startWindow && !url.question.window ? { ...url.question, window: startWindow } : url.question,
19785
19809
  [url.question, startWindow]
@@ -19799,7 +19823,7 @@ function questionFromGrouping(grouping) {
19799
19823
  };
19800
19824
  }
19801
19825
  function groupingFromQuestion(question, held) {
19802
- const [first, ...rest] = question.by.map(import_data_table14.parseDimensionRef);
19826
+ const [first, ...rest] = question.by.map(import_data_table12.parseDimensionRef);
19803
19827
  if (!first) return void 0;
19804
19828
  const sameFirst = held?.field === first.key;
19805
19829
  return {
@@ -19814,9 +19838,9 @@ function groupingFromQuestion(question, held) {
19814
19838
  };
19815
19839
  }
19816
19840
  function trailClause(fields, w) {
19817
- const { key, grain } = (0, import_data_table14.parseDimensionRef)(w.dim);
19841
+ const { key, grain } = (0, import_data_table12.parseDimensionRef)(w.dim);
19818
19842
  const field2 = fields.find((f) => f.key === key);
19819
- if (grain && w.value !== null) return { key, value: (0, import_data_table14.bucketWindow)(w.value, grain), field: field2 };
19843
+ if (grain && w.value !== null) return { key, value: (0, import_data_table12.bucketWindow)(w.value, grain), field: field2 };
19820
19844
  if (field2 && String(editorKindFor(field2)) === "checkbox" && (w.value === "true" || w.value === "false")) {
19821
19845
  return { key, value: w.value === "true", field: field2 };
19822
19846
  }
@@ -19860,7 +19884,7 @@ function useGridDrillQuestion(args) {
19860
19884
  const { tableId, fields, presentation, filter } = args;
19861
19885
  const source = (0, import_react113.useMemo)(() => ({ kind: "table", id: tableId }), [tableId]);
19862
19886
  const saved = (0, import_react113.useMemo)(() => questionFromGrouping(presentation.grouping), [presentation.grouping]);
19863
- const url = (0, import_data_table14.useDrillUrlState)({ fallback: saved });
19887
+ const url = (0, import_data_table12.useDrillUrlState)({ fallback: saved });
19864
19888
  const requested = args.enabled && // Up to three levels are ROWS under nested headers on the merged grid (Airtable's group levels).
19865
19889
  (url.question.by.length > (args.plainGroupingIsRows ? 3 : 0) || url.question.across !== null || url.question.where.length > 0 || // `!= null`: a question read by a design-system that does not know the window or the comparison
19866
19890
  // yet has them UNDEFINED, and `undefined !== null` asked for drill metadata on every plain grid.
@@ -19871,15 +19895,15 @@ function useGridDrillQuestion(args) {
19871
19895
  const windowKey = drillWindowDimensionOf(def);
19872
19896
  const trailFilter = (0, import_react113.useMemo)(() => {
19873
19897
  if (!enabled) return filter;
19874
- const range = question.window && windowKey ? (0, import_data_table14.drillWindowRange)(question.window) : null;
19898
+ const range = question.window && windowKey ? (0, import_data_table12.drillWindowRange)(question.window) : null;
19875
19899
  const withWindow = range && windowKey ? filterWithWindow(fields, filter, windowKey, range) : filter;
19876
19900
  return filterWithTrail(fields, withWindow, question.where);
19877
19901
  }, [enabled, fields, filter, question.where, question.window, windowKey]);
19878
19902
  return { enabled, source, def, question, setQuestion: url.setQuestion, filter, trailFilter };
19879
19903
  }
19880
19904
  function useGridDrillConfig(args) {
19881
- const { state, presentation, onPresentationChange, version } = args;
19882
- const { setQuestion } = state;
19905
+ const { state: state2, presentation, onPresentationChange, version } = args;
19906
+ const { setQuestion } = state2;
19883
19907
  const onQuestionChange = (0, import_react113.useMemo)(
19884
19908
  () => (next) => {
19885
19909
  setQuestion(next);
@@ -19891,21 +19915,21 @@ function useGridDrillConfig(args) {
19891
19915
  },
19892
19916
  [setQuestion, onPresentationChange, presentation]
19893
19917
  );
19894
- const flat = state.filter && !(0, import_records39.isRuleFilter)(state.filter) ? state.filter : void 0;
19895
- const rule = state.filter && (0, import_records39.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
19918
+ const flat = state2.filter && !(0, import_records39.isRuleFilter)(state2.filter) ? state2.filter : void 0;
19919
+ const rule = state2.filter && (0, import_records39.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
19896
19920
  const { config } = useDrill({
19897
- source: state.source,
19898
- question: state.question,
19921
+ source: state2.source,
19922
+ question: state2.question,
19899
19923
  onQuestionChange,
19900
19924
  filter: flat,
19901
19925
  rule,
19902
19926
  version,
19903
- enabled: state.enabled
19927
+ enabled: state2.enabled
19904
19928
  });
19905
19929
  return config;
19906
19930
  }
19907
- function filterWithTrailRuleOnly(state) {
19908
- return state.trailFilter;
19931
+ function filterWithTrailRuleOnly(state2) {
19932
+ return state2.trailFilter;
19909
19933
  }
19910
19934
 
19911
19935
  // src/pointsCost.ts
@@ -19934,18 +19958,18 @@ function ago(at) {
19934
19958
  return at ? (0, import_format6.formatRelativeTime)(at, { style: "intl", fallback: "" }) : "";
19935
19959
  }
19936
19960
  function EnrichBadge({ cell: cell2, onPin, className }) {
19937
- const state = cellState(cell2);
19938
- if (!cell2 || state === "none") return null;
19961
+ const state2 = cellState(cell2);
19962
+ if (!cell2 || state2 === "none") return null;
19939
19963
  const source = cell2.source ?? {};
19940
19964
  const read = Array.isArray(source.read) ? source.read : [];
19941
19965
  const alternates = cell2.alternates ?? [];
19942
- const word = state === "yours" ? "yours" : state === "unsure" ? "unsure" : "agent";
19966
+ const word = state2 === "yours" ? "yours" : state2 === "unsure" ? "unsure" : "agent";
19943
19967
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_design_system60.HoverCard, { openDelay: 120, children: [
19944
19968
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system60.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: (0, import_design_system60.cn)("inline-flex items-center gap-1 align-middle", className), children: [
19945
19969
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
19946
19970
  import_design_system60.Badge,
19947
19971
  {
19948
- variant: state === "yours" ? "secondary" : "outline",
19972
+ variant: state2 === "yours" ? "secondary" : "outline",
19949
19973
  className: "text-[10px] font-normal leading-none",
19950
19974
  children: word
19951
19975
  }
@@ -19953,8 +19977,8 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
19953
19977
  cell2.stale ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system60.Badge, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
19954
19978
  ] }) }),
19955
19979
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_design_system60.HoverCardContent, { className: "w-80 space-y-2 text-xs", children: [
19956
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "font-medium", children: state === "yours" ? "You typed this one in" : state === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
19957
- state !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "text-muted-foreground", children: [
19980
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
19981
+ state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "text-muted-foreground", children: [
19958
19982
  "Acting for ",
19959
19983
  cell2.on_behalf_of,
19960
19984
  cell2.written_at ? `, ${ago(cell2.written_at)}` : "",
@@ -19975,7 +19999,7 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
19975
19999
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
19976
20000
  ] }) : null,
19977
20001
  alternates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { children: [
19978
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-muted-foreground", children: state === "unsure" ? "What it considered" : "What it nearly said instead" }),
20002
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
19979
20003
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("li", { children: String(a.value ?? "") }, i)) })
19980
20004
  ] }) : null,
19981
20005
  cell2.stale && cell2.due_at ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "text-muted-foreground", children: [
@@ -24418,7 +24442,7 @@ var import_react131 = require("react");
24418
24442
  var import_react132 = require("@ai-matrx/records/react");
24419
24443
  var import_core15 = require("@ai-matrx/records/core");
24420
24444
  var import_design_system69 = require("@ai-matrx/design-system");
24421
- var import_data_table15 = require("@ai-matrx/design-system/data-table");
24445
+ var import_data_table13 = require("@ai-matrx/design-system/data-table");
24422
24446
  var import_jsx_runtime82 = require("react/jsx-runtime");
24423
24447
  function changesFor(step2, direction, versions = /* @__PURE__ */ new Map()) {
24424
24448
  const byRow = /* @__PURE__ */ new Map();
@@ -24446,7 +24470,7 @@ function useGridUndo(args) {
24446
24470
  onVersionsRef.current = args.onVersions;
24447
24471
  const onVersions = (versions) => onVersionsRef.current?.(versions);
24448
24472
  const known = (0, import_react131.useRef)(/* @__PURE__ */ new Map());
24449
- const [held, setHeld] = (0, import_react131.useState)(() => ({ stack: (0, import_data_table15.createUndoStack)(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
24473
+ const [held, setHeld] = (0, import_react131.useState)(() => ({ stack: (0, import_data_table13.createUndoStack)(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
24450
24474
  const heldRef = (0, import_react131.useRef)(held);
24451
24475
  heldRef.current = held;
24452
24476
  const [busy, setBusy] = (0, import_react131.useState)(false);
@@ -24461,7 +24485,7 @@ function useGridUndo(args) {
24461
24485
  setHeld((was) => {
24462
24486
  const steps = new Map(was.steps);
24463
24487
  steps.set(id, step2);
24464
- const stack = (0, import_data_table15.pushUndo)(was.stack, { label: id, undo: [], redo: [] });
24488
+ const stack = (0, import_data_table13.pushUndo)(was.stack, { label: id, undo: [], redo: [] });
24465
24489
  const live = new Set([...stack.past, ...stack.future].map((e) => e.label));
24466
24490
  for (const key of [...steps.keys()]) if (!live.has(key)) steps.delete(key);
24467
24491
  return { stack, steps };
@@ -24471,7 +24495,7 @@ function useGridUndo(args) {
24471
24495
  const apply = (0, import_react131.useCallback)(
24472
24496
  async (direction) => {
24473
24497
  const was = heldRef.current;
24474
- const taken = direction === "undo" ? (0, import_data_table15.popUndo)(was.stack) : (0, import_data_table15.popRedo)(was.stack);
24498
+ const taken = direction === "undo" ? (0, import_data_table13.popUndo)(was.stack) : (0, import_data_table13.popRedo)(was.stack);
24475
24499
  if (!taken.entry) return;
24476
24500
  const step2 = was.steps.get(taken.entry.label);
24477
24501
  if (!step2) return;
@@ -25599,19 +25623,19 @@ function StructureLocked({ className }) {
25599
25623
  // src/viewAddress.ts
25600
25624
  var import_react142 = require("react");
25601
25625
  var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
25602
- function isViewAddressEmpty(state) {
25603
- if (!state) return true;
25604
- return !state.sort && Object.keys(state.filters ?? {}).length === 0 && !(state.search ?? "").trim() && (state.hidden?.length ?? 0) === 0 && !(state.page && state.page > 1);
25626
+ function isViewAddressEmpty(state2) {
25627
+ if (!state2) return true;
25628
+ return !state2.sort && Object.keys(state2.filters ?? {}).length === 0 && !(state2.search ?? "").trim() && (state2.hidden?.length ?? 0) === 0 && !(state2.page && state2.page > 1);
25605
25629
  }
25606
- function viewAddressToParams(state) {
25630
+ function viewAddressToParams(state2) {
25607
25631
  const out = {};
25608
- if (!state) return out;
25609
- if (state.sort) out["sort"] = `${state.sort.field}:${state.sort.direction}`;
25610
- const filters = Object.fromEntries(Object.entries(state.filters ?? {}).filter(([, v]) => v !== void 0 && v !== null));
25632
+ if (!state2) return out;
25633
+ if (state2.sort) out["sort"] = `${state2.sort.field}:${state2.sort.direction}`;
25634
+ const filters = Object.fromEntries(Object.entries(state2.filters ?? {}).filter(([, v]) => v !== void 0 && v !== null));
25611
25635
  if (Object.keys(filters).length > 0) out["cf"] = JSON.stringify(filters);
25612
- if ((state.search ?? "").trim()) out["q"] = (state.search ?? "").trim();
25613
- if (state.hidden && state.hidden.length > 0) out["hide"] = JSON.stringify(state.hidden);
25614
- if (state.page && state.page > 1) out["page"] = String(Math.floor(state.page));
25636
+ if ((state2.search ?? "").trim()) out["q"] = (state2.search ?? "").trim();
25637
+ if (state2.hidden && state2.hidden.length > 0) out["hide"] = JSON.stringify(state2.hidden);
25638
+ if (state2.page && state2.page > 1) out["page"] = String(Math.floor(state2.page));
25615
25639
  return out;
25616
25640
  }
25617
25641
  function viewAddressFromParams(get) {
@@ -25666,7 +25690,7 @@ var NO_REREAD = () => {
25666
25690
  };
25667
25691
  var VALUE_FILTER_UI = { allowNegation: true };
25668
25692
  function Grid(props) {
25669
- const inCard = (0, import_data_table16.useMatrxTableCard)() !== null;
25693
+ const inCard = (0, import_data_table14.useMatrxTableCard)() !== null;
25670
25694
  if (!inCard) return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(GridBody, { ...props });
25671
25695
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarSlotContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarFoldContext.Provider, { value: 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarSheetExtrasContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(GridBody, { ...props }) }) }) });
25672
25696
  }
@@ -25697,7 +25721,7 @@ function GridBody({
25697
25721
  hideRefusedRowActions = false
25698
25722
  }) {
25699
25723
  const toolbarSlot = useTableToolbarSlot();
25700
- const tableCard = (0, import_data_table16.useMatrxTableCard)();
25724
+ const tableCard = (0, import_data_table14.useMatrxTableCard)();
25701
25725
  const [cardExtraRows, setCardExtraRows] = (0, import_react143.useState)(0);
25702
25726
  const fills = footer === "sticky";
25703
25727
  const host = useRecordsUi();
@@ -26919,7 +26943,7 @@ function GridBody({
26919
26943
  [tableId, table.data, ordered, labelFor, merged]
26920
26944
  );
26921
26945
  const tableStyleProp = (0, import_react143.useMemo)(
26922
- () => (0, import_data_table16.tableStyleIsEmpty)(paint.style) ? null : {
26946
+ () => (0, import_data_table14.tableStyleIsEmpty)(paint.style) ? null : {
26923
26947
  style: paint.style,
26924
26948
  // A choice is read as its OPTION (`paintByOption`): the rule, the value and the
26925
26949
  // colour a column keeps for it all name the same option, however it is stored.
@@ -27709,7 +27733,7 @@ function GridBody({
27709
27733
  "data-records-grid-fit": look.fit,
27710
27734
  onPasteCapture: takeEmptyTablePaste,
27711
27735
  children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(EmbeddedLookProvider, { value: embedded ? EMBEDDED_LOOK : null, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
27712
- import_data_table16.MatrxDataTable,
27736
+ import_data_table14.MatrxDataTable,
27713
27737
  {
27714
27738
  ...fills ? { className: "min-h-0 flex-1" } : {},
27715
27739
  frameHeight: fills ? "fill" : "content",
@@ -27828,7 +27852,7 @@ function GridBody({
27828
27852
  // More exists when the store's total says so, or when it answered a FULL page (it
27829
27853
  // names a total only once a page comes back short).
27830
27854
  (typeof records.data?.total === "number" ? records.data.total > rows.length : rows.length >= pageSize + cardExtraRows) ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
27831
- import_data_table16.MatrxTableCardShowMore,
27855
+ import_data_table14.MatrxTableCardShowMore,
27832
27856
  {
27833
27857
  shown: rows.length,
27834
27858
  total: typeof records.data?.total === "number" ? records.data.total : void 0,
@@ -27837,7 +27861,7 @@ function GridBody({
27837
27861
  }
27838
27862
  ) : null
27839
27863
  ) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
27840
- import_data_table16.MatrxTableCardShowMore,
27864
+ import_data_table14.MatrxTableCardShowMore,
27841
27865
  {
27842
27866
  shown: pageRows.length,
27843
27867
  total: records.data.total,
@@ -28010,13 +28034,13 @@ function sortIgnoredOf(answer) {
28010
28034
  }
28011
28035
 
28012
28036
  // src/RecordsTableCard.tsx
28013
- var import_data_table18 = require("@ai-matrx/design-system/data-table");
28037
+ var import_data_table16 = require("@ai-matrx/design-system/data-table");
28014
28038
  var import_design_system73 = require("@ai-matrx/design-system");
28015
28039
  var import_react148 = require("@ai-matrx/records/react");
28016
28040
 
28017
28041
  // src/entityTable.tsx
28018
28042
  var import_react145 = require("react");
28019
- var import_data_table17 = require("@ai-matrx/design-system/data-table");
28043
+ var import_data_table15 = require("@ai-matrx/design-system/data-table");
28020
28044
  var import_react146 = require("@ai-matrx/records/react");
28021
28045
  var import_react147 = require("@ai-matrx/records/entity/react");
28022
28046
 
@@ -28138,7 +28162,7 @@ function EntityGrid({
28138
28162
  const columns = (0, import_react145.useMemo)(() => entityTableColumns(entity.columns, canEdit), [entity.columns, canEdit]);
28139
28163
  const byId = (0, import_react145.useMemo)(() => new Map(entity.columns.map((c) => [columnId(c), c])), [entity.columns]);
28140
28164
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
28141
- import_data_table17.MatrxDataTable,
28165
+ import_data_table15.MatrxDataTable,
28142
28166
  {
28143
28167
  data: entity.rows,
28144
28168
  columns,
@@ -28173,7 +28197,7 @@ var import_jsx_runtime89 = require("react/jsx-runtime");
28173
28197
  function RecordsTableCard(props) {
28174
28198
  const client = (0, import_react148.useOptionalRecordsClient)();
28175
28199
  if (!client) {
28176
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table18.MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table18.MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
28200
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
28177
28201
  }
28178
28202
  if (props.source.kind === "entity") return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(EntityTableCard, { ...props, source: props.source });
28179
28203
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ConnectedRecordsTableCard, { ...props, source: props.source });
@@ -28193,11 +28217,11 @@ function EntityTableCardBody({
28193
28217
  editable,
28194
28218
  className
28195
28219
  }) {
28196
- const batch = initialRows ?? import_data_table18.TABLE_CARD_DEFAULT_INITIAL_ROWS;
28220
+ const batch = initialRows ?? import_data_table16.TABLE_CARD_DEFAULT_INITIAL_ROWS;
28197
28221
  const entity = useEntityTable(source.token, { pageSize: batch });
28198
28222
  const label = entity.label ?? (entity.loading ? "Loading\u2026" : "Table");
28199
28223
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
28200
- import_data_table18.MatrxTableCard,
28224
+ import_data_table16.MatrxTableCard,
28201
28225
  {
28202
28226
  title: label,
28203
28227
  fields: entity.columns.length,
@@ -28210,10 +28234,10 @@ function EntityTableCardBody({
28210
28234
  ...entity.newer > 0 ? { headerActions: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_design_system73.Button, { size: "sm", variant: "ghost", onClick: entity.refresh, children: `${entity.newer.toLocaleString()} new` }) } : {},
28211
28235
  ...initialRows ? { initialRows } : {},
28212
28236
  ...className ? { className } : {},
28213
- children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table18.MatrxTableCardEmpty, { message: `This table could not be read: ${entity.error}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
28237
+ children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: `This table could not be read: ${entity.error}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
28214
28238
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(EntityGrid, { entity, pageSize: batch, ...editable === void 0 ? {} : { editable } }),
28215
28239
  entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
28216
- import_data_table18.MatrxTableCardShowMore,
28240
+ import_data_table16.MatrxTableCardShowMore,
28217
28241
  {
28218
28242
  shown: entity.rows.length,
28219
28243
  total: entity.total ?? entity.rows.length + 1,
@@ -28244,7 +28268,7 @@ function ConnectedRecordsTableCard({
28244
28268
  const plural4 = t?.label_plural ?? t?.name ?? "Records";
28245
28269
  const singular = t?.label_singular ?? t?.name ?? "Record";
28246
28270
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
28247
- import_data_table18.MatrxTableCard,
28271
+ import_data_table16.MatrxTableCard,
28248
28272
  {
28249
28273
  title: t ? plural4 : table.loading ? "Loading\u2026" : "Table",
28250
28274
  records: { singular: singular.toLowerCase(), plural: plural4.toLowerCase() },
@@ -28257,11 +28281,11 @@ function ConnectedRecordsTableCard({
28257
28281
  ...edit ? { edit } : {},
28258
28282
  ...initialRows ? { initialRows } : {},
28259
28283
  ...className ? { className } : {},
28260
- children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table18.MatrxTableCardEmpty, { message: `This table could not be read: ${refusalSentence(table.error)}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
28284
+ children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: `This table could not be read: ${refusalSentence(table.error)}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
28261
28285
  Grid,
28262
28286
  {
28263
28287
  tableId: source.id,
28264
- pageSize: initialRows ?? import_data_table18.TABLE_CARD_DEFAULT_INITIAL_ROWS,
28288
+ pageSize: initialRows ?? import_data_table16.TABLE_CARD_DEFAULT_INITIAL_ROWS,
28265
28289
  ...onOpenRecord ? { onOpenRecord } : {},
28266
28290
  ...editable === void 0 ? {} : { editable }
28267
28291
  }
@@ -29446,7 +29470,7 @@ function TimeZoneInput({
29446
29470
  "aria-label": label
29447
29471
  }
29448
29472
  ),
29449
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("datalist", { id: listId, children: TIME_ZONES.map((zone2) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("option", { value: zone2 }, zone2)) })
29473
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("datalist", { id: listId, children: TIME_ZONES.map((zone) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("option", { value: zone }, zone)) })
29450
29474
  ] });
29451
29475
  }
29452
29476
 
@@ -33332,7 +33356,7 @@ async function declare(client, spec) {
33332
33356
  }
33333
33357
  function usePlatformTable(spec) {
33334
33358
  const client = (0, import_react198.useRecordsClient)();
33335
- const [state, setState] = (0, import_react197.useState)({ tableId: null, loading: true, error: null });
33359
+ const [state2, setState] = (0, import_react197.useState)({ tableId: null, loading: true, error: null });
33336
33360
  const slug = spec.slug;
33337
33361
  const stable = (0, import_react197.useMemo)(() => spec, [slug]);
33338
33362
  (0, import_react197.useEffect)(() => {
@@ -33348,7 +33372,7 @@ function usePlatformTable(spec) {
33348
33372
  cancelled = true;
33349
33373
  };
33350
33374
  }, [client, stable]);
33351
- return state;
33375
+ return state2;
33352
33376
  }
33353
33377
 
33354
33378
  // src/viewLook.ts
@@ -33386,7 +33410,7 @@ var import_react224 = require("react");
33386
33410
  var import_react225 = require("@ai-matrx/records/react");
33387
33411
  var import_records61 = require("@ai-matrx/records");
33388
33412
  var import_design_system109 = require("@ai-matrx/design-system");
33389
- var import_data_table24 = require("@ai-matrx/design-system/data-table");
33413
+ var import_data_table22 = require("@ai-matrx/design-system/data-table");
33390
33414
  var import_format10 = require("@ai-matrx/kit/format");
33391
33415
 
33392
33416
  // src/recordMoves.tsx
@@ -33587,7 +33611,7 @@ var import_react201 = require("react");
33587
33611
  var import_react202 = require("@ai-matrx/records/react");
33588
33612
  var import_records58 = require("@ai-matrx/records");
33589
33613
  var import_design_system100 = require("@ai-matrx/design-system");
33590
- var import_data_table19 = require("@ai-matrx/design-system/data-table");
33614
+ var import_data_table17 = require("@ai-matrx/design-system/data-table");
33591
33615
 
33592
33616
  // src/CardDates.tsx
33593
33617
  var import_jsx_runtime116 = require("react/jsx-runtime");
@@ -33822,7 +33846,7 @@ function PipelineBoard({
33822
33846
  const ordered = (definition?.stages ?? []).flatMap((stage) => cardsByStage.get(stage.key) ?? []);
33823
33847
  const selectedInOrder = ordered.filter((r) => selected.has(r.id));
33824
33848
  const select = (index, how) => {
33825
- const { next, anchor: at } = (0, import_data_table19.toggleSelection)({
33849
+ const { next, anchor: at } = (0, import_data_table17.toggleSelection)({
33826
33850
  order: ordered,
33827
33851
  idOf: (r) => r.id,
33828
33852
  selected,
@@ -34199,7 +34223,7 @@ function PipelineCard({
34199
34223
  dates
34200
34224
  }) {
34201
34225
  const labels = useRecordLabels(field2 ? [field2] : []);
34202
- const color = style ? (0, import_data_table19.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
34226
+ const color = style ? (0, import_data_table17.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
34203
34227
  const draggable = (0, import_react202.mayDrag)(record.level);
34204
34228
  const { text: label, withheld } = cardWords(record, field2, labels);
34205
34229
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
@@ -34217,7 +34241,7 @@ function PipelineCard({
34217
34241
  draggable ? "cursor-grab active:cursor-grabbing" : "",
34218
34242
  dragging ? "opacity-50" : "",
34219
34243
  // A selected card shows the selection, not its tint — the two never fight for one background.
34220
- selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ? import_data_table19.ROW_TINT_CLASS[color] : ""
34244
+ selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ? import_data_table17.ROW_TINT_CLASS[color] : ""
34221
34245
  ),
34222
34246
  onClick: (e) => {
34223
34247
  if (draggable && (e.shiftKey || e.metaKey || e.ctrlKey)) {
@@ -34375,7 +34399,7 @@ function CardFieldsInline({ row, fields }) {
34375
34399
  var import_react206 = require("react");
34376
34400
  var import_react207 = require("@ai-matrx/records/react");
34377
34401
  var import_design_system101 = require("@ai-matrx/design-system");
34378
- var import_data_table21 = require("@ai-matrx/design-system/data-table");
34402
+ var import_data_table19 = require("@ai-matrx/design-system/data-table");
34379
34403
 
34380
34404
  // src/weekStart.ts
34381
34405
  var import_react203 = require("react");
@@ -34413,7 +34437,7 @@ function useReaderWeekStart() {
34413
34437
 
34414
34438
  // src/rowColorBy.tsx
34415
34439
  var import_react205 = require("react");
34416
- var import_data_table20 = require("@ai-matrx/design-system/data-table");
34440
+ var import_data_table18 = require("@ai-matrx/design-system/data-table");
34417
34441
  function useRowColorBy(all, colorKey, style) {
34418
34442
  const colorField = all.find((f) => f.key === colorKey);
34419
34443
  const options = useChoiceOptions(all, colorField && isChoiceField(colorField) ? [colorField.key] : []);
@@ -34423,11 +34447,11 @@ function useRowColorBy(all, colorKey, style) {
34423
34447
  return optionFor(options.get(key), first)?.color ?? (colorField ? storedChoiceColor(colorField, first) : void 0) ?? colorFromTheValue(key, first);
34424
34448
  };
34425
34449
  const effective = {
34426
- ...import_data_table20.EMPTY_TABLE_STYLE,
34450
+ ...import_data_table18.EMPTY_TABLE_STYLE,
34427
34451
  ...style ?? {},
34428
34452
  ...colorKey ? { colorBy: { field: colorKey, target: "row" } } : { colorBy: null }
34429
34453
  };
34430
- return (row) => (0, import_data_table20.resolveRowColor)(effective, { id: row.id, data: row.document ?? {} }, lookup);
34454
+ return (row) => (0, import_data_table18.resolveRowColor)(effective, { id: row.id, data: row.document ?? {} }, lookup);
34431
34455
  }, [options, colorField, colorKey, style]);
34432
34456
  }
34433
34457
 
@@ -35020,7 +35044,7 @@ function CalendarView({
35020
35044
  className: (0, import_design_system101.cn)(
35021
35045
  "flex w-full min-w-0 items-center gap-1 truncate rounded border px-1.5 py-0.5 text-left text-xs hover:brightness-95",
35022
35046
  // The chip palette, not the faint row tint: a calendar is read by its colours at a glance.
35023
- color ? import_data_table21.CHOICE_CHIP_CLASS[color] : "bg-background",
35047
+ color ? import_data_table19.CHOICE_CHIP_CLASS[color] : "bg-background",
35024
35048
  may ? "cursor-grab active:cursor-grabbing" : "cursor-default",
35025
35049
  className2
35026
35050
  ),
@@ -35437,7 +35461,7 @@ function weekHeading(first) {
35437
35461
  var import_react208 = require("react");
35438
35462
  var import_react209 = require("@ai-matrx/records/react");
35439
35463
  var import_design_system102 = require("@ai-matrx/design-system");
35440
- var import_data_table22 = require("@ai-matrx/design-system/data-table");
35464
+ var import_data_table20 = require("@ai-matrx/design-system/data-table");
35441
35465
  var import_react210 = require("@ai-matrx/records/react");
35442
35466
 
35443
35467
  // src/timelineGantt.ts
@@ -36216,7 +36240,7 @@ function TimelineView({
36216
36240
  className: (0, import_design_system102.cn)(
36217
36241
  "absolute flex select-none items-center gap-1 rounded border px-1.5 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",
36218
36242
  outside ? "overflow-visible" : "overflow-hidden",
36219
- milestone ? "border-transparent bg-transparent" : color ? import_data_table22.CHOICE_CHIP_CLASS[color] : "bg-muted",
36243
+ milestone ? "border-transparent bg-transparent" : color ? import_data_table20.CHOICE_CHIP_CLASS[color] : "bg-muted",
36220
36244
  onCritical ? "ring-2 ring-amber-500" : void 0,
36221
36245
  linkTarget === p.row.id ? "ring-2 ring-primary" : void 0,
36222
36246
  may ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
@@ -36446,7 +36470,7 @@ function TimelineView({
36446
36470
  type: "button",
36447
36471
  className: (0, import_design_system102.cn)(
36448
36472
  "flex w-full min-w-0 items-center gap-1 truncate rounded border px-1.5 py-0.5 text-left text-xs hover:brightness-95",
36449
- color ? import_data_table22.CHOICE_CHIP_CLASS[color] : "bg-background",
36473
+ color ? import_data_table20.CHOICE_CHIP_CLASS[color] : "bg-background",
36450
36474
  may ? "cursor-grab" : "cursor-default"
36451
36475
  ),
36452
36476
  title: may ? `${titleOf(row)} \xB7 drag onto a day` : (0, import_react209.mayDrag)(row.level) ? WORKED_OUT_DATE_LOCK : whatYouMayDo(row.level ?? null).why("write"),
@@ -36526,7 +36550,7 @@ function TimelineView({
36526
36550
  /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
36527
36551
  "span",
36528
36552
  {
36529
- className: (0, import_design_system102.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ? import_data_table22.CHOICE_CHIP_CLASS[lane.color] : void 0),
36553
+ className: (0, import_design_system102.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ? import_data_table20.CHOICE_CHIP_CLASS[lane.color] : void 0),
36530
36554
  title: laneLocked ?? lane.label,
36531
36555
  ...laneLocked ? { "data-timeline-lane-locked": "" } : {},
36532
36556
  children: lane.label
@@ -36938,7 +36962,7 @@ function BoardOptions({
36938
36962
  // src/ListView.tsx
36939
36963
  var import_react215 = require("react");
36940
36964
  var import_design_system105 = require("@ai-matrx/design-system");
36941
- var import_data_table23 = require("@ai-matrx/design-system/data-table");
36965
+ var import_data_table21 = require("@ai-matrx/design-system/data-table");
36942
36966
  var import_jsx_runtime124 = require("react/jsx-runtime");
36943
36967
  var LIST_DEFAULT_FIELDS = 4;
36944
36968
  var NO_GROUP = "__none";
@@ -37080,7 +37104,7 @@ function ListRow({
37080
37104
  const doc = row.document ?? {};
37081
37105
  const filled = fields.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
37082
37106
  const onRow = chose ? filled : filled.slice(0, LIST_DEFAULT_FIELDS);
37083
- const color = style ? (0, import_data_table23.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
37107
+ const color = style ? (0, import_data_table21.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
37084
37108
  const values = onRow.map((field2) => (
37085
37109
  // ONE LINE PER VALUE (walk 2026-10-05): a multi-line caption drew as paragraphs, pushing the
37086
37110
  // title to the row's foot. A list row is one line, as Notion's is; the record page has the rest.
@@ -37104,7 +37128,7 @@ function ListRow({
37104
37128
  "data-records-list-row": row.id,
37105
37129
  className: (0, import_design_system105.cn)(
37106
37130
  "flex w-full min-w-0 items-center gap-3 rounded px-1 py-1 pr-7 text-left text-xs hover:bg-muted",
37107
- color ? import_data_table23.ROW_TINT_CLASS[color] : void 0
37131
+ color ? import_data_table21.ROW_TINT_CLASS[color] : void 0
37108
37132
  ),
37109
37133
  onClick: () => onOpenRecord?.(row.id),
37110
37134
  title: withheld ?? title,
@@ -38066,7 +38090,7 @@ function chartQuestion(view, fields) {
38066
38090
  function ChartLayout({ view, fields, filter, onChange, remembered }) {
38067
38091
  const client = (0, import_react223.useRecordsClient)();
38068
38092
  const q = (0, import_react222.useMemo)(() => chartQuestion(view, fields), [view, fields]);
38069
- const [state, setState] = (0, import_react222.useState)({ block: null, error: null });
38093
+ const [state2, setState] = (0, import_react222.useState)({ block: null, error: null });
38070
38094
  const filterKey = JSON.stringify(filter ?? {});
38071
38095
  const qKey = JSON.stringify(q);
38072
38096
  (0, import_react222.useEffect)(() => {
@@ -38134,7 +38158,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
38134
38158
  MEASURE_LABEL2[isChartMeasure(view.chartMeasure) ? view.chartMeasure : "count"],
38135
38159
  " needs a number field \u2014 pick one above. Counting until then."
38136
38160
  ] }) : null,
38137
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(RefusalNotice, { error: state.error }) : state.block ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ChartBlock, { block: state.block, subject: view.subject, variant: "bare", centerValue: true }) : null
38161
+ state2.error ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(RefusalNotice, { error: state2.error }) : state2.block ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ChartBlock, { block: state2.block, subject: view.subject, variant: "bare", centerValue: true }) : null
38138
38162
  ] });
38139
38163
  }
38140
38164
 
@@ -38667,7 +38691,7 @@ function Board({
38667
38691
  onColorFieldChange: (key) => onChange({
38668
38692
  presentation: {
38669
38693
  ...view.presentation,
38670
- style: { ...import_data_table24.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: key ? { field: key, target: "row" } : null }
38694
+ style: { ...import_data_table22.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: key ? { field: key, target: "row" } : null }
38671
38695
  }
38672
38696
  }),
38673
38697
  titleField,
@@ -38718,7 +38742,7 @@ function Board({
38718
38742
  onChange({
38719
38743
  presentation: {
38720
38744
  ...view.presentation,
38721
- style: { ...import_data_table24.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: patch.colorKey ? { field: patch.colorKey, target: "row" } : null }
38745
+ style: { ...import_data_table22.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: patch.colorKey ? { field: patch.colorKey, target: "row" } : null }
38722
38746
  }
38723
38747
  });
38724
38748
  }
@@ -38978,7 +39002,7 @@ function Kanban({
38978
39002
  const heading = (name) => /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
38979
39003
  "header",
38980
39004
  {
38981
- className: (0, import_design_system109.cn)("flex h-7 items-center gap-2 border-b px-2 text-xs font-medium", columnColor(name) ? import_data_table24.CHOICE_CHIP_CLASS[columnColor(name)] : void 0),
39005
+ className: (0, import_design_system109.cn)("flex h-7 items-center gap-2 border-b px-2 text-xs font-medium", columnColor(name) ? import_data_table22.CHOICE_CHIP_CLASS[columnColor(name)] : void 0),
38982
39006
  "data-board-heading": name,
38983
39007
  ...columnColor(name) ? { "data-column-color": columnColor(name) } : {},
38984
39008
  children: [
@@ -39045,7 +39069,7 @@ function Kanban({
39045
39069
  void move(card, { column: name, lane: laneName }, { column: to, lane: laneName });
39046
39070
  },
39047
39071
  children: [
39048
- accent ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { "aria-hidden": "true", "data-card-accent": accent, className: (0, import_design_system109.cn)("absolute inset-y-0.5 left-0 w-1 rounded", import_data_table24.SWATCH_CLASS[accent]) }) : null,
39072
+ accent ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { "aria-hidden": "true", "data-card-accent": accent, className: (0, import_design_system109.cn)("absolute inset-y-0.5 left-0 w-1 rounded", import_data_table22.SWATCH_CLASS[accent]) }) : null,
39049
39073
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(RecordActionMenu, { tableId, row: card, name: cardWords(card, titleField).text, onOpenRecord, onChanged, children: previewField ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-1", children: [
39050
39074
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: (0, import_design_system109.cn)("block w-full shrink-0 overflow-hidden rounded bg-muted/50", size.cover), "data-board-preview": previewField.key, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GalleryCover, { field: previewField, value: cover }) }),
39051
39075
  recordCard
@@ -39177,7 +39201,7 @@ function Gallery({
39177
39201
  const doc = row.document ?? {};
39178
39202
  const filled = shown5.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
39179
39203
  const onCard = chose ? filled : filled.slice(0, GALLERY_DEFAULT_FIELDS);
39180
- const rowColor = style ? (0, import_data_table24.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
39204
+ const rowColor = style ? (0, import_data_table22.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
39181
39205
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("li", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
39182
39206
  MaybeRecordActionMenu,
39183
39207
  {
@@ -39192,7 +39216,7 @@ function Gallery({
39192
39216
  type: "button",
39193
39217
  className: (0, import_design_system109.cn)(
39194
39218
  "flex h-full w-full flex-col gap-1 rounded border p-2 pr-7 text-left hover:bg-muted",
39195
- rowColor ? import_data_table24.ROW_TINT_CLASS[rowColor] : void 0
39219
+ rowColor ? import_data_table22.ROW_TINT_CLASS[rowColor] : void 0
39196
39220
  ),
39197
39221
  onClick: () => onOpenRecord?.(row.id),
39198
39222
  children: [
@@ -39267,7 +39291,7 @@ function RecordCard({
39267
39291
  const parentId = parentField ? parentIdOf(record.document, parentField.key) : null;
39268
39292
  const parentName = parentField && parentId ? scalarText(parentField, parentId, labels) : null;
39269
39293
  const open = () => onOpenRecord?.(record.id);
39270
- const color = style ? (0, import_data_table24.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
39294
+ const color = style ? (0, import_data_table22.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
39271
39295
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
39272
39296
  "div",
39273
39297
  {
@@ -39277,7 +39301,7 @@ function RecordCard({
39277
39301
  className: (0, import_design_system109.cn)(
39278
39302
  "w-full cursor-pointer truncate rounded border bg-background px-2 py-1 text-left text-xs hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
39279
39303
  host.density === "spacious" ? "py-2" : "",
39280
- color ? import_data_table24.ROW_TINT_CLASS[color] : void 0
39304
+ color ? import_data_table22.ROW_TINT_CLASS[color] : void 0
39281
39305
  ),
39282
39306
  onClick: open,
39283
39307
  onKeyDown: (e) => {
@@ -39768,7 +39792,7 @@ function SectionBox({ id, children, ...rest }) {
39768
39792
  return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { ref: setNodeRef, className: (0, import_design_system112.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
39769
39793
  }
39770
39794
  function SortableRow({ id, disabled, children }) {
39771
- const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = (0, import_sortable.useSortable)({ id, disabled });
39795
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, import_sortable.useSortable)({ id, disabled });
39772
39796
  return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
39773
39797
  "div",
39774
39798
  {
@@ -39777,7 +39801,7 @@ function SortableRow({ id, disabled, children }) {
39777
39801
  className: (0, import_design_system112.cn)(isDragging && "relative z-10 opacity-80"),
39778
39802
  "data-view-row": id,
39779
39803
  ...disabled ? {} : attributes,
39780
- ...disabled ? {} : listeners2,
39804
+ ...disabled ? {} : listeners,
39781
39805
  children
39782
39806
  }
39783
39807
  );
@@ -40362,7 +40386,7 @@ function ProposalRow({
40362
40386
  var import_react238 = require("react");
40363
40387
  var import_react239 = require("@ai-matrx/records/react");
40364
40388
  var import_design_system115 = require("@ai-matrx/design-system");
40365
- var import_data_table25 = require("@ai-matrx/design-system/data-table");
40389
+ var import_data_table23 = require("@ai-matrx/design-system/data-table");
40366
40390
  var import_format11 = require("@ai-matrx/kit/format");
40367
40391
 
40368
40392
  // src/ChecklistRunner.tsx
@@ -41430,7 +41454,7 @@ function ActionInbox({
41430
41454
  );
41431
41455
  const select = (0, import_react238.useCallback)(
41432
41456
  (index, shift) => {
41433
- const { next, anchor: at } = (0, import_data_table25.toggleSelection)({
41457
+ const { next, anchor: at } = (0, import_data_table23.toggleSelection)({
41434
41458
  order: shown5,
41435
41459
  idOf: (i) => i.item_id,
41436
41460
  selected,
@@ -42029,8 +42053,8 @@ function planUndo(changes, current, only) {
42029
42053
  const doc = current ?? {};
42030
42054
  return changes.filter((change) => !only || change.key === only).map((change) => {
42031
42055
  const now = doc[change.key];
42032
- const state = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
42033
- return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state };
42056
+ const state2 = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
42057
+ return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state: state2 };
42034
42058
  });
42035
42059
  }
42036
42060
  function undoPatch(lines, replaceLaterEdits) {
@@ -42056,11 +42080,11 @@ var import_design_system116 = require("@ai-matrx/design-system");
42056
42080
  var import_controls3 = require("@ai-matrx/design-system/controls");
42057
42081
  var import_text_case16 = require("@ai-matrx/kit/text-case");
42058
42082
  var import_jsx_runtime135 = require("react/jsx-runtime");
42059
- function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
42083
+ function endOfDayIso(day2, zone = getPersonTimeZone()) {
42060
42084
  const [y, m, d] = day2.split("-").map(Number);
42061
- if (!zone2) return new Date(y, m - 1, d, 23, 59, 59, 999).toISOString();
42085
+ if (!zone) return new Date(y, m - 1, d, 23, 59, 59, 999).toISOString();
42062
42086
  const wall = (at) => {
42063
- const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone2, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(new Date(at));
42087
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(new Date(at));
42064
42088
  const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
42065
42089
  return Date.UTC(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
42066
42090
  };
@@ -42069,8 +42093,8 @@ function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
42069
42093
  for (let i = 0; i < 2; i += 1) guess -= wall(guess) - target;
42070
42094
  return new Date(guess + 999).toISOString();
42071
42095
  }
42072
- function asOfArgs(record_id, asOf, zone2 = getPersonTimeZone()) {
42073
- return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone2) } : { record_id, world_on: asOf.day };
42096
+ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
42097
+ return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
42074
42098
  }
42075
42099
  function AsOfControl({ value, onChange, className }) {
42076
42100
  const [text, setText] = (0, import_react240.useState)(value ? (0, import_records64.typedDateText)(value.day) : "");
@@ -42173,12 +42197,12 @@ function AsOfReading({
42173
42197
  className
42174
42198
  }) {
42175
42199
  const client = (0, import_react241.useRecordsClient)();
42176
- const zone2 = usePersonTimeZone();
42200
+ const zone = usePersonTimeZone();
42177
42201
  const [answer, setAnswer] = (0, import_react240.useState)(null);
42178
- const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone2 ?? ""}`;
42202
+ const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone ?? ""}`;
42179
42203
  (0, import_react240.useEffect)(() => {
42180
42204
  let live = true;
42181
- void client.recordAsOf(asOfArgs(recordId, asOf, zone2)).then((got) => {
42205
+ void client.recordAsOf(asOfArgs(recordId, asOf, zone)).then((got) => {
42182
42206
  if (!live) return;
42183
42207
  setAnswer(got.ok ? { key, doc: got.data } : { key, error: got.error });
42184
42208
  });
@@ -44462,7 +44486,7 @@ function People({
44462
44486
  said2 ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "text-xs text-muted-foreground", children: said2 }) : null,
44463
44487
  card.principals.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "text-xs text-muted-foreground", children: "Nobody yet. Inviting somebody below emails them a sign-in link; it gives them nothing until they follow it." }) : null,
44464
44488
  card.principals.map((person) => {
44465
- const state = stateWords(person);
44489
+ const state2 = stateWords(person);
44466
44490
  const asking = askingToRevoke?.principal_id === person.principal_id;
44467
44491
  const showing = previewing?.principal_id === person.principal_id;
44468
44492
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
@@ -44472,10 +44496,10 @@ function People({
44472
44496
  children: [
44473
44497
  /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
44474
44498
  /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium", children: person.client || person.email }),
44475
- /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_design_system125.Badge, { variant: state.tone, children: state.label })
44499
+ /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_design_system125.Badge, { variant: state2.tone, children: state2.label })
44476
44500
  ] }),
44477
44501
  /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 break-all text-muted-foreground", children: person.email }),
44478
- /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 text-muted-foreground", children: state.why }),
44502
+ /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 text-muted-foreground", children: state2.why }),
44479
44503
  person.is_active ? /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: [
44480
44504
  person.accept_path ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(CopyLink, { url: `${here}${person.accept_path}`, what: "their link" }) : null,
44481
44505
  /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
@@ -44676,7 +44700,7 @@ function Invite({ card, onInvited }) {
44676
44700
 
44677
44701
  // src/FormLookFrame.tsx
44678
44702
  var import_design_system126 = require("@ai-matrx/design-system");
44679
- var import_data_table26 = require("@ai-matrx/design-system/data-table");
44703
+ var import_data_table24 = require("@ai-matrx/design-system/data-table");
44680
44704
  var import_jsx_runtime145 = require("react/jsx-runtime");
44681
44705
  var ACCENT_PRIMARY = {
44682
44706
  slate: "215 19% 35%",
@@ -44695,15 +44719,15 @@ function safeHref(url) {
44695
44719
  return null;
44696
44720
  }
44697
44721
  function formLookView(style, fallbackName) {
44698
- const accent = style?.accent && style.accent in import_data_table26.SWATCH_CLASS ? style.accent : null;
44722
+ const accent = style?.accent && style.accent in import_data_table24.SWATCH_CLASS ? style.accent : null;
44699
44723
  const https = (u) => typeof u === "string" && /^https:\/\//i.test(u) ? u : null;
44700
44724
  const links = Array.isArray(style?.footer_links) ? style.footer_links : [];
44701
44725
  return {
44702
44726
  name: (style?.display_name ?? "").trim() || fallbackName.trim() || "Form",
44703
44727
  logoUrl: https(style?.logo_url),
44704
44728
  coverUrl: https(style?.cover_url),
44705
- bandClass: accent ? import_data_table26.SWATCH_CLASS[accent] : null,
44706
- monogramClass: accent ? `${import_data_table26.SWATCH_CLASS[accent]} text-white` : "bg-primary text-primary-foreground",
44729
+ bandClass: accent ? import_data_table24.SWATCH_CLASS[accent] : null,
44730
+ monogramClass: accent ? `${import_data_table24.SWATCH_CLASS[accent]} text-white` : "bg-primary text-primary-foreground",
44707
44731
  primaryVars: accent && ACCENT_PRIMARY[accent] ? {
44708
44732
  "--primary": ACCENT_PRIMARY[accent],
44709
44733
  "--primary-foreground": "0 0% 100%",
@@ -44804,8 +44828,8 @@ function scheduleWords(schedule, tz) {
44804
44828
  if (words2.length === 0) return null;
44805
44829
  const time = words2.find((w) => /^\d{1,2}:\d{2}$/.test(w)) ?? null;
44806
44830
  const day2 = words2.map((w) => DAYS3[w.slice(0, 3)]).find(Boolean) ?? null;
44807
- const zone2 = tz?.trim() ? `${tz.trim()} time` : "UTC";
44808
- const at = time ? `at ${time.padStart(5, "0")}, ${zone2}` : null;
44831
+ const zone = tz?.trim() ? `${tz.trim()} time` : "UTC";
44832
+ const at = time ? `at ${time.padStart(5, "0")}, ${zone}` : null;
44809
44833
  return [day2, at].filter(Boolean).join(" ") || null;
44810
44834
  }
44811
44835
 
@@ -47143,7 +47167,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47143
47167
  }
47144
47168
  function PublishRow({
47145
47169
  url,
47146
- state,
47170
+ state: state2,
47147
47171
  mayPublish,
47148
47172
  why,
47149
47173
  busy,
@@ -47153,7 +47177,7 @@ function PublishRow({
47153
47177
  onCopy,
47154
47178
  unsaved = false
47155
47179
  }) {
47156
- const open = state === "open";
47180
+ const open = state2 === "open";
47157
47181
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-1.5 rounded border px-2.5 py-2", children: [
47158
47182
  /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
47159
47183
  mayPublish ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
@@ -47166,7 +47190,7 @@ function PublishRow({
47166
47190
  children: busy ? "\u2026" : open ? "Unpublish" : unsaved ? "Save and publish" : "Publish"
47167
47191
  }
47168
47192
  ) : null,
47169
- state !== "draft" ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(import_jsx_runtime151.Fragment, { children: [
47193
+ state2 !== "draft" ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(import_jsx_runtime151.Fragment, { children: [
47170
47194
  /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
47171
47195
  import_outbound_react7.OutboundLink,
47172
47196
  {
@@ -47178,7 +47202,7 @@ function PublishRow({
47178
47202
  /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_design_system133.Button, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
47179
47203
  ] }) : null
47180
47204
  ] }),
47181
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: import_forms3.FORM_STATE_WORDS[state], "data-records-form-state": state, children: FORM_STATE_LABELS[state] }),
47205
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: import_forms3.FORM_STATE_WORDS[state2], "data-records-form-state": state2, children: FORM_STATE_LABELS[state2] }),
47182
47206
  open && unsaved ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-muted-foreground", "data-records-form-unsaved": "", children: "Unsaved changes \u2014 the live form shows your last save" }) : null,
47183
47207
  !mayPublish ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: why, children: "Publishing needs table admin" }) : null,
47184
47208
  shownUrl ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("p", { className: "break-all rounded border border-dashed px-2 py-1 text-xs", title: "This browser would not copy for you.", children: [
@@ -54531,7 +54555,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
54531
54555
  // src/entityViews.tsx
54532
54556
  var import_format15 = require("@ai-matrx/kit/format");
54533
54557
  var import_design_system158 = require("@ai-matrx/design-system");
54534
- var import_data_table27 = require("@ai-matrx/design-system/data-table");
54558
+ var import_data_table25 = require("@ai-matrx/design-system/data-table");
54535
54559
  var import_react313 = require("react");
54536
54560
  var import_design_system159 = require("@ai-matrx/design-system");
54537
54561
  var import_react314 = require("@ai-matrx/records/react");
@@ -54778,7 +54802,7 @@ function EntityTablePageBody({
54778
54802
  ) }) }) : null,
54779
54803
  /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
54780
54804
  entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
54781
- import_data_table27.MatrxTableCardShowMore,
54805
+ import_data_table25.MatrxTableCardShowMore,
54782
54806
  {
54783
54807
  shown: entity.rows.length,
54784
54808
  total: entity.total ?? entity.rows.length + 1,