@ai-matrx/records-ui 0.115.17 → 0.115.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4179,7 +4179,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
4179
4179
 
4180
4180
  // src/gridEditing.tsx
4181
4181
  var import_react64 = require("react");
4182
- var import_records31 = require("@ai-matrx/records");
4182
+ var import_records32 = require("@ai-matrx/records");
4183
4183
  var import_core7 = require("@ai-matrx/records/core");
4184
4184
  var import_react65 = require("@ai-matrx/records/react");
4185
4185
  var import_design_system37 = require("@ai-matrx/design-system");
@@ -4600,7 +4600,7 @@ function resolveTableStyle(decorations, fields, viewStyle) {
4600
4600
 
4601
4601
  // src/editors.tsx
4602
4602
  var import_react59 = require("react");
4603
- var import_records30 = require("@ai-matrx/records");
4603
+ var import_records31 = require("@ai-matrx/records");
4604
4604
  var import_react60 = require("@ai-matrx/records/react");
4605
4605
  var import_design_system36 = require("@ai-matrx/design-system");
4606
4606
 
@@ -5241,7 +5241,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
5241
5241
  var import_react52 = require("react");
5242
5242
  var import_design_system33 = require("@ai-matrx/design-system");
5243
5243
  var import_data_table9 = require("@ai-matrx/design-system/data-table");
5244
- var import_records28 = require("@ai-matrx/records");
5244
+ var import_records29 = require("@ai-matrx/records");
5245
5245
  var import_react53 = require("@ai-matrx/records/react");
5246
5246
 
5247
5247
  // src/columnName.ts
@@ -5265,10 +5265,30 @@ var import_design_system32 = require("@ai-matrx/design-system");
5265
5265
  // src/FormulaTextEditor.tsx
5266
5266
  var import_react25 = require("react");
5267
5267
  var import_react26 = require("@ai-matrx/records/react");
5268
- var import_formula = require("@ai-matrx/kit/formula");
5268
+ var import_records15 = require("@ai-matrx/records");
5269
5269
  var import_design_system14 = require("@ai-matrx/design-system");
5270
5270
  var import_jsx_runtime16 = require("react/jsx-runtime");
5271
- var FUNCTION_NAMES = import_formula.FORMULA_FUNCTIONS.map((fn) => fn.name).sort();
5271
+ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
5272
+ "fx.add",
5273
+ "fx.sub",
5274
+ "fx.mul",
5275
+ "fx.div",
5276
+ "fx.mod",
5277
+ "fx.neg",
5278
+ "fx.eq",
5279
+ "fx.ne",
5280
+ "fx.lt",
5281
+ "fx.lte",
5282
+ "fx.gt",
5283
+ "fx.gte",
5284
+ "fx.autonumber",
5285
+ "fx.created_time",
5286
+ "fx.modified_time"
5287
+ ]);
5288
+ function formulaFunctionNames(kinds) {
5289
+ return [...new Set(kinds.map((row) => row.node))].filter((node) => node.startsWith("fx.") && !NOT_TYPED_BY_NAME.has(node)).map((node) => node.slice(3).toUpperCase()).sort();
5290
+ }
5291
+ var FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records15.RULE_NODE_KINDS);
5272
5292
  var RESULT_WORD = {
5273
5293
  number: "a number",
5274
5294
  text: "text",
@@ -5365,7 +5385,7 @@ function FormulaTextEditor({
5365
5385
  text,
5366
5386
  columns,
5367
5387
  mistake: parsed && !parsed.ok ? parsed.error : error ? refusalSentence(error) : null,
5368
- functions: FUNCTION_NAMES,
5388
+ functions: FORMULA_FUNCTION_NAMES,
5369
5389
  onFormula: onText
5370
5390
  }) }) : null
5371
5391
  ] }),
@@ -5412,13 +5432,13 @@ function FormulaTextEditor({
5412
5432
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
5413
5433
  columns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
5414
5434
  ] }),
5415
- FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "text-[11px] text-muted-foreground", children: [
5435
+ FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "text-[11px] text-muted-foreground", children: [
5416
5436
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("summary", { className: "cursor-pointer", children: [
5417
5437
  "Functions the store works out (",
5418
- FUNCTION_NAMES.length,
5438
+ FORMULA_FUNCTION_NAMES.length,
5419
5439
  ")"
5420
5440
  ] }),
5421
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: FUNCTION_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
5441
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
5422
5442
  ] }) : null
5423
5443
  ] });
5424
5444
  }
@@ -5747,14 +5767,14 @@ var ABSENCE_WORD_LABEL = {
5747
5767
 
5748
5768
  // src/EntityReferenceControl.tsx
5749
5769
  var import_react30 = require("react");
5750
- var import_records15 = require("@ai-matrx/records");
5770
+ var import_records16 = require("@ai-matrx/records");
5751
5771
  var import_react31 = require("@ai-matrx/records/react");
5752
5772
  var import_design_system16 = require("@ai-matrx/design-system");
5753
5773
  var import_jsx_runtime19 = require("react/jsx-runtime");
5754
5774
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
5755
5775
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
5756
5776
  function entityReferenceText(value) {
5757
- const refs = (0, import_records15.entityRefsOf)(value);
5777
+ const refs = (0, import_records16.entityRefsOf)(value);
5758
5778
  if (refs.length === 0) return "\u2014";
5759
5779
  return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
5760
5780
  }
@@ -5768,7 +5788,7 @@ function EntityReferenceControl(props) {
5768
5788
  return client ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Chips, { ...props, words: null, picker: null });
5769
5789
  }
5770
5790
  function WithWords(props) {
5771
- const refs = (0, import_react30.useMemo)(() => (0, import_records15.entityRefsOf)(props.value), [props.value]);
5791
+ const refs = (0, import_react30.useMemo)(() => (0, import_records16.entityRefsOf)(props.value), [props.value]);
5772
5792
  const [known, setKnown] = (0, import_react30.useState)([]);
5773
5793
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
5774
5794
  const unlabelled = (0, import_react30.useMemo)(
@@ -5786,7 +5806,7 @@ function WithWords(props) {
5786
5806
  setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
5787
5807
  const multi = Boolean(props.field.multi);
5788
5808
  const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
5789
- props.onChange((0, import_records15.entityRefsToWrite)(next, multi));
5809
+ props.onChange((0, import_records16.entityRefsToWrite)(next, multi));
5790
5810
  }
5791
5811
  }
5792
5812
  );
