@ai-matrx/records-ui 0.116.110 → 0.116.111

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
@@ -371,11 +371,19 @@ function peopleSentence(message) {
371
371
  function refusalSentence(error) {
372
372
  return refusalForAPerson(error).sentence;
373
373
  }
374
+ function withoutBuildLabel(sentence2) {
375
+ const hit = LEADING_BUILD_LABEL.exec(sentence2);
376
+ if (!hit) return { label: null, rest: sentence2 };
377
+ const rest = sentence2.slice(hit[0].length).trim();
378
+ return { label: hit[0].trim(), rest: rest.charAt(0).toUpperCase() + rest.slice(1) };
379
+ }
374
380
  function plainSentence(message) {
375
381
  const dropped = [];
376
382
  const kept2 = [];
377
383
  for (const raw of message.split(/(?<=[.!?])\s+/)) {
378
- const sentence2 = raw.trim();
384
+ const labelled = withoutBuildLabel(raw.trim());
385
+ if (labelled.label) dropped.push(labelled.label);
386
+ const sentence2 = labelled.rest;
379
387
  if (sentence2 === "") continue;
380
388
  const cleaned = withoutMachineClauses(sentence2);
381
389
  dropped.push(...cleaned.dropped);
@@ -383,6 +391,9 @@ function plainSentence(message) {
383
391
  }
384
392
  return { kept: kept2.length === 0 ? null : kept2.join(" "), dropped };
385
393
  }
394
+ function readsAsASentence(text) {
395
+ return (text ?? "").trim().split(/\s+/).filter(Boolean).length >= 2;
396
+ }
386
397
  function exampleOf(error) {
387
398
  const detail = error.detail;
388
399
  if (!detail || typeof detail !== "object") return null;
@@ -398,7 +409,7 @@ function refusalForAPerson(error) {
398
409
  const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
399
410
  const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
400
411
  const example = exampleOf(error);
401
- const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
412
+ const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers || !readsAsASentence(hint.kept) ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
402
413
  const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
403
414
  const said2 = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
404
415
  const forEngineers = [
@@ -433,7 +444,7 @@ function refusalIsMissingInput(error) {
433
444
  function withoutInternalCodes(text) {
434
445
  return text.replace(/\s*\((?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+)(?:\s*\/\s*(?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+))*\)/g, "").replace(/\s+([.,;])/g, "$1").trim();
435
446
  }
436
- var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, TIMED_OUT_SAID;
447
+ var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, BUILD_LABEL, LEADING_BUILD_LABEL, TIMED_OUT_SAID;
437
448
  var init_plainWords = __esm({
438
449
  "src/plainWords.ts"() {
439
450
  "use strict";
@@ -520,6 +531,8 @@ var init_plainWords = __esm({
520
531
  // the app, arriving on the screen of somebody who cannot act on it.
521
532
  /\bbind\s+[`'"A-Za-z]/i
522
533
  ];
534
+ BUILD_LABEL = String.raw`(?:Test \d+ \([^)]{1,40}\)|[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+|[A-Z]{1,5}\d+[a-z]?)`;
535
+ LEADING_BUILD_LABEL = new RegExp(String.raw`^${BUILD_LABEL}(?:\s*\/\s*${BUILD_LABEL})*:\s+`);
523
536
  TIMED_OUT_SAID = "That took too long. Nothing was lost; try again.";
524
537
  }
525
538
  });
@@ -540,6 +553,7 @@ function setPersonTimeZone(next) {
540
553
  state.zone = clean;
541
554
  (0, import_table_style.setColorRuleTimeZone)(clean);
542
555
  (0, import_table_style.setDisplayTimeZone)(clean);
556
+ (0, import_records.setReadersTimeZone)(clean);
543
557
  state.listeners.forEach((l) => l());
544
558
  }
545
559
  function getPersonTimeZone() {
@@ -579,11 +593,12 @@ function instantFromPersonWall(wall) {
579
593
  }
580
594
  return new Date(guess);
581
595
  }
582
- var import_table_style, import_global_slot, state;
596
+ var import_table_style, import_records, import_global_slot, state;
583
597
  var init_personZone = __esm({
584
598
  "src/personZone.ts"() {
585
599
  "use strict";
586
600
  import_table_style = require("@ai-matrx/design-system/data-table/table-style");
601
+ import_records = require("@ai-matrx/records");
587
602
  import_global_slot = require("@ai-matrx/kit/global-slot");
588
603
  state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
589
604
  zone: null,
@@ -1575,7 +1590,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
1575
1590
  cancelled = true;
1576
1591
  };
1577
1592
  }, [client, personTable, picked.length, people.length]);
1578
- const listed = (0, import_records4.rankTypedMatches)(members ?? [], search, memberName);
1593
+ const listed = (0, import_records5.rankTypedMatches)(members ?? [], search, memberName);
1579
1594
  if (!membersPort || !client) {
1580
1595
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
1581
1596
  }
@@ -1676,13 +1691,13 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
1676
1691
  )
1677
1692
  ] });
1678
1693
  }
1679
- var import_react16, import_records4, import_react17, import_design_system9, import_jsx_runtime14;
1694
+ var import_react16, import_records5, import_react17, import_design_system9, import_jsx_runtime14;
1680
1695
  var init_PersonPicker = __esm({
1681
1696
  "src/PersonPicker.tsx"() {
1682
1697
  "use strict";
1683
1698
  "use client";
1684
1699
  import_react16 = require("react");
1685
- import_records4 = require("@ai-matrx/records");
1700
+ import_records5 = require("@ai-matrx/records");
1686
1701
  import_react17 = require("@ai-matrx/records/react");
1687
1702
  import_design_system9 = require("@ai-matrx/design-system");
1688
1703
  init_PickOrAdd();
@@ -2065,7 +2080,7 @@ function usePickerTables() {
2065
2080
  };
2066
2081
  }, [client, nonce]);
2067
2082
  const data = (0, import_react36.useMemo)(
2068
- () => (0, import_records11.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
2083
+ () => (0, import_records12.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
2069
2084
  [tables.data, facts]
2070
2085
  );
2071
2086
  return { loading: tables.loading || facts === "reading", data, reload };
@@ -2084,13 +2099,13 @@ function ShowListsToggle({
2084
2099
  ")"
2085
2100
  ] });
2086
2101
  }
2087
- var import_react36, import_records11, import_react37, import_design_system20, import_jsx_runtime26;
2102
+ var import_react36, import_records12, import_react37, import_design_system20, import_jsx_runtime26;
2088
2103
  var init_tablePicking = __esm({
2089
2104
  "src/tablePicking.tsx"() {
2090
2105
  "use strict";
2091
2106
  "use client";
2092
2107
  import_react36 = require("react");
2093
- import_records11 = require("@ai-matrx/records");
2108
+ import_records12 = require("@ai-matrx/records");
2094
2109
  import_react37 = require("@ai-matrx/records/react");
2095
2110
  import_design_system20 = require("@ai-matrx/design-system");
2096
2111
  init_tablePickerEntries();
@@ -3013,7 +3028,7 @@ function choiceOptionsOf(options) {
3013
3028
  const labels = [];
3014
3029
  for (const option of options) {
3015
3030
  const id = option.id;
3016
- const key = (0, import_records16.optionKey)(option);
3031
+ const key = (0, import_records17.optionKey)(option);
3017
3032
  const label = recordName(option.data, null, "");
3018
3033
  if (label) {
3019
3034
  labels.push(label);
@@ -3025,7 +3040,7 @@ function choiceOptionsOf(options) {
3025
3040
  return { byWord, labels };
3026
3041
  }
3027
3042
  function valueFromPastedText(field2, raw, options, relationNames) {
3028
- return (0, import_records16.coerceTypedAnswer)(field2, raw, {
3043
+ return (0, import_records17.coerceTypedAnswer)(field2, raw, {
3029
3044
  label: fieldName(field2),
3030
3045
  ...options ? { options } : {},
3031
3046
  ...relationNames ? { relationNames } : {}
@@ -3218,12 +3233,12 @@ function gridRefusalForPastedCell(field2, value) {
3218
3233
  const judged = valueFromPastedText(field2, value === null ? "" : String(value));
3219
3234
  return "refusal" in judged ? judged.refusal : void 0;
3220
3235
  }
3221
- var import_core6, import_records16, sameWords;
3236
+ var import_core6, import_records17, sameWords;
3222
3237
  var init_pasteValues = __esm({
3223
3238
  "src/pasteValues.ts"() {
3224
3239
  "use strict";
3225
3240
  import_core6 = require("@ai-matrx/records/core");
3226
- import_records16 = require("@ai-matrx/records");
3241
+ import_records17 = require("@ai-matrx/records");
3227
3242
  init_dates();
3228
3243
  init_parity();
3229
3244
  init_names();
@@ -3347,7 +3362,7 @@ function datesOfColumn(rows, header, opts = {}) {
3347
3362
  const raw = String(r[header] ?? "").trim();
3348
3363
  if (raw === "") return;
3349
3364
  filled += 1;
3350
- const got = (0, import_records17.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
3365
+ const got = (0, import_records18.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
3351
3366
  if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
3352
3367
  else unreadable.push({ row: i, raw });
3353
3368
  });
@@ -3380,11 +3395,11 @@ function looksLike(rows, header) {
3380
3395
  if (share(isPhone) >= 0.6) return "phone";
3381
3396
  return null;
3382
3397
  }
3383
- var import_records17, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
3398
+ var import_records18, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
3384
3399
  var init_importKinds = __esm({
3385
3400
  "src/importKinds.ts"() {
3386
3401
  "use strict";
3387
- import_records17 = require("@ai-matrx/records");
3402
+ import_records18 = require("@ai-matrx/records");
3388
3403
  IMPORT_KINDS = [
3389
3404
  { kind: "text", label: "Text" },
3390
3405
  { kind: "date", label: "Date" },
@@ -3406,7 +3421,7 @@ function titleRepeats(rows, header) {
3406
3421
  const seen = /* @__PURE__ */ new Set();
3407
3422
  let filled = 0;
3408
3423
  for (const r of rows) {
3409
- const key = (0, import_records18.relationNameKey)(String(r[header] ?? ""));
3424
+ const key = (0, import_records19.relationNameKey)(String(r[header] ?? ""));
3410
3425
  if (key === "") continue;
3411
3426
  filled += 1;
3412
3427
  seen.add(key);
@@ -3416,7 +3431,7 @@ function titleRepeats(rows, header) {
3416
3431
  function sameRecordLikely(rows, header, notIdentity) {
3417
3432
  const groups = /* @__PURE__ */ new Map();
3418
3433
  for (const r of rows) {
3419
- const key = (0, import_records18.relationNameKey)(String(r[header] ?? ""));
3434
+ const key = (0, import_records19.relationNameKey)(String(r[header] ?? ""));
3420
3435
  if (key === "") continue;
3421
3436
  const held = groups.get(key);
3422
3437
  if (held) held.push(r);
@@ -3449,7 +3464,7 @@ function combineRows(rows, header) {
3449
3464
  const out = [];
3450
3465
  const outLines = [];
3451
3466
  rows.forEach((r, i) => {
3452
- const key = (0, import_records18.relationNameKey)(String(r[header] ?? ""));
3467
+ const key = (0, import_records19.relationNameKey)(String(r[header] ?? ""));
3453
3468
  if (key === "") {
3454
3469
  out.push({ ...r });
3455
3470
  outLines.push([i + 1]);
@@ -3489,11 +3504,11 @@ function combineRows(rows, header) {
3489
3504
  index.sort((a, b) => a.lines[0] - b.lines[0]);
3490
3505
  return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
3491
3506
  }
3492
- var import_records18, LIST_JOIN;
3507
+ var import_records19, LIST_JOIN;
3493
3508
  var init_importCombine = __esm({
3494
3509
  "src/importCombine.ts"() {
3495
3510
  "use strict";
3496
- import_records18 = require("@ai-matrx/records");
3511
+ import_records19 = require("@ai-matrx/records");
3497
3512
  LIST_JOIN = "; ";
3498
3513
  }
3499
3514
  });
@@ -3962,13 +3977,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3962
3977
  async (wanted) => {
3963
3978
  const next = /* @__PURE__ */ new Map();
3964
3979
  for (const { header, field: field2 } of wanted) {
3965
- const names2 = effectiveRows.flatMap((r) => (0, import_records19.relationNamesIn)(field2, String(r[header] ?? "")));
3980
+ const names2 = effectiveRows.flatMap((r) => (0, import_records20.relationNamesIn)(field2, String(r[header] ?? "")));
3966
3981
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
3967
3982
  if (!got.ok) {
3968
3983
  setRelationProblem(got.error);
3969
3984
  return null;
3970
3985
  }
3971
- next.set(field2.key, (0, import_records19.relationNameIndexOf)(got.data));
3986
+ next.set(field2.key, (0, import_records20.relationNameIndexOf)(got.data));
3972
3987
  }
3973
3988
  setRelationProblem(null);
3974
3989
  setRelationIndex(next);
@@ -3992,12 +4007,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3992
4007
  let linked = 0;
3993
4008
  let named = 0;
3994
4009
  effectiveRows.forEach((row, i) => {
3995
- const names2 = (0, import_records19.relationNamesIn)(field2, String(row[header] ?? ""));
4010
+ const names2 = (0, import_records20.relationNamesIn)(field2, String(row[header] ?? ""));
3996
4011
  if (String(row[header] ?? "").trim() === "") return;
3997
4012
  named += 1;
3998
4013
  let ok = true;
3999
4014
  for (const name of names2) {
4000
- const hits = index.byName.get((0, import_records19.relationNameKey)(name)) ?? [];
4015
+ const hits = index.byName.get((0, import_records20.relationNameKey)(name)) ?? [];
4001
4016
  if (hits.length === 1) continue;
4002
4017
  ok = false;
4003
4018
  if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
@@ -4063,11 +4078,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
4063
4078
  const named = index.get(field2.key);
4064
4079
  const text = String(row[header] ?? "").trim();
4065
4080
  if (!named || text === "") continue;
4066
- const parts = field2.multi ? (0, import_records19.splitListCell)(text) : [text];
4081
+ const parts = field2.multi ? (0, import_records20.splitListCell)(text) : [text];
4067
4082
  const ids = [];
4068
4083
  let skip = false;
4069
4084
  for (const part of parts) {
4070
- const hits = (0, import_records19.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records19.relationNameKey)(part)) ?? [];
4085
+ const hits = (0, import_records20.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records20.relationNameKey)(part)) ?? [];
4071
4086
  if (hits === null) ids.push(part);
4072
4087
  else if (hits.length === 1) ids.push(hits[0].id);
4073
4088
  else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
@@ -4107,7 +4122,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
4107
4122
  setPhase("linking");
4108
4123
  for (const ask2 of toMerge) {
4109
4124
  for (const [name] of ask2.ambiguous) {
4110
- const hits = ask2.index.byName.get((0, import_records19.relationNameKey)(name)) ?? [];
4125
+ const hits = ask2.index.byName.get((0, import_records20.relationNameKey)(name)) ?? [];
4111
4126
  const winner = hits[0];
4112
4127
  if (!winner) continue;
4113
4128
  for (const loser of hits.slice(1)) {
@@ -5047,7 +5062,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
5047
5062
  table.error ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RefusalNotice, { error: table.error, onRetry: table.reload }) : null
5048
5063
  ] });
5049
5064
  }
5050
- var import_react57, import_react58, import_core8, import_design_system32, import_records19, import_text_case5, import_jsx_runtime39, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
5065
+ var import_react57, import_react58, import_core8, import_design_system32, import_records20, import_text_case5, import_jsx_runtime39, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
5051
5066
  var init_ImportWizard = __esm({
5052
5067
  "src/ImportWizard.tsx"() {
5053
5068
  "use strict";
@@ -5056,7 +5071,7 @@ var init_ImportWizard = __esm({
5056
5071
  import_react58 = require("@ai-matrx/records/react");
5057
5072
  import_core8 = require("@ai-matrx/records/core");
5058
5073
  import_design_system32 = require("@ai-matrx/design-system");
5059
- import_records19 = require("@ai-matrx/records");
5074
+ import_records20 = require("@ai-matrx/records");
5060
5075
  init_Refusal();
5061
5076
  init_refusals();
5062
5077
  init_importRuleCheck();
@@ -6211,7 +6226,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
6211
6226
  if (!rights.structure) {
6212
6227
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: (0, import_design_system36.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs Full access on this table, because it lets people with no account take time in your calendar." });
6213
6228
  }
6214
- const url = formId ? `${publicOrigin}${(0, import_records20.bookingPath)(formId)}` : null;
6229
+ const url = formId ? `${publicOrigin}${(0, import_records21.bookingPath)(formId)}` : null;
6215
6230
  const shown5 = offer ?? null;
6216
6231
  return (
6217
6232
  // THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
@@ -6610,7 +6625,7 @@ function asksWhoTheyAre(askable) {
6610
6625
  return kind2 === "email" || kind2 === "phone";
6611
6626
  });
6612
6627
  }
6613
- var import_clipboard, import_design_system35, import_react62, import_react63, import_format3, import_records20, import_design_system36, import_controls7, import_jsx_runtime42, STORE_ANSWERS_THESE, DAYS, LENGTHS, WORKING_WEEK;
6628
+ var import_clipboard, import_design_system35, import_react62, import_react63, import_format3, import_records21, import_design_system36, import_controls7, import_jsx_runtime42, STORE_ANSWERS_THESE, DAYS, LENGTHS, WORKING_WEEK;
6614
6629
  var init_BookingBuilder = __esm({
6615
6630
  "src/BookingBuilder.tsx"() {
6616
6631
  "use strict";
@@ -6620,7 +6635,7 @@ var init_BookingBuilder = __esm({
6620
6635
  import_react62 = require("react");
6621
6636
  import_react63 = require("@ai-matrx/records/react");
6622
6637
  import_format3 = require("@ai-matrx/kit/format");
6623
- import_records20 = require("@ai-matrx/records");
6638
+ import_records21 = require("@ai-matrx/records");
6624
6639
  import_design_system36 = require("@ai-matrx/design-system");
6625
6640
  import_controls7 = require("@ai-matrx/design-system/controls");
6626
6641
  init_bookingMessages();
@@ -7135,9 +7150,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
7135
7150
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
7136
7151
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "truncate text-sm", children: thing.title }),
7137
7152
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
7138
- import_records21.BUILT_KIND_WORD[thing.kind],
7153
+ import_records22.BUILT_KIND_WORD[thing.kind],
7139
7154
  " \xB7 archived ",
7140
- (0, import_records21.archivedWhen)(thing.archivedAt)
7155
+ (0, import_records22.archivedWhen)(thing.archivedAt)
7141
7156
  ] }),
7142
7157
  refusal3 && refusal3.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
7143
7158
  ] }),
@@ -7158,13 +7173,13 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
7158
7173
  )) })
7159
7174
  ] });
7160
7175
  }
7161
- var import_react64, import_records21, import_react65, import_design_system39, import_jsx_runtime46, ARCHIVE_NEEDS_ADMIN;
7176
+ var import_react64, import_records22, import_react65, import_design_system39, import_jsx_runtime46, ARCHIVE_NEEDS_ADMIN;
7162
7177
  var init_BuiltOnArchive = __esm({
7163
7178
  "src/BuiltOnArchive.tsx"() {
7164
7179
  "use strict";
7165
7180
  "use client";
7166
7181
  import_react64 = require("react");
7167
- import_records21 = require("@ai-matrx/records");
7182
+ import_records22 = require("@ai-matrx/records");
7168
7183
  import_react65 = require("@ai-matrx/records/react");
7169
7184
  import_design_system39 = require("@ai-matrx/design-system");
7170
7185
  init_ObjectActionMenuItems();
@@ -7298,7 +7313,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
7298
7313
  " Open the table the appointments should land in to make one."
7299
7314
  ] }) : null,
7300
7315
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
7301
- const url = `${origin}${(0, import_records22.bookingPath)(page.form_id)}`;
7316
+ const url = `${origin}${(0, import_records23.bookingPath)(page.form_id)}`;
7302
7317
  const mayOpen = levels.data?.[page.table_id] === "admin";
7303
7318
  const open = page.published_at !== null && page.closed_at === null;
7304
7319
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
@@ -7415,7 +7430,7 @@ function nextInWords(page) {
7415
7430
  }
7416
7431
  return `Next: ${said2} (${page.timezone}).`;
7417
7432
  }
7418
- var import_clipboard2, import_react66, import_react67, import_records22, import_design_system40, import_jsx_runtime47, BOOKING_NOT_HERE_LINE, WHAT_A_BOOKING_PAGE_IS, NO_ADMIN, STATE_WORDS;
7433
+ var import_clipboard2, import_react66, import_react67, import_records23, import_design_system40, import_jsx_runtime47, BOOKING_NOT_HERE_LINE, WHAT_A_BOOKING_PAGE_IS, NO_ADMIN, STATE_WORDS;
7419
7434
  var init_BookingSlots = __esm({
7420
7435
  "src/BookingSlots.tsx"() {
7421
7436
  "use strict";
@@ -7423,7 +7438,7 @@ var init_BookingSlots = __esm({
7423
7438
  import_clipboard2 = require("@ai-matrx/kit/clipboard");
7424
7439
  import_react66 = require("react");
7425
7440
  import_react67 = require("@ai-matrx/records/react");
7426
- import_records22 = require("@ai-matrx/records");
7441
+ import_records23 = require("@ai-matrx/records");
7427
7442
  import_design_system40 = require("@ai-matrx/design-system");
7428
7443
  init_BookingBuilder();
7429
7444
  init_BuildOrAsk();
@@ -7565,7 +7580,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
7565
7580
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
7566
7581
  "?"
7567
7582
  ] }),
7568
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-muted-foreground", children: (0, import_records23.moveConsequence)(answer.home, choosing) }),
7583
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-muted-foreground", children: (0, import_records24.moveConsequence)(answer.home, choosing) }),
7569
7584
  said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
7570
7585
  import_design_system41.ErrorBox,
7571
7586
  {
@@ -7643,13 +7658,13 @@ function SharedNameAddress({
7643
7658
  const address = sharedNameAddress(to, all);
7644
7659
  return address ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ml-1.5 font-normal text-muted-foreground", "data-where-it-lives-address": "", children: address }) : null;
7645
7660
  }
7646
- var import_react68, import_records23, import_react69, import_design_system41, import_jsx_runtime48;
7661
+ var import_react68, import_records24, import_react69, import_design_system41, import_jsx_runtime48;
7647
7662
  var init_WhereItLives = __esm({
7648
7663
  "src/WhereItLives.tsx"() {
7649
7664
  "use strict";
7650
7665
  "use client";
7651
7666
  import_react68 = require("react");
7652
- import_records23 = require("@ai-matrx/records");
7667
+ import_records24 = require("@ai-matrx/records");
7653
7668
  import_react69 = require("@ai-matrx/records/react");
7654
7669
  init_host();
7655
7670
  init_Refusal();
@@ -7715,7 +7730,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
7715
7730
  alive = false;
7716
7731
  };
7717
7732
  }, [client]);
7718
- const listed = facts.phase === "read" ? (0, import_records24.withTablePlacement)(
7733
+ const listed = facts.phase === "read" ? (0, import_records25.withTablePlacement)(
7719
7734
  (0, import_core9.withTableFacts)(tables.data ?? [], facts.rows, me),
7720
7735
  facts.rows
7721
7736
  ) : tables.data ?? [];
@@ -7872,7 +7887,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
7872
7887
  }) : null
7873
7888
  ] });
7874
7889
  }
7875
- var import_react70, import_react71, import_core9, import_records24, import_design_system42, import_jsx_runtime49, TABLE_LANES, LANE_TITLE, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
7890
+ var import_react70, import_react71, import_core9, import_records25, import_design_system42, import_jsx_runtime49, TABLE_LANES, LANE_TITLE, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
7876
7891
  var init_TablesHome = __esm({
7877
7892
  "src/TablesHome.tsx"() {
7878
7893
  "use strict";
@@ -7880,7 +7895,7 @@ var init_TablesHome = __esm({
7880
7895
  import_react70 = require("react");
7881
7896
  import_react71 = require("@ai-matrx/records/react");
7882
7897
  import_core9 = require("@ai-matrx/records/core");
7883
- import_records24 = require("@ai-matrx/records");
7898
+ import_records25 = require("@ai-matrx/records");
7884
7899
  import_design_system42 = require("@ai-matrx/design-system");
7885
7900
  init_NewTableStart();
7886
7901
  init_Refusal();
@@ -9320,7 +9335,7 @@ function buildTableSettingsAgent(tableId, live, client, slots2) {
9320
9335
  var import_react107 = require("react");
9321
9336
  var import_react108 = require("@ai-matrx/records/react");
9322
9337
  var import_design_system65 = require("@ai-matrx/design-system");
9323
- var import_records39 = require("@ai-matrx/records");
9338
+ var import_records40 = require("@ai-matrx/records");
9324
9339
 
9325
9340
  // src/gridMenus.ts
9326
9341
  init_names();
@@ -9329,7 +9344,7 @@ init_names();
9329
9344
  var REVERSE_COLUMN_PREFIX = "linked:";
9330
9345
 
9331
9346
  // src/gridPage.ts
9332
- var import_records = require("@ai-matrx/records");
9347
+ var import_records2 = require("@ai-matrx/records");
9333
9348
  var import_data_table = require("@ai-matrx/design-system/data-table");
9334
9349
 
9335
9350
  // src/personTime.ts
@@ -9378,7 +9393,7 @@ function markWithheld(fields, keys) {
9378
9393
  return fields.map((f) => keys.has(f.key) ? { ...f, withheld: true } : f);
9379
9394
  }
9380
9395
  function skipWhenWithheld(filter) {
9381
- if (!filter || !(0, import_records.isRuleFilter)(filter)) return filter;
9396
+ if (!filter || !(0, import_records2.isRuleFilter)(filter)) return filter;
9382
9397
  return { op: "and", args: [filter], skip_withheld: true };
9383
9398
  }
9384
9399
  var NUMBER_LOOKS = /* @__PURE__ */ new Set(["number", "decimal", "currency", "percent", "progress", "integer", "duration", "file_size"]);
@@ -9487,7 +9502,7 @@ function storeQuestion(fields, base2, columnFilters, now = /* @__PURE__ */ new D
9487
9502
  const refused = [];
9488
9503
  const flat = {};
9489
9504
  const rules = [];
9490
- if (base2 && (0, import_records.isRuleFilter)(base2)) rules.push(base2);
9505
+ if (base2 && (0, import_records2.isRuleFilter)(base2)) rules.push(base2);
9491
9506
  else if (base2) Object.assign(flat, base2);
9492
9507
  for (const [key, value] of Object.entries(columnFilters)) {
9493
9508
  if (!value) continue;
@@ -9539,8 +9554,8 @@ __reExport(askOnce_exports, require("@ai-matrx/records/versions"));
9539
9554
  // src/labels.tsx
9540
9555
  var import_react12 = require("react");
9541
9556
  var import_react13 = require("@ai-matrx/records/react");
9542
- var import_records2 = require("@ai-matrx/records");
9543
9557
  var import_records3 = require("@ai-matrx/records");
9558
+ var import_records4 = require("@ai-matrx/records");
9544
9559
  init_names();
9545
9560
  var import_uuid2 = require("@ai-matrx/kit/uuid");
9546
9561
  init_docs();
@@ -11213,17 +11228,17 @@ function isId(value) {
11213
11228
  return typeof value === "string" && (0, import_uuid2.isUuidShape)(value);
11214
11229
  }
11215
11230
  function copiesAsWords(field2) {
11216
- return pointsAtRecords(field2) || isSignatureField(field2) || (0, import_records2.autonumberPrefixOf)(field2) !== "" || isDateField(field2);
11231
+ return pointsAtRecords(field2) || isSignatureField(field2) || (0, import_records3.autonumberPrefixOf)(field2) !== "" || isDateField(field2);
11217
11232
  }
11218
11233
  function pointsAtRecords(field2) {
11219
11234
  return field2.type === "list" || field2.type === "relation";
11220
11235
  }
11221
11236
  function shownValue(field2, value, labels) {
11222
11237
  if (isSignatureField(field2)) return signatureWords(value);
11223
- if ((0, import_records2.autonumberPrefixOf)(field2)) return (0, import_records2.autonumberWords)(field2, value) ?? value;
11238
+ if ((0, import_records3.autonumberPrefixOf)(field2)) return (0, import_records3.autonumberWords)(field2, value) ?? value;
11224
11239
  const dateWords2 = isDateField(field2) ? dateText(field2, value) : null;
11225
11240
  if (dateWords2 !== null) return dateWords2;
11226
- const newerWords = value === null || value === void 0 ? null : (0, import_records3.newerKindExportWords)(field2, value);
11241
+ const newerWords = value === null || value === void 0 ? null : (0, import_records4.newerKindExportWords)(field2, value);
11227
11242
  if (newerWords !== null) return newerWords;
11228
11243
  const look = value === null || value === void 0 ? void 0 : registeredLook(shownAsOf(field2));
11229
11244
  if (look) {
@@ -11293,7 +11308,7 @@ function RecordLabelProvider({ children }) {
11293
11308
  for (const option of result.data ?? []) {
11294
11309
  const words2 = recordName(option.data, null, "Unnamed choice");
11295
11310
  next[option.id] = words2;
11296
- const key = (0, import_records3.optionKey)(option);
11311
+ const key = (0, import_records4.optionKey)(option);
11297
11312
  if (key) next[choiceKeyName(field2.id, key)] = words2;
11298
11313
  }
11299
11314
  return next;
@@ -11837,7 +11852,7 @@ init_parity();
11837
11852
 
11838
11853
  // src/FieldRetype.tsx
11839
11854
  var import_react20 = require("react");
11840
- var import_records5 = require("@ai-matrx/records");
11855
+ var import_records6 = require("@ai-matrx/records");
11841
11856
  var import_react21 = require("@ai-matrx/records/react");
11842
11857
  var import_design_system10 = require("@ai-matrx/design-system");
11843
11858
  init_parity();
@@ -12053,7 +12068,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
12053
12068
  return;
12054
12069
  }
12055
12070
  const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
12056
- setPreview((0, import_records5.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
12071
+ setPreview((0, import_records6.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
12057
12072
  }).catch((e) => {
12058
12073
  if (cancelled) return;
12059
12074
  setAsking(false);
@@ -12617,7 +12632,7 @@ function nextFieldSort(fields) {
12617
12632
  // src/FormulaTextEditor.tsx
12618
12633
  var import_react22 = require("react");
12619
12634
  var import_react23 = require("@ai-matrx/records/react");
12620
- var import_records6 = require("@ai-matrx/records");
12635
+ var import_records7 = require("@ai-matrx/records");
12621
12636
  var import_design_system11 = require("@ai-matrx/design-system");
12622
12637
  init_host();
12623
12638
  init_Refusal();
@@ -12641,7 +12656,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
12641
12656
  function formulaFunctionNames(kinds) {
12642
12657
  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();
12643
12658
  }
12644
- var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records6.RULE_NODE_KINDS);
12659
+ var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records7.RULE_NODE_KINDS);
12645
12660
  var RESULT_WORD = {
12646
12661
  number: "a number",
12647
12662
  text: "text",
@@ -12800,7 +12815,7 @@ function FormulaTextEditor({
12800
12815
 
12801
12816
  // src/gridRowLabel.tsx
12802
12817
  var import_react25 = require("react");
12803
- var import_records7 = require("@ai-matrx/records");
12818
+ var import_records8 = require("@ai-matrx/records");
12804
12819
  var import_react26 = require("@ai-matrx/records/react");
12805
12820
  var import_design_system13 = require("@ai-matrx/design-system");
12806
12821
  init_names();
@@ -12858,7 +12873,7 @@ function RowLabelPicker({
12858
12873
  const columns = labelColumns(fields);
12859
12874
  const mayChange = kept2?.can_change !== false;
12860
12875
  const keptFormula = kept2?.formula ?? null;
12861
- const formulaTooLong = formula.trim().length > import_records7.ROW_LABEL_FORMULA_MAX_LENGTH;
12876
+ const formulaTooLong = formula.trim().length > import_records8.ROW_LABEL_FORMULA_MAX_LENGTH;
12862
12877
  const formulaUnchanged = formula.trim() === (keptFormula ?? "").trim() && kept2?.valid !== false;
12863
12878
  const saveColumn = async () => {
12864
12879
  setBusy(true);
@@ -12955,7 +12970,7 @@ function RowLabelPicker({
12955
12970
  ) : null,
12956
12971
  formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-[11px] text-foreground", children: [
12957
12972
  "Up to ",
12958
- import_records7.ROW_LABEL_FORMULA_MAX_LENGTH,
12973
+ import_records8.ROW_LABEL_FORMULA_MAX_LENGTH,
12959
12974
  " characters"
12960
12975
  ] }) : null
12961
12976
  ] }),
@@ -12979,7 +12994,7 @@ function RowLabelPicker({
12979
12994
  type: "button",
12980
12995
  size: "sm",
12981
12996
  "data-records-row-label-save-formula": "",
12982
- disabled: busy || !mayChange || (0, import_records7.clearsRowLabel)(formula) || formulaTooLong || formulaOk === false || formulaUnchanged,
12997
+ disabled: busy || !mayChange || (0, import_records8.clearsRowLabel)(formula) || formulaTooLong || formulaOk === false || formulaUnchanged,
12983
12998
  onClick: () => void saveFormula(),
12984
12999
  children: busy ? "Saving\u2026" : "Use this formula"
12985
13000
  }
@@ -12994,7 +13009,7 @@ init_PickOne();
12994
13009
 
12995
13010
  // src/RecordTypes.tsx
12996
13011
  var import_react105 = require("react");
12997
- var import_records38 = require("@ai-matrx/records");
13012
+ var import_records39 = require("@ai-matrx/records");
12998
13013
  var import_react106 = require("@ai-matrx/records/react");
12999
13014
  var import_design_system64 = require("@ai-matrx/design-system");
13000
13015
  init_PickOne();
@@ -13002,7 +13017,7 @@ init_PickOne();
13002
13017
  // src/RecordForm.tsx
13003
13018
  var import_react103 = require("react");
13004
13019
  var import_react104 = require("@ai-matrx/records/react");
13005
- var import_records37 = require("@ai-matrx/records");
13020
+ var import_records38 = require("@ai-matrx/records");
13006
13021
  var import_core13 = require("@ai-matrx/records/core");
13007
13022
  init_writeOnTheWinningVersion();
13008
13023
  var import_design_system63 = require("@ai-matrx/design-system");
@@ -13014,7 +13029,7 @@ var import_design_system15 = require("@ai-matrx/design-system");
13014
13029
 
13015
13030
  // src/ChoiceListEditor.tsx
13016
13031
  var import_react27 = require("react");
13017
- var import_records8 = require("@ai-matrx/records");
13032
+ var import_records9 = require("@ai-matrx/records");
13018
13033
  var import_react28 = require("@ai-matrx/records/react");
13019
13034
  var import_design_system14 = require("@ai-matrx/design-system");
13020
13035
  var import_data_table2 = require("@ai-matrx/design-system/data-table");
@@ -13025,7 +13040,7 @@ var rowSeed = 0;
13025
13040
  var nextRow = () => `new-${rowSeed += 1}`;
13026
13041
  function choiceRowsFrom(options, field2) {
13027
13042
  return inTheStoresOrder([...options]).map((option) => {
13028
- const words2 = (0, import_records8.optionLabel)(option);
13043
+ const words2 = (0, import_records9.optionLabel)(option);
13029
13044
  const key = option.data?.key;
13030
13045
  const color = field2 ? storedChoiceColor(field2, words2) ?? storedChoiceColor(field2, key) : void 0;
13031
13046
  return { id: option.id, words: words2, row: option.id, color: color ?? null };
@@ -13195,11 +13210,11 @@ function ChoiceListEditor({
13195
13210
  "div",
13196
13211
  {
13197
13212
  role: "group",
13198
- "aria-label": (0, import_records8.recordsUseSentence)(heldBy(asking), asking.words.trim()),
13213
+ "aria-label": (0, import_records9.recordsUseSentence)(heldBy(asking), asking.words.trim()),
13199
13214
  "data-records-choice-removal-ask": "",
13200
13215
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
13201
13216
  children: [
13202
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs", children: (0, import_records8.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
13217
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs", children: (0, import_records9.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
13203
13218
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13204
13219
  targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13205
13220
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
@@ -13218,7 +13233,7 @@ function ChoiceListEditor({
13218
13233
  ) : null,
13219
13234
  Object.entries(rehome).map(
13220
13235
  ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
13221
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: (0, import_records8.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
13236
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: (0, import_records9.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
13222
13237
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
13223
13238
  ] }, id) : null
13224
13239
  ),
@@ -13315,7 +13330,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
13315
13330
 
13316
13331
  // src/editors.tsx
13317
13332
  var import_react95 = require("react");
13318
- var import_records35 = require("@ai-matrx/records");
13333
+ var import_records36 = require("@ai-matrx/records");
13319
13334
  var import_react96 = require("@ai-matrx/records/react");
13320
13335
  var import_design_system59 = require("@ai-matrx/design-system");
13321
13336
  init_dates();
@@ -13323,22 +13338,22 @@ init_dates();
13323
13338
  // src/newerKindValues.tsx
13324
13339
  var import_react31 = require("react");
13325
13340
  var import_source = require("@ai-matrx/content-ir/source");
13326
- var import_records9 = require("@ai-matrx/records");
13341
+ var import_records10 = require("@ai-matrx/records");
13327
13342
  var import_design_system16 = require("@ai-matrx/design-system");
13328
13343
  var import_outbound_react = require("@ai-matrx/kit/outbound-react");
13329
13344
  var import_jsx_runtime21 = require("react/jsx-runtime");
13330
13345
  var own = (event) => event.stopPropagation();
13331
13346
  function newerKindValue(field2, value, opts = {}) {
13332
- switch ((0, import_records9.newerKindOf)(field2)) {
13347
+ switch ((0, import_records10.newerKindOf)(field2)) {
13333
13348
  case "duration": {
13334
- const words2 = (0, import_records9.durationText)(value);
13349
+ const words2 = (0, import_records10.durationText)(value);
13335
13350
  return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
13336
13351
  }
13337
13352
  case "created_by":
13338
13353
  case "modified_by":
13339
- return (0, import_records9.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PersonStampChip, { stamp: value }) : void 0;
13354
+ return (0, import_records10.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PersonStampChip, { stamp: value }) : void 0;
13340
13355
  case "address":
13341
- return (0, import_records9.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddressLink, { value }) : void 0;
13356
+ return (0, import_records10.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddressLink, { value }) : void 0;
13342
13357
  case "barcode":
13343
13358
  return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
13344
13359
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
@@ -13353,7 +13368,7 @@ function newerKindValue(field2, value, opts = {}) {
13353
13368
  }
13354
13369
  }
13355
13370
  function PersonStampChip({ stamp }) {
13356
- const words2 = (0, import_records9.personStampText)(stamp) ?? import_records9.NOT_A_MEMBER_WORDS;
13371
+ const words2 = (0, import_records10.personStampText)(stamp) ?? import_records10.NOT_A_MEMBER_WORDS;
13357
13372
  const tier = stamp.actor ?? "user";
13358
13373
  const name = tier === "user" ? stamp.name : null;
13359
13374
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
@@ -13370,8 +13385,8 @@ function PersonStampChip({ stamp }) {
13370
13385
  ] });
13371
13386
  }
13372
13387
  function AddressLink({ value }) {
13373
- const words2 = (0, import_records9.addressValueText)(value);
13374
- const href = (0, import_records9.addressMapUrl)(value);
13388
+ const words2 = (0, import_records10.addressValueText)(value);
13389
+ const href = (0, import_records10.addressMapUrl)(value);
13375
13390
  if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
13376
13391
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13377
13392
  import_outbound_react.OutboundLink,
@@ -13390,11 +13405,11 @@ function AddressLink({ value }) {
13390
13405
  }
13391
13406
  var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
13392
13407
  function statusMarkOf(field2, value, document2) {
13393
- if ((0, import_records9.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
13408
+ if ((0, import_records10.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
13394
13409
  const chosen = document2?.["_choices"]?.[field2.key];
13395
13410
  const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
13396
- const group = (0, import_records9.statusGroupOf)(field2, key);
13397
- return { mark: STATUS_GROUP_MARK[group], group, words: import_records9.STATUS_GROUP_WORDS[group] };
13411
+ const group = (0, import_records10.statusGroupOf)(field2, key);
13412
+ return { mark: STATUS_GROUP_MARK[group], group, words: import_records10.STATUS_GROUP_WORDS[group] };
13398
13413
  }
13399
13414
  function inline(text, key) {
13400
13415
  const out = [];
@@ -13422,7 +13437,7 @@ function marks(text, key) {
13422
13437
  if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { children: tok.slice(2, -2) }, k));
13423
13438
  else if (tok.startsWith("[")) {
13424
13439
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
13425
- const href = (0, import_records9.safeLinkHref)(link?.[2] ?? "");
13440
+ const href = (0, import_records10.safeLinkHref)(link?.[2] ?? "");
13426
13441
  out.push(
13427
13442
  href ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
13428
13443
  );
@@ -13487,7 +13502,7 @@ function SafeMarkdown({ text, clipped }) {
13487
13502
  );
13488
13503
  }
13489
13504
  function newerKindControl(props) {
13490
- switch ((0, import_records9.newerKindOf)(props.field)) {
13505
+ switch ((0, import_records10.newerKindOf)(props.field)) {
13491
13506
  case "duration":
13492
13507
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DurationControl, { ...props });
13493
13508
  case "address":
@@ -13503,10 +13518,10 @@ function newerKindControl(props) {
13503
13518
  }
13504
13519
  }
13505
13520
  function DurationControl({ value, onChange, disabled, id }) {
13506
- const [text, setText] = (0, import_react31.useState)(() => (0, import_records9.durationText)(value) ?? "");
13521
+ const [text, setText] = (0, import_react31.useState)(() => (0, import_records10.durationText)(value) ?? "");
13507
13522
  const [wrong, setWrong] = (0, import_react31.useState)(false);
13508
13523
  (0, import_react31.useEffect)(() => {
13509
- setText((0, import_records9.durationText)(value) ?? "");
13524
+ setText((0, import_records10.durationText)(value) ?? "");
13510
13525
  }, [value]);
13511
13526
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex flex-col gap-1", children: [
13512
13527
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -13526,12 +13541,12 @@ function DurationControl({ value, onChange, disabled, id }) {
13526
13541
  onChange(null);
13527
13542
  return;
13528
13543
  }
13529
- const seconds = (0, import_records9.readTypedDuration)(e.target.value);
13544
+ const seconds = (0, import_records10.readTypedDuration)(e.target.value);
13530
13545
  setWrong(seconds === null);
13531
13546
  if (seconds !== null) onChange(seconds);
13532
13547
  },
13533
13548
  onBlur: () => {
13534
- if (!wrong) setText((0, import_records9.durationText)(value) ?? "");
13549
+ if (!wrong) setText((0, import_records10.durationText)(value) ?? "");
13535
13550
  }
13536
13551
  }
13537
13552
  ),
@@ -13553,13 +13568,13 @@ var ADDRESS_EXAMPLES = {
13553
13568
  country: "US"
13554
13569
  };
13555
13570
  function AddressControl({ value, onChange, disabled, id }) {
13556
- const held = (0, import_records9.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
13571
+ const held = (0, import_records10.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
13557
13572
  const set = (part, words2) => {
13558
13573
  const next = { ...held, [part]: words2 };
13559
13574
  const kept2 = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
13560
13575
  onChange(Object.keys(kept2).length === 0 ? null : kept2);
13561
13576
  };
13562
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records9.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13577
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records10.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13563
13578
  import_design_system16.BasicInput,
13564
13579
  {
13565
13580
  "aria-label": ADDRESS_LABELS[part],
@@ -13640,7 +13655,7 @@ init_names();
13640
13655
 
13641
13656
  // src/RelationPicker.tsx
13642
13657
  var import_react32 = require("react");
13643
- var import_records10 = require("@ai-matrx/records");
13658
+ var import_records11 = require("@ai-matrx/records");
13644
13659
  var import_react33 = require("@ai-matrx/records/react");
13645
13660
  var import_design_system17 = require("@ai-matrx/design-system");
13646
13661
  init_PickOrAdd();
@@ -13911,7 +13926,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
13911
13926
  toggle(createdId);
13912
13927
  };
13913
13928
  const apart = tellApart(rows ?? [], titleOf);
13914
- const visible = (0, import_records10.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
13929
+ const visible = (0, import_records11.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
13915
13930
  const anchored = autoOpen === true;
13916
13931
  const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13917
13932
  RecordChip,
@@ -14045,7 +14060,7 @@ function readableLink(raw) {
14045
14060
  var import_react90 = require("react");
14046
14061
  var import_design_system56 = require("@ai-matrx/design-system");
14047
14062
  var import_data_table7 = require("@ai-matrx/design-system/data-table");
14048
- var import_records33 = require("@ai-matrx/records");
14063
+ var import_records34 = require("@ai-matrx/records");
14049
14064
  var import_react91 = require("@ai-matrx/records/react");
14050
14065
  init_host();
14051
14066
 
@@ -14748,7 +14763,7 @@ init_enumLabels();
14748
14763
 
14749
14764
  // src/EntityReferenceControl.tsx
14750
14765
  var import_react43 = require("react");
14751
- var import_records12 = require("@ai-matrx/records");
14766
+ var import_records13 = require("@ai-matrx/records");
14752
14767
  var import_react44 = require("@ai-matrx/records/react");
14753
14768
  var import_design_system23 = require("@ai-matrx/design-system");
14754
14769
  init_PickOrAdd();
@@ -14758,7 +14773,7 @@ var import_jsx_runtime29 = require("react/jsx-runtime");
14758
14773
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
14759
14774
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
14760
14775
  function entityReferenceText(value) {
14761
- const refs = (0, import_records12.entityRefsOf)(value);
14776
+ const refs = (0, import_records13.entityRefsOf)(value);
14762
14777
  if (refs.length === 0) return "\u2014";
14763
14778
  return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
14764
14779
  }
@@ -14772,7 +14787,7 @@ function EntityReferenceControl(props) {
14772
14787
  return client ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Chips, { ...props, words: null, picker: null });
14773
14788
  }
14774
14789
  function WithWords(props) {
14775
- const refs = (0, import_react43.useMemo)(() => (0, import_records12.entityRefsOf)(props.value), [props.value]);
14790
+ const refs = (0, import_react43.useMemo)(() => (0, import_records13.entityRefsOf)(props.value), [props.value]);
14776
14791
  const [known, setKnown] = (0, import_react43.useState)([]);
14777
14792
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
14778
14793
  const unlabelled = (0, import_react43.useMemo)(
@@ -14792,14 +14807,14 @@ function WithWords(props) {
14792
14807
  initialSearch: props.initialSearch,
14793
14808
  onTakeOff: (ref) => {
14794
14809
  const rest = withKnown.filter((x) => !(x.token === ref.token && x.id === ref.id));
14795
- props.onChange((0, import_records12.entityRefsToWrite)(rest, Boolean(props.field.multi)));
14810
+ props.onChange((0, import_records13.entityRefsToWrite)(rest, Boolean(props.field.multi)));
14796
14811
  },
14797
14812
  labelOf: (r) => r.label ?? words2?.data?.find((w) => w.token === r.token && w.id === r.id)?.label ?? WITHHELD_ENTITY_LABEL,
14798
14813
  onPick: (picked) => {
14799
14814
  setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
14800
14815
  const multi = Boolean(props.field.multi);
14801
14816
  const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
14802
- props.onChange((0, import_records12.entityRefsToWrite)(next, multi));
14817
+ props.onChange((0, import_records13.entityRefsToWrite)(next, multi));
14803
14818
  }
14804
14819
  }
14805
14820
  );
@@ -14910,7 +14925,7 @@ function Chips({
14910
14925
  words: words2,
14911
14926
  picker
14912
14927
  }) {
14913
- const refs = (0, import_react43.useMemo)(() => (0, import_records12.entityRefsOf)(value), [value]);
14928
+ const refs = (0, import_react43.useMemo)(() => (0, import_records13.entityRefsOf)(value), [value]);
14914
14929
  const labelOf = (token2, refId, own3) => {
14915
14930
  if (own3) return own3;
14916
14931
  const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
@@ -14934,7 +14949,7 @@ function Chips({
14934
14949
  "aria-label": `Take ${label} off`,
14935
14950
  onClick: () => {
14936
14951
  const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
14937
- onChange((0, import_records12.entityRefsToWrite)(rest, multi));
14952
+ onChange((0, import_records13.entityRefsToWrite)(rest, multi));
14938
14953
  },
14939
14954
  children: "\xD7"
14940
14955
  }
@@ -15617,7 +15632,7 @@ function AttachmentControl({
15617
15632
  }
15618
15633
 
15619
15634
  // src/ReferenceChips.tsx
15620
- var import_records13 = require("@ai-matrx/records");
15635
+ var import_records14 = require("@ai-matrx/records");
15621
15636
  var import_design_system29 = require("@ai-matrx/design-system");
15622
15637
  init_host();
15623
15638
  init_kindValues();
@@ -15638,7 +15653,7 @@ function iconOf(pair) {
15638
15653
  }
15639
15654
  function referenceChipsOf(field2, value, kind2, labels) {
15640
15655
  if (kind2 === "entity_reference") {
15641
- return (0, import_records13.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
15656
+ return (0, import_records14.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
15642
15657
  }
15643
15658
  const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
15644
15659
  const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
@@ -15826,7 +15841,7 @@ function ClampedChips({
15826
15841
  init_kindValues();
15827
15842
 
15828
15843
  // src/formulaNames.ts
15829
- var import_records14 = require("@ai-matrx/records");
15844
+ var import_records15 = require("@ai-matrx/records");
15830
15845
  init_names();
15831
15846
  function fieldRefsOf(expr) {
15832
15847
  const out = [];
@@ -15935,7 +15950,7 @@ function formulaSourceArchived(field2, document2) {
15935
15950
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
15936
15951
  if (!Array.isArray(keys) || !document2) return null;
15937
15952
  for (const key of keys) {
15938
- const state2 = (0, import_records14.sourceArchivedOf)(document2[String(key)]);
15953
+ const state2 = (0, import_records15.sourceArchivedOf)(document2[String(key)]);
15939
15954
  if (state2) return state2;
15940
15955
  }
15941
15956
  return null;
@@ -15956,7 +15971,7 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
15956
15971
  }
15957
15972
 
15958
15973
  // src/values.tsx
15959
- var import_records25 = require("@ai-matrx/records");
15974
+ var import_records26 = require("@ai-matrx/records");
15960
15975
  var import_uuid7 = require("@ai-matrx/kit/uuid");
15961
15976
  init_userIds();
15962
15977
 
@@ -16016,7 +16031,7 @@ function usePeopleTick() {
16016
16031
  }
16017
16032
 
16018
16033
  // src/cellMarks.tsx
16019
- var import_records15 = require("@ai-matrx/records");
16034
+ var import_records16 = require("@ai-matrx/records");
16020
16035
 
16021
16036
  // src/RetiredValues.tsx
16022
16037
  var import_react53 = require("react");
@@ -16147,7 +16162,7 @@ function bound(value) {
16147
16162
  function keptAsideReason(field2, entry) {
16148
16163
  const rules = field2.rules ?? [];
16149
16164
  const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
16150
- const rule = (0, import_records15.ruleThatRefuses)(rules, numeric);
16165
+ const rule = (0, import_records16.ruleThatRefuses)(rules, numeric);
16151
16166
  let why = null;
16152
16167
  if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
16153
16168
  else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
@@ -16621,7 +16636,7 @@ function structuredNode(field2, structured, room) {
16621
16636
  return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StructuredValueView, { structured, label });
16622
16637
  }
16623
16638
  function renderValue(field2, value, document2, labels, stillWaitingFor, look, room = "cell") {
16624
- const archivedSource = (0, import_records25.sourceArchivedOf)(value);
16639
+ const archivedSource = (0, import_records26.sourceArchivedOf)(value);
16625
16640
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SourceArchivedValue, { state: archivedSource });
16626
16641
  const envelope = envelopeFor(document2, field2.key);
16627
16642
  if (envelope?.absent) {
@@ -16644,7 +16659,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
16644
16659
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
16645
16660
  }
16646
16661
  if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SignatureValue, { value, fieldKey: field2.key, document: document2 });
16647
- if ((0, import_records25.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ButtonValue, { field: field2 });
16662
+ if ((0, import_records26.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ButtonValue, { field: field2 });
16648
16663
  const newer = newerKindValue(field2, value);
16649
16664
  if (newer !== void 0) return newer;
16650
16665
  const whole = typeof value === "string" ? (0, import_core10.wholeValueOf)(document2, field2.key) : null;
@@ -16782,10 +16797,10 @@ function personWordsOf(kind2, value) {
16782
16797
  }
16783
16798
  function scalarText(field2, value, labels, stillWaitingFor) {
16784
16799
  if (value === null || value === void 0) return "\u2014";
16785
- if ((0, import_records25.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
16800
+ if ((0, import_records26.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
16786
16801
  if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
16787
- if ((0, import_records25.autonumberPrefixOf)(field2)) return (0, import_records25.autonumberWords)(field2, value) ?? String(value);
16788
- const newerWords = (0, import_records25.newerKindWords)(field2, value);
16802
+ if ((0, import_records26.autonumberPrefixOf)(field2)) return (0, import_records26.autonumberWords)(field2, value) ?? String(value);
16803
+ const newerWords = (0, import_records26.newerKindWords)(field2, value);
16789
16804
  if (newerWords !== null) return newerWords;
16790
16805
  const kind2 = editorKindFor(field2);
16791
16806
  if (kind2 === "entity_reference") return entityReferenceText(value);
@@ -16846,7 +16861,7 @@ function RecordValue({
16846
16861
  const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field2));
16847
16862
  const stillWaitingFor = useLabelWait(field2);
16848
16863
  const embeddedLook = useEmbeddedLook();
16849
- if ((0, import_records25.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ButtonValue, { field: field2, recordId, inCell });
16864
+ if ((0, import_records26.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ButtonValue, { field: field2, recordId, inCell });
16850
16865
  if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(WithheldValue, { field: field2, notice: withheld });
16851
16866
  if (value === null || value === void 0) {
16852
16867
  const failed = workedOutErrorFor(document2, field2.key);
@@ -16856,7 +16871,7 @@ function RecordValue({
16856
16871
  const kept2 = keptAsideFor(document2, field2.key);
16857
16872
  if (kept2) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KeptAsideValue, { field: field2, entry: kept2, shown: scalarText(field2, kept2.value) });
16858
16873
  }
16859
- const archivedSource = (0, import_records25.sourceArchivedOf)(value);
16874
+ const archivedSource = (0, import_records26.sourceArchivedOf)(value);
16860
16875
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SourceArchivedValue, { state: archivedSource });
16861
16876
  if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
16862
16877
  if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
@@ -16973,7 +16988,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
16973
16988
  // src/Condition.tsx
16974
16989
  var import_react78 = require("react");
16975
16990
  var import_design_system47 = require("@ai-matrx/design-system");
16976
- var import_records26 = require("@ai-matrx/records");
16991
+ var import_records27 = require("@ai-matrx/records");
16977
16992
  init_PickOrAdd();
16978
16993
  init_choiceLooks();
16979
16994
  var import_react79 = require("@ai-matrx/records/react");
@@ -17089,7 +17104,7 @@ function ChoiceValues({ field: field2, value, onChange }) {
17089
17104
  let cancelled = false;
17090
17105
  void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((got) => {
17091
17106
  if (cancelled) return;
17092
- setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records26.optionKey)(o), label: (0, import_records26.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []);
17107
+ setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records27.optionKey)(o), label: (0, import_records27.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []);
17093
17108
  });
17094
17109
  return () => {
17095
17110
  cancelled = true;
@@ -17145,7 +17160,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
17145
17160
  void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((got) => {
17146
17161
  if (cancelled) return;
17147
17162
  setChoices(
17148
- got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records26.optionKey)(o), label: (0, import_records26.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
17163
+ got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records27.optionKey)(o), label: (0, import_records27.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
17149
17164
  );
17150
17165
  });
17151
17166
  return () => {
@@ -17163,7 +17178,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
17163
17178
  }
17164
17179
  );
17165
17180
  }
17166
- const shown5 = (0, import_records26.rankTypedMatches)(choices, search.trim(), (c) => c.label);
17181
+ const shown5 = (0, import_records27.rankTypedMatches)(choices, search.trim(), (c) => c.label);
17167
17182
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
17168
17183
  PickOrAdd,
17169
17184
  {
@@ -17675,7 +17690,7 @@ function ConditionGroup({
17675
17690
 
17676
17691
  // src/FieldRulePreview.tsx
17677
17692
  var import_react80 = require("react");
17678
- var import_records27 = require("@ai-matrx/records");
17693
+ var import_records28 = require("@ai-matrx/records");
17679
17694
  var import_react81 = require("@ai-matrx/records/react");
17680
17695
  init_Refusal();
17681
17696
  init_names();
@@ -17725,7 +17740,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
17725
17740
  }
17726
17741
  const numbers = holdsNumbers3(field2);
17727
17742
  const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
17728
- setPreview((0, import_records27.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS));
17743
+ setPreview((0, import_records28.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS));
17729
17744
  }).catch((thrown) => {
17730
17745
  if (cancelled) return;
17731
17746
  setRefusal((0, refusals_exports.refusalFromThrown)(thrown, `${name}'s values could not be counted.`, "The check still applies when you save."));
@@ -17910,7 +17925,7 @@ function PickListLink({
17910
17925
  }
17911
17926
 
17912
17927
  // src/NewerKindQuestions.tsx
17913
- var import_records28 = require("@ai-matrx/records");
17928
+ var import_records29 = require("@ai-matrx/records");
17914
17929
  var import_design_system49 = require("@ai-matrx/design-system");
17915
17930
  var import_jsx_runtime57 = require("react/jsx-runtime");
17916
17931
  var STATUS_STARTING_CHOICES = [
@@ -17931,7 +17946,7 @@ function statusGroupRows(field2, rows, keyOfId, changed2) {
17931
17946
  if (words2 === "") continue;
17932
17947
  const ref = r.id ?? words2;
17933
17948
  const key = r.id ? keyOfId[r.id] : void 0;
17934
- const held = field2 && key ? (0, import_records28.statusGroupOf)(field2, key) : void 0;
17949
+ const held = field2 && key ? (0, import_records29.statusGroupOf)(field2, key) : void 0;
17935
17950
  out.push({ ref, words: words2, group: changed2[ref] ?? held ?? guessStatusGroup(words2) });
17936
17951
  }
17937
17952
  return out;
@@ -17947,10 +17962,10 @@ function StatusGroupsQuestion({
17947
17962
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
17948
17963
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_design_system49.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
17949
17964
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectValue, {}) }),
17950
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectContent, { children: import_records28.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_design_system49.SelectItem, { value: g, children: [
17965
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectContent, { children: import_records29.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_design_system49.SelectItem, { value: g, children: [
17951
17966
  STATUS_GROUP_MARK[g],
17952
17967
  " ",
17953
- import_records28.STATUS_GROUP_WORDS[g]
17968
+ import_records29.STATUS_GROUP_WORDS[g]
17954
17969
  ] }, g)) })
17955
17970
  ] })
17956
17971
  ] }, r.ref))
@@ -17988,7 +18003,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
17988
18003
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectValue, {}) }),
17989
18004
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_design_system49.SelectContent, { children: [
17990
18005
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectItem, { value: "any", children: "Any code" }),
17991
- import_records28.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
18006
+ import_records29.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system49.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
17992
18007
  ] })
17993
18008
  ] })
