@ai-matrx/records-ui 0.93.8 → 0.93.12

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
@@ -2752,7 +2752,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
2752
2752
  if (refusal2)
2753
2753
  return /* @__PURE__ */ jsx12("div", { id, children: /* @__PURE__ */ jsx12(RefusalLine, { error: refusal2 }) });
2754
2754
  if (!options) return /* @__PURE__ */ jsx12("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
2755
- if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && allowsOtherValues(field2)) {
2755
+ if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (allowsOtherValues(field2) || !autoOpen)) {
2756
2756
  return /* @__PURE__ */ jsx12(
2757
2757
  OpenChoicePicker,
2758
2758
  {
@@ -2763,6 +2763,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
2763
2763
  disabled,
2764
2764
  id,
2765
2765
  addsChoices,
2766
+ allowOther: allowsOtherValues(field2),
2766
2767
  onChoicesChanged: () => setReread((n) => n + 1)
2767
2768
  }
2768
2769
  );
@@ -2835,6 +2836,7 @@ function OpenChoicePicker({
2835
2836
  disabled,
2836
2837
  id,
2837
2838
  addsChoices,
2839
+ allowOther = true,
2838
2840
  onChoicesChanged
2839
2841
  }) {
2840
2842
  const client = useOptionalRecordsClient5();
@@ -2852,7 +2854,7 @@ function OpenChoicePicker({
2852
2854
  });
2853
2855
  const q = search.trim();
2854
2856
  const visible = options.filter((o) => q === "" || titleOf(o).toLowerCase().includes(q.toLowerCase()));
2855
- const decided = decideTypedChoice({ words: q, options, allowOther: true, nudge: nudge ?? "ask" });
2857
+ const decided = decideTypedChoice({ words: q, options, allowOther, nudge: nudge ?? "ask" });
2856
2858
  const choose = (word, addingIt = false) => {
2857
2859
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
2858
2860
  let next;
@@ -2937,7 +2939,10 @@ function OpenChoicePicker({
2937
2939
  empty: q === "" ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
2938
2940
  add,
2939
2941
  foot,
2940
- footNote: addRefused ? /* @__PURE__ */ jsx12(RefusalLine, { error: addRefused }) : null
2942
+ footNote: addRefused ? /* @__PURE__ */ jsx12(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
2943
+ // never_add on a column that takes only its choices: said, never a silent nothing.
2944
+ /* @__PURE__ */ jsx12("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) })
2945
+ ) : null
2941
2946
  }
2942
2947
  )
2943
2948
  )
@@ -4641,7 +4646,7 @@ import {
4641
4646
  } from "@ai-matrx/records/react";
4642
4647
  import { asPermissionLevel } from "@ai-matrx/records";
4643
4648
  import { MatrxDataTable, tableStyleIsEmpty as tableStyleIsEmpty2 } from "@ai-matrx/design-system/data-table";
4644
- import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
4649
+ import { announceRecordChanged as announceRecordChanged4 } from "@ai-matrx/records/core";
4645
4650
 
4646
4651
  // src/archiveWords.ts
4647
4652
  function archiveConfirmSentence(what) {
@@ -4875,7 +4880,7 @@ function EmptyRecords({ words: words2 }) {
4875
4880
 
4876
4881
  // src/gridControls.tsx
4877
4882
  import { useCallback as useCallback9, useEffect as useEffect18, useMemo as useMemo14, useRef as useRef9, useState as useState22 } from "react";
4878
- import { tableShapeChanged, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
4883
+ import { tableShapeChanged as tableShapeChanged2, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
4879
4884
  import {
4880
4885
  BasicInput as BasicInput10,
4881
4886
  Button as Button17,
@@ -4891,20 +4896,21 @@ import {
4891
4896
 
4892
4897
  // src/FieldEditor.tsx
4893
4898
  import { useMemo as useMemo11, useState as useState18 } from "react";
4894
- import { useFieldMutation, useFields as useFields2, useRecords as useRecords2, useRecordsClient as useRecordsClient8, useTable } from "@ai-matrx/records/react";
4899
+ import { tableShapeChanged, useFieldMutation, useFields as useFields2, useRecords as useRecords2, useRecordsClient as useRecordsClient8, useTable } from "@ai-matrx/records/react";
4900
+ import { announceRecordChanged } from "@ai-matrx/records/core";
4895
4901
  import {
4896
4902
  BasicInput as BasicInput9,
4897
4903
  BasicTextarea as BasicTextarea5,
4898
4904
  Button as Button13,
4899
4905
  Checkbox as Checkbox5,
4900
4906
  Label as Label8,
4901
- Select as Select3,
4902
- SelectContent as SelectContent3,
4907
+ Select as Select4,
4908
+ SelectContent as SelectContent4,
4903
4909
  SelectGroup,
4904
- SelectItem as SelectItem3,
4910
+ SelectItem as SelectItem4,
4905
4911
  SelectLabel,
4906
- SelectTrigger as SelectTrigger3,
4907
- SelectValue as SelectValue3,
4912
+ SelectTrigger as SelectTrigger4,
4913
+ SelectValue as SelectValue4,
4908
4914
  Separator,
4909
4915
  cn as cn15
4910
4916
  } from "@ai-matrx/design-system";
@@ -5268,10 +5274,10 @@ function ChoiceColorsEditor({
5268
5274
 
5269
5275
  // src/ChoiceListEditor.tsx
5270
5276
  import { useEffect as useEffect14, useState as useState17 } from "react";
5271
- import { optionLabel } from "@ai-matrx/records";
5277
+ import { optionLabel, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
5272
5278
  import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
5273
- import { BasicInput as BasicInput8, Button as Button12, Label as Label6 } from "@ai-matrx/design-system";
5274
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
5279
+ import { BasicInput as BasicInput8, Button as Button12, Label as Label6, Select as Select3, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3 } from "@ai-matrx/design-system";
5280
+ import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
5275
5281
  var rowSeed = 0;
5276
5282
  var nextRow = () => `new-${rowSeed += 1}`;
5277
5283
  function choiceRowsFrom(options) {
@@ -5299,10 +5305,17 @@ function ChoiceListEditor({
5299
5305
  field: field2,
5300
5306
  rows,
5301
5307
  onRows,
5302
- onStart
5308
+ onStart,
5309
+ allowOther = false,
5310
+ rehome = {},
5311
+ onRehome
5303
5312
  }) {
5304
5313
  const client = useRecordsClient7();
5305
5314
  const [refused, setRefused] = useState17(null);
5315
+ const [usage, setUsage] = useState17(null);
5316
+ const [asking, setAsking] = useState17(null);
5317
+ const [moveTo, setMoveTo] = useState17("");
5318
+ const [removed, setRemoved] = useState17({});
5306
5319
  useEffect14(() => {
5307
5320
  if (rows !== null) return;
5308
5321
  let live = true;
@@ -5320,6 +5333,19 @@ function ChoiceListEditor({
5320
5333
  live = false;
5321
5334
  };
5322
5335
  }, [client, field2.id, rows, onRows, onStart]);
5336
+ useEffect14(() => {
5337
+ if (!onRehome) return;
5338
+ let live = true;
5339
+ void client.fieldChoiceUsage({ field_id: field2.id }).then(
5340
+ (got) => {
5341
+ if (live && got.ok) setUsage(got.data);
5342
+ },
5343
+ () => void 0
5344
+ );
5345
+ return () => {
5346
+ live = false;
5347
+ };
5348
+ }, [client, field2.id, onRehome]);
5323
5349
  if (refused) {
5324
5350
  return /* @__PURE__ */ jsxs19("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
5325
5351
  "The choices could not be read, so they are left as they are: ",
@@ -5336,6 +5362,37 @@ function ChoiceListEditor({
5336
5362
  onRows(next);
5337
5363
  };
5338
5364
  const named = (r, i) => r.words.trim() === "" ? `choice ${i + 1}` : `\u201C${r.words.trim()}\u201D`;
5365
+ const heldBy = (r) => r.id && onRehome ? usage?.[r.id]?.records ?? 0 : 0;
5366
+ const remove = (i) => {
5367
+ const r = rows[i];
5368
+ if (heldBy(r) > 0) {
5369
+ setAsking(r);
5370
+ setMoveTo("");
5371
+ return;
5372
+ }
5373
+ onRows(rows.filter((_, j) => j !== i));
5374
+ };
5375
+ const answer = (spec) => {
5376
+ if (!asking?.id || !onRehome) return;
5377
+ const index = rows.findIndex((r) => r.id === asking.id);
5378
+ setRemoved({ ...removed, [asking.id]: { row: asking, index: index < 0 ? rows.length : index } });
5379
+ onRows(rows.filter((r) => r.id !== asking.id));
5380
+ onRehome({ ...rehome, [asking.id]: spec });
5381
+ setAsking(null);
5382
+ };
5383
+ const putBack = (id) => {
5384
+ const was = removed[id];
5385
+ if (!was || !onRehome) return;
5386
+ const next = [...rows];
5387
+ next.splice(Math.min(was.index, next.length), 0, was.row);
5388
+ onRows(next);
5389
+ const { [id]: _gone, ...rest } = rehome;
5390
+ onRehome(rest);
5391
+ const { [id]: _was, ...keep } = removed;
5392
+ setRemoved(keep);
5393
+ };
5394
+ const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
5395
+ const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
5339
5396
  return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
5340
5397
  /* @__PURE__ */ jsx23(Label6, { className: "text-xs", children: "The choices" }),
5341
5398
  rows.length === 0 ? /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet. Add the first one here, or type it into a cell and answer Add." }) : null,
@@ -5351,10 +5408,43 @@ function ChoiceListEditor({
5351
5408
  ),
5352
5409
  /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
5353
5410
  /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
5354
- /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => onRows(rows.filter((_, j) => j !== i)), children: "\xD7" })
5411
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
5355
5412
  ] }, r.row)) }),
5413
+ asking ? (
5414
+ // THE QUESTION, Notion-style: where do the records that hold it go?
5415
+ /* @__PURE__ */ jsxs19(
5416
+ "div",
5417
+ {
5418
+ role: "group",
5419
+ "aria-label": recordsUseSentence(heldBy(asking), asking.words.trim()),
5420
+ "data-records-choice-removal-ask": "",
5421
+ className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
5422
+ children: [
5423
+ /* @__PURE__ */ jsx23("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
5424
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1", children: [
5425
+ targets.length > 0 ? /* @__PURE__ */ jsxs19(Fragment6, { children: [
5426
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
5427
+ /* @__PURE__ */ jsxs19(Select3, { value: moveTo, onValueChange: setMoveTo, children: [
5428
+ /* @__PURE__ */ jsx23(SelectTrigger3, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx23(SelectValue3, { placeholder: "Another choice" }) }),
5429
+ /* @__PURE__ */ jsx23(SelectContent3, { children: targets.map((r) => /* @__PURE__ */ jsx23(SelectItem3, { value: r.id, children: r.words.trim() }, r.id)) })
5430
+ ] })
5431
+ ] }) : null,
5432
+ allowOther ? /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
5433
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
5434
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
5435
+ ] })
5436
+ ]
5437
+ }
5438
+ )
5439
+ ) : null,
5440
+ Object.entries(rehome).map(
5441
+ ([id, spec]) => removed[id] ? /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
5442
+ /* @__PURE__ */ jsx23("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
5443
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
5444
+ ] }, id) : null
5445
+ ),
5356
5446
  /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: () => onRows([...rows, { id: null, words: "", row: nextRow() }]), children: "Add a choice" }),
5357
- /* @__PURE__ */ jsx23("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. A removed choice is no longer offered; records that hold it keep it." })
5447
+ /* @__PURE__ */ jsx23("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
5358
5448
  ] });
5359
5449
  }
5360
5450
 
@@ -5853,7 +5943,7 @@ function nextFieldSort(fields) {
5853
5943
 
5854
5944
  // src/FieldEditor.tsx
5855
5945
  import { FIELD_SENSITIVITIES, CONTEXT_POLICIES } from "@ai-matrx/records";
5856
- import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5946
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5857
5947
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
5858
5948
  var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
5859
5949
  var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
@@ -5895,6 +5985,9 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5895
5985
  const [optionText, setOptionText] = useState18("");
5896
5986
  const [choiceList, setChoiceList] = useState18(null);
5897
5987
  const [choiceListStart, setChoiceListStart] = useState18(null);
5988
+ const [rehome, setRehome] = useState18({});
5989
+ const [rehomed, setRehomed] = useState18(null);
5990
+ const [rehomeRefused, setRehomeRefused] = useState18(null);
5898
5991
  const [unit, setUnit] = useState18(field2?.unit ?? "$");
5899
5992
  const [withTime, setWithTime] = useState18(String(field2?.config?.["kind"] ?? "date") === "datetime");
5900
5993
  const [via, setVia] = useState18(String(field2?.config?.["via"] ?? ""));
@@ -5988,6 +6081,20 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5988
6081
  // K2: a re-aimed formula goes WITH its type word, the arm `field_update` reads it in.
5989
6082
  ...type === "formula" && formulaWritten && formulaChanged && formulaText.trim() !== "" ? { type: "formula", formula_text: formulaText.trim() } : {}
5990
6083
  };
6084
+ if (Object.keys(rehome).length > 0 && Array.isArray(patch.options)) {
6085
+ setRehomeRefused(null);
6086
+ const done = await client.fieldUpdateRehomingChoices({ field_id: field2.id, patch, rehome });
6087
+ if (!done.ok) {
6088
+ setRehomeRefused(done.error);
6089
+ return;
6090
+ }
6091
+ tableShapeChanged(tableId);
6092
+ for (const c of done.data.undo.cells_back) announceRecordChanged(c.record_id);
6093
+ const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
6094
+ setRehome({});
6095
+ setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
6096
+ return;
6097
+ }
5991
6098
  const written2 = await mutation.update({ field_id: field2.id, patch });
5992
6099
  if (written2 !== null) onSaved?.();
5993
6100
  return;