@@ -5875,7 +5895,7 @@ function Chips({
5875
5895
  words: words2,
5876
5896
  picker
5877
5897
  }) {
5878
- const refs = (0, import_react30.useMemo)(() => (0, import_records15.entityRefsOf)(value), [value]);
5898
+ const refs = (0, import_react30.useMemo)(() => (0, import_records16.entityRefsOf)(value), [value]);
5879
5899
  const labelOf = (token2, refId, own3) => {
5880
5900
  if (own3) return own3;
5881
5901
  const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
@@ -5899,7 +5919,7 @@ function Chips({
5899
5919
  "aria-label": `Take ${label} off`,
5900
5920
  onClick: () => {
5901
5921
  const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
5902
- onChange((0, import_records15.entityRefsToWrite)(rest, multi));
5922
+ onChange((0, import_records16.entityRefsToWrite)(rest, multi));
5903
5923
  },
5904
5924
  children: "\xD7"
5905
5925
  }
@@ -6430,7 +6450,7 @@ function AttachmentControl({
6430
6450
  }
6431
6451
 
6432
6452
  // src/ReferenceChips.tsx
6433
- var import_records16 = require("@ai-matrx/records");
6453
+ var import_records17 = require("@ai-matrx/records");
6434
6454
  var import_design_system21 = require("@ai-matrx/design-system");
6435
6455
 
6436
6456
  // src/kindValues.ts
@@ -6502,7 +6522,7 @@ function iconOf(pair) {
6502
6522
  }
6503
6523
  function referencesOf(field2, value, kind, labels) {
6504
6524
  if (kind === "entity_reference") {
6505
- return (0, import_records16.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
6525
+ return (0, import_records17.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
6506
6526
  }
6507
6527
  const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
6508
6528
  const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
@@ -6681,7 +6701,7 @@ function ClampedChips({
6681
6701
  }
6682
6702
 
6683
6703
  // src/formulaNames.ts
6684
- var import_records17 = require("@ai-matrx/records");
6704
+ var import_records18 = require("@ai-matrx/records");
6685
6705
  function fieldRefsOf(expr) {
6686
6706
  const out = [];
6687
6707
  const walk = (node) => {
@@ -6789,7 +6809,7 @@ function formulaSourceArchived(field2, document2) {
6789
6809
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
6790
6810
  if (!Array.isArray(keys) || !document2) return null;
6791
6811
  for (const key of keys) {
6792
- const state = (0, import_records17.sourceArchivedOf)(document2[String(key)]);
6812
+ const state = (0, import_records18.sourceArchivedOf)(document2[String(key)]);
6793
6813
  if (state) return state;
6794
6814
  }
6795
6815
  return null;
@@ -6810,10 +6830,10 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
6810
6830
  }
6811
6831
 
6812
6832
  // src/values.tsx
6813
- var import_records19 = require("@ai-matrx/records");
6833
+ var import_records20 = require("@ai-matrx/records");
6814
6834
 
6815
6835
  // src/cellMarks.tsx
6816
- var import_records18 = require("@ai-matrx/records");
6836
+ var import_records19 = require("@ai-matrx/records");
6817
6837
 
6818
6838
  // src/RetiredValues.tsx
6819
6839
  var import_react38 = require("react");
@@ -6919,7 +6939,7 @@ function bound(value) {
6919
6939
  function keptAsideReason(field2, entry) {
6920
6940
  const rules = field2.rules ?? [];
6921
6941
  const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
6922
- const rule = (0, import_records18.ruleThatRefuses)(rules, numeric);
6942
+ const rule = (0, import_records19.ruleThatRefuses)(rules, numeric);
6923
6943
  let why = null;
6924
6944
  if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
6925
6945
  else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
@@ -7028,7 +7048,7 @@ function SourceArchivedValue({ state }) {
7028
7048
  }
7029
7049
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
7030
7050
  function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
7031
- const archivedSource = (0, import_records19.sourceArchivedOf)(value);
7051
+ const archivedSource = (0, import_records20.sourceArchivedOf)(value);
7032
7052
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SourceArchivedValue, { state: archivedSource });
7033
7053
  const envelope = envelopeFor(document2, field2.key);
7034
7054
  if (envelope?.absent) {
@@ -7051,7 +7071,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
7051
7071
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
7052
7072
  }
7053
7073
  if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SignatureValue, { value, fieldKey: field2.key, document: document2 });
7054
- if ((0, import_records19.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ButtonValue, { field: field2 });
7074
+ if ((0, import_records20.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ButtonValue, { field: field2 });
7055
7075
  const newer = newerKindValue(field2, value);
7056
7076
  if (newer !== void 0) return newer;
7057
7077
  const whole = typeof value === "string" ? (0, import_core5.wholeValueOf)(document2, field2.key) : null;
@@ -7138,10 +7158,10 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
7138
7158
  }
7139
7159
  function scalarText(field2, value, labels, stillWaitingFor) {
7140
7160
  if (value === null || value === void 0) return "\u2014";
7141
- if ((0, import_records19.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
7161
+ if ((0, import_records20.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
7142
7162
  if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
7143
- if ((0, import_records19.autonumberPrefixOf)(field2)) return (0, import_records19.autonumberWords)(field2, value) ?? String(value);
7144
- const newerWords = (0, import_records19.newerKindWords)(field2, value);
7163
+ if ((0, import_records20.autonumberPrefixOf)(field2)) return (0, import_records20.autonumberWords)(field2, value) ?? String(value);
7164
+ const newerWords = (0, import_records20.newerKindWords)(field2, value);
7145
7165
  if (newerWords !== null) return newerWords;
7146
7166
  const kind = editorKindFor(field2);
7147
7167
  if (kind === "entity_reference") return entityReferenceText(value);
@@ -7197,7 +7217,7 @@ function RecordValue({
7197
7217
  const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field2));
7198
7218
  const stillWaitingFor = useLabelWait(field2);
7199
7219
  const embeddedLook = useEmbeddedLook();
7200
- if ((0, import_records19.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ButtonValue, { field: field2, recordId, inCell });
7220
+ if ((0, import_records20.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ButtonValue, { field: field2, recordId, inCell });
7201
7221
  if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(WithheldValue, { field: field2, notice: withheld });
7202
7222
  if (value === null || value === void 0) {
7203
7223
  const failed = workedOutErrorFor(document2, field2.key);
@@ -7207,7 +7227,7 @@ function RecordValue({
7207
7227
  const kept = keptAsideFor(document2, field2.key);
7208
7228
  if (kept) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
7209
7229
  }
7210
- const archivedSource = (0, import_records19.sourceArchivedOf)(value);
7230
+ const archivedSource = (0, import_records20.sourceArchivedOf)(value);
7211
7231
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SourceArchivedValue, { state: archivedSource });
7212
7232
  if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
7213
7233
  if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
@@ -7317,7 +7337,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7317
7337
  // src/Condition.tsx
7318
7338
  var import_react42 = require("react");
7319
7339
  var import_design_system26 = require("@ai-matrx/design-system");
7320
- var import_records20 = require("@ai-matrx/records");
7340
+ var import_records21 = require("@ai-matrx/records");
7321
7341
  var import_react43 = require("@ai-matrx/records/react");
7322
7342
  var import_jsx_runtime30 = require("react/jsx-runtime");
7323
7343
  var CONDITION_OPS = [
@@ -7390,7 +7410,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
7390
7410
  void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((got) => {
7391
7411
  if (cancelled) return;
7392
7412
  setChoices(
7393
- got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records20.optionKey)(o), label: (0, import_records20.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
7413
+ got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records21.optionKey)(o), label: (0, import_records21.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
7394
7414
  );
7395
7415
  });
7396
7416
  return () => {
@@ -7408,7 +7428,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
7408
7428
  }
7409
7429
  );
7410
7430
  }
7411
- const shown4 = (0, import_records20.rankTypedMatches)(choices, search.trim(), (c) => c.label);
7431
+ const shown4 = (0, import_records21.rankTypedMatches)(choices, search.trim(), (c) => c.label);
7412
7432
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7413
7433
  PickOrAdd,
7414
7434
  {
@@ -7818,7 +7838,7 @@ function ConditionGroup({
7818
7838
 
7819
7839
  // src/FieldRulePreview.tsx
7820
7840
  var import_react44 = require("react");
7821
- var import_records21 = require("@ai-matrx/records");
7841
+ var import_records22 = require("@ai-matrx/records");
7822
7842
  var import_react45 = require("@ai-matrx/records/react");
7823
7843
  var import_jsx_runtime31 = require("react/jsx-runtime");
7824
7844
  var PREVIEW_GROUPS2 = 1e3;
@@ -7857,7 +7877,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
7857
7877
  }
7858
7878
  const numbers = holdsNumbers3(field2);
7859
7879
  const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
7860
- setPreview((0, import_records21.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
7880
+ setPreview((0, import_records22.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
7861
7881
  });
7862
7882
  }, 300);
7863
7883
  return () => {
@@ -7966,7 +7986,7 @@ function choiceLookForNewList(multi, rows) {
7966
7986
 
7967
7987
  // src/ChoiceListEditor.tsx
7968
7988
  var import_react46 = require("react");
7969
- var import_records22 = require("@ai-matrx/records");
7989
+ var import_records23 = require("@ai-matrx/records");
7970
7990
  var import_react47 = require("@ai-matrx/records/react");
7971
7991
  var import_design_system27 = require("@ai-matrx/design-system");
7972
7992
  var import_data_table6 = require("@ai-matrx/design-system/data-table");
@@ -7975,7 +7995,7 @@ var rowSeed = 0;
7975
7995
  var nextRow = () => `new-${rowSeed += 1}`;
7976
7996
  function choiceRowsFrom(options, field2) {
7977
7997
  return inTheStoresOrder([...options]).map((option) => {
7978
- const words2 = (0, import_records22.optionLabel)(option);
7998
+ const words2 = (0, import_records23.optionLabel)(option);
7979
7999
  const key = option.data?.key;
7980
8000
  const color = field2 ? storedChoiceColor(field2, words2) ?? storedChoiceColor(field2, key) : void 0;
7981
8001
  return { id: option.id, words: words2, row: option.id, color: color ?? null };
@@ -8145,11 +8165,11 @@ function ChoiceListEditor({
8145
8165
  "div",
8146
8166
  {
8147
8167
  role: "group",
8148
- "aria-label": (0, import_records22.recordsUseSentence)(heldBy(asking), asking.words.trim()),
8168
+ "aria-label": (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()),
8149
8169
  "data-records-choice-removal-ask": "",
8150
8170
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
8151
8171
  children: [
8152
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs", children: (0, import_records22.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
8172
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs", children: (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
8153
8173
  /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
8154
8174
  targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
8155
8175
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system27.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
@@ -8168,7 +8188,7 @@ function ChoiceListEditor({
8168
8188
  ) : null,
8169
8189
  Object.entries(rehome).map(
8170
8190
  ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
8171
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: (0, import_records22.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
8191
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: (0, import_records23.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
8172
8192
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system27.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
8173
8193
  ] }, id) : null
8174
8194
  ),
@@ -8228,7 +8248,7 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
8228
8248
  }
8229
8249
 
8230
8250
  // src/NewerKindQuestions.tsx
8231
- var import_records23 = require("@ai-matrx/records");
8251
+ var import_records24 = require("@ai-matrx/records");
8232
8252
  var import_design_system28 = require("@ai-matrx/design-system");
8233
8253
  var import_jsx_runtime33 = require("react/jsx-runtime");
8234
8254
  var STATUS_STARTING_CHOICES = [
@@ -8249,7 +8269,7 @@ function statusGroupRows(field2, rows, keyOfId, changed) {
8249
8269
  if (words2 === "") continue;
8250
8270
  const ref = r.id ?? words2;
8251
8271
  const key = r.id ? keyOfId[r.id] : void 0;
8252
- const held = field2 && key ? (0, import_records23.statusGroupOf)(field2, key) : void 0;
8272
+ const held = field2 && key ? (0, import_records24.statusGroupOf)(field2, key) : void 0;
8253
8273
  out.push({ ref, words: words2, group: changed[ref] ?? held ?? guessStatusGroup(words2) });
8254
8274
  }
8255
8275
  return out;
@@ -8265,10 +8285,10 @@ function StatusGroupsQuestion({
8265
8285
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
8266
8286
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system28.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
8267
8287
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectValue, {}) }),
8268
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectContent, { children: import_records23.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system28.SelectItem, { value: g, children: [
8288
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectContent, { children: import_records24.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system28.SelectItem, { value: g, children: [
8269
8289
  STATUS_GROUP_MARK[g],
8270
8290
  " ",
8271
- import_records23.STATUS_GROUP_WORDS[g]
8291
+ import_records24.STATUS_GROUP_WORDS[g]
8272
8292
  ] }, g)) })
8273
8293
  ] })
8274
8294
  ] }, r.ref))
@@ -8306,7 +8326,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
8306
8326
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectValue, {}) }),
8307
8327
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system28.SelectContent, { children: [
8308
8328
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectItem, { value: "any", children: "Any code" }),
8309
- import_records23.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
8329
+ import_records24.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system28.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
8310
8330
  ] })
8311
8331
  ] })
8312
8332
  ] });
@@ -8635,21 +8655,21 @@ function readersSentence(count, tableName2) {
8635
8655
  }
8636
8656
 
8637
8657
  // src/FieldEditor.tsx
8638
- var import_records26 = require("@ai-matrx/records");
8658
+ var import_records27 = require("@ai-matrx/records");
8639
8659
 
8640
8660
  // src/ButtonSettings.tsx
8641
8661
  var import_react48 = require("react");
8642
8662
  var import_design_system31 = require("@ai-matrx/design-system");
8643
8663
  var import_data_table8 = require("@ai-matrx/design-system/data-table");
8644
- var import_records25 = require("@ai-matrx/records");
8664
+ var import_records26 = require("@ai-matrx/records");
8645
8665
  var import_react49 = require("@ai-matrx/records/react");
8646
8666
 
8647
8667
  // src/AccentSwatches.tsx
8648
- var import_records24 = require("@ai-matrx/records");
8668
+ var import_records25 = require("@ai-matrx/records");
8649
8669
  var import_design_system30 = require("@ai-matrx/design-system");
8650
8670
  var import_data_table7 = require("@ai-matrx/design-system/data-table");
8651
8671
  var import_jsx_runtime35 = require("react/jsx-runtime");
8652
- function AccentSwatches({ value, onChange, options = import_records24.PORTAL_ACCENTS, noneLabel = "App colour" }) {
8672
+ function AccentSwatches({ value, onChange, options = import_records25.PORTAL_ACCENTS, noneLabel = "App colour" }) {
8653
8673
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
8654
8674
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
8655
8675
  "button",
@@ -8691,7 +8711,7 @@ var DOES_WORDS = {
8691
8711
  };
8692
8712
  function buttonUrlInWords(url, fields) {
8693
8713
  let out = url;
8694
- for (const id of (0, import_records25.buttonUrlPlaceholders)(url)) {
8714
+ for (const id of (0, import_records26.buttonUrlPlaceholders)(url)) {
8695
8715
  const f = fields.find((x) => x.id === id || x.key === id);
8696
8716
  if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
8697
8717
  }
@@ -8786,7 +8806,7 @@ function ButtonSettingsEditor({
8786
8806
  }
8787
8807
  ) : null
8788
8808
  ] }),
8789
- value.url && (0, import_records25.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
8809
+ value.url && (0, import_records26.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
8790
8810
  ] }) : null,
8791
8811
  value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
8792
8812
  actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -8892,11 +8912,11 @@ function NewRowAction({
8892
8912
  }
8893
8913
 
8894
8914
  // src/FieldEditor.tsx
8895
- var import_records27 = require("@ai-matrx/records");
8915
+ var import_records28 = require("@ai-matrx/records");
8896
8916
  var import_jsx_runtime37 = require("react/jsx-runtime");
8897
8917
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
8898
- var SENSITIVITIES = import_records27.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
8899
- var AGENT_VISIBILITY = import_records27.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
8918
+ var SENSITIVITIES = import_records28.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
8919
+ var AGENT_VISIBILITY = import_records28.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
8900
8920
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
8901
8921
  value,
8902
8922
  label: ROLLUP_AGG_LABEL[value]
@@ -8909,7 +8929,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
8909
8929
  label: FORMULA_OP_LABEL[value],
8910
8930
  joins: FORMULA_OP_JOINS[value]
8911
8931
  }));
8912
- var STORE_BEHAVIOUR = new Map(import_records27.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
8932
+ var STORE_BEHAVIOUR = new Map(import_records28.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
8913
8933
  function holdsAValueOnAStandardTable(kind) {
8914
8934
  if (isSystemFieldKind(kind)) return false;
8915
8935
  const behaviour = STORE_BEHAVIOUR.get(kind);
@@ -9014,18 +9034,18 @@ function FieldEditor(props) {
9014
9034
  const [contextPolicy, setContextPolicy] = (0, import_react50.useState)(String(start?.context_policy ?? "include"));
9015
9035
  const [rules, setRules] = (0, import_react50.useState)(start?.rules ?? []);
9016
9036
  const [startsWith, setStartsWith] = (0, import_react50.useState)(start?.default ?? null);
9017
- const [ratingMax, setRatingMax] = (0, import_react50.useState)(() => start ? (0, import_records27.ratingMaxOf)(start) : 5);
9037
+ const [ratingMax, setRatingMax] = (0, import_react50.useState)(() => start ? (0, import_records28.ratingMaxOf)(start) : 5);
9018
9038
  const savedRules = (0, import_react50.useMemo)(
9019
- () => field2 ? type === "rating" ? (0, import_records27.rulesWithTopStar)(field2.rules ?? [], (0, import_records27.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
9039
+ () => field2 ? type === "rating" ? (0, import_records28.rulesWithTopStar)(field2.rules ?? [], (0, import_records28.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
9020
9040
  [field2, type]
9021
9041
  );
9022
- const editedRules = (0, import_react50.useMemo)(() => type === "rating" ? (0, import_records27.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
9042
+ const editedRules = (0, import_react50.useMemo)(() => type === "rating" ? (0, import_records28.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
9023
9043
  const [statusGroups, setStatusGroups] = (0, import_react50.useState)({});
9024
9044
  const [statusKeys, setStatusKeys] = (0, import_react50.useState)({});
9025
9045
  const [symbology, setSymbology] = (0, import_react50.useState)(String(start?.config?.["symbology"] ?? ""));
9026
- const buttonStart = (0, import_react50.useMemo)(() => (0, import_records26.buttonOf)(start) ?? { label: "" }, [start]);
9046
+ const buttonStart = (0, import_react50.useMemo)(() => (0, import_records27.buttonOf)(start) ?? { label: "" }, [start]);
9027
9047
  const [buttonSettings, setButtonSettings] = (0, import_react50.useState)(buttonStart);
9028
- const prefixStart = (0, import_records26.autonumberPrefixOf)(start);
9048
+ const prefixStart = (0, import_records27.autonumberPrefixOf)(start);
9029
9049
  const [numberPrefix, setNumberPrefix] = (0, import_react50.useState)(prefixStart);
9030
9050
  const dependencyStart = start?.config?.["dependency"] === true;
9031
9051
  const [dependency, setDependency] = (0, import_react50.useState)(dependencyStart);
@@ -9033,7 +9053,7 @@ function FieldEditor(props) {
9033
9053
  if (!field2 || type !== "status") return;
9034
9054
  let live = true;
9035
9055
  void client.fieldOptions({ field_id: field2.id }).then((got) => {
9036
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records27.optionKey)(o)])));
9056
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records28.optionKey)(o)])));
9037
9057
  });
9038
9058
  return () => {
9039
9059
  live = false;
@@ -9147,7 +9167,7 @@ function FieldEditor(props) {
9147
9167
  const noun = onEntity ? "field" : "column";
9148
9168
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
9149
9169
  const listsChoices = type === "select" || type === "multi_select" || type === "status";
9150
- const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records26.buttonNeeds)(buttonSettings) : null;
9170
+ const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records27.buttonNeeds)(buttonSettings) : null;
9151
9171
  const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
9152
9172
  type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
9153
9173
  )));
@@ -9188,7 +9208,7 @@ function FieldEditor(props) {
9188
9208
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
9189
9209
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
9190
9210
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
9191
- ...type === "rating" && ratingMax !== (0, import_records27.ratingMaxOf)(field2) ? { max: ratingMax } : {},
9211
+ ...type === "rating" && ratingMax !== (0, import_records28.ratingMaxOf)(field2) ? { max: ratingMax } : {},
9192
9212
  ...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
9193
9213
  ...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
9194
9214
  ...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
@@ -10134,13 +10154,13 @@ function buttonPressWords(label, pressed) {
10134
10154
  var stop = (event) => event.stopPropagation();
10135
10155
  function ButtonValue({ field: field2, recordId, inCell }) {
10136
10156
  const client = (0, import_react53.useOptionalRecordsClient)();
10137
- const b = (0, import_records28.buttonOf)(field2);
10157
+ const b = (0, import_records29.buttonOf)(field2);
10138
10158
  const [busy, setBusy] = (0, import_react52.useState)(false);
10139
10159
  const [said2, setSaid] = (0, import_react52.useState)(null);
10140
10160
  const [settingUp, setSettingUp] = (0, import_react52.useState)(false);
10141
10161
  if (!b) return null;
10142
10162
  const color = (0, import_data_table9.isStyleColor)(b.color) ? import_data_table9.CHOICE_CHIP_CLASS[b.color] : import_data_table9.NEUTRAL_CHIP_CLASS;
10143
- const needs = (0, import_records28.buttonNeeds)(b);
10163
+ const needs = (0, import_records29.buttonNeeds)(b);
10144
10164
  const tableId = field2.entity_definition_id;
10145
10165
  const press = async () => {
10146
10166
  if (!client || !recordId) return setSaid({ kind: "public" });
@@ -10381,7 +10401,7 @@ function formatControl(args) {
10381
10401
  // src/typedDateHelper.tsx
10382
10402
  var import_react56 = require("react");
10383
10403
  var import_design_system35 = require("@ai-matrx/design-system");
10384
- var import_records29 = require("@ai-matrx/records");
10404
+ var import_records30 = require("@ai-matrx/records");
10385
10405
  var import_jsx_runtime41 = require("react/jsx-runtime");
10386
10406
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
10387
10407
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -10390,12 +10410,12 @@ function pad2(n) {
10390
10410
  }
10391
10411
  function readBox(text, kind) {
10392
10412
  if (kind === "time") {
10393
- const t = (0, import_records29.readTypedTime)(text);
10413
+ const t = (0, import_records30.readTypedTime)(text);
10394
10414
  if (!t.ok) return { day: null, time: null };
10395
10415
  const [h, m] = t.value.split(":").map(Number);
10396
10416
  return { day: null, time: { h, m } };
10397
10417
  }
10398
- const read = (0, import_records29.readTypedDate)(text, { withTime: kind === "datetime" });
10418
+ const read = (0, import_records30.readTypedDate)(text, { withTime: kind === "datetime" });
10399
10419
  if (!read.ok) return { day: null, time: null };
10400
10420
  if (kind === "datetime" && read.instant) {
10401
10421
  const at = new Date(read.instant);
@@ -10404,10 +10424,10 @@ function readBox(text, kind) {
10404
10424
  return { day: read.day, time: null };
10405
10425
  }
10406
10426
  function wordsFor(kind, day2, time) {
10407
- if (kind === "time") return time ? (0, import_records29.typedTimeText)(time.h, time.m) : "";
10427
+ if (kind === "time") return time ? (0, import_records30.typedTimeText)(time.h, time.m) : "";
10408
10428
  if (!day2) return "";
10409
- const dayText = (0, import_records29.typedDateText)(day2);
10410
- return kind === "datetime" && time ? `${dayText} ${(0, import_records29.typedTimeText)(time.h, time.m)}` : dayText;
10429
+ const dayText = (0, import_records30.typedDateText)(day2);
10430
+ return kind === "datetime" && time ? `${dayText} ${(0, import_records30.typedTimeText)(time.h, time.m)}` : dayText;
10411
10431
  }
10412
10432
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
10413
10433
  function CalendarGlyph() {
@@ -10529,7 +10549,7 @@ function TypedDateHelper({
10529
10549
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
10530
10550
  ),
10531
10551
  onClick: () => pickTime(t),
10532
- children: (0, import_records29.typedTimeText)(t.h, t.m)
10552
+ children: (0, import_records30.typedTimeText)(t.h, t.m)
10533
10553
  },
10534
10554
  `${t.h}:${t.m}`
10535
10555
  )) })
@@ -10616,7 +10636,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
10616
10636
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
10617
10637
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
10618
10638
  field2.required ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
10619
- field2.unit && (0, import_records30.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
10639
+ field2.unit && (0, import_records31.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
10620
10640
  children
10621
10641
  ] });
10622
10642
  }
@@ -10626,7 +10646,7 @@ function isTypedDraft(value) {
10626
10646
  var TYPED_AS_WORDS = /* @__PURE__ */ new Set(["text", "long_text", "phone"]);
10627
10647
  var TYPED_AND_READ = /* @__PURE__ */ new Set(["number", "currency", "percent", "datetime", "select", "multi_select", "email", "url"]);
10628
10648
  function typingOpens(field2) {
10629
- if ((0, import_records30.isButtonField)(field2)) return "none";
10649
+ if ((0, import_records31.isButtonField)(field2)) return "none";
10630
10650
  const kind = String(editorKindFor(field2));
10631
10651
  if (kind === "formula" || kind === "lookup" || kind === "rollup") return "none";
10632
10652
  if (kind === "select" || kind === "multi_select" || kind === "member") return "search";
@@ -10652,21 +10672,21 @@ function judgeTyped(field2, text, choices, nudge) {
10652
10672
  const format = formatForField(field2);
10653
10673
  if (trimmed === "") return { value: null };
10654
10674
  if (format && format.id === "time") {
10655
- const read2 = (0, import_records30.readTypedTime)(trimmed);
10675
+ const read2 = (0, import_records31.readTypedTime)(trimmed);
10656
10676
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
10657
10677
  }
10658
10678
  if (kind === "select" || kind === "multi_select") {
10659
10679
  if (!choices || nudge === null) return null;
10660
10680
  const several = field2.multi || kind === "multi_select";
10661
10681
  const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
10662
- const allowOther = (0, import_records30.allowsOtherValues)(field2);
10682
+ const allowOther = (0, import_records31.allowsOtherValues)(field2);
10663
10683
  const parts = [];
10664
10684
  const add = [];
10665
10685
  const ask2 = [];
10666
10686
  const notChoices = [];
10667
10687
  let keepOffered = allowOther;
10668
10688
  for (const word of words2) {
10669
- const decided = (0, import_records30.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
10689
+ const decided = (0, import_records31.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
10670
10690
  if (decided.decision === "empty") continue;
10671
10691
  if (decided.decision === "chosen") parts.push(decided.key);
10672
10692
  else {
@@ -10699,7 +10719,7 @@ function judgeTyped(field2, text, choices, nudge) {
10699
10719
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
10700
10720
  }
10701
10721
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
10702
- const read = (0, import_records30.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
10722
+ const read = (0, import_records31.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
10703
10723
  if ("refusal" in read) {
10704
10724
  if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
10705
10725
  const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
@@ -10720,12 +10740,12 @@ function openingText(field2, value) {
10720
10740
  if (value === null || value === void 0 || value === "") return "";
10721
10741
  const helper = dateHelperKind(field2, value);
10722
10742
  if (helper === "time") {
10723
- const read = (0, import_records30.readTypedTime)(String(value));
10743
+ const read = (0, import_records31.readTypedTime)(String(value));
10724
10744
  if (!read.ok) return String(value);
10725
10745
  const [h, m] = read.value.split(":").map(Number);
10726
- return (0, import_records30.typedTimeText)(h, m);
10746
+ return (0, import_records31.typedTimeText)(h, m);
10727
10747
  }
10728
- if (helper) return (0, import_records30.typedDateText)(value, { withTime: helper === "datetime" });
10748
+ if (helper) return (0, import_records31.typedDateText)(value, { withTime: helper === "datetime" });
10729
10749
  const format = formatForField(field2);
10730
10750
  return format ? typedText(format, value) : String(value);
10731
10751
  }
@@ -10829,7 +10849,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
10829
10849
  " ",
10830
10850
  needsChoices ? String(
10831
10851
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
10832
- const option = choices?.find((o) => (0, import_records30.optionKey)(o) === k);
10852
+ const option = choices?.find((o) => (0, import_records31.optionKey)(o) === k);
10833
10853
  return option ? recordName(option.data, null, String(k)) : String(k);
10834
10854
  }).join(", ")
10835
10855
  ) : (() => {
@@ -10850,7 +10870,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10850
10870
  const ownDetails = (0, import_react60.useOptionalRecordsClient)() === null;
10851
10871
  if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
10852
10872
  if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
10853
- if ((0, import_records30.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ButtonValue, { field: field2 });
10873
+ if ((0, import_records31.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ButtonValue, { field: field2 });
10854
10874
  const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
10855
10875
  if (newerControl !== void 0) return newerControl;
10856
10876
  const format = formatForField(field2);
@@ -11006,7 +11026,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
11006
11026
  function typedDatePlaceholder(helper) {
11007
11027
  const time = "h:mm AM";
11008
11028
  if (helper === "time") return time;
11009
- const pattern = (0, import_records30.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
11029
+ const pattern = (0, import_records31.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
11010
11030
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
11011
11031
  }
11012
11032
  function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
@@ -11145,15 +11165,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11145
11165
  ChoiceAnswer,
11146
11166
  {
11147
11167
  field: field2,
11148
- choices: options.map((option) => ({ key: (0, import_records30.optionKey)(option), label: titled(option) })),
11168
+ choices: options.map((option) => ({ key: (0, import_records31.optionKey)(option), label: titled(option) })),
11149
11169
  value,
11150
11170
  onChange,
11151
11171
  disabled,
11152
11172
  id,
11153
11173
  onChosen,
11154
11174
  isChosen: (choice, v) => {
11155
- const option = options.find((o) => (0, import_records30.optionKey)(o) === choice.key);
11156
- return option ? (0, import_records30.isTheChosen)(option, v) : false;
11175
+ const option = options.find((o) => (0, import_records31.optionKey)(o) === choice.key);
11176
+ return option ? (0, import_records31.isTheChosen)(option, v) : false;
11157
11177
  }
11158
11178
  }
11159
11179
  );
@@ -11173,7 +11193,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11173
11193
  onCancel,
11174
11194
  initialSearch,
11175
11195
  addsChoices,
11176
- allowOther: (0, import_records30.allowsOtherValues)(field2),
11196
+ allowOther: (0, import_records31.allowsOtherValues)(field2),
11177
11197
  onChoicesChanged: () => {
11178
11198
  if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field2.id}`);
11179
11199
  setReread((n) => n + 1);
@@ -11186,19 +11206,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11186
11206
  }
11187
11207
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
11188
11208
  if (field2.multi) {
11189
- const chosen = options.filter((option) => (0, import_records30.choiceValuesOf)(value).some((v) => (0, import_records30.isTheChosen)(option, v)));
11190
- const picked = new Set(chosen.map((option) => (0, import_records30.optionKey)(option)));
11209
+ const chosen = options.filter((option) => (0, import_records31.choiceValuesOf)(value).some((v) => (0, import_records31.isTheChosen)(option, v)));
11210
+ const picked = new Set(chosen.map((option) => (0, import_records31.optionKey)(option)));
11191
11211
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11192
11212
  import_design_system36.Button,
11193
11213
  {
11194
11214
  type: "button",
11195
11215
  size: "sm",
11196
- variant: picked.has((0, import_records30.optionKey)(option)) ? "default" : "outline",
11216
+ variant: picked.has((0, import_records31.optionKey)(option)) ? "default" : "outline",
11197
11217
  disabled,
11198
11218
  onClick: () => {
11199
11219
  const next = new Set(picked);
11200
- if (next.has((0, import_records30.optionKey)(option))) next.delete((0, import_records30.optionKey)(option));
11201
- else next.add((0, import_records30.optionKey)(option));
11220
+ if (next.has((0, import_records31.optionKey)(option))) next.delete((0, import_records31.optionKey)(option));
11221
+ else next.add((0, import_records31.optionKey)(option));
11202
11222
  onChange(next.size === 0 ? null : [...next]);
11203
11223
  },
11204
11224
  children: titleOf(option)
@@ -11220,11 +11240,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11220
11240
  }
11221
11241
  );
11222
11242
  }
11223
- const current = options.find((option) => (0, import_records30.isTheChosen)(option, value));
11243
+ const current = options.find((option) => (0, import_records31.isTheChosen)(option, value));
11224
11244
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11225
11245
  import_design_system36.Select,
11226
11246
  {
11227
- value: current ? (0, import_records30.optionKey)(current) : "",
11247
+ value: current ? (0, import_records31.optionKey)(current) : "",
11228
11248
  disabled: disabled ?? false,
11229
11249
  onValueChange: (next) => onChange(next === "" ? null : next),
11230
11250
  ...autoOpen ? {
@@ -11236,7 +11256,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11236
11256
  } : {},
11237
11257
  children: [
11238
11258
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectValue, { placeholder: "Choose" }) }),
11239
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectItem, { value: (0, import_records30.optionKey)(option), children: titleOf(option) }, option.id)) })
11259
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.SelectItem, { value: (0, import_records31.optionKey)(option), children: titleOf(option) }, option.id)) })
11240
11260
  ]
11241
11261
  }
11242
11262
  );
@@ -11270,23 +11290,23 @@ function OpenChoicePicker({
11270
11290
  const [addRefused, setAddRefused] = (0, import_react59.useState)(null);
11271
11291
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
11272
11292
  const held = withoutAddition(value);
11273
- const current = (0, import_records30.choiceValuesOf)(held.value);
11293
+ const current = (0, import_records31.choiceValuesOf)(held.value);
11274
11294
  const pickedWords = current.map((v) => {
11275
- const option = options.find((o) => (0, import_records30.isTheChosen)(o, v));
11295
+ const option = options.find((o) => (0, import_records31.isTheChosen)(o, v));
11276
11296
  return option ? titleOf(option) : String(v);
11277
11297
  });
11278
- const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records30.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
11298
+ const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records31.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
11279
11299
  const q = search.trim();
11280
- const visible = (0, import_records30.rankTypedMatches)(options, q, titleOf);
11281
- const decided = (0, import_records30.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
11300
+ const visible = (0, import_records31.rankTypedMatches)(options, q, titleOf);
11301
+ const decided = (0, import_records31.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
11282
11302
  const choose = (word, addingIt = false) => {
11283
11303
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
11284
11304
  let next;
11285
11305
  let add2 = [...pending];
11286
11306
  if (field2.multi) {
11287
11307
  const existing = current.map((v) => {
11288
- const option = options.find((o) => (0, import_records30.isTheChosen)(o, v));
11289
- return option ? (0, import_records30.optionKey)(option) : String(v);
11308
+ const option = options.find((o) => (0, import_records31.isTheChosen)(o, v));
11309
+ return option ? (0, import_records31.optionKey)(option) : String(v);
11290
11310
  });
11291
11311
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
11292
11312
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -11322,7 +11342,7 @@ function OpenChoicePicker({
11322
11342
  const foot = null;
11323
11343
  const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
11324
11344
  const listed = visible;
11325
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records30.isTheChosen)(o, v)));
11345
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records31.isTheChosen)(o, v)));
11326
11346
  const cellChips = pickedWords.map((word, i) => {
11327
11347
  const chip = chipOf(pickedOptions[i], word);
11328
11348
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Badge, { variant: "outline", className: (0, import_design_system36.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -11334,7 +11354,7 @@ function OpenChoicePicker({
11334
11354
  label: word,
11335
11355
  chip: chipOf(option, word).className,
11336
11356
  onRemove: () => {
11337
- if (field2.multi) choose(option ? (0, import_records30.optionKey)(option) : String(current[i]));
11357
+ if (field2.multi) choose(option ? (0, import_records31.optionKey)(option) : String(current[i]));
11338
11358
  else onChange(null);
11339
11359
  }
11340
11360
  };
@@ -11365,11 +11385,11 @@ function OpenChoicePicker({
11365
11385
  id: option.id,
11366
11386
  label: titleOf(option),
11367
11387
  chip: chipOf(option, titleOf(option)).className,
11368
- picked: current.some((v) => (0, import_records30.isTheChosen)(option, v))
11388
+ picked: current.some((v) => (0, import_records31.isTheChosen)(option, v))
11369
11389
  })),
11370
11390
  onPick: (optionId) => {
11371
11391
  const option = options.find((o) => o.id === optionId);
11372
- if (option) choose((0, import_records30.optionKey)(option));
11392
+ if (option) choose((0, import_records31.optionKey)(option));
11373
11393
  },
11374
11394
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
11375
11395
  add,
@@ -11425,7 +11445,7 @@ function ChoiceAnswer({
11425
11445
  onChosen
11426
11446
  }) {
11427
11447
  const [search, setSearch] = (0, import_react59.useState)("");
11428
- const held = field2.multi ? (0, import_records30.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
11448
+ const held = field2.multi ? (0, import_records31.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
11429
11449
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
11430
11450
  const press = (choice) => {
11431
11451
  if (!field2.multi) {
@@ -11691,7 +11711,7 @@ function isTypedCharacter(event) {
11691
11711
  return !event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1 && event.key !== " ";
11692
11712
  }
11693
11713
  function fieldIsEditable(field2) {
11694
- if ((0, import_records31.isButtonField)(field2)) return false;
11714
+ if ((0, import_records32.isButtonField)(field2)) return false;
11695
11715
  const kind = editorKindFor(field2);
11696
11716
  return kind !== "formula" && kind !== "lookup" && kind !== "rollup";
11697
11717
  }
@@ -13062,8 +13082,8 @@ function useWholeTableCount(args) {
13062
13082
  // src/Grid.tsx
13063
13083
  var import_react127 = require("react");
13064
13084
  var import_react128 = require("@ai-matrx/records/react");
13065
- var import_records44 = require("@ai-matrx/records");
13066
13085
  var import_records45 = require("@ai-matrx/records");
13086
+ var import_records46 = require("@ai-matrx/records");
13067
13087
  var import_data_table16 = require("@ai-matrx/design-system/data-table");
13068
13088
  var import_core17 = require("@ai-matrx/records/core");
13069
13089
 
@@ -13102,7 +13122,7 @@ function useTableDecorations(tableId, revision) {
13102
13122
  }
13103
13123
 
13104
13124
  // src/emptyState.tsx
13105
- var import_records32 = require("@ai-matrx/records");
13125
+ var import_records33 = require("@ai-matrx/records");
13106
13126
  var import_design_system39 = require("@ai-matrx/design-system");
13107
13127
  var import_format3 = require("@ai-matrx/kit/format");
13108
13128
  var import_jsx_runtime46 = require("react/jsx-runtime");
@@ -13112,7 +13132,7 @@ function lockedRowsWords(count) {
13112
13132
  function questionIsAsked(args) {
13113
13133
  if ((args.search ?? "").trim() !== "") return true;
13114
13134
  if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
13115
- if (args.filter && (0, import_records32.stableFilterKey)(args.filter) !== "{}") return true;
13135
+ if (args.filter && (0, import_records33.stableFilterKey)(args.filter) !== "{}") return true;
13116
13136
  return Boolean(args.ruled);
13117
13137
  }
13118
13138
  function emptyCauseOf(args) {
@@ -13269,7 +13289,7 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
13269
13289
 
13270
13290
  // src/gridColors.tsx
13271
13291
  var import_react73 = require("react");
13272
- var import_records33 = require("@ai-matrx/records");
13292
+ var import_records34 = require("@ai-matrx/records");
13273
13293
  var import_react74 = require("@ai-matrx/records/react");
13274
13294
  var import_design_system41 = require("@ai-matrx/design-system");
13275
13295
  var import_data_table11 = require("@ai-matrx/design-system/data-table");
@@ -13330,7 +13350,7 @@ function useChoiceOptions(fields, keys) {
13330
13350
  function lookOf(option) {
13331
13351
  const raw = option.data?.["color"];
13332
13352
  const color = typeof raw === "string" && import_data_table11.STYLE_COLORS.includes(raw) ? raw : void 0;
13333
- return { id: String(option.id), key: (0, import_records33.optionKey)(option), label: (0, import_records33.optionLabel)(option), ...color ? { color } : {} };
13353
+ return { id: String(option.id), key: (0, import_records34.optionKey)(option), label: (0, import_records34.optionLabel)(option), ...color ? { color } : {} };
13334
13354
  }
13335
13355
  function paintByOption(style, _fields, index, lookup) {
13336
13356
  if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
@@ -14043,7 +14063,7 @@ function ActionRowPreview({
14043
14063
  // src/gridActions.tsx
14044
14064
  var import_react79 = require("react");
14045
14065
  var import_react80 = require("@ai-matrx/records/react");
14046
- var import_records34 = require("@ai-matrx/records");
14066
+ var import_records35 = require("@ai-matrx/records");
14047
14067
  var import_design_system44 = require("@ai-matrx/design-system");
14048
14068
  var import_jsx_runtime51 = require("react/jsx-runtime");
14049
14069
  var EMPTY_ACTIONS = [];
@@ -14124,7 +14144,7 @@ function useActionRunner(args) {
14124
14144
  const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
14125
14145
  setBusy(null);
14126
14146
  if (!answered.ok) {
14127
- const refusals = (0, import_records34.actionRefusals)(answered.error);
14147
+ const refusals = (0, import_records35.actionRefusals)(answered.error);
14128
14148
  setOutcome({
14129
14149
  kind: "refused",
14130
14150
  action: action3,
@@ -14903,7 +14923,7 @@ function RowActionsDialog({
14903
14923
  // src/gridSummaries.tsx
14904
14924
  var import_react83 = require("react");
14905
14925
  var import_react84 = require("@ai-matrx/records/react");
14906
- var import_records35 = require("@ai-matrx/records");
14926
+ var import_records36 = require("@ai-matrx/records");
14907
14927
  var import_design_system47 = require("@ai-matrx/design-system");
14908
14928
  var import_jsx_runtime54 = require("react/jsx-runtime");
14909
14929
  var SUMMARY_ROW_ID = "__records_ui_summary__";
@@ -14950,8 +14970,8 @@ function useColumnSummaries(args) {
14950
14970
  const why = {};
14951
14971
  for (const [key, op2] of entries) {
14952
14972
  const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
14953
- out[key] = row?.measures?.[(0, import_records35.measureKey)(measure)] ?? null;
14954
- const notice = row?.withheld?.[(0, import_records35.measureKey)(measure)];
14973
+ out[key] = row?.measures?.[(0, import_records36.measureKey)(measure)] ?? null;
14974
+ const notice = row?.withheld?.[(0, import_records36.measureKey)(measure)];
14955
14975
  if (notice) why[key] = notice;
14956
14976
  }
14957
14977
  setValues(out);
@@ -15511,7 +15531,7 @@ function WholeTextDialog({
15511
15531
 
15512
15532
  // src/pasteValues.ts
15513
15533
  var import_core8 = require("@ai-matrx/records/core");
15514
- var import_records36 = require("@ai-matrx/records");
15534
+ var import_records37 = require("@ai-matrx/records");
15515
15535
  function wordForStoredChoice(options, value) {
15516
15536
  if (options === void 0 || typeof value !== "string" || value === "") return null;
15517
15537
  for (const label of options.labels) {
@@ -15524,7 +15544,7 @@ function choiceOptionsOf(options) {
15524
15544
  const labels = [];
15525
15545
  for (const option of options) {
15526
15546
  const id = option.id;
15527
- const key = (0, import_records36.optionKey)(option);
15547
+ const key = (0, import_records37.optionKey)(option);
15528
15548
  const label = recordName(option.data, null, "");
15529
15549
  if (label) {
15530
15550
  labels.push(label);
@@ -15536,7 +15556,7 @@ function choiceOptionsOf(options) {
15536
15556
  return { byWord, labels };
15537
15557
  }
15538
15558
  function valueFromPastedText(field2, raw, options, relationNames) {
15539
- return (0, import_records36.coerceTypedAnswer)(field2, raw, {
15559
+ return (0, import_records37.coerceTypedAnswer)(field2, raw, {
15540
15560
  label: fieldName(field2),
15541
15561
  ...options ? { options } : {},
15542
15562
  ...relationNames ? { relationNames } : {}
@@ -17578,7 +17598,7 @@ function NewRecordControl({
17578
17598
  // src/gridDrill.tsx
17579
17599
  var import_react102 = require("react");
17580
17600
  var import_react103 = require("@ai-matrx/records/react");
17581
- var import_records37 = require("@ai-matrx/records");
17601
+ var import_records38 = require("@ai-matrx/records");
17582
17602
  var import_data_table14 = require("@ai-matrx/design-system/data-table");
17583
17603
 
17584
17604
  // src/drillLevel.ts
@@ -17845,7 +17865,7 @@ function useDrillAnswers(args) {
17845
17865
  across: question.across ?? null,
17846
17866
  show: question.show,
17847
17867
  where: args.where,
17848
- rule: args.rule && (0, import_records37.isRuleFilter)(args.rule) ? args.rule : null,
17868
+ rule: args.rule && (0, import_records38.isRuleFilter)(args.rule) ? args.rule : null,
17849
17869
  window: question.window ?? null,
17850
17870
  compare: question.compare ?? null,
17851
17871
  windowKey: args.windowKey ?? null,
@@ -18110,7 +18130,7 @@ function trailClause(fields, w) {
18110
18130
  }
18111
18131
  function filterWithTrail(fields, base2, trail) {
18112
18132
  if (trail.length === 0) return base2;
18113
- if (!base2 || !(0, import_records37.isRuleFilter)(base2)) {
18133
+ if (!base2 || !(0, import_records38.isRuleFilter)(base2)) {
18114
18134
  const flat = { ...base2 ?? {} };
18115
18135
  for (const w of trail) {
18116
18136
  const clause = trailClause(fields, w);
@@ -18133,7 +18153,7 @@ function filterWithTrail(fields, base2, trail) {
18133
18153
  return { op: "and", args };
18134
18154
  }
18135
18155
  function filterWithWindow(fields, base2, key, range) {
18136
- if (!base2 || !(0, import_records37.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
18156
+ if (!base2 || !(0, import_records38.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
18137
18157
  const field2 = fields.find((f) => f.key === key);
18138
18158
  if (!field2) return base2;
18139
18159
  const ref = { field: field2.id };
@@ -18176,8 +18196,8 @@ function useGridDrillConfig(args) {
18176
18196
  },
18177
18197
  [setQuestion, onPresentationChange, presentation]
18178
18198
  );
18179
- const flat = state.filter && !(0, import_records37.isRuleFilter)(state.filter) ? state.filter : void 0;
18180
- const rule = state.filter && (0, import_records37.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
18199
+ const flat = state.filter && !(0, import_records38.isRuleFilter)(state.filter) ? state.filter : void 0;
18200
+ const rule = state.filter && (0, import_records38.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
18181
18201
  const { config } = useDrill({
18182
18202
  source: state.source,
18183
18203
  question: state.question,
@@ -18932,7 +18952,7 @@ function withTypeMark(field2, header) {
18932
18952
 
18933
18953
  // src/ReverseColumns.tsx
18934
18954
  var import_react106 = require("react");
18935
- var import_records38 = require("@ai-matrx/records");
18955
+ var import_records39 = require("@ai-matrx/records");
18936
18956
 
18937
18957
  // src/groupReads.ts
18938
18958
  var import_first_page6 = require("@ai-matrx/records/first-page");
@@ -19083,7 +19103,7 @@ function useReverseField(tableId, column) {
19083
19103
  if (column.read_only || !client) return;
19084
19104
  let live = true;
19085
19105
  void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
19086
- if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records38.isReverseField)(f)) ?? null);
19106
+ if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records39.isReverseField)(f)) ?? null);
19087
19107
  });
19088
19108
  return () => {
19089
19109
  live = false;
@@ -19629,7 +19649,7 @@ var import_react109 = require("react");
19629
19649
  var import_react110 = require("@ai-matrx/records/react");
19630
19650
  var import_core13 = require("@ai-matrx/records/core");
19631
19651
  var import_design_system60 = require("@ai-matrx/design-system");
19632
- var import_records41 = require("@ai-matrx/records");
19652
+ var import_records42 = require("@ai-matrx/records");
19633
19653
 
19634
19654
  // src/importRuleCheck.ts
19635
19655
  var import_core12 = require("@ai-matrx/records/core");
@@ -19680,7 +19700,7 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
19680
19700
  var import_text_case8 = require("@ai-matrx/kit/text-case");
19681
19701
 
19682
19702
  // src/importKinds.ts
19683
- var import_records39 = require("@ai-matrx/records");
19703
+ var import_records40 = require("@ai-matrx/records");
19684
19704
  var IMPORT_KINDS = [
19685
19705
  { kind: "text", label: "Text" },
19686
19706
  { kind: "date", label: "Date" },
@@ -19708,7 +19728,7 @@ function datesOfColumn(rows, header, opts = {}) {
19708
19728
  const raw = String(r[header] ?? "").trim();
19709
19729
  if (raw === "") return;
19710
19730
  filled += 1;
19711
- const got = (0, import_records39.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
19731
+ const got = (0, import_records40.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
19712
19732
  if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
19713
19733
  else unreadable.push({ row: i, raw });
19714
19734
  });
@@ -19733,12 +19753,12 @@ function exactDuplicateRows(rows, headers) {
19733
19753
  }
19734
19754
 
19735
19755
  // src/importCombine.ts
19736
- var import_records40 = require("@ai-matrx/records");
19756
+ var import_records41 = require("@ai-matrx/records");
19737
19757
  function titleRepeats(rows, header) {
19738
19758
  const seen = /* @__PURE__ */ new Set();
19739
19759
  let filled = 0;
19740
19760
  for (const r of rows) {
19741
- const key = (0, import_records40.relationNameKey)(String(r[header] ?? ""));
19761
+ const key = (0, import_records41.relationNameKey)(String(r[header] ?? ""));
19742
19762
  if (key === "") continue;
19743
19763
  filled += 1;
19744
19764
  seen.add(key);
@@ -19748,7 +19768,7 @@ function titleRepeats(rows, header) {
19748
19768
  function sameRecordLikely(rows, header) {
19749
19769
  const groups = /* @__PURE__ */ new Map();
19750
19770
  for (const r of rows) {
19751
- const key = (0, import_records40.relationNameKey)(String(r[header] ?? ""));
19771
+ const key = (0, import_records41.relationNameKey)(String(r[header] ?? ""));
19752
19772
  if (key === "") continue;
19753
19773
  const held = groups.get(key);
19754
19774
  if (held) held.push(r);
@@ -19781,7 +19801,7 @@ function combineRows(rows, header) {
19781
19801
  const out = [];
19782
19802
  const outLines = [];
19783
19803
  rows.forEach((r, i) => {
19784
- const key = (0, import_records40.relationNameKey)(String(r[header] ?? ""));
19804
+ const key = (0, import_records41.relationNameKey)(String(r[header] ?? ""));
19785
19805
  if (key === "") {
19786
19806
  out.push({ ...r });
19787
19807
  outLines.push([i + 1]);
@@ -20273,13 +20293,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20273
20293
  async (wanted) => {
20274
20294
  const next = /* @__PURE__ */ new Map();
20275
20295
  for (const { header, field: field2 } of wanted) {
20276
- const names = effectiveRows.flatMap((r) => (0, import_records41.relationNamesIn)(field2, String(r[header] ?? "")));
20296
+ const names = effectiveRows.flatMap((r) => (0, import_records42.relationNamesIn)(field2, String(r[header] ?? "")));
20277
20297
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
20278
20298
  if (!got.ok) {
20279
20299
  setRelationProblem(got.error);
20280
20300
  return null;
20281
20301
  }
20282
- next.set(field2.key, (0, import_records41.relationNameIndexOf)(got.data));
20302
+ next.set(field2.key, (0, import_records42.relationNameIndexOf)(got.data));
20283
20303
  }
20284
20304
  setRelationProblem(null);
20285
20305
  setRelationIndex(next);
@@ -20303,12 +20323,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20303
20323
  let linked = 0;
20304
20324
  let named = 0;
20305
20325
  effectiveRows.forEach((row, i) => {
20306
- const names = (0, import_records41.relationNamesIn)(field2, String(row[header] ?? ""));
20326
+ const names = (0, import_records42.relationNamesIn)(field2, String(row[header] ?? ""));
20307
20327
  if (String(row[header] ?? "").trim() === "") return;
20308
20328
  named += 1;
20309
20329
  let ok = true;
20310
20330
  for (const name of names) {
20311
- const hits = index.byName.get((0, import_records41.relationNameKey)(name)) ?? [];
20331
+ const hits = index.byName.get((0, import_records42.relationNameKey)(name)) ?? [];
20312
20332
  if (hits.length === 1) continue;
20313
20333
  ok = false;
20314
20334
  if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
@@ -20366,11 +20386,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20366
20386
  const named = index.get(field2.key);
20367
20387
  const text = String(row[header] ?? "").trim();
20368
20388
  if (!named || text === "") continue;
20369
- const parts = field2.multi ? (0, import_records41.splitListCell)(text) : [text];
20389
+ const parts = field2.multi ? (0, import_records42.splitListCell)(text) : [text];
20370
20390
  const ids = [];
20371
20391
  let skip = false;
20372
20392
  for (const part of parts) {
20373
- const hits = (0, import_records41.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records41.relationNameKey)(part)) ?? [];
20393
+ const hits = (0, import_records42.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records42.relationNameKey)(part)) ?? [];
20374
20394
  if (hits === null) ids.push(part);
20375
20395
  else if (hits.length === 1) ids.push(hits[0].id);
20376
20396
  else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
@@ -20410,7 +20430,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20410
20430
  setPhase("linking");
20411
20431
  for (const ask2 of toMerge) {
20412
20432
  for (const [name] of ask2.ambiguous) {
20413
- const hits = ask2.index.byName.get((0, import_records41.relationNameKey)(name)) ?? [];
20433
+ const hits = ask2.index.byName.get((0, import_records42.relationNameKey)(name)) ?? [];
20414
20434
  const winner = hits[0];
20415
20435
  if (!winner) continue;
20416
20436
  for (const loser of hits.slice(1)) {
@@ -22076,7 +22096,7 @@ function useStoreValueFacets(enabled, inputs) {
22076
22096
  // src/gridGrouping.tsx
22077
22097
  var import_react115 = require("react");
22078
22098
  var import_react116 = require("@ai-matrx/records/react");
22079
- var import_records42 = require("@ai-matrx/records");
22099
+ var import_records43 = require("@ai-matrx/records");
22080
22100
  var import_jsx_runtime72 = require("react/jsx-runtime");
22081
22101
  function groupValueKey(value) {
22082
22102
  if (value === null || value === void 0 || value === "") return "";
@@ -22113,8 +22133,8 @@ function useGroupFacts(args) {
22113
22133
  const withheld = {};
22114
22134
  for (const [fieldKey, op2] of entries) {
22115
22135
  const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
22116
- values[fieldKey] = row.measures?.[(0, import_records42.measureKey)(m)] ?? null;
22117
- const notice = row.withheld?.[(0, import_records42.measureKey)(m)];
22136
+ values[fieldKey] = row.measures?.[(0, import_records43.measureKey)(m)] ?? null;
22137
+ const notice = row.withheld?.[(0, import_records43.measureKey)(m)];
22118
22138
  if (notice) withheld[fieldKey] = notice;
22119
22139
  }
22120
22140
  out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
@@ -23164,7 +23184,7 @@ function BulkActions({
23164
23184
  // src/handOrder.tsx
23165
23185
  var import_react124 = require("react");
23166
23186
  var import_react125 = require("@ai-matrx/records/react");
23167
- var import_records43 = require("@ai-matrx/records");
23187
+ var import_records44 = require("@ai-matrx/records");
23168
23188
  var import_design_system64 = require("@ai-matrx/design-system");
23169
23189
 
23170
23190
  // src/views.ts
@@ -23287,7 +23307,7 @@ function useHandOrderRows(args) {
23287
23307
  const client = (0, import_react125.useRecordsClient)();
23288
23308
  const { viewId, active, page, pageSize } = args;
23289
23309
  const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
23290
- const filterKey = filter ? (0, import_records43.stableFilterKey)(filter) : "";
23310
+ const filterKey = filter ? (0, import_records44.stableFilterKey)(filter) : "";
23291
23311
  const filterNow = (0, import_react124.useRef)(filter);
23292
23312
  filterNow.current = filter;
23293
23313
  const [answer, setAnswer] = (0, import_react124.useState)(null);
@@ -23668,9 +23688,9 @@ function GridBody({
23668
23688
  const pageAskedFor = (0, import_react127.useRef)(null);
23669
23689
  if (fields.data && !table.loading) pageAskedFor.current = tableId;
23670
23690
  const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
23671
- const numberAsked = (0, import_react127.useMemo)(() => (0, import_records44.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
23691
+ const numberAsked = (0, import_react127.useMemo)(() => (0, import_records45.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
23672
23692
  const pageSearch = numberAsked ? "" : searchTerm;
23673
- const pageFilter = numberAsked ? (0, import_records44.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
23693
+ const pageFilter = numberAsked ? (0, import_records45.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
23674
23694
  const serverRead = (0, import_react128.useRecordPage)(storePaged && pageAsked ? tableId : null, {
23675
23695
  pageSize: query.pageSize,
23676
23696
  page: Math.max(0, query.page - 1),
@@ -24003,7 +24023,7 @@ function GridBody({
24003
24023
  const names = wanted.get(field2.key) ?? [];
24004
24024
  if (names.length === 0) return;
24005
24025
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
24006
- if (got.ok) relationNames.current.set(field2.key, (0, import_records45.relationNameIndexOf)(got.data));
24026
+ if (got.ok) relationNames.current.set(field2.key, (0, import_records46.relationNameIndexOf)(got.data));
24007
24027
  })
24008
24028
  );
24009
24029
  },
@@ -24082,7 +24102,7 @@ function GridBody({
24082
24102
  field2.key,
24083
24103
  lines.flatMap((line) => {
24084
24104
  const cell2 = line[at];
24085
- return typeof cell2 === "string" ? (0, import_records45.relationNamesIn)(field2, cell2) : [];
24105
+ return typeof cell2 === "string" ? (0, import_records46.relationNamesIn)(field2, cell2) : [];
24086
24106
  })
24087
24107
  );
24088
24108
  }
@@ -24369,7 +24389,7 @@ function GridBody({
24369
24389
  tableName: table.data ? tableName(table.data) : "",
24370
24390
  fields: fields.data ?? [],
24371
24391
  document: row.document ?? {},
24372
- level: (0, import_records45.asPermissionLevel)(row.level)
24392
+ level: (0, import_records46.asPermissionLevel)(row.level)
24373
24393
  }),
24374
24394
  [host, tableId, table.data, fields.data]
24375
24395
  );
@@ -26310,7 +26330,7 @@ var import_design_system78 = require("@ai-matrx/design-system");
26310
26330
  var import_react147 = require("react");
26311
26331
  var import_react148 = require("@ai-matrx/records/react");
26312
26332
  var import_core19 = require("@ai-matrx/records/core");
26313
- var import_records50 = require("@ai-matrx/records");
26333
+ var import_records51 = require("@ai-matrx/records");
26314
26334
  var import_design_system77 = require("@ai-matrx/design-system");
26315
26335
 
26316
26336
  // src/newTableColumns.ts
@@ -26494,7 +26514,7 @@ function fieldsForNewColumns(columns) {
26494
26514
  var import_clipboard5 = require("@ai-matrx/kit/clipboard");
26495
26515
  var import_react143 = require("react");
26496
26516
  var import_react144 = require("@ai-matrx/records/react");
26497
- var import_records48 = require("@ai-matrx/records");
26517
+ var import_records49 = require("@ai-matrx/records");
26498
26518
  var import_design_system75 = require("@ai-matrx/design-system");
26499
26519
 
26500
26520
  // src/BookingBuilder.tsx
@@ -26503,7 +26523,7 @@ var import_design_system70 = require("@ai-matrx/design-system");
26503
26523
  var import_react139 = require("react");
26504
26524
  var import_react140 = require("@ai-matrx/records/react");
26505
26525
  var import_format7 = require("@ai-matrx/kit/format");
26506
- var import_records46 = require("@ai-matrx/records");
26526
+ var import_records47 = require("@ai-matrx/records");
26507
26527
  var import_design_system71 = require("@ai-matrx/design-system");
26508
26528
 
26509
26529
  // src/publicQuestions.ts
@@ -26784,7 +26804,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
26784
26804
  if (!rights.structure) {
26785
26805
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: (0, import_design_system71.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
26786
26806
  }
26787
- const url = formId ? `${publicOrigin}${(0, import_records46.bookingPath)(formId)}` : null;
26807
+ const url = formId ? `${publicOrigin}${(0, import_records47.bookingPath)(formId)}` : null;
26788
26808
  const shown4 = offer ?? null;
26789
26809
  return (
26790
26810
  // THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
@@ -27044,7 +27064,7 @@ function BuildOrAsk({
27044
27064
 
27045
27065
  // src/BuiltOnArchive.tsx
27046
27066
  var import_react141 = require("react");
27047
- var import_records47 = require("@ai-matrx/records");
27067
+ var import_records48 = require("@ai-matrx/records");
27048
27068
  var import_react142 = require("@ai-matrx/records/react");
27049
27069
  var import_design_system74 = require("@ai-matrx/design-system");
27050
27070
 
@@ -27487,9 +27507,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
27487
27507
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
27488
27508
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "truncate text-sm", children: thing.title }),
27489
27509
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
27490
- import_records47.BUILT_KIND_WORD[thing.kind],
27510
+ import_records48.BUILT_KIND_WORD[thing.kind],
27491
27511
  " \xB7 archived ",
27492
- (0, import_records47.archivedWhen)(thing.archivedAt)
27512
+ (0, import_records48.archivedWhen)(thing.archivedAt)
27493
27513
  ] }),
27494
27514
  refusal3 && refusal3.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
27495
27515
  ] }),
@@ -27640,7 +27660,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
27640
27660
  " Open the table the appointments should land in to make one."
27641
27661
  ] }) : null,
27642
27662
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
27643
- const url = `${origin}${(0, import_records48.bookingPath)(page.form_id)}`;
27663
+ const url = `${origin}${(0, import_records49.bookingPath)(page.form_id)}`;
27644
27664
  const mayOpen = levels.data?.[page.table_id] === "admin";
27645
27665
  const open = page.published_at !== null && page.closed_at === null;
27646
27666
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
@@ -27760,7 +27780,7 @@ function nextInWords(page) {
27760
27780
 
27761
27781
  // src/WhereItLives.tsx
27762
27782
  var import_react145 = require("react");
27763
- var import_records49 = require("@ai-matrx/records");
27783
+ var import_records50 = require("@ai-matrx/records");
27764
27784
  var import_react146 = require("@ai-matrx/records/react");
27765
27785
  var import_design_system76 = require("@ai-matrx/design-system");
27766
27786
  var import_jsx_runtime89 = require("react/jsx-runtime");
@@ -27889,7 +27909,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
27889
27909
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
27890
27910
  "?"
27891
27911
  ] }),
27892
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-muted-foreground", children: (0, import_records49.moveConsequence)(answer.home, choosing) }),
27912
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-muted-foreground", children: (0, import_records50.moveConsequence)(answer.home, choosing) }),
27893
27913
  said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
27894
27914
  import_design_system76.ErrorBox,
27895
27915
  {
@@ -28047,7 +28067,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
28047
28067
  alive = false;
28048
28068
  };
28049
28069
  }, [client]);
28050
- const listed = facts.phase === "read" ? (0, import_records50.withTablePlacement)(
28070
+ const listed = facts.phase === "read" ? (0, import_records51.withTablePlacement)(
28051
28071
  (0, import_core19.withTableFacts)(tables.data ?? [], facts.rows, me),
28052
28072
  facts.rows
28053
28073
  ) : tables.data ?? [];
@@ -29165,7 +29185,7 @@ function TableRenameDialog({
29165
29185
 
29166
29186
  // src/TableSettings.tsx
29167
29187
  var import_react165 = require("react");
29168
- var import_records52 = require("@ai-matrx/records");
29188
+ var import_records53 = require("@ai-matrx/records");
29169
29189
 
29170
29190
  // src/ArchiveDeliberately.tsx
29171
29191
  var import_react155 = require("react");
@@ -29456,7 +29476,7 @@ function TableAccessLevel({ tableId, fields }) {
29456
29476
 
29457
29477
  // src/RowControls.tsx
29458
29478
  var import_react161 = require("react");
29459
- var import_records51 = require("@ai-matrx/records");
29479
+ var import_records52 = require("@ai-matrx/records");
29460
29480
  var import_react162 = require("@ai-matrx/records/react");
29461
29481
  var import_design_system84 = require("@ai-matrx/design-system");
29462
29482
  var import_jsx_runtime97 = require("react/jsx-runtime");
@@ -29484,9 +29504,9 @@ function ShownToSelect({
29484
29504
  onChange,
29485
29505
  testId
29486
29506
  }) {
29487
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_design_system84.Select, { value, onValueChange: (next) => (0, import_records51.isShownTo)(next) ? onChange(next) : void 0, children: [
29507
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_design_system84.Select, { value, onValueChange: (next) => (0, import_records52.isShownTo)(next) ? onChange(next) : void 0, children: [
29488
29508
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectTrigger, { size: "sm", "aria-label": label, className: "h-7 min-w-[8rem] text-xs", "data-testid": testId, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectValue, {}) }),
29489
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectItem, { value: word, children: import_records51.SHOWN_TO_LABEL[word] }, word)) })
29509
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system84.SelectItem, { value: word, children: import_records52.SHOWN_TO_LABEL[word] }, word)) })
29490
29510
  ] });
29491
29511
  }
29492
29512
  function NewRowsDefaults({ tableId }) {
@@ -29524,10 +29544,10 @@ function NewRowsDefaults({ tableId }) {
29524
29544
  setError(null);
29525
29545
  setApplied(appliedLine(answer.data));
29526
29546
  };
29527
- if (!(0, import_records51.levelHasShownTo)(table.data?.level)) return null;
29547
+ if (!(0, import_records52.levelHasShownTo)(table.data?.level)) return null;
29528
29548
  if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RefusalNotice, { error }) : null;
29529
29549
  const shown4 = d.shown_to ?? d.effective.shown_to;
29530
- const allowed = d.allowed_shown_to.filter(import_records51.isShownTo);
29550
+ const allowed = d.allowed_shown_to.filter(import_records52.isShownTo);
29531
29551
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
29532
29552
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
29533
29553
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -29541,7 +29561,7 @@ function NewRowsDefaults({ tableId }) {
29541
29561
  testId: "new-rows-shown-to",
29542
29562
  onChange: (next) => void set({ shown_to: next })
29543
29563
  }
29544
- ) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records51.SHOWN_TO_LABEL[shown4] })
29564
+ ) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records52.SHOWN_TO_LABEL[shown4] })
29545
29565
  ] }),
29546
29566
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
29547
29567
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
@@ -29592,10 +29612,10 @@ function RowShownTo({ recordId, tableId }) {
29592
29612
  }, [read]);
29593
29613
  if (error && !c) return null;
29594
29614
  if (tableId && table.loading && !table.data) return null;
29595
- if (!(0, import_records51.levelHasShownTo)(table.data?.level)) return null;
29596
- if (!c || c.shown_to.is_child || !(0, import_records51.isShownTo)(c.shown_to.effective)) return null;
29615
+ if (!(0, import_records52.levelHasShownTo)(table.data?.level)) return null;
29616
+ if (!c || c.shown_to.is_child || !(0, import_records52.isShownTo)(c.shown_to.effective)) return null;
29597
29617
  const effective = c.shown_to.effective;
29598
- const allowed = c.shown_to.allowed.filter(import_records51.isShownTo);
29618
+ const allowed = c.shown_to.allowed.filter(import_records52.isShownTo);
29599
29619
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "flex items-center gap-1.5", "data-testid": "row-shown-to", children: [
29600
29620
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
29601
29621
  c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
@@ -29614,7 +29634,7 @@ function RowShownTo({ recordId, tableId }) {
29614
29634
  }
29615
29635
  }
29616
29636
  ) : /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
29617
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records51.SHOWN_TO_LABEL[effective] }),
29637
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records52.SHOWN_TO_LABEL[effective] }),
29618
29638
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
29619
29639
  ] }),
29620
29640
  error ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RefusalNotice, { error }) : null
@@ -29973,7 +29993,7 @@ function TableSettingsPanel({
29973
29993
  table.data ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
29974
29994
  table.data ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
29975
29995
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Separator, {}),
29976
- (0, import_records52.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
29996
+ (0, import_records53.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
29977
29997
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(NewRowsDefaults, { tableId }),
29978
29998
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Separator, {})
29979
29999
  ] }) : null,
@@ -30057,7 +30077,7 @@ function TableSettingsPanel({
30057
30077
 
30058
30078
  // src/Peek.tsx
30059
30079
  var import_react174 = require("react");
30060
- var import_records54 = require("@ai-matrx/records");
30080
+ var import_records55 = require("@ai-matrx/records");
30061
30081
  var import_react175 = require("@ai-matrx/records/react");
30062
30082
  var import_react176 = require("@ai-matrx/alchemy/react");
30063
30083
 
@@ -30375,12 +30395,12 @@ function ShareForSomebodyElse({
30375
30395
  // src/RecordBody.tsx
30376
30396
  var import_react172 = require("react");
30377
30397
  var import_design_system89 = require("@ai-matrx/design-system");
30378
- var import_records53 = require("@ai-matrx/records");
30398
+ var import_records54 = require("@ai-matrx/records");
30379
30399
  var import_react173 = require("@ai-matrx/records/react");
30380
30400
  var import_jsx_runtime103 = require("react/jsx-runtime");
30381
30401
  var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
30382
30402
  function bodyFieldOf(fields) {
30383
- const rich2 = fields.filter((field2) => (0, import_records53.newerKindOf)(field2) === "rich_text");
30403
+ const rich2 = fields.filter((field2) => (0, import_records54.newerKindOf)(field2) === "rich_text");
30384
30404
  return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
30385
30405
  }
30386
30406
  var BODY_COLUMN_NAME = "Notes";
@@ -30504,7 +30524,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
30504
30524
  if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(RefusalNotice, { error: record.error, className });
30505
30525
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(RefusalNotice, { error: fields.error, className });
30506
30526
  const document2 = record.data?.document;
30507
- if (document2 && (0, import_records54.isLockedStub)({ document: document2, level: null })) {
30527
+ if (document2 && (0, import_records55.isLockedStub)({ document: document2, level: null })) {
30508
30528
  const filed = document2["submitted_at"];
30509
30529
  const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
30510
30530
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("p", { className: (0, import_design_system90.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
@@ -30803,7 +30823,7 @@ var LOOK_WORDS = {
30803
30823
  // src/ViewSwitcher.tsx
30804
30824
  var import_react206 = require("react");
30805
30825
  var import_react207 = require("@ai-matrx/records/react");
30806
- var import_records58 = require("@ai-matrx/records");
30826
+ var import_records59 = require("@ai-matrx/records");
30807
30827
  var import_design_system102 = require("@ai-matrx/design-system");
30808
30828
  var import_data_table24 = require("@ai-matrx/design-system/data-table");
30809
30829
  var import_format9 = require("@ai-matrx/kit/format");
@@ -31004,7 +31024,7 @@ function MoveRefusedBadge({ refused }) {
31004
31024
  // src/Pipeline.tsx
31005
31025
  var import_react183 = require("react");
31006
31026
  var import_react184 = require("@ai-matrx/records/react");
31007
- var import_records55 = require("@ai-matrx/records");
31027
+ var import_records56 = require("@ai-matrx/records");
31008
31028
  var import_design_system93 = require("@ai-matrx/design-system");
31009
31029
  var import_data_table19 = require("@ai-matrx/design-system/data-table");
31010
31030
 
@@ -31337,7 +31357,7 @@ function PipelineBoard({
31337
31357
  alive.current = false;
31338
31358
  };
31339
31359
  }, []);
31340
- const filterKey = (0, import_records55.stableFilterKey)(filter);
31360
+ const filterKey = (0, import_records56.stableFilterKey)(filter);
31341
31361
  const reload = (0, import_react183.useCallback)(async () => {
31342
31362
  setLoading(true);
31343
31363
  const [read, board, held] = await Promise.all([
@@ -34414,13 +34434,13 @@ function ListRow({
34414
34434
  // src/ChartLayout.tsx
34415
34435
  var import_react204 = require("react");
34416
34436
  var import_react205 = require("@ai-matrx/records/react");
34417
- var import_records57 = require("@ai-matrx/records");
34437
+ var import_records58 = require("@ai-matrx/records");
34418
34438
  var import_design_system101 = require("@ai-matrx/design-system");
34419
34439
 
34420
34440
  // src/ChartBlock.tsx
34421
34441
  var import_react203 = require("react");
34422
34442
  var import_recharts = require("recharts");
34423
- var import_records56 = require("@ai-matrx/records");
34443
+ var import_records57 = require("@ai-matrx/records");
34424
34444
  var import_core20 = require("@ai-matrx/records/core");
34425
34445
  var import_design_system100 = require("@ai-matrx/design-system");
34426
34446
  var import_format8 = require("@ai-matrx/kit/format");
@@ -34898,7 +34918,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
34898
34918
  const kind = block.kind;
34899
34919
  const tableId = block.table_id ?? subject;
34900
34920
  const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
34901
- const primary = (0, import_records56.measureKey)(measures[0]);
34921
+ const primary = (0, import_records57.measureKey)(measures[0]);
34902
34922
  const windows = kind === "stuck" ? null : block.compare ?? null;
34903
34923
  const compared = !!windows;
34904
34924
  const grain = block.bucket?.by ?? null;
@@ -35393,7 +35413,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
35393
35413
  }, [client, view.subject, view.name, qKey, filterKey]);
35394
35414
  const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
35395
35415
  const numeric = fields.filter((f) => NUMBER_TYPES.has(String(f.type)));
35396
- const pickMeasure = (0, import_records57.measureKey)(q.measure);
35416
+ const pickMeasure = (0, import_records58.measureKey)(q.measure);
35397
35417
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex min-h-0 flex-col gap-2", "data-records-chart-layout": "", "data-records-chart-measure": pickMeasure, children: [
35398
35418
  /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
35399
35419
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-muted-foreground", children: "Group by" }),
@@ -35432,7 +35452,7 @@ var NO_FIELDS2 = [];
35432
35452
  function useViewRecords(view, pageSize = 200, filter, viewId) {
35433
35453
  const client = (0, import_react207.useRecordsClient)();
35434
35454
  const [limit, setLimit] = (0, import_react206.useState)(pageSize);
35435
- const questionKey = `${view.subject}|${(0, import_records58.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
35455
+ const questionKey = `${view.subject}|${(0, import_records59.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
35436
35456
  (0, import_react206.useEffect)(() => {
35437
35457
  setLimit(pageSize);
35438
35458
  }, [questionKey, pageSize]);
@@ -35465,8 +35485,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
35465
35485
  cancelled = true;
35466
35486
  };
35467
35487
  }, [client, ruleId, pageSize]);
35468
- const asked3 = (0, import_records58.stableFilterKey)(filter ?? null);
35469
- const fromView = asked3 !== "{}" && (asked3 === (0, import_records58.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records58.stableFilterKey)(view.filters ?? null));
35488
+ const asked3 = (0, import_records59.stableFilterKey)(filter ?? null);
35489
+ const fromView = asked3 !== "{}" && (asked3 === (0, import_records59.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records59.stableFilterKey)(view.filters ?? null));
35470
35490
  const tableRows = (0, import_react206.useMemo)(() => table.data?.rows ?? [], [table.data]);
35471
35491
  const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
35472
35492
  const hand = useHandOrderRows({
@@ -36565,7 +36585,7 @@ function RecordCard({
36565
36585
  /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "block truncate", children: label }),
36566
36586
  parentName ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-parent": parentId ?? "", children: `Sub-item of ${parentName}` }) : null,
36567
36587
  dates && dates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(CardDates, { record, fields: dates }) : null,
36568
- (fields ?? []).filter((f) => (0, import_records58.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
36588
+ (fields ?? []).filter((f) => (0, import_records59.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
36569
36589
  RecordValue,
36570
36590
  {
36571
36591
  field: f,
@@ -36586,12 +36606,12 @@ function cardHiddenOf(presentation) {
36586
36606
  }
36587
36607
  var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
36588
36608
  function boardDefaultGroupField(eligible) {
36589
- return eligible.find((f) => (0, import_records58.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
36609
+ return eligible.find((f) => (0, import_records59.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
36590
36610
  }
36591
36611
 
36592
36612
  // src/ArchivedView.tsx
36593
36613
  var import_react208 = require("react");
36594
- var import_records59 = require("@ai-matrx/records");
36614
+ var import_records60 = require("@ai-matrx/records");
36595
36615
  var import_react209 = require("@ai-matrx/records/react");
36596
36616
  var import_design_system103 = require("@ai-matrx/design-system");
36597
36617
  var import_jsx_runtime120 = require("react/jsx-runtime");
@@ -36601,7 +36621,7 @@ function mayNotRestoreLine(why) {
36601
36621
  return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
36602
36622
  }
36603
36623
  function archivedRowLine(row, titleKey) {
36604
- return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records59.archivedByLine)(row)}`;
36624
+ return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records60.archivedByLine)(row)}`;
36605
36625
  }
36606
36626
  function ArchivedView({
36607
36627
  tableId,
@@ -36615,7 +36635,7 @@ function ArchivedView({
36615
36635
  const table = (0, import_react209.useTable)(tableId);
36616
36636
  const rights = useTableRights(table.data);
36617
36637
  const fields = (0, import_react209.useFields)(tableId);
36618
- const [lane, setLane] = (0, import_react208.useState)(laneFromHost ?? import_records59.DEFAULT_ARCHIVE_LANE);
36638
+ const [lane, setLane] = (0, import_react208.useState)(laneFromHost ?? import_records60.DEFAULT_ARCHIVE_LANE);
36619
36639
  const [rows, setRows] = (0, import_react208.useState)([]);
36620
36640
  const [loading, setLoading] = (0, import_react208.useState)(true);
36621
36641
  const [error, setError] = (0, import_react208.useState)(null);
@@ -36662,15 +36682,15 @@ function ArchivedView({
36662
36682
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: (0, import_design_system103.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
36663
36683
  /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
36664
36684
  /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
36665
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records59.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
36685
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records60.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
36666
36686
  import_design_system103.Button,
36667
36687
  {
36668
36688
  size: "sm",
36669
36689
  variant: option === lane ? "secondary" : "ghost",
36670
36690
  "aria-pressed": option === lane,
36671
- title: import_records59.ARCHIVE_LANE_MEANS[option],
36691
+ title: import_records60.ARCHIVE_LANE_MEANS[option],
36672
36692
  onClick: () => pick(option),
36673
- children: import_records59.ARCHIVE_LANE_LABEL[option]
36693
+ children: import_records60.ARCHIVE_LANE_LABEL[option]
36674
36694
  },
36675
36695
  option
36676
36696
  )) })
@@ -36686,7 +36706,7 @@ function ArchivedView({
36686
36706
  ),
36687
36707
  error ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(RefusalNotice, { error }) : null,
36688
36708
  loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_design_system103.Skeleton, { className: "h-24 w-full" }) : null,
36689
- !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records59.emptyArchiveLine)(lane) }) : null,
36709
+ !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records60.emptyArchiveLine)(lane) }) : null,
36690
36710
  !loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
36691
36711
  "li",
36692
36712
  {
@@ -36696,7 +36716,7 @@ function ArchivedView({
36696
36716
  children: [
36697
36717
  /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
36698
36718
  /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
36699
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records59.archivedByLine)(row) }),
36719
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records60.archivedByLine)(row) }),
36700
36720
  refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
36701
36721
  ] }),
36702
36722
  mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
@@ -36719,7 +36739,7 @@ function ArchivedView({
36719
36739
  ] });
36720
36740
  }
36721
36741
  function retiredColumnLine(row) {
36722
- return (0, import_records59.archivedByLine)(row);
36742
+ return (0, import_records60.archivedByLine)(row);
36723
36743
  }
36724
36744
  function RetiredColumns({ tableId, mayRestore, whyNot }) {
36725
36745
  const client = (0, import_react209.useRecordsClient)();
@@ -36783,7 +36803,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
36783
36803
 
36784
36804
  // src/ArchivedDisclosure.tsx
36785
36805
  var import_react210 = require("react");
36786
- var import_records60 = require("@ai-matrx/records");
36806
+ var import_records61 = require("@ai-matrx/records");
36787
36807
  var import_react211 = require("@ai-matrx/records/react");
36788
36808
  var import_design_system104 = require("@ai-matrx/design-system");
36789
36809
  var import_jsx_runtime121 = require("react/jsx-runtime");
@@ -36883,10 +36903,10 @@ function ArchivedPortals({
36883
36903
  error ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(RefusalNotice, { error }) : null,
36884
36904
  rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_design_system104.Skeleton, { className: "h-16 w-full" }) : null,
36885
36905
  said2 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
36886
- rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records60.emptyPortalArchiveLine)() }) : null,
36906
+ rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records61.emptyPortalArchiveLine)() }) : null,
36887
36907
  rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
36888
36908
  const asking = confirming === portal.portal_id;
36889
- const matches2 = (0, import_records60.portalTitleTypedBack)(typed2, portal.title);
36909
+ const matches2 = (0, import_records61.portalTitleTypedBack)(typed2, portal.title);
36890
36910
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
36891
36911
  "li",
36892
36912
  {
@@ -36925,7 +36945,7 @@ function ArchivedPortals({
36925
36945
  ] }),
36926
36946
  asking ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
36927
36947
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
36928
- (0, import_records60.portalConfirmLine)(portal.title),
36948
+ (0, import_records61.portalConfirmLine)(portal.title),
36929
36949
  " Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
36930
36950
  ] }),
36931
36951
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
@@ -40286,7 +40306,7 @@ function clientNoun(table) {
40286
40306
  var import_clipboard8 = require("@ai-matrx/kit/clipboard");
40287
40307
  var import_react234 = require("react");
40288
40308
  var import_react235 = require("@ai-matrx/records/react");
40289
- var import_records61 = require("@ai-matrx/records");
40309
+ var import_records62 = require("@ai-matrx/records");
40290
40310
  var import_design_system116 = require("@ai-matrx/design-system");
40291
40311
 
40292
40312
  // src/PortalLookEditor.tsx
@@ -40729,7 +40749,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
40729
40749
  ] }) : null,
40730
40750
  activePortalId && !shown4.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: PORTAL_NOT_HERE_LINE }) : null,
40731
40751
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("ul", { className: "flex flex-col gap-2", children: shown4.map((portal) => {
40732
- const url = `${origin}${(0, import_records61.portalPath)(portal.slug)}`;
40752
+ const url = `${origin}${(0, import_records62.portalPath)(portal.slug)}`;
40733
40753
  const open = openId === portal.portal_id;
40734
40754
  const linked = portal.portal_id === activePortalId;
40735
40755
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
@@ -40844,8 +40864,8 @@ function ArchivePortalControl({
40844
40864
  }
40845
40865
  ),
40846
40866
  asking ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "mt-1.5 flex w-full flex-col gap-1.5 rounded-md border border-dashed border-border p-2.5", children: [
40847
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records61.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
40848
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records61.portalConfirmLine)(portal.title) }),
40867
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records62.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
40868
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records62.portalConfirmLine)(portal.title) }),
40849
40869
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
40850
40870
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
40851
40871
  import_design_system116.BasicInput,
@@ -40863,7 +40883,7 @@ function ArchivePortalControl({
40863
40883
  size: "sm",
40864
40884
  variant: "destructive",
40865
40885
  "data-testid": "portal-archive-do",
40866
- disabled: busy || !(0, import_records61.portalTitleTypedBack)(typed2, portal.title),
40886
+ disabled: busy || !(0, import_records62.portalTitleTypedBack)(typed2, portal.title),
40867
40887
  onClick: () => void go(),
40868
40888
  children: busy ? "Archiving\u2026" : "Archive it"
40869
40889
  }
@@ -41388,7 +41408,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
41388
41408
  // src/DigestScheduler.tsx
41389
41409
  var import_react236 = require("react");
41390
41410
  var import_react237 = require("@ai-matrx/records/react");
41391
- var import_records62 = require("@ai-matrx/records");
41411
+ var import_records63 = require("@ai-matrx/records");
41392
41412
  var import_design_system118 = require("@ai-matrx/design-system");
41393
41413
 
41394
41414
  // src/scheduleWords.ts
@@ -41474,7 +41494,7 @@ function DigestScheduler({
41474
41494
  const [channel, setChannel] = (0, import_react236.useState)(
41475
41495
  existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
41476
41496
  );
41477
- const [quiet2, setQuiet] = (0, import_react236.useState)((0, import_records62.hasQuietHours)(existing?.quiet_hours));
41497
+ const [quiet2, setQuiet] = (0, import_react236.useState)((0, import_records63.hasQuietHours)(existing?.quiet_hours));
41478
41498
  const [quietFrom, setQuietFrom] = (0, import_react236.useState)(existing?.quiet_hours?.start ?? "22:00");
41479
41499
  const [quietTo, setQuietTo] = (0, import_react236.useState)(existing?.quiet_hours?.end ?? "07:00");
41480
41500
  const [recipients, setRecipients] = (0, import_react236.useState)(
@@ -41760,7 +41780,7 @@ function DigestScheduler({
41760
41780
  // src/SubscriptionsPanel.tsx
41761
41781
  var import_react240 = require("react");
41762
41782
  var import_react241 = require("@ai-matrx/records/react");
41763
- var import_records63 = require("@ai-matrx/records");
41783
+ var import_records64 = require("@ai-matrx/records");
41764
41784
  var import_design_system120 = require("@ai-matrx/design-system");
41765
41785
 
41766
41786
  // src/WebhooksPanel.tsx
@@ -42123,7 +42143,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
42123
42143
  "Last told you ",
42124
42144
  new Date(subscription.last_sent_at).toLocaleString()
42125
42145
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { children: "It has not told you anything yet." }),
42126
- (0, import_records63.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { children: [
42146
+ (0, import_records64.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { children: [
42127
42147
  "Not between ",
42128
42148
  subscription.quiet_hours.start,
42129
42149
  " and ",
@@ -42194,7 +42214,7 @@ var import_core21 = require("@dnd-kit/core");
42194
42214
  var import_sortable = require("@dnd-kit/sortable");
42195
42215
  var import_utilities = require("@dnd-kit/utilities");
42196
42216
  var import_react246 = require("@ai-matrx/records/react");
42197
- var import_records64 = require("@ai-matrx/records");
42217
+ var import_records65 = require("@ai-matrx/records");
42198
42218
  var import_design_system124 = require("@ai-matrx/design-system");
42199
42219
 
42200
42220
  // src/FormFlowEditor.tsx
@@ -43520,7 +43540,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
43520
43540
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
43521
43541
  PublishRow,
43522
43542
  {
43523
- url: `${publicOrigin}${(0, import_records64.publicFormPath)(draft.id)}`,
43543
+ url: `${publicOrigin}${(0, import_records65.publicFormPath)(draft.id)}`,
43524
43544
  state: draft.state,
43525
43545
  mayPublish: rights.structure,
43526
43546
  why: rights.why("structure"),
@@ -43532,7 +43552,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
43532
43552
  unsaved: dirty
43533
43553
  }
43534
43554
  ),
43535
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records64.publicFormPath)(draft.id)}`, label: draft.name }),
43555
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records65.publicFormPath)(draft.id)}`, label: draft.name }),
43536
43556
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
43537
43557
  NotifyOnAnswer,
43538
43558
  {
@@ -44585,7 +44605,7 @@ function SignBlock({ tableId, recordId, render, className }) {
44585
44605
  // src/NotifyRuleEditor.tsx
44586
44606
  var import_react254 = require("react");
44587
44607
  var import_react255 = require("@ai-matrx/records/react");
44588
- var import_records65 = require("@ai-matrx/records");
44608
+ var import_records66 = require("@ai-matrx/records");
44589
44609
  var import_design_system128 = require("@ai-matrx/design-system");
44590
44610
  var import_jsx_runtime144 = require("react/jsx-runtime");
44591
44611
  var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
@@ -44736,7 +44756,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
44736
44756
  "next ",
44737
44757
  new Date(held.next_digest_at).toLocaleString()
44738
44758
  ] }) : null,
44739
- (0, import_records65.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("span", { className: "text-muted-foreground", children: [
44759
+ (0, import_records66.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("span", { className: "text-muted-foreground", children: [
44740
44760
  "quiet ",
44741
44761
  held.quiet_hours.start,
44742
44762
  "\u2013",
@@ -45422,7 +45442,7 @@ function AddChart({ subject, onAdd, onClose }) {
45422
45442
  }
45423
45443
 
45424
45444
  // src/pages.ts
45425
- var import_records66 = require("@ai-matrx/records");
45445
+ var import_records67 = require("@ai-matrx/records");
45426
45446
  var PAGE_BLOCK_KINDS = ["list", "record", "button", "form", "filter", "chart", "heading", "text", "applet"];
45427
45447
  var PAGE_BLOCK_LABEL = {
45428
45448
  list: "List",
@@ -45472,10 +45492,10 @@ function filterTargets(filter, blocks) {
45472
45492
  }
45473
45493
  function combineFilter(base2, extra, fieldIdOf) {
45474
45494
  const extraKeys = Object.keys(extra);
45475
- if (!base2 || !(0, import_records66.isRuleFilter)(base2) && Object.keys(base2).length === 0) {
45495
+ if (!base2 || !(0, import_records67.isRuleFilter)(base2) && Object.keys(base2).length === 0) {
45476
45496
  return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
45477
45497
  }
45478
- if (!(0, import_records66.isRuleFilter)(base2)) return { filter: { ...base2, ...extra }, dropped: [] };
45498
+ if (!(0, import_records67.isRuleFilter)(base2)) return { filter: { ...base2, ...extra }, dropped: [] };
45479
45499
  const dropped = [];
45480
45500
  let rule = base2;
45481
45501
  for (const key of extraKeys) {
@@ -46693,7 +46713,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
46693
46713
  // src/TableAsk.tsx
46694
46714
  var import_react266 = require("react");
46695
46715
  var import_design_system134 = require("@ai-matrx/design-system");
46696
- var import_records67 = require("@ai-matrx/records");
46716
+ var import_records68 = require("@ai-matrx/records");
46697
46717
  var import_react267 = require("@ai-matrx/records/react");
46698
46718
 
46699
46719
  // src/askWords.ts
@@ -46923,7 +46943,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
46923
46943
  await Promise.all(
46924
46944
  all.filter(isChoiceField).map(async (field2) => {
46925
46945
  const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field2.id);
46926
- if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records67.optionLabel)(o)).filter((w) => Boolean(w));
46946
+ if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records68.optionLabel)(o)).filter((w) => Boolean(w));
46927
46947
  })
46928
46948
  );
46929
46949
  const read = questionFromWords(words2, all, choices);
@@ -47774,7 +47794,7 @@ function onePerKey3(all) {
47774
47794
  var import_clipboard12 = require("@ai-matrx/kit/clipboard");
47775
47795
  var import_react270 = require("react");
47776
47796
  var import_react271 = require("@ai-matrx/records/react");
47777
- var import_records68 = require("@ai-matrx/records");
47797
+ var import_records69 = require("@ai-matrx/records");
47778
47798
  var import_design_system136 = require("@ai-matrx/design-system");
47779
47799
  var import_forms5 = require("@ai-matrx/records/forms");
47780
47800
  var import_jsx_runtime153 = require("react/jsx-runtime");
@@ -47880,7 +47900,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
47880
47900
  }
47881
47901
  ) : null,
47882
47902
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
47883
- const url = `${origin}${(0, import_records68.publicFormPath)(form.form_id)}`;
47903
+ const url = `${origin}${(0, import_records69.publicFormPath)(form.form_id)}`;
47884
47904
  return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
47885
47905
  "li",
47886
47906
  {
@@ -47962,7 +47982,7 @@ var import_design_system138 = require("@ai-matrx/design-system");
47962
47982
 
47963
47983
  // src/CaptureRun.tsx
47964
47984
  var import_react272 = require("react");
47965
- var import_records69 = require("@ai-matrx/records");
47985
+ var import_records70 = require("@ai-matrx/records");
47966
47986
  var import_react273 = require("@ai-matrx/records/react");
47967
47987
  var import_design_system137 = require("@ai-matrx/design-system");
47968
47988
  var import_jsx_runtime154 = require("react/jsx-runtime");
@@ -48017,7 +48037,7 @@ function CaptureRun({ sheetId, face: given, className }) {
48017
48037
  const [sending, setSending] = (0, import_react272.useState)(false);
48018
48038
  const queueRef = (0, import_react272.useRef)(null);
48019
48039
  (0, import_react272.useEffect)(() => {
48020
- const q2 = (0, import_records69.openCaptureQueue)({
48040
+ const q2 = (0, import_records70.openCaptureQueue)({
48021
48041
  onChange: (c, all) => {
48022
48042
  setCounts(c);
48023
48043
  setItems(all);
@@ -48284,7 +48304,7 @@ function CaptureRun({ sheetId, face: given, className }) {
48284
48304
  value: String(answers[q.field] ?? ""),
48285
48305
  onChange: (e) => {
48286
48306
  const raw = e.target.value;
48287
- const answered2 = field2 ? (0, import_records69.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records69.coercionLabel)(field2) }) : { value: raw };
48307
+ const answered2 = field2 ? (0, import_records70.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records70.coercionLabel)(field2) }) : { value: raw };
48288
48308
  setAnswers((held) => ({
48289
48309
  ...held,
48290
48310
  [q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
@@ -48927,7 +48947,7 @@ function useEmbedHandshake(args) {
48927
48947
  // src/TablePage.tsx
48928
48948
  var import_clipboard17 = require("@ai-matrx/kit/clipboard");
48929
48949
  var import_react293 = require("react");
48930
- var import_records70 = require("@ai-matrx/records");
48950
+ var import_records71 = require("@ai-matrx/records");
48931
48951
  var import_react294 = require("@ai-matrx/records/react");
48932
48952
  var import_design_system149 = require("@ai-matrx/design-system");
48933
48953
  var import_text_case19 = require("@ai-matrx/kit/text-case");
@@ -49916,7 +49936,7 @@ function TableNotHere({
49916
49936
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: (0, import_design_system149.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
49917
49937
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
49918
49938
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
49919
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records70.archivedByLine)(row) }),
49939
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records71.archivedByLine)(row) }),
49920
49940
  refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(RefusalNotice, { error: refusal3 }) : null,
49921
49941
  /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex gap-2", children: [
49922
49942
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
@@ -51496,7 +51516,7 @@ function TablePage2(props) {
51496
51516
 
51497
51517
  // src/DataBindingPicker.tsx
51498
51518
  var import_react297 = require("react");
51499
- var import_records71 = require("@ai-matrx/records");
51519
+ var import_records72 = require("@ai-matrx/records");
51500
51520
  var import_react298 = require("@ai-matrx/records/react");
51501
51521
  var import_design_system152 = require("@ai-matrx/design-system");
51502
51522
  var import_jsx_runtime169 = require("react/jsx-runtime");
@@ -51530,7 +51550,7 @@ function isCompleteDataBinding(binding) {
51530
51550
  }
51531
51551
  function bindingPlaceholdersFor(field2) {
51532
51552
  const label = fieldName(field2);
51533
- if ((0, import_records71.isEntityReferenceConfig)(field2.config)) {
51553
+ if ((0, import_records72.isEntityReferenceConfig)(field2.config)) {
51534
51554
  return [
51535
51555
  { token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
51536
51556
  { token: `{${field2.key}.id}`, label: `${label} \xB7 id` }