17994
18009
  ] });
@@ -18360,21 +18375,21 @@ function readersSentence(count, tableName2) {
18360
18375
 
18361
18376
  // src/FieldEditor.tsx
18362
18377
  init_enumLabels();
18363
- var import_records31 = require("@ai-matrx/records");
18378
+ var import_records32 = require("@ai-matrx/records");
18364
18379
 
18365
18380
  // src/ButtonSettings.tsx
18366
18381
  var import_react86 = require("react");
18367
18382
  var import_design_system54 = require("@ai-matrx/design-system");
18368
18383
  var import_data_table6 = require("@ai-matrx/design-system/data-table");
18369
- var import_records30 = require("@ai-matrx/records");
18384
+ var import_records31 = require("@ai-matrx/records");
18370
18385
  var import_react87 = require("@ai-matrx/records/react");
18371
18386
 
18372
18387
  // src/AccentSwatches.tsx
18373
- var import_records29 = require("@ai-matrx/records");
18388
+ var import_records30 = require("@ai-matrx/records");
18374
18389
  var import_design_system52 = require("@ai-matrx/design-system");
18375
18390
  var import_data_table5 = require("@ai-matrx/design-system/data-table");
18376
18391
  var import_jsx_runtime60 = require("react/jsx-runtime");
18377
- function AccentSwatches({ value, onChange, options = import_records29.PORTAL_ACCENTS, noneLabel = "App color" }) {
18392
+ function AccentSwatches({ value, onChange, options = import_records30.PORTAL_ACCENTS, noneLabel = "App color" }) {
18378
18393
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
18379
18394
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
18380
18395
  "button",
@@ -18498,7 +18513,7 @@ var DOES_WORDS = {
18498
18513
  };
18499
18514
  function buttonUrlInWords(url, fields) {
18500
18515
  let out = url;
18501
- for (const id of (0, import_records30.buttonUrlPlaceholders)(url)) {
18516
+ for (const id of (0, import_records31.buttonUrlPlaceholders)(url)) {
18502
18517
  const f = fields.find((x) => x.id === id || x.key === id);
18503
18518
  if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
18504
18519
  }
@@ -18593,7 +18608,7 @@ function ButtonSettingsEditor({
18593
18608
  }
18594
18609
  ) : null
18595
18610
  ] }),
18596
- value.url && (0, import_records30.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
18611
+ value.url && (0, import_records31.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
18597
18612
  ] }) : null,
18598
18613
  value.do === "add_row" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(AddRowSettings, { value, onChange, tableId, fields }) : null,
18599
18614
  value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
@@ -18700,7 +18715,7 @@ function NewRowAction({
18700
18715
  }
18701
18716
 
18702
18717
  // src/FieldEditor.tsx
18703
- var import_records32 = require("@ai-matrx/records");
18718
+ var import_records33 = require("@ai-matrx/records");
18704
18719
 
18705
18720
  // src/standardFieldChoices.ts
18706
18721
  var import_field_kinds7 = require("@ai-matrx/records/field-kinds");
@@ -18722,8 +18737,8 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
18722
18737
  // src/FieldEditor.tsx
18723
18738
  var import_jsx_runtime63 = require("react/jsx-runtime");
18724
18739
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind2) => ({ kind: kind2, label: FIELD_RULE_KIND_LABEL[kind2] }));
18725
- var SENSITIVITIES = import_records32.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
18726
- var AGENT_VISIBILITY = import_records32.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
18740
+ var SENSITIVITIES = import_records33.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
18741
+ var AGENT_VISIBILITY = import_records33.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
18727
18742
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
18728
18743
  value,
