@ai-matrx/records-ui 0.115.83 → 0.115.84

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.js CHANGED
@@ -2602,7 +2602,7 @@ function PersonAvatar({ name, size = "sm" }) {
2602
2602
  }
2603
2603
  );
2604
2604
  }
2605
- function PersonChip({ name, onRemove, className }) {
2605
+ function PersonChip({ name, onRemove, onOpen, className }) {
2606
2606
  return /* @__PURE__ */ jsxs5(
2607
2607
  "span",
2608
2608
  {
@@ -2611,7 +2611,7 @@ function PersonChip({ name, onRemove, className }) {
2611
2611
  className: cn4("inline-flex min-w-0 max-w-full items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[11px] text-foreground", className),
2612
2612
  children: [
2613
2613
  /* @__PURE__ */ jsx7(PersonAvatar, { name }),
2614
- /* @__PURE__ */ jsx7("span", { className: "min-w-0 truncate", children: name }),
2614
+ onOpen ? /* @__PURE__ */ jsx7("button", { type: "button", onClick: onOpen, "data-records-person-open": "", className: "min-w-0 truncate hover:underline", children: name }) : /* @__PURE__ */ jsx7("span", { className: "min-w-0 truncate", children: name }),
2615
2615
  onRemove ? /* @__PURE__ */ jsx7("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${name}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
2616
2616
  ]
2617
2617
  }
@@ -3751,7 +3751,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
3751
3751
  }
3752
3752
 
3753
3753
  // src/gridEditing.tsx
3754
- import { useCallback as useCallback10, useEffect as useEffect26, useMemo as useMemo14, useRef as useRef21, useState as useState36 } from "react";
3754
+ import { useCallback as useCallback10, useEffect as useEffect26, useMemo as useMemo15, useRef as useRef21, useState as useState36 } from "react";
3755
3755
  import { isButtonField as isButtonField4 } from "@ai-matrx/records";
3756
3756
  import { asWriteConflict, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
3757
3757
  import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
@@ -4505,7 +4505,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
4505
4505
  // src/editors.tsx
4506
4506
  import { useCallback as useCallback8, useEffect as useEffect23, useLayoutEffect as useLayoutEffect3, useRef as useRef18, useState as useState34 } from "react";
4507
4507
  import { isButtonField as isButtonField3, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf5, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
4508
- import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
4508
+ import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
4509
4509
  import {
4510
4510
  BasicInput as BasicInput11,
4511
4511
  BasicTextarea as BasicTextarea4,
@@ -5176,7 +5176,7 @@ import { useState as useState29 } from "react";
5176
5176
  import { Button as Button18, Dialog as Dialog2, DialogContent as DialogContent2, DialogDescription, DialogHeader as DialogHeader2, DialogTitle as DialogTitle2, Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn24 } from "@ai-matrx/design-system";
5177
5177
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2, NEUTRAL_CHIP_CLASS as NEUTRAL_CHIP_CLASS2, isStyleColor as isStyleColor2 } from "@ai-matrx/design-system/data-table";
5178
5178
  import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
5179
- import { useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
5179
+ import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
5180
5180
 
5181
5181
  // src/columnName.ts
5182
5182
  var said = (name) => name.trim().replace(/\s+/g, " ");
@@ -5214,7 +5214,7 @@ function columnNameProblemLine(name, noun = "column") {
5214
5214
  }
5215
5215
 
5216
5216
  // src/FieldEditor.tsx
5217
- import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef15, useState as useState28 } from "react";
5217
+ import { useEffect as useEffect20, useMemo as useMemo13, useRef as useRef15, useState as useState28 } from "react";
5218
5218
  import {
5219
5219
  tableShapeChanged as tableShapeChanged4,
5220
5220
  useEntityFieldMutation,
@@ -7017,7 +7017,8 @@ import { useRecordsClient as useRecordsClient8 } from "@ai-matrx/records/react";
7017
7017
  import { Button as Button13 } from "@ai-matrx/design-system";
7018
7018
 
7019
7019
  // src/memberNames.ts
7020
- import { useEffect as useEffect15, useState as useState22 } from "react";
7020
+ import { useEffect as useEffect15, useMemo as useMemo11, useState as useState22 } from "react";
7021
+ import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
7021
7022
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7022
7023
  var PERSON_NOT_IN_ORGANIZATION = "A person no longer in this organization";
7023
7024
  function isUserId(value) {
@@ -7029,11 +7030,6 @@ function memberWords(member) {
7029
7030
  const email = member?.email?.trim();
7030
7031
  return email ? email : null;
7031
7032
  }
7032
- function peopleIn(value, roster) {
7033
- const items = Array.isArray(value) ? value : [value];
7034
- if (!items.some(isUserId)) return void 0;
7035
- return items.filter(isUserId).map((id) => memberWords(roster.get(id.toLowerCase())) ?? PERSON_NOT_IN_ORGANIZATION);
7036
- }
7037
7033
  function useMemberRoster() {
7038
7034
  const host = useRecordsUi();
7039
7035
  const members = host.members;
@@ -7051,6 +7047,35 @@ function useMemberRoster() {
7051
7047
  }, [members]);
7052
7048
  return roster;
7053
7049
  }
7050
+ async function resolveKeptPerson(client, id, roster) {
7051
+ if (client) {
7052
+ try {
7053
+ const read = await client.recordRead({ record_id: id });
7054
+ if (read.ok) {
7055
+ const person = personFromRow({ id, document: read.data.document });
7056
+ const named = (person.userId ? memberWords(roster.get(person.userId.toLowerCase())) : null) ?? (person.name !== "" ? person.name : null);
7057
+ if (person.userId || named) return { id, recordId: id, name: named ?? PERSON_NOT_IN_ORGANIZATION };
7058
+ }
7059
+ } catch {
7060
+ }
7061
+ }
7062
+ return { id, recordId: null, name: memberWords(roster.get(id.toLowerCase())) ?? PERSON_NOT_IN_ORGANIZATION };
7063
+ }
7064
+ function useKeptPeople(value, roster) {
7065
+ const client = useOptionalRecordsClient7();
7066
+ const ids = useMemo11(() => (Array.isArray(value) ? value : [value]).filter(isUserId), [value]);
7067
+ const key = ids.join(",");
7068
+ const [people, setPeople] = useState22(null);
7069
+ useEffect15(() => {
7070
+ if (!roster) return;
7071
+ let cancelled = false;
7072
+ void Promise.all(ids.map((id) => resolveKeptPerson(client, id, roster))).then((named) => !cancelled && setPeople(named));
7073
+ return () => {
7074
+ cancelled = true;
7075
+ };
7076
+ }, [key, roster, client]);
7077
+ return people;
7078
+ }
7054
7079
 
7055
7080
  // src/RetiredValues.tsx
7056
7081
  import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
@@ -7067,6 +7092,18 @@ function versionHolding(entries, value) {
7067
7092
  for (const e of entries) if (same(e.after, value) && (best === null || e.version > best)) best = e.version;
7068
7093
  return best;
7069
7094
  }
7095
+ function KeptPeople({ value, roster }) {
7096
+ const host = useRecordsUi();
7097
+ const people = useKeptPeople(value, roster);
7098
+ return /* @__PURE__ */ jsx28("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: (people ?? [{ id: "wait", recordId: null, name: "\u2026" }]).map((who, i) => /* @__PURE__ */ jsx28(
7099
+ PersonChip,
7100
+ {
7101
+ name: who.name,
7102
+ ...who.recordId && host.openPerson ? { onOpen: () => host.openPerson({ recordId: who.recordId }) } : {}
7103
+ },
7104
+ `${who.id}-${i}`
7105
+ )) });
7106
+ }
7070
7107
  function RetiredValues({
7071
7108
  tableId,
7072
7109
  recordId,
@@ -7121,11 +7158,10 @@ function RetiredValues({
7121
7158
  const name = field2 ? fieldName(field2) : entry.label ?? entry.key;
7122
7159
  const shown5 = field2 ? scalarText(field2, entry.value) : typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value);
7123
7160
  const holdsUserId = (Array.isArray(entry.value) ? entry.value : [entry.value]).some(isUserId);
7124
- const people = holdsUserId ? roster ? peopleIn(entry.value, roster) : ["\u2026"] : void 0;
7125
7161
  return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-0.5", "data-records-retired-key": entry.key, children: [
7126
7162
  /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-baseline gap-2", children: [
7127
7163
  /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: name }),
7128
- people ? /* @__PURE__ */ jsx28("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: people.map((who, i) => /* @__PURE__ */ jsx28(PersonChip, { name: who }, `${who}-${i}`)) }) : /* @__PURE__ */ jsx28("span", { className: "min-w-0 break-words", children: shown5 }),
7164
+ holdsUserId ? /* @__PURE__ */ jsx28(KeptPeople, { value: entry.value, roster }) : /* @__PURE__ */ jsx28("span", { className: "min-w-0 break-words", children: shown5 }),
7129
7165
  mayWrite ? /* @__PURE__ */ jsx28(Button13, { size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy !== null, onClick: () => void restore(entry, index), "data-records-retired-restore": "", children: busy === id ? "Restoring\u2026" : "Restore" }) : null
7130
7166
  ] }),
7131
7167
  entry.reason ? /* @__PURE__ */ jsx28("p", { className: "text-[11px] text-muted-foreground", children: entry.reason }) : null,
@@ -7554,7 +7590,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7554
7590
  import { createContext as createContext5, useContext as useContext5, useEffect as useEffect17, useState as useState25 } from "react";
7555
7591
  import { BasicInput as BasicInput7, Button as Button15 } from "@ai-matrx/design-system";
7556
7592
  import { optionKey as optionKey2, optionLabel as optionLabel2, rankTypedMatches as rankTypedMatches3 } from "@ai-matrx/records";
7557
- import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
7593
+ import { useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
7558
7594
  import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
7559
7595
  var CONDITION_OPS = [
7560
7596
  { op: "eq", label: "is" },
@@ -7643,7 +7679,7 @@ function isChoiceColumn(f) {
7643
7679
  return kind2 === "select" || kind2 === "multi_select";
7644
7680
  }
7645
7681
  function ChoiceValue({ field: field2, value, onChange }) {
7646
- const client = useOptionalRecordsClient7();
7682
+ const client = useOptionalRecordsClient8();
7647
7683
  const [choices, setChoices] = useState25(null);
7648
7684
  const [open, setOpen] = useState25(false);
7649
7685
  const [search, setSearch] = useState25("");
@@ -8104,7 +8140,7 @@ function ConditionGroup({
8104
8140
  }
8105
8141
 
8106
8142
  // src/FieldRulePreview.tsx
8107
- import { useEffect as useEffect18, useMemo as useMemo11, useRef as useRef14, useState as useState26 } from "react";
8143
+ import { useEffect as useEffect18, useMemo as useMemo12, useRef as useRef14, useState as useState26 } from "react";
8108
8144
  import { previewRuleChange } from "@ai-matrx/records";
8109
8145
  import { useRecordsClient as useRecordsClient10 } from "@ai-matrx/records/react";
8110
8146
  import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
@@ -8127,7 +8163,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
8127
8163
  const client = useRecordsClient10();
8128
8164
  const [preview, setPreview] = useState26(null);
8129
8165
  const [refusal3, setRefusal] = useState26(null);
8130
- const key = useMemo11(() => ruleWords(rules), [rules]);
8166
+ const key = useMemo12(() => ruleWords(rules), [rules]);
8131
8167
  const latest = useRef14(rules);
8132
8168
  latest.current = rules;
8133
8169
  const name = fieldName(field2);
@@ -8675,7 +8711,7 @@ import { useEffect as useEffect19, useState as useState27 } from "react";
8675
8711
  import { BasicInput as BasicInput8, Button as Button16, Label as Label7 } from "@ai-matrx/design-system";
8676
8712
  import { STYLE_COLORS as STYLE_COLORS3 } from "@ai-matrx/design-system/data-table";
8677
8713
  import { buttonUrlPlaceholders } from "@ai-matrx/records";
8678
- import { useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
8714
+ import { useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
8679
8715
 
8680
8716
  // src/AccentSwatches.tsx
8681
8717
  import { PORTAL_ACCENTS } from "@ai-matrx/records";
@@ -8736,7 +8772,7 @@ function ButtonSettingsEditor({
8736
8772
  tableId,
8737
8773
  fields
8738
8774
  }) {
8739
- const client = useOptionalRecordsClient8();
8775
+ const client = useOptionalRecordsClient9();
8740
8776
  const [actions, setActions] = useState27(null);
8741
8777
  const [actionsRefused, setActionsRefused] = useState27(null);
8742
8778
  const [automations, setAutomations] = useState27(null);
@@ -8872,7 +8908,7 @@ function NewRowAction({
8872
8908
  columns,
8873
8909
  onMade
8874
8910
  }) {
8875
- const client = useOptionalRecordsClient8();
8911
+ const client = useOptionalRecordsClient9();
8876
8912
  const settable2 = settableColumns(columns);
8877
8913
  const [fieldId, setFieldId] = useState27("");
8878
8914
  const [setTo, setSetTo] = useState27("");
@@ -9054,17 +9090,17 @@ function FieldEditor(props) {
9054
9090
  const [rules, setRules] = useState28(start?.rules ?? []);
9055
9091
  const [startsWith, setStartsWith] = useState28(start?.default ?? null);
9056
9092
  const [ratingMax, setRatingMax] = useState28(() => start ? ratingMaxOf2(start) : 5);
9057
- const savedRules = useMemo12(
9093
+ const savedRules = useMemo13(
9058
9094
  () => field2 ? type === "rating" ? rulesWithTopStar(field2.rules ?? [], ratingMaxOf2(field2)) : field2.rules ?? [] : [],
9059
9095
  [field2, type]
9060
9096
  );
9061
- const editedRules = useMemo12(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
9097
+ const editedRules = useMemo13(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
9062
9098
  const [statusGroups, setStatusGroups] = useState28({});
9063
9099
  const [statusKeys, setStatusKeys] = useState28({});
9064
9100
  const [symbology, setSymbology] = useState28(String(start?.config?.["symbology"] ?? ""));
9065
9101
  const descriptionStart = String(start?.config?.["description"] ?? "");
9066
9102
  const [description, setDescription] = useState28(descriptionStart);
9067
- const buttonStart = useMemo12(() => buttonOf(start) ?? { label: "" }, [start]);
9103
+ const buttonStart = useMemo13(() => buttonOf(start) ?? { label: "" }, [start]);
9068
9104
  const [buttonSettings, setButtonSettings] = useState28(buttonStart);
9069
9105
  const prefixStart = autonumberPrefixOf3(start);
9070
9106
  const [numberPrefix, setNumberPrefix] = useState28(prefixStart);
@@ -9160,14 +9196,14 @@ function FieldEditor(props) {
9160
9196
  setUnit(liveField.unit ?? "$");
9161
9197
  setWithTime(String(liveField.config?.["kind"] ?? "date") === "datetime");
9162
9198
  }, [heldAs]);
9163
- const others = useMemo12(
9199
+ const others = useMemo13(
9164
9200
  () => (fields.data ?? []).filter((f) => f.id !== field2?.id),
9165
9201
  [fields.data, field2?.id]
9166
9202
  );
9167
- const relations = useMemo12(() => others.filter((f) => sourceKindOf(f) !== null), [others]);
9203
+ const relations = useMemo13(() => others.filter((f) => sourceKindOf(f) !== null), [others]);
9168
9204
  const reverse = useReverseColumns(onEntity ? null : tableId);
9169
- const backLinks = useMemo12(() => (reverse.data ?? []).map(backLinkAsSource), [reverse.data]);
9170
- const totalSources = useMemo12(() => [...relations, ...backLinks], [relations, backLinks]);
9205
+ const backLinks = useMemo13(() => (reverse.data ?? []).map(backLinkAsSource), [reverse.data]);
9206
+ const totalSources = useMemo13(() => [...relations, ...backLinks], [relations, backLinks]);
9171
9207
  const sourcesFor = (kind2) => kind2 === "rollup" || kind2 === "count" ? totalSources : relations;
9172
9208
  const choice = fieldTypeChoice(type);
9173
9209
  const editing = Boolean(field2);
@@ -9177,7 +9213,7 @@ function FieldEditor(props) {
9177
9213
  const newDefault = !editing && !onEntity && newColumnTakesADefault(type) ? defaultToKeep(startsWith) : null;
9178
9214
  const farFieldsOfLink = useFields2(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
9179
9215
  const farTable = useTable(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
9180
- const linkReaders = useMemo12(
9216
+ const linkReaders = useMemo13(
9181
9217
  () => field2 ? readingThroughLink(field2, farFieldsOfLink.data ?? []) : [],
9182
9218
  [field2, farFieldsOfLink.data]
9183
9219
  );
@@ -10133,7 +10169,7 @@ function RollupFilterQuestion({
10133
10169
  }) {
10134
10170
  const far = relation?.relation_target ?? null;
10135
10171
  const farFields = useFields2(far);
10136
- const conditionFields = useMemo12(
10172
+ const conditionFields = useMemo13(
10137
10173
  () => (farFields.data ?? []).filter((f) => f.type !== "formula").map((f) => ({ id: f.id, key: f.key, label: fieldName(f), field: f })),
10138
10174
  [farFields.data]
10139
10175
  );
@@ -10247,7 +10283,7 @@ function buttonPressWords(label, pressed) {
10247
10283
  }
10248
10284
  var stop = (event) => event.stopPropagation();
10249
10285
  function ButtonValue({ field: field2, recordId, inCell }) {
10250
- const client = useOptionalRecordsClient9();
10286
+ const client = useOptionalRecordsClient10();
10251
10287
  const b = buttonOf2(field2);
10252
10288
  const [busy, setBusy] = useState29(false);
10253
10289
  const [said2, setSaid] = useState29(null);
@@ -10655,7 +10691,7 @@ function TypedDateHelper({
10655
10691
 
10656
10692
  // src/choiceNudge.ts
10657
10693
  import { useEffect as useEffect22, useState as useState33 } from "react";
10658
- import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
10694
+ import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
10659
10695
  var asked = /* @__PURE__ */ new WeakMap();
10660
10696
  function choiceNudgeOf(client) {
10661
10697
  let answer = asked.get(client);
@@ -10669,7 +10705,7 @@ function choiceNudgeOf(client) {
10669
10705
  return answer;
10670
10706
  }
10671
10707
  function useChoiceNudge(enabled = true) {
10672
- const client = useOptionalRecordsClient10();
10708
+ const client = useOptionalRecordsClient11();
10673
10709
  const [nudge, setNudge] = useState33(null);
10674
10710
  useEffect22(() => {
10675
10711
  if (!enabled || !client) return;
@@ -10870,7 +10906,7 @@ function ReadsAsNote({ typed: typed2, always, children }) {
10870
10906
  return /* @__PURE__ */ jsx43("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
10871
10907
  }
10872
10908
  function TypedTextControl({ field: field2, value, onChange, disabled, id, onCommit, onCancel }) {
10873
- const client = useOptionalRecordsClient11();
10909
+ const client = useOptionalRecordsClient12();
10874
10910
  const kind2 = String(editorKindFor(field2));
10875
10911
  const needsChoices = kind2 === "select" || kind2 === "multi_select";
10876
10912
  const nudge = useChoiceNudge(needsChoices);
@@ -10961,7 +10997,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10961
10997
  const host = useRecordsUi();
10962
10998
  const kind2 = editorKindFor(field2);
10963
10999
  const inputId = id ?? `field-${field2.key}`;
10964
- const ownDetails = useOptionalRecordsClient11() === null;
11000
+ const ownDetails = useOptionalRecordsClient12() === null;
10965
11001
  if (isTypedDraft(value)) return /* @__PURE__ */ jsx43(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
10966
11002
  if (isSignatureField(field2)) return /* @__PURE__ */ jsx43(SignaturePad, { id: inputId, value, onChange, disabled });
10967
11003
  if (isButtonField3(field2)) return /* @__PURE__ */ jsx43(ButtonValue, { field: field2 });
@@ -11227,7 +11263,7 @@ function inTheStoresOrder(options) {
11227
11263
  return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
11228
11264
  }
11229
11265
  function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
11230
- const client = useOptionalRecordsClient11();
11266
+ const client = useOptionalRecordsClient12();
11231
11267
  const [options, setOptions] = useState34(null);
11232
11268
  const [refusal3, setRefusal] = useState34(null);
11233
11269
  const [reread, setReread] = useState34(0);
@@ -11395,7 +11431,7 @@ function OpenChoicePicker({
11395
11431
  allowOther = true,
11396
11432
  onChoicesChanged
11397
11433
  }) {
11398
- const client = useOptionalRecordsClient11();
11434
+ const client = useOptionalRecordsClient12();
11399
11435
  const nudge = useChoiceNudge();
11400
11436
  const [open, setOpenState] = useState34(autoOpen === true);
11401
11437
  const onCloseRef = useRef18(onClose);
@@ -11666,7 +11702,7 @@ function ChoiceAnswer({
11666
11702
  }
11667
11703
 
11668
11704
  // src/whoChangedSource.tsx
11669
- import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as useEffect24, useMemo as useMemo13, useRef as useRef19, useState as useState35 } from "react";
11705
+ import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as useEffect24, useMemo as useMemo14, useRef as useRef19, useState as useState35 } from "react";
11670
11706
  import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
11671
11707
 
11672
11708
  // src/whoChanged.ts
@@ -11774,7 +11810,7 @@ function WhoChangedSource({
11774
11810
  },
11775
11811
  [client, tableId]
11776
11812
  );
11777
- const value = useMemo13(
11813
+ const value = useMemo14(
11778
11814
  () => ({
11779
11815
  answerFor: (fieldKey, recordId) => answers[`${recordId}|${fieldKey}`],
11780
11816
  ask: ask2,
@@ -11984,9 +12020,9 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
11984
12020
  const queues = useRef21(/* @__PURE__ */ new Map());
11985
12021
  const writtenRef = useRef21(onWritten);
11986
12022
  writtenRef.current = onWritten;
11987
- const editable = useMemo14(() => fields.filter(fieldIsEditable), [fields]);
11988
- const order = useMemo14(() => editable.map((f) => f.key), [editable]);
11989
- const rowIds = useMemo14(() => rows.map((r) => r.id), [rows]);
12023
+ const editable = useMemo15(() => fields.filter(fieldIsEditable), [fields]);
12024
+ const order = useMemo15(() => editable.map((f) => f.key), [editable]);
12025
+ const rowIds = useMemo15(() => rows.map((r) => r.id), [rows]);
11990
12026
  const cellKey = (rowId, key) => `${rowId}::${key}`;
11991
12027
  const openingDraft = (key, current) => {
11992
12028
  const field2 = fields.find((f) => f.key === key);
@@ -13353,7 +13389,7 @@ function useWholeTableCount(args) {
13353
13389
  }
13354
13390
 
13355
13391
  // src/Grid.tsx
13356
- import { useCallback as useCallback28, useEffect as useEffect56, useMemo as useMemo39, useRef as useRef37, useState as useState72 } from "react";
13392
+ import { useCallback as useCallback28, useEffect as useEffect56, useMemo as useMemo40, useRef as useRef37, useState as useState72 } from "react";
13357
13393
  import {
13358
13394
  useFields as useFields12,
13359
13395
  useRecordPage,
@@ -13505,7 +13541,7 @@ function useTableCanBeCleaned(tableId) {
13505
13541
  // src/gridControls.tsx
13506
13542
  import { copyText as writeClipboardText, readText as readClipboardText } from "@ai-matrx/kit/clipboard";
13507
13543
  import { onRecordChanged } from "@ai-matrx/records/core";
13508
- import { useCallback as useCallback17, useEffect as useEffect39, useMemo as useMemo24, useRef as useRef26, useState as useState52 } from "react";
13544
+ import { useCallback as useCallback17, useEffect as useEffect39, useMemo as useMemo25, useRef as useRef26, useState as useState52 } from "react";
13509
13545
  import { tableShapeChanged as tableShapeChanged5, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient27, useReverseColumns as useReverseColumns2 } from "@ai-matrx/records/react";
13510
13546
  import {
13511
13547
  BasicInput as BasicInput14,
@@ -13523,7 +13559,7 @@ import { gridToTsv } from "@ai-matrx/design-system/data-table";
13523
13559
  import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
13524
13560
 
13525
13561
  // src/MergeRecordDialog.tsx
13526
- import { useMemo as useMemo15, useState as useState39 } from "react";
13562
+ import { useMemo as useMemo16, useState as useState39 } from "react";
13527
13563
  import { useRecords as useRecords3, useRecordsClient as useRecordsClient16, useTable as useTable2 } from "@ai-matrx/records/react";
13528
13564
  import {
13529
13565
  Button as Button22,
@@ -13547,7 +13583,7 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
13547
13583
  const [other, setOther] = useState39(null);
13548
13584
  const [busy, setBusy] = useState39(false);
13549
13585
  const [refusal3, setRefusal] = useState39(null);
13550
- const options = useMemo15(
13586
+ const options = useMemo16(
13551
13587
  () => (records.data?.rows ?? []).filter((row) => row.id !== record.id).map((row) => ({ value: row.id, label: rowNameIn(table.data ?? null, row) })),
13552
13588
  [records.data, record.id, table.data]
13553
13589
  );
@@ -13625,7 +13661,7 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
13625
13661
  }
13626
13662
 
13627
13663
  // src/SplitRecordDialog.tsx
13628
- import { useMemo as useMemo16, useState as useState40 } from "react";
13664
+ import { useMemo as useMemo17, useState as useState40 } from "react";
13629
13665
  import { useFields as useFields3, useRecordsClient as useRecordsClient17, useTable as useTable3 } from "@ai-matrx/records/react";
13630
13666
  import {
13631
13667
  Button as Button23,
@@ -13946,7 +13982,7 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
13946
13982
  const notify = host.notify;
13947
13983
  const fields = useFields3(tableId);
13948
13984
  const table = useTable3(tableId);
13949
- const filled = useMemo16(() => filledFields(fields.data ?? [], document2), [fields.data, document2]);
13985
+ const filled = useMemo17(() => filledFields(fields.data ?? [], document2), [fields.data, document2]);
13950
13986
  const [moving, setMoving] = useState40(/* @__PURE__ */ new Set());
13951
13987
  const [busy, setBusy] = useState40(false);
13952
13988
  const [refusal3, setRefusal] = useState40(null);
@@ -14068,7 +14104,7 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
14068
14104
  }
14069
14105
 
14070
14106
  // src/ExtractParentDialog.tsx
14071
- import { useMemo as useMemo18, useState as useState42 } from "react";
14107
+ import { useMemo as useMemo19, useState as useState42 } from "react";
14072
14108
  import { useFields as useFields5, useRecordsClient as useRecordsClient18, useTable as useTable5 } from "@ai-matrx/records/react";
14073
14109
  import {
14074
14110
  Button as Button25,
@@ -14084,7 +14120,7 @@ import {
14084
14120
  } from "@ai-matrx/design-system";
14085
14121
 
14086
14122
  // src/TablePickers.tsx
14087
- import { useEffect as useEffect29, useMemo as useMemo17, useState as useState41 } from "react";
14123
+ import { useEffect as useEffect29, useMemo as useMemo18, useState as useState41 } from "react";
14088
14124
  import { RecordsProvider as RecordsProvider2, useFields as useFields4, useRecords as useRecords4, useTable as useTable4 } from "@ai-matrx/records/react";
14089
14125
  import { Button as Button24, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
14090
14126
 
@@ -14284,8 +14320,8 @@ function TableScope({ dataSource, userId, tableId, children, fallback = null, un
14284
14320
  }
14285
14321
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
14286
14322
  const fields = useFields4(tableId);
14287
- const all = useMemo17(() => fields.data ?? [], [fields.data]);
14288
- const byKey = useMemo17(() => new Map(all.map((f) => [f.key, f])), [all]);
14323
+ const all = useMemo18(() => fields.data ?? [], [fields.data]);
14324
+ const byKey = useMemo18(() => new Map(all.map((f) => [f.key, f])), [all]);
14289
14325
  const keys = Object.keys(value);
14290
14326
  const [adding, setAdding] = useState41(false);
14291
14327
  const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
@@ -14422,12 +14458,12 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
14422
14458
  const [busy, setBusy] = useState42(false);
14423
14459
  const [refusal3, setRefusal] = useState42(null);
14424
14460
  const doc = document2 ?? {};
14425
- const pickable = useMemo18(() => {
14461
+ const pickable = useMemo19(() => {
14426
14462
  const home = tables.rows.find((t) => t.table_id === tableId)?.organization_id ?? homeTable.data?.organization_id;
14427
14463
  if (home === void 0) return { ...tables, rows: [], loading: tables.loading || homeTable.loading };
14428
14464
  return { ...tables, rows: tables.rows.filter((t) => t.table_id !== tableId && t.organization_id === home) };
14429
14465
  }, [tables, tableId, homeTable.data, homeTable.loading]);
14430
- const shared = useMemo18(() => {
14466
+ const shared = useMemo19(() => {
14431
14467
  if (!parentId) return [];
14432
14468
  const there = new Set((parentFields.data ?? []).map((f) => f.key));
14433
14469
  return filledFields(fields.data ?? [], doc).filter((f) => there.has(f.key));
@@ -14570,7 +14606,7 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
14570
14606
  }
14571
14607
 
14572
14608
  // src/gridColors.tsx
14573
- import { useCallback as useCallback12, useEffect as useEffect30, useMemo as useMemo19, useState as useState43 } from "react";
14609
+ import { useCallback as useCallback12, useEffect as useEffect30, useMemo as useMemo20, useState as useState43 } from "react";
14574
14610
  import { optionKey as optionKey5, optionLabel as optionLabel3 } from "@ai-matrx/records";
14575
14611
  import { useRecordsClient as useRecordsClient19 } from "@ai-matrx/records/react";
14576
14612
  import {
@@ -14951,7 +14987,7 @@ function ColourRulesDialog({
14951
14987
  const [drafts, setDrafts] = useState43(null);
14952
14988
  const [busy, setBusy] = useState43(false);
14953
14989
  const [scope, setScope] = useState43("table");
14954
- const keptTable = useMemo19(() => draftsFrom(decorations, fields), [decorations, fields]);
14990
+ const keptTable = useMemo20(() => draftsFrom(decorations, fields), [decorations, fields]);
14955
14991
  const held = scope === "view" && viewRules ? viewRules.drafts : keptTable;
14956
14992
  const opsFor = (key) => {
14957
14993
  const field2 = fields.find((f) => f.key === key);
@@ -15309,7 +15345,7 @@ function RowLabelPicker({
15309
15345
  import { Button as Button30, Dialog as Dialog8, DialogContent as DialogContent8, DialogHeader as DialogHeader8, DialogTitle as DialogTitle8 } from "@ai-matrx/design-system";
15310
15346
 
15311
15347
  // src/RowActionsEditor.tsx
15312
- import { useCallback as useCallback14, useEffect as useEffect34, useMemo as useMemo21, useRef as useRef24, useState as useState47 } from "react";
15348
+ import { useCallback as useCallback14, useEffect as useEffect34, useMemo as useMemo22, useRef as useRef24, useState as useState47 } from "react";
15313
15349
  import { useFields as useFields6, useRecords as useRecords5, useRecordsClient as useRecordsClient23 } from "@ai-matrx/records/react";
15314
15350
  import {
15315
15351
  Badge as Badge7,
@@ -15468,7 +15504,7 @@ function ActionRowPreview({
15468
15504
  }
15469
15505
 
15470
15506
  // src/gridActions.tsx
15471
- import { useCallback as useCallback13, useEffect as useEffect33, useMemo as useMemo20, useState as useState46 } from "react";
15507
+ import { useCallback as useCallback13, useEffect as useEffect33, useMemo as useMemo21, useState as useState46 } from "react";
15472
15508
  import { useRecordsClient as useRecordsClient22, useRowActions } from "@ai-matrx/records/react";
15473
15509
  import { actionRefusals } from "@ai-matrx/records";
15474
15510
  import { Button as Button28, ConfirmDialog, cn as cn30 } from "@ai-matrx/design-system";
@@ -15495,7 +15531,7 @@ function useTableActions(tableId, enabled) {
15495
15531
  set.delete(listener);
15496
15532
  };
15497
15533
  }, [tableId, enabled, reload]);
15498
- return useMemo20(() => {
15534
+ return useMemo21(() => {
15499
15535
  const isAgent = (a) => a.kind === "agent";
15500
15536
  return {
15501
15537
  runnable: actions.filter((a) => !isAgent(a) && a.runnable !== false && a.id),
@@ -16061,7 +16097,7 @@ function ActionForm({
16061
16097
  const [draft, setDraft] = useState47(() => draftOf(original));
16062
16098
  const host = useRecordsUi();
16063
16099
  const [previewId, setPreviewId] = useState47(rows[0]?.id ?? "");
16064
- const settable2 = useMemo21(() => settableFields(fields), [fields]);
16100
+ const settable2 = useMemo22(() => settableFields(fields), [fields]);
16065
16101
  const previewRow = rows.find((r) => r.id === previewId) ?? rows[0] ?? null;
16066
16102
  const candidate = actionOf(draft, original);
16067
16103
  const complete = draft.steps.every((s) => s.field !== "");
@@ -16341,7 +16377,7 @@ function RowActionsDialog({
16341
16377
  }
16342
16378
 
16343
16379
  // src/gridSummaries.tsx
16344
- import { useCallback as useCallback15, useEffect as useEffect35, useMemo as useMemo22, useRef as useRef25, useState as useState48 } from "react";
16380
+ import { useCallback as useCallback15, useEffect as useEffect35, useMemo as useMemo23, useRef as useRef25, useState as useState48 } from "react";
16345
16381
  import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
16346
16382
  import { measureKey } from "@ai-matrx/records";
16347
16383
  import {
@@ -16442,7 +16478,7 @@ function SummaryCell({
16442
16478
  onChoose,
16443
16479
  calculate = false
16444
16480
  }) {
16445
- const offered = useMemo22(
16481
+ const offered = useMemo23(
16446
16482
  () => summaries.operations ? calculate ? calculationsFor(field2, summaries.operations).map((c) => c.op) : measuresFor(field2, summaries.operations, firstColumn) : null,
16447
16483
  [summaries.operations, field2, firstColumn, calculate]
16448
16484
  );
@@ -16559,7 +16595,7 @@ function SummarySheetControls({
16559
16595
  }
16560
16596
 
16561
16597
  // src/ColumnCleanDialog.tsx
16562
- import { useEffect as useEffect36, useMemo as useMemo23, useState as useState49 } from "react";
16598
+ import { useEffect as useEffect36, useMemo as useMemo24, useState as useState49 } from "react";
16563
16599
  import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
16564
16600
  import {
16565
16601
  Button as Button32,
@@ -16753,10 +16789,10 @@ function ColumnCleanDialog({
16753
16789
  live = false;
16754
16790
  };
16755
16791
  }, [client, tableId, row]);
16756
- const fields = useMemo23(() => many ? [...many] : field2 ? [field2] : [], [many, field2]);
16792
+ const fields = useMemo24(() => many ? [...many] : field2 ? [field2] : [], [many, field2]);
16757
16793
  const whole = !field2;
16758
- const keys = useMemo23(() => fields.map((f) => f.key), [fields]);
16759
- const plan = useMemo23(() => rows ? planTableClean(rows, keys, enabled) : null, [rows, keys, enabled]);
16794
+ const keys = useMemo24(() => fields.map((f) => f.key), [fields]);
16795
+ const plan = useMemo24(() => rows ? planTableClean(rows, keys, enabled) : null, [rows, keys, enabled]);
16760
16796
  const nameOf2 = (key) => {
16761
16797
  const f = fields.find((x) => x.key === key);
16762
16798
  return f ? fieldName(f) : key;
@@ -17340,7 +17376,7 @@ function useMergedGridControls(args) {
17340
17376
  const [deleteBusy, setDeleteBusy] = useState52(false);
17341
17377
  const [labelling, setLabelling] = useState52(false);
17342
17378
  const [rowActionsOpen, setRowActionsOpen] = useState52(false);
17343
- const noDecorations = useMemo24(() => ({ data: null, apply: () => void 0 }), []);
17379
+ const noDecorations = useMemo25(() => ({ data: null, apply: () => void 0 }), []);
17344
17380
  const colours = useGridColours({
17345
17381
  enabled,
17346
17382
  tableId,
@@ -17362,17 +17398,17 @@ function useMergedGridControls(args) {
17362
17398
  useEffect39(() => {
17363
17399
  setHeld(null);
17364
17400
  }, [keptKey]);
17365
- const order = useMemo24(() => {
17401
+ const order = useMemo25(() => {
17366
17402
  const base2 = held?.order ?? columnsInKeptOrder(fieldKeys, keptOrder);
17367
17403
  const known = columnsInKeptOrder(fieldKeys, base2);
17368
17404
  if (frozenKeys.size === 0) return known;
17369
17405
  return [...known.filter((k) => frozenKeys.has(k)), ...known.filter((k) => !frozenKeys.has(k))];
17370
17406
  }, [held, fieldKeys, keptOrder, frozenKeys]);
17371
- const hidden = useMemo24(() => {
17407
+ const hidden = useMemo25(() => {
17372
17408
  const known = new Set(fieldKeys);
17373
17409
  return (held?.hidden ?? keptHidden ?? []).filter((k) => known.has(k) || k.startsWith(REVERSE_COLUMN_PREFIX));
17374
17410
  }, [held, keptHidden, fieldKeys]);
17375
- const naturalOrder = useMemo24(
17411
+ const naturalOrder = useMemo25(
17376
17412
  () => [...fieldKeys.filter((k) => frozenKeys.has(k)), ...fieldKeys.filter((k) => !frozenKeys.has(k))],
17377
17413
  [fieldKeys, frozenKeys]
17378
17414
  );
@@ -17405,7 +17441,7 @@ function useMergedGridControls(args) {
17405
17441
  (columnId2) => columnId2.startsWith(REVERSE_COLUMN_PREFIX) ? (reverseColumns.data ?? []).find((c) => `${REVERSE_COLUMN_PREFIX}${c.key}` === columnId2) : void 0,
17406
17442
  [reverseColumns.data]
17407
17443
  );
17408
- const choiceKeys = useMemo24(() => enabled ? fields.filter(isChoiceField).map((f) => f.key) : [], [enabled, fields]);
17444
+ const choiceKeys = useMemo25(() => enabled ? fields.filter(isChoiceField).map((f) => f.key) : [], [enabled, fields]);
17409
17445
  const choiceOptions = useChoiceOptions(fields, choiceKeys);
17410
17446
  const searchWords = (args.search ?? "").trim();
17411
17447
  const countQuestionKey = JSON.stringify([choiceKeys, query.columnFilters, args.filter ?? null, searchWords]);
@@ -17480,7 +17516,7 @@ function useMergedGridControls(args) {
17480
17516
  },
17481
17517
  [notify]
17482
17518
  );
17483
- const ctx = useMemo24(() => {
17519
+ const ctx = useMemo25(() => {
17484
17520
  const mayStructure = rights.structure && editable;
17485
17521
  const summaries = args.summaries;
17486
17522
  const firstKey = fieldKeys[0];
@@ -17831,7 +17867,7 @@ function useMergedGridControls(args) {
17831
17867
  },
17832
17868
  [rows, order, hidden]
17833
17869
  );
17834
- const contextMenu = useMemo24(
17870
+ const contextMenu = useMemo25(
17835
17871
  // The designed menu: these sections are its feature section, headed by the row / column clicked.
17836
17872
  () => enabled ? { sections: (payload) => gridMenuSections(payload, ctx, rowText), designedMenu: true } : void 0,
17837
17873
  [enabled, ctx, rowText]
@@ -17840,7 +17876,7 @@ function useMergedGridControls(args) {
17840
17876
  (columnKey) => enabled && fieldOf2(columnKey) ? headerMenuItems(columnKey, ctx) : void 0,
17841
17877
  [enabled, ctx, fieldOf2]
17842
17878
  );
17843
- const columnsControl = useMemo24(
17879
+ const columnsControl = useMemo25(
17844
17880
  () => enabled ? { order, hidden, onChange: keepColumns } : void 0,
17845
17881
  [enabled, order, hidden, keepColumns]
17846
17882
  );
@@ -18138,7 +18174,7 @@ function selectOpenCellText() {
18138
18174
  import { Button as Button49, ConfirmDialog as ConfirmDialog5, TapTargetSearchGroup, cn as cn41, useIsMobile } from "@ai-matrx/design-system";
18139
18175
 
18140
18176
  // src/gridAddRow.tsx
18141
- import { useCallback as useCallback18, useEffect as useEffect42, useMemo as useMemo27, useRef as useRef29, useState as useState56 } from "react";
18177
+ import { useCallback as useCallback18, useEffect as useEffect42, useMemo as useMemo28, useRef as useRef29, useState as useState56 } from "react";
18142
18178
  import { useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
18143
18179
  import {
18144
18180
  Button as Button38,
@@ -18153,7 +18189,7 @@ import {
18153
18189
  } from "@ai-matrx/design-system";
18154
18190
 
18155
18191
  // src/RecordForm.tsx
18156
- import { useEffect as useEffect41, useMemo as useMemo26, useRef as useRef28, useState as useState55 } from "react";
18192
+ import { useEffect as useEffect41, useMemo as useMemo27, useRef as useRef28, useState as useState55 } from "react";
18157
18193
  import {
18158
18194
  useFields as useFields7,
18159
18195
  useRecord,
@@ -18170,7 +18206,7 @@ import { useEntityRecord as useEntityRecord2, useRecordsClient as useRecordsClie
18170
18206
  import { Input as Input2, Textarea as Textarea2, cn as cn34 } from "@ai-matrx/design-system";
18171
18207
 
18172
18208
  // src/CustomFieldsSection.tsx
18173
- import { useEffect as useEffect40, useMemo as useMemo25, useRef as useRef27, useState as useState53 } from "react";
18209
+ import { useEffect as useEffect40, useMemo as useMemo26, useRef as useRef27, useState as useState53 } from "react";
18174
18210
  import {
18175
18211
  useEntityFieldMutation as useEntityFieldMutation2,
18176
18212
  useEntityFieldRights as useEntityFieldRights2,
@@ -18302,7 +18338,7 @@ function CustomFieldsSection({
18302
18338
  const [cellValue, setCellValue] = useState53(void 0);
18303
18339
  const [cellSaving, setCellSaving] = useState53(false);
18304
18340
  const [removing, setRemoving] = useState53(null);
18305
- const fields = useMemo25(() => read.data?.fields ?? [], [read.data]);
18341
+ const fields = useMemo26(() => read.data?.fields ?? [], [read.data]);
18306
18342
  const saveCell = async (key) => {
18307
18343
  if (cellSaving) return;
18308
18344
  const was = (read.data?.custom ?? {})[key];
@@ -18801,7 +18837,7 @@ function CustomRecordForm({
18801
18837
  }, [focusFirstRequired, recordId, fields.data]);
18802
18838
  const [changed2, setChanged] = useState55({});
18803
18839
  const [answered, setAnswered] = useState55(null);
18804
- const formRows = useMemo26(
18840
+ const formRows = useMemo27(
18805
18841
  () => existing.data ? [{ id: existing.data.record_id, document: existing.data.document, level: "", hidden: {} }] : [],
18806
18842
  [existing.data]
18807
18843
  );
@@ -18822,7 +18858,7 @@ function CustomRecordForm({
18822
18858
  return next;
18823
18859
  });
18824
18860
  }, [existing.data?.record_id]);
18825
- const document2 = useMemo26(() => {
18861
+ const document2 = useMemo27(() => {
18826
18862
  const out = {};
18827
18863
  for (const [key, value] of Object.entries(draft)) {
18828
18864
  if (key.startsWith("_")) continue;
@@ -18830,7 +18866,7 @@ function CustomRecordForm({
18830
18866
  }
18831
18867
  return out;
18832
18868
  }, [draft]);
18833
- const predicted = useMemo26(
18869
+ const predicted = useMemo27(
18834
18870
  () => fields.data ? predictWriteRefusals({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
18835
18871
  [fields.data, document2, recordType]
18836
18872
  );
@@ -19058,7 +19094,7 @@ function useAddedRows(args) {
19058
19094
  );
19059
19095
  });
19060
19096
  }, [enabled, pageRows, pinnedKey, client, tableId]);
19061
- const rows = useMemo27(() => enabled ? placePinnedRows(pageRows, added, anchors) : pageRows, [enabled, pageRows, added, anchors]);
19097
+ const rows = useMemo28(() => enabled ? placePinnedRows(pageRows, added, anchors) : pageRows, [enabled, pageRows, added, anchors]);
19062
19098
  const pin = useCallback18((row, after) => {
19063
19099
  setAdded((held) => held.some((r) => r.id === row.id) ? held : [...held, row]);
19064
19100
  if (after) setAnchors((held) => new Map(held).set(row.id, after));
@@ -19223,7 +19259,7 @@ function NewRecordControl({
19223
19259
  }
19224
19260
 
19225
19261
  // src/gridDrill.tsx
19226
- import { useEffect as useEffect44, useMemo as useMemo28, useState as useState58 } from "react";
19262
+ import { useEffect as useEffect44, useMemo as useMemo29, useState as useState58 } from "react";
19227
19263
  import { useRecordsClient as useRecordsClient33 } from "@ai-matrx/records/react";
19228
19264
  import {
19229
19265
  isRuleFilter as isRuleFilter2
@@ -19631,17 +19667,17 @@ function drillQuestionFor(question, def) {
19631
19667
  function useDrill(args) {
19632
19668
  const enabled = args.enabled ?? true;
19633
19669
  const { def, error: describeError } = useDrillDefinition(enabled ? args.source : null);
19634
- const question = useMemo28(() => drillQuestionFor(args.question, def), [args.question, def]);
19635
- const booleans = useMemo28(() => new Set((def?.dimensions ?? []).filter((d) => d.kind === "boolean").map((d) => d.key)), [def]);
19670
+ const question = useMemo29(() => drillQuestionFor(args.question, def), [args.question, def]);
19671
+ const booleans = useMemo29(() => new Set((def?.dimensions ?? []).filter((d) => d.kind === "boolean").map((d) => d.key)), [def]);
19636
19672
  const baseKey = JSON.stringify(args.base ?? []);
19637
- const filter = useMemo28(() => {
19673
+ const filter = useMemo29(() => {
19638
19674
  const base2 = JSON.parse(baseKey);
19639
19675
  if (base2.length === 0) return args.filter;
19640
19676
  const out = { ...args.filter ?? {} };
19641
19677
  for (const b of base2) out[b.key] = b.value;
19642
19678
  return out;
19643
19679
  }, [args.filter, baseKey]);
19644
- const where = useMemo28(() => drillWhere(filter, question.where, booleans), [filter, question.where, booleans]);
19680
+ const where = useMemo29(() => drillWhere(filter, question.where, booleans), [filter, question.where, booleans]);
19645
19681
  const windowKey = drillWindowDimensionOf(def);
19646
19682
  const { answers, labels, error } = useDrillAnswers({
19647
19683
  source: args.source,
@@ -19654,7 +19690,7 @@ function useDrill(args) {
19654
19690
  enabled: enabled && def !== null
19655
19691
  });
19656
19692
  const hostDims = args.dimensions;
19657
- const plain2 = useMemo28(() => drillDimensionsOf(def, labels, hostDims), [def, labels, hostDims]);
19693
+ const plain2 = useMemo29(() => drillDimensionsOf(def, labels, hostDims), [def, labels, hostDims]);
19658
19694
  const range = question.window && windowKey ? drillWindowRange(question.window) : null;
19659
19695
  const level = useDrillLevelReads({
19660
19696
  source: args.source,
@@ -19666,7 +19702,7 @@ function useDrill(args) {
19666
19702
  lane: args.lane,
19667
19703
  enabled: enabled && def !== null && !args.rule
19668
19704
  });
19669
- const named = useMemo28(() => {
19705
+ const named = useMemo29(() => {
19670
19706
  if (level.names.size === 0) return labels;
19671
19707
  const out = /* @__PURE__ */ new Map();
19672
19708
  for (const [k, m] of labels) out.set(k, new Map(m));
@@ -19677,10 +19713,10 @@ function useDrill(args) {
19677
19713
  }
19678
19714
  return out;
19679
19715
  }, [labels, level.names]);
19680
- const dimensions = useMemo28(() => named === labels ? plain2 : drillDimensionsOf(def, named, hostDims), [named, labels, plain2, def, hostDims]);
19681
- const measures = useMemo28(() => drillMeasuresOf(def), [def]);
19682
- const paths = useMemo28(() => drillPathsOf(def), [def]);
19683
- const baseCrumbs = useMemo28(
19716
+ const dimensions = useMemo29(() => named === labels ? plain2 : drillDimensionsOf(def, named, hostDims), [named, labels, plain2, def, hostDims]);
19717
+ const measures = useMemo29(() => drillMeasuresOf(def), [def]);
19718
+ const paths = useMemo29(() => drillPathsOf(def), [def]);
19719
+ const baseCrumbs = useMemo29(
19684
19720
  () => JSON.parse(baseKey).map((b) => {
19685
19721
  const dim = dimensions.find((d) => d.key === b.key);
19686
19722
  const value = b.value === null ? null : String(b.value);
@@ -19693,7 +19729,7 @@ function useDrill(args) {
19693
19729
  const rootLabel = args.rootLabel ?? "All records";
19694
19730
  const { attributes, focusAttributes } = level;
19695
19731
  const controls = args.controls;
19696
- const config = useMemo28(() => {
19732
+ const config = useMemo29(() => {
19697
19733
  if (!enabled) return null;
19698
19734
  if (!def) return describeError ? { dimensions: [], measures: [], question, answers: {}, error: describeError, onQuestionChange } : null;
19699
19735
  if (dimensions.length === 0) return null;
@@ -19719,13 +19755,13 @@ function useDrill(args) {
19719
19755
  function useAddressDrill(args) {
19720
19756
  const { token: token2, startWindow, prefix, ...rest } = args;
19721
19757
  const active = (args.enabled ?? true) && token2 !== null;
19722
- const source = useMemo28(() => active && token2 ? { kind: "entity", token: token2 } : null, [active, token2]);
19723
- const fallback = useMemo28(
19758
+ const source = useMemo29(() => active && token2 ? { kind: "entity", token: token2 } : null, [active, token2]);
19759
+ const fallback = useMemo29(
19724
19760
  () => ({ by: [], across: null, show: [], where: [], ...startWindow ? { window: startWindow } : {} }),
19725
19761
  [startWindow]
19726
19762
  );
19727
19763
  const url = useDrillUrlState({ fallback, prefix: prefix ?? "drill" });
19728
- const question = useMemo28(
19764
+ const question = useMemo29(
19729
19765
  () => startWindow && !url.question.window ? { ...url.question, window: startWindow } : url.question,
19730
19766
  [url.question, startWindow]
19731
19767
  );
@@ -19803,18 +19839,18 @@ function filterWithWindow(fields, base2, key, range) {
19803
19839
  }
19804
19840
  function useGridDrillQuestion(args) {
19805
19841
  const { tableId, fields, presentation, filter } = args;
19806
- const source = useMemo28(() => ({ kind: "table", id: tableId }), [tableId]);
19807
- const saved = useMemo28(() => questionFromGrouping(presentation.grouping), [presentation.grouping]);
19842
+ const source = useMemo29(() => ({ kind: "table", id: tableId }), [tableId]);
19843
+ const saved = useMemo29(() => questionFromGrouping(presentation.grouping), [presentation.grouping]);
19808
19844
  const url = useDrillUrlState({ fallback: saved });
19809
19845
  const requested = args.enabled && // Up to three levels are ROWS under nested headers on the merged grid (Airtable's group levels).
19810
19846
  (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
19811
19847
  // yet has them UNDEFINED, and `undefined !== null` asked for drill metadata on every plain grid.
19812
19848
  url.question.window != null || url.question.compare != null);
19813
19849
  const { def } = useDrillDefinition(requested ? source : null);
19814
- const question = useMemo28(() => drillQuestionFor(url.question, def), [url.question, def]);
19850
+ const question = useMemo29(() => drillQuestionFor(url.question, def), [url.question, def]);
19815
19851
  const enabled = requested && def !== null && def.dimensions.length > 0;
19816
19852
  const windowKey = drillWindowDimensionOf(def);
19817
- const trailFilter = useMemo28(() => {
19853
+ const trailFilter = useMemo29(() => {
19818
19854
  if (!enabled) return filter;
19819
19855
  const range = question.window && windowKey ? drillWindowRange(question.window) : null;
19820
19856
  const withWindow = range && windowKey ? filterWithWindow(fields, filter, windowKey, range) : filter;
@@ -19825,7 +19861,7 @@ function useGridDrillQuestion(args) {
19825
19861
  function useGridDrillConfig(args) {
19826
19862
  const { state: state2, presentation, onPresentationChange, version } = args;
19827
19863
  const { setQuestion } = state2;
19828
- const onQuestionChange = useMemo28(
19864
+ const onQuestionChange = useMemo29(
19829
19865
  () => (next) => {
19830
19866
  setQuestion(next);
19831
19867
  if (onPresentationChange) {
@@ -19862,7 +19898,7 @@ function costInPoints(cents, rate) {
19862
19898
  }
19863
19899
 
19864
19900
  // src/Enrich.tsx
19865
- import { useCallback as useCallback19, useEffect as useEffect45, useMemo as useMemo29, useState as useState59 } from "react";
19901
+ import { useCallback as useCallback19, useEffect as useEffect45, useMemo as useMemo30, useState as useState59 } from "react";
19866
19902
  import {
19867
19903
  useFields as useFields8,
19868
19904
  useRecordsClient as useRecordsClient34,
@@ -20009,11 +20045,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
20009
20045
  useEffect45(() => {
20010
20046
  void load();
20011
20047
  }, [load]);
20012
- const shown5 = useMemo29(
20048
+ const shown5 = useMemo30(
20013
20049
  () => fieldId ? (rows ?? []).filter((r) => r.field_id === fieldId) : rows ?? [],
20014
20050
  [rows, fieldId]
20015
20051
  );
20016
- const fieldByKey = useMemo29(() => {
20052
+ const fieldByKey = useMemo30(() => {
20017
20053
  const map = /* @__PURE__ */ new Map();
20018
20054
  for (const f of fields.data ?? []) map.set(f.key, f);
20019
20055
  return map;
@@ -20663,7 +20699,7 @@ function withTypeMark(field2, header) {
20663
20699
  }
20664
20700
 
20665
20701
  // src/ReverseColumns.tsx
20666
- import { useCallback as useCallback20, useEffect as useEffect46, useMemo as useMemo30, useRef as useRef30, useState as useState60, useSyncExternalStore as useSyncExternalStore4 } from "react";
20702
+ import { useCallback as useCallback20, useEffect as useEffect46, useMemo as useMemo31, useRef as useRef30, useState as useState60, useSyncExternalStore as useSyncExternalStore4 } from "react";
20667
20703
  import { isReverseField } from "@ai-matrx/records";
20668
20704
 
20669
20705
  // src/groupReads.ts
@@ -20677,7 +20713,7 @@ import {
20677
20713
  } from "@ai-matrx/records/first-page";
20678
20714
 
20679
20715
  // src/ReverseColumns.tsx
20680
- import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient12, useReverseColumns as useReverseColumns3, useReverseLinks, useTable as useTable7 } from "@ai-matrx/records/react";
20716
+ import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient13, useReverseColumns as useReverseColumns3, useReverseLinks, useTable as useTable7 } from "@ai-matrx/records/react";
20681
20717
  import { Button as Button41, Dialog as Dialog14, DialogContent as DialogContent14, DialogHeader as DialogHeader14, DialogTitle as DialogTitle14, Popover as Popover9, PopoverContent as PopoverContent9, PopoverTrigger as PopoverTrigger9, Separator as Separator4, Skeleton as Skeleton7, cn as cn37 } from "@ai-matrx/design-system";
20682
20718
  import { Fragment as Fragment20, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
20683
20719
  function reverseColumnId(column) {
@@ -20730,8 +20766,8 @@ function ReverseAllLinks({
20730
20766
  first,
20731
20767
  total
20732
20768
  }) {
20733
- const ids = useMemo30(() => [recordId], [recordId]);
20734
- const one = useMemo30(() => [column], [column]);
20769
+ const ids = useMemo31(() => [recordId], [recordId]);
20770
+ const one = useMemo31(() => [column], [column]);
20735
20771
  const read = useReverseLinks(tableId, one, ids, 50);
20736
20772
  const answer = read.data?.[column.key]?.[recordId];
20737
20773
  const refs = answer ? refsOf(column, answer) : first;
@@ -20749,10 +20785,10 @@ function ReverseAllLinks({
20749
20785
  function useReverseGridColumns(tableId, rowIds) {
20750
20786
  const reverse = useReverseColumns3(tableId);
20751
20787
  const columns = useStableColumns(reverse.data);
20752
- const ids = useMemo30(() => rowIds.filter((id) => id !== SUMMARY_ROW_ID && id !== ADD_ROW_ID), [rowIds]);
20788
+ const ids = useMemo31(() => rowIds.filter((id) => id !== SUMMARY_ROW_ID && id !== ADD_ROW_ID), [rowIds]);
20753
20789
  const links = useReverseLinks(tableId, columns, ids, REVERSE_CELL_CHIPS);
20754
20790
  const held = useLinksStore(links.data, links.loading);
20755
- return useMemo30(
20791
+ return useMemo31(
20756
20792
  () => columns.length === 0 ? NO_GRID_COLUMNS : columns.map((column) => ({
20757
20793
  id: reverseColumnId(column),
20758
20794
  // Decided before the first paint, as every column's is (`columnWidths.ts`).
@@ -20816,7 +20852,7 @@ function openReverseCell(rowId, columnId2) {
20816
20852
  return true;
20817
20853
  }
20818
20854
  function useReverseField(tableId, column) {
20819
- const client = useOptionalRecordsClient12();
20855
+ const client = useOptionalRecordsClient13();
20820
20856
  const [field2, setField] = useState60(null);
20821
20857
  useEffect46(() => {
20822
20858
  if (column.read_only || !client) return;
@@ -20831,10 +20867,10 @@ function useReverseField(tableId, column) {
20831
20867
  return field2;
20832
20868
  }
20833
20869
  function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
20834
- const client = useOptionalRecordsClient12();
20870
+ const client = useOptionalRecordsClient13();
20835
20871
  const field2 = useReverseField(tableId, column);
20836
- const ids = useMemo30(() => [recordId], [recordId]);
20837
- const one = useMemo30(() => [column], [column]);
20872
+ const ids = useMemo31(() => [recordId], [recordId]);
20873
+ const one = useMemo31(() => [column], [column]);
20838
20874
  const read = useReverseLinks(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
20839
20875
  const answer = read.data?.[column.key]?.[recordId];
20840
20876
  const [refused, setRefused] = useState60(null);
@@ -20908,8 +20944,8 @@ function ReverseLinksSections({ tableId, recordId }) {
20908
20944
  }
20909
20945
  function ReverseLinksSection({ tableId, recordId, column }) {
20910
20946
  const [shown5, setShown] = useState60(REVERSE_PANEL_PAGE);
20911
- const ids = useMemo30(() => [recordId], [recordId]);
20912
- const one = useMemo30(() => [column], [column]);
20947
+ const ids = useMemo31(() => [recordId], [recordId]);
20948
+ const one = useMemo31(() => [column], [column]);
20913
20949
  const first = useReverseLinks(tableId, one, ids, Math.min(shown5, 50));
20914
20950
  const answer = first.data?.[column.key]?.[recordId];
20915
20951
  const [adding, setAdding] = useState60(false);
@@ -21297,7 +21333,7 @@ function confirmLabel(plan, noun, nounPlural) {
21297
21333
 
21298
21334
  // src/RecordActionMenu.tsx
21299
21335
  import { copyText } from "@ai-matrx/kit/clipboard";
21300
- import { useCallback as useCallback21, useMemo as useMemo31, useState as useState62 } from "react";
21336
+ import { useCallback as useCallback21, useMemo as useMemo32, useState as useState62 } from "react";
21301
21337
  import { useFields as useFields10, useRecordsClient as useRecordsClient35, useTable as useTable8 } from "@ai-matrx/records/react";
21302
21338
  import {
21303
21339
  ContextMenu,
@@ -21449,7 +21485,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
21449
21485
  const navigate = host.navigate;
21450
21486
  const href = host.hrefForRecord && table.data ? host.hrefForRecord({ table: table.data, recordId: row.id }) : void 0;
21451
21487
  const fieldList = fields.data;
21452
- return useMemo31(() => {
21488
+ return useMemo32(() => {
21453
21489
  const said2 = (sentence2) => notify?.success(sentence2);
21454
21490
  return {
21455
21491
  ...typeof window !== "undefined" ? { origin: window.location.origin } : {},
@@ -21561,8 +21597,8 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
21561
21597
  const openSplit = useCallback21(() => setSplitting(true), []);
21562
21598
  const openExtract = useCallback21(() => setExtracting(true), []);
21563
21599
  const actionHost = useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge: openMerge, onSplit: openSplit, onExtractParent: openExtract });
21564
- const rights = useMemo31(() => whatYouMayDo(row.level || null, true), [row.level]);
21565
- const actions = useMemo31(
21600
+ const rights = useMemo32(() => whatYouMayDo(row.level || null, true), [row.level]);
21601
+ const actions = useMemo32(
21566
21602
  () => recordActions({ record: { id: row.id, tableId, name }, rights, host: actionHost }),
21567
21603
  [row.id, tableId, name, rights, actionHost]
21568
21604
  );
@@ -21695,7 +21731,7 @@ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf, navigat
21695
21731
  }
21696
21732
 
21697
21733
  // src/ImportWizard.tsx
21698
- import { useCallback as useCallback22, useEffect as useEffect47, useMemo as useMemo32, useState as useState63 } from "react";
21734
+ import { useCallback as useCallback22, useEffect as useEffect47, useMemo as useMemo33, useState as useState63 } from "react";
21699
21735
  import { useFields as useFields11, useRecordsClient as useRecordsClient36, useTable as useTable9 } from "@ai-matrx/records/react";
21700
21736
  import {
21701
21737
  importCsv,
@@ -22170,17 +22206,17 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22170
22206
  },
22171
22207
  [client, openRun]
22172
22208
  );
22173
- const declared2 = useMemo32(() => fields.data ?? [], [fields.data]);
22209
+ const declared2 = useMemo33(() => fields.data ?? [], [fields.data]);
22174
22210
  const titleKey = table.data?.title_field ?? null;
22175
22211
  const titleHeader = titleFrom ?? (titleKey ? Object.entries(mapping).find(([h, key]) => key === titleKey && h !== TITLE_COPY)?.[0] ?? null : null);
22176
- const distinctRows = useMemo32(() => {
22212
+ const distinctRows = useMemo33(() => {
22177
22213
  const headers = (plan?.columns ?? []).map((c) => c.header).filter((h) => !leftOut.has(h));
22178
22214
  const exact = new Set(exactDuplicateRows(rows, headers).map((r) => r.row));
22179
22215
  return exact.size === 0 ? rows : rows.filter((_, i) => !exact.has(i));
22180
22216
  }, [rows, plan, leftOut]);
22181
- const titleStats = useMemo32(() => titleHeader ? titleRepeats(distinctRows, titleHeader) : null, [distinctRows, titleHeader]);
22217
+ const titleStats = useMemo33(() => titleHeader ? titleRepeats(distinctRows, titleHeader) : null, [distinctRows, titleHeader]);
22182
22218
  const titleRepeating = Boolean(titleStats && titleStats.filled > 0 && titleStats.distinct < titleStats.filled);
22183
- const notIdentity = useMemo32(() => {
22219
+ const notIdentity = useMemo33(() => {
22184
22220
  const out = /* @__PURE__ */ new Set();
22185
22221
  for (const c of plan?.columns ?? []) {
22186
22222
  const k = importKindOfPlan(c.type);
@@ -22188,12 +22224,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22188
22224
  }
22189
22225
  return out;
22190
22226
  }, [plan, distinctRows]);
22191
- const combineDefault = useMemo32(
22227
+ const combineDefault = useMemo33(
22192
22228
  () => titleRepeating && titleHeader && sameRecordLikely(distinctRows, titleHeader, notIdentity) ? "combine" : "each",
22193
22229
  [distinctRows, titleHeader, titleRepeating, notIdentity]
22194
22230
  );
22195
22231
  const combining = titleRepeating && (combine ?? combineDefault) === "combine";
22196
- const combined = useMemo32(() => combining && titleHeader ? combineRows(rows, titleHeader) : null, [combining, rows, titleHeader]);
22232
+ const combined = useMemo33(() => combining && titleHeader ? combineRows(rows, titleHeader) : null, [combining, rows, titleHeader]);
22197
22233
  const effectiveRows = combined?.rows ?? rows;
22198
22234
  useEffect47(() => {
22199
22235
  if (dedupeChosen) return;
@@ -22330,7 +22366,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22330
22366
  if (!choiceKeysToRead) return;
22331
22367
  void readChoices(mappedChoiceFields.filter((f) => choiceKeysToRead.split(",").includes(f.key)));
22332
22368
  }, [choiceKeysToRead, readChoices]);
22333
- const newChoiceWords = useMemo32(() => {
22369
+ const newChoiceWords = useMemo33(() => {
22334
22370
  const out = [];
22335
22371
  for (const [header, key] of Object.entries(mapping)) {
22336
22372
  const field2 = declared2.find((f) => f.key === key);
@@ -22365,7 +22401,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22365
22401
  },
22366
22402
  [client, choiceIndex, readChoices]
22367
22403
  );
22368
- const mappedRelations = useMemo32(() => {
22404
+ const mappedRelations = useMemo33(() => {
22369
22405
  const out = [];
22370
22406
  for (const [header, key] of Object.entries(mapping)) {
22371
22407
  const field2 = declared2.find((f) => f.key === key);
@@ -22405,7 +22441,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22405
22441
  }
22406
22442
  void readRelationNames(mappedRelations);
22407
22443
  }, [relationSignature, readRelationNames]);
22408
- const relationAsks = useMemo32(() => {
22444
+ const relationAsks = useMemo33(() => {
22409
22445
  return mappedRelations.flatMap(({ header, field: field2 }) => {
22410
22446
  const index = relationIndex.get(field2.key);
22411
22447
  if (!index) return [];
@@ -22432,7 +22468,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22432
22468
  }, [mappedRelations, relationIndex, effectiveRows]);
22433
22469
  const choiceFor = (key) => unlinkedChoice[key] ?? { unmatched: "skip", ambiguous: "skip" };
22434
22470
  const makesColumns = unmapped === "create" && rights.admin;
22435
- const guessedKind = useMemo32(() => {
22471
+ const guessedKind = useMemo33(() => {
22436
22472
  const out = {};
22437
22473
  for (const c of plan?.columns ?? []) {
22438
22474
  const k = importKindOfPlan(c.type);
@@ -22444,7 +22480,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22444
22480
  }, [plan, effectiveRows, combined]);
22445
22481
  const kindOf = (header) => kindChoice[header] ?? guessedKind[header] ?? null;
22446
22482
  const newColumns = (plan?.columns ?? []).filter((c) => !leftOut.has(c.header) && !(c.header in mapping));
22447
- const dateAsks = useMemo32(() => {
22483
+ const dateAsks = useMemo33(() => {
22448
22484
  const out = [];
22449
22485
  for (const c of plan?.columns ?? []) {
22450
22486
  if (leftOut.has(c.header)) continue;
@@ -22460,12 +22496,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22460
22496
  }
22461
22497
  return out;
22462
22498
  }, [plan, leftOut, mapping, declared2, effectiveRows, makesColumns, kindChoice, guessedKind]);
22463
- const repeats = useMemo32(
22499
+ const repeats = useMemo33(
22464
22500
  () => exactDuplicateRows(effectiveRows, (plan?.columns ?? []).map((c) => c.header).filter((h) => !leftOut.has(h))),
22465
22501
  [effectiveRows, plan, leftOut]
22466
22502
  );
22467
22503
  const [goAheadAnyway, setGoAheadAnyway] = useState63(false);
22468
- const refusedCells = useMemo32(
22504
+ const refusedCells = useMemo33(
22469
22505
  () => goAheadAnyway ? refusedCellsOf(declared2, effectiveRows, mapping, choiceIndex, relationIndex) : [],
22470
22506
  [goAheadAnyway, declared2, effectiveRows, mapping, choiceIndex, relationIndex]
22471
22507
  );
@@ -22712,7 +22748,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22712
22748
  onWrote?.(finished.data.rows_written);
22713
22749
  void loadRuns();
22714
22750
  }, [newColumns, makesColumns, kindChoice, guessedKind, addChoiceWords, client, dedupeKey, effectiveRows, fileBytes, fileHash, fileName, format, leftOut, loadRuns, mappedRelations, mapping, newChoiceWords, nudge, onDuplicate, onWrote, plan, readRelationNames, refusedCells, relationAsks, relationIndex, rights.admin, rowsToSend, tableId, unmapped, unlinkedChoice]);
22715
- const counts = useMemo32(() => {
22751
+ const counts = useMemo33(() => {
22716
22752
  let landed = 0;
22717
22753
  let duplicate = 0;
22718
22754
  let refused = 0;
@@ -22723,7 +22759,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22723
22759
  }
22724
22760
  return { landed, duplicate, refused };
22725
22761
  }, [outcomes]);
22726
- const interesting = useMemo32(
22762
+ const interesting = useMemo33(
22727
22763
  () => outcomes.filter((o) => show === "all" ? o.outcome !== "landed" : o.outcome === show),
22728
22764
  [outcomes, show]
22729
22765
  );
@@ -22734,11 +22770,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22734
22770
  const titleMissing = Boolean(titleKey) && titleTakesWords && titleMappedTo === null;
22735
22771
  const titleFieldLabel = (titleKey ? plan?.fields.find((f) => f.key === titleKey)?.label : null) || (titleKey ? declared2.find((f) => f.key === titleKey)?.label : null) || "the name column";
22736
22772
  const busy = phase === "reading" || phase === "planning" || phase === "linking" || phase === "declaring" || phase === "writing";
22737
- const ruleVerdicts = useMemo32(
22773
+ const ruleVerdicts = useMemo33(
22738
22774
  () => checkImportRules(declared2, effectiveRows, mapping, choiceIndex, relationIndex),
22739
22775
  [declared2, effectiveRows, mapping, choiceIndex, relationIndex]
22740
22776
  );
22741
- const ruleVerdictOf = useMemo32(() => new Map(ruleVerdicts.map((v) => [v.header, v])), [ruleVerdicts]);
22777
+ const ruleVerdictOf = useMemo33(() => new Map(ruleVerdicts.map((v) => [v.header, v])), [ruleVerdicts]);
22742
22778
  const refusedByRules = ruleVerdicts.reduce((n, v) => n + v.refused, 0);
22743
22779
  const verdictKey = ruleVerdicts.map((v) => `${v.header}:${v.refused}/${v.judged}`).join("|");
22744
22780
  useEffect47(() => setGoAheadAnyway(false), [verdictKey]);
@@ -24247,7 +24283,7 @@ function SortPanel({
24247
24283
  import { pageSortFor as pageSortFor2, pageSortsFor, thenSortsOf } from "@ai-matrx/records/first-page";
24248
24284
 
24249
24285
  // src/gridValueFilter.ts
24250
- import { useMemo as useMemo33, useRef as useRef31 } from "react";
24286
+ import { useMemo as useMemo34, useRef as useRef31 } from "react";
24251
24287
  var LONGEST_LISTABLE = 300;
24252
24288
  var MOST_VALUES = 500;
24253
24289
  function valueListKind(field2) {
@@ -24358,14 +24394,14 @@ async function askColumnValues(inputs, args) {
24358
24394
  function useStoreValueFacets(enabled, inputs) {
24359
24395
  const latest = useRef31(inputs);
24360
24396
  latest.current = inputs;
24361
- return useMemo33(
24397
+ return useMemo34(
24362
24398
  () => enabled ? { source: (args) => askColumnValues(latest.current, args) } : void 0,
24363
24399
  [enabled]
24364
24400
  );
24365
24401
  }
24366
24402
 
24367
24403
  // src/gridGrouping.tsx
24368
- import { useEffect as useEffect49, useMemo as useMemo34, useState as useState66 } from "react";
24404
+ import { useEffect as useEffect49, useMemo as useMemo35, useState as useState66 } from "react";
24369
24405
  import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
24370
24406
  import { measureKey as measureKey2 } from "@ai-matrx/records";
24371
24407
  import { jsx as jsx82, jsxs as jsxs73 } from "react/jsx-runtime";
@@ -24465,7 +24501,7 @@ function groupFactsFor(facts, fields, chosen) {
24465
24501
  }
24466
24502
  function useGroupLabel(fields, groupKey, thenKeys = []) {
24467
24503
  const thenJoined = thenKeys.join("|");
24468
- return useMemo34(() => {
24504
+ return useMemo35(() => {
24469
24505
  const keys = groupKey ? [groupKey, ...thenJoined ? thenJoined.split("|") : []] : [];
24470
24506
  return (group) => {
24471
24507
  const key = keys[group.ancestors?.length ?? 0] ?? groupKey;
@@ -24476,7 +24512,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
24476
24512
  }
24477
24513
 
24478
24514
  // src/gridUndo.tsx
24479
- import { useCallback as useCallback23, useEffect as useEffect50, useLayoutEffect as useLayoutEffect4, useMemo as useMemo35, useRef as useRef32, useState as useState67, useSyncExternalStore as useSyncExternalStore5 } from "react";
24515
+ import { useCallback as useCallback23, useEffect as useEffect50, useLayoutEffect as useLayoutEffect4, useMemo as useMemo36, useRef as useRef32, useState as useState67, useSyncExternalStore as useSyncExternalStore5 } from "react";
24480
24516
  import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
24481
24517
  import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
24482
24518
  import { Button as Button46 } from "@ai-matrx/design-system";
@@ -24592,7 +24628,7 @@ function useGridUndo(args) {
24592
24628
  );
24593
24629
  const undo = useCallback23(() => apply("undo"), [apply]);
24594
24630
  const redo = useCallback23(() => apply("redo"), [apply]);
24595
- return useMemo35(
24631
+ return useMemo36(
24596
24632
  () => ({
24597
24633
  push,
24598
24634
  undo,
@@ -24616,7 +24652,7 @@ function useUndoSource(undo) {
24616
24652
  listeners: /* @__PURE__ */ new Set()
24617
24653
  });
24618
24654
  box.current.undo = undo;
24619
- const source = useMemo35(
24655
+ const source = useMemo36(
24620
24656
  () => ({
24621
24657
  face: () => box.current.face,
24622
24658
  subscribe: (listener) => {
@@ -24868,7 +24904,7 @@ function useRowFollowsItsMove(args) {
24868
24904
 
24869
24905
  // src/gridAssist.tsx
24870
24906
  import { copyText as copyText2 } from "@ai-matrx/kit/clipboard";
24871
- import { useCallback as useCallback26, useEffect as useEffect53, useMemo as useMemo36, useRef as useRef35, useState as useState68 } from "react";
24907
+ import { useCallback as useCallback26, useEffect as useEffect53, useMemo as useMemo37, useRef as useRef35, useState as useState68 } from "react";
24872
24908
  import { tableKindSlug, wholeValueOf as wholeValueOf4 } from "@ai-matrx/records/core";
24873
24909
  import { useContentTransferCapabilities } from "@ai-matrx/alchemy/react/workspace";
24874
24910
 
@@ -25010,7 +25046,7 @@ function useGridAssist(args) {
25010
25046
  [tableId, say2]
25011
25047
  );
25012
25048
  const name = table ? tableName(table) : "";
25013
- const refFor = useMemo36(
25049
+ const refFor = useMemo37(
25014
25050
  () => ({
25015
25051
  table: () => ({
25016
25052
  id: `table:${tableId}`,
@@ -25149,7 +25185,7 @@ function useGridAssist(args) {
25149
25185
  }
25150
25186
 
25151
25187
  // src/gridBulk.tsx
25152
- import { useCallback as useCallback27, useMemo as useMemo37, useState as useState69 } from "react";
25188
+ import { useCallback as useCallback27, useMemo as useMemo38, useState as useState69 } from "react";
25153
25189
  import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
25154
25190
  import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
25155
25191
  import {
@@ -25282,7 +25318,7 @@ function BulkActions({
25282
25318
  nounPlural,
25283
25319
  onDone
25284
25320
  }) {
25285
- const typeable = useMemo37(() => fields.filter(fieldIsEditable), [fields]);
25321
+ const typeable = useMemo38(() => fields.filter(fieldIsEditable), [fields]);
25286
25322
  const [asking, setAsking] = useState69(null);
25287
25323
  const [key, setKey] = useState69("");
25288
25324
  const [value, setValue] = useState69(null);
@@ -25388,7 +25424,7 @@ function BulkActions({
25388
25424
  }
25389
25425
 
25390
25426
  // src/handOrder.tsx
25391
- import { useEffect as useEffect54, useMemo as useMemo38, useRef as useRef36, useState as useState70 } from "react";
25427
+ import { useEffect as useEffect54, useMemo as useMemo39, useRef as useRef36, useState as useState70 } from "react";
25392
25428
  import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
25393
25429
  import { stableFilterKey as stableFilterKey2 } from "@ai-matrx/records";
25394
25430
  import { Button as Button48, ConfirmDialog as ConfirmDialog4, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, cn as cn40 } from "@ai-matrx/design-system";
@@ -25559,7 +25595,7 @@ function useHandOrderRows(args) {
25559
25595
  cancelled = true;
25560
25596
  };
25561
25597
  }, [client, viewId, active, limit, offset, key, filterKey, args.version, tick]);
25562
- const rows = useMemo38(() => {
25598
+ const rows = useMemo39(() => {
25563
25599
  if (!active || !viewId || !answer || answer.key !== key) return null;
25564
25600
  if (answer.error) return null;
25565
25601
  return answer.rows;
@@ -25805,12 +25841,12 @@ function GridBody({
25805
25841
  const table = useTable10(tableId);
25806
25842
  const fields = useFields12(tableId);
25807
25843
  const decorations = useTableDecorations(tableId, fields.data);
25808
- const mergedStyle = useMemo39(
25844
+ const mergedStyle = useMemo40(
25809
25845
  () => resolveTableStyle(decorations.data, fields.data ?? [], presentation.style),
25810
25846
  [decorations.data, fields.data, presentation.style]
25811
25847
  );
25812
25848
  const paintedChoices = useChoiceOptions(fields.data ?? [], choiceKeysIn(mergedStyle, fields.data ?? []));
25813
- const paint = useMemo39(
25849
+ const paint = useMemo40(
25814
25850
  () => paintByOption(mergedStyle, fields.data ?? [], paintedChoices, storedChoiceColorLookup(fields.data ?? [], colorFromTheValue)),
25815
25851
  [mergedStyle, fields.data, paintedChoices]
25816
25852
  );
@@ -25832,8 +25868,8 @@ function GridBody({
25832
25868
  const viewSorts = heldOrder?.sorts ?? viewOrder?.sorts ?? [];
25833
25869
  const manual = order === "manual" && viewId !== null;
25834
25870
  const storePaged = merged || tableCard === null && !manual;
25835
- const defaultSort = useMemo39(() => defaultSortOf(table.data, fields.data ?? []), [table.data, fields.data]);
25836
- const viewSort = useMemo39(() => {
25871
+ const defaultSort = useMemo40(() => defaultSortOf(table.data, fields.data ?? []), [table.data, fields.data]);
25872
+ const viewSort = useMemo40(() => {
25837
25873
  const first = viewSorts[0];
25838
25874
  if (!first) return null;
25839
25875
  return (fields.data ?? []).some((f) => f.key === first.field) ? { id: first.field, direction: first.direction } : null;
@@ -25899,7 +25935,7 @@ function GridBody({
25899
25935
  page: query.page
25900
25936
  });
25901
25937
  }, [reportQuery, query.sort, query.columnFilters, query.search, query.page, openingKey]);
25902
- const liveKeys = useMemo39(() => fields.data ? new Set(fields.data.map((f) => f.key)) : null, [fields.data]);
25938
+ const liveKeys = useMemo40(() => fields.data ? new Set(fields.data.map((f) => f.key)) : null, [fields.data]);
25903
25939
  useEffect56(() => {
25904
25940
  if (!liveKeys) return;
25905
25941
  setQuery((held) => withoutGoneColumns(held, liveKeys, openingSort));
@@ -25922,7 +25958,7 @@ function GridBody({
25922
25958
  const timer = setTimeout(() => setSearchTerm(wanted), 250);
25923
25959
  return () => clearTimeout(timer);
25924
25960
  }, [storePaged, query.search, searchTerm]);
25925
- const question = useMemo39(
25961
+ const question = useMemo40(
25926
25962
  () => storePaged ? storeQuestion(fields.data ?? [], filter, query.columnFilters) : { filter, refused: [] },
25927
25963
  [storePaged, fields.data, filter, query.columnFilters]
25928
25964
  );
@@ -25938,7 +25974,7 @@ function GridBody({
25938
25974
  });
25939
25975
  const readFilter = drillState.enabled ? drillState.trailFilter : question.filter;
25940
25976
  const localQuestion = query.search.trim() !== "" || Object.values(query.columnFilters).some((value) => value !== void 0 && value !== null);
25941
- const clearQuestion = useMemo39(() => {
25977
+ const clearQuestion = useMemo40(() => {
25942
25978
  const external = Boolean(filter) && Boolean(onClearFilter);
25943
25979
  if (!localQuestion && !external) return void 0;
25944
25980
  return () => {
@@ -25948,7 +25984,7 @@ function GridBody({
25948
25984
  }, [localQuestion, filter, onClearFilter]);
25949
25985
  const seatedSort = seatedOn === openingKey ? query.sort : addressSort.current ?? openingSort;
25950
25986
  const rowGroupKey = merged && !drillState.enabled ? presentation.grouping?.field ?? null : null;
25951
- const thenSorts = useMemo39(() => {
25987
+ const thenSorts = useMemo40(() => {
25952
25988
  if (!seatedSort || manual) return [];
25953
25989
  const list = fields.data ?? [];
25954
25990
  const unsortable = (f) => sortRefusal(f) !== null;
@@ -25957,7 +25993,7 @@ function GridBody({
25957
25993
  }, [seatedSort, manual, fields.data, heldThen, viewSorts]);
25958
25994
  const thenKey = JSON.stringify(thenSorts);
25959
25995
  const groupThenKeys = rowGroupKey ? (presentation.grouping?.then ?? []).map((t) => t.field).join("|") : "";
25960
- const pageSort = useMemo39(
25996
+ const pageSort = useMemo40(
25961
25997
  () => {
25962
25998
  if (!storePaged) return [];
25963
25999
  const sorted = groupedPageSort(fields.data ?? [], rowGroupKey, pageSortsFor(fields.data ?? [], seatedSort, thenSorts));
@@ -25968,7 +26004,7 @@ function GridBody({
25968
26004
  // eslint-disable-next-line react-hooks/exhaustive-deps -- thenKey stands for thenSorts
25969
26005
  [storePaged, fields.data, seatedSort, rowGroupKey, thenKey, groupThenKeys]
25970
26006
  );
25971
- const fullSorts = useMemo39(
26007
+ const fullSorts = useMemo40(
25972
26008
  () => seatedSort ? [{ field: seatedSort.id, direction: seatedSort.direction }, ...thenSorts] : [],
25973
26009
  // eslint-disable-next-line react-hooks/exhaustive-deps -- thenKey stands for thenSorts
25974
26010
  [seatedSort, thenKey]
@@ -25987,7 +26023,7 @@ function GridBody({
25987
26023
  const pageAskedFor = useRef37(null);
25988
26024
  if (fields.data && !table.loading) pageAskedFor.current = tableId;
25989
26025
  const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
25990
- const numberAsked = useMemo39(() => autonumberSearchOf(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
26026
+ const numberAsked = useMemo40(() => autonumberSearchOf(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
25991
26027
  const pageSearch = numberAsked ? "" : searchTerm;
25992
26028
  const pageFilter = numberAsked ? filterWithAutonumber(readFilter, numberAsked.field, numberAsked.number) : readFilter;
25993
26029
  const serverRead = useRecordPage(storePaged && pageAsked ? tableId : null, {
@@ -25999,7 +26035,7 @@ function GridBody({
25999
26035
  viewId: manual && pageSort.length === 0 ? viewId : null
26000
26036
  });
26001
26037
  const records = storePaged ? serverRead : classicRead;
26002
- const storeRows = useMemo39(() => records.data?.rows ?? [], [records.data]);
26038
+ const storeRows = useMemo40(() => records.data?.rows ?? [], [records.data]);
26003
26039
  const hand = useHandOrderRows({
26004
26040
  viewId,
26005
26041
  active: manual && !storePaged,
@@ -26021,7 +26057,7 @@ function GridBody({
26021
26057
  setAppendedPhysicalPages(0);
26022
26058
  setAppending(false);
26023
26059
  }, [askKey2]);
26024
- const pageRows = useMemo39(() => {
26060
+ const pageRows = useMemo40(() => {
26025
26061
  if (manual && !storePaged) return hand.rows ?? [];
26026
26062
  if (!embeddedMore || appendedRows.length === 0) return storeRows;
26027
26063
  const seen = new Set(storeRows.map((row) => row.id));
@@ -26056,7 +26092,7 @@ function GridBody({
26056
26092
  });
26057
26093
  const rows = added.rows;
26058
26094
  const lockedRows = records.data?.locked ?? 0;
26059
- const rowIds = useMemo39(() => rows.map((row) => row.id), [rows]);
26095
+ const rowIds = useMemo40(() => rows.map((row) => row.id), [rows]);
26060
26096
  const rowsShownRef = useRef37(onRowsShown);
26061
26097
  rowsShownRef.current = onRowsShown;
26062
26098
  useEffect56(() => {
@@ -26128,7 +26164,7 @@ function GridBody({
26128
26164
  });
26129
26165
  const editingNow = useRef37(editing);
26130
26166
  editingNow.current = editing;
26131
- const editingHandle = useMemo39(
26167
+ const editingHandle = useMemo40(
26132
26168
  () => new Proxy({}, {
26133
26169
  get: (_target, key) => editingNow.current[key]
26134
26170
  }),
@@ -26174,11 +26210,11 @@ function GridBody({
26174
26210
  const [localLook, setLocalLook] = useState72(null);
26175
26211
  const [localSummaries, setLocalSummaries] = useState72(null);
26176
26212
  const titleKey = table.data?.title_field ?? null;
26177
- const sortedKeys = useMemo39(
26213
+ const sortedKeys = useMemo40(
26178
26214
  () => lookColumnKeys([...fields.data ?? []].sort(compareFieldOrder).map((f) => f.key), titleKey),
26179
26215
  [fields.data, titleKey]
26180
26216
  );
26181
- const look = useMemo39(() => {
26217
+ const look = useMemo40(() => {
26182
26218
  const own3 = {
26183
26219
  rowHeight: presentation.rowHeight,
26184
26220
  frozen: presentation.frozen,
@@ -26191,9 +26227,9 @@ function GridBody({
26191
26227
  }, [presentation, localLook, storeLayout.layout, sortedKeys]);
26192
26228
  const frozenList = look.frozen;
26193
26229
  const lines = rowLines(look.rowHeight);
26194
- const wrapColumnSet = useMemo39(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
26195
- const frozenKeys = useMemo39(() => new Set(frozenList), [frozenList]);
26196
- const ordered = useMemo39(() => {
26230
+ const wrapColumnSet = useMemo40(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
26231
+ const frozenKeys = useMemo40(() => new Set(frozenList), [frozenList]);
26232
+ const ordered = useMemo40(() => {
26197
26233
  const all = [...fields.data ?? []].sort(compareFieldOrder);
26198
26234
  if (frozenKeys.size === 0) return all;
26199
26235
  const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
@@ -26243,7 +26279,7 @@ function GridBody({
26243
26279
  const offerSelection = !embedded && !readOnly && canWrite && (merged || tableActions2.runnable.length > 0);
26244
26280
  const [reordering, setReordering] = useState72(false);
26245
26281
  const chosenSummaries = localSummaries ?? presentation.summaries ?? NO_SUMMARIES;
26246
- const summaryVersion = useMemo39(
26282
+ const summaryVersion = useMemo40(
26247
26283
  () => (
26248
26284
  // A read that has not asked yet (or is still asking) holds no answer: its empty page is not one.
26249
26285
  // The store's page always names its total, so a paged answer without one has not arrived yet.
@@ -26305,7 +26341,7 @@ function GridBody({
26305
26341
  },
26306
26342
  [client, fields.data, host, records, table.data, tableId, merged, added, manual, viewId, rows, viewOrder, hand, undo]
26307
26343
  );
26308
- const recordIds = useMemo39(() => rows.map((r) => r.id), [rows]);
26344
+ const recordIds = useMemo40(() => rows.map((r) => r.id), [rows]);
26309
26345
  const { cells: enrichCells, refresh: refreshEnrich } = useEnrichCells(tableId, recordIds);
26310
26346
  const pinCell = useCallback28(
26311
26347
  async (recordId, fieldKey, pinned) => {
@@ -26353,7 +26389,7 @@ function GridBody({
26353
26389
  },
26354
26390
  [client]
26355
26391
  );
26356
- const pasteableKeys = useMemo39(
26392
+ const pasteableKeys = useMemo40(
26357
26393
  () => ordered.filter((f) => fieldIsEditable(f)).map((f) => f.key),
26358
26394
  [ordered]
26359
26395
  );
@@ -26654,7 +26690,7 @@ function GridBody({
26654
26690
  records.reload();
26655
26691
  return { written, readBack, missing, refusals };
26656
26692
  }, [pastePlan, client, tableId, records, merged, applyPasteAsOne, versions, fields.data]);
26657
- const columnIds = useMemo39(() => ordered.map((field2) => field2.key), [ordered]);
26693
+ const columnIds = useMemo40(() => ordered.map((field2) => field2.key), [ordered]);
26658
26694
  const lookWrites = useRef37(null);
26659
26695
  const writeLook = useCallback28(
26660
26696
  (next) => {
@@ -26704,7 +26740,7 @@ function GridBody({
26704
26740
  [host, tableId, table.data, fields.data]
26705
26741
  );
26706
26742
  const hiddenKeys = presentation.hiddenFields;
26707
- const shownKeys = useMemo39(
26743
+ const shownKeys = useMemo40(
26708
26744
  () => hiddenKeys && hiddenKeys.length > 0 ? columnIds.filter((k) => !hiddenKeys.includes(k)) : columnIds,
26709
26745
  [columnIds, hiddenKeys]
26710
26746
  );
@@ -26875,7 +26911,7 @@ function GridBody({
26875
26911
  for (const row of rows) for (const id of idsOf(row.document?.[field2.key])) labels(field2, id);
26876
26912
  }
26877
26913
  }, [ordered, rows, labels]);
26878
- const fieldColumns = useMemo39(
26914
+ const fieldColumns = useMemo40(
26879
26915
  () => ordered.map((field2) => {
26880
26916
  const column = {
26881
26917
  ...columnForField(
@@ -26949,11 +26985,11 @@ function GridBody({
26949
26985
  };
26950
26986
  const addColumnNow = useRef37(controls.addColumn);
26951
26987
  addColumnNow.current = controls.addColumn;
26952
- const rowIdsOnScreen = useMemo39(() => rows.map((row) => row.id), [rows]);
26988
+ const rowIdsOnScreen = useMemo40(() => rows.map((row) => row.id), [rows]);
26953
26989
  const reverseGridColumns = useReverseGridColumns(tableId, rowIdsOnScreen);
26954
- const subField = useMemo39(() => subItemsField(fields.data, tableId), [fields.data, tableId]);
26990
+ const subField = useMemo40(() => subItemsField(fields.data, tableId), [fields.data, tableId]);
26955
26991
  const [collapsedSub, setCollapsedSub] = useState72(() => /* @__PURE__ */ new Set());
26956
- const subTree = useMemo39(
26992
+ const subTree = useMemo40(
26957
26993
  () => subField && !rowGroupKey ? subItemTree(rows, subField.key, collapsedSub) : null,
26958
26994
  [subField, rowGroupKey, rows, collapsedSub]
26959
26995
  );
@@ -26980,11 +27016,11 @@ function GridBody({
26980
27016
  },
26981
27017
  [client, subField, tableId]
26982
27018
  );
26983
- const treeColumns = useMemo39(
27019
+ const treeColumns = useMemo40(
26984
27020
  () => withSubItems(fieldColumns, subTree, collapsedSub, toggleSub, mayAddRow && subTree ? (id) => void addSubItem(id) : void 0),
26985
27021
  [fieldColumns, subTree, collapsedSub, toggleSub, mayAddRow, addSubItem]
26986
27022
  );
26987
- const bodyColumns = useMemo39(
27023
+ const bodyColumns = useMemo40(
26988
27024
  () => withAddRowCells(
26989
27025
  withSummaryCells(
26990
27026
  // THE ONE WAY A ROW OPENS ITS RECORD (VERIFIER-17): an Open control on the first cell,
@@ -27013,7 +27049,7 @@ function GridBody({
27013
27049
  const isRowSelectable = useCallback28((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
27014
27050
  const viewRowsNow = useRef37([]);
27015
27051
  viewRowsNow.current = rows.filter((row) => row.id !== SUMMARY_ROW.id);
27016
- const copyConfig = useMemo39(
27052
+ const copyConfig = useMemo40(
27017
27053
  () => table.data ? gridCopyConfig({
27018
27054
  tableId,
27019
27055
  tableName: tableName(table.data),
@@ -27025,7 +27061,7 @@ function GridBody({
27025
27061
  }) : null,
27026
27062
  [tableId, table.data, ordered, labelFor, merged]
27027
27063
  );
27028
- const tableStyleProp = useMemo39(
27064
+ const tableStyleProp = useMemo40(
27029
27065
  () => tableStyleIsEmpty2(paint.style) ? null : {
27030
27066
  style: paint.style,
27031
27067
  // A choice is read as its OPTION (`paintByOption`): the rule, the value and the
@@ -27043,7 +27079,7 @@ function GridBody({
27043
27079
  const hasTalk = Boolean(host.talkToRecord);
27044
27080
  const hasAgent = Boolean(host.runAgentAction);
27045
27081
  const mayManageActions = !readOnly && rights.structure;
27046
- const actionsHeader = useMemo39(
27082
+ const actionsHeader = useMemo40(
27047
27083
  () => /* @__PURE__ */ jsx88(ActionsHeaderControls, { ...mayManageActions ? { onAddColumn: () => addColumnNow.current() } : {} }),
27048
27084
  [mayManageActions]
27049
27085
  );
@@ -27115,8 +27151,8 @@ function GridBody({
27115
27151
  );
27116
27152
  const headerHeld = useRef37(/* @__PURE__ */ new Map());
27117
27153
  const menuLatest = useRef37(/* @__PURE__ */ new Map());
27118
- const addColumnDef = useMemo39(() => addColumnColumn(() => addColumnNow.current()), []);
27119
- const drawnColumns = useMemo39(
27154
+ const addColumnDef = useMemo40(() => addColumnColumn(() => addColumnNow.current()), []);
27155
+ const drawnColumns = useMemo40(
27120
27156
  () => {
27121
27157
  const filterFor = controls.filterFor;
27122
27158
  const drawn = withHeaderMenus(
@@ -27132,7 +27168,7 @@ function GridBody({
27132
27168
  const columnsHeld = useRef37(null);
27133
27169
  const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
27134
27170
  columnsHeld.current = columns;
27135
- const tableColumns = useMemo39(
27171
+ const tableColumns = useMemo40(
27136
27172
  () => offersRowActions ? [...columns, { id: "custom-actions", header: merged ? /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-0.5", children: [
27137
27173
  /* @__PURE__ */ jsx88("span", { children: "Actions" }),
27138
27174
  actionsHeader
@@ -27155,7 +27191,7 @@ function GridBody({
27155
27191
  [presentation, writeLook]
27156
27192
  );
27157
27193
  const widths = localWidths ?? presentation.widths;
27158
- const columnState = useMemo39(
27194
+ const columnState = useMemo40(
27159
27195
  () => ({
27160
27196
  // THE CLASSIC GRID OBEYS THE VIEW TOO (CHAIR-GRID-LINKS 07): with no merged controls the kept
27161
27197
  // `presentation.hiddenFields` / `columnOrder` still decide what is drawn.
@@ -27177,7 +27213,7 @@ function GridBody({
27177
27213
  }),
27178
27214
  [columnIds, localColumns, widths, presentation, writeLook, controls.columns, fields.data]
27179
27215
  );
27180
- const groupingConfig = useMemo39(() => {
27216
+ const groupingConfig = useMemo40(() => {
27181
27217
  const view = presentation.grouping;
27182
27218
  const field2 = view?.field ?? null;
27183
27219
  if (field2 === null && !onPresentationChange) return null;
@@ -27236,7 +27272,7 @@ function GridBody({
27236
27272
  };
27237
27273
  }, [presentation, onPresentationChange, writeLook, merged, phone, groupFacts, groupLabel2, fields.data, chosenSummaries]);
27238
27274
  const queryTotal = records.data?.total ?? rows.length;
27239
- const tableQuery = useMemo39(
27275
+ const tableQuery = useMemo40(
27240
27276
  () => storePaged ? {
27241
27277
  // THE STORE ANSWERS THE QUERY (tranche 6k; every paged grid since B3-06): `data` is the page.
27242
27278
  mode: "controlled",
@@ -27261,14 +27297,14 @@ function GridBody({
27261
27297
  showAddLine ? added.busy : null,
27262
27298
  showSummaryLine ? [chosenSummaries, summaries.values, summaries.rowCount, summaries.loading] : null
27263
27299
  ]);
27264
- const footerRows = useMemo39(
27300
+ const footerRows = useMemo40(
27265
27301
  () => [...showAddLine ? [ADD_ROW] : [], ...showSummaryLine ? [SUMMARY_ROW] : []],
27266
27302
  // `footerFace`, `ordered` and the summaries' operations are what the footer's cells draw.
27267
27303
  // eslint-disable-next-line react-hooks/exhaustive-deps
27268
27304
  [showAddLine, showSummaryLine, footerFace, ordered, summaries.operations, summaries.askOperations]
27269
27305
  );
27270
27306
  const coverageTotal = typeof records.data?.total === "number" ? records.data.total : null;
27271
- const tableCoverage = useMemo39(
27307
+ const tableCoverage = useMemo40(
27272
27308
  () => ({
27273
27309
  answeredBy: storePaged ? "source" : "client",
27274
27310
  ...storePaged && coverageTotal !== null ? { matched: coverageTotal } : {},
@@ -27281,7 +27317,7 @@ function GridBody({
27281
27317
  sheetNow.current = { merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify };
27282
27318
  const hasNotify = Boolean(host.notify);
27283
27319
  const readOnlyReason = !editable || !rights.known || rights.write ? "Editing is off here, so this table can be copied but not changed." : rights.why("write");
27284
- const spreadsheetConfig = useMemo39(
27320
+ const spreadsheetConfig = useMemo40(
27285
27321
  () => canWrite && editable ? {
27286
27322
  enabled: true,
27287
27323
  writableColumnIds: pasteableKeys,
@@ -27353,7 +27389,7 @@ function GridBody({
27353
27389
  [canWrite, editable, pasteableKeys, merged, followSelection, receivePastePlan, hasNotify, readOnlyReason]
27354
27390
  );
27355
27391
  const toolbarFields = fields.data;
27356
- const sortableColumns = useMemo39(
27392
+ const sortableColumns = useMemo40(
27357
27393
  () => (fields.data ?? []).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
27358
27394
  [fields.data]
27359
27395
  );
@@ -27362,7 +27398,7 @@ function GridBody({
27362
27398
  const addRecord = editing.addRecord;
27363
27399
  const phoneSheetTools = merged && phone ? controls.sheetTools : null;
27364
27400
  const narrowSearch = merged && !phone && !embedded && searchBox && toolbarFold2 >= 1;
27365
- const tableToolbar = useMemo39(
27401
+ const tableToolbar = useMemo40(
27366
27402
  () => ({
27367
27403
  // A NARROW ROW KEEPS ITS SEARCH (member walk 2026-10-10: at 1440 px with the chat panel and the
27368
27404
  // sidebar open the search field was folded out of sight). Once the row folds anything, the search
@@ -28119,10 +28155,10 @@ function sortIgnoredOf(answer) {
28119
28155
  // src/RecordsTableCard.tsx
28120
28156
  import { MatrxTableCard, MatrxTableCardEmpty, MatrxTableCardShowMore as MatrxTableCardShowMore2, TABLE_CARD_DEFAULT_INITIAL_ROWS } from "@ai-matrx/design-system/data-table";
28121
28157
  import { Button as Button50 } from "@ai-matrx/design-system";
28122
- import { useFields as useFields13, useOptionalRecordsClient as useOptionalRecordsClient13, useTable as useTable11 } from "@ai-matrx/records/react";
28158
+ import { useFields as useFields13, useOptionalRecordsClient as useOptionalRecordsClient14, useTable as useTable11 } from "@ai-matrx/records/react";
28123
28159
 
28124
28160
  // src/entityTable.tsx
28125
- import { useId as useId2, useMemo as useMemo40 } from "react";
28161
+ import { useId as useId2, useMemo as useMemo41 } from "react";
28126
28162
  import { MatrxDataTable as MatrxDataTable3 } from "@ai-matrx/design-system/data-table";
28127
28163
  import { useRecordsClient as useRecordsClient44 } from "@ai-matrx/records/react";
28128
28164
  import {
@@ -28191,7 +28227,7 @@ function useEntityTable(token2, options = {}) {
28191
28227
  const columns = useEntityColumns(token2);
28192
28228
  const list = useEntityList(token2, entityTableQuery(options));
28193
28229
  const write = useEntityWrite(token2);
28194
- const shown5 = useMemo40(() => entityShownColumns(columns.data ?? []), [columns.data]);
28230
+ const shown5 = useMemo41(() => entityShownColumns(columns.data ?? []), [columns.data]);
28195
28231
  const refused = list.error ?? columns.error ?? type.error;
28196
28232
  const name = entityNameColumn(shown5);
28197
28233
  return {
@@ -28249,8 +28285,8 @@ function EntityGrid({
28249
28285
  editable = true
28250
28286
  }) {
28251
28287
  const canEdit = editable && entity.canUpdate;
28252
- const columns = useMemo40(() => entityTableColumns(entity.columns, canEdit), [entity.columns, canEdit]);
28253
- const byId = useMemo40(() => new Map(entity.columns.map((c) => [columnId(c), c])), [entity.columns]);
28288
+ const columns = useMemo41(() => entityTableColumns(entity.columns, canEdit), [entity.columns, canEdit]);
28289
+ const byId = useMemo41(() => new Map(entity.columns.map((c) => [columnId(c), c])), [entity.columns]);
28254
28290
  return /* @__PURE__ */ jsx89(
28255
28291
  MatrxDataTable3,
28256
28292
  {
@@ -28285,7 +28321,7 @@ function EntityGrid({
28285
28321
  // src/RecordsTableCard.tsx
28286
28322
  import { Fragment as Fragment32, jsx as jsx90, jsxs as jsxs78 } from "react/jsx-runtime";
28287
28323
  function RecordsTableCard(props) {
28288
- const client = useOptionalRecordsClient13();
28324
+ const client = useOptionalRecordsClient14();
28289
28325
  if (!client) {
28290
28326
  return /* @__PURE__ */ jsx90(MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ jsx90(MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
28291
28327
  }
@@ -28635,7 +28671,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
28635
28671
  }
28636
28672
 
28637
28673
  // src/ImportNotice.tsx
28638
- import { useCallback as useCallback29, useEffect as useEffect58, useMemo as useMemo41, useState as useState74 } from "react";
28674
+ import { useCallback as useCallback29, useEffect as useEffect58, useMemo as useMemo42, useState as useState74 } from "react";
28639
28675
  import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
28640
28676
  import { Button as Button52, cn as cn43 } from "@ai-matrx/design-system";
28641
28677
  import { jsx as jsx92, jsxs as jsxs80 } from "react/jsx-runtime";
@@ -28679,7 +28715,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
28679
28715
  live = false;
28680
28716
  };
28681
28717
  }, [client, tableId, epoch]);
28682
- const run = useMemo41(() => runs ? runToNotice(runs) : null, [runs]);
28718
+ const run = useMemo42(() => runs ? runToNotice(runs) : null, [runs]);
28683
28719
  const shown5 = run && !wasDismissed(run.import_id) && dismissed !== run.import_id ? run : null;
28684
28720
  useEffect58(() => {
28685
28721
  if (!shown5 || report?.import_id === shown5.import_id) return;
@@ -28739,7 +28775,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
28739
28775
  }
28740
28776
 
28741
28777
  // src/SaveToTable.tsx
28742
- import { useEffect as useEffect64, useMemo as useMemo45, useRef as useRef40, useState as useState81 } from "react";
28778
+ import { useEffect as useEffect64, useMemo as useMemo46, useRef as useRef40, useState as useState81 } from "react";
28743
28779
  import { useRecordsClient as useRecordsClient53, useMyLevels as useMyLevels3, useTables as useTables3 } from "@ai-matrx/records/react";
28744
28780
  import {
28745
28781
  Button as Button60,
@@ -28797,7 +28833,7 @@ import { withTablePlacement as withTablePlacement2 } from "@ai-matrx/records";
28797
28833
  import { Button as Button59, Skeleton as Skeleton10, cn as cn48 } from "@ai-matrx/design-system";
28798
28834
 
28799
28835
  // src/NewTableStart.tsx
28800
- import { useCallback as useCallback30, useMemo as useMemo42, useRef as useRef38, useState as useState75 } from "react";
28836
+ import { useCallback as useCallback30, useMemo as useMemo43, useRef as useRef38, useState as useState75 } from "react";
28801
28837
  import { tableShapeChanged as tableShapeChanged7, useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
28802
28838
  import {
28803
28839
  BasicInput as BasicInput15,
@@ -29104,8 +29140,8 @@ function NewTableStart({
29104
29140
  const [target, setTarget] = useState75(NEW_TABLE2);
29105
29141
  const [dragging, setDragging] = useState75(false);
29106
29142
  const fileInput = useRef38(null);
29107
- const parsed = useMemo42(() => read ? importFromGrid(read.grid, headerRow) : null, [read, headerRow]);
29108
- const intoTables = useMemo42(
29143
+ const parsed = useMemo43(() => read ? importFromGrid(read.grid, headerRow) : null, [read, headerRow]);
29144
+ const intoTables = useMemo43(
29109
29145
  () => (existingTables ?? []).filter((t) => !t.is_kernel).slice().sort((a, b) => tableName(a).localeCompare(tableName(b))),
29110
29146
  [existingTables]
29111
29147
  );
@@ -29496,7 +29532,7 @@ function NewTableColumns({
29496
29532
 
29497
29533
  // src/BookingSlots.tsx
29498
29534
  import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
29499
- import { useCallback as useCallback33, useEffect as useEffect61, useMemo as useMemo44, useState as useState78 } from "react";
29535
+ import { useCallback as useCallback33, useEffect as useEffect61, useMemo as useMemo45, useState as useState78 } from "react";
29500
29536
  import { useRecordsClient as useRecordsClient50, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
29501
29537
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
29502
29538
  import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47 } from "@ai-matrx/design-system";
@@ -29504,7 +29540,7 @@ import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47
29504
29540
  // src/BookingBuilder.tsx
29505
29541
  import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
29506
29542
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
29507
- import { useCallback as useCallback31, useEffect as useEffect59, useMemo as useMemo43, useRef as useRef39, useState as useState76 } from "react";
29543
+ import { useCallback as useCallback31, useEffect as useEffect59, useMemo as useMemo44, useRef as useRef39, useState as useState76 } from "react";
29508
29544
  import { useFields as useFields15, useRecordsClient as useRecordsClient48, useTable as useTable13 } from "@ai-matrx/records/react";
29509
29545
  import { formatDurationMinutes } from "@ai-matrx/kit/format";
29510
29546
  import {
@@ -29644,12 +29680,12 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
29644
29680
  const [formId, setFormId] = useState76(bookingId ?? null);
29645
29681
  const madeRef = useRef39(null);
29646
29682
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
29647
- const askable = useMemo43(
29683
+ const askable = useMemo44(
29648
29684
  () => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
29649
29685
  [fields.data]
29650
29686
  );
29651
29687
  const unfillable = requiredLeftUnasked(fields.data ?? [], asked3, STORE_ANSWERS_THESE);
29652
- const leftOut = useMemo43(
29688
+ const leftOut = useMemo44(
29653
29689
  () => whyNotAskable(fields.data ?? [], STORE_ANSWERS_THESE),
29654
29690
  [fields.data]
29655
29691
  );
@@ -30242,7 +30278,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
30242
30278
  useEffect61(() => {
30243
30279
  void load();
30244
30280
  }, [load]);
30245
- const subjectIds = useMemo44(
30281
+ const subjectIds = useMemo45(
30246
30282
  () => Array.from(
30247
30283
  /* @__PURE__ */ new Set([
30248
30284
  ...(pages ?? []).map((p) => p.table_id),
@@ -30951,7 +30987,7 @@ function typeWord2(t) {
30951
30987
  }
30952
30988
  function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, makeAtOnce = false, className }) {
30953
30989
  const client = useRecordsClient53();
30954
- const shapes = useMemo45(() => shapesOfSource(source), [source]);
30990
+ const shapes = useMemo46(() => shapesOfSource(source), [source]);
30955
30991
  const [which, setWhich] = useState81(() => Math.min(Math.max(0, shapeIndex), Math.max(0, shapes.length - 1)));
30956
30992
  const shape = shapes[which] ?? null;
30957
30993
  const [split, setSplit] = useState81("");
@@ -30987,8 +31023,8 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
30987
31023
  madeAtOnce.current = true;
30988
31024
  void makeRef.current();
30989
31025
  }, [makeAtOnce, shape, tablesKnown]);
30990
- const sourceText = useMemo45(() => JSON.stringify({ headers, rows }), [headers, rows]);
30991
- const wizardSource = useMemo45(
31026
+ const sourceText = useMemo46(() => JSON.stringify({ headers, rows }), [headers, rows]);
31027
+ const wizardSource = useMemo46(
30992
31028
  () => ({ name: sourceName, parsed: { headers, rows }, text: sourceText }),
30993
31029
  [sourceName, headers, rows, sourceText]
30994
31030
  );
@@ -31358,7 +31394,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
31358
31394
  }
31359
31395
 
31360
31396
  // src/StageRules.tsx
31361
- import { useCallback as useCallback34, useEffect as useEffect65, useMemo as useMemo46, useState as useState82 } from "react";
31397
+ import { useCallback as useCallback34, useEffect as useEffect65, useMemo as useMemo47, useState as useState82 } from "react";
31362
31398
  import { useFields as useFields16, useRecordsClient as useRecordsClient54, useTable as useTable14 } from "@ai-matrx/records/react";
31363
31399
  import { BasicInput as BasicInput18, BasicTextarea as BasicTextarea8, Button as Button61, Separator as Separator7, Skeleton as Skeleton11, cn as cn50 } from "@ai-matrx/design-system";
31364
31400
  import { Select as Select13 } from "@ai-matrx/design-system/controls";
@@ -31420,8 +31456,8 @@ function StageRulesSection({ tableId, stage, className }) {
31420
31456
  const stages = pipeline?.stages ?? [];
31421
31457
  const stageKey = chosen ?? stages.find((s) => !s.retired)?.key ?? null;
31422
31458
  const stageLabel = stages.find((s) => s.key === stageKey)?.label ?? stageKey ?? "";
31423
- const gates = useMemo46(() => stageKey ? gatesOf(pipeline, stageKey) : [], [pipeline, stageKey]);
31424
- const conditionFields = useMemo46(
31459
+ const gates = useMemo47(() => stageKey ? gatesOf(pipeline, stageKey) : [], [pipeline, stageKey]);
31460
+ const conditionFields = useMemo47(
31425
31461
  () => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
31426
31462
  [fields.data]
31427
31463
  );
@@ -31786,7 +31822,7 @@ function TableRenameDialog({
31786
31822
  }
31787
31823
 
31788
31824
  // src/TableSettings.tsx
31789
- import { useEffect as useEffect71, useMemo as useMemo49, useRef as useRef42, useState as useState89 } from "react";
31825
+ import { useEffect as useEffect71, useMemo as useMemo50, useRef as useRef42, useState as useState89 } from "react";
31790
31826
  import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
31791
31827
 
31792
31828
  // src/ArchiveDeliberately.tsx
@@ -31963,7 +31999,7 @@ function TableFoundationSwitch({ tableId, table }) {
31963
31999
  }
31964
32000
 
31965
32001
  // src/TableAccessLevel.tsx
31966
- import { useCallback as useCallback36, useEffect as useEffect68, useMemo as useMemo47, useState as useState86 } from "react";
32002
+ import { useCallback as useCallback36, useEffect as useEffect68, useMemo as useMemo48, useState as useState86 } from "react";
31967
32003
  import { tableShapeChanged as tableShapeChanged10, useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
31968
32004
  import { Badge as Badge12, Button as Button64, Textarea as Textarea5, cn as cn51 } from "@ai-matrx/design-system";
31969
32005
  import { Fragment as Fragment37, jsx as jsx106, jsxs as jsxs94 } from "react/jsx-runtime";
@@ -31981,7 +32017,7 @@ function TableAccessLevel({ tableId, fields }) {
31981
32017
  const [reason, setReason] = useState86("");
31982
32018
  const [busy, setBusy] = useState86(false);
31983
32019
  const [refused, setRefused] = useState86(null);
31984
- const candidates = useMemo47(() => personColumns(fields), [fields]);
32020
+ const candidates = useMemo48(() => personColumns(fields), [fields]);
31985
32021
  const load = useCallback36(async () => {
31986
32022
  const answer = await client.tableLevelFacts({ table_id: tableId });
31987
32023
  if (!answer.ok) {
@@ -32263,7 +32299,7 @@ function RowShownTo({ recordId, tableId }) {
32263
32299
  }
32264
32300
 
32265
32301
  // src/ColumnsAtOnce.tsx
32266
- import { useEffect as useEffect70, useMemo as useMemo48, useState as useState88 } from "react";
32302
+ import { useEffect as useEffect70, useMemo as useMemo49, useState as useState88 } from "react";
32267
32303
  import { useFieldMutation as useFieldMutation3 } from "@ai-matrx/records/react";
32268
32304
  import { Badge as Badge13, BasicInput as BasicInput19, Button as Button66, Checkbox as Checkbox12, cn as cn52 } from "@ai-matrx/design-system";
32269
32305
  import { jsx as jsx108, jsxs as jsxs96 } from "react/jsx-runtime";
@@ -32303,7 +32339,7 @@ function ColumnsAtOnce({
32303
32339
  useEffect70(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
32304
32340
  const [dragging, setDragging] = useState88(null);
32305
32341
  const [saving, setSaving] = useState88(false);
32306
- const byId = useMemo48(() => new Map(rows.map((f) => [f.id, f])), [rows]);
32342
+ const byId = useMemo49(() => new Map(rows.map((f) => [f.id, f])), [rows]);
32307
32343
  const batch = columnsBatch(rows, draft);
32308
32344
  const orderMoved = rows.some((f, i) => f.id !== draft[i]?.id);
32309
32345
  const hiddenChanged = look ? JSON.stringify([...hidden].sort()) !== JSON.stringify([...look.hidden].sort()) : false;
@@ -32453,7 +32489,7 @@ function TableSettings(props) {
32453
32489
  const now = useRef42({ table: table.data ?? null, fields: fields.data ?? [] });
32454
32490
  now.current = { table: table.data ?? null, fields: fields.data ?? [] };
32455
32491
  const slots = useRef42({ details: { current: null }, rowActions: { current: null } }).current;
32456
- const agent = useMemo49(
32492
+ const agent = useMemo50(
32457
32493
  () => buildTableSettingsAgent(props.tableId, () => now.current, client, slots),
32458
32494
  [props.tableId, client, slots]
32459
32495
  );
@@ -32703,7 +32739,7 @@ import { useFields as useFields19, useRecord as useRecord3, useRecordsClient as
32703
32739
  import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
32704
32740
 
32705
32741
  // src/RecordChat.tsx
32706
- import { useEffect as useEffect72, useMemo as useMemo50, useState as useState90 } from "react";
32742
+ import { useEffect as useEffect72, useMemo as useMemo51, useState as useState90 } from "react";
32707
32743
  import { useRecordsClient as useRecordsClient61 } from "@ai-matrx/records/react";
32708
32744
  import { Skeleton as Skeleton12, cn as cn54 } from "@ai-matrx/design-system";
32709
32745
  import { jsx as jsx110, jsxs as jsxs98 } from "react/jsx-runtime";
@@ -32729,7 +32765,7 @@ function RecordChat({ tableId, recordId, className }) {
32729
32765
  cancelled = true;
32730
32766
  };
32731
32767
  }, [client, recordId]);
32732
- const context = useMemo50(() => {
32768
+ const context = useMemo51(() => {
32733
32769
  if (!scope) return null;
32734
32770
  return {
32735
32771
  surfaceKey: `records-ui:record-chat:${recordId}`,
@@ -32830,7 +32866,7 @@ function entriesFor(scope) {
32830
32866
  import { Button as Button71, Separator as Separator9, Skeleton as Skeleton14, cn as cn56 } from "@ai-matrx/design-system";
32831
32867
 
32832
32868
  // src/recordInPlace.tsx
32833
- import { useMemo as useMemo51, useRef as useRef43 } from "react";
32869
+ import { useMemo as useMemo52, useRef as useRef43 } from "react";
32834
32870
  import { useRecordsClient as useRecordsClient62, useTable as useTable17 } from "@ai-matrx/records/react";
32835
32871
  import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
32836
32872
  import { jsx as jsx111, jsxs as jsxs99 } from "react/jsx-runtime";
@@ -32848,11 +32884,11 @@ function RecordFieldsInPlace({
32848
32884
  }) {
32849
32885
  const client = useRecordsClient62();
32850
32886
  const table = useTable17(tableId);
32851
- const row = useMemo51(
32887
+ const row = useMemo52(
32852
32888
  () => ({ id: recordId, document: document2 ?? {}, level: canWrite ? "editor" : "viewer", hidden: hidden ?? {} }),
32853
32889
  [recordId, document2, canWrite, hidden]
32854
32890
  );
32855
- const rows = useMemo51(() => [row], [row]);
32891
+ const rows = useMemo52(() => [row], [row]);
32856
32892
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
32857
32893
  const pushWritten = useRef43(null);
32858
32894
  const editing = useGridEditing({
@@ -33377,7 +33413,7 @@ function computedInPlainWords(row, field2) {
33377
33413
  }
33378
33414
 
33379
33415
  // src/platformTable.ts
33380
- import { useEffect as useEffect76, useMemo as useMemo52, useState as useState95 } from "react";
33416
+ import { useEffect as useEffect76, useMemo as useMemo53, useState as useState95 } from "react";
33381
33417
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
33382
33418
  var inFlight = /* @__PURE__ */ new Map();
33383
33419
  async function ensurePlatformTable(client, spec) {
@@ -33509,7 +33545,7 @@ function usePlatformTable(spec) {
33509
33545
  const client = useRecordsClient66();
33510
33546
  const [state2, setState] = useState95({ tableId: null, loading: true, error: null });
33511
33547
  const slug = spec.slug;
33512
- const stable = useMemo52(() => spec, [slug]);
33548
+ const stable = useMemo53(() => spec, [slug]);
33513
33549
  useEffect76(() => {
33514
33550
  let cancelled = false;
33515
33551
  setState({ tableId: null, loading: true, error: null });
@@ -33557,7 +33593,7 @@ function lookAfterReset(look) {
33557
33593
  }
33558
33594
 
33559
33595
  // src/ViewSwitcher.tsx
33560
- import { useEffect as useEffect88, useMemo as useMemo62, useState as useState107 } from "react";
33596
+ import { useEffect as useEffect88, useMemo as useMemo63, useState as useState107 } from "react";
33561
33597
  import { mayDrag as mayDrag4, useFields as useFields21, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient71, useTable as useTable21 } from "@ai-matrx/records/react";
33562
33598
  import { isButtonField as isButtonField5, newerKindOf as newerKindOf7, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
33563
33599
  import { Button as Button77, Select as Select19, SelectContent as SelectContent17, SelectItem as SelectItem17, SelectTrigger as SelectTrigger17, SelectValue as SelectValue17, cn as cn63 } from "@ai-matrx/design-system";
@@ -33571,7 +33607,7 @@ import {
33571
33607
  import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
33572
33608
 
33573
33609
  // src/recordMoves.tsx
33574
- import { useCallback as useCallback38, useEffect as useEffect77, useMemo as useMemo53, useRef as useRef45, useState as useState96 } from "react";
33610
+ import { useCallback as useCallback38, useEffect as useEffect77, useMemo as useMemo54, useRef as useRef45, useState as useState96 } from "react";
33575
33611
  import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
33576
33612
  import { Button as Button72 } from "@ai-matrx/design-system";
33577
33613
  import { Fragment as Fragment43, jsx as jsx116, jsxs as jsxs104 } from "react/jsx-runtime";
@@ -33746,7 +33782,7 @@ function useRecordMoves({
33746
33782
  }
33747
33783
  ) : null
33748
33784
  ] });
33749
- return useMemo53(
33785
+ return useMemo54(
33750
33786
  () => ({ move, moveMany, create, refused, say: (says, sticky) => undo.say(says, sticky), undo, onKeyDown, notice }),
33751
33787
  // eslint-disable-next-line react-hooks/exhaustive-deps
33752
33788
  [move, moveMany, create, refused, undo, onKeyDown, stale, reloadStale]
@@ -33765,7 +33801,7 @@ function MoveRefusedBadge({ refused }) {
33765
33801
  }
33766
33802
 
33767
33803
  // src/Pipeline.tsx
33768
- import { useCallback as useCallback39, useEffect as useEffect78, useMemo as useMemo54, useRef as useRef46, useState as useState97 } from "react";
33804
+ import { useCallback as useCallback39, useEffect as useEffect78, useMemo as useMemo55, useRef as useRef46, useState as useState97 } from "react";
33769
33805
  import {
33770
33806
  mayDrag,
33771
33807
  useFields as useFields20,
@@ -33866,7 +33902,7 @@ function PipelineBoard({
33866
33902
  const client = useRecordsClient68();
33867
33903
  const fields = useFields20(tableId);
33868
33904
  const ownDecorations = useTableDecorations(style ? null : tableId);
33869
- const cardStyle = useMemo54(
33905
+ const cardStyle = useMemo55(
33870
33906
  () => style ?? resolveTableStyle(ownDecorations.data, fields.data ?? [], void 0),
33871
33907
  [style, ownDecorations.data, fields.data]
33872
33908
  );
@@ -33926,7 +33962,7 @@ function PipelineBoard({
33926
33962
  onChanged?.();
33927
33963
  onOpenRecord?.(made);
33928
33964
  };
33929
- const cardsByStage = useMemo54(() => {
33965
+ const cardsByStage = useMemo55(() => {
33930
33966
  const map = /* @__PURE__ */ new Map();
33931
33967
  if (!stageKey) return map;
33932
33968
  for (const row of rows) {
@@ -33937,12 +33973,12 @@ function PipelineBoard({
33937
33973
  }, [rows, stageKey, definition?.stages]);
33938
33974
  const unplaced = cardsByStage.get(UNPLACED) ?? [];
33939
33975
  const all = fields.data ?? [];
33940
- const titleField = useMemo54(
33976
+ const titleField = useMemo55(
33941
33977
  () => cardTitleField(all, titleKey ?? null, [stageKey]),
33942
33978
  [all, stageKey, titleKey]
33943
33979
  );
33944
33980
  const unplacedLabels = useRecordLabels(titleField ? [titleField] : []);
33945
- const measurable = useMemo54(
33981
+ const measurable = useMemo55(
33946
33982
  () => all.filter((f) => ["number", "currency", "percentage"].includes(String(f.type ?? ""))),
33947
33983
  [all]
33948
33984
  );
@@ -34570,14 +34606,14 @@ function CardFieldsInline({ row, fields }) {
34570
34606
  }
34571
34607
 
34572
34608
  // src/CalendarView.tsx
34573
- import { useEffect as useEffect80, useMemo as useMemo56, useRef as useRef47, useState as useState99 } from "react";
34609
+ import { useEffect as useEffect80, useMemo as useMemo57, useRef as useRef47, useState as useState99 } from "react";
34574
34610
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
34575
34611
  import { Button as Button74, Select as Select15, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn58 } from "@ai-matrx/design-system";
34576
34612
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
34577
34613
 
34578
34614
  // src/weekStart.ts
34579
34615
  import { useEffect as useEffect79, useState as useState98 } from "react";
34580
- import { useOptionalRecordsClient as useOptionalRecordsClient14 } from "@ai-matrx/records/react";
34616
+ import { useOptionalRecordsClient as useOptionalRecordsClient15 } from "@ai-matrx/records/react";
34581
34617
  var DAYS2 = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
34582
34618
  function weekStartIndex(word) {
34583
34619
  const at = DAYS2.indexOf(String(word ?? "").trim().toLowerCase());
@@ -34596,7 +34632,7 @@ function ask(client) {
34596
34632
  return p;
34597
34633
  }
34598
34634
  function useReaderWeekStart() {
34599
- const client = useOptionalRecordsClient14();
34635
+ const client = useOptionalRecordsClient15();
34600
34636
  const [first, setFirst] = useState98(1);
34601
34637
  useEffect79(() => {
34602
34638
  if (!client) return;
@@ -34610,12 +34646,12 @@ function useReaderWeekStart() {
34610
34646
  }
34611
34647
 
34612
34648
  // src/rowColorBy.tsx
34613
- import { useMemo as useMemo55 } from "react";
34649
+ import { useMemo as useMemo56 } from "react";
34614
34650
  import { EMPTY_TABLE_STYLE, resolveRowColor as resolveRowColor2 } from "@ai-matrx/design-system/data-table";
34615
34651
  function useRowColorBy(all, colorKey, style) {
34616
34652
  const colorField = all.find((f) => f.key === colorKey);
34617
34653
  const options = useChoiceOptions(all, colorField && isChoiceField(colorField) ? [colorField.key] : []);
34618
- return useMemo55(() => {
34654
+ return useMemo56(() => {
34619
34655
  const lookup = (key, value) => {
34620
34656
  const first = Array.isArray(value) ? value[0] : value;
34621
34657
  return optionFor(options.get(key), first)?.color ?? (colorField ? storedChoiceColor(colorField, first) : void 0) ?? colorFromTheValue(key, first);
@@ -34883,12 +34919,12 @@ function CalendarView({
34883
34919
  usePersonTimeZone();
34884
34920
  const [anchor, setAnchor] = useState99(initialDate ?? dayKey(personWallNow()));
34885
34921
  const [openDay, setOpenDay] = useState99(null);
34886
- const titleFields = useMemo56(() => titleField ? [titleField] : [], [titleField]);
34922
+ const titleFields = useMemo57(() => titleField ? [titleField] : [], [titleField]);
34887
34923
  const labels = useRecordLabels(titleFields);
34888
34924
  const all = fields ?? [];
34889
34925
  const moments = holdsMoments(dateField);
34890
34926
  const snap = (minutes) => snapTo(minutes, snapMinutes);
34891
- const otherDates = useMemo56(
34927
+ const otherDates = useMemo57(
34892
34928
  () => eligibleFieldFor("date", all, null, { far: farFields }).eligible.filter((f) => f.key !== dateField.key),
34893
34929
  [all, farFields, dateField.key]
34894
34930
  );
@@ -34900,7 +34936,7 @@ function CalendarView({
34900
34936
  const endWorkedOut = isComputedField(endField);
34901
34937
  const canMove = (row) => mayDrag2(row.level) && !startWorkedOut;
34902
34938
  const creates = canCreate && !startWorkedOut;
34903
- const choiceFields = useMemo56(() => eligibleFieldFor("choice", all).eligible.filter(isChoiceField), [all]);
34939
+ const choiceFields = useMemo57(() => eligibleFieldFor("choice", all).eligible.filter(isChoiceField), [all]);
34904
34940
  const [colorPick, setColorPick] = useState99(void 0);
34905
34941
  const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
34906
34942
  const colorOf = useRowColorBy(all, colorKey, style);
@@ -34912,7 +34948,7 @@ function CalendarView({
34912
34948
  }, [undoneCount]);
34913
34949
  const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
34914
34950
  const endOf = (row) => endField ? placedOver.has(row.id) ? placedOver.get(row.id).end : (row.document ?? {})[endField.key] : null;
34915
- const { placed, undated } = useMemo56(() => {
34951
+ const { placed, undated } = useMemo57(() => {
34916
34952
  const out = [];
34917
34953
  const without = [];
34918
34954
  for (const row of rows) {
@@ -35581,11 +35617,11 @@ function weekHeading(first) {
35581
35617
  }
35582
35618
 
35583
35619
  // src/TimelineView.tsx
35584
- import { useEffect as useEffect81, useMemo as useMemo57, useRef as useRef48, useState as useState100 } from "react";
35620
+ import { useEffect as useEffect81, useMemo as useMemo58, useRef as useRef48, useState as useState100 } from "react";
35585
35621
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
35586
35622
  import { DropdownMenu as DropdownMenu8, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent8, DropdownMenuItem as DropdownMenuItem7, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator4, DropdownMenuSub as DropdownMenuSub2, DropdownMenuSubContent as DropdownMenuSubContent2, DropdownMenuSubTrigger as DropdownMenuSubTrigger2, DropdownMenuTrigger as DropdownMenuTrigger8, Button as Button75, Select as Select16, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn59 } from "@ai-matrx/design-system";
35587
35623
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS4 } from "@ai-matrx/design-system/data-table";
35588
- import { useOptionalRecordsClient as useOptionalRecordsClient15 } from "@ai-matrx/records/react";
35624
+ import { useOptionalRecordsClient as useOptionalRecordsClient16 } from "@ai-matrx/records/react";
35589
35625
 
35590
35626
  // src/timelineGantt.ts
35591
35627
  var inclusiveDays = (t) => daysBetween(t.first, t.last) + 1;
@@ -35843,23 +35879,23 @@ function TimelineView({
35843
35879
  usePersonTimeZone();
35844
35880
  const today = dayKeyOf(personWallNow());
35845
35881
  const [anchor, setAnchor] = useState100(initialDate ?? today);
35846
- const dates = useMemo57(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
35882
+ const dates = useMemo58(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
35847
35883
  const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
35848
35884
  const [picked, setPicked] = useState100({});
35849
35885
  useEffect81(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
35850
35886
  const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
35851
35887
  const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
35852
- const endCandidates = useMemo57(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
35853
- const baselineKeys = useMemo57(() => new Set([gantt?.baselineStart ?? "baseline_start", gantt?.baselineEnd ?? "baseline_end"].filter((k) => Boolean(k))), [gantt]);
35854
- const endAutoCandidates = useMemo57(() => endCandidates.filter((f) => !baselineKeys.has(f.key)), [endCandidates, baselineKeys]);
35855
- const endAuto = useMemo57(() => {
35888
+ const endCandidates = useMemo58(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
35889
+ const baselineKeys = useMemo58(() => new Set([gantt?.baselineStart ?? "baseline_start", gantt?.baselineEnd ?? "baseline_end"].filter((k) => Boolean(k))), [gantt]);
35890
+ const endAutoCandidates = useMemo58(() => endCandidates.filter((f) => !baselineKeys.has(f.key)), [endCandidates, baselineKeys]);
35891
+ const endAuto = useMemo58(() => {
35856
35892
  const only = onlyCandidate(endAutoCandidates);
35857
35893
  return only && startChosen && endFollowsStart(rows, startChosen, only) ? only : null;
35858
35894
  }, [endAutoCandidates, rows, startChosen]);
35859
35895
  const endChosen = "endKey" in picked ? picked.endKey ?? null : has(endCandidates, endKey) ?? (endKey !== startChosen ? named(endKey) : null) ?? (endKey === void 0 ? endAuto : null);
35860
- const groupCandidates = useMemo57(() => groupableFields(fields), [fields]);
35896
+ const groupCandidates = useMemo58(() => groupableFields(fields), [fields]);
35861
35897
  const groupChosen = "groupKey" in picked ? picked.groupKey ?? null : has(groupCandidates, groupKey);
35862
- const choiceFields = useMemo57(() => fields.filter(isChoiceField), [fields]);
35898
+ const choiceFields = useMemo58(() => fields.filter(isChoiceField), [fields]);
35863
35899
  const colorChosen = "colorKey" in picked ? picked.colorKey ?? null : has(choiceFields, colorKey) ?? (colorKey === void 0 ? has(choiceFields, style?.colorBy?.field) ?? onlyCandidate(choiceFields) : null);
35864
35900
  const setting = (patch) => {
35865
35901
  setPicked((held) => ({ ...held, ...patch }));
@@ -35882,14 +35918,14 @@ function TimelineView({
35882
35918
  const endWorkedOut = isComputedField(endField);
35883
35919
  const canMove = (row) => mayDrag3(row.level) && !startWorkedOut;
35884
35920
  const colorOf = useRowColorBy(fields, colorChosen, style);
35885
- const depField = useMemo57(() => dependencyFieldOf(fields, tableId), [fields, tableId]);
35921
+ const depField = useMemo58(() => dependencyFieldOf(fields, tableId), [fields, tableId]);
35886
35922
  const progressField = fields.find((f) => f.key === g.progress);
35887
35923
  const milestoneField = fields.find((f) => f.key === g.milestone);
35888
35924
  const baseStartField = fields.find((f) => f.key === (g.baselineStart ?? "baseline_start")) ?? null;
35889
35925
  const baseEndField = fields.find((f) => f.key === (g.baselineEnd ?? "baseline_end")) ?? null;
35890
- const progressCandidates = useMemo57(() => fields.filter((f) => PROGRESS_KINDS.has(String(editorKindFor(f))) && !isComputedField(f)), [fields]);
35891
- const milestoneCandidates = useMemo57(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
35892
- const knobClient = useOptionalRecordsClient15();
35926
+ const progressCandidates = useMemo58(() => fields.filter((f) => PROGRESS_KINDS.has(String(editorKindFor(f))) && !isComputedField(f)), [fields]);
35927
+ const milestoneCandidates = useMemo58(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
35928
+ const knobClient = useOptionalRecordsClient16();
35893
35929
  const [shiftDependents, setShiftDependents] = useState100(true);
35894
35930
  useEffect81(() => {
35895
35931
  if (!depField || !knobClient) return;
@@ -35902,7 +35938,7 @@ function TimelineView({
35902
35938
  };
35903
35939
  }, [depField, knobClient]);
35904
35940
  const dependents = (id) => depField && shiftDependents ? dependentsOf(rows, depField.key, id) : [];
35905
- const labelFields = useMemo57(() => [titleField, groupField].filter((f) => Boolean(f)), [titleField, groupField]);
35941
+ const labelFields = useMemo58(() => [titleField, groupField].filter((f) => Boolean(f)), [titleField, groupField]);
35906
35942
  const labels = useRecordLabels(labelFields);
35907
35943
  const titleOf = (row) => cardWords(row, titleField, labels).text;
35908
35944
  const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
@@ -35918,7 +35954,7 @@ function TimelineView({
35918
35954
  const [linking, setLinking] = useState100(null);
35919
35955
  const [ganttBusy, setGanttBusy] = useState100(false);
35920
35956
  const [linkTarget, setLinkTarget] = useState100(null);
35921
- const { placed, unscheduled } = useMemo57(() => {
35957
+ const { placed, unscheduled } = useMemo58(() => {
35922
35958
  const out = [];
35923
35959
  const without = [];
35924
35960
  for (const row of rows) {
@@ -35936,7 +35972,7 @@ function TimelineView({
35936
35972
  }
35937
35973
  return { placed: out, unscheduled: without };
35938
35974
  }, [rows, startField?.key, endField?.key, placedOver, ganttOn, milestoneField?.key]);
35939
- const draggedAlong = useMemo57(
35975
+ const draggedAlong = useMemo58(
35940
35976
  () => new Set(dragging && dragging.part === "move" && dragging.days !== 0 ? dependents(dragging.id) : []),
35941
35977
  // eslint-disable-next-line react-hooks/exhaustive-deps
35942
35978
  [dragging?.id, dragging?.part, dragging?.days !== 0, rows, depField, shiftDependents]
@@ -35953,17 +35989,17 @@ function TimelineView({
35953
35989
  const last = addDays(p.last, d);
35954
35990
  return { first: p.first, last: last < p.first ? p.first : last };
35955
35991
  };
35956
- const waitsOnMap = useMemo57(() => {
35992
+ const waitsOnMap = useMemo58(() => {
35957
35993
  const map = /* @__PURE__ */ new Map();
35958
35994
  if (depField) for (const row of rows) map.set(row.id, waitsOnIds((row.document ?? {})[depField.key]));
35959
35995
  return map;
35960
35996
  }, [rows, depField]);
35961
- const critical = useMemo57(
35997
+ const critical = useMemo58(
35962
35998
  () => ganttOn && g.critical && depField ? criticalPath(placed.map((p) => ({ id: p.row.id, first: p.first, last: p.last })), waitsOnMap) : null,
35963
35999
  // eslint-disable-next-line react-hooks/exhaustive-deps
35964
36000
  [ganttOn, g.critical, depField, placed, waitsOnMap]
35965
36001
  );
35966
- const criticalIds = useMemo57(() => new Set(critical?.ids ?? []), [critical]);
36002
+ const criticalIds = useMemo58(() => new Set(critical?.ids ?? []), [critical]);
35967
36003
  const baselineOf = (row) => ganttOn && baseStartField ? baselineSpan(calendarDayOf((row.document ?? {})[baseStartField.key]), baseEndField ? calendarDayOf((row.document ?? {})[baseEndField.key]) : null) : null;
35968
36004
  const commit = async (row, patch, label) => {
35969
36005
  const doc = row.document ?? {};
@@ -36170,7 +36206,7 @@ function TimelineView({
36170
36206
  const from = windowStart(anchor, zoom, firstDay);
36171
36207
  const days = WINDOW[zoom].days;
36172
36208
  const width = days * px;
36173
- const scale = useMemo57(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
36209
+ const scale = useMemo58(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
36174
36210
  const xOf = (day2) => daysBetween(from, day2) * px;
36175
36211
  const scroller = useRef48(null);
36176
36212
  const grouped = Boolean(groupField) && !ganttOn;
@@ -36191,7 +36227,7 @@ function TimelineView({
36191
36227
  el.scrollLeft = Math.max(0, xOf(anchor) - (el.clientWidth - label) / 4);
36192
36228
  setScrollX(el.scrollLeft);
36193
36229
  }, [anchor, zoom, hasLabel]);
36194
- const lanes = useMemo57(() => {
36230
+ const lanes = useMemo58(() => {
36195
36231
  if (!groupField || ganttOn) return [{ key: "all", label: "", color: void 0, bars: placed }];
36196
36232
  const order = (groupOptions ?? []).map((o) => o.label);
36197
36233
  const map = new Map(order.map((name) => [name, []]));
@@ -36210,14 +36246,14 @@ function TimelineView({
36210
36246
  }, [groupField, groupOptions, placed, labels, ganttOn]);
36211
36247
  const laneChangeAllowed = Boolean(groupField && fieldIsEditable(groupField));
36212
36248
  const laneLocked = groupField && !laneChangeAllowed ? `${fieldName(groupField)} is worked out, so a bar keeps its row.` : null;
36213
- const holdsKeys = useMemo57(
36249
+ const holdsKeys = useMemo58(
36214
36250
  () => Boolean(groupField) && (groupOptions ?? []).length > 0 && rows.some((row) => {
36215
36251
  const v = (row.document ?? {})[groupField.key];
36216
36252
  return (Array.isArray(v) ? v : [v]).some((x) => (groupOptions ?? []).some((o) => o.key === x && o.id !== x));
36217
36253
  }),
36218
36254
  [rows, groupOptions, groupField]
36219
36255
  );
36220
- const heldIn = useMemo57(() => {
36256
+ const heldIn = useMemo58(() => {
36221
36257
  const out = /* @__PURE__ */ new Map();
36222
36258
  if (!groupField) return out;
36223
36259
  for (const row of rows) {
@@ -36845,7 +36881,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
36845
36881
 
36846
36882
  // src/GalleryCover.tsx
36847
36883
  import { useEffect as useEffect83, useState as useState102 } from "react";
36848
- import { useOptionalRecordsClient as useOptionalRecordsClient16 } from "@ai-matrx/records/react";
36884
+ import { useOptionalRecordsClient as useOptionalRecordsClient17 } from "@ai-matrx/records/react";
36849
36885
  import { Fragment as Fragment47, jsx as jsx123 } from "react/jsx-runtime";
36850
36886
  function isImageAddress(value) {
36851
36887
  return typeof value === "string" && /^(https?:\/\/|\/|data:image\/)/i.test(value.trim());
@@ -36863,7 +36899,7 @@ function GalleryCover({ field: field2, value }) {
36863
36899
  return null;
36864
36900
  }
36865
36901
  function FileCover({ recordId }) {
36866
- const client = useOptionalRecordsClient16();
36902
+ const client = useOptionalRecordsClient17();
36867
36903
  const host = useRecordsUi();
36868
36904
  const [read, setRead] = useState102(null);
36869
36905
  useEffect83(() => {
@@ -37083,7 +37119,7 @@ function BoardOptions({
37083
37119
  }
37084
37120
 
37085
37121
  // src/ListView.tsx
37086
- import { useMemo as useMemo58 } from "react";
37122
+ import { useMemo as useMemo59 } from "react";
37087
37123
  import { Select as Select17, SelectContent as SelectContent15, SelectItem as SelectItem15, SelectTrigger as SelectTrigger15, SelectValue as SelectValue15, cn as cn60 } from "@ai-matrx/design-system";
37088
37124
  import { resolveRowColor as resolveRowColor3, ROW_TINT_CLASS as ROW_TINT_CLASS2 } from "@ai-matrx/design-system/data-table";
37089
37125
  import { jsx as jsx125, jsxs as jsxs112 } from "react/jsx-runtime";
@@ -37123,7 +37159,7 @@ function ListView({
37123
37159
  }) {
37124
37160
  const groupField = grouping?.field ? fields.find((f) => f.key === grouping.field) : void 0;
37125
37161
  const groupKey = groupField?.key ?? null;
37126
- const groups = useMemo58(() => listGroups(rows, groupKey), [rows, groupKey]);
37162
+ const groups = useMemo59(() => listGroups(rows, groupKey), [rows, groupKey]);
37127
37163
  const shown5 = cardFieldsShown(fields, hiddenFields, [titleField?.key, groupKey]);
37128
37164
  const chose = hiddenFields !== void 0;
37129
37165
  const moves = useRecordMoves({ tableId, rows, ...onMoved ? { onMoved } : {} });
@@ -37221,7 +37257,7 @@ function ListRow({
37221
37257
  style,
37222
37258
  onOpenRecord
37223
37259
  }) {
37224
- const wanted = useMemo58(() => titleField && pointsAtRecords(titleField) ? [titleField] : NO_FIELDS, [titleField]);
37260
+ const wanted = useMemo59(() => titleField && pointsAtRecords(titleField) ? [titleField] : NO_FIELDS, [titleField]);
37225
37261
  const labels = useRecordLabels(wanted);
37226
37262
  const { text: title, withheld } = cardWords(row, titleField, labels);
37227
37263
  const doc = row.document ?? {};
@@ -37264,13 +37300,13 @@ function ListRow({
37264
37300
  }
37265
37301
 
37266
37302
  // src/ChartLayout.tsx
37267
- import { useEffect as useEffect87, useMemo as useMemo61, useState as useState106 } from "react";
37303
+ import { useEffect as useEffect87, useMemo as useMemo62, useState as useState106 } from "react";
37268
37304
  import { useRecordsClient as useRecordsClient70 } from "@ai-matrx/records/react";
37269
37305
  import { fieldKindFor as fieldKindFor2, measureKey as measureKey4 } from "@ai-matrx/records";
37270
37306
  import { Select as Select18, SelectContent as SelectContent16, SelectItem as SelectItem16, SelectTrigger as SelectTrigger16, SelectValue as SelectValue16 } from "@ai-matrx/design-system";
37271
37307
 
37272
37308
  // src/ChartBlock.tsx
37273
- import { useMemo as useMemo60 } from "react";
37309
+ import { useMemo as useMemo61 } from "react";
37274
37310
  import {
37275
37311
  Bar,
37276
37312
  BarChart,
@@ -37294,8 +37330,8 @@ import { cn as cn62 } from "@ai-matrx/design-system";
37294
37330
  import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
37295
37331
 
37296
37332
  // src/linkWords.ts
37297
- import { useEffect as useEffect84, useMemo as useMemo59, useState as useState103 } from "react";
37298
- import { useOptionalRecordsClient as useOptionalRecordsClient17 } from "@ai-matrx/records/react";
37333
+ import { useEffect as useEffect84, useMemo as useMemo60, useState as useState103 } from "react";
37334
+ import { useOptionalRecordsClient as useOptionalRecordsClient18 } from "@ai-matrx/records/react";
37299
37335
 
37300
37336
  // src/charts.ts
37301
37337
  var CHART_KIND_LABEL = {
@@ -37505,7 +37541,7 @@ function bucketWindow2(groupKey, value) {
37505
37541
 
37506
37542
  // src/linkWords.ts
37507
37543
  function useLinkGroupNamer(block, tableId) {
37508
- const client = useOptionalRecordsClient17();
37544
+ const client = useOptionalRecordsClient18();
37509
37545
  const groupBy = block.kind === "stuck" ? [] : block.group_by ?? [];
37510
37546
  const rows = block.kind === "stuck" ? [] : block.rows ?? [];
37511
37547
  const ask2 = JSON.stringify([tableId, groupBy, rows.map((r) => r.groups ?? null)]);
@@ -37540,7 +37576,7 @@ function useLinkGroupNamer(block, tableId) {
37540
37576
  cancelled = true;
37541
37577
  };
37542
37578
  }, [client, ask2]);
37543
- return useMemo59(() => {
37579
+ return useMemo60(() => {
37544
37580
  if (Object.keys(named).length === 0 && choices.length === 0) return void 0;
37545
37581
  return (key, value) => {
37546
37582
  const choice = choices.find((f) => f.key === key);
@@ -37556,7 +37592,7 @@ function useLinkGroupNamer(block, tableId) {
37556
37592
 
37557
37593
  // src/measureWords.ts
37558
37594
  import { useEffect as useEffect85, useState as useState104 } from "react";
37559
- import { useOptionalRecordsClient as useOptionalRecordsClient18 } from "@ai-matrx/records/react";
37595
+ import { useOptionalRecordsClient as useOptionalRecordsClient19 } from "@ai-matrx/records/react";
37560
37596
  import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
37561
37597
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
37562
37598
  function measureWords(key, fields) {
@@ -37571,7 +37607,7 @@ function measureWords(key, fields) {
37571
37607
  return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier14(op2)} ${name}`;
37572
37608
  }
37573
37609
  function useMeasureWords(key, tableId) {
37574
- const client = useOptionalRecordsClient18();
37610
+ const client = useOptionalRecordsClient19();
37575
37611
  const [fields, setFields] = useState104(null);
37576
37612
  const needs = key !== "count";
37577
37613
  useEffect85(() => {
@@ -37779,7 +37815,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
37779
37815
  const target = kind2 === "stuck" ? null : block.target ?? null;
37780
37816
  const named = useLinkGroupNamer(source ? NO_GROUPS : block, tableId);
37781
37817
  const measureName = useMeasureWords(primary, tableId);
37782
- const points = useMemo60(() => {
37818
+ const points = useMemo61(() => {
37783
37819
  if (kind2 === "stuck") return [];
37784
37820
  const rows = block.rows ?? [];
37785
37821
  return rows.map((row, index) => {
@@ -37803,7 +37839,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
37803
37839
  };
37804
37840
  });
37805
37841
  }, [block.rows, kind2, primary, compared, grain, windows, named]);
37806
- const config = useMemo60(() => {
37842
+ const config = useMemo61(() => {
37807
37843
  const out = {};
37808
37844
  out[primary] = {
37809
37845
  label: windows ? windowName(windows.window, windows.period) : measureName,
@@ -38233,7 +38269,7 @@ function chartQuestion(view, fields) {
38233
38269
  }
38234
38270
  function ChartLayout({ view, fields, filter, onChange, remembered }) {
38235
38271
  const client = useRecordsClient70();
38236
- const q = useMemo61(() => chartQuestion(view, fields), [view, fields]);
38272
+ const q = useMemo62(() => chartQuestion(view, fields), [view, fields]);
38237
38273
  const [state2, setState] = useState106({ block: null, error: null });
38238
38274
  const filterKey = JSON.stringify(filter ?? {});
38239
38275
  const qKey = JSON.stringify(q);
@@ -38316,7 +38352,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
38316
38352
  useEffect88(() => {
38317
38353
  setLimit(pageSize);
38318
38354
  }, [questionKey, pageSize]);
38319
- const storeSort = useMemo62(
38355
+ const storeSort = useMemo63(
38320
38356
  () => (view.sorts ?? []).map((s) => ({ field: s.field, direction: s.direction })),
38321
38357
  [view.sorts]
38322
38358
  );
@@ -38347,7 +38383,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
38347
38383
  }, [client, ruleId, pageSize]);
38348
38384
  const asked3 = stableFilterKey4(filter ?? null);
38349
38385
  const fromView = asked3 !== "{}" && (asked3 === stableFilterKey4(view.where ?? null) || asked3 === stableFilterKey4(view.filters ?? null));
38350
- const tableRows = useMemo62(() => table.data?.rows ?? [], [table.data]);
38386
+ const tableRows = useMemo63(() => table.data?.rows ?? [], [table.data]);
38351
38387
  const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
38352
38388
  const hand = useHandOrderRows({
38353
38389
  viewId: viewId ?? null,
@@ -38360,7 +38396,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
38360
38396
  const rows = ruleId ? ruled.rows : manual ? hand.rows ?? NO_ROWS3 : tableRows;
38361
38397
  const total = ruleId || manual ? null : table.data?.total ?? null;
38362
38398
  const sortsKey = JSON.stringify(view.sorts ?? []);
38363
- const shown5 = useMemo62(
38399
+ const shown5 = useMemo63(
38364
38400
  () => manual || !ruleId ? rows : sortRows(rows, JSON.parse(sortsKey)),
38365
38401
  [rows, manual, ruleId, sortsKey]
38366
38402
  );
@@ -38636,7 +38672,7 @@ function Board({
38636
38672
  const records = useViewRecords(view, pageSize, filter, viewId ?? null);
38637
38673
  const stage = useStageField(view.subject);
38638
38674
  const decorations = useTableDecorations(view.subject);
38639
- const style = useMemo62(
38675
+ const style = useMemo63(
38640
38676
  () => resolveTableStyle(decorations.data, fields.data ?? [], view.presentation?.style),
38641
38677
  [decorations.data, fields.data, view.presentation?.style]
38642
38678
  );
@@ -39064,27 +39100,27 @@ function Kanban({
39064
39100
  canAdd = false,
39065
39101
  parentField
39066
39102
  }) {
39067
- const axisFields = useMemo62(() => laneField ? [groupField, laneField] : [groupField], [groupField, laneField]);
39103
+ const axisFields = useMemo63(() => laneField ? [groupField, laneField] : [groupField], [groupField, laneField]);
39068
39104
  const labels = useRecordLabels(axisFields);
39069
39105
  const choiceKeys = axisFields.filter(isChoiceField).map((f) => f.key);
39070
39106
  const optionIndex = useChoiceOptions(axisFields, choiceKeys);
39071
39107
  const options = optionIndex.get(groupField.key);
39072
39108
  const laneOptions = laneField ? optionIndex.get(laneField.key) : void 0;
39073
- const columnAxis = useMemo62(() => buildAxis(groupField, rows, labels, options), [groupField, rows, labels, options]);
39074
- const laneAxis = useMemo62(() => laneField ? buildAxis(laneField, rows, labels, laneOptions) : null, [laneField, rows, labels, laneOptions]);
39109
+ const columnAxis = useMemo63(() => buildAxis(groupField, rows, labels, options), [groupField, rows, labels, options]);
39110
+ const laneAxis = useMemo63(() => laneField ? buildAxis(laneField, rows, labels, laneOptions) : null, [laneField, rows, labels, laneOptions]);
39075
39111
  const board = look ?? {};
39076
39112
  const size = BOARD_SIZE[board.boardSize ?? "medium"];
39077
39113
  const colorColumns = board.boardColorColumns !== false;
39078
39114
  const showCounts = board.boardCounts !== false;
39079
39115
  const hideEmpty = board.boardHideEmpty === true;
39080
- const cardsOf = useMemo62(() => {
39116
+ const cardsOf = useMemo63(() => {
39081
39117
  const map = /* @__PURE__ */ new Map();
39082
39118
  for (const name of columnAxis.names) map.set(name, []);
39083
39119
  for (const row of rows) for (const key of columnAxis.keysOf(row)) map.get(key)?.push(row);
39084
39120
  return map;
39085
39121
  }, [rows, columnAxis]);
39086
39122
  const columns = columnAxis.names.filter((name) => !hideEmpty || (cardsOf.get(name)?.length ?? 0) > 0);
39087
- const lanes = useMemo62(() => {
39123
+ const lanes = useMemo63(() => {
39088
39124
  if (!laneAxis) return [];
39089
39125
  const byLane = new Map(laneAxis.names.map((n) => [n, []]));
39090
39126
  for (const row of rows) for (const key of laneAxis.keysOf(row)) byLane.get(key)?.push(row);
@@ -39328,7 +39364,7 @@ function Gallery({
39328
39364
  onNew,
39329
39365
  newLabel
39330
39366
  }) {
39331
- const hidden = useMemo62(() => new Set(hiddenFields ?? []), [hiddenFields]);
39367
+ const hidden = useMemo63(() => new Set(hiddenFields ?? []), [hiddenFields]);
39332
39368
  const imageField = imageKey ? fields.find((field2) => field2.key === imageKey) : void 0;
39333
39369
  const shown5 = fields.filter((field2) => !hidden.has(field2.key) && field2.key !== imageKey && field2.key !== titleKey);
39334
39370
  const chose = hiddenFields !== void 0;
@@ -39431,7 +39467,7 @@ function RecordCard({
39431
39467
  parentField
39432
39468
  }) {
39433
39469
  const host = useRecordsUi();
39434
- const wanted = useMemo62(() => {
39470
+ const wanted = useMemo63(() => {
39435
39471
  const asked3 = [field2 && pointsAtRecords(field2) ? field2 : null, parentField ?? null].filter((f) => f !== null);
39436
39472
  return asked3.length > 0 ? asked3 : NO_FIELDS2;
39437
39473
  }, [field2, parentField]);
@@ -40591,14 +40627,14 @@ function ProposalRow({
40591
40627
  }
40592
40628
 
40593
40629
  // src/ActionInbox.tsx
40594
- import { useCallback as useCallback45, useEffect as useEffect94, useMemo as useMemo64, useRef as useRef53, useState as useState113 } from "react";
40630
+ import { useCallback as useCallback45, useEffect as useEffect94, useMemo as useMemo65, useRef as useRef53, useState as useState113 } from "react";
40595
40631
  import { useRecordsClient as useRecordsClient77 } from "@ai-matrx/records/react";
40596
40632
  import { Badge as Badge18, Button as Button83, Checkbox as Checkbox13, Skeleton as Skeleton20, cn as cn69 } from "@ai-matrx/design-system";
40597
40633
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
40598
40634
  import { formatAbsoluteDate, formatDurationMs } from "@ai-matrx/kit/format";
40599
40635
 
40600
40636
  // src/ChecklistRunner.tsx
40601
- import { useCallback as useCallback44, useEffect as useEffect93, useMemo as useMemo63, useState as useState112 } from "react";
40637
+ import { useCallback as useCallback44, useEffect as useEffect93, useMemo as useMemo64, useState as useState112 } from "react";
40602
40638
  import { useRecordsClient as useRecordsClient76, useTable as useTable24 } from "@ai-matrx/records/react";
40603
40639
  import { Badge as Badge17, BasicInput as BasicInput22, BasicTextarea as BasicTextarea9, Button as Button82, Skeleton as Skeleton19, cn as cn68 } from "@ai-matrx/design-system";
40604
40640
  import { Select as Select20 } from "@ai-matrx/design-system/controls";
@@ -40734,7 +40770,7 @@ function ChecklistRunner({
40734
40770
  },
40735
40771
  [client, loadSteps]
40736
40772
  );
40737
- const active = useMemo63(
40773
+ const active = useMemo64(
40738
40774
  () => runs?.find((r) => r.run_id === activeId) ?? null,
40739
40775
  [runs, activeId]
40740
40776
  );
@@ -41210,7 +41246,7 @@ function ChecklistTemplateEditor({
41210
41246
  cancelled = true;
41211
41247
  };
41212
41248
  }, [client, templateId]);
41213
- const spec = useMemo63(
41249
+ const spec = useMemo64(
41214
41250
  () => ({
41215
41251
  name: name.trim(),
41216
41252
  about_table_id: aboutTableId,
@@ -41518,17 +41554,17 @@ function ActionInbox({
41518
41554
  useEffect94(() => {
41519
41555
  void load();
41520
41556
  }, [load]);
41521
- const narrowed = useMemo64(() => {
41557
+ const narrowed = useMemo65(() => {
41522
41558
  const all = (items ?? []).filter((i) => !(view === "inbox" && i.kind === "assignment" && stepIds.has(i.item_id)));
41523
41559
  if (!tableId || everyTable) return all;
41524
41560
  return all.filter((i) => i.table_id === tableId);
41525
41561
  }, [items, tableId, everyTable, view, stepIds]);
41526
- const waitingIds = useMemo64(
41562
+ const waitingIds = useMemo65(
41527
41563
  () => new Set((items ?? []).filter((i) => i.kind === "assignment").map((i) => i.item_id)),
41528
41564
  [items]
41529
41565
  );
41530
- const groups = useMemo64(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
41531
- const shown5 = useMemo64(() => groups.flatMap((g) => g.items), [groups]);
41566
+ const groups = useMemo65(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
41567
+ const shown5 = useMemo65(() => groups.flatMap((g) => g.items), [groups]);
41532
41568
  const elsewhere = (items?.length ?? 0) - narrowed.length;
41533
41569
  useEffect94(() => {
41534
41570
  if (cursor >= shown5.length) setCursor(Math.max(0, shown5.length - 1));
@@ -42283,7 +42319,7 @@ import { Badge as Badge19, Button as Button86, Skeleton as Skeleton22, cn as cn7
42283
42319
  import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
42284
42320
 
42285
42321
  // src/AsOfReading.tsx
42286
- import { useEffect as useEffect95, useMemo as useMemo65, useState as useState114 } from "react";
42322
+ import { useEffect as useEffect95, useMemo as useMemo66, useState as useState114 } from "react";
42287
42323
  import { readTypedDate as readTypedDate3, typedDateText as typedDateText3 } from "@ai-matrx/records";
42288
42324
  import { useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
42289
42325
  import { Button as Button84, Skeleton as Skeleton21, cn as cn70 } from "@ai-matrx/design-system";
@@ -42420,7 +42456,7 @@ function AsOfReading({
42420
42456
  live = false;
42421
42457
  };
42422
42458
  }, [client, key]);
42423
- const rows = useMemo65(() => answer && "doc" in answer && answer.doc ? asOfRows(fields, answer.doc, today) : [], [answer, fields, today]);
42459
+ const rows = useMemo66(() => answer && "doc" in answer && answer.doc ? asOfRows(fields, answer.doc, today) : [], [answer, fields, today]);
42424
42460
  const box = cn70("h-[9.25rem] min-h-0 overflow-y-auto rounded border", className);
42425
42461
  if (!answer || answer.key !== key) return /* @__PURE__ */ jsx136(Skeleton21, { shape: "block", className: box });
42426
42462
  if ("error" in answer) return /* @__PURE__ */ jsx136(RefusalNotice, { error: answer.error, className });
@@ -42989,7 +43025,7 @@ function say(value, field2) {
42989
43025
  }
42990
43026
 
42991
43027
  // src/CommentThread.tsx
42992
- import { useCallback as useCallback48, useEffect as useEffect98, useMemo as useMemo66, useRef as useRef55, useState as useState117 } from "react";
43028
+ import { useCallback as useCallback48, useEffect as useEffect98, useMemo as useMemo67, useRef as useRef55, useState as useState117 } from "react";
42993
43029
  import {
42994
43030
  useFields as useFields24,
42995
43031
  useRecordsClient as useRecordsClient81,
@@ -43047,7 +43083,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
43047
43083
  alive = false;
43048
43084
  };
43049
43085
  }, [host]);
43050
- const candidates = useMemo66(() => {
43086
+ const candidates = useMemo67(() => {
43051
43087
  if (mentionQuery === null) return [];
43052
43088
  const q = mentionQuery.trim().toLowerCase();
43053
43089
  return people.filter((p) => !picked.some((already) => already.userId === p.userId)).filter((p) => q === "" || (p.name ?? p.email ?? "").toLowerCase().includes(q)).slice(0, 6);
@@ -43405,8 +43441,8 @@ function FieldHistoryPanel({
43405
43441
  import { FORM_FLOWS as FORM_FLOWS2, FORM_EMBEDS as FORM_EMBEDS2, formDeclareArgs as formDeclareArgs2, formFromSummary as formFromSummary4, formPresentation, formLookDocument as formLookDocument2, formLookFromDocument, submissionStamp as submissionStamp2, formEmbedSnippet as formEmbedSnippet2, formRoutes as formRoutes2, hiddenFromLink, endingsFromDocument, welcomeFromDocument, themeFromDocument } from "@ai-matrx/records/forms";
43406
43442
 
43407
43443
  // src/FormResultsPanel.tsx
43408
- import { useEffect as useEffect100, useMemo as useMemo67, useState as useState119 } from "react";
43409
- import { useFields as useFields26, useOptionalRecordsClient as useOptionalRecordsClient19 } from "@ai-matrx/records/react";
43444
+ import { useEffect as useEffect100, useMemo as useMemo68, useState as useState119 } from "react";
43445
+ import { useFields as useFields26, useOptionalRecordsClient as useOptionalRecordsClient20 } from "@ai-matrx/records/react";
43410
43446
  import { Button as Button89, Skeleton as Skeleton25, cn as cn75 } from "@ai-matrx/design-system";
43411
43447
  import { jsx as jsx141, jsxs as jsxs128 } from "react/jsx-runtime";
43412
43448
  var CHARTED_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "checkbox", "number", "currency", "percent", "member", "relation"]);
@@ -43429,7 +43465,7 @@ function answersBlock(question, title) {
43429
43465
  };
43430
43466
  }
43431
43467
  function FormResultsPanel({ form, className }) {
43432
- const client = useOptionalRecordsClient19();
43468
+ const client = useOptionalRecordsClient20();
43433
43469
  const fields = useFields26(form.subject);
43434
43470
  const [results, setResults] = useState119(null);
43435
43471
  const [error, setError] = useState119(null);
@@ -43451,14 +43487,14 @@ function FormResultsPanel({ form, className }) {
43451
43487
  cancelled = true;
43452
43488
  };
43453
43489
  }, [client, form.id, round]);
43454
- const charted = useMemo67(() => {
43490
+ const charted = useMemo68(() => {
43455
43491
  const byKey = new Map((fields.data ?? []).map((f) => [f.key, f]));
43456
43492
  return (key) => {
43457
43493
  const field2 = byKey.get(key);
43458
43494
  return field2 ? CHARTED_KINDS.has(editorKindFor(field2)) : false;
43459
43495
  };
43460
43496
  }, [fields.data]);
43461
- const label = useMemo67(() => {
43497
+ const label = useMemo68(() => {
43462
43498
  const byKey = new Map((fields.data ?? []).map((f) => [f.key, f]));
43463
43499
  const asks = new Map((form.questions ?? []).map((q) => [q.field, q.ask]));
43464
43500
  return (key) => asks.get(key)?.trim() || (byKey.get(key) ? fieldName(byKey.get(key)) : key);
@@ -43532,7 +43568,7 @@ function FormResultsPanel({ form, className }) {
43532
43568
  }
43533
43569
 
43534
43570
  // src/PortalBuilder.tsx
43535
- import { useCallback as useCallback50, useEffect as useEffect101, useMemo as useMemo68, useRef as useRef57, useState as useState120 } from "react";
43571
+ import { useCallback as useCallback50, useEffect as useEffect101, useMemo as useMemo69, useRef as useRef57, useState as useState120 } from "react";
43536
43572
  import { useRecordsClient as useRecordsClient83, useTables as useTables4 } from "@ai-matrx/records/react";
43537
43573
  import { BasicInput as BasicInput23, Button as Button90, Checkbox as Checkbox14, Label as Label20, Separator as Separator10, Skeleton as Skeleton26, cn as cn76 } from "@ai-matrx/design-system";
43538
43574
  import { Select as Select21 } from "@ai-matrx/design-system/controls";
@@ -43601,7 +43637,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
43601
43637
  return rest;
43602
43638
  });
43603
43639
  }, [tableId, portalId, clientTableId, cameFromPeople]);
43604
- const ticked = useMemo68(() => Object.values(exposures).filter((e) => e.on), [exposures]);
43640
+ const ticked = useMemo69(() => Object.values(exposures).filter((e) => e.on), [exposures]);
43605
43641
  const tiesTo = useCallback50(
43606
43642
  (id) => (fieldsByTable[id] ?? []).filter(
43607
43643
  (f) => f.type === "relation" && f.relation_target === clientTableId
@@ -43687,7 +43723,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
43687
43723
  setSavedId(answered.data);
43688
43724
  onSaved?.(answered.data);
43689
43725
  }
43690
- const inviteField = useMemo68(() => {
43726
+ const inviteField = useMemo69(() => {
43691
43727
  for (const e of ticked) {
43692
43728
  const tie = tiesTo(e.tableId)[0];
43693
43729
  if (tie) return tie;
@@ -43925,7 +43961,7 @@ function clientNoun(table) {
43925
43961
 
43926
43962
  // src/PortalsPanel.tsx
43927
43963
  import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
43928
- import { useCallback as useCallback51, useEffect as useEffect103, useMemo as useMemo70, useState as useState122 } from "react";
43964
+ import { useCallback as useCallback51, useEffect as useEffect103, useMemo as useMemo71, useState as useState122 } from "react";
43929
43965
  import { useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
43930
43966
  import {
43931
43967
  portalArchiveConsequence,
@@ -43936,7 +43972,7 @@ import {
43936
43972
  import { Badge as Badge22, BasicInput as BasicInput25, Button as Button92, Separator as Separator11, Skeleton as Skeleton27, cn as cn79 } from "@ai-matrx/design-system";
43937
43973
 
43938
43974
  // src/PortalLookEditor.tsx
43939
- import { useEffect as useEffect102, useMemo as useMemo69, useState as useState121 } from "react";
43975
+ import { useEffect as useEffect102, useMemo as useMemo70, useState as useState121 } from "react";
43940
43976
  import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
43941
43977
  import { BasicInput as BasicInput24, Button as Button91, cn as cn78 } from "@ai-matrx/design-system";
43942
43978
 
@@ -44044,7 +44080,7 @@ function PortalLookEditor({ card, onSaved, className }) {
44044
44080
  cancelled = true;
44045
44081
  };
44046
44082
  }, [card, client]);
44047
- const orgName = useMemo69(
44083
+ const orgName = useMemo70(
44048
44084
  () => card.style.from_organization.includes("display_name") ? card.style.display_name : null,
44049
44085
  [card.style]
44050
44086
  );
@@ -44839,7 +44875,7 @@ function Invite({ card, onInvited }) {
44839
44875
  cancelled = true;
44840
44876
  };
44841
44877
  }, [client, card.client_table_id]);
44842
- const options = useMemo70(() => {
44878
+ const options = useMemo71(() => {
44843
44879
  const all = (rows ?? []).map((row) => ({ id: row.id, name: rowNameIn(clientTable, row) }));
44844
44880
  const needle = search.trim().toLowerCase();
44845
44881
  return needle === "" ? all.slice(0, 25) : all.filter((o) => o.name.toLowerCase().includes(needle)).slice(0, 25);
@@ -45032,7 +45068,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
45032
45068
  }
45033
45069
 
45034
45070
  // src/DigestScheduler.tsx
45035
- import { useCallback as useCallback52, useEffect as useEffect104, useMemo as useMemo71, useState as useState123 } from "react";
45071
+ import { useCallback as useCallback52, useEffect as useEffect104, useMemo as useMemo72, useState as useState123 } from "react";
45036
45072
  import { useRecordsClient as useRecordsClient86, useTable as useTable28 } from "@ai-matrx/records/react";
45037
45073
  import { hasQuietHours } from "@ai-matrx/records";
45038
45074
  import { BasicInput as BasicInput26, Button as Button93, Checkbox as Checkbox15, Label as Label21, Separator as Separator12, Skeleton as Skeleton28, cn as cn81 } from "@ai-matrx/design-system";
@@ -45153,12 +45189,12 @@ function DigestScheduler({
45153
45189
  useEffect104(() => {
45154
45190
  void load();
45155
45191
  }, [load]);
45156
- const schedule = useMemo71(() => {
45192
+ const schedule = useMemo72(() => {
45157
45193
  if (cadence === "weekly") return `${weekday} ${time}`;
45158
45194
  if (cadence === "daily") return time;
45159
45195
  return null;
45160
45196
  }, [cadence, weekday, time]);
45161
- const quietHours = useMemo71(
45197
+ const quietHours = useMemo72(
45162
45198
  () => quiet2 ? { start: quietFrom, end: quietTo, tz: timezone } : { tz: timezone },
45163
45199
  [quiet2, quietFrom, quietTo, timezone]
45164
45200
  );
@@ -45840,7 +45876,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
45840
45876
  import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
45841
45877
  import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
45842
45878
  import { Select as Select23 } from "@ai-matrx/design-system/controls";
45843
- import { useCallback as useCallback56, useEffect as useEffect108, useMemo as useMemo73, useRef as useRef59, useState as useState128 } from "react";
45879
+ import { useCallback as useCallback56, useEffect as useEffect108, useMemo as useMemo74, useRef as useRef59, useState as useState128 } from "react";
45844
45880
  import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
45845
45881
  import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
45846
45882
  import { CSS as CSS3 } from "@dnd-kit/utilities";
@@ -46113,8 +46149,8 @@ function EmbedSnippets({ url, label }) {
46113
46149
  }
46114
46150
 
46115
46151
  // src/FormRunner.tsx
46116
- import { useCallback as useCallback55, useEffect as useEffect107, useMemo as useMemo72, useRef as useRef58, useState as useState127 } from "react";
46117
- import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecordsClient20 } from "@ai-matrx/records/react";
46152
+ import { useCallback as useCallback55, useEffect as useEffect107, useMemo as useMemo73, useRef as useRef58, useState as useState127 } from "react";
46153
+ import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecordsClient21 } from "@ai-matrx/records/react";
46118
46154
  import { Button as Button97, Label as Label24, Progress, Skeleton as Skeleton31, cn as cn84, formThemeClasses } from "@ai-matrx/design-system";
46119
46155
  import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
46120
46156
  import { humanizeIdentifier as humanizeIdentifier21 } from "@ai-matrx/kit/text-case";
@@ -46129,7 +46165,7 @@ function FormRunner(props) {
46129
46165
  return /* @__PURE__ */ jsx151(ConnectedFormRunner, { ...props });
46130
46166
  }
46131
46167
  function ConnectedFormRunner(props) {
46132
- const client = useOptionalRecordsClient20();
46168
+ const client = useOptionalRecordsClient21();
46133
46169
  const fields = useFields27(props.form.subject);
46134
46170
  const { form, className } = props;
46135
46171
  const submit = useCallback55(
@@ -46236,7 +46272,7 @@ function FormStage({
46236
46272
  const choose = autoAdvance ?? form.autoAdvance ?? true;
46237
46273
  const decoy = useRef58("");
46238
46274
  const stage = useRef58(null);
46239
- const questions = useMemo72(() => {
46275
+ const questions = useMemo73(() => {
46240
46276
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
46241
46277
  return (form.questions ?? []).map((q) => {
46242
46278
  const field2 = byKey.get(q.field) ?? null;
@@ -46936,12 +46972,12 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
46936
46972
  }
46937
46973
  onActiveForm?.(chosen);
46938
46974
  }, [forms, activeFormId, makeOnMount]);
46939
- const byKey = useMemo73(() => new Map((fields.data ?? []).map((f) => [f.key, f])), [fields.data]);
46940
- const conditionFields = useMemo73(
46975
+ const byKey = useMemo74(() => new Map((fields.data ?? []).map((f) => [f.key, f])), [fields.data]);
46976
+ const conditionFields = useMemo74(
46941
46977
  () => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: f.label || f.key, field: f })),
46942
46978
  [fields.data]
46943
46979
  );
46944
- const stored = useMemo73(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
46980
+ const stored = useMemo74(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
46945
46981
  const dirty = Boolean(draft && stored && !sameForm(draft, stored));
46946
46982
  useEffect108(() => {
46947
46983
  if (!draft || !stored) return;
@@ -48548,7 +48584,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
48548
48584
  }
48549
48585
 
48550
48586
  // src/DashboardCanvas.tsx
48551
- import { useCallback as useCallback61, useEffect as useEffect113, useMemo as useMemo75, useState as useState134 } from "react";
48587
+ import { useCallback as useCallback61, useEffect as useEffect113, useMemo as useMemo76, useState as useState134 } from "react";
48552
48588
  import { useFields as useFields32, useRecordsClient as useRecordsClient95, useTable as useTable34 } from "@ai-matrx/records/react";
48553
48589
  import {
48554
48590
  BasicInput as BasicInput32,
@@ -48717,7 +48753,7 @@ function GridCell2({
48717
48753
  }
48718
48754
 
48719
48755
  // src/AddChart.tsx
48720
- import { useMemo as useMemo74, useState as useState133 } from "react";
48756
+ import { useMemo as useMemo75, useState as useState133 } from "react";
48721
48757
  import { useFields as useFields31, useRecordsClient as useRecordsClient94 } from "@ai-matrx/records/react";
48722
48758
  import {
48723
48759
  Button as Button103,
@@ -48769,7 +48805,7 @@ function AddChart({ subject, onAdd, onClose }) {
48769
48805
  const client = useRecordsClient94();
48770
48806
  const [tableId, setTableId] = useState133(subject);
48771
48807
  const fields = useFields31(tableId);
48772
- const all = useMemo74(() => onePerKey(fields.data ?? []), [fields.data]);
48808
+ const all = useMemo75(() => onePerKey(fields.data ?? []), [fields.data]);
48773
48809
  const labels = useRecordLabels(all);
48774
48810
  const wordsFor2 = (key, value) => {
48775
48811
  const field2 = all.find((f) => f.key === key);
@@ -48970,7 +49006,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
48970
49006
  const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
48971
49007
  if (chosen.id !== activeId) setActiveId(chosen.id);
48972
49008
  }, [boards, activeDashboardId, madeOnMount]);
48973
- const board = useMemo75(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
49009
+ const board = useMemo76(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
48974
49010
  const filterKey = JSON.stringify(filter ?? {});
48975
49011
  useEffect113(() => {
48976
49012
  if (!activeId) {
@@ -49557,7 +49593,7 @@ function TargetControl({
49557
49593
 
49558
49594
  // src/QuestionPanel.tsx
49559
49595
  import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
49560
- import { useEffect as useEffect114, useMemo as useMemo76, useRef as useRef61, useState as useState135 } from "react";
49596
+ import { useEffect as useEffect114, useMemo as useMemo77, useRef as useRef61, useState as useState135 } from "react";
49561
49597
  import { Badge as Badge24, BasicInput as BasicInput33, Button as Button105, Checkbox as Checkbox18, Label as Label27, Skeleton as Skeleton38, cn as cn92 } from "@ai-matrx/design-system";
49562
49598
  import { useFields as useFields33, useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
49563
49599
 
@@ -49609,7 +49645,7 @@ function fromLocalInput(value) {
49609
49645
  function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
49610
49646
  const client = useRecordsClient96();
49611
49647
  const fields = useFields33(tableId);
49612
- const all = useMemo76(() => fields.data ?? [], [fields.data]);
49648
+ const all = useMemo77(() => fields.data ?? [], [fields.data]);
49613
49649
  const me = client.config.actor?.user_id ?? null;
49614
49650
  const [hidden, setHidden] = useState135(null);
49615
49651
  const [related, setRelated] = useState135({});
@@ -49636,7 +49672,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
49636
49672
  live = false;
49637
49673
  };
49638
49674
  }, [client, tableId, all, fields.loading]);
49639
- const offered = useMemo76(() => hidden ? all.filter((f) => !hidden.has(f.key)) : [], [all, hidden]);
49675
+ const offered = useMemo77(() => hidden ? all.filter((f) => !hidden.has(f.key)) : [], [all, hidden]);
49640
49676
  const [saved, setSaved] = useState135(null);
49641
49677
  const [savedEpoch, setSavedEpoch] = useState135(0);
49642
49678
  const [current, setCurrent] = useState135(null);
@@ -50025,7 +50061,7 @@ function formatValue(key, value, fields) {
50025
50061
  return new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(value);
50026
50062
  }
50027
50063
  function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATED }) {
50028
- const block = useMemo76(
50064
+ const block = useMemo77(
50029
50065
  () => ({
50030
50066
  kind: "table",
50031
50067
  group_by: answer.groupKey && spec.group?.kind === "field" ? [answer.groupKey] : [],
@@ -50531,7 +50567,7 @@ function AgentAnswer({
50531
50567
  }
50532
50568
 
50533
50569
  // src/PageScreen.tsx
50534
- import { useCallback as useCallback62, useEffect as useEffect116, useMemo as useMemo77, useState as useState137 } from "react";
50570
+ import { useCallback as useCallback62, useEffect as useEffect116, useMemo as useMemo78, useState as useState137 } from "react";
50535
50571
  import {
50536
50572
  useFields as useFields35,
50537
50573
  useRecordPage as useRecordPage3,
@@ -50640,7 +50676,7 @@ function PageScreen({
50640
50676
  live = false;
50641
50677
  };
50642
50678
  }, [client, chartKey]);
50643
- const blocks = useMemo77(
50679
+ const blocks = useMemo78(
50644
50680
  () => page ? pageBlocksOf(page.presentation, page.blocks.map((b) => b.id ?? "").filter(Boolean)) : [],
50645
50681
  [page]
50646
50682
  );
@@ -50906,7 +50942,7 @@ function ListBlockView({
50906
50942
  const client = useRecordsClient98();
50907
50943
  const table = useTable36(block.table_id);
50908
50944
  const fields = useFields35(block.table_id);
50909
- const all = useMemo77(() => onePerKey3(fields.data ?? []), [fields.data]);
50945
+ const all = useMemo78(() => onePerKey3(fields.data ?? []), [fields.data]);
50910
50946
  const [view, setView] = useState137(block.view_id ? "reading" : null);
50911
50947
  useEffect116(() => {
50912
50948
  if (!block.view_id) {
@@ -51509,7 +51545,7 @@ import { useFields as useFields36, useRecordsClient as useRecordsClient101, useT
51509
51545
  import { Button as Button110, Input as Input9, Skeleton as Skeleton43, Textarea as Textarea8, cn as cn96 } from "@ai-matrx/design-system";
51510
51546
 
51511
51547
  // src/CaptureRun.tsx
51512
- import { useCallback as useCallback64, useEffect as useEffect118, useMemo as useMemo78, useRef as useRef62, useState as useState139 } from "react";
51548
+ import { useCallback as useCallback64, useEffect as useEffect118, useMemo as useMemo79, useRef as useRef62, useState as useState139 } from "react";
51513
51549
  import {
51514
51550
  coerceTypedAnswer as coerceTypedAnswer3,
51515
51551
  coercionLabel,
@@ -51618,7 +51654,7 @@ function CaptureRun({ sheetId, face: given, className }) {
51618
51654
  cancelled = true;
51619
51655
  };
51620
51656
  }, [client, given, sheetId]);
51621
- const questions = useMemo78(() => {
51657
+ const questions = useMemo79(() => {
51622
51658
  const asked3 = face?.presentation?.questions ?? [];
51623
51659
  if (asked3.length > 0) return asked3;
51624
51660
  return (face?.fields ?? []).map((f) => ({
@@ -52478,7 +52514,7 @@ function useEmbedHandshake(args) {
52478
52514
 
52479
52515
  // src/TablePage.tsx
52480
52516
  import { copyText as copyText15 } from "@ai-matrx/kit/clipboard";
52481
- import { useCallback as useCallback70, useEffect as useEffect126, useMemo as useMemo82, useRef as useRef64, useState as useState152 } from "react";
52517
+ import { useCallback as useCallback70, useEffect as useEffect126, useMemo as useMemo83, useRef as useRef64, useState as useState152 } from "react";
52482
52518
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
52483
52519
  import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, useRecordsClient as useRecordsClient106, useSeededAnswer, useTable as useTable40, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
52484
52520
  import {
@@ -53037,7 +53073,7 @@ function RecordAsk({ tableId, recordId }) {
53037
53073
  }
53038
53074
 
53039
53075
  // src/breakDown.tsx
53040
- import { useMemo as useMemo79, useState as useState147 } from "react";
53076
+ import { useMemo as useMemo80, useState as useState147 } from "react";
53041
53077
  import {
53042
53078
  Button as Button116,
53043
53079
  Dialog as Dialog20,
@@ -53074,9 +53110,9 @@ function BreakDownDialog({
53074
53110
  onOpenChange,
53075
53111
  onApply
53076
53112
  }) {
53077
- const source = useMemo79(() => ({ kind: "table", id: tableId }), [tableId]);
53113
+ const source = useMemo80(() => ({ kind: "table", id: tableId }), [tableId]);
53078
53114
  const { def } = useDrillDefinition(open ? source : null);
53079
- const dimensions = useMemo79(() => drillDimensionsOf(def, NO_LABELS), [def]);
53115
+ const dimensions = useMemo80(() => drillDimensionsOf(def, NO_LABELS), [def]);
53080
53116
  const [picked, setPicked] = useState147(null);
53081
53117
  const key = picked ?? held?.field ?? dimensions[0]?.key ?? "";
53082
53118
  return /* @__PURE__ */ jsx173(Dialog20, { open, onOpenChange, children: /* @__PURE__ */ jsxs160(DialogContent20, { "data-break-down": "", className: "max-w-sm", children: [
@@ -53104,7 +53140,7 @@ function BreakDownDialog({
53104
53140
 
53105
53141
  // src/TableReference.tsx
53106
53142
  import { copyText as copyText14 } from "@ai-matrx/kit/clipboard";
53107
- import { useCallback as useCallback69, useMemo as useMemo80, useState as useState148 } from "react";
53143
+ import { useCallback as useCallback69, useMemo as useMemo81, useState as useState148 } from "react";
53108
53144
  import { useContentTransferCapabilities as useContentTransferCapabilities2 } from "@ai-matrx/alchemy/react/workspace";
53109
53145
  import { Button as Button117, Dialog as Dialog21, DialogContent as DialogContent21, DialogHeader as DialogHeader21, DialogTitle as DialogTitle21 } from "@ai-matrx/design-system";
53110
53146
  import { jsx as jsx174, jsxs as jsxs161 } from "react/jsx-runtime";
@@ -53133,7 +53169,7 @@ function TableReferenceDialog({
53133
53169
  const port = useContentTransferCapabilities2().reference;
53134
53170
  const notify = useRecordsUi().notify;
53135
53171
  const [copied, setCopied] = useState148(null);
53136
- const choices = useMemo80(
53172
+ const choices = useMemo81(
53137
53173
  () => tableReferenceChoices(table.id, tableName(table)).filter((c) => port?.supports(c.reference)),
53138
53174
  [table, port]
53139
53175
  );
@@ -53264,9 +53300,9 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
53264
53300
  }
53265
53301
 
53266
53302
  // src/ViewFilter.tsx
53267
- import { useEffect as useEffect124, useMemo as useMemo81, useState as useState150 } from "react";
53303
+ import { useEffect as useEffect124, useMemo as useMemo82, useState as useState150 } from "react";
53268
53304
  import { Button as Button119, Popover as Popover19, PopoverContent as PopoverContent19, PopoverTrigger as PopoverTrigger19 } from "@ai-matrx/design-system";
53269
- import { useFields as useFields38, useOptionalRecordsClient as useOptionalRecordsClient21 } from "@ai-matrx/records/react";
53305
+ import { useFields as useFields38, useOptionalRecordsClient as useOptionalRecordsClient22 } from "@ai-matrx/records/react";
53270
53306
  import { jsx as jsx176, jsxs as jsxs163 } from "react/jsx-runtime";
53271
53307
  function conditionCount(expr) {
53272
53308
  if (!expr || typeof expr !== "object" || Array.isArray(expr)) return 0;
@@ -53285,8 +53321,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
53285
53321
  useEffect124(() => {
53286
53322
  setDraft(saved);
53287
53323
  }, [view?.id, savedKey]);
53288
- const client = useOptionalRecordsClient21();
53289
- const relations = useMemo81(
53324
+ const client = useOptionalRecordsClient22();
53325
+ const relations = useMemo82(
53290
53326
  () => (fields.data ?? []).filter((f) => f.type === "relation" && !!f.relation_target),
53291
53327
  [fields.data]
53292
53328
  );
@@ -53305,7 +53341,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
53305
53341
  cancelled = true;
53306
53342
  };
53307
53343
  }, [open, client, relations]);
53308
- const conditionFields = useMemo81(() => {
53344
+ const conditionFields = useMemo82(() => {
53309
53345
  const own3 = (fields.data ?? []).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
53310
53346
  const reached = relations.flatMap(
53311
53347
  (rel) => (linkedFields[rel.id] ?? []).filter((inner2) => inner2.type !== "relation").map((inner2) => ({
@@ -54234,7 +54270,7 @@ function TablePage({
54234
54270
  const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
54235
54271
  setGridQuery((held) => sameViewAddress(held, next) ? held : next);
54236
54272
  }, []);
54237
- const addressPort = useMemo82(
54273
+ const addressPort = useMemo83(
54238
54274
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
54239
54275
  [reportGrid, addressResetEpoch]
54240
54276
  );
@@ -55195,7 +55231,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
55195
55231
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
55196
55232
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
55197
55233
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
55198
- import { useEffect as useEffect127, useMemo as useMemo83, useRef as useRef65, useState as useState153 } from "react";
55234
+ import { useEffect as useEffect127, useMemo as useMemo84, useRef as useRef65, useState as useState153 } from "react";
55199
55235
  import { Button as Button121, ErrorBox as ErrorBox9, Input as Input13, cn as cn102 } from "@ai-matrx/design-system";
55200
55236
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient107, useSeededAnswerAt } from "@ai-matrx/records/react";
55201
55237
  import { Fragment as Fragment73, jsx as jsx179, jsxs as jsxs166 } from "react/jsx-runtime";
@@ -55208,7 +55244,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
55208
55244
  const choiceColumns = entityChoiceColumns(entity.columns);
55209
55245
  const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
55210
55246
  const title = entityTitleColumn(entity.columns);
55211
- const extra = useMemo83(
55247
+ const extra = useMemo84(
55212
55248
  () => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
55213
55249
  [cardFields, entity.columns, title, column]
55214
55250
  );
@@ -55478,7 +55514,7 @@ function TablePage2(props) {
55478
55514
  }
55479
55515
 
55480
55516
  // src/DataBindingPicker.tsx
55481
- import { useEffect as useEffect128, useMemo as useMemo84 } from "react";
55517
+ import { useEffect as useEffect128, useMemo as useMemo85 } from "react";
55482
55518
  import { isEntityReferenceConfig } from "@ai-matrx/records";
55483
55519
  import { useFields as useFields40, useTable as useTable41 } from "@ai-matrx/records/react";
55484
55520
  import { BasicInput as BasicInput36, Button as Button122, CreatablePicker as CreatablePicker3, cn as cn103 } from "@ai-matrx/design-system";
@@ -55572,7 +55608,7 @@ function BindingDetails({
55572
55608
  }) {
55573
55609
  const table = useTable41(tableId);
55574
55610
  const fields = useFields40(tableId);
55575
- const fieldList = useMemo84(() => fields.data ?? [], [fields.data]);
55611
+ const fieldList = useMemo85(() => fields.data ?? [], [fields.data]);
55576
55612
  const shape = binding.semantic_type;
55577
55613
  useEffect128(() => {
55578
55614
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
@@ -55926,17 +55962,17 @@ function CalendarLinks({ port }) {
55926
55962
  }
55927
55963
 
55928
55964
  // src/TemplatePreview.tsx
55929
- import { useEffect as useEffect131, useMemo as useMemo85, useState as useState156 } from "react";
55965
+ import { useEffect as useEffect131, useMemo as useMemo86, useState as useState156 } from "react";
55930
55966
  import { templatePreview } from "@ai-matrx/records/memory";
55931
55967
  import { useRecordsClient as useRecordsClient109 } from "@ai-matrx/records/react";
55932
55968
  import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
55933
55969
  import { jsx as jsx185, jsxs as jsxs171 } from "react/jsx-runtime";
55934
55970
  function useTemplatePreview(spec, today) {
55935
- return useMemo85(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
55971
+ return useMemo86(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
55936
55972
  }
55937
55973
  function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
55938
55974
  const preview = useTemplatePreview(spec, today);
55939
- const bound2 = useMemo85(() => ({ ...host, sayLevelNeeded: false }), [host]);
55975
+ const bound2 = useMemo86(() => ({ ...host, sayLevelNeeded: false }), [host]);
55940
55976
  const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
55941
55977
  const [active, setActive] = useState156(first?.id ?? null);
55942
55978
  const table = preview.tables.find((t) => t.id === active) ?? first;