@@ -6072,16 +6179,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6072
6179
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6073
6180
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What it holds" }),
6074
6181
  /* @__PURE__ */ jsxs21(
6075
- Select3,
6182
+ Select4,
6076
6183
  {
6077
6184
  value: type,
6078
6185
  disabled: editing,
6079
6186
  onValueChange: (next) => setType(next),
6080
6187
  children: [
6081
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6082
- /* @__PURE__ */ jsx25(SelectContent3, { children: FIELD_TYPE_GROUPS.map((group) => /* @__PURE__ */ jsxs21(SelectGroup, { children: [
6188
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6189
+ /* @__PURE__ */ jsx25(SelectContent4, { children: FIELD_TYPE_GROUPS.map((group) => /* @__PURE__ */ jsxs21(SelectGroup, { children: [
6083
6190
  /* @__PURE__ */ jsx25(SelectLabel, { children: group }),
6084
- FIELD_TYPE_CHOICES.filter((c) => c.group === group).map((c) => /* @__PURE__ */ jsx25(SelectItem3, { value: c.id, children: c.label }, c.id))
6191
+ FIELD_TYPE_CHOICES.filter((c) => c.group === group).map((c) => /* @__PURE__ */ jsx25(SelectItem4, { value: c.id, children: c.label }, c.id))
6085
6192
  ] }, group)) })
6086
6193
  ]
6087
6194
  }
@@ -6158,7 +6265,18 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6158
6265
  relations,
6159
6266
  others,
6160
6267
  existingOptionsTable: Boolean(field2?.options_table_id ?? field2?.config?.["options_table_id"]),
6161
- choiceList: editing && field2 ? /* @__PURE__ */ jsx25(ChoiceListEditor, { field: field2, rows: choiceList, onRows: setChoiceList, onStart: setChoiceListStart }) : null,
6268
+ choiceList: editing && field2 ? /* @__PURE__ */ jsx25(
6269
+ ChoiceListEditor,
6270
+ {
6271
+ field: field2,
6272
+ rows: choiceList,
6273
+ onRows: setChoiceList,
6274
+ onStart: setChoiceListStart,
6275
+ allowOther,
6276
+ rehome,
6277
+ onRehome: setRehome
6278
+ }
6279
+ ) : null,
6162
6280
  allowedTypes,
6163
6281
  setAllowedTypes
6164
6282
  }
@@ -6214,16 +6332,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6214
6332
  /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6215
6333
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6216
6334
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Who can see what is in it" }),
6217
- /* @__PURE__ */ jsxs21(Select3, { value: sensitivity, onValueChange: setSensitivity, children: [
6218
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6219
- /* @__PURE__ */ jsx25(SelectContent3, { children: SENSITIVITIES.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6335
+ /* @__PURE__ */ jsxs21(Select4, { value: sensitivity, onValueChange: setSensitivity, children: [
6336
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6337
+ /* @__PURE__ */ jsx25(SelectContent4, { children: SENSITIVITIES.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6220
6338
  ] })
6221
6339
  ] }),
6222
6340
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6223
6341
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Can an assistant read it" }),
6224
- /* @__PURE__ */ jsxs21(Select3, { value: contextPolicy, onValueChange: setContextPolicy, children: [
6225
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6226
- /* @__PURE__ */ jsx25(SelectContent3, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6342
+ /* @__PURE__ */ jsxs21(Select4, { value: contextPolicy, onValueChange: setContextPolicy, children: [
6343
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6344
+ /* @__PURE__ */ jsx25(SelectContent4, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6227
6345
  ] })
6228
6346
  ] })
6229
6347
  ] }),
@@ -6246,13 +6364,13 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6246
6364
  rules.length === 0 ? /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No checks. Anything this kind of column can hold will be accepted." }) : null,
6247
6365
  rules.map((rule, index) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
6248
6366
  /* @__PURE__ */ jsxs21(
6249
- Select3,
6367
+ Select4,
6250
6368
  {
6251
6369
  value: rule.kind,
6252
6370
  onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
6253
6371
  children: [
6254
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6255
- /* @__PURE__ */ jsx25(SelectContent3, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.kind, children: row.label }, row.kind)) })
6372
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6373
+ /* @__PURE__ */ jsx25(SelectContent4, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.kind, children: row.label }, row.kind)) })
6256
6374
  ]
6257
6375
  }
6258
6376
  ),
@@ -6308,6 +6426,36 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6308
6426
  error: refusal("internal", COLUMN_DID_NOT_LAND_SENTENCE, COLUMN_DID_NOT_LAND_REMEDY)
6309
6427
  }
6310
6428
  ) : null,
6429
+ rehomeRefused ? /* @__PURE__ */ jsx25(RefusalNotice, { error: rehomeRefused }) : null,
6430
+ rehomed ? /* @__PURE__ */ jsxs21("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
6431
+ /* @__PURE__ */ jsx25("span", { children: rehomed.said }),
6432
+ rehomed.undo ? /* @__PURE__ */ jsx25(
6433
+ Button13,
6434
+ {
6435
+ type: "button",
6436
+ size: "sm",
6437
+ variant: "outline",
6438
+ className: "h-6 px-2 text-xs",
6439
+ onClick: () => {
6440
+ const undo = rehomed.undo;
6441
+ if (!undo || !field2) return;
6442
+ void client.fieldUpdateRehomingChoices({ field_id: field2.id, patch: { options: undo.options }, cells_back: undo.cells_back }).then((back) => {
6443
+ if (!back.ok) {
6444
+ setRehomeRefused(back.error);
6445
+ return;
6446
+ }
6447
+ tableShapeChanged(tableId);
6448
+ for (const c of undo.cells_back) announceRecordChanged(c.record_id);
6449
+ setChoiceList(null);
6450
+ setChoiceListStart(null);
6451
+ setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
6452
+ });
6453
+ },
6454
+ children: "Undo"
6455
+ }
6456
+ ) : null,
6457
+ /* @__PURE__ */ jsx25(Button13, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
6458
+ ] }) : null,
6311
6459
  backfillError ? /* @__PURE__ */ jsxs21("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
6312
6460
  /* @__PURE__ */ jsx25("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
6313
6461
  /* @__PURE__ */ jsx25(RefusalNotice, { error: backfillError })
@@ -6324,7 +6472,7 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6324
6472
  }
6325
6473
  ),