18729
18744
  label: ROLLUP_AGG_LABEL[value]
@@ -18811,7 +18826,7 @@ function FieldEditor(props) {
18811
18826
  const onEntity = entityToken !== null;
18812
18827
  const tableId = props.tableId ?? "";
18813
18828
  const table = (0, import_react89.useTable)(onEntity ? null : tableId);
18814
- const tableFields = (0, import_react89.useFields)(onEntity ? null : tableId, import_records32.EVERY_RECORD_TYPE);
18829
+ const tableFields = (0, import_react89.useFields)(onEntity ? null : tableId, import_records33.EVERY_RECORD_TYPE);
18815
18830
  const entityFields = (0, import_react89.useEntityFields)(entityToken);
18816
18831
  const fields = onEntity ? entityFields : tableFields;
18817
18832
  const tableRights2 = useTableRights(onEntity ? null : table.data);
@@ -18832,27 +18847,27 @@ function FieldEditor(props) {
18832
18847
  const [label, setLabel] = (0, import_react88.useState)(field2?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
18833
18848
  const [type, setType] = (0, import_react88.useState)(() => startAs ? startAs.type : startingType(start));
18834
18849
  const [required, setRequired] = (0, import_react88.useState)(start?.required ?? false);
18835
- const [appliesTo, setAppliesTo] = (0, import_react88.useState)(() => (0, import_records32.typesOfField)(start ?? { applies_to_types: [] }));
18850
+ const [appliesTo, setAppliesTo] = (0, import_react88.useState)(() => (0, import_records33.typesOfField)(start ?? { applies_to_types: [] }));
18836
18851
  const [multi, setMulti] = (0, import_react88.useState)(start?.multi ?? false);
18837
18852
  const [dated, setDated] = (0, import_react88.useState)(start?.dated ?? false);
18838
18853
  const [sensitivity, setSensitivity] = (0, import_react88.useState)(String(start?.sensitivity ?? "internal"));
18839
18854
  const [contextPolicy, setContextPolicy] = (0, import_react88.useState)(String(start?.context_policy ?? "include"));
18840
18855
  const [rules, setRules] = (0, import_react88.useState)(start?.rules ?? []);
18841
18856
  const [startsWith, setStartsWith] = (0, import_react88.useState)(start?.default ?? null);
18842
- const [ratingMax, setRatingMax] = (0, import_react88.useState)(() => start ? (0, import_records32.ratingMaxOf)(start) : 5);
18857
+ const [ratingMax, setRatingMax] = (0, import_react88.useState)(() => start ? (0, import_records33.ratingMaxOf)(start) : 5);
18843
18858
  const savedRules = (0, import_react88.useMemo)(
18844
- () => field2 ? type === "rating" ? (0, import_records32.rulesWithTopStar)(field2.rules ?? [], (0, import_records32.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
18859
+ () => field2 ? type === "rating" ? (0, import_records33.rulesWithTopStar)(field2.rules ?? [], (0, import_records33.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
18845
18860
  [field2, type]
18846
18861
  );
18847
- const editedRules = (0, import_react88.useMemo)(() => type === "rating" ? (0, import_records32.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
18862
+ const editedRules = (0, import_react88.useMemo)(() => type === "rating" ? (0, import_records33.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
18848
18863
  const [statusGroups, setStatusGroups] = (0, import_react88.useState)({});
18849
18864
  const [statusKeys, setStatusKeys] = (0, import_react88.useState)({});
18850
18865
  const [symbology, setSymbology] = (0, import_react88.useState)(String(start?.config?.["symbology"] ?? ""));
18851
18866
  const descriptionStart = String(start?.config?.["description"] ?? "");
18852
18867
  const [description, setDescription] = (0, import_react88.useState)(descriptionStart);
18853
- const buttonStart = (0, import_react88.useMemo)(() => (0, import_records31.buttonOf)(start) ?? { label: "" }, [start]);
18868
+ const buttonStart = (0, import_react88.useMemo)(() => (0, import_records32.buttonOf)(start) ?? { label: "" }, [start]);
18854
18869
  const [buttonSettings, setButtonSettings] = (0, import_react88.useState)(buttonStart);
18855
- const prefixStart = (0, import_records31.autonumberPrefixOf)(start);
18870
+ const prefixStart = (0, import_records32.autonumberPrefixOf)(start);
18856
18871
  const [numberPrefix, setNumberPrefix] = (0, import_react88.useState)(prefixStart);
18857
18872
  const dependencyStart = start?.config?.["dependency"] === true;
18858
18873
  const watchStart = (0, import_react88.useMemo)(() => watchedFieldsOf(start), [start]);
@@ -18862,6 +18877,8 @@ function FieldEditor(props) {
18862
18877
  const [limitView, setLimitView] = (0, import_react88.useState)(limitViewStart);
18863
18878
  const bindingStart = start?.config?.["binding"] === "snapshot" ? "snapshot" : "live";
18864
18879
  const [binding, setBinding] = (0, import_react88.useState)(bindingStart);
18880
+ const onDeleteStart = start?.on_target_delete === "cascade" || start?.on_target_delete === "restrict" ? start.on_target_delete : "set_null";
18881
+ const [onDelete, setOnDelete] = (0, import_react88.useState)(onDeleteStart);
18865
18882
  const carriesStart = start?.config?.["carries"] === true;
18866
18883
  const [carries, setCarries] = (0, import_react88.useState)(carriesStart);
18867
18884
  const carriesMaxStart = start?.config?.["carries_max"] === "editor" ? "editor" : "viewer";
@@ -18909,7 +18926,7 @@ function FieldEditor(props) {
18909
18926
  if (!field2 || type !== "status") return;
18910
18927
  let live = true;
18911
18928
  void client.fieldOptions({ field_id: field2.id }).then((got) => {
18912
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records32.optionKey)(o)])));
18929
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records33.optionKey)(o)])));
18913
18930
  });
18914
18931
  return () => {
18915
18932
  live = false;
@@ -19021,7 +19038,7 @@ function FieldEditor(props) {
19021
19038
  const typeKey = onEntity ? null : table.data?.type_field ?? null;
19022
19039
  const typeField = typeKey ? (fields.data ?? []).find((f) => f.key === typeKey) ?? null : null;
19023
19040
  const offersAppliesTo = Boolean(typeField) && !isTitle && field2?.key !== typeKey;
19024
- const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0, import_records32.typesOfField)(field2 ?? { applies_to_types: [] }));
19041
+ const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0, import_records33.typesOfField)(field2 ?? { applies_to_types: [] }));
19025
19042
  const offersMany = multiApplies(type) && !isTitle;
19026
19043
  if (!mayShape) {
19027
19044
  if (onEntity && entityRights.loading) return null;
@@ -19037,7 +19054,7 @@ function FieldEditor(props) {
19037
19054
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
19038
19055
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
19039
19056
  const listsChoices = type === "select" || type === "multi_select" || type === "status";
19040
- const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records31.buttonNeeds)(buttonSettings) : null;
19057
+ const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records32.buttonNeeds)(buttonSettings) : null;
19041
19058
  const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
19042
19059
  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 }
19043
19060
  )));
@@ -19080,12 +19097,13 @@ function FieldEditor(props) {
19080
19097
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
19081
19098
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
19082
19099
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
19083
- ...type === "rating" && ratingMax !== (0, import_records32.ratingMaxOf)(field2) ? { max: ratingMax } : {},
19100
+ ...type === "rating" && ratingMax !== (0, import_records33.ratingMaxOf)(field2) ? { max: ratingMax } : {},
19084
19101
  ...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
19085
19102
  ...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
19086
19103
  ...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
19087
19104
  ...field2.type === "relation" && limitView !== limitViewStart ? { limit_to_view: limitView === "" ? null : limitView } : {},
19088
19105
  ...field2.type === "relation" && binding !== bindingStart ? { binding } : {},
19106
+ ...field2.type === "relation" && onDelete !== onDeleteStart ? { on_target_delete: onDelete } : {},
19089
19107
  ...field2.type === "relation" && carries !== carriesStart ? { carries } : {},
19090
19108
  ...field2.type === "relation" && carries && carriesMax !== carriesMaxStart ? { carries_max: carriesMax } : {},
19091
19109
  ...field2.type === "relation" && loops !== loopsStart ? { loops } : {},
@@ -19455,6 +19473,24 @@ function FieldEditor(props) {
19455
19473
  ] })
19456
19474
  ] })
19457
19475
  ] }) : null,
19476
+ editing && field2?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-on-archive": "", children: [
19477
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.Label, { className: "text-xs", children: "When a linked record is archived" }),
19478
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
19479
+ import_design_system55.Select,
19480
+ {
19481
+ value: onDelete,
19482
+ onValueChange: (next) => setOnDelete(next === "cascade" || next === "restrict" ? next : "set_null"),
19483
+ children: [
19484
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.SelectTrigger, { size: "sm", "aria-label": "When a linked record is archived", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.SelectValue, {}) }),
19485
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_design_system55.SelectContent, { children: [
19486
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.SelectItem, { value: "set_null", children: "Keep the link, shown as archived" }),
19487
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.SelectItem, { value: "cascade", children: "Archive this record too" }),
19488
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.SelectItem, { value: "restrict", children: "Refuse while it is linked" })
19489
+ ] })
19490
+ ]
19491
+ }
19492
+ )
19493
+ ] }) : null,
19458
19494
  editing && field2?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
19459
19495
  /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
19460
19496
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system55.Checkbox, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
@@ -20237,7 +20273,7 @@ function waitingRunsOf(pressed) {
20237
20273
  var stop2 = (event) => event.stopPropagation();
20238
20274
  function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
20239
20275
  const client = (0, import_react91.useOptionalRecordsClient)();
20240
- const b = (0, import_records33.buttonOf)(field2);
20276
+ const b = (0, import_records34.buttonOf)(field2);
20241
20277
  const [busy, setBusy] = (0, import_react90.useState)(false);
20242
20278
  const [said2, setSaid] = (0, import_react90.useState)(null);
20243
20279
  const [settingUp, setSettingUp] = (0, import_react90.useState)(false);
@@ -20255,7 +20291,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
20255
20291
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { id: `${field2.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
20256
20292
  ] });
20257
20293
  }
20258
- const needs = (0, import_records33.buttonNeeds)(b);
20294
+ const needs = (0, import_records34.buttonNeeds)(b);
20259
20295
  const tableId = field2.entity_definition_id;
20260
20296
  const press = async () => {
20261
20297
  if (!client || !recordId) return setSaid({ kind: "public" });
@@ -20603,7 +20639,7 @@ function formatControl(args) {
20603
20639
  // src/typedDateHelper.tsx
20604
20640
  var import_react94 = require("react");
20605
20641
  var import_design_system58 = require("@ai-matrx/design-system");
20606
- var import_records34 = require("@ai-matrx/records");
20642
+ var import_records35 = require("@ai-matrx/records");
20607
20643
  var import_jsx_runtime67 = require("react/jsx-runtime");
20608
20644
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
20609
20645
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -20612,24 +20648,24 @@ function pad2(n) {
20612
20648
  }
20613
20649
  function readBox(text, kind2) {
20614
20650
  if (kind2 === "time") {
20615
- const t = (0, import_records34.readTypedTime)(text);
20651
+ const t = (0, import_records35.readTypedTime)(text);
20616
20652
  if (!t.ok) return { day: null, time: null };
20617
20653
  const [h, m] = t.value.split(":").map(Number);
20618
20654
  return { day: null, time: { h, m } };
20619
20655
  }
20620
- const read = (0, import_records34.readTypedDate)(text, { withTime: kind2 === "datetime" });
20656
+ const read = (0, import_records35.readTypedDate)(text, { withTime: kind2 === "datetime" });
20621
20657
  if (!read.ok) return { day: null, time: null };
20622
20658
  if (kind2 === "datetime" && read.instant) {
20623
- const wall = (0, import_records34.wallPartsInZone)(new Date(read.instant));
20659
+ const wall = (0, import_records35.wallPartsInZone)(new Date(read.instant));
20624
20660
  return { day: read.day, time: { h: wall.hour, m: wall.minute } };
20625
20661
  }
20626
20662
  return { day: read.day, time: null };
20627
20663
  }
20628
20664
  function wordsFor2(kind2, day2, time) {
20629
- if (kind2 === "time") return time ? (0, import_records34.typedTimeText)(time.h, time.m) : "";
20665
+ if (kind2 === "time") return time ? (0, import_records35.typedTimeText)(time.h, time.m) : "";
20630
20666
  if (!day2) return "";
20631
- const dayText = (0, import_records34.typedDateText)(day2);
20632
- return kind2 === "datetime" && time ? `${dayText} ${(0, import_records34.typedTimeText)(time.h, time.m)}` : dayText;
20667
+ const dayText = (0, import_records35.typedDateText)(day2);
20668
+ return kind2 === "datetime" && time ? `${dayText} ${(0, import_records35.typedTimeText)(time.h, time.m)}` : dayText;
20633
20669
  }
20634
20670
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
20635
20671
  function CalendarGlyph() {
@@ -20751,7 +20787,7 @@ function TypedDateHelper({
20751
20787
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
20752
20788
  ),
20753
20789
  onClick: () => pickTime(t),
20754
- children: (0, import_records34.typedTimeText)(t.h, t.m)
20790
+ children: (0, import_records35.typedTimeText)(t.h, t.m)
20755
20791
  },
20756
20792
  `${t.h}:${t.m}`
20757
20793
  )) })
@@ -20808,7 +20844,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
20808
20844
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
20809
20845
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
20810
20846
  field2.required ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
20811
- field2.unit && (0, import_records35.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
20847
+ field2.unit && (0, import_records36.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
20812
20848
  children
20813
20849
  ] });
20814
20850
  }
@@ -20818,7 +20854,7 @@ function isTypedDraft(value) {
20818
20854
  var TYPED_AS_WORDS = /* @__PURE__ */ new Set(["text", "long_text", "phone"]);
20819
20855
  var TYPED_AND_READ = /* @__PURE__ */ new Set(["number", "currency", "percent", "datetime", "select", "multi_select", "email", "url"]);
20820
20856
  function typingOpens(field2) {
20821
- if ((0, import_records35.isButtonField)(field2)) return "none";
20857
+ if ((0, import_records36.isButtonField)(field2)) return "none";
20822
20858
  const kind2 = String(editorKindFor(field2));
20823
20859
  if (kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup") return "none";
20824
20860
  if (kind2 === "select" || kind2 === "multi_select" || kind2 === "member") return "search";
@@ -20844,21 +20880,21 @@ function judgeTyped(field2, text, choices, nudge) {
20844
20880
  const format = formatForField(field2);
20845
20881
  if (trimmed === "") return { value: null };
20846
20882
  if (format && format.id === "time") {
20847
- const read2 = (0, import_records35.readTypedTime)(trimmed);
20883
+ const read2 = (0, import_records36.readTypedTime)(trimmed);
20848
20884
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
20849
20885
  }
20850
20886
  if (kind2 === "select" || kind2 === "multi_select") {
20851
20887
  if (!choices || nudge === null) return null;
20852
20888
  const several = field2.multi || kind2 === "multi_select";
20853
20889
  const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
20854
- const allowOther = (0, import_records35.allowsOtherValues)(field2);
20890
+ const allowOther = (0, import_records36.allowsOtherValues)(field2);
20855
20891
  const parts = [];
20856
20892
  const add = [];
20857
20893
  const ask2 = [];
20858
20894
  const notChoices = [];
20859
20895
  let keepOffered = allowOther;
20860
20896
  for (const word of words2) {
20861
- const decided = (0, import_records35.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
20897
+ const decided = (0, import_records36.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
20862
20898
  if (decided.decision === "empty") continue;
20863
20899
  if (decided.decision === "chosen") parts.push(decided.key);
20864
20900
  else {
@@ -20891,7 +20927,7 @@ function judgeTyped(field2, text, choices, nudge) {
20891
20927
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
20892
20928
  }
20893
20929
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
20894
- const read = (0, import_records35.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
20930
+ const read = (0, import_records36.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
20895
20931
  if ("refusal" in read) {
20896
20932
  if (kind2 === "email" || kind2 === "url") return { refusal: SHORT_REFUSAL[kind2] };
20897
20933
  const short = kind2 === "datetime" ? SHORT_REFUSAL.date : kind2 === "number" || kind2 === "currency" || kind2 === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
@@ -20912,12 +20948,12 @@ function openingText(field2, value) {
20912
20948
  if (value === null || value === void 0 || value === "") return "";
20913
20949
  const helper = dateHelperKind(field2, value);
20914
20950
  if (helper === "time") {
20915
- const read = (0, import_records35.readTypedTime)(String(value));
20951
+ const read = (0, import_records36.readTypedTime)(String(value));
20916
20952
  if (!read.ok) return String(value);
20917
20953
  const [h, m] = read.value.split(":").map(Number);
20918
- return (0, import_records35.typedTimeText)(h, m);
20954
+ return (0, import_records36.typedTimeText)(h, m);
20919
20955
  }
20920
- if (helper) return (0, import_records35.typedDateText)(value, { withTime: helper === "datetime" });
20956
+ if (helper) return (0, import_records36.typedDateText)(value, { withTime: helper === "datetime" });
20921
20957
  const format = formatForField(field2);
20922
20958
  return format ? typedText(format, value) : String(value);
20923
20959
  }
@@ -21021,7 +21057,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
21021
21057
  " ",
21022
21058
  needsChoices ? String(
21023
21059
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
21024
- const option = choices?.find((o) => (0, import_records35.optionKey)(o) === k);
21060
+ const option = choices?.find((o) => (0, import_records36.optionKey)(o) === k);
21025
21061
  return option ? recordName(option.data, null, String(k)) : String(k);
21026
21062
  }).join(", ")
21027
21063
  ) : (() => {
@@ -21042,7 +21078,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
21042
21078
  const ownDetails = (0, import_react96.useOptionalRecordsClient)() === null;
21043
21079
  if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
21044
21080
  if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
21045
- if ((0, import_records35.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ButtonValue, { field: field2, recordId: recordId ?? null, beforeSave: !recordId });
21081
+ if ((0, import_records36.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ButtonValue, { field: field2, recordId: recordId ?? null, beforeSave: !recordId });
21046
21082
  const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
21047
21083
  if (newerControl !== void 0) return newerControl;
21048
21084
  const format = formatForField(field2);
@@ -21212,7 +21248,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
21212
21248
  function typedDatePlaceholder(helper) {
21213
21249
  const time = "h:mm AM";
21214
21250
  if (helper === "time") return time;
21215
- const pattern = (0, import_records35.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
21251
+ const pattern = (0, import_records36.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
21216
21252
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
21217
21253
  }
21218
21254
  function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
@@ -21382,15 +21418,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
21382
21418
  ChoiceAnswer,
21383
21419
  {
21384
21420
  field: field2,
21385
- choices: options.map((option) => ({ key: (0, import_records35.optionKey)(option), label: titled(option) })),
21421
+ choices: options.map((option) => ({ key: (0, import_records36.optionKey)(option), label: titled(option) })),
21386
21422
  value,
21387
21423
  onChange,
21388
21424
  disabled,
21389
21425
  id,
21390
21426
  onChosen,
21391
21427
  isChosen: (choice, v) => {
21392
- const option = options.find((o) => (0, import_records35.optionKey)(o) === choice.key);
21393
- return option ? (0, import_records35.isTheChosen)(option, v) : false;
21428
+ const option = options.find((o) => (0, import_records36.optionKey)(o) === choice.key);
21429
+ return option ? (0, import_records36.isTheChosen)(option, v) : false;
21394
21430
  }
21395
21431
  }
21396
21432
  );
@@ -21423,7 +21459,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
21423
21459
  onCancel,
21424
21460
  initialSearch,
21425
21461
  addsChoices,
21426
- allowOther: (0, import_records35.allowsOtherValues)(field2),
21462
+ allowOther: (0, import_records36.allowsOtherValues)(field2),
21427
21463
  onChoicesChanged: () => {
21428
21464
  if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field2.id}`);
21429
21465
  setReread((n) => n + 1);
@@ -21437,19 +21473,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
21437
21473
  }