6326
6474
  onCancel ? /* @__PURE__ */ jsx25(Button13, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
6327
- field2 ? /* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-2", children: askingToRemove ? /* @__PURE__ */ jsxs21(Fragment6, { children: [
6475
+ field2 ? /* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-2", children: askingToRemove ? /* @__PURE__ */ jsxs21(Fragment7, { children: [
6328
6476
  /* @__PURE__ */ jsxs21("span", { className: "text-destructive", children: [
6329
6477
  archiveConfirmSentence(`the field \u201C${fieldName(field2)}\u201D`),
6330
6478
  " Its values stay in every record and come back with it."
@@ -6430,7 +6578,7 @@ function TypeQuestions(props) {
6430
6578
  );
6431
6579
  }
6432
6580
  if (type === "select" || type === "multi_select") {
6433
- if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment6, { children: props.choiceList });
6581
+ if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment7, { children: props.choiceList });
6434
6582
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6435
6583
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "The choices" }),
6436
6584
  /* @__PURE__ */ jsx25(
@@ -6483,9 +6631,9 @@ function TypeQuestions(props) {
6483
6631
  return /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6484
6632
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6485
6633
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: type === "rollup" ? "Across the records in" : "Read it from" }),
6486
- /* @__PURE__ */ jsxs21(Select3, { value: props.via, onValueChange: props.setVia, children: [
6487
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": type === "rollup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6488
- /* @__PURE__ */ jsx25(SelectContent3, { children: usable.map((f) => /* @__PURE__ */ jsxs21(SelectItem3, { value: f.key, children: [
6634
+ /* @__PURE__ */ jsxs21(Select4, { value: props.via, onValueChange: props.setVia, children: [
6635
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": type === "rollup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx25(SelectValue4, { placeholder: "Choose a column" }) }),
6636
+ /* @__PURE__ */ jsx25(SelectContent4, { children: usable.map((f) => /* @__PURE__ */ jsxs21(SelectItem4, { value: f.key, children: [
6489
6637
  fieldName(f),
6490
6638
  type === "rollup" && !f.multi ? " \u2014 holds one" : ""
6491
6639
  ] }, f.id)) })
@@ -6502,9 +6650,9 @@ function TypeQuestions(props) {
6502
6650
  }
6503
6651
  ) : /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6504
6652
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to work out" }),
6505
- /* @__PURE__ */ jsxs21(Select3, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
6506
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6507
- /* @__PURE__ */ jsx25(SelectContent3, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6653
+ /* @__PURE__ */ jsxs21(Select4, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
6654
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6655
+ /* @__PURE__ */ jsx25(SelectContent4, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6508
6656
  ] }),
6509
6657
  props.agg !== "count" ? /* @__PURE__ */ jsx25(
6510
6658
  ValueOnTheOtherSide,
@@ -6527,9 +6675,9 @@ function TypeQuestions(props) {
6527
6675
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
6528
6676
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6529
6677
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to do" }),
6530
- /* @__PURE__ */ jsxs21(Select3, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
6531
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6532
- /* @__PURE__ */ jsx25(SelectContent3, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6678
+ /* @__PURE__ */ jsxs21(Select4, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
6679
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6680
+ /* @__PURE__ */ jsx25(SelectContent4, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6533
6681
  ] })
6534
6682
  ] }),
6535
6683
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -6588,9 +6736,9 @@ function ValueOnTheOtherSide({
6588
6736
  const body = !relation ? /* @__PURE__ */ jsx25("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx25("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsxs21("p", { className: "text-[11px] text-muted-foreground", children: [
6589
6737
  fieldName(relation),
6590
6738
  " points at a table that has no columns to read yet. Add one there first."
6591
- ] }) : /* @__PURE__ */ jsxs21(Select3, { value, onValueChange: onChange, children: [
6592
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6593
- /* @__PURE__ */ jsx25(SelectContent3, { children: offered.map((column) => /* @__PURE__ */ jsx25(SelectItem3, { value: column.key, children: column.name }, column.key)) })
6739
+ ] }) : /* @__PURE__ */ jsxs21(Select4, { value, onValueChange: onChange, children: [
6740
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx25(SelectValue4, { placeholder: "Choose a column" }) }),
6741
+ /* @__PURE__ */ jsx25(SelectContent4, { children: offered.map((column) => /* @__PURE__ */ jsx25(SelectItem4, { value: column.key, children: column.name }, column.key)) })
6594
6742
  ] });
6595
6743
  if (compact) return /* @__PURE__ */ jsx25("div", { className: "mt-1 flex flex-col gap-1", children: body });
6596
6744
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -7327,7 +7475,7 @@ function gridCopyConfig(args) {
7327
7475
  }
7328
7476
 
7329
7477
  // src/gridSummaries.tsx
7330
- import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7478
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7331
7479
  var SUMMARY_ROW_ID = "__records_ui_summary__";
7332
7480
  var SUMMARY_ROW = {
7333
7481
  id: SUMMARY_ROW_ID,
@@ -7427,7 +7575,7 @@ function SummaryCell({
7427
7575
  chosen ? "text-foreground" : "text-muted-foreground opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
7428
7576
  ),
7429
7577
  title: chosen && rowCount !== null ? `${label} of ${fieldName(field2)}, worked out by the store over all ${rowCount} record${rowCount === 1 ? "" : "s"} \u2014 not only this page.` : `Summarize ${fieldName(field2)}`,
7430
- children: chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7578
+ children: chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7431
7579
  /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: label }),
7432
7580
  shown3 !== null ? /* @__PURE__ */ jsx28("span", { className: "font-medium tabular-nums", children: shown3 }) : /* @__PURE__ */ jsx28("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ jsx28(RecordValue, { field: field2, value, format: formatForField(field2) }) })
7433
7581
  ] }) : "Summarize"
@@ -7445,7 +7593,7 @@ function SummaryCell({
7445
7593
  },
7446
7594
  op2
7447
7595
  )),
7448
- chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7596
+ chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7449
7597
  /* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
7450
7598
  /* @__PURE__ */ jsx28(DropdownMenuItem, { onSelect: () => onChoose(null), children: "No summary" })
7451
7599
  ] }) : null
@@ -7644,7 +7792,7 @@ function documentOf(row) {
7644
7792
  }
7645
7793
 
7646
7794
  // src/gridControls.tsx
7647
- import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
7795
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
7648
7796
  function filterForValue(field2, value) {
7649
7797
  const empty = value === null || value === void 0 || value === "";
7650
7798
  if (empty) return { kind: "text", value: "", mode: "empty" };
@@ -7970,7 +8118,7 @@ function useMergedGridControls(args) {
7970
8118
  return;
7971
8119
  }
7972
8120
  notify?.success(`Each record is named by ${field2 ? fieldName(field2) : columnId} now.`);
7973
- tableShapeChanged(tableId);
8121
+ tableShapeChanged2(tableId);
7974
8122
  args.reloadTable();
7975
8123
  })();
7976
8124
  },
@@ -8027,7 +8175,7 @@ function useMergedGridControls(args) {
8027
8175
  [enabled, order, hidden, keepColumns]
8028
8176
  );
8029
8177
  const close = () => setDialog(null);
8030
- const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment8, { children: [
8178
+ const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment9, { children: [
8031
8179
  colours.dialogs,
8032
8180
  /* @__PURE__ */ jsx29(
8033
8181
  RowLabelPicker,
@@ -8038,7 +8186,7 @@ function useMergedGridControls(args) {
8038
8186
  tableId,
8039
8187
  fields,
8040
8188
  onSaved: () => {
8041
- tableShapeChanged(tableId);
8189
+ tableShapeChanged2(tableId);
8042
8190
  args.reloadTable();
8043
8191
  },
8044
8192
  notify
@@ -8160,7 +8308,7 @@ function useMergedGridControls(args) {
8160
8308
  columns: columnsControl,
8161
8309
  dialogs,
8162
8310
  addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
8163
- sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
8311
+ sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment9, { children: [
8164
8312
  colours.sheet,
8165
8313
  args.summaries ? /* @__PURE__ */ jsx29(
8166
8314
  SummarySheetControls,
@@ -8346,7 +8494,7 @@ import {
8346
8494
  Switch,
8347
8495
  cn as cn17
8348
8496
  } from "@ai-matrx/design-system";
8349
- import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8497
+ import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8350
8498
  var NO_ENRICH_REASON = "Having an agent fill this column is not switched on here yet, so this panel does not offer it rather than offering something that cannot happen. Everything else on this panel works. It is on our list, not yours.";
8351
8499
  function cellState(cell) {
8352
8500
  if (!cell || !cell.agent_owned) return "none";
@@ -8708,7 +8856,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
8708
8856
  children: "Show me five rows it would do"
8709
8857
  }
8710
8858
  ),
8711
- host.enrich ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
8859
+ host.enrich ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
8712
8860
  /* @__PURE__ */ jsx31(
8713
8861
  Button19,
8714
8862
  {
@@ -8946,7 +9094,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
8946
9094
  // src/PastePreview.tsx
8947
9095
  import { useState as useState25 } from "react";
8948
9096
  import { Badge as Badge7, Button as Button21, Separator as Separator2 } from "@ai-matrx/design-system";
8949
- import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
9097
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
8950
9098
  function PastePreview({
8951
9099
  plan,
8952
9100
  noun,
@@ -8974,7 +9122,7 @@ function PastePreview({
8974
9122
  /* @__PURE__ */ jsx33("span", { className: "text-xs text-muted-foreground", "data-matrx-paste-summary": true, children: outcome ? `${outcome.readBack} ${outcome.readBack === 1 ? "value" : "values"} read back` : summarize(plan) })
8975
9123
  ] }),
8976
9124
  /* @__PURE__ */ jsx33(Separator2, {}),
8977
- outcome === null ? /* @__PURE__ */ jsxs29(Fragment10, { children: [
9125
+ outcome === null ? /* @__PURE__ */ jsxs29(Fragment11, { children: [
8978
9126
  nothingToDo ? /* @__PURE__ */ jsx33("p", { className: "text-sm", children: "Nothing in what you pasted can be written to this table. Every cell is listed below with the reason." }) : /* @__PURE__ */ jsxs29("p", { className: "text-sm", children: [
8979
9127
  sentence(plan, noun, nounPlural),
8980
9128
  " The values below are exactly what will be stored, written the way the grid writes them \u2014 a choice column shows the word and stores the option behind it."
@@ -9064,7 +9212,7 @@ function PastePreview({
9064
9212
  }
9065
9213
  function Outcome({ outcome, onClose }) {
9066
9214
  const whole = outcome.missing === 0 && outcome.refusals.length === 0;
9067
- return /* @__PURE__ */ jsxs29(Fragment10, { children: [
9215
+ return /* @__PURE__ */ jsxs29(Fragment11, { children: [
9068
9216
  /* @__PURE__ */ jsx33("p", { className: "text-sm", "data-matrx-paste-outcome": whole ? "whole" : "partial", children: whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.` }),
9069
9217
  outcome.refusals.length > 0 ? /* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ jsx33("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
9070
9218
  /* @__PURE__ */ jsx33("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx33(Button21, { size: "sm", onClick: onClose, children: "Close" }) })
@@ -9467,14 +9615,14 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end") {
9467
9615
  // src/toolbarSlot.tsx
9468
9616
  import { createContext as createContext4, useContext as useContext4 } from "react";
9469
9617
  import { createPortal } from "react-dom";
9470
- import { Fragment as Fragment11, jsx as jsx36 } from "react/jsx-runtime";
9618
+ import { Fragment as Fragment12, jsx as jsx36 } from "react/jsx-runtime";
9471
9619
  var TableToolbarSlotContext = createContext4(void 0);
9472
9620
  function useTableToolbarSlot() {
9473
9621
  return useContext4(TableToolbarSlotContext);
9474
9622
  }
9475
9623
  function InTableToolbar({ children }) {
9476
9624
  const slot = useTableToolbarSlot();
9477
- if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment11, { children });
9625
+ if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment12, { children });
9478
9626
  if (slot === null) return null;
9479
9627
  return createPortal(children, slot);
9480
9628
  }
@@ -9502,7 +9650,7 @@ import {
9502
9650
  DropdownMenuSeparator as DropdownMenuSeparator2,
9503
9651
  DropdownMenuTrigger as DropdownMenuTrigger2
9504
9652
  } from "@ai-matrx/design-system";
9505
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
9653
+ import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
9506
9654
  function useStoreGridLayout(tableId) {
9507
9655
  const client = useRecordsClient16();
9508
9656
  const [answer, setAnswer] = useState27({
@@ -9590,7 +9738,7 @@ function GridLayoutMenu({
9590
9738
  ]
9591
9739
  }
9592
9740
  ) : null,
9593
- anyOwn ? /* @__PURE__ */ jsxs32(Fragment12, { children: [
9741
+ anyOwn ? /* @__PURE__ */ jsxs32(Fragment13, { children: [
9594
9742
  /* @__PURE__ */ jsx37(DropdownMenuSeparator2, {}),
9595
9743
  /* @__PURE__ */ jsx37(
9596
9744
  DropdownMenuItem2,
@@ -9609,10 +9757,10 @@ function GridLayoutMenu({
9609
9757
  // src/gridUndo.tsx
9610
9758
  import { useCallback as useCallback13, useEffect as useEffect23, useLayoutEffect, useMemo as useMemo18, useRef as useRef11, useState as useState28, useSyncExternalStore } from "react";
9611
9759
  import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
9612
- import { announceRecordChanged } from "@ai-matrx/records/core";
9760
+ import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
9613
9761
  import { Button as Button24 } from "@ai-matrx/design-system";
9614
9762
  import { createUndoStack, popRedo, popUndo, pushUndo } from "@ai-matrx/design-system/data-table";
9615
- import { Fragment as Fragment13, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
9763
+ import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
9616
9764
  function changesFor(step2, direction) {
9617
9765
  const byRow = /* @__PURE__ */ new Map();
9618
9766
  for (const cell of step2.cells) {
@@ -9677,7 +9825,7 @@ function useGridUndo(args) {
9677
9825
  }
9678
9826
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
9679
9827
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
9680
- announceRecordChanged(id);
9828
+ announceRecordChanged2(id);
9681
9829
  }
9682
9830
  setHeld(() => {
9683
9831
  let stack = taken.stack;
@@ -9751,7 +9899,7 @@ function UndoRedoLive({ source }) {
9751
9899
  function UndoRedoPair({ face, onUndo, onRedo }) {
9752
9900
  const undo = { depth: { back: face.back, forward: face.forward }, busy: face.busy };
9753
9901
  if (undo.depth.back === 0 && undo.depth.forward === 0) return null;
9754
- return /* @__PURE__ */ jsxs33(Fragment13, { children: [
9902
+ return /* @__PURE__ */ jsxs33(Fragment14, { children: [
9755
9903
  /* @__PURE__ */ jsxs33(
9756
9904
  Button24,
9757
9905
  {
@@ -10203,7 +10351,7 @@ function useGridAssist(args) {
10203
10351
  // src/gridBulk.tsx
10204
10352
  import { useCallback as useCallback15, useMemo as useMemo20, useState as useState31 } from "react";
10205
10353
  import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
10206
- import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
10354
+ import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
10207
10355
  import {
10208
10356
  Button as Button26,
10209
10357
  ConfirmDialog as ConfirmDialog3,
@@ -10215,7 +10363,7 @@ import {
10215
10363
  DialogTitle as DialogTitle5,
10216
10364
  Label as Label11
10217
10365
  } from "@ai-matrx/design-system";
10218
- import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
10366
+ import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
10219
10367
  function countOf(n, one, many) {
10220
10368
  return `${n} ${n === 1 ? one : many}`;
10221
10369
  }
@@ -10270,7 +10418,7 @@ function useGridBulk(args) {
10270
10418
  setRefusal(done.error);
10271
10419
  return null;
10272
10420
  }
10273
- for (const change of changes) if ("record_id" in change && change.record_id) announceRecordChanged2(change.record_id);
10421
+ for (const change of changes) if ("record_id" in change && change.record_id) announceRecordChanged3(change.record_id);
10274
10422
  return done.data;
10275
10423
  },
10276
10424
  [client, tableId]
@@ -10343,8 +10491,8 @@ function BulkActions({
10343
10491
  setAsking(null);
10344
10492
  if (ok) onDone();
10345
10493
  };
10346
- return /* @__PURE__ */ jsxs35(Fragment14, { children: [
10347
- typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment14, { children: [
10494
+ return /* @__PURE__ */ jsxs35(Fragment15, { children: [
10495
+ typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment15, { children: [
10348
10496
  /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "set", disabled: bulk.busy, onClick: () => open("set"), children: "Set a column" }),
10349
10497
  /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "clear", disabled: bulk.busy, onClick: () => open("clear"), children: "Clear a column" }),
10350
10498
  ids.length > 1 ? /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "fill", disabled: bulk.busy, onClick: () => open("fill"), children: "Fill down" }) : null
@@ -10978,7 +11126,7 @@ function HandOrderDialog({
10978
11126
  }
10979
11127
 
10980
11128
  // src/Grid.tsx
10981
- import { Fragment as Fragment15, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
11129
+ import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
10982
11130
  var NO_COLUMNS_YET = "This table has no columns yet";
10983
11131
  var NO_COLUMNS_WHY = "A column is what a record holds \u2014 a name, a date, an amount, a person. Add the first one and the grid appears with it; everything else on this page works the moment it exists.";
10984
11132
  var NO_SUMMARIES = Object.freeze({});
@@ -11412,7 +11560,7 @@ function Grid({
11412
11560
  }))
11413
11561
  );
11414
11562
  editing.forget(cells);
11415
- for (const u of updates) announceRecordChanged3(u.row.recordId);
11563
+ for (const u of updates) announceRecordChanged4(u.row.recordId);
11416
11564
  const lines = updates.length + creates.length;
11417
11565
  undo.push({ label: `Pasted ${lines} ${lines === 1 ? "row" : "rows"}`, cells, created });
11418
11566
  const expected = [
@@ -11768,7 +11916,7 @@ function Grid({
11768
11916
  const hasTalk = Boolean(host.talkToRecord);
11769
11917
  const hasAgent = Boolean(host.runAgentAction);
11770
11918
  const rowActions = useCallback16(
11771
- (row) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
11919
+ (row) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
11772
11920
  canWrite && mayWriteRow(row.id) ? tableActions.runnable.map((action) => /* @__PURE__ */ jsx43(
11773
11921
  ActionButton,
11774
11922
  {
@@ -12061,7 +12209,7 @@ function Grid({
12061
12209
  * — the table's own (clear, copy/export, group, columns), these, the search, the sort and
12062
12210
  * the page's filter, layout and share — in ONE "Tools" sheet. Never dropped.
12063
12211
  */
12064
- actions: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12212
+ actions: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12065
12213
  manual ? /* @__PURE__ */ jsx43(
12066
12214
  SortStateControl,
12067
12215
  {
@@ -12105,7 +12253,7 @@ function Grid({
12105
12253
  ...merged ? {
12106
12254
  overflow: {
12107
12255
  mode: phone ? "sheet" : toolbarFold2 >= 3 ? "menu" : "inline",
12108
- pinned: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12256
+ pinned: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12109
12257
  /* @__PURE__ */ jsx43(UndoRedoLive, { source: undoSource }),
12110
12258
  Boolean(editable) && rights.write ? /* @__PURE__ */ jsx43(Button28, { size: "sm", className: "shrink-0", disabled: added.busy, onClick: () => addRowRef.current(), children: added.busy ? "Adding\u2026" : "New record" }) : null
12111
12259
  ] }),
@@ -12338,7 +12486,7 @@ function Grid({
12338
12486
  rights.structure && onAddField ? /* @__PURE__ */ jsx43(Button28, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ jsx43("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("structure") })
12339
12487
  ]
12340
12488
  }
12341
- ) : /* @__PURE__ */ jsxs37(Fragment15, { children: [
12489
+ ) : /* @__PURE__ */ jsxs37(Fragment16, { children: [
12342
12490
  /* @__PURE__ */ jsx43(
12343
12491
  "div",
12344
12492
  {
@@ -12372,7 +12520,7 @@ function Grid({
12372
12520
  onSelectedIdsChange: setSelectedIds,
12373
12521
  noun,
12374
12522
  isRowSelectable,
12375
- actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
12523
+ actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
12376
12524
  merged ? /* @__PURE__ */ jsx43(
12377
12525
  BulkActions,
12378
12526
  {
@@ -12724,11 +12872,11 @@ import {
12724
12872
  import {
12725
12873
  Badge as Badge8,
12726
12874
  Button as Button30,
12727
- Select as Select4,
12728
- SelectContent as SelectContent4,
12729
- SelectItem as SelectItem4,
12730
- SelectTrigger as SelectTrigger4,
12731
- SelectValue as SelectValue4,
12875
+ Select as Select5,
12876
+ SelectContent as SelectContent5,
12877
+ SelectItem as SelectItem5,
12878
+ SelectTrigger as SelectTrigger5,
12879
+ SelectValue as SelectValue5,
12732
12880
  Separator as Separator3,
12733
12881
  cn as cn22
12734
12882
  } from "@ai-matrx/design-system";
@@ -12771,7 +12919,7 @@ function checkImportRules(fields, rows, mapping) {
12771
12919
  }
12772
12920
 
12773
12921
  // src/ImportWizard.tsx
12774
- import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
12922
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
12775
12923
  var BATCH = 250;
12776
12924
  var SAMPLES = 40;
12777
12925
  var ABSENT = "__absent__";
@@ -13050,7 +13198,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13050
13198
  accept: ".csv,.xlsx",
13051
13199
  disabled: busy,
13052
13200
  chosenName: fileName || null,
13053
- hint: /* @__PURE__ */ jsx45(Fragment16, { children: "A spreadsheet or CSV whose FIRST ROW is the column names \u2014 Job Number, Customer, Scheduled Date \u2014 and one row per record under it. Every column is shown back to you with what this table made of it, and nothing is written until you press Import." }),
13201
+ hint: /* @__PURE__ */ jsx45(Fragment17, { children: "A spreadsheet or CSV whose FIRST ROW is the column names \u2014 Job Number, Customer, Scheduled Date \u2014 and one row per record under it. Every column is shown back to you with what this table made of it, and nothing is written until you press Import." }),
13054
13202
  onFile: (file) => void take(file),
13055
13203
  ...fileName ? {
13056
13204
  onClear: () => {
@@ -13070,11 +13218,11 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13070
13218
  fileName ? `${fileName} has been sent to this table` : "This file has been sent to this table",
13071
13219
  ledger && !ledger.final ? ", but the run stopped part-way. Importing it again would write the rows that already landed a second time, so fix the file (or keep only the rows below the ones that landed) and choose it again." : ". What landed and what was refused is below. To import another file, choose it above."
13072
13220
  ] }) : null,
13073
- plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13221
+ plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13074
13222
  titleKey ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2 rounded border bg-muted/40 px-2 py-1.5", children: [
13075
13223
  /* @__PURE__ */ jsx45("span", { className: "font-medium", children: "What each record is called" }),
13076
13224
  /* @__PURE__ */ jsxs39(
13077
- Select4,
13225
+ Select5,
13078
13226
  {
13079
13227
  value: titleMappedTo ?? "",
13080
13228
  disabled: busy,
@@ -13090,15 +13238,15 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13090
13238
  },
13091
13239
  children: [
13092
13240
  /* @__PURE__ */ jsx45(
13093
- SelectTrigger4,
13241
+ SelectTrigger5,
13094
13242
  {
13095
13243
  size: "sm",
13096
13244
  "aria-label": "Which column each record is named by",
13097
13245
  className: "min-w-[14rem]",
13098
- children: /* @__PURE__ */ jsx45(SelectValue4, { placeholder: "\u2014 choose the column \u2014" })
13246
+ children: /* @__PURE__ */ jsx45(SelectValue5, { placeholder: "\u2014 choose the column \u2014" })
13099
13247
  }
13100
13248
  ),
13101
- /* @__PURE__ */ jsx45(SelectContent4, { children: plan.columns.map((c) => /* @__PURE__ */ jsx45(SelectItem4, { value: c.header, children: c.header }, c.header)) })
13249
+ /* @__PURE__ */ jsx45(SelectContent5, { children: plan.columns.map((c) => /* @__PURE__ */ jsx45(SelectItem5, { value: c.header, children: c.header }, c.header)) })
13102
13250
  ]
13103
13251
  }
13104
13252
  ),
@@ -13118,7 +13266,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13118
13266
  /* @__PURE__ */ jsx45("span", { className: "min-w-[8rem] flex-1 break-words font-medium", children: column.header }),
13119
13267
  /* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "goes to" }),
13120
13268
  /* @__PURE__ */ jsxs39(
13121
- Select4,
13269
+ Select5,
13122
13270
  {
13123
13271
  value: to || ABSENT,
13124
13272
  disabled: busy,
@@ -13132,18 +13280,18 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13132
13280
  },
13133
13281
  children: [
13134
13282
  /* @__PURE__ */ jsx45(
13135
- SelectTrigger4,
13283
+ SelectTrigger5,
13136
13284
  {
13137
13285
  size: "sm",
13138
13286
  "aria-label": `Where ${column.header} goes`,
13139
13287
  "data-goes-to": column.header,
13140
13288
  className: "min-w-[14rem] flex-1",
13141
- children: /* @__PURE__ */ jsx45(SelectValue4, {})
13289
+ children: /* @__PURE__ */ jsx45(SelectValue5, {})
13142
13290
  }
13143
13291
  ),
13144
- /* @__PURE__ */ jsxs39(SelectContent4, { children: [
13145
- /* @__PURE__ */ jsx45(SelectItem4, { value: ABSENT, children: absent }),
13146
- plan.fields.map((f) => /* @__PURE__ */ jsx45(SelectItem4, { value: f.key, children: f.label || f.key }, f.field_id))
13292
+ /* @__PURE__ */ jsxs39(SelectContent5, { children: [
13293
+ /* @__PURE__ */ jsx45(SelectItem5, { value: ABSENT, children: absent }),
13294
+ plan.fields.map((f) => /* @__PURE__ */ jsx45(SelectItem5, { value: f.key, children: f.label || f.key }, f.field_id))
13147
13295
  ] })
13148
13296
  ]
13149
13297
  }
@@ -13301,12 +13449,12 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13301
13449
  ] }) : null
13302
13450
  ] }) : null,
13303
13451
  alreadyRan ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: alreadyRan }) : null,
13304
- outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13452
+ outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13305
13453
  /* @__PURE__ */ jsx45(Separator3, {}),
13306
13454
  /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2", children: [
13307
13455
  /* @__PURE__ */ jsx45("span", { children: ledger ? `${ledger.written} landed \xB7 ${ledger.duplicate} already here \xB7 ${ledger.refused} refused, of ${ledger.seen} row${ledger.seen === 1 ? "" : "s"} offered` : `${counts.landed} landed \xB7 ${counts.duplicate} already here \xB7 ${counts.refused} refused` }),
13308
13456
  ledger && !ledger.final && phase !== "writing" ? /* @__PURE__ */ jsx45("span", { className: "text-destructive", children: "The run stopped here, so the rest of the file was never offered \u2014 these are the rows that were dealt with before it stopped, not the whole file." }) : null,
13309
- (ledger ? ledger.refused + ledger.duplicate : counts.refused + counts.duplicate) > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13457
+ (ledger ? ledger.refused + ledger.duplicate : counts.refused + counts.duplicate) > 0 ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13310
13458
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "all" && "font-medium"), onClick: () => setShow("all"), children: "everything that did not land" }),
13311
13459
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "refused" && "font-medium"), onClick: () => setShow("refused"), children: "refused" }),
13312
13460
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "duplicate" && "font-medium"), onClick: () => setShow("duplicate"), children: "already here" })
@@ -13362,7 +13510,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13362
13510
  ] }) : null
13363
13511
  ] }) : null,
13364
13512
  runsProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runsProblem }) : null,
13365
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13513
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13366
13514
  /* @__PURE__ */ jsx45(Separator3, {}),
13367
13515
  /* @__PURE__ */ jsx45("p", { className: "font-medium", children: "Imports into this table" }),
13368
13516
  /* @__PURE__ */ jsx45("ul", { className: "flex flex-col gap-1", children: runs.map((r) => /* @__PURE__ */ jsxs39("li", { className: "flex flex-col gap-1", children: [
@@ -13394,7 +13542,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13394
13542
  }
13395
13543
  ) : null
13396
13544
  ] }),
13397
- openRun === r.import_id ? runProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runProblem }) : runRows ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13545
+ openRun === r.import_id ? runProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runProblem }) : runRows ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13398
13546
  runRows.note ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: runRows.note }) : null,
13399
13547
  /* @__PURE__ */ jsx45("div", { className: "max-h-64 overflow-auto rounded border", children: /* @__PURE__ */ jsxs39("table", { className: "w-full", children: [
13400
13548
  /* @__PURE__ */ jsx45("thead", { className: "sticky top-0 bg-muted", children: /* @__PURE__ */ jsxs39("tr", { children: [
@@ -13438,11 +13586,11 @@ import {
13438
13586
  import {
13439
13587
  BasicInput as BasicInput11,
13440
13588
  Button as Button31,
13441
- Select as Select5,
13442
- SelectContent as SelectContent5,
13443
- SelectItem as SelectItem5,
13444
- SelectTrigger as SelectTrigger5,
13445
- SelectValue as SelectValue5,
13589
+ Select as Select6,
13590
+ SelectContent as SelectContent6,
13591
+ SelectItem as SelectItem6,
13592
+ SelectTrigger as SelectTrigger6,
13593
+ SelectValue as SelectValue6,
13446
13594
  Separator as Separator4,
13447
13595
  cn as cn23
13448
13596
  } from "@ai-matrx/design-system";
@@ -13522,11 +13670,12 @@ function CustomFieldsSection({
13522
13670
  const [newLabel, setNewLabel] = useState36("");
13523
13671
  const [newType, setNewType] = useState36("text");
13524
13672
  const [draft, setDraft] = useState36({});
13673
+ const [removing, setRemoving] = useState36(null);
13525
13674
  const fields = useMemo24(() => read.data?.fields ?? [], [read.data]);
13526
13675
  const mayAdd = rights.data?.may_declare === true;
13527
- const live = useRef15({ fields, rights: rights.data, loading: rights.loading, reload: read.reload });
13676
+ const live = useRef15({ fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} });
13528
13677
  useEffect29(() => {
13529
- live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload };
13678
+ live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} };
13530
13679
  });
13531
13680
  useEffect29(() => {
13532
13681
  if (!agentDoor) return;
@@ -13538,7 +13687,8 @@ function CustomFieldsSection({
13538
13687
  entityLabel: now.rights?.label ?? null,
13539
13688
  mayAdd: now.rights ? now.rights.may_declare === true : now.loading ? null : false,
13540
13689
  refusal: now.rights && !now.rights.may_declare ? now.rights.reason ?? null : null,
13541
- fields: now.fields.map((f) => ({ key: f.key, label: f.label, type: f.type })),
13690
+ fields: now.fields.map((f) => ({ key: f.key, label: f.label, type: f.type, value: now.values[f.key] })),
13691
+ mayFill: now.rights ? now.rights.may_fill_in !== false : now.loading ? null : false,
13542
13692
  types: ADDABLE_TYPES
13543
13693
  };
13544
13694
  };
@@ -13570,7 +13720,39 @@ function CustomFieldsSection({
13570
13720
  }
13571
13721
  return { ok: true, field_id: declared2.data, label, type };
13572
13722
  };
13573
- return agentDoor({ entityToken, recordId, state, check, addField });
13723
+ const resolveKeys = (values2) => {
13724
+ const now = live.current;
13725
+ const problems = [];
13726
+ const patch = {};
13727
+ const written2 = [];
13728
+ const entries = values2 && typeof values2 === "object" && !Array.isArray(values2) ? Object.entries(values2) : [];
13729
+ if (entries.length === 0) problems.push("Name at least one field and its value.");
13730
+ for (const [name, value] of entries) {
13731
+ const want = name.trim().toLowerCase();
13732
+ const field2 = now.fields.find((f) => f.key.toLowerCase() === want || f.label.trim().toLowerCase() === want);
13733
+ if (!field2) {
13734
+ problems.push(`There is no custom field "${name}". Fields: ${now.fields.map((f) => f.label).join(", ") || "none yet"}.`);
13735
+ continue;
13736
+ }
13737
+ patch[field2.key] = value;
13738
+ written2.push({ key: field2.key, label: field2.label, value });
13739
+ }
13740
+ if (now.rights && now.rights.may_fill_in === false) problems.push("This person may not fill in custom fields on this record.");
13741
+ return { problems, patch, written: written2 };
13742
+ };
13743
+ const checkValues = (values2) => resolveKeys(values2).problems;
13744
+ const setValues = async (values2) => {
13745
+ const { problems, patch, written: written2 } = resolveKeys(values2);
13746
+ if (problems.length > 0) return { ok: false, message: problems.join(" ") };
13747
+ const result = await client.entityValueWrite({ token: entityToken, record_id: recordId, patch });
13748
+ if (!result.ok) {
13749
+ const hint = hintForAPerson(result.error.hint);
13750
+ return { ok: false, message: hint ? `${result.error.message} ${hint}` : result.error.message };
13751
+ }
13752
+ live.current.reload();
13753
+ return { ok: true, written: written2 };
13754
+ };
13755
+ return agentDoor({ entityToken, recordId, state, check, addField, checkValues, setValues });
13574
13756
  }, [agentDoor, client, entityToken, recordId]);
13575
13757
  if (!read.loading && !read.error && fields.length === 0 && !mayAdd) return null;
13576
13758
  if (read.error) return /* @__PURE__ */ jsx46(RefusalLine, { error: read.error, className });
@@ -13668,9 +13850,9 @@ function CustomFieldsSection({
13668
13850
  ] }),
13669
13851
  /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-1", children: [
13670
13852
  /* @__PURE__ */ jsx46("span", { className: "text-muted-foreground", children: "Holds" }),
13671
- /* @__PURE__ */ jsxs40(Select5, { value: newType, onValueChange: setNewType, children: [
13672
- /* @__PURE__ */ jsx46(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx46(SelectValue5, {}) }),
13673
- /* @__PURE__ */ jsx46(SelectContent5, { children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx46(SelectItem5, { value: t.value, children: t.label }, t.value)) })
13853
+ /* @__PURE__ */ jsxs40(Select6, { value: newType, onValueChange: setNewType, children: [
13854
+ /* @__PURE__ */ jsx46(SelectTrigger6, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx46(SelectValue6, {}) }),
13855
+ /* @__PURE__ */ jsx46(SelectContent6, { children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx46(SelectItem6, { value: t.value, children: t.label }, t.value)) })
13674
13856
  ] })
13675
13857
  ] }),
13676
13858
  /* @__PURE__ */ jsx46(Button31, { size: "sm", type: "submit", disabled: mutation.saving || newLabel.trim() === "", children: mutation.saving ? "Adding\u2026" : "Add" })
@@ -13681,7 +13863,46 @@ function CustomFieldsSection({
13681
13863
  const field2 = asField(f);
13682
13864
  const id = `cf-${recordId}-${f.key}`;
13683
13865
  return /* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-col gap-1", children: [
13684
- /* @__PURE__ */ jsx46(FieldLabel, { field: field2, htmlFor: id }),
13866
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2", children: [
13867
+ /* @__PURE__ */ jsx46(FieldLabel, { field: field2, htmlFor: id }),
13868
+ mayAdd && removing !== f.id ? /* @__PURE__ */ jsx46(
13869
+ Button31,
13870
+ {
13871
+ size: "sm",
13872
+ variant: "ghost",
13873
+ className: "ml-auto h-6 px-2 text-xs text-muted-foreground",
13874
+ onClick: () => setRemoving(f.id),
13875
+ children: "Remove field"
13876
+ }
13877
+ ) : null
13878
+ ] }),
13879
+ removing === f.id ? /* @__PURE__ */ jsxs40("div", { className: "flex flex-wrap items-center gap-2", children: [
13880
+ /* @__PURE__ */ jsxs40("span", { className: "text-destructive", children: [
13881
+ archiveConfirmSentence(`the field \u201C${f.label}\u201D`),
13882
+ " It is removed for everyone in this organization; its values stay in every record and come back with it."
13883
+ ] }),
13884
+ /* @__PURE__ */ jsx46(
13885
+ Button31,
13886
+ {
13887
+ size: "sm",
13888
+ variant: "destructive",
13889
+ disabled: mutation.saving,
13890
+ onClick: async () => {
13891
+ const gone = await mutation.retire({ field_id: f.id });
13892
+ setRemoving(null);
13893
+ if (gone) {
13894
+ setDraft((d) => {
13895
+ const { [f.key]: _dropped, ...rest } = d;
13896
+ return rest;
13897
+ });
13898
+ read.reload();
13899
+ }
13900
+ },
13901
+ children: "Remove it"
13902
+ }
13903
+ ),
13904
+ /* @__PURE__ */ jsx46(Button31, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
13905
+ ] }) : null,
13685
13906
  /* @__PURE__ */ jsx46(
13686
13907
  FieldControl,
13687
13908
  {
@@ -13710,7 +13931,7 @@ import { BasicInput as BasicInput13, BasicTextarea as BasicTextarea7, Button as
13710
13931
  // src/Condition.tsx
13711
13932
  import { useState as useState37 } from "react";
13712
13933
  import { BasicInput as BasicInput12, Button as Button32 } from "@ai-matrx/design-system";
13713
- import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
13934
+ import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
13714
13935
  var CONDITION_OPS = [
13715
13936
  { op: "eq", label: "is" },
13716
13937
  { op: "ne", label: "is not" },
@@ -13821,7 +14042,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
13821
14042
  ]
13822
14043
  }
13823
14044
  ),
13824
- onField ? /* @__PURE__ */ jsxs41(Fragment17, { children: [
14045
+ onField ? /* @__PURE__ */ jsxs41(Fragment18, { children: [
13825
14046
  /* @__PURE__ */ jsx47(
13826
14047
  "select",
13827
14048
  {
@@ -14354,11 +14575,11 @@ import {
14354
14575
  Button as Button34,
14355
14576
  Checkbox as Checkbox6,
14356
14577
  Label as Label12,
14357
- Select as Select6,
14358
- SelectContent as SelectContent6,
14359
- SelectItem as SelectItem6,
14360
- SelectTrigger as SelectTrigger6,
14361
- SelectValue as SelectValue6,
14578
+ Select as Select7,
14579
+ SelectContent as SelectContent7,
14580
+ SelectItem as SelectItem7,
14581
+ SelectTrigger as SelectTrigger7,
14582
+ SelectValue as SelectValue7,
14362
14583
  cn as cn26
14363
14584
  } from "@ai-matrx/design-system";
14364
14585
 
@@ -14860,7 +15081,7 @@ function ActionForm({
14860
15081
  rows.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "ml-auto flex items-center gap-1", children: [
14861
15082
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Start from a record" }),
14862
15083
  /* @__PURE__ */ jsxs44(
14863
- Select6,
15084
+ Select7,
14864
15085
  {
14865
15086
  value: "",
14866
15087
  onValueChange: (id) => {
@@ -14878,8 +15099,8 @@ function ActionForm({
14878
15099
  setPreviewId(row.id);
14879
15100
  },
14880
15101
  children: [
14881
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Pick one" }) }),
14882
- /* @__PURE__ */ jsx50(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
15102
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx50(SelectValue7, { placeholder: "Pick one" }) }),
15103
+ /* @__PURE__ */ jsx50(SelectContent7, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem7, { value: row.id, children: rowName2(row) }, row.id)) })
14883
15104
  ]
14884
15105
  }
14885
15106
  )
@@ -14887,16 +15108,16 @@ function ActionForm({
14887
15108
  ] }),
14888
15109
  draft.steps.length === 0 ? /* @__PURE__ */ jsx50("p", { className: "text-muted-foreground", children: "Nothing yet. Add a change, or start from a record and remove the columns it should leave alone." }) : null,
14889
15110
  draft.steps.map((step2, index) => /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
14890
- /* @__PURE__ */ jsxs44(Select6, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
14891
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Column" }) }),
14892
- /* @__PURE__ */ jsx50(SelectContent6, { children: settable.map((f) => /* @__PURE__ */ jsx50(SelectItem6, { value: f.id, children: fieldName(f) }, f.id)) })
15111
+ /* @__PURE__ */ jsxs44(Select7, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
15112
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx50(SelectValue7, { placeholder: "Column" }) }),
15113
+ /* @__PURE__ */ jsx50(SelectContent7, { children: settable.map((f) => /* @__PURE__ */ jsx50(SelectItem7, { value: f.id, children: fieldName(f) }, f.id)) })
14893
15114
  ] }),
14894
- /* @__PURE__ */ jsxs44(Select6, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
14895
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14896
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14897
- /* @__PURE__ */ jsx50(SelectItem6, { value: "value", children: "Set to" }),
14898
- /* @__PURE__ */ jsx50(SelectItem6, { value: "clear", children: "Clear" }),
14899
- /* @__PURE__ */ jsx50(SelectItem6, { value: "compute", children: "Work out" })
15115
+ /* @__PURE__ */ jsxs44(Select7, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
15116
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15117
+ /* @__PURE__ */ jsxs44(SelectContent7, { children: [
15118
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "value", children: "Set to" }),
15119
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "clear", children: "Clear" }),
15120
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "compute", children: "Work out" })
14900
15121
  ] })
14901
15122
  ] }),
14902
15123
  step2.set === "value" ? /* @__PURE__ */ jsx50(
@@ -14941,9 +15162,9 @@ function ActionForm({
14941
15162
  /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", children: [
14942
15163
  /* @__PURE__ */ jsx50("span", { className: "font-medium", children: "Before and after" }),
14943
15164
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "on" }),
14944
- /* @__PURE__ */ jsxs44(Select6, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
14945
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14946
- /* @__PURE__ */ jsx50(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
15165
+ /* @__PURE__ */ jsxs44(Select7, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
15166
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15167
+ /* @__PURE__ */ jsx50(SelectContent7, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem7, { value: row.id, children: rowName2(row) }, row.id)) })
14947
15168
  ] })
14948
15169
  ] }),
14949
15170
  /* @__PURE__ */ jsx50(
@@ -14978,15 +15199,15 @@ function ActionForm({
14978
15199
  colors.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-1", children: [
14979
15200
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Color" }),
14980
15201
  /* @__PURE__ */ jsxs44(
14981
- Select6,
15202
+ Select7,
14982
15203
  {
14983
15204
  value: draft.color || NO_COLOR,
14984
15205
  onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
14985
15206
  children: [
14986
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14987
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14988
- /* @__PURE__ */ jsx50(SelectItem6, { value: NO_COLOR, children: "None" }),
14989
- colors.map((c) => /* @__PURE__ */ jsx50(SelectItem6, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
15207
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15208
+ /* @__PURE__ */ jsxs44(SelectContent7, { children: [
15209
+ /* @__PURE__ */ jsx50(SelectItem7, { value: NO_COLOR, children: "None" }),
15210
+ colors.map((c) => /* @__PURE__ */ jsx50(SelectItem7, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
14990
15211
  ] })
14991
15212
  ]
14992
15213
  }
@@ -15011,7 +15232,7 @@ function ActionForm({
15011
15232
  }
15012
15233
 
15013
15234
  // src/TableSettings.tsx
15014
- import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
15235
+ import { Fragment as Fragment19, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
15015
15236
  function TableSettings({
15016
15237
  tableId,
15017
15238
  proposals,
@@ -15183,7 +15404,7 @@ function TableSettings({
15183
15404
  /* @__PURE__ */ jsx51(Separator6, {}),
15184
15405
  /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-1", children: [
15185
15406
  /* @__PURE__ */ jsx51("span", { className: "font-medium", children: "This table" }),
15186
- askingToDelete ? /* @__PURE__ */ jsxs45(Fragment18, { children: [
15407
+ askingToDelete ? /* @__PURE__ */ jsxs45(Fragment19, { children: [
15187
15408
  /* @__PURE__ */ jsxs45("p", { className: "text-muted-foreground", "data-archive-confirm": "table", children: [
15188
15409
  archiveConfirmSentence(table.data ? `the table \u201C${tableName(table.data)}\u201D` : "this table"),
15189
15410
  " ",
@@ -15204,10 +15425,10 @@ function TableSettings({
15204
15425
  archive.slowedDown ? " The store is busy, so it is taking smaller passes \u2014 it will still finish." : ""
15205
15426
  ] }) : null,
15206
15427
  archive.interrupted && archive.progress ? /* @__PURE__ */ jsx51("p", { className: "text-muted-foreground", children: archive.error ? `That pass did not finish, so the rest is still here. ${archive.progress.archived_total.toLocaleString()} record${archive.progress.archived_total === 1 ? " is" : "s are"} already archived and ${archive.progress.remaining.toLocaleString()} ${archive.progress.remaining === 1 ? "is" : "are"} left. Nothing was lost \u2014 carry on and it picks up where it stopped.` : `Stopped. ${archive.progress.archived_total.toLocaleString()} record${archive.progress.archived_total === 1 ? " is" : "s are"} archived and ${archive.progress.remaining.toLocaleString()} ${archive.progress.remaining === 1 ? "is" : "are"} left. Carry on whenever you like \u2014 it picks up where it stopped.` }) : null,
15207
- /* @__PURE__ */ jsx51("div", { className: "flex gap-1", children: archive.running ? /* @__PURE__ */ jsxs45(Fragment18, { children: [
15428
+ /* @__PURE__ */ jsx51("div", { className: "flex gap-1", children: archive.running ? /* @__PURE__ */ jsxs45(Fragment19, { children: [
15208
15429
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", disabled: true, children: "Archiving\u2026" }),
15209
15430
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => archive.stop(), children: "Stop" })
15210
- ] }) : /* @__PURE__ */ jsxs45(Fragment18, { children: [
15431
+ ] }) : /* @__PURE__ */ jsxs45(Fragment19, { children: [
15211
15432
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", onClick: () => void startArchive(), children: archive.interrupted ? "Carry on archiving" : "Archive this table" }),
15212
15433
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
15213
15434
  ] }) })
@@ -15803,7 +16024,7 @@ function asWords(value) {
15803
16024
  // src/ShareControl.tsx
15804
16025
  import { useEffect as useEffect36, useState as useState45 } from "react";
15805
16026
  import { Button as Button37 } from "@ai-matrx/design-system";
15806
- import { Fragment as Fragment19, jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
16027
+ import { Fragment as Fragment20, jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
15807
16028
  function useCanShare() {
15808
16029
  return typeof useRecordsUi().share === "function";
15809
16030
  }
@@ -15830,7 +16051,7 @@ function ShareControl({
15830
16051
  const mayShare = may ?? asked2.share;
15831
16052
  if (!host.share) return null;
15832
16053
  if (!mayShare) return null;
15833
- return /* @__PURE__ */ jsxs48(Fragment19, { children: [
16054
+ return /* @__PURE__ */ jsxs48(Fragment20, { children: [
15834
16055
  /* @__PURE__ */ jsx54(
15835
16056
  Button37,
15836
16057
  {
@@ -15855,7 +16076,7 @@ function ShareControl({
15855
16076
  }
15856
16077
 
15857
16078
  // src/Peek.tsx
15858
- import { Fragment as Fragment20, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
16079
+ import { Fragment as Fragment21, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
15859
16080
  function Peek({ tableId, recordId, onClose, className }) {
15860
16081
  const table = useTable7(tableId);
15861
16082
  const fields = useFields11(tableId);
@@ -15913,7 +16134,7 @@ function Peek({ tableId, recordId, onClose, className }) {
15913
16134
  onClose ? /* @__PURE__ */ jsx55(Button38, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
15914
16135
  ] }),
15915
16136
  /* @__PURE__ */ jsx55(Separator8, {}),
15916
- talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16137
+ talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15917
16138
  /* @__PURE__ */ jsx55(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }),
15918
16139
  /* @__PURE__ */ jsx55(Separator8, {})
15919
16140
  ] }) : null,
@@ -15935,11 +16156,11 @@ function Peek({ tableId, recordId, onClose, className }) {
15935
16156
  ] }),
15936
16157
  /* @__PURE__ */ jsx55("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx55(RecordValue, { field: field2, value: document2?.[field2.key], document: document2, withheld: withheldNoticeOf(record.data?.hidden, field2.key) }) })
15937
16158
  ] }, field2.id)) }),
15938
- record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16159
+ record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15939
16160
  /* @__PURE__ */ jsx55(Separator8, {}),
15940
16161
  /* @__PURE__ */ jsx55("p", { className: "text-muted-foreground", children: "Nothing here can say which columns the system worked out for itself: that part of the record is not readable from your seat. Everything above is the record as it stands." })
15941
16162
  ] }) : null,
15942
- record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16163
+ record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15943
16164
  /* @__PURE__ */ jsx55(Separator8, {}),
15944
16165
  /* @__PURE__ */ jsxs49("div", { className: "flex flex-col gap-1", children: [
15945
16166
  /* @__PURE__ */ jsx55("span", { className: "font-medium", children: "Worked out by the system" }),
@@ -16072,7 +16293,7 @@ import {
16072
16293
  } from "@ai-matrx/design-system/data-table";
16073
16294
 
16074
16295
  // src/CardDates.tsx
16075
- import { Fragment as Fragment21, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
16296
+ import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
16076
16297
  function cardDateFields(all, titleField, hiddenFields) {
16077
16298
  const hidden = new Set(hiddenFields ?? []);
16078
16299
  return all.filter(
@@ -16087,7 +16308,7 @@ function CardDates({ record, fields }) {
16087
16308
  return value !== null && value !== void 0 && value !== "";
16088
16309
  });
16089
16310
  if (held.length === 0) return null;
16090
- return /* @__PURE__ */ jsx56(Fragment21, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16311
+ return /* @__PURE__ */ jsx56(Fragment22, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16091
16312
  "span",
16092
16313
  {
16093
16314
  className: "mt-0.5 flex min-w-0 items-baseline gap-1 text-[11px] text-muted-foreground",
@@ -16793,7 +17014,7 @@ function batchSentence(moved, waiting, notMoved, label) {
16793
17014
  }
16794
17015
 
16795
17016
  // src/ViewSwitcher.tsx
16796
- import { Fragment as Fragment22, jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
17017
+ import { Fragment as Fragment23, jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
16797
17018
  var NO_FIELDS = [];
16798
17019
  function useViewRecords(view, pageSize = 200, filter, viewId) {
16799
17020
  const client = useRecordsClient32();
@@ -17405,7 +17626,7 @@ function Card2({
17405
17626
  onClick: () => onOpenRecord?.(record.id),
17406
17627
  title: withheld ?? label,
17407
17628
  ...withheld && field2 ? { "data-records-withheld": field2.key } : {},
17408
- children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment22, { children: [
17629
+ children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment23, { children: [
17409
17630
  /* @__PURE__ */ jsx58("span", { className: "block truncate", children: label }),
17410
17631
  /* @__PURE__ */ jsx58(CardDates, { record, fields: dates })
17411
17632
  ] }) : label
@@ -18027,7 +18248,7 @@ import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/dat
18027
18248
  import { useCallback as useCallback25, useEffect as useEffect42, useMemo as useMemo32, useState as useState53 } from "react";
18028
18249
  import { useRecordsClient as useRecordsClient37, useTable as useTable10 } from "@ai-matrx/records/react";
18029
18250
  import { Badge as Badge13, BasicInput as BasicInput16, BasicTextarea as BasicTextarea9, Button as Button45, Skeleton as Skeleton11, cn as cn37 } from "@ai-matrx/design-system";
18030
- import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
18251
+ import { Fragment as Fragment24, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
18031
18252
  var DUE_WORD = DUE_STATE_LABEL;
18032
18253
  var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
18033
18254
  var NO_TEMPLATES = "No checklist has been written for this table yet. Ask an agent for one in a sentence \u2014 the steps, who each belongs to, and how many days in each is due \u2014 and it is stored whole, judged before a single step is written.";
@@ -18442,7 +18663,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18442
18663
  /* @__PURE__ */ jsxs57("p", { className: "mt-1 text-xs", children: [
18443
18664
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.steps }),
18444
18665
  " steps",
18445
- t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18666
+ t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18446
18667
  " \xB7 ",
18447
18668
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.roles }),
18448
18669
  " roles"
@@ -18467,7 +18688,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18467
18688
  }
18468
18689
  ) : null
18469
18690
  ] }, t.template_id)) }),
18470
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18691
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18471
18692
  /* @__PURE__ */ jsx63("h4", { className: "text-xs font-medium text-muted-foreground", children: "Runs" }),
18472
18693
  /* @__PURE__ */ jsx63("ul", { className: "flex flex-col gap-1.5", "data-testid": "checklist-runs", children: runs.map((run) => /* @__PURE__ */ jsxs57("li", { className: "rounded border p-2 text-xs", children: [
18473
18694
  /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-2", children: [
@@ -18749,7 +18970,7 @@ function roleKey(said) {
18749
18970
  }
18750
18971
 
18751
18972
  // src/ActionInbox.tsx
18752
- import { Fragment as Fragment24, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
18973
+ import { Fragment as Fragment25, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
18753
18974
  var ACTION_KINDS = ["approval", "assignment", "proposal"];
18754
18975
  var KIND_WORD2 = WORK_INBOX_KIND_LABEL;
18755
18976
  var DUE_WORD2 = DUE_STATE_LABEL;
@@ -19374,7 +19595,7 @@ function ActionInbox({
19374
19595
  /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-0.5", "data-testid": "inbox-closed", children: [
19375
19596
  /* @__PURE__ */ jsxs58("p", { className: "text-[11px] text-muted-foreground", children: [
19376
19597
  item.state === "withdrawn" ? item.decided_by_name ? `Withdrawn when ${item.decided_by_name} archived it` : "Withdrawn when what it would change was archived" : `${WORK_APPROVAL_STATE_LABEL[item.state] ?? item.state}${item.decided_by_name ? ` by ${item.decided_by_name}` : ""}`,
19377
- item.decided_at ? /* @__PURE__ */ jsxs58(Fragment24, { children: [
19598
+ item.decided_at ? /* @__PURE__ */ jsxs58(Fragment25, { children: [
19378
19599
  " \xB7 ",
19379
19600
  /* @__PURE__ */ jsx64("time", { dateTime: item.decided_at, children: whenWords2(item.decided_at) })
19380
19601
  ] }) : null
@@ -19546,7 +19767,7 @@ function ActionInbox({
19546
19767
  onSteps,
19547
19768
  actions: (stepId) => {
19548
19769
  const title = items?.find((i) => i.item_id === stepId)?.title ?? "this step";
19549
- return /* @__PURE__ */ jsxs58(Fragment24, { children: [
19770
+ return /* @__PURE__ */ jsxs58(Fragment25, { children: [
19550
19771
  snoozing === stepId ? snoozeChoices().map((c) => /* @__PURE__ */ jsx64(
19551
19772
  Button46,
19552
19773
  {
@@ -20130,7 +20351,7 @@ import {
20130
20351
  useTable as useTable13
20131
20352
  } from "@ai-matrx/records/react";
20132
20353
  import { Badge as Badge17, Button as Button49, Skeleton as Skeleton15, cn as cn41 } from "@ai-matrx/design-system";
20133
- import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
20354
+ import { Fragment as Fragment26, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
20134
20355
  function FieldHistoryPanel({
20135
20356
  tableId,
20136
20357
  fieldKey,
@@ -20225,7 +20446,7 @@ function FieldHistoryPanel({
20225
20446
  /* @__PURE__ */ jsx67("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
20226
20447
  /* @__PURE__ */ jsx67("strong", { className: "font-medium", children: say(row.after, void 0) })
20227
20448
  ] }),
20228
- /* @__PURE__ */ jsx67("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs61(Fragment25, { children: [
20449
+ /* @__PURE__ */ jsx67("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs61(Fragment26, { children: [
20229
20450
  /* @__PURE__ */ jsx67(Badge17, { variant: "outline", className: "mr-1 text-[10px]", children: "agent" }),
20230
20451
  "for ",
20231
20452
  row.actor.on_behalf_of?.name ?? "a person"
@@ -20373,7 +20594,7 @@ function submissionStamp(args) {
20373
20594
  import { useCallback as useCallback30, useEffect as useEffect47, useMemo as useMemo35, useState as useState58 } from "react";
20374
20595
  import { useRecordsClient as useRecordsClient42, useTables as useTables3 } from "@ai-matrx/records/react";
20375
20596
  import { BasicInput as BasicInput17, Button as Button50, Checkbox as Checkbox8, Label as Label13, Separator as Separator9, Skeleton as Skeleton16, cn as cn42 } from "@ai-matrx/design-system";
20376
- import { Fragment as Fragment26, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
20597
+ import { Fragment as Fragment27, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
20377
20598
  var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
20378
20599
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20379
20600
  const client = useRecordsClient42();
@@ -20524,7 +20745,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20524
20745
  ),
20525
20746
  /* @__PURE__ */ jsx68("span", { className: "text-xs text-muted-foreground", children: "One record in this table is one client. Their sign-in is a one-time link emailed to them \u2014 a portal never holds a password." })
20526
20747
  ] }),
20527
- clientTableId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20748
+ clientTableId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20528
20749
  /* @__PURE__ */ jsx68(Separator9, {}),
20529
20750
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20530
20751
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "What they can see" }),
@@ -20620,7 +20841,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20620
20841
  " yet."
20621
20842
  ] }) : null
20622
20843
  ] }) : null,
20623
- savedId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20844
+ savedId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20624
20845
  /* @__PURE__ */ jsx68(Separator9, {}),
20625
20846
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20626
20847
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "Invite a client" }),
@@ -20997,7 +21218,7 @@ function PortalLookEditor({ card, onSaved, className }) {
20997
21218
  }
20998
21219
 
20999
21220
  // src/PortalsPanel.tsx
21000
- import { Fragment as Fragment27, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
21221
+ import { Fragment as Fragment28, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
21001
21222
  var PORTAL_NOT_HERE_LINE = "The link named a portal this table is not part of \u2014 it may have been archived, or it shows other tables. The portals this table is in are listed here.";
21002
21223
  function revokeConsequence(person, portalTitle) {
21003
21224
  const who = person.client ? `${person.email} (${person.client})` : person.email;
@@ -21107,7 +21328,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
21107
21328
  buildLabel: elsewhere > 0 ? "Build a new portal" : "Build the portal",
21108
21329
  children: [
21109
21330
  "A portal is how one of your clients signs in and sees the records that name them \u2014 their jobs, their invoices \u2014 and nothing else.",
21110
- elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21331
+ elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21111
21332
  " ",
21112
21333
  "This table is not in",
21113
21334
  " ",
@@ -21235,7 +21456,7 @@ function ArchivePortalControl({
21235
21456
  if (said) {
21236
21457
  return /* @__PURE__ */ jsx71("span", { className: "text-xs text-muted-foreground", "data-testid": "portal-archived-said", children: said });
21237
21458
  }
21238
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21459
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21239
21460
  /* @__PURE__ */ jsx71(
21240
21461
  Button53,
21241
21462
  {
@@ -21283,7 +21504,7 @@ function ArchivePortalControl({
21283
21504
  function CopyLink({ url, what }) {
21284
21505
  const [copied, setCopied] = useState60(false);
21285
21506
  const [shown3, setShown] = useState60(false);
21286
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21507
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21287
21508
  /* @__PURE__ */ jsx71(
21288
21509
  Button53,
21289
21510
  {
@@ -21427,13 +21648,13 @@ function PortalCardView({
21427
21648
  ] })
21428
21649
  ] }, exposed.table_id))
21429
21650
  ] }),
21430
- look ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21651
+ look ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21431
21652
  /* @__PURE__ */ jsx71(Separator10, {}),
21432
21653
  look
21433
21654
  ] }) : null,
21434
21655
  /* @__PURE__ */ jsx71(Separator10, {}),
21435
21656
  /* @__PURE__ */ jsx71(People, { card, onRevoke, onPreview, origin }),
21436
- invite ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21657
+ invite ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21437
21658
  /* @__PURE__ */ jsx71(Separator10, {}),
21438
21659
  invite
21439
21660
  ] }) : null
@@ -21632,7 +21853,7 @@ function Invite({ card, onInvited }) {
21632
21853
  /* @__PURE__ */ jsx71("p", { className: "text-xs text-muted-foreground", children: "Pick the client they are, and say where to send their sign-in link. They get nothing until they follow it." }),
21633
21854
  error ? /* @__PURE__ */ jsx71(RefusalNotice, { error }) : null,
21634
21855
  said ? /* @__PURE__ */ jsx71("p", { className: "text-xs text-muted-foreground", children: said }) : null,
21635
- rows === null ? /* @__PURE__ */ jsx71(Skeleton17, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs65(Fragment27, { children: [
21856
+ rows === null ? /* @__PURE__ */ jsx71(Skeleton17, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs65(Fragment28, { children: [
21636
21857
  /* @__PURE__ */ jsx71(
21637
21858
  BasicInput19,
21638
21859
  {
@@ -21688,7 +21909,7 @@ function Invite({ card, onInvited }) {
21688
21909
  import { useCallback as useCallback32, useEffect as useEffect50, useMemo as useMemo38, useState as useState61 } from "react";
21689
21910
  import { useRecordsClient as useRecordsClient45 } from "@ai-matrx/records/react";
21690
21911
  import { BasicInput as BasicInput20, Button as Button54, Checkbox as Checkbox9, Label as Label14, Separator as Separator11, Skeleton as Skeleton18, cn as cn46 } from "@ai-matrx/design-system";
21691
- import { Fragment as Fragment28, jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
21912
+ import { Fragment as Fragment29, jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
21692
21913
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
21693
21914
  var CADENCE_WORDS = {
21694
21915
  instant: "the moment something arrives",
@@ -21907,7 +22128,7 @@ function DigestScheduler({
21907
22128
  ] }),
21908
22129
  /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1.5", children: [
21909
22130
  /* @__PURE__ */ jsx72(Label14, { className: "text-xs font-medium", children: "Who to send it to" }),
21910
- members === null ? /* @__PURE__ */ jsx72(Skeleton18, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx72("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs66(Fragment28, { children: [
22131
+ members === null ? /* @__PURE__ */ jsx72(Skeleton18, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx72("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs66(Fragment29, { children: [
21911
22132
  /* @__PURE__ */ jsx72("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: members.map((m) => /* @__PURE__ */ jsxs66("label", { className: "flex items-center gap-1.5 text-xs", children: [
21912
22133
  /* @__PURE__ */ jsx72(
21913
22134
  Checkbox9,
@@ -21949,7 +22170,7 @@ function DigestScheduler({
21949
22170
  ),
21950
22171
  /* @__PURE__ */ jsx72("span", { className: "text-xs text-muted-foreground", children: "A send inside these hours waits until they end \u2014 it is never dropped." })
21951
22172
  ] }) : null,
21952
- outcomes ? /* @__PURE__ */ jsxs66(Fragment28, { children: [
22173
+ outcomes ? /* @__PURE__ */ jsxs66(Fragment29, { children: [
21953
22174
  /* @__PURE__ */ jsx72(Separator11, {}),
21954
22175
  /* @__PURE__ */ jsx72("div", { className: "flex flex-col gap-1.5", children: outcomes.map((o) => /* @__PURE__ */ jsx72("div", { className: "text-xs", children: o.ruleId ? /* @__PURE__ */ jsxs66("span", { children: [
21955
22176
  o.who,
@@ -22444,7 +22665,7 @@ import {
22444
22665
  import { useCallback as useCallback35, useEffect as useEffect54, useMemo as useMemo39, useRef as useRef22, useState as useState65 } from "react";
22445
22666
  import { useFields as useFields18, useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
22446
22667
  import { Button as Button57, Progress, Skeleton as Skeleton21, cn as cn49 } from "@ai-matrx/design-system";
22447
- import { Fragment as Fragment29, jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
22668
+ import { Fragment as Fragment30, jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
22448
22669
  function authored(host, text, where) {
22449
22670
  return host.renderText ? host.renderText(text, where) : text;
22450
22671
  }
@@ -22820,7 +23041,7 @@ function Question({
22820
23041
  return /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-1.5", children: [
22821
23042
  /* @__PURE__ */ jsx75(FieldLabel, { field: { ...field2, label: question.ask, required: question.required }, htmlFor: id }),
22822
23043
  question.help ? /* @__PURE__ */ jsx75("p", { className: "text-xs text-muted-foreground", children: authored(host, question.help, "form-help") }) : null,
22823
- isAttachment && !upload ? /* @__PURE__ */ jsx75("p", { className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", children: NO_UPLOAD_REASON }) : isAttachment ? /* @__PURE__ */ jsxs69(Fragment29, { children: [
23044
+ isAttachment && !upload ? /* @__PURE__ */ jsx75("p", { className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", children: NO_UPLOAD_REASON }) : isAttachment ? /* @__PURE__ */ jsxs69(Fragment30, { children: [
22824
23045
  /* @__PURE__ */ jsx75(
22825
23046
  "input",
22826
23047
  {
@@ -23124,7 +23345,7 @@ function whyNotAskable(fields, hidden = []) {
23124
23345
  }
23125
23346
 
23126
23347
  // src/FormBuilder.tsx
23127
- import { Fragment as Fragment30, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23348
+ import { Fragment as Fragment31, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23128
23349
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23129
23350
  const client = useRecordsClient50();
23130
23351
  const publishGate = usePublishGate();
@@ -23309,7 +23530,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23309
23530
  }
23310
23531
  }
23311
23532
  ) : null,
23312
- !draft ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs71(Fragment30, { children: [
23533
+ !draft ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs71(Fragment31, { children: [
23313
23534
  /* @__PURE__ */ jsx77(
23314
23535
  PublishRow,
23315
23536
  {
@@ -23522,7 +23743,7 @@ function PublishRow({
23522
23743
  children: busy ? "\u2026" : open ? "Unpublish" : "Publish"
23523
23744
  }
23524
23745
  ) : null,
23525
- state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment30, { children: [
23746
+ state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment31, { children: [
23526
23747
  /* @__PURE__ */ jsx77(
23527
23748
  "a",
23528
23749
  {
@@ -24355,7 +24576,7 @@ import {
24355
24576
  } from "@ai-matrx/records";
24356
24577
  import { mapPgError } from "@ai-matrx/records/core";
24357
24578
  import { cn as cn56 } from "@ai-matrx/design-system";
24358
- import { Fragment as Fragment31, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
24579
+ import { Fragment as Fragment32, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
24359
24580
  var priorKey = (key) => `prior__${key}`;
24360
24581
  function Trend({ pct, aimingUp, className }) {
24361
24582
  if (pct === null || pct === void 0) return null;
@@ -24506,7 +24727,7 @@ function ChartBlock({ block, subject, className }) {
24506
24727
  ] }),
24507
24728
  block.compare_refused ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: block.compare_refused }) : null,
24508
24729
  !block.refused && targetNote(target) ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: targetNote(target) }) : null,
24509
- block.refused ? /* @__PURE__ */ jsx82(RefusalNotice, { error: asRefusal2(block) }) : needs ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: needs }) : kind === "stuck" ? /* @__PURE__ */ jsx82(StuckList, { rows: block.rows ?? [] }) : points.length === 0 ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: "The store answered this question with no groups at all, so there is nothing to draw yet." }) : /* @__PURE__ */ jsx82(Fragment31, { children: kind === "number" ? /* @__PURE__ */ jsx82(BigNumber, { points, measure: primary, onDrill: drill, block }) : kind === "table" ? /* @__PURE__ */ jsx82(GroupTable, { points, series, onDrill: drill }) : /* @__PURE__ */ jsxs76(Fragment31, { children: [
24730
+ block.refused ? /* @__PURE__ */ jsx82(RefusalNotice, { error: asRefusal2(block) }) : needs ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: needs }) : kind === "stuck" ? /* @__PURE__ */ jsx82(StuckList, { rows: block.rows ?? [] }) : points.length === 0 ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: "The store answered this question with no groups at all, so there is nothing to draw yet." }) : /* @__PURE__ */ jsx82(Fragment32, { children: kind === "number" ? /* @__PURE__ */ jsx82(BigNumber, { points, measure: primary, onDrill: drill, block }) : kind === "table" ? /* @__PURE__ */ jsx82(GroupTable, { points, series, onDrill: drill }) : /* @__PURE__ */ jsxs76(Fragment32, { children: [
24510
24731
  /* @__PURE__ */ jsx82(Drawing, { kind, points, series, config, onDrill: drill, goal }),
24511
24732
  /* @__PURE__ */ jsx82(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
24512
24733
  ] }) })
@@ -24526,7 +24747,7 @@ function BigNumber({
24526
24747
  const windows = block.compare ?? null;
24527
24748
  const target = block.target ?? null;
24528
24749
  const priorTotal = block.totals?.prior;
24529
- const body = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24750
+ const body = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24530
24751
  /* @__PURE__ */ jsxs76("span", { className: "flex items-baseline gap-2", children: [
24531
24752
  /* @__PURE__ */ jsx82("span", { className: "text-2xl font-semibold tabular-nums", children: pretty(total) }),
24532
24753
  windows ? /* @__PURE__ */ jsx82(Trend, { pct: block.totals?.change_pct, aimingUp: !!target, className: "text-sm" }) : null
@@ -24570,7 +24791,7 @@ function Values({
24570
24791
  aimingUp
24571
24792
  }) {
24572
24793
  return /* @__PURE__ */ jsx82("ul", { className: "flex flex-wrap gap-x-2 gap-y-0.5", children: points.map((point) => {
24573
- const text = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24794
+ const text = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24574
24795
  /* @__PURE__ */ jsx82(
24575
24796
  "span",
24576
24797
  {
@@ -24750,10 +24971,10 @@ function Drawing({
24750
24971
  margin: { top: 6, right: 6, bottom: 0, left: 0 },
24751
24972
  children: [
24752
24973
  /* @__PURE__ */ jsx82(CartesianGrid, { vertical: horizontal, horizontal: !horizontal }),
24753
- horizontal ? /* @__PURE__ */ jsxs76(Fragment31, { children: [
24974
+ horizontal ? /* @__PURE__ */ jsxs76(Fragment32, { children: [
24754
24975
  /* @__PURE__ */ jsx82(XAxis, { type: "number", ...axis }),
24755
24976
  /* @__PURE__ */ jsx82(YAxis, { type: "category", dataKey: "label", width: 88, ...axis })
24756
- ] }) : /* @__PURE__ */ jsxs76(Fragment31, { children: [
24977
+ ] }) : /* @__PURE__ */ jsxs76(Fragment32, { children: [
24757
24978
  /* @__PURE__ */ jsx82(XAxis, { dataKey: "label", ...axis }),
24758
24979
  /* @__PURE__ */ jsx82(YAxis, { width: 44, ...axis })
24759
24980
  ] }),
@@ -24783,15 +25004,15 @@ import { useFields as useFields22, useRecordsClient as useRecordsClient54, useTa
24783
25004
  import {
24784
25005
  BasicInput as BasicInput25,
24785
25006
  Button as Button63,
24786
- Select as Select7,
24787
- SelectContent as SelectContent7,
24788
- SelectItem as SelectItem7,
24789
- SelectTrigger as SelectTrigger7,
24790
- SelectValue as SelectValue7,
25007
+ Select as Select8,
25008
+ SelectContent as SelectContent8,
25009
+ SelectItem as SelectItem8,
25010
+ SelectTrigger as SelectTrigger8,
25011
+ SelectValue as SelectValue8,
24791
25012
  Skeleton as Skeleton27,
24792
25013
  cn as cn57
24793
25014
  } from "@ai-matrx/design-system";
24794
- import { Fragment as Fragment32, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
25015
+ import { Fragment as Fragment33, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
24795
25016
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24796
25017
  const client = useRecordsClient54();
24797
25018
  const host = useRecordsUi();
@@ -24966,15 +25187,15 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24966
25187
  rights.admin ? /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
24967
25188
  board ? /* @__PURE__ */ jsxs77("span", { className: "ml-auto flex items-center gap-1", children: [
24968
25189
  (board.blocks ?? []).some((b) => !!b.bucket) ? /* @__PURE__ */ jsxs77(
24969
- Select7,
25190
+ Select8,
24970
25191
  {
24971
25192
  value: grain ?? "saved",
24972
25193
  onValueChange: (v) => setGrain(v === "saved" ? null : v),
24973
25194
  children: [
24974
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": "Date grain for every chart on this dashboard", className: "h-7 min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
24975
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
24976
- /* @__PURE__ */ jsx83(SelectItem7, { value: "saved", children: "By the saved grain" }),
24977
- Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem7, { value: g, children: [
25195
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": "Date grain for every chart on this dashboard", className: "h-7 min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25196
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25197
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "saved", children: "By the saved grain" }),
25198
+ Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem8, { value: g, children: [
24978
25199
  "By ",
24979
25200
  GRAIN_LABEL[g].toLowerCase()
24980
25201
  ] }, g))
@@ -25001,7 +25222,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
25001
25222
  children: scheduling ? "Done" : "Send on a schedule"
25002
25223
  }
25003
25224
  ),
25004
- rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment32, { children: [
25225
+ rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment33, { children: [
25005
25226
  /* @__PURE__ */ jsx83("span", { className: "text-xs text-destructive", children: archiveConfirmSentence(`the dashboard \u201C${board.name}\u201D`) }),
25006
25227
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "destructive", onClick: () => void remove(board), children: "Remove it" }),
25007
25228
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
@@ -25044,7 +25265,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
25044
25265
  !host.onReask ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: NO_REASK_REASON }) : null
25045
25266
  ] }) : null,
25046
25267
  notKept ? /* @__PURE__ */ jsx83("p", { role: "status", "data-records-dashboard-not-kept": "", className: "text-xs text-amber-700 dark:text-amber-400", children: notKept }) : null,
25047
- !board ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboard looks at this table yet. \u201CNew dashboard\u201D makes one, or ask an agent for the one you want and it writes the whole thing." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx83(Skeleton27, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: "This dashboard has no blocks yet. Each one is a single question the store answers \u2014 grouped, bucketed and measured inside the read door." }) : /* @__PURE__ */ jsxs77(Fragment32, { children: [
25268
+ !board ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboard looks at this table yet. \u201CNew dashboard\u201D makes one, or ask an agent for the one you want and it writes the whole thing." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx83(Skeleton27, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: "This dashboard has no blocks yet. Each one is a single question the store answers \u2014 grouped, bucketed and measured inside the read door." }) : /* @__PURE__ */ jsxs77(Fragment33, { children: [
25048
25269
  /* @__PURE__ */ jsx83("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3", children: run.blocks.map((block, index) => /* @__PURE__ */ jsxs77("div", { className: "flex min-w-0 flex-col gap-1", children: [
25049
25270
  /* @__PURE__ */ jsx83(ChartBlock, { block, subject: tableId }),
25050
25271
  rights.admin && board.blocks[index] ? /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap items-center gap-1 text-xs", children: [
@@ -25150,20 +25371,20 @@ function GroupingPicker({
25150
25371
  return /* @__PURE__ */ jsx83("span", { className: "text-muted-foreground", children: "This table has no columns yet, so there is nothing to group this block by." });
25151
25372
  }
25152
25373
  const known = choices.some((c) => c.field.key === current);
25153
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25374
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25154
25375
  /* @__PURE__ */ jsx83("label", { className: "text-muted-foreground", htmlFor: `block-group-${block.title}`, children: "Group by" }),
25155
- /* @__PURE__ */ jsxs77(Select7, { value: known ? current : "", onValueChange: onPick, children: [
25376
+ /* @__PURE__ */ jsxs77(Select8, { value: known ? current : "", onValueChange: onPick, children: [
25156
25377
  /* @__PURE__ */ jsx83(
25157
- SelectTrigger7,
25378
+ SelectTrigger8,
25158
25379
  {
25159
25380
  size: "sm",
25160
25381
  id: `block-group-${block.title}`,
25161
25382
  "aria-label": `Which column ${block.title} is grouped by`,
25162
25383
  className: "h-7 min-w-[10rem] text-xs",
25163
- children: /* @__PURE__ */ jsx83(SelectValue7, { placeholder: "Choose a column" })
25384
+ children: /* @__PURE__ */ jsx83(SelectValue8, { placeholder: "Choose a column" })
25164
25385
  }
25165
25386
  ),
25166
- /* @__PURE__ */ jsx83(SelectContent7, { children: choices.map(({ field: field2, unusual }) => /* @__PURE__ */ jsx83(SelectItem7, { value: field2.key, children: unusual ? `${fieldName(field2)} \u2014 ${UNUSUAL_FIELD_NOTE}` : fieldName(field2) }, field2.key)) })
25387
+ /* @__PURE__ */ jsx83(SelectContent8, { children: choices.map(({ field: field2, unusual }) => /* @__PURE__ */ jsx83(SelectItem8, { value: field2.key, children: unusual ? `${fieldName(field2)} \u2014 ${UNUSUAL_FIELD_NOTE}` : fieldName(field2) }, field2.key)) })
25167
25388
  ] }),
25168
25389
  known ? null : /* @__PURE__ */ jsx83("span", { className: "text-muted-foreground", children: "The column this block was grouped by is no longer on this table \u2014 choose another." })
25169
25390
  ] });
@@ -25247,9 +25468,9 @@ function CompareControl({
25247
25468
  // that has one does not lose it by being shown.
25248
25469
  (k) => k !== "range" || current === "range"
25249
25470
  );
25250
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25471
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25251
25472
  /* @__PURE__ */ jsxs77(
25252
- Select7,
25473
+ Select8,
25253
25474
  {
25254
25475
  value: current ?? "none",
25255
25476
  onValueChange: (v) => {
@@ -25263,22 +25484,22 @@ function CompareControl({
25263
25484
  });
25264
25485
  },
25265
25486
  children: [
25266
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `What ${block.title} is compared with`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25267
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25268
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No comparison" }),
25269
- kinds.map((k) => /* @__PURE__ */ jsx83(SelectItem7, { value: k, children: COMPARE_LABEL[k] }, k))
25487
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `What ${block.title} is compared with`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25488
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25489
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "none", children: "No comparison" }),
25490
+ kinds.map((k) => /* @__PURE__ */ jsx83(SelectItem8, { value: k, children: COMPARE_LABEL[k] }, k))
25270
25491
  ] })
25271
25492
  ]
25272
25493
  }
25273
25494
  ),
25274
25495
  current && !explicitWindow ? /* @__PURE__ */ jsxs77(
25275
- Select7,
25496
+ Select8,
25276
25497
  {
25277
25498
  value: period,
25278
25499
  onValueChange: (v) => onChange({ ...block.compare ?? { against: current, key }, period: v }),
25279
25500
  children: [
25280
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `Which period ${block.title} shows`, className: "h-7 w-auto min-w-[7rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25281
- /* @__PURE__ */ jsx83(SelectContent7, { children: Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem7, { value: g, children: [
25501
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `Which period ${block.title} shows`, className: "h-7 w-auto min-w-[7rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25502
+ /* @__PURE__ */ jsx83(SelectContent8, { children: Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem8, { value: g, children: [
25282
25503
  "This ",
25283
25504
  GRAIN_LABEL[g].toLowerCase()
25284
25505
  ] }, g)) })
@@ -25309,9 +25530,9 @@ function TargetControl({
25309
25530
  if (draft.trim() === "" || !Number.isFinite(n) || n === savedValue) return;
25310
25531
  onChange({ value: n, label: label && saved === "value" ? label : "Target", ...per ? { per } : {} });
25311
25532
  }
25312
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25533
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25313
25534
  /* @__PURE__ */ jsxs77(
25314
- Select7,
25535
+ Select8,
25315
25536
  {
25316
25537
  value: mode,
25317
25538
  onValueChange: (v) => {
@@ -25320,11 +25541,11 @@ function TargetControl({
25320
25541
  if (next === "none" && saved !== "none") onChange(null);
25321
25542
  },
25322
25543
  children: [
25323
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `The target ${block.title} aims for`, className: "h-7 w-auto min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25324
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25325
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No target" }),
25326
- /* @__PURE__ */ jsx83(SelectItem7, { value: "value", children: "A target number" }),
25327
- columns.length > 0 ? /* @__PURE__ */ jsx83(SelectItem7, { value: "field", children: "A goal column" }) : null
25544
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `The target ${block.title} aims for`, className: "h-7 w-auto min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25545
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25546
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "none", children: "No target" }),
25547
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "value", children: "A target number" }),
25548
+ columns.length > 0 ? /* @__PURE__ */ jsx83(SelectItem8, { value: "field", children: "A goal column" }) : null
25328
25549
  ] })
25329
25550
  ]
25330
25551
  }
@@ -25345,7 +25566,7 @@ function TargetControl({
25345
25566
  }
25346
25567
  ) : null,
25347
25568
  mode === "field" ? /* @__PURE__ */ jsxs77(
25348
- Select7,
25569
+ Select8,
25349
25570
  {
25350
25571
  value: block.target && "field" in block.target && block.target.field ? block.target.field : "",
25351
25572
  onValueChange: (key) => {
@@ -25354,8 +25575,8 @@ function TargetControl({
25354
25575
  onChange({ field: key, op: "sum", label: fieldName(picked) });
25355
25576
  },
25356
25577
  children: [
25357
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `Which column holds the goal for ${block.title}`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, { placeholder: "Choose a column" }) }),
25358
- /* @__PURE__ */ jsx83(SelectContent7, { children: columns.map((f) => /* @__PURE__ */ jsx83(SelectItem7, { value: f.key, children: fieldName(f) }, f.key)) })
25578
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `Which column holds the goal for ${block.title}`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, { placeholder: "Choose a column" }) }),
25579
+ /* @__PURE__ */ jsx83(SelectContent8, { children: columns.map((f) => /* @__PURE__ */ jsx83(SelectItem8, { value: f.key, children: fieldName(f) }, f.key)) })
25359
25580
  ]
25360
25581
  }
25361
25582
  ) : null
@@ -25367,7 +25588,7 @@ import { useCallback as useCallback42, useEffect as useEffect62, useState as use
25367
25588
  import { useRecordsClient as useRecordsClient55, useTable as useTable20 } from "@ai-matrx/records/react";
25368
25589
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
25369
25590
  import { Badge as Badge20, Button as Button64, Skeleton as Skeleton28, cn as cn58 } from "@ai-matrx/design-system";
25370
- import { Fragment as Fragment33, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
25591
+ import { Fragment as Fragment34, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
25371
25592
  var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
25372
25593
  var WHAT_A_FORM_IS = "A form asks for this table's own fields, and its answers land here as ordinary records stamped with the form they came through.";
25373
25594
  var NO_ADMIN = "This table has no forms. Making one needs the admin level on it, because a form decides what people with no account may add here.";
@@ -25488,12 +25709,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
25488
25709
  /* @__PURE__ */ jsxs78("p", { className: "mt-1.5 text-xs", children: [
25489
25710
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.in_table }),
25490
25711
  " in the table",
25491
- form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25712
+ form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25492
25713
  " \xB7 ",
25493
25714
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.held }),
25494
25715
  " waiting for someone"
25495
25716
  ] }) : null,
25496
- form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25717
+ form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25497
25718
  " \xB7 ",
25498
25719
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.rejected }),
25499
25720
  " turned away"
@@ -25538,7 +25759,7 @@ import {
25538
25759
  bookingPath
25539
25760
  } from "@ai-matrx/records";
25540
25761
  import { BasicInput as BasicInput26, BasicTextarea as BasicTextarea12, Button as Button65, Checkbox as Checkbox12, Label as Label18, Skeleton as Skeleton29, cn as cn59 } from "@ai-matrx/design-system";
25541
- import { Fragment as Fragment34, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
25762
+ import { Fragment as Fragment35, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
25542
25763
  var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
25543
25764
  var DAYS = [
25544
25765
  { weekday: 1, label: "Mon" },
@@ -25779,7 +26000,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
25779
26000
  ),
25780
26001
  DAYS[i]?.label
25781
26002
  ] }),
25782
- w.on ? /* @__PURE__ */ jsxs79(Fragment34, { children: [
26003
+ w.on ? /* @__PURE__ */ jsxs79(Fragment35, { children: [
25783
26004
  /* @__PURE__ */ jsx85(
25784
26005
  BasicInput26,
25785
26006
  {
@@ -25884,7 +26105,7 @@ import { useCallback as useCallback44, useEffect as useEffect64, useMemo as useM
25884
26105
  import { useRecordsClient as useRecordsClient57, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
25885
26106
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
25886
26107
  import { Badge as Badge21, Button as Button66, Skeleton as Skeleton30, cn as cn60 } from "@ai-matrx/design-system";
25887
- import { Fragment as Fragment35, jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
26108
+ import { Fragment as Fragment36, jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
25888
26109
  var BOOKING_NOT_HERE_LINE = "The link named a booking page this table does not have \u2014 it may have been closed for good, or it writes into another table. The booking pages this table does have are listed here.";
25889
26110
  var WHAT_A_BOOKING_PAGE_IS = "A booking page offers times you are free and writes each appointment into this table as an ordinary record.";
25890
26111
  function bookingSuggestion(tableName2) {
@@ -26024,12 +26245,12 @@ function BookingSlots({ tableId, activeBookingId, className }) {
26024
26245
  " \xB7 ",
26025
26246
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.booked }),
26026
26247
  " booked in all",
26027
- page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26248
+ page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26028
26249
  " \xB7 ",
26029
26250
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.held }),
26030
26251
  " being held right now"
26031
26252
  ] }) : null,
26032
- page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26253
+ page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26033
26254
  " \xB7 ",
26034
26255
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.cancelled }),
26035
26256
  " cancelled"
@@ -26486,7 +26707,7 @@ function CaptureRun({ sheetId, face: given, className }) {
26486
26707
  }
26487
26708
 
26488
26709
  // src/CaptureSheet.tsx
26489
- import { Fragment as Fragment36, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
26710
+ import { Fragment as Fragment37, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
26490
26711
  var CAPTURE_MODES = ["reading", "photo", "voice"];
26491
26712
  var IN_MEMORY_QUEUE_REASON = "Anything you capture while offline is held only in this page until it can be sent, and it is lost if you close the tab. Keep this page open until you are back on a connection. It is said here rather than discovered later.";
26492
26713
  function mintClientKey() {
@@ -26663,7 +26884,7 @@ function AdHocCaptureSheet({
26663
26884
  " ",
26664
26885
  /* @__PURE__ */ jsx88("code", { children: "attachmentField" }),
26665
26886
  "."
26666
- ] }) : /* @__PURE__ */ jsxs82(Fragment36, { children: [
26887
+ ] }) : /* @__PURE__ */ jsxs82(Fragment37, { children: [
26667
26888
  /* @__PURE__ */ jsx88(
26668
26889
  "input",
26669
26890
  {
@@ -26917,7 +27138,7 @@ import { useCallback as useCallback49, useEffect as useEffect69, useState as use
26917
27138
  import { useRecordsClient as useRecordsClient62 } from "@ai-matrx/records/react";
26918
27139
  import { Button as Button70, Input as Input5, Skeleton as Skeleton35, Textarea as Textarea4, cn as cn65 } from "@ai-matrx/design-system";
26919
27140
  import { useTable as useTable23 } from "@ai-matrx/records/react";
26920
- import { Fragment as Fragment37, jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
27141
+ import { Fragment as Fragment38, jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
26921
27142
  function EmbedFrame({
26922
27143
  tableId,
26923
27144
  formId,
@@ -27001,7 +27222,7 @@ function EmbedFrame({
27001
27222
  " will not pass."
27002
27223
  ] })
27003
27224
  ] }),
27004
- !secret ? /* @__PURE__ */ jsx91(Button70, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs85(Fragment37, { children: [
27225
+ !secret ? /* @__PURE__ */ jsx91(Button70, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs85(Fragment38, { children: [
27005
27226
  /* @__PURE__ */ jsx91("p", { className: "rounded border px-2 py-1 text-xs text-muted-foreground", children: "Copy this now. Only its digest is stored, so nobody \u2014 including us \u2014 can show it to you again; if it is lost, issue a new one and replace the old." }),
27006
27227
  /* @__PURE__ */ jsx91(Textarea4, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
27007
27228
  /* @__PURE__ */ jsxs85("div", { className: "flex gap-2", children: [
@@ -27411,7 +27632,7 @@ function SharedNameAddress({
27411
27632
  }
27412
27633
 
27413
27634
  // src/TablesHome.tsx
27414
- import { Fragment as Fragment38, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
27635
+ import { Fragment as Fragment39, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
27415
27636
  var TABLE_LANES = ["mine", "organization", "system", "community", "app"];
27416
27637
  var LANE_TITLE = {
27417
27638
  mine: "Mine",
@@ -27539,7 +27760,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27539
27760
  [client, name, onOpenTable, tables]
27540
27761
  );
27541
27762
  return /* @__PURE__ */ jsxs88("div", { className: cn67("flex min-h-0 flex-col gap-4", className), children: [
27542
- /* @__PURE__ */ jsx95("div", { className: "flex items-center gap-2", children: creating ? /* @__PURE__ */ jsxs88(Fragment38, { children: [
27763
+ /* @__PURE__ */ jsx95("div", { className: "flex items-center gap-2", children: creating ? /* @__PURE__ */ jsxs88(Fragment39, { children: [
27543
27764
  /* @__PURE__ */ jsx95(
27544
27765
  BasicInput27,
27545
27766
  {
@@ -27566,7 +27787,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27566
27787
  }
27567
27788
  ),
27568
27789
  /* @__PURE__ */ jsx95(Button73, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
27569
- ] }) : /* @__PURE__ */ jsxs88(Fragment38, { children: [
27790
+ ] }) : /* @__PURE__ */ jsxs88(Fragment39, { children: [
27570
27791
  /* @__PURE__ */ jsx95(Button73, { size: "sm", onClick: () => setCreating(true), children: "New table" }),
27571
27792
  /* @__PURE__ */ jsx95(
27572
27793
  Button73,
@@ -27980,7 +28201,7 @@ function useSlotScroll(slot) {
27980
28201
  }
27981
28202
 
27982
28203
  // src/TablePage.tsx
27983
- import { Fragment as Fragment39, jsx as jsx97, jsxs as jsxs90 } from "react/jsx-runtime";
28204
+ import { Fragment as Fragment40, jsx as jsx97, jsxs as jsxs90 } from "react/jsx-runtime";
27984
28205
  var RAIL_TITLE = {
27985
28206
  settings: "Table settings",
27986
28207
  inbox: "Inbox",
@@ -28212,7 +28433,7 @@ function MenuEntry({
28212
28433
  onPress,
28213
28434
  separatorBefore
28214
28435
  }) {
28215
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28436
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28216
28437
  separatorBefore ? /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}) : null,
28217
28438
  /* @__PURE__ */ jsx97(DropdownMenuCheckboxItem2, { checked, onSelect: () => onPress(), children: label })
28218
28439
  ] });
@@ -28487,7 +28708,7 @@ function TablePage({
28487
28708
  ]
28488
28709
  }
28489
28710
  );
28490
- const sheetExtras = controlsInSheet && main === "records" && !hostLayout && shownLayout === "grid" ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28711
+ const sheetExtras = controlsInSheet && main === "records" && !hostLayout && shownLayout === "grid" ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28491
28712
  /* @__PURE__ */ jsx97("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx97(ViewFilter, { tableId, view: shown3, onApply: (where) => void patchView({ where }) }) }),
28492
28713
  /* @__PURE__ */ jsxs90("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: [
28493
28714
  VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx97(
@@ -28517,7 +28738,7 @@ function TablePage({
28517
28738
  ] }),
28518
28739
  rights.share && canShare ? /* @__PURE__ */ jsx97(Button75, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
28519
28740
  ] }) : void 0;
28520
- const pageActions = /* @__PURE__ */ jsxs90(Fragment39, { children: [
28741
+ const pageActions = /* @__PURE__ */ jsxs90(Fragment40, { children: [
28521
28742
  /* @__PURE__ */ jsx97(
28522
28743
  ShareControl,
28523
28744
  {
@@ -28538,7 +28759,7 @@ function TablePage({
28538
28759
  /* @__PURE__ */ jsx97("circle", { cx: "19", cy: "12", r: "1.75" })
28539
28760
  ] }) }) }),
28540
28761
  /* @__PURE__ */ jsxs90(DropdownMenuContent4, { align: "end", className: "w-56", "data-table-menu-content": "", children: [
28541
- !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28762
+ !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28542
28763
  /* @__PURE__ */ jsx97(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
28543
28764
  layoutRadio,
28544
28765
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {})
@@ -28553,15 +28774,15 @@ function TablePage({
28553
28774
  },
28554
28775
  entry.key
28555
28776
  )),
28556
- phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28777
+ phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28557
28778
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28558
28779
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
28559
28780
  ] }) : null,
28560
- canDesignate ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28781
+ canDesignate ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28561
28782
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28562
28783
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => void designate(), "data-table-designate": layoutShowing ?? "", children: makeDefaultLabel(layoutShowingLabel) })
28563
28784
  ] }) : null,
28564
- menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28785
+ menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28565
28786
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28566
28787
  menuExtras.map((extra) => /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => extra.onSelect(), "data-table-menu-extra": extra.key, children: extra.label }, extra.key))
28567
28788
  ] }) : null
@@ -28569,16 +28790,16 @@ function TablePage({
28569
28790
  ] }, "menu")
28570
28791
  ] });
28571
28792
  const headerNode = header ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
28572
- if (table.error) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28793
+ if (table.error) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28573
28794
  headerNode,
28574
28795
  /* @__PURE__ */ jsx97(RefusalNotice, { error: table.error })
28575
28796
  ] });
28576
- if (table.loading) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28797
+ if (table.loading) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28577
28798
  headerNode,
28578
28799
  /* @__PURE__ */ jsx97(Skeleton38, { className: "h-40 w-full" })
28579
28800
  ] });
28580
28801
  if (!table.data) {
28581
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28802
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28582
28803
  headerNode,
28583
28804
  /* @__PURE__ */ jsx97(TableNotHere, { tableId, onLeave, leaveLabel, className })
28584
28805
  ] });