21438
21474
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
21439
21475
  if (field2.multi) {
21440
- const chosen = options.filter((option) => (0, import_records35.choiceValuesOf)(value).some((v) => (0, import_records35.isTheChosen)(option, v)));
21441
- const picked = new Set(chosen.map((option) => (0, import_records35.optionKey)(option)));
21476
+ const chosen = options.filter((option) => (0, import_records36.choiceValuesOf)(value).some((v) => (0, import_records36.isTheChosen)(option, v)));
21477
+ const picked = new Set(chosen.map((option) => (0, import_records36.optionKey)(option)));
21442
21478
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
21443
21479
  import_design_system59.Button,
21444
21480
  {
21445
21481
  type: "button",
21446
21482
  size: "sm",
21447
- variant: picked.has((0, import_records35.optionKey)(option)) ? "default" : "outline",
21483
+ variant: picked.has((0, import_records36.optionKey)(option)) ? "default" : "outline",
21448
21484
  disabled,
21449
21485
  onClick: () => {
21450
21486
  const next = new Set(picked);
21451
- if (next.has((0, import_records35.optionKey)(option))) next.delete((0, import_records35.optionKey)(option));
21452
- else next.add((0, import_records35.optionKey)(option));
21487
+ if (next.has((0, import_records36.optionKey)(option))) next.delete((0, import_records36.optionKey)(option));
21488
+ else next.add((0, import_records36.optionKey)(option));
21453
21489
  onChange(next.size === 0 ? null : [...next]);
21454
21490
  },
21455
21491
  children: titleOf(option)
@@ -21471,11 +21507,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
21471
21507
  }
21472
21508
  );
21473
21509
  }
21474
- const current = options.find((option) => (0, import_records35.isTheChosen)(option, value));
21510
+ const current = options.find((option) => (0, import_records36.isTheChosen)(option, value));
21475
21511
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
21476
21512
  import_design_system59.Select,
21477
21513
  {
21478
- value: current ? (0, import_records35.optionKey)(current) : "",
21514
+ value: current ? (0, import_records36.optionKey)(current) : "",
21479
21515
  disabled: disabled ?? false,
21480
21516
  onValueChange: (next) => onChange(next === "" ? null : next),
21481
21517
  ...autoOpen ? {
@@ -21487,7 +21523,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
21487
21523
  } : {},
21488
21524
  children: [
21489
21525
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectValue, { placeholder: "Choose" }) }),
21490
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectItem, { value: (0, import_records35.optionKey)(option), children: titleOf(option) }, option.id)) })
21526
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.SelectItem, { value: (0, import_records36.optionKey)(option), children: titleOf(option) }, option.id)) })
21491
21527
  ]
21492
21528
  }
21493
21529
  );
@@ -21521,23 +21557,23 @@ function OpenChoicePicker({
21521
21557
  const [addRefused, setAddRefused] = (0, import_react95.useState)(null);
21522
21558
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
21523
21559
  const held = withoutAddition(value);
21524
- const current = (0, import_records35.choiceValuesOf)(held.value);
21560
+ const current = (0, import_records36.choiceValuesOf)(held.value);
21525
21561
  const pickedWords = current.map((v) => {
21526
- const option = options.find((o) => (0, import_records35.isTheChosen)(o, v));
21562
+ const option = options.find((o) => (0, import_records36.isTheChosen)(o, v));
21527
21563
  return option ? titleOf(option) : String(v);
21528
21564
  });
21529
- const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records35.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
21565
+ const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records36.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
21530
21566
  const q = search.trim();
21531
- const visible = (0, import_records35.rankTypedMatches)(options, q, titleOf);
21532
- const decided = (0, import_records35.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
21567
+ const visible = (0, import_records36.rankTypedMatches)(options, q, titleOf);
21568
+ const decided = (0, import_records36.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
21533
21569
  const choose = (word, addingIt = false) => {
21534
21570
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
21535
21571
  let next;
21536
21572
  let add2 = [...pending];
21537
21573
  if (field2.multi) {
21538
21574
  const existing = current.map((v) => {
21539
- const option = options.find((o) => (0, import_records35.isTheChosen)(o, v));
21540
- return option ? (0, import_records35.optionKey)(option) : String(v);
21575
+ const option = options.find((o) => (0, import_records36.isTheChosen)(o, v));
21576
+ return option ? (0, import_records36.optionKey)(option) : String(v);
21541
21577
  });
21542
21578
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
21543
21579
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -21573,7 +21609,7 @@ function OpenChoicePicker({
21573
21609
  const foot = null;
21574
21610
  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;
21575
21611
  const listed = visible;
21576
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records35.isTheChosen)(o, v)));
21612
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records36.isTheChosen)(o, v)));
21577
21613
  const cellChips = pickedWords.map((word, i) => {
21578
21614
  const chip = chipOf(pickedOptions[i], word);
21579
21615
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system59.Badge, { variant: "outline", className: (0, import_design_system59.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -21585,7 +21621,7 @@ function OpenChoicePicker({
21585
21621
  label: word,
21586
21622
  chip: chipOf(option, word).className,
21587
21623
  onRemove: () => {
21588
- if (field2.multi) choose(option ? (0, import_records35.optionKey)(option) : String(current[i]));
21624
+ if (field2.multi) choose(option ? (0, import_records36.optionKey)(option) : String(current[i]));
21589
21625
  else onChange(null);
21590
21626
  }
21591
21627
  };
@@ -21616,11 +21652,11 @@ function OpenChoicePicker({
21616
21652
  id: option.id,
21617
21653
  label: titleOf(option),
21618
21654
  chip: chipOf(option, titleOf(option)).className,
21619
- picked: current.some((v) => (0, import_records35.isTheChosen)(option, v))
21655
+ picked: current.some((v) => (0, import_records36.isTheChosen)(option, v))
21620
21656
  })),
21621
21657
  onPick: (optionId) => {
21622
21658
  const option = options.find((o) => o.id === optionId);
21623
- if (option) choose((0, import_records35.optionKey)(option));
21659
+ if (option) choose((0, import_records36.optionKey)(option));
21624
21660
  },
21625
21661
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
21626
21662
  add,
@@ -21676,7 +21712,7 @@ function ChoiceAnswer({
21676
21712
  onChosen
21677
21713
  }) {
21678
21714
  const [search, setSearch] = (0, import_react95.useState)("");
21679
- const held = field2.multi ? (0, import_records35.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
21715
+ const held = field2.multi ? (0, import_records36.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
21680
21716
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
21681
21717
  const press = (choice) => {
21682
21718
  if (!field2.multi) {
@@ -21797,7 +21833,7 @@ init_Refusal();
21797
21833
 
21798
21834
  // src/gridColors.tsx
21799
21835
  var import_react97 = require("react");
21800
- var import_records36 = require("@ai-matrx/records");
21836
+ var import_records37 = require("@ai-matrx/records");
21801
21837
  var import_react98 = require("@ai-matrx/records/react");
21802
21838
  var import_design_system60 = require("@ai-matrx/design-system");
21803
21839
  var import_data_table8 = require("@ai-matrx/design-system/data-table");
@@ -21879,7 +21915,7 @@ function useChoiceOptions(fields, keys) {
21879
21915
  function lookOf(option) {
21880
21916
  const raw = option.data?.["color"];
21881
21917
  const color = typeof raw === "string" && import_data_table8.STYLE_COLORS.includes(raw) ? raw : void 0;
21882
- return { id: String(option.id), key: (0, import_records36.optionKey)(option), label: (0, import_records36.optionLabel)(option), ...color ? { color } : {} };
21918
+ return { id: String(option.id), key: (0, import_records37.optionKey)(option), label: (0, import_records37.optionLabel)(option), ...color ? { color } : {} };
21883
21919
  }
21884
21920
  function paintByOption(style, _fields, index, lookup) {
21885
21921
  if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
@@ -22937,7 +22973,7 @@ function CustomRecordForm({
22937
22973
  const host = useRecordsUi();
22938
22974
  const [draft, setDraft] = (0, import_react103.useState)(() => recordId ? {} : { ...initial ?? {} });
22939
22975
  const table = (0, import_react104.useTable)(tableId);
22940
- const typeInDraft = (0, import_records37.recordTypeOf)(table.data, draft);
22976
+ const typeInDraft = (0, import_records38.recordTypeOf)(table.data, draft);
22941
22977
  const typeNow = typeInDraft ?? recordType;
22942
22978
  const fields = (0, import_react104.useFields)(tableId, typeNow);
22943
22979
  const existing = (0, import_react104.useRecord)(recordId ?? null);
@@ -23256,9 +23292,9 @@ function useTypeFieldKey() {
23256
23292
  }
23257
23293
  function NotApplicableGate({ field: field2, document: document2, children }) {
23258
23294
  const typeKey = useTypeFieldKey();
23259
- if ((0, import_records38.typesOfField)(field2).length === 0) return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_jsx_runtime73.Fragment, { children });
23260
- const recordType = (0, import_records38.recordTypeOf)({ type_field: typeKey }, document2);
23261
- if ((0, import_records38.fieldAppliesToType)(field2, recordType)) return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_jsx_runtime73.Fragment, { children });
23295
+ if ((0, import_records39.typesOfField)(field2).length === 0) return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_jsx_runtime73.Fragment, { children });
23296
+ const recordType = (0, import_records39.recordTypeOf)({ type_field: typeKey }, document2);
23297
+ if ((0, import_records39.fieldAppliesToType)(field2, recordType)) return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_jsx_runtime73.Fragment, { children });
23262
23298
  const why = notApplicableSentence(field2, recordType);
23263
23299
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "block w-full truncate text-muted-foreground", title: why, "aria-label": why, "data-records-cell-not-applicable": field2.key, children: "\u2014" });
23264
23300
  }
@@ -23273,7 +23309,7 @@ function useTypeChoices(typeField) {
23273
23309
  }
23274
23310
  let live = true;
23275
23311
  void client.fieldOptions({ field_id: id }).then((got) => {
23276
- if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0, import_records38.optionKey)(o), label: (0, import_records38.optionLabel)(o) })));
23312
+ if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0, import_records39.optionKey)(o), label: (0, import_records39.optionLabel)(o) })));
23277
23313
  });
23278
23314
  return () => {
23279
23315
  live = false;
@@ -23282,7 +23318,7 @@ function useTypeChoices(typeField) {
23282
23318
  return choices;
23283
23319
  }
23284
23320
  function typeFieldCandidates(fields) {
23285
- return fields.filter((f) => editorKindFor(f) === "select" && !f.multi && (0, import_records38.typesOfField)(f).length === 0);
23321
+ return fields.filter((f) => editorKindFor(f) === "select" && !f.multi && (0, import_records39.typesOfField)(f).length === 0);
23286
23322
  }
23287
23323
  function RecordTypeSetting({
23288
23324
  table,
@@ -23320,7 +23356,7 @@ function AppliesToTypes({
23320
23356
  }) {
23321
23357
  const choices = useTypeChoices(typeField);
23322
23358
  if (!typeField || choices.length === 0) return null;
23323
- const has = (key, label) => value.some((v) => (0, import_records38.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records38.fieldAppliesToType)({ applies_to_types: [v] }, label));
23359
+ const has = (key, label) => value.some((v) => (0, import_records39.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records39.fieldAppliesToType)({ applies_to_types: [v] }, label));
23324
23360
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-applies-to": "", children: [
23325
23361
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "text-muted-foreground", children: "Applies to" }),
23326
23362
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("label", { className: "flex items-center gap-1.5", children: [
@@ -23331,7 +23367,7 @@ function AppliesToTypes({
23331
23367
  "aria-label": `Applies to ${choice.label}`,
23332
23368
  "data-records-field-applies-to-type": choice.key,
23333
23369
  onCheckedChange: (on) => {
23334
- const rest = value.filter((v) => !((0, import_records38.fieldAppliesToType)({ applies_to_types: [v] }, choice.key) || (0, import_records38.fieldAppliesToType)({ applies_to_types: [v] }, choice.label)));
23370
+ const rest = value.filter((v) => !((0, import_records39.fieldAppliesToType)({ applies_to_types: [v] }, choice.key) || (0, import_records39.fieldAppliesToType)({ applies_to_types: [v] }, choice.label)));
23335
23371
  onValue(on === true ? [...rest, choice.key] : rest);
23336
23372
  }
23337
23373
  }
@@ -23479,7 +23515,7 @@ function RowLabelSetting({
23479
23515
  }, [client, tableId, table.title_field]);
23480
23516
  const mayChange = kept2?.can_change !== false;
23481
23517
  const keptFormula = kept2?.formula ?? null;
23482
- const tooLong = formula.trim().length > import_records39.ROW_LABEL_FORMULA_MAX_LENGTH;
23518
+ const tooLong = formula.trim().length > import_records40.ROW_LABEL_FORMULA_MAX_LENGTH;
23483
23519
  const unchanged = formula.trim() === (keptFormula ?? "").trim() && kept2?.valid !== false;
23484
23520
  const saveFormula = async () => {
23485
23521
  setSaving(true);
@@ -23531,7 +23567,7 @@ function RowLabelSetting({
23531
23567
  ] }) : null,
23532
23568
  tooLong ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("p", { className: "text-[11px] text-foreground", children: [
23533
23569
  "Up to ",
23534
- import_records39.ROW_LABEL_FORMULA_MAX_LENGTH,
23570
+ import_records40.ROW_LABEL_FORMULA_MAX_LENGTH,
23535
23571
  " characters"
23536
23572
  ] }) : null,
23537
23573
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
@@ -23540,7 +23576,7 @@ function RowLabelSetting({
23540
23576
  type: "button",
23541
23577
  size: "sm",
23542
23578
  "data-table-row-label-save-formula": "",
23543
- disabled: saving || busy || !mayChange || (0, import_records39.clearsRowLabel)(formula) || tooLong || formulaOk === false || unchanged,
23579
+ disabled: saving || busy || !mayChange || (0, import_records40.clearsRowLabel)(formula) || tooLong || formulaOk === false || unchanged,
23544
23580
  onClick: () => void saveFormula(),
23545
23581
  children: saving ? "Saving\u2026" : "Use this formula"
23546
23582
  }
@@ -23677,7 +23713,7 @@ init_PersonPicker();
23677
23713
 
23678
23714
  // src/gridEditing.tsx
23679
23715
  var import_react112 = require("react");
23680
- var import_records40 = require("@ai-matrx/records");
23716
+ var import_records41 = require("@ai-matrx/records");
23681
23717
  var import_core14 = require("@ai-matrx/records/core");
23682
23718
  var import_react113 = require("@ai-matrx/records/react");
23683
23719
  var import_design_system66 = require("@ai-matrx/design-system");
@@ -23956,7 +23992,7 @@ function isTypedCharacter(event) {
23956
23992
  return !event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1 && event.key !== " ";
23957
23993
  }
23958
23994
  function fieldIsEditable(field2) {
23959
- if ((0, import_records40.isButtonField)(field2)) return false;
23995
+ if ((0, import_records41.isButtonField)(field2)) return false;
23960
23996
  const kind2 = editorKindFor(field2);
23961
23997
  return kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup";
23962
23998
  }
@@ -25510,8 +25546,8 @@ function useWholeTableCount(args) {
25510
25546
  // src/Grid.tsx
25511
25547
  var import_react197 = require("react");
25512
25548
  var import_react198 = require("@ai-matrx/records/react");
25513
- var import_records51 = require("@ai-matrx/records");
25514
25549
  var import_records52 = require("@ai-matrx/records");
25550
+ var import_records53 = require("@ai-matrx/records");
25515
25551
  var import_data_table14 = require("@ai-matrx/design-system/data-table");
25516
25552
  var import_core21 = require("@ai-matrx/records/core");
25517
25553
 
@@ -25554,7 +25590,7 @@ function useTableDecorations(tableId, revision) {
25554
25590
  }
25555
25591
 
25556
25592
  // src/emptyState.tsx
25557
- var import_records41 = require("@ai-matrx/records");
25593
+ var import_records42 = require("@ai-matrx/records");
25558
25594
  var import_design_system67 = require("@ai-matrx/design-system");
25559
25595
  var import_format6 = require("@ai-matrx/kit/format");
25560
25596
  var import_jsx_runtime78 = require("react/jsx-runtime");
@@ -25564,7 +25600,7 @@ function lockedRowsWords(count) {
25564
25600
  function questionIsAsked(args) {
25565
25601
  if ((args.search ?? "").trim() !== "") return true;
25566
25602
  if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
25567
- if (args.filter && (0, import_records41.stableFilterKey)(args.filter) !== "{}") return true;
25603
+ if (args.filter && (0, import_records42.stableFilterKey)(args.filter) !== "{}") return true;
25568
25604
  return Boolean(args.ruled);
25569
25605
  }
25570
25606
  function emptyCauseOf(args) {
@@ -25703,7 +25739,7 @@ function costInPoints(cents, rate) {
25703
25739
  // src/Enrich.tsx
25704
25740
  var import_react121 = require("react");
25705
25741
  var import_react122 = require("@ai-matrx/records/react");
25706
- var import_records42 = require("@ai-matrx/records");
25742
+ var import_records43 = require("@ai-matrx/records");
25707
25743
  var import_design_system68 = require("@ai-matrx/design-system");
25708
25744
  var import_format8 = require("@ai-matrx/kit/format");
25709
25745
  var import_core15 = require("@ai-matrx/records/core");
@@ -26039,16 +26075,16 @@ function EnrichPanel({ tableId, fieldId, className }) {
26039
26075
  const setup = draft[fieldId] ?? { instruction: "", every: "30" };
26040
26076
  const kindOf = target ? editorKindFor(target) : null;
26041
26077
  const attachmentColumns = (fields.data ?? []).filter((f) => f.id !== fieldId && editorKindFor(f) === "attachment");
26042
- const offered = (0, import_records42.presetsFor)({
26078
+ const offered = (0, import_records43.presetsFor)({
26043
26079
  targetIsChoice: kindOf === "select" || kindOf === "multi_select",
26044
26080
  hasAttachmentColumn: attachmentColumns.length > 0
26045
26081
  });
26046
- const chosen = setup.preset ? (0, import_records42.aiFieldPreset)(setup.preset) : void 0;
26047
- const readsPictures = (0, import_records42.presetInputs)(setup.preset, attachmentColumns.map((f) => f.key));
26048
- const readsRecord = readsPictures ?? (0, import_records42.defaultEnrichInputs)(fields.data ?? [], target?.key ?? "");
26082
+ const chosen = setup.preset ? (0, import_records43.aiFieldPreset)(setup.preset) : void 0;
26083
+ const readsPictures = (0, import_records43.presetInputs)(setup.preset, attachmentColumns.map((f) => f.key));
26084
+ const readsRecord = readsPictures ?? (0, import_records43.defaultEnrichInputs)(fields.data ?? [], target?.key ?? "", limits?.enrichmentSensitivityCeiling);
26049
26085
  const applyPreset = (preset, answer) => {
26050
26086
  const reads = preset === "describe_image" ? attachmentColumns.map((f) => f.name ?? f.label) : void 0;
26051
- const sentence2 = (0, import_records42.presetInstruction)(preset, { answer, reads });
26087
+ const sentence2 = (0, import_records43.presetInstruction)(preset, { answer, reads });
26052
26088
  setDraft((prev) => ({
26053
26089
  ...prev,
26054
26090
  [fieldId]: { ...setup, preset, ...answer !== void 0 ? { answer } : {}, instruction: sentence2 ?? "" }
@@ -28343,7 +28379,7 @@ init_names();
28343
28379
  // src/gridActions.tsx
28344
28380
  var import_react147 = require("react");
28345
28381
  var import_react148 = require("@ai-matrx/records/react");
28346
- var import_records43 = require("@ai-matrx/records");
28382
+ var import_records44 = require("@ai-matrx/records");
28347
28383
  var import_design_system79 = require("@ai-matrx/design-system");
28348
28384
  init_Refusal();
28349
28385
  init_names();
@@ -28428,7 +28464,7 @@ function useActionRunner(args) {
28428
28464
  const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
28429
28465
  setBusy(null);
28430
28466
  if (!answered.ok) {
28431
- const refusals = (0, import_records43.actionRefusals)(answered.error);
28467
+ const refusals = (0, import_records44.actionRefusals)(answered.error);
28432
28468
  setOutcome({
28433
28469
  kind: "refused",
28434
28470
  action: action3,
@@ -29224,7 +29260,7 @@ init_writeOnTheWinningVersion();
29224
29260
  // src/gridSummaries.tsx
29225
29261
  var import_react151 = require("react");
29226
29262
  var import_react152 = require("@ai-matrx/records/react");
29227
- var import_records44 = require("@ai-matrx/records");
29263
+ var import_records45 = require("@ai-matrx/records");
29228
29264
  var import_design_system82 = require("@ai-matrx/design-system");
29229
29265
  init_parity();
29230
29266
  init_names();
@@ -29275,8 +29311,8 @@ function useColumnSummaries(args) {
29275
29311
  const why = {};
29276
29312
  for (const [key, op2] of entries) {
29277
29313
  const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
29278
- out[key] = row?.measures?.[(0, import_records44.measureKey)(measure)] ?? null;
29279
- const notice2 = row?.withheld?.[(0, import_records44.measureKey)(measure)];
29314
+ out[key] = row?.measures?.[(0, import_records45.measureKey)(measure)] ?? null;
29315
+ const notice2 = row?.withheld?.[(0, import_records45.measureKey)(measure)];
29280
29316
  if (notice2) why[key] = notice2;
29281
29317
  }
29282
29318
  setValues(out);
@@ -31102,7 +31138,7 @@ function NewRecordControl({
31102
31138
  // src/gridDrill.tsx
31103
31139
  var import_react164 = require("react");
31104
31140
  var import_react165 = require("@ai-matrx/records/react");
31105
- var import_records45 = require("@ai-matrx/records");
31141
+ var import_records46 = require("@ai-matrx/records");
31106
31142
  var import_data_table12 = require("@ai-matrx/design-system/data-table");
31107
31143
  init_parity();
31108
31144
  init_plainWords();
@@ -31366,7 +31402,7 @@ function useDrillAnswers(args) {
31366
31402
  across: question.across ?? null,
31367
31403
  show: question.show,
31368
31404
  where: args.where,
31369
- rule: args.rule && (0, import_records45.isRuleFilter)(args.rule) ? args.rule : null,
31405
+ rule: args.rule && (0, import_records46.isRuleFilter)(args.rule) ? args.rule : null,
31370
31406
  window: question.window ?? null,
31371
31407
  compare: question.compare ?? null,
31372
31408
  windowKey: args.windowKey ?? null,
@@ -31599,7 +31635,7 @@ function trailClause(fields, w) {
31599
31635
  }
31600
31636
  function filterWithTrail(fields, base2, trail) {
31601
31637
  if (trail.length === 0) return base2;
31602
- if (!base2 || !(0, import_records45.isRuleFilter)(base2)) {
31638
+ if (!base2 || !(0, import_records46.isRuleFilter)(base2)) {
31603
31639
  const flat = { ...base2 ?? {} };
31604
31640
  for (const w of trail) {
31605
31641
  const clause = trailClause(fields, w);
@@ -31622,7 +31658,7 @@ function filterWithTrail(fields, base2, trail) {
31622
31658
  return { op: "and", args };
31623
31659
  }
31624
31660
  function filterWithWindow(fields, base2, key, range) {
31625
- if (!base2 || !(0, import_records45.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
31661
+ if (!base2 || !(0, import_records46.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
31626
31662
  const field2 = fields.find((f) => f.key === key);
31627
31663
  if (!field2) return base2;
31628
31664
  const ref = { field: field2.id };
@@ -31666,8 +31702,8 @@ function useGridDrillConfig(args) {
31666
31702
  },
31667
31703
  [setQuestion, onPresentationChange, presentation]
31668
31704
  );
31669
- const flat = state2.filter && !(0, import_records45.isRuleFilter)(state2.filter) ? state2.filter : void 0;
31670
- const rule = state2.filter && (0, import_records45.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
31705
+ const flat = state2.filter && !(0, import_records46.isRuleFilter)(state2.filter) ? state2.filter : void 0;
31706
+ const rule = state2.filter && (0, import_records46.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
31671
31707
  const { config } = useDrill({
31672
31708
  source: state2.source,
31673
31709
  question: state2.question,
@@ -32056,7 +32092,7 @@ function withTypeMark(field2, header) {
32056
32092
 
32057
32093
  // src/ReverseColumns.tsx
32058
32094
  var import_react166 = require("react");
32059
- var import_records46 = require("@ai-matrx/records");
32095
+ var import_records47 = require("@ai-matrx/records");
32060
32096
 
32061
32097
  // src/groupReads.ts
32062
32098
  var import_first_page6 = require("@ai-matrx/records/first-page");
@@ -32209,7 +32245,7 @@ function useReverseField(tableId, column) {
32209
32245
  if (column.read_only || !client) return;
32210
32246
  let live = true;
32211
32247
  void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
32212
- if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records46.isReverseField)(f)) ?? null);
32248
+ if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records47.isReverseField)(f)) ?? null);
32213
32249
  });
32214
32250
  return () => {
32215
32251
  live = false;
@@ -32996,13 +33032,13 @@ init_tableShape();
32996
33032
 
32997
33033
  // src/TableAsOf.tsx
32998
33034
  var import_react174 = require("react");
32999
- var import_records48 = require("@ai-matrx/records");
33035
+ var import_records49 = require("@ai-matrx/records");
33000
33036
  var import_react175 = require("@ai-matrx/records/react");
33001
33037
  var import_design_system94 = require("@ai-matrx/design-system");
33002
33038
 
33003
33039
  // src/AsOfReading.tsx
33004
33040
  var import_react172 = require("react");
33005
- var import_records47 = require("@ai-matrx/records");
33041
+ var import_records48 = require("@ai-matrx/records");
33006
33042
  var import_react173 = require("@ai-matrx/records/react");
33007
33043
  var import_design_system93 = require("@ai-matrx/design-system");
33008
33044
  var import_controls9 = require("@ai-matrx/design-system/controls");
@@ -33027,7 +33063,7 @@ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
33027
33063
  return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
33028
33064
  }
33029
33065
  function AsOfControl({ value, onChange, className }) {
33030
- const [text, setText] = (0, import_react172.useState)(value ? (0, import_records47.typedDateText)(value.day) : "");
33066
+ const [text, setText] = (0, import_react172.useState)(value ? (0, import_records48.typedDateText)(value.day) : "");
33031
33067
  const [bad, setBad] = (0, import_react172.useState)(false);
33032
33068
  usePersonTimeZone();
33033
33069
  const clock = value?.clock ?? "recorded";
@@ -33037,13 +33073,13 @@ function AsOfControl({ value, onChange, className }) {
33037
33073
  onChange(null);
33038
33074
  return;
33039
33075
  }
33040
- const read = (0, import_records47.readTypedDate)(words2);
33076
+ const read = (0, import_records48.readTypedDate)(words2);
33041
33077
  if (!read.ok) {
33042
33078
  setBad(true);
33043
33079
  return;
33044
33080
  }
33045
33081
  setBad(false);
33046
- setText((0, import_records47.typedDateText)(read.day));
33082
+ setText((0, import_records48.typedDateText)(read.day));
33047
33083
  onChange({ day: read.day, clock });
33048
33084
  }
33049
33085
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: (0, import_design_system93.cn)("flex h-6 items-center gap-1", className), "data-records-as-of": "", children: [
@@ -33148,7 +33184,7 @@ function AsOfReading({
33148
33184
  if (answer.doc === null) {
33149
33185
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("p", { className: (0, import_design_system93.cn)(box, "p-2 text-xs text-muted-foreground"), "data-records-as-of-none": "", children: [
33150
33186
  "Not there on ",
33151
- (0, import_records47.typedDateText)(asOf.day)
33187
+ (0, import_records48.typedDateText)(asOf.day)
33152
33188
  ] });
33153
33189
  }
33154
33190
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("dl", { className: (0, import_design_system93.cn)(box, "grid grid-cols-[minmax(5rem,9rem)_1fr] content-start gap-x-3 gap-y-0.5 p-2 text-[11px]"), "data-records-as-of-reading": "", children: rows.map(({ field: field2, was, now, differs }) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "contents", "data-as-of-field": field2.key, "data-as-of-differs": differs ? "" : void 0, children: [
@@ -33218,7 +33254,7 @@ function TableAsOfButton({
33218
33254
  }) {
33219
33255
  const [open, setOpen] = (0, import_react174.useState)(false);
33220
33256
  usePersonTimeZone();
33221
- const label = value ? `${TABLE_AS_OF_WORDS.button} ${(0, import_records48.typedDateText)(value.day)}` : TABLE_AS_OF_WORDS.button;
33257
+ const label = value ? `${TABLE_AS_OF_WORDS.button} ${(0, import_records49.typedDateText)(value.day)}` : TABLE_AS_OF_WORDS.button;
33222
33258
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_design_system94.Popover, { open, onOpenChange: setOpen, children: [
33223
33259
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_design_system94.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
33224
33260
  import_design_system94.Button,
@@ -33713,7 +33749,7 @@ function useStoreValueFacets(enabled, inputs) {
33713
33749
  // src/gridGrouping.tsx
33714
33750
  var import_react183 = require("react");
33715
33751
  var import_react184 = require("@ai-matrx/records/react");
33716
- var import_records49 = require("@ai-matrx/records");
33752
+ var import_records50 = require("@ai-matrx/records");
33717
33753
  init_parity();
33718
33754
  var import_jsx_runtime114 = require("react/jsx-runtime");
33719
33755
  function groupValueKey(value) {
@@ -33751,8 +33787,8 @@ function useGroupFacts(args) {
33751
33787
  const withheld = {};
33752
33788
  for (const [fieldKey, op2] of entries) {
33753
33789
  const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
33754
- values[fieldKey] = row.measures?.[(0, import_records49.measureKey)(m)] ?? null;
33755
- const notice2 = row.withheld?.[(0, import_records49.measureKey)(m)];
33790
+ values[fieldKey] = row.measures?.[(0, import_records50.measureKey)(m)] ?? null;
33791
+ const notice2 = row.withheld?.[(0, import_records50.measureKey)(m)];
33756
33792
  if (notice2) withheld[fieldKey] = notice2;
33757
33793
  }
33758
33794
  out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
@@ -34753,7 +34789,7 @@ init_recordVersions();
34753
34789
  // src/handOrder.tsx
34754
34790
  var import_react192 = require("react");
34755
34791
  var import_react193 = require("@ai-matrx/records/react");
34756
- var import_records50 = require("@ai-matrx/records");
34792
+ var import_records51 = require("@ai-matrx/records");
34757
34793
  var import_design_system100 = require("@ai-matrx/design-system");
34758
34794
  init_Refusal();
34759
34795
 
@@ -34877,7 +34913,7 @@ function useHandOrderRows(args) {
34877
34913
  const client = (0, import_react193.useRecordsClient)();
34878
34914
  const { viewId, active, page, pageSize } = args;
34879
34915
  const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
34880
- const filterKey = filter ? (0, import_records50.stableFilterKey)(filter) : "";
34916
+ const filterKey = filter ? (0, import_records51.stableFilterKey)(filter) : "";
34881
34917
  const filterNow = (0, import_react192.useRef)(filter);
34882
34918
  filterNow.current = filter;
34883
34919
  const [answer, setAnswer] = (0, import_react192.useState)(null);
@@ -35179,7 +35215,7 @@ function GridBody({
35179
35215
  const hrefForRecord = host.hrefForRecord;
35180
35216
  const client = (0, import_react198.useRecordsClient)();
35181
35217
  const table = (0, import_react198.useTable)(tableId);
35182
- const fields = (0, import_react198.useFields)(tableId, import_records51.EVERY_RECORD_TYPE);
35218
+ const fields = (0, import_react198.useFields)(tableId, import_records52.EVERY_RECORD_TYPE);
35183
35219
  const decorations = useTableDecorations(tableId, fields.data);
35184
35220
  const mergedStyle = (0, import_react197.useMemo)(
35185
35221
  () => resolveTableStyle(decorations.data, fields.data ?? [], presentation.style),
@@ -35365,9 +35401,9 @@ function GridBody({
35365
35401
  const pageAskedFor = (0, import_react197.useRef)(null);
35366
35402
  if (fields.data && !table.loading) pageAskedFor.current = tableId;
35367
35403
  const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
35368
- const numberAsked = (0, import_react197.useMemo)(() => (0, import_records51.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
35404
+ const numberAsked = (0, import_react197.useMemo)(() => (0, import_records52.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
35369
35405
  const pageSearch = numberAsked ? "" : searchTerm;
35370
- const pageFilter = numberAsked ? (0, import_records51.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
35406
+ const pageFilter = numberAsked ? (0, import_records52.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
35371
35407
  const [tableAsOf, setTableAsOf] = (0, import_react197.useState)(null);
35372
35408
  const pastRead = useTableAsOfPage(tableAsOf && storePaged ? tableId : null, tableAsOf, Math.max(0, query.page - 1), query.pageSize);
35373
35409
  const serverRead = (0, import_react198.useRecordPage)(storePaged && pageAsked && !tableAsOf ? tableId : null, {
@@ -35736,7 +35772,7 @@ function GridBody({
35736
35772
  const names2 = wanted.get(field2.key) ?? [];
35737
35773
  if (names2.length === 0) return;
35738
35774
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
35739
- if (got.ok) relationNames.current.set(field2.key, (0, import_records52.relationNameIndexOf)(got.data));
35775
+ if (got.ok) relationNames.current.set(field2.key, (0, import_records53.relationNameIndexOf)(got.data));
35740
35776
  })
35741
35777
  );
35742
35778
  },
@@ -35815,7 +35851,7 @@ function GridBody({
35815
35851
  field2.key,
35816
35852
  lines2.flatMap((line) => {
35817
35853
  const cell2 = line[at];
35818
- return typeof cell2 === "string" ? (0, import_records52.relationNamesIn)(field2, cell2) : [];
35854
+ return typeof cell2 === "string" ? (0, import_records53.relationNamesIn)(field2, cell2) : [];
35819
35855
  })
35820
35856
  );
35821
35857
  }
@@ -36113,7 +36149,7 @@ function GridBody({
36113
36149
  tableName: table.data ? tableName(table.data) : "",
36114
36150
  fields: fields.data ?? [],
36115
36151
  document: row.document ?? {},
36116
- level: (0, import_records52.asPermissionLevel)(row.level)
36152
+ level: (0, import_records53.asPermissionLevel)(row.level)
36117
36153
  }),
36118
36154
  [host, tableId, table.data, fields.data]
36119
36155
  );
@@ -37615,7 +37651,7 @@ var import_react230 = require("@ai-matrx/records/react");
37615
37651
 
37616
37652
  // src/Peek.tsx
37617
37653
  var import_react212 = require("react");
37618
- var import_records56 = require("@ai-matrx/records");
37654
+ var import_records57 = require("@ai-matrx/records");
37619
37655
  var import_react213 = require("@ai-matrx/records/react");
37620
37656
  var import_react214 = require("@ai-matrx/alchemy/react");
37621
37657
 
@@ -37851,7 +37887,7 @@ init_Refusal();
37851
37887
 
37852
37888
  // src/ValueAlternates.tsx
37853
37889
  var import_react203 = require("react");
37854
- var import_records53 = require("@ai-matrx/records");
37890
+ var import_records54 = require("@ai-matrx/records");
37855
37891
  var import_react204 = require("@ai-matrx/records/react");
37856
37892
  var import_text_case17 = require("@ai-matrx/kit/text-case");
37857
37893
  var import_design_system104 = require("@ai-matrx/design-system");
@@ -37907,7 +37943,7 @@ function ValueAlternates({
37907
37943
  async function use(index) {
37908
37944
  setBusy(index);
37909
37945
  setRefusal(null);
37910
- const written = await (0, import_records53.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index, ...shownList[index]?.rank !== void 0 ? { rank: shownList[index].rank } : {} });
37946
+ const written = await (0, import_records54.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index, ...shownList[index]?.rank !== void 0 ? { rank: shownList[index].rank } : {} });
37911
37947
  setBusy(null);
37912
37948
  if (!written.ok) return setRefusal(written.error);
37913
37949
  setOpen(false);
@@ -37952,7 +37988,7 @@ function ValueAlternates({
37952
37988
 
37953
37989
  // src/ValuePeriods.tsx
37954
37990
  var import_react205 = require("react");
37955
- var import_records54 = require("@ai-matrx/records");
37991
+ var import_records55 = require("@ai-matrx/records");
37956
37992
  var import_react206 = require("@ai-matrx/records/react");
37957
37993
  var import_design_system105 = require("@ai-matrx/design-system");
37958
37994
  var import_controls10 = require("@ai-matrx/design-system/controls");
@@ -37979,14 +38015,14 @@ function ValuePeriods({
37979
38015
  setRefusal(null);
37980
38016
  const raw = await client.recordAsOf({ record_id: recordId, recorded_at: (/* @__PURE__ */ new Date()).toISOString() });
37981
38017
  if (!raw.ok) return setRefusal(raw.error);
37982
- setRows(asRows((0, import_records54.valuePeriodsOf)(raw.data, field2.key)));
38018
+ setRows(asRows((0, import_records55.valuePeriodsOf)(raw.data, field2.key)));
37983
38019
  }
37984
38020
  const change = (i, part) => setRows((now) => (now ?? []).map((r, j) => j === i ? { ...r, ...part } : r));
37985
38021
  async function save() {
37986
38022
  if (!rows) return;
37987
38023
  setSaving(true);
37988
38024
  setRefusal(null);
37989
- const written = await (0, import_records54.setValuePeriods)(client, {
38025
+ const written = await (0, import_records55.setValuePeriods)(client, {
37990
38026
  record_id: recordId,
37991
38027
  field_key: field2.key,
37992
38028
  periods: rows.filter((r) => r.value.trim() !== "" || r.from || r.to).map((r) => ({ from: r.from, to: r.to, value: r.value }))
@@ -38125,7 +38161,7 @@ function ShareForSomebodyElse({
38125
38161
 
38126
38162
  // src/RowControls.tsx
38127
38163
  var import_react208 = require("react");
38128
- var import_records55 = require("@ai-matrx/records");
38164
+ var import_records56 = require("@ai-matrx/records");
38129
38165
  var import_react209 = require("@ai-matrx/records/react");
38130
38166
  var import_design_system107 = require("@ai-matrx/design-system");
38131
38167
  init_Refusal();
@@ -38141,7 +38177,7 @@ var ROW_CONTROL_WORDS = {
38141
38177
  applying: "Applying\u2026",
38142
38178
  whoMayChangeTable: "Only the table's maker or an admin can change these.",
38143
38179
  shownTo: "Shown to",
38144
- whoMayChangeRow: import_records55.SHOWN_TO_WHO_MAY_CHANGE
38180
+ whoMayChangeRow: import_records56.SHOWN_TO_WHO_MAY_CHANGE
38145
38181
  };
38146
38182
  function appliedLine(done) {
38147
38183
  const rows = `${done.changed} ${done.changed === 1 ? "row" : "rows"} changed`;
@@ -38155,7 +38191,7 @@ function ShownToSelect({
38155
38191
  onChange,
38156
38192
  testId
38157
38193
  }) {
38158
- return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_design_system107.Select, { value, onValueChange: (next) => (0, import_records55.isShownTo)(next) ? onChange(next) : void 0, children: [
38194
+ return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_design_system107.Select, { value, onValueChange: (next) => (0, import_records56.isShownTo)(next) ? onChange(next) : void 0, children: [
38159
38195
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
38160
38196
  import_design_system107.SelectTrigger,
38161
38197
  {
@@ -38169,7 +38205,7 @@ function ShownToSelect({
38169
38205
  ]
38170
38206
  }
38171
38207
  ),
38172
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_design_system107.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_design_system107.SelectItem, { value: word, children: import_records55.SHOWN_TO_LABEL[word] }, word)) })
38208
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_design_system107.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_design_system107.SelectItem, { value: word, children: import_records56.SHOWN_TO_LABEL[word] }, word)) })
38173
38209
  ] });
38174
38210
  }
38175
38211
  function NewRowsDefaults({ tableId }) {
@@ -38207,10 +38243,10 @@ function NewRowsDefaults({ tableId }) {
38207
38243
  setError(null);
38208
38244
  setApplied(appliedLine(answer.data));
38209
38245
  };
38210
- if (!(0, import_records55.levelHasShownTo)(table.data?.level)) return null;
38246
+ if (!(0, import_records56.levelHasShownTo)(table.data?.level)) return null;
38211
38247
  if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(RefusalNotice, { error }) : null;
38212
38248
  const shown5 = d.shown_to ?? d.effective.shown_to;
38213
- const allowed = d.allowed_shown_to.filter(import_records55.isShownTo);
38249
+ const allowed = d.allowed_shown_to.filter(import_records56.isShownTo);
38214
38250
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
38215
38251
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
38216
38252
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -38224,7 +38260,7 @@ function NewRowsDefaults({ tableId }) {
38224
38260
  testId: "new-rows-shown-to",
38225
38261
  onChange: (next) => void set({ shown_to: next })
38226
38262
  }
38227
- ) : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records55.SHOWN_TO_LABEL[shown5] })
38263
+ ) : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records56.SHOWN_TO_LABEL[shown5] })
38228
38264
  ] }),
38229
38265
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
38230
38266
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
@@ -38275,10 +38311,10 @@ function RowShownTo({ recordId, tableId }) {
38275
38311
  }, [read]);
38276
38312
  if (error && !c) return null;
38277
38313
  if (tableId && table.loading && !table.data) return null;
38278
- if (!(0, import_records55.levelHasShownTo)(table.data?.level)) return null;
38279
- if (!c || c.shown_to.is_child || !(0, import_records55.isShownTo)(c.shown_to.effective)) return null;
38314
+ if (!(0, import_records56.levelHasShownTo)(table.data?.level)) return null;
38315
+ if (!c || c.shown_to.is_child || !(0, import_records56.isShownTo)(c.shown_to.effective)) return null;
38280
38316
  const effective = c.shown_to.effective;
38281
- const allowed = c.shown_to.allowed.filter(import_records55.isShownTo);
38317
+ const allowed = c.shown_to.allowed.filter(import_records56.isShownTo);
38282
38318
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("span", { className: "inline-flex shrink-0 items-center", "data-testid": "row-shown-to", children: [
38283
38319
  c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
38284
38320
  ShownToSelect,
@@ -38305,7 +38341,7 @@ function RowShownTo({ recordId, tableId }) {
38305
38341
  title: ROW_CONTROL_WORDS.whoMayChangeRow,
38306
38342
  children: [
38307
38343
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
38308
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records55.SHOWN_TO_LABEL[effective] }),
38344
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records56.SHOWN_TO_LABEL[effective] }),
38309
38345
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "sr-only", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
38310
38346
  ]
38311
38347
  }
@@ -38446,7 +38482,7 @@ function Peek3({ tableId, recordId, onClose, className, onPage = false }) {
38446
38482
  usePeopleTick();
38447
38483
  const table = (0, import_react213.useTable)(tableId);
38448
38484
  const record = (0, import_react213.useRecord)(recordId, true, { tableId });
38449
- const fields = (0, import_react213.useFields)(tableId, (0, import_records56.recordTypeOf)(table.data, record.data?.document));
38485
+ const fields = (0, import_react213.useFields)(tableId, (0, import_records57.recordTypeOf)(table.data, record.data?.document));
38450
38486
  const may = useRecordRights(recordId);
38451
38487
  const host = useRecordsUi();
38452
38488
  const organizationId = (0, import_react213.useRecordsClient)().config.organizationId;
@@ -38462,7 +38498,7 @@ function Peek3({ tableId, recordId, onClose, className, onPage = false }) {
38462
38498
  if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(RefusalNotice, { error: record.error, className });
38463
38499
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
38464
38500
  const document2 = record.data?.document;
38465
- if (document2 && (0, import_records56.isLockedStub)({ document: document2, level: null })) {
38501
+ if (document2 && (0, import_records57.isLockedStub)({ document: document2, level: null })) {
38466
38502
  const filed = document2["submitted_at"];
38467
38503
  const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric", ...(0, import_field_formats16.momentZoneOptions)(filed) }) : null;
38468
38504
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("p", { className: (0, import_design_system109.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
@@ -39209,12 +39245,14 @@ function ChangeLine({
39209
39245
  nameOf: nameOf3
39210
39246
  }) {
39211
39247
  usePeopleTick();
39248
+ const linkFields = (0, import_react217.useMemo)(() => field2?.type === "relation" ? [field2] : void 0, [field2]);
39249
+ const labels = useRecordLabels(linkFields);
39212
39250
  return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("li", { "data-change-key": change.key, className: "flex items-baseline gap-2 text-[11px]", children: [
39213
39251
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "w-24 shrink-0 truncate font-medium", title: change.label, children: change.label || (0, import_text_case20.humanizeIdentifier)(change.key) }),
39214
39252
  /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
39215
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-muted-foreground line-through", children: change.before_words ?? say(change.before, field2) }),
39253
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-muted-foreground line-through", children: change.before_words ?? say(change.before, field2, labels) }),
39216
39254
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
39217
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("strong", { className: "font-medium", children: change.after_words ?? say(change.after, field2) })
39255
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("strong", { className: "font-medium", children: change.after_words ?? say(change.after, field2, labels) })
39218
39256
  ] }),
39219
39257
  change.rule ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_design_system112.Badge, { variant: "outline", className: "shrink-0 text-[10px]", title: "Worked out by a rule", children: [
39220
39258
  "rule v",
@@ -39334,9 +39372,10 @@ function whenText(at) {
39334
39372
  }
39335
39373
  return then.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric", ...(0, import_field_formats17.momentZoneOptions)(then) });
39336
39374
  }
39337
- function say(value, field2) {
39375
+ var LINKED_RECORD_WORDS = "a linked record";
39376
+ function say(value, field2, labels) {
39338
39377
  if (value === null || value === void 0 || value === "") return "nothing";
39339
- if (field2) return scalarText(field2, value);
39378
+ if (field2) return scalarText(field2, value, labels, field2.type === "relation" ? LINKED_RECORD_WORDS : void 0);
39340
39379
  const ids = (Array.isArray(value) ? value : [value]).filter(import_uuid9.isUuidShape);
39341
39380
  if (ids.length > 0 && ids.length === (Array.isArray(value) ? value.length : 1)) {
39342
39381
  return ids.map((id) => knownPerson(id) ?? PERSON_NOT_IN_ORGANIZATION).join(", ");
@@ -41906,7 +41945,7 @@ function TableRenameDialog({
41906
41945
 
41907
41946
  // src/TableSettings.tsx
41908
41947
  var import_react261 = require("react");
41909
- var import_records57 = require("@ai-matrx/records");
41948
+ var import_records58 = require("@ai-matrx/records");
41910
41949
 
41911
41950
  // src/ArchiveDeliberately.tsx
41912
41951
  var import_react245 = require("react");
@@ -42663,7 +42702,7 @@ function TableSettings(props) {
42663
42702
  const ui = useRecordsUi();
42664
42703
  const client = (0, import_react262.useRecordsClient)();
42665
42704
  const table = (0, import_react262.useTable)(props.tableId);
42666
- const fields = (0, import_react262.useFields)(props.tableId, import_records57.EVERY_RECORD_TYPE);
42705
+ const fields = (0, import_react262.useFields)(props.tableId, import_records58.EVERY_RECORD_TYPE);
42667
42706
  const now = (0, import_react261.useRef)({ table: table.data ?? null, fields: fields.data ?? [] });
42668
42707
  now.current = { table: table.data ?? null, fields: fields.data ?? [] };
42669
42708
  const slots2 = (0, import_react261.useRef)({ details: { current: null }, rowActions: { current: null } }).current;
@@ -42684,7 +42723,7 @@ function TableSettingsPanel({
42684
42723
  className
42685
42724
  }) {
42686
42725
  const table = (0, import_react262.useTable)(tableId);
42687
- const fields = (0, import_react262.useFields)(tableId, import_records57.EVERY_RECORD_TYPE);
42726
+ const fields = (0, import_react262.useFields)(tableId, import_records58.EVERY_RECORD_TYPE);
42688
42727
  const rights = useTableRights(table.data);
42689
42728
  const queued = useTableProposals(tableId, proposals === void 0);
42690
42729
  const shownProposals = proposals ?? queued.rows ?? void 0;
@@ -42836,7 +42875,7 @@ function TableSettingsPanel({
42836
42875
  table.data ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
42837
42876
  /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TableHistoryRetention, { tableId }),
42838
42877
  /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_design_system130.Separator, {}),
42839
- (0, import_records57.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
42878
+ (0, import_records58.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
42840
42879
  /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(NewRowsDefaults, { tableId }),
42841
42880
  /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_design_system130.Separator, {})
42842
42881
  ] }) : null,
@@ -43110,7 +43149,7 @@ function lookAfterReset(look) {
43110
43149
  // src/ViewSwitcher.tsx
43111
43150
  var import_react299 = require("react");
43112
43151
  var import_react300 = require("@ai-matrx/records/react");
43113
- var import_records64 = require("@ai-matrx/records");
43152
+ var import_records65 = require("@ai-matrx/records");
43114
43153
  var import_design_system146 = require("@ai-matrx/design-system");
43115
43154
  var import_data_table23 = require("@ai-matrx/design-system/data-table");
43116
43155
  var import_format15 = require("@ai-matrx/kit/format");
@@ -43314,7 +43353,7 @@ function MoveRefusedBadge({ refused }) {
43314
43353
  // src/Pipeline.tsx
43315
43354
  var import_react267 = require("react");
43316
43355
  var import_react268 = require("@ai-matrx/records/react");
43317
- var import_records58 = require("@ai-matrx/records");
43356
+ var import_records59 = require("@ai-matrx/records");
43318
43357
  var import_design_system132 = require("@ai-matrx/design-system");
43319
43358
  var import_data_table17 = require("@ai-matrx/design-system/data-table");
43320
43359
  init_recordVersions();
@@ -43429,7 +43468,7 @@ function PipelineBoard({
43429
43468
  alive.current = false;
43430
43469
  };
43431
43470
  }, []);
43432
- const filterKey = (0, import_records58.stableFilterKey)(filter);
43471
+ const filterKey = (0, import_records59.stableFilterKey)(filter);
43433
43472
  const reload = (0, import_react267.useCallback)(async () => {
43434
43473
  setLoading(true);
43435
43474
  const [read, board, held] = await Promise.all([
@@ -44186,7 +44225,7 @@ function useRowColorBy(all, colorKey, style) {
44186
44225
  }
44187
44226
 
44188
44227
  // src/workedOutDate.ts
44189
- var import_records59 = require("@ai-matrx/records");
44228
+ var import_records60 = require("@ai-matrx/records");
44190
44229
  var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
44191
44230
  var FORMULA_TYPING_ROUNDS = 9;
44192
44231
  var configOf = (field2) => field2?.config ?? {};
@@ -44263,7 +44302,7 @@ function formulaResultKind(node, all) {
44263
44302
  if (op2 === "fx.min" || op2 === "fx.max") {
44264
44303
  return args.length > 0 && args.every((a) => formulaResultKind(a, all) === "date") ? "date" : "number";
44265
44304
  }
44266
- return import_records59.FORMULA_NODE_RESULTS[op2] ?? "unknown";
44305
+ return import_records60.FORMULA_NODE_RESULTS[op2] ?? "unknown";
44267
44306
  }
44268
44307
  function isDateFormula(field2, all) {
44269
44308
  const expr = ownExpression(field2);
@@ -46957,7 +46996,7 @@ function ListRow({
46957
46996
  }
46958
46997
 
46959
46998
  // src/pivot.ts
46960
- var import_records60 = require("@ai-matrx/records");
46999
+ var import_records61 = require("@ai-matrx/records");
46961
47000
  var PIVOT_OPS = ["count", "sum", "avg", "min", "max"];
46962
47001
  var isPivotOp = (v) => PIVOT_OPS.includes(v ?? "");
46963
47002
  var PIVOT_OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Min", max: "Max" };
@@ -46990,7 +47029,7 @@ function byValue(a, b) {
46990
47029
  return a.label.localeCompare(b.label, void 0, { numeric: true, sensitivity: "base" });
46991
47030
  }
46992
47031
  function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
46993
- const m = (0, import_records60.measureKey)(q.measure);
47032
+ const m = (0, import_records61.measureKey)(q.measure);
46994
47033
  const read = (r) => r ? { value: typeof r.measures?.[m] === "number" ? r.measures[m] : null, n: r.row_count } : null;
46995
47034
  const axis = (key, sources) => {
46996
47035
  if (!key) return [{ id: NONE3, value: null, label: "" }];
@@ -47024,7 +47063,7 @@ function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
47024
47063
  // src/ChartLayout.tsx
47025
47064
  var import_react290 = require("react");
47026
47065
  var import_react291 = require("@ai-matrx/records/react");
47027
- var import_records62 = require("@ai-matrx/records");
47066
+ var import_records63 = require("@ai-matrx/records");
47028
47067
  var import_design_system141 = require("@ai-matrx/design-system");
47029
47068
  var import_controls18 = require("@ai-matrx/design-system/controls");
47030
47069
 
@@ -47032,7 +47071,7 @@ var import_controls18 = require("@ai-matrx/design-system/controls");
47032
47071
  var import_controls17 = require("@ai-matrx/design-system/controls");
47033
47072
  var import_react289 = require("react");
47034
47073
  var import_recharts = require("recharts");
47035
- var import_records61 = require("@ai-matrx/records");
47074
+ var import_records62 = require("@ai-matrx/records");
47036
47075
  var import_core23 = require("@ai-matrx/records/core");
47037
47076
  var import_design_system140 = require("@ai-matrx/design-system");
47038
47077
  var import_format13 = require("@ai-matrx/kit/format");
@@ -47619,7 +47658,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
47619
47658
  const kind2 = shape ? BASE_KIND_OF_SHAPE[shape] : block.kind;
47620
47659
  const tableId = block.table_id ?? subject;
47621
47660
  const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
47622
- const primary = (0, import_records61.measureKey)(measures[0]);
47661
+ const primary = (0, import_records62.measureKey)(measures[0]);
47623
47662
  const windows = kind2 === "stuck" ? null : block.compare ?? null;
47624
47663
  const compared = !!windows;
47625
47664
  const grain = block.bucket?.by ?? null;
@@ -47629,7 +47668,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
47629
47668
  const measureFields = useMeasureFields(primary, source ? void 0 : tableId);
47630
47669
  const measureName = useMeasureWords(primary, tableId);
47631
47670
  const numberFormat = (0, import_react289.useMemo)(() => source ? null : chartFormatFor(primary, measureFields), [source, primary, measureFields]);
47632
- const yKey = drawn === "scatter" && measures[1] ? (0, import_records61.measureKey)(measures[1]) : null;
47671
+ const yKey = drawn === "scatter" && measures[1] ? (0, import_records62.measureKey)(measures[1]) : null;
47633
47672
  const yName = useMeasureWords(yKey ?? primary, tableId);
47634
47673
  const points = (0, import_react289.useMemo)(() => {
47635
47674
  if (kind2 === "stuck") return [];
@@ -48376,7 +48415,7 @@ var isChartKind = (v) => Object.prototype.hasOwnProperty.call(KIND_LABEL, v ?? "
48376
48415
  var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
48377
48416
  function defaultChartGroup(fields) {
48378
48417
  return fields.find((f) => {
48379
- const kind2 = (0, import_records62.fieldKindFor)(f);
48418
+ const kind2 = (0, import_records63.fieldKindFor)(f);
48380
48419
  return kind2 === "select" || kind2 === "multi_select";
48381
48420
  })?.key ?? null;
48382
48421
  }
@@ -48430,7 +48469,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
48430
48469
  return;
48431
48470
  }
48432
48471
  const wholeRow = overall && overall.ok ? (overall.data ?? [])[0] : void 0;
48433
- const wholeValue = wholeRow ? wholeRow.measures[(0, import_records62.measureKey)(question.measure)] : void 0;
48472
+ const wholeValue = wholeRow ? wholeRow.measures[(0, import_records63.measureKey)(question.measure)] : void 0;
48434
48473
  setState({
48435
48474
  error: null,
48436
48475
  ...question.kind === "donut" ? { total: typeof wholeValue === "number" ? wholeValue : null } : {},
@@ -48451,7 +48490,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
48451
48490
  }, [client, view.subject, view.name, qKey, filterKey]);
48452
48491
  const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
48453
48492
  const numeric = fields.filter(isNumberField);
48454
- const pickMeasure = (0, import_records62.measureKey)(q.measure);
48493
+ const pickMeasure = (0, import_records63.measureKey)(q.measure);
48455
48494
  const dataLabels = view.presentation?.chartLabels === true;
48456
48495
  const legend = view.presentation?.chartLegend !== false;
48457
48496
  const setLook = (patch) => onChange({ presentation: { ...view.presentation, ...patch } });
@@ -48513,7 +48552,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
48513
48552
  // src/PivotLayout.tsx
48514
48553
  var import_react292 = require("react");
48515
48554
  var import_react293 = require("@ai-matrx/records/react");
48516
- var import_records63 = require("@ai-matrx/records");
48555
+ var import_records64 = require("@ai-matrx/records");
48517
48556
  var import_design_system142 = require("@ai-matrx/design-system");
48518
48557
  var import_skeleton2 = require("@ai-matrx/design-system/skeleton");
48519
48558
  var import_controls19 = require("@ai-matrx/design-system/controls");
@@ -48589,7 +48628,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
48589
48628
  [view.name, view.subject, q, state2.answers]
48590
48629
  );
48591
48630
  const named = useLinkGroupNamer(namerBlock, view.subject);
48592
- const measureName = useMeasureWords((0, import_records63.measureKey)(q.measure), view.subject);
48631
+ const measureName = useMeasureWords((0, import_records64.measureKey)(q.measure), view.subject);
48593
48632
  const table = (0, import_react292.useMemo)(
48594
48633
  () => state2.answers ? pivotTable(q, state2.answers, (key, value) => groupLabel({ [key]: value }, named), PIVOT_CELL_LIMIT) : null,
48595
48634
  [q, state2.answers, named]
@@ -48627,7 +48666,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
48627
48666
  ] });
48628
48667
  const hasCols = !!q.colKey;
48629
48668
  const colHead = (label) => label === "" ? measureName : label;
48630
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex min-h-0 flex-col gap-2", "data-records-pivot-layout": "", "data-records-pivot-measure": (0, import_records63.measureKey)(q.measure), children: [
48669
+ return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex min-h-0 flex-col gap-2", "data-records-pivot-layout": "", "data-records-pivot-measure": (0, import_records64.measureKey)(q.measure), children: [
48631
48670
  /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
48632
48671
  /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "text-muted-foreground", children: "Rows" }),
48633
48672
  select(
@@ -49516,7 +49555,7 @@ var NO_FIELDS2 = [];
49516
49555
  function useViewRecords(view, pageSize = 200, filter, viewId) {
49517
49556
  const client = (0, import_react300.useRecordsClient)();
49518
49557
  const [limit, setLimit] = (0, import_react299.useState)(pageSize);
49519
- const questionKey = `${view.subject}|${(0, import_records64.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
49558
+ const questionKey = `${view.subject}|${(0, import_records65.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
49520
49559
  (0, import_react299.useEffect)(() => {
49521
49560
  setLimit(pageSize);
49522
49561
  }, [questionKey, pageSize]);
@@ -50748,7 +50787,7 @@ function RecordCard({
50748
50787
  /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "block truncate", children: label }),
50749
50788
  parentName ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-parent": parentId ?? "", children: `Sub-item of ${parentName}` }) : null,
50750
50789
  dates && dates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(CardDates, { record, fields: dates }) : null,
50751
- (fields ?? []).filter((f) => (0, import_records64.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
50790
+ (fields ?? []).filter((f) => (0, import_records65.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
50752
50791
  RecordValue,
50753
50792
  {
50754
50793
  field: f,
@@ -50769,12 +50808,12 @@ function cardHiddenOf(presentation) {
50769
50808
  }
50770
50809
  var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
50771
50810
  function boardDefaultGroupField(eligible) {
50772
- return eligible.find((f) => (0, import_records64.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
50811
+ return eligible.find((f) => (0, import_records65.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
50773
50812
  }
50774
50813
 
50775
50814
  // src/ArchivedView.tsx
50776
50815
  var import_react301 = require("react");
50777
- var import_records65 = require("@ai-matrx/records");
50816
+ var import_records66 = require("@ai-matrx/records");
50778
50817
  var import_react302 = require("@ai-matrx/records/react");
50779
50818
  var import_design_system147 = require("@ai-matrx/design-system");
50780
50819
  init_Refusal();
@@ -50788,7 +50827,7 @@ function mayNotRestoreLine(why) {
50788
50827
  return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
50789
50828
  }
50790
50829
  function archivedRowLine(row, titleKey) {
50791
- return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records65.archivedByLine)(row)}`;
50830
+ return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records66.archivedByLine)(row)}`;
50792
50831
  }
50793
50832
  function ArchivedView({
50794
50833
  tableId,
@@ -50802,7 +50841,7 @@ function ArchivedView({
50802
50841
  const table = (0, import_react302.useTable)(tableId);
50803
50842
  const rights = useTableRights(table.data);
50804
50843
  const fields = (0, import_react302.useFields)(tableId);
50805
- const [lane, setLane] = (0, import_react301.useState)(laneFromHost ?? import_records65.DEFAULT_ARCHIVE_LANE);
50844
+ const [lane, setLane] = (0, import_react301.useState)(laneFromHost ?? import_records66.DEFAULT_ARCHIVE_LANE);
50806
50845
  const [rows, setRows] = (0, import_react301.useState)([]);
50807
50846
  const [loading, setLoading] = (0, import_react301.useState)(true);
50808
50847
  const [error, setError] = (0, import_react301.useState)(null);
@@ -50849,15 +50888,15 @@ function ArchivedView({
50849
50888
  return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: (0, import_design_system147.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
50850
50889
  /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
50851
50890
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
50852
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records65.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
50891
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records66.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
50853
50892
  import_design_system147.Button,
50854
50893
  {
50855
50894
  size: "sm",
50856
50895
  variant: option === lane ? "secondary" : "ghost",
50857
50896
  "aria-pressed": option === lane,
50858
- title: import_records65.ARCHIVE_LANE_MEANS[option],
50897
+ title: import_records66.ARCHIVE_LANE_MEANS[option],
50859
50898
  onClick: () => pick(option),
50860
- children: import_records65.ARCHIVE_LANE_LABEL[option]
50899
+ children: import_records66.ARCHIVE_LANE_LABEL[option]
50861
50900
  },
50862
50901
  option
50863
50902
  )) })
@@ -50873,7 +50912,7 @@ function ArchivedView({
50873
50912
  ),
50874
50913
  error ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(RefusalNotice, { error }) : null,
50875
50914
  loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_design_system147.Skeleton, { className: "h-24 w-full" }) : null,
50876
- !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records65.emptyArchiveLine)(lane) }) : null,
50915
+ !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records66.emptyArchiveLine)(lane) }) : null,
50877
50916
  !loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
50878
50917
  "li",
50879
50918
  {
@@ -50883,7 +50922,7 @@ function ArchivedView({
50883
50922
  children: [
50884
50923
  /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
50885
50924
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
50886
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records65.archivedByLine)(row) }),
50925
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records66.archivedByLine)(row) }),
50887
50926
  refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
50888
50927
  ] }),
50889
50928
  mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
@@ -50906,7 +50945,7 @@ function ArchivedView({
50906
50945
  ] });
50907
50946
  }
50908
50947
  function retiredColumnLine(row) {
50909
- return (0, import_records65.archivedByLine)(row);
50948
+ return (0, import_records66.archivedByLine)(row);
50910
50949
  }
50911
50950
  function RetiredColumns({ tableId, mayRestore, whyNot }) {
50912
50951
  const client = (0, import_react302.useRecordsClient)();
@@ -50970,7 +51009,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
50970
51009
 
50971
51010
  // src/ArchivedDisclosure.tsx
50972
51011
  var import_react303 = require("react");
50973
- var import_records66 = require("@ai-matrx/records");
51012
+ var import_records67 = require("@ai-matrx/records");
50974
51013
  var import_react304 = require("@ai-matrx/records/react");
50975
51014
  var import_design_system148 = require("@ai-matrx/design-system");
50976
51015
  init_Refusal();
@@ -51035,10 +51074,10 @@ function ArchivedPortals({
51035
51074
  error ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(RefusalNotice, { error }) : null,
51036
51075
  rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(import_design_system148.Skeleton, { className: "h-16 w-full" }) : null,
51037
51076
  said2 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
51038
- rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records66.emptyPortalArchiveLine)() }) : null,
51077
+ rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records67.emptyPortalArchiveLine)() }) : null,
51039
51078
  rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
51040
51079
  const asking = confirming === portal.portal_id;
51041
- const matches2 = (0, import_records66.portalTitleTypedBack)(typed2, portal.title);
51080
+ const matches2 = (0, import_records67.portalTitleTypedBack)(typed2, portal.title);
51042
51081
  return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
51043
51082
  "li",
51044
51083
  {
@@ -51077,7 +51116,7 @@ function ArchivedPortals({
51077
51116
  ] }),
51078
51117
  asking ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
51079
51118
  /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
51080
- (0, import_records66.portalConfirmLine)(portal.title),
51119
+ (0, import_records67.portalConfirmLine)(portal.title),
51081
51120
  " Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
51082
51121
  ] }),
51083
51122
  /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
@@ -53235,7 +53274,7 @@ function clientNoun(table) {
53235
53274
  var import_clipboard8 = require("@ai-matrx/kit/clipboard");
53236
53275
  var import_react318 = require("react");
53237
53276
  var import_react319 = require("@ai-matrx/records/react");
53238
- var import_records67 = require("@ai-matrx/records");
53277
+ var import_records68 = require("@ai-matrx/records");
53239
53278
  var import_design_system156 = require("@ai-matrx/design-system");
53240
53279
  init_BuildOrAsk();
53241
53280
 
@@ -53683,7 +53722,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
53683
53722
  ] }) : null,
53684
53723
  activePortalId && !shown5.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime181.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,
53685
53724
  /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("ul", { className: "flex flex-col gap-2", children: shown5.map((portal) => {
53686
- const url = `${origin}${(0, import_records67.portalPath)(portal.slug)}`;
53725
+ const url = `${origin}${(0, import_records68.portalPath)(portal.slug)}`;
53687
53726
  const open = openId === portal.portal_id;
53688
53727
  const linked = portal.portal_id === activePortalId;
53689
53728
  return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)(
@@ -53798,8 +53837,8 @@ function ArchivePortalControl({
53798
53837
  }
53799
53838
  ),
53800
53839
  asking ? /* @__PURE__ */ (0, import_jsx_runtime181.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: [
53801
- /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records67.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
53802
- /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records67.portalConfirmLine)(portal.title) }),
53840
+ /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records68.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
53841
+ /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records68.portalConfirmLine)(portal.title) }),
53803
53842
  /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
53804
53843
  /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
53805
53844
  import_design_system156.BasicInput,
@@ -53817,7 +53856,7 @@ function ArchivePortalControl({
53817
53856
  size: "sm",
53818
53857
  variant: "destructive",
53819
53858
  "data-testid": "portal-archive-do",
53820
- disabled: busy || !(0, import_records67.portalTitleTypedBack)(typed2, portal.title),
53859
+ disabled: busy || !(0, import_records68.portalTitleTypedBack)(typed2, portal.title),
53821
53860
  onClick: () => void go(),
53822
53861
  children: busy ? "Archiving\u2026" : "Archive it"
53823
53862
  }
@@ -54342,7 +54381,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
54342
54381
  // src/DigestScheduler.tsx
54343
54382
  var import_react320 = require("react");
54344
54383
  var import_react321 = require("@ai-matrx/records/react");
54345
- var import_records68 = require("@ai-matrx/records");
54384
+ var import_records69 = require("@ai-matrx/records");
54346
54385
  var import_design_system158 = require("@ai-matrx/design-system");
54347
54386
  var import_controls23 = require("@ai-matrx/design-system/controls");
54348
54387
  init_Refusal();
@@ -54433,7 +54472,7 @@ function DigestScheduler({
54433
54472
  const [channel, setChannel] = (0, import_react320.useState)(
54434
54473
  existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
54435
54474
  );
54436
- const [quiet2, setQuiet] = (0, import_react320.useState)((0, import_records68.hasQuietHours)(existing?.quiet_hours));
54475
+ const [quiet2, setQuiet] = (0, import_react320.useState)((0, import_records69.hasQuietHours)(existing?.quiet_hours));
54437
54476
  const [quietFrom, setQuietFrom] = (0, import_react320.useState)(existing?.quiet_hours?.start ?? "22:00");
54438
54477
  const [quietTo, setQuietTo] = (0, import_react320.useState)(existing?.quiet_hours?.end ?? "07:00");
54439
54478
  const [recipients, setRecipients] = (0, import_react320.useState)(
@@ -54724,7 +54763,7 @@ function DigestScheduler({
54724
54763
  // src/SubscriptionsPanel.tsx
54725
54764
  var import_react324 = require("react");
54726
54765
  var import_react325 = require("@ai-matrx/records/react");
54727
- var import_records69 = require("@ai-matrx/records");
54766
+ var import_records70 = require("@ai-matrx/records");
54728
54767
  var import_design_system160 = require("@ai-matrx/design-system");
54729
54768
  init_BuildOrAsk();
54730
54769
  init_Refusal();
@@ -55094,7 +55133,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
55094
55133
  "Last told you ",
55095
55134
  new Date(subscription.last_sent_at).toLocaleString()
55096
55135
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("span", { children: "It has not told you anything yet." }),
55097
- (0, import_records69.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("span", { children: [
55136
+ (0, import_records70.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("span", { children: [
55098
55137
  "Not between ",
55099
55138
  subscription.quiet_hours.start,
55100
55139
  " and ",
@@ -55170,7 +55209,7 @@ var import_core25 = require("@dnd-kit/core");
55170
55209
  var import_sortable2 = require("@dnd-kit/sortable");
55171
55210
  var import_utilities2 = require("@dnd-kit/utilities");
55172
55211
  var import_react332 = require("@ai-matrx/records/react");
55173
- var import_records70 = require("@ai-matrx/records");
55212
+ var import_records71 = require("@ai-matrx/records");
55174
55213
  var import_design_system165 = require("@ai-matrx/design-system");
55175
55214
 
55176
55215
  // src/FormFlowEditor.tsx
@@ -56787,7 +56826,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
56787
56826
  /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
56788
56827
  PublishRow,
56789
56828
  {
56790
- url: `${publicOrigin}${(0, import_records70.publicFormPath)(draft.id)}`,
56829
+ url: `${publicOrigin}${(0, import_records71.publicFormPath)(draft.id)}`,
56791
56830
  state: draft.state,
56792
56831
  mayPublish: rights.structure,
56793
56832
  why: rights.why("structure"),
@@ -56799,7 +56838,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
56799
56838
  unsaved: dirty
56800
56839
  }
56801
56840
  ),
56802
- /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records70.publicFormPath)(draft.id)}`, label: draft.name }),
56841
+ /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records71.publicFormPath)(draft.id)}`, label: draft.name }),
56803
56842
  /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
56804
56843
  NotifyOnAnswer,
56805
56844
  {
@@ -57742,7 +57781,7 @@ function SignBlock({ tableId, recordId, render, className }) {
57742
57781
  // src/NotifyRuleEditor.tsx
57743
57782
  var import_react338 = require("react");
57744
57783
  var import_react339 = require("@ai-matrx/records/react");
57745
- var import_records71 = require("@ai-matrx/records");
57784
+ var import_records72 = require("@ai-matrx/records");
57746
57785
  var import_design_system168 = require("@ai-matrx/design-system");
57747
57786
  var import_controls26 = require("@ai-matrx/design-system/controls");
57748
57787
  init_Refusal();
@@ -57900,7 +57939,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
57900
57939
  "next ",
57901
57940
  new Date(held.next_digest_at).toLocaleString()
57902
57941
  ] }) : null,
57903
- (0, import_records71.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("span", { className: "text-muted-foreground", children: [
57942
+ (0, import_records72.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("span", { className: "text-muted-foreground", children: [
57904
57943
  "quiet ",
57905
57944
  held.quiet_hours.start,
57906
57945
  "\u2013",
@@ -59794,7 +59833,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
59794
59833
  // src/TableAsk.tsx
59795
59834
  var import_react346 = require("react");
59796
59835
  var import_design_system173 = require("@ai-matrx/design-system");
59797
- var import_records72 = require("@ai-matrx/records");
59836
+ var import_records73 = require("@ai-matrx/records");
59798
59837
  var import_react347 = require("@ai-matrx/records/react");
59799
59838
  init_recordVersions();
59800
59839
 
@@ -60043,7 +60082,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
60043
60082
  await Promise.all(
60044
60083
  all.filter(isChoiceField).map(async (field2) => {
60045
60084
  const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field2.id);
60046
- if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records72.optionLabel)(o)).filter((w) => Boolean(w));
60085
+ if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records73.optionLabel)(o)).filter((w) => Boolean(w));
60047
60086
  })
60048
60087
  );
60049
60088
  const read = questionFromWords(words2, all, choices);
@@ -61955,7 +61994,7 @@ function InterfaceScreen({
61955
61994
  var import_clipboard12 = require("@ai-matrx/kit/clipboard");
61956
61995
  var import_react354 = require("react");
61957
61996
  var import_react355 = require("@ai-matrx/records/react");
61958
- var import_records73 = require("@ai-matrx/records");
61997
+ var import_records74 = require("@ai-matrx/records");
61959
61998
  var import_design_system177 = require("@ai-matrx/design-system");
61960
61999
  init_BuildOrAsk();
61961
62000
  init_BuiltOnArchive();
@@ -62071,7 +62110,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
62071
62110
  }
62072
62111
  ) : null,
62073
62112
  /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
62074
- const url = `${origin}${(0, import_records73.publicFormPath)(form.form_id)}`;
62113
+ const url = `${origin}${(0, import_records74.publicFormPath)(form.form_id)}`;
62075
62114
  return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)(
62076
62115
  "li",
62077
62116
  {
@@ -62162,7 +62201,7 @@ init_plainWords();
62162
62201
 
62163
62202
  // src/CaptureRun.tsx
62164
62203
  var import_react356 = require("react");
62165
- var import_records74 = require("@ai-matrx/records");
62204
+ var import_records75 = require("@ai-matrx/records");
62166
62205
  var import_react357 = require("@ai-matrx/records/react");
62167
62206
  var import_design_system178 = require("@ai-matrx/design-system");
62168
62207
  init_host();
@@ -62229,7 +62268,7 @@ function CaptureRun({ sheetId, face: given, className }) {
62229
62268
  const [sending, setSending] = (0, import_react356.useState)(false);
62230
62269
  const queueRef = (0, import_react356.useRef)(null);
62231
62270
  (0, import_react356.useEffect)(() => {
62232
- const q2 = (0, import_records74.openCaptureQueue)({
62271
+ const q2 = (0, import_records75.openCaptureQueue)({
62233
62272
  onChange: (c, all) => {
62234
62273
  setCounts(c);
62235
62274
  setItems(all);
@@ -62499,7 +62538,7 @@ function CaptureRun({ sheetId, face: given, className }) {
62499
62538
  value: String(answers2[q.field] ?? ""),
62500
62539
  onChange: (e) => {
62501
62540
  const raw = e.target.value;
62502
- const answered2 = field2 ? (0, import_records74.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records74.coercionLabel)(field2) }) : { value: raw };
62541
+ const answered2 = field2 ? (0, import_records75.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records75.coercionLabel)(field2) }) : { value: raw };
62503
62542
  setAnswers((held) => ({
62504
62543
  ...held,
62505
62544
  [q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
@@ -63165,7 +63204,7 @@ init_WhereItLives();
63165
63204
  // src/TablePage.tsx
63166
63205
  var import_clipboard17 = require("@ai-matrx/kit/clipboard");
63167
63206
  var import_react377 = require("react");
63168
- var import_records75 = require("@ai-matrx/records");
63207
+ var import_records76 = require("@ai-matrx/records");
63169
63208
  var import_react378 = require("@ai-matrx/records/react");
63170
63209
  var import_design_system190 = require("@ai-matrx/design-system");
63171
63210
  init_names();
@@ -64412,7 +64451,7 @@ function TableNotHere({
64412
64451
  return /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: (0, import_design_system190.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
64413
64452
  /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
64414
64453
  /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
64415
- /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records75.archivedByLine)(row) }),
64454
+ /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records76.archivedByLine)(row) }),
64416
64455
  refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(RefusalNotice, { error: refusal3 }) : null,
64417
64456
  /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex gap-2", children: [
64418
64457
  /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
@@ -66170,7 +66209,7 @@ init_objectActionIcons();
66170
66209
 
66171
66210
  // src/DataBindingPicker.tsx
66172
66211
  var import_react381 = require("react");
66173
- var import_records76 = require("@ai-matrx/records");
66212
+ var import_records77 = require("@ai-matrx/records");
66174
66213
  var import_react382 = require("@ai-matrx/records/react");
66175
66214
  var import_design_system193 = require("@ai-matrx/design-system");
66176
66215
  init_names();
@@ -66205,7 +66244,7 @@ function isCompleteDataBinding(binding) {
66205
66244
  }
66206
66245
  function bindingPlaceholdersFor(field2) {
66207
66246
  const label = fieldName(field2);
66208
- if ((0, import_records76.isEntityReferenceConfig)(field2.config)) {
66247
+ if ((0, import_records77.isEntityReferenceConfig)(field2.config)) {
66209
66248
  return [
66210
66249
  { token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
66211
66250
  { token: `{${field2.key}.id}`, label: `${label} \xB7 id` }