@ai-matrx/records-ui 0.113.2 → 0.113.4

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
@@ -1240,7 +1240,7 @@ var import_design_system7 = require("@ai-matrx/design-system");
1240
1240
  var REVERSE_COLUMN_PREFIX = "linked:";
1241
1241
 
1242
1242
  // src/gridPage.ts
1243
- var import_records4 = require("@ai-matrx/records");
1243
+ var import_records5 = require("@ai-matrx/records");
1244
1244
  var import_data_table2 = require("@ai-matrx/design-system/data-table");
1245
1245
 
1246
1246
  // src/personTime.ts
@@ -1292,6 +1292,7 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
1292
1292
  }
1293
1293
 
1294
1294
  // src/choiceLooks.ts
1295
+ var import_records2 = require("@ai-matrx/records");
1295
1296
  var import_data_table = require("@ai-matrx/design-system/data-table");
1296
1297
  function displayFormatOf(field2) {
1297
1298
  const raw = field2.display_format;
@@ -1326,6 +1327,20 @@ function choiceLooksOf(field2) {
1326
1327
  function choiceWord(value) {
1327
1328
  return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
1328
1329
  }
1330
+ var STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
1331
+ function statusGroupColor(field2, value) {
1332
+ if ((0, import_records2.newerKindOf)(field2) !== "status" || value === null || value === void 0 || value === "") return void 0;
1333
+ const word = choiceWord(value);
1334
+ if (word === "") return void 0;
1335
+ const groups = (field2.config ?? {})["status_groups"];
1336
+ if (groups && typeof groups === "object") {
1337
+ for (const [key, group] of Object.entries(groups)) {
1338
+ if (choiceWord(key) !== word) continue;
1339
+ return group === "in_progress" ? STATUS_GROUP_COLOR.in_progress : group === "done" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;
1340
+ }
1341
+ }
1342
+ return STATUS_GROUP_COLOR.todo;
1343
+ }
1329
1344
  function storedChoiceColor(field2, value) {
1330
1345
  if (value === null || value === void 0 || value === "") return void 0;
1331
1346
  const word = choiceWord(value);
@@ -1334,7 +1349,7 @@ function storedChoiceColor(field2, value) {
1334
1349
  if (!look.color) continue;
1335
1350
  if (choiceWord(look.value) === word || look.label && choiceWord(look.label) === word) return look.color;
1336
1351
  }
1337
- return void 0;
1352
+ return statusGroupColor(field2, value);
1338
1353
  }
1339
1354
  function storedChoiceColorLookup(fields, fallback) {
1340
1355
  const byKey = new Map(fields.map((f) => [f.key, f]));
@@ -1358,7 +1373,7 @@ function choiceChipLookOf(field2, ...words2) {
1358
1373
  }
1359
1374
 
1360
1375
  // src/parity.ts
1361
- var import_records3 = require("@ai-matrx/records");
1376
+ var import_records4 = require("@ai-matrx/records");
1362
1377
  var import_text_case2 = require("@ai-matrx/kit/text-case");
1363
1378
 
1364
1379
  // src/docs.ts
@@ -1384,7 +1399,7 @@ function isSignatureField(field2) {
1384
1399
  }
1385
1400
 
1386
1401
  // src/fieldTypes.ts
1387
- var import_records2 = require("@ai-matrx/records");
1402
+ var import_records3 = require("@ai-matrx/records");
1388
1403
  var LOOK_KINDS = {
1389
1404
  rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
1390
1405
  time: { plain: "text", look: () => ({ id: "time" }) }
@@ -1393,9 +1408,9 @@ function declaredAsLook(kind) {
1393
1408
  return kind in LOOK_KINDS && !storePublishesKind(kind);
1394
1409
  }
1395
1410
  function storePublishesKind(kind) {
1396
- return import_records2.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
1411
+ return import_records3.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
1397
1412
  }
1398
- var STORE_PUBLISHES_ENTITY_REFERENCE = import_records2.DECLARABLE_FIELD_KINDS.some(
1413
+ var STORE_PUBLISHES_ENTITY_REFERENCE = import_records3.DECLARABLE_FIELD_KINDS.some(
1399
1414
  (row) => row.kind === "entity_reference"
1400
1415
  );
1401
1416
  var SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
@@ -1442,7 +1457,7 @@ var FIELD_TYPE_CATALOGUE = [
1442
1457
  { id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
1443
1458
  { id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
1444
1459
  ];
1445
- var GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_records2.NEWER_FIELD_KINDS]);
1460
+ var GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_records3.NEWER_FIELD_KINDS]);
1446
1461
  var FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
1447
1462
  (c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
1448
1463
  );
@@ -1463,20 +1478,20 @@ function isRelationFieldType(id) {
1463
1478
  return id === "relation";
1464
1479
  }
1465
1480
  function isParityFieldType(id) {
1466
- return import_records2.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
1481
+ return import_records3.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
1467
1482
  }
1468
1483
  function parityTypesWithNoExplanation() {
1469
- return import_records2.PARITY_FIELD_TYPES.map((row) => row.parity_type).filter((type) => !BY_ID.has(type));
1484
+ return import_records3.PARITY_FIELD_TYPES.map((row) => row.parity_type).filter((type) => !BY_ID.has(type));
1470
1485
  }
1471
1486
  function kindsWithNoChoice() {
1472
- return import_records2.DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind) => !BY_ID.has(kind));
1487
+ return import_records3.DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind) => !BY_ID.has(kind));
1473
1488
  }
1474
1489
  var ADD_FIELD_OPEN_LABEL = "Add column";
1475
1490
  var ADD_FIELD_SAVE_LABEL = "Create column";
1476
1491
  var EDIT_FIELD_SAVE_LABEL = "Save column";
1477
1492
 
1478
1493
  // src/parity.ts
1479
- var kernelId = (name) => import_records3.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
1494
+ var kernelId = (name) => import_records4.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
1480
1495
  var KERNEL_FILE_TABLE = kernelId("File");
1481
1496
  var KERNEL_PERSON_TABLE = kernelId("Person");
1482
1497
  var PARITY_LABEL = {
@@ -1496,15 +1511,15 @@ var PARITY_LABEL = {
1496
1511
  url: "Link"
1497
1512
  };
1498
1513
  var PARITY_MADE_OF = Object.fromEntries(
1499
- import_records3.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
1514
+ import_records4.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
1500
1515
  );
1501
1516
  var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
1502
1517
  function editorKindFor(field2) {
1503
- return (0, import_records3.fieldKindFor)(field2, KERNEL);
1518
+ return (0, import_records4.fieldKindFor)(field2, KERNEL);
1504
1519
  }
1505
1520
  function pickableTypeOf(field2) {
1506
1521
  if (isSignatureField(field2)) return "signature";
1507
- const newer = (0, import_records3.newerKindOf)(field2);
1522
+ const newer = (0, import_records4.newerKindOf)(field2);
1508
1523
  if (newer) return newer;
1509
1524
  const look = displayFormatOf(field2)?.id;
1510
1525
  if (look === "rating" && field2.type === "range") return "rating";
@@ -1661,7 +1676,7 @@ function storeQuestion(fields, base, columnFilters, now = /* @__PURE__ */ new Da
1661
1676
  const refused = [];
1662
1677
  const flat = {};
1663
1678
  const rules = [];
1664
- if (base && (0, import_records4.isRuleFilter)(base)) rules.push(base);
1679
+ if (base && (0, import_records5.isRuleFilter)(base)) rules.push(base);
1665
1680
  else if (base) Object.assign(flat, base);
1666
1681
  for (const [key, value] of Object.entries(columnFilters)) {
1667
1682
  if (!value) continue;
@@ -1766,7 +1781,7 @@ var ENRICH_CELLS_FRESH_MS = 5e3;
1766
1781
  // src/labels.tsx
1767
1782
  var import_react7 = require("react");
1768
1783
  var import_react8 = require("@ai-matrx/records/react");
1769
- var import_records5 = require("@ai-matrx/records");
1784
+ var import_records6 = require("@ai-matrx/records");
1770
1785
  var import_uuid2 = require("@ai-matrx/kit/uuid");
1771
1786
 
1772
1787
  // src/signature.tsx
@@ -2073,7 +2088,7 @@ function pointsAtRecords(field2) {
2073
2088
  }
2074
2089
  function shownValue(field2, value, labels) {
2075
2090
  if (isSignatureField(field2)) return signatureWords(value);
2076
- const newerWords = value === null || value === void 0 ? null : (0, import_records5.newerKindExportWords)(field2, value);
2091
+ const newerWords = value === null || value === void 0 ? null : (0, import_records6.newerKindExportWords)(field2, value);
2077
2092
  if (newerWords !== null) return newerWords;
2078
2093
  if (!labels || !pointsAtRecords(field2)) return value;
2079
2094
  const ids = idsOf(value);
@@ -2138,7 +2153,7 @@ function RecordLabelProvider({ children }) {
2138
2153
  for (const option of result.data ?? []) {
2139
2154
  const words2 = recordName(option.data, null, "Unnamed choice");
2140
2155
  next[option.id] = words2;
2141
- const key = (0, import_records5.optionKey)(option);
2156
+ const key = (0, import_records6.optionKey)(option);
2142
2157
  if (key) next[choiceKeyName(field2.id, key)] = words2;
2143
2158
  }
2144
2159
  return next;
@@ -2434,7 +2449,7 @@ function gridCopyConfig(args) {
2434
2449
 
2435
2450
  // src/FieldRetype.tsx
2436
2451
  var import_react9 = require("react");
2437
- var import_records6 = require("@ai-matrx/records");
2452
+ var import_records7 = require("@ai-matrx/records");
2438
2453
  var import_react10 = require("@ai-matrx/records/react");
2439
2454
  var import_design_system3 = require("@ai-matrx/design-system");
2440
2455
 
@@ -2577,7 +2592,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
2577
2592
  return;
2578
2593
  }
2579
2594
  const groups = answer.data.map((row) => ({ value: row.groups[field2.key] ?? null, count: row.row_count }));
2580
- setPreview((0, import_records6.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
2595
+ setPreview((0, import_records7.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
2581
2596
  });
2582
2597
  return () => {
2583
2598
  cancelled = true;
@@ -3768,7 +3783,7 @@ var import_core3 = require("@ai-matrx/records/core");
3768
3783
 
3769
3784
  // src/tablePicking.tsx
3770
3785
  var import_react16 = require("react");
3771
- var import_records7 = require("@ai-matrx/records");
3786
+ var import_records8 = require("@ai-matrx/records");
3772
3787
  var import_react17 = require("@ai-matrx/records/react");
3773
3788
  var import_design_system8 = require("@ai-matrx/design-system");
3774
3789
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -3832,7 +3847,7 @@ function usePickerTables() {
3832
3847
  };
3833
3848
  }, [client, nonce]);
3834
3849
  const data = (0, import_react16.useMemo)(
3835
- () => (0, import_records7.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
3850
+ () => (0, import_records8.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
3836
3851
  [tables.data, facts]
3837
3852
  );
3838
3853
  return { loading: tables.loading || facts === "reading", data, reload };
@@ -4183,7 +4198,7 @@ function ReferenceBuilder({
4183
4198
 
4184
4199
  // src/PersonPicker.tsx
4185
4200
  var import_react20 = require("react");
4186
- var import_records8 = require("@ai-matrx/records");
4201
+ var import_records9 = require("@ai-matrx/records");
4187
4202
  var import_react21 = require("@ai-matrx/records/react");
4188
4203
  var import_design_system10 = require("@ai-matrx/design-system");
4189
4204
  var import_jsx_runtime12 = require("react/jsx-runtime");
@@ -4265,7 +4280,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
4265
4280
  cancelled = true;
4266
4281
  };
4267
4282
  }, [client, personTable, picked.length, people.length]);
4268
- const listed = (0, import_records8.rankTypedMatches)(members ?? [], search, memberName);
4283
+ const listed = (0, import_records9.rankTypedMatches)(members ?? [], search, memberName);
4269
4284
  if (!membersPort || !client) {
4270
4285
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: (0, import_design_system10.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
4271
4286
  }
@@ -4377,7 +4392,7 @@ var import_design_system25 = require("@ai-matrx/design-system");
4377
4392
  var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
4378
4393
  var import_data_table3 = require("@ai-matrx/design-system/data-table");
4379
4394
  var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
4380
- var import_records9 = require("@ai-matrx/records");
4395
+ var import_records10 = require("@ai-matrx/records");
4381
4396
 
4382
4397
  // src/dates.ts
4383
4398
  var import_field_formats = require("@ai-matrx/design-system/field-formats");
@@ -4655,8 +4670,8 @@ function shownAsOf(field2) {
4655
4670
  }
4656
4671
  function formatForField(field2) {
4657
4672
  const shownAs = shownAsOf(field2);
4658
- if ((0, import_records9.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
4659
- return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_records9.ratingMaxOf)(field2) } };
4673
+ if ((0, import_records10.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
4674
+ return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_records10.ratingMaxOf)(field2) } };
4660
4675
  }
4661
4676
  if (shownAs) return shownAs;
4662
4677
  const stamp = dateFormatFor(field2);
@@ -4778,28 +4793,28 @@ function resolveTableStyle(decorations, fields, viewStyle) {
4778
4793
 
4779
4794
  // src/editors.tsx
4780
4795
  var import_react36 = require("react");
4781
- var import_records14 = require("@ai-matrx/records");
4796
+ var import_records15 = require("@ai-matrx/records");
4782
4797
  var import_react37 = require("@ai-matrx/records/react");
4783
4798
  var import_design_system19 = require("@ai-matrx/design-system");
4784
4799
 
4785
4800
  // src/newerKindValues.tsx
4786
4801
  var import_react22 = require("react");
4787
4802
  var import_source = require("@ai-matrx/content-ir/source");
4788
- var import_records10 = require("@ai-matrx/records");
4803
+ var import_records11 = require("@ai-matrx/records");
4789
4804
  var import_design_system11 = require("@ai-matrx/design-system");
4790
4805
  var import_jsx_runtime13 = require("react/jsx-runtime");
4791
4806
  var own = (event) => event.stopPropagation();
4792
4807
  function newerKindValue(field2, value, opts = {}) {
4793
- switch ((0, import_records10.newerKindOf)(field2)) {
4808
+ switch ((0, import_records11.newerKindOf)(field2)) {
4794
4809
  case "duration": {
4795
- const words2 = (0, import_records10.durationText)(value);
4810
+ const words2 = (0, import_records11.durationText)(value);
4796
4811
  return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
4797
4812
  }
4798
4813
  case "created_by":
4799
4814
  case "modified_by":
4800
- return (0, import_records10.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonStampChip, { stamp: value }) : void 0;
4815
+ return (0, import_records11.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonStampChip, { stamp: value }) : void 0;
4801
4816
  case "address":
4802
- return (0, import_records10.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AddressLink, { value }) : void 0;
4817
+ return (0, import_records11.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AddressLink, { value }) : void 0;
4803
4818
  case "barcode":
4804
4819
  return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
4805
4820
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
@@ -4814,7 +4829,7 @@ function newerKindValue(field2, value, opts = {}) {
4814
4829
  }
4815
4830
  }
4816
4831
  function PersonStampChip({ stamp }) {
4817
- const words2 = (0, import_records10.personStampText)(stamp) ?? import_records10.NOT_A_MEMBER_WORDS;
4832
+ const words2 = (0, import_records11.personStampText)(stamp) ?? import_records11.NOT_A_MEMBER_WORDS;
4818
4833
  const tier = stamp.actor ?? "user";
4819
4834
  const name = tier === "user" ? stamp.name : null;
4820
4835
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
@@ -4831,8 +4846,8 @@ function PersonStampChip({ stamp }) {
4831
4846
  ] });
4832
4847
  }
4833
4848
  function AddressLink({ value }) {
4834
- const words2 = (0, import_records10.addressText)(value);
4835
- const href = (0, import_records10.addressMapUrl)(value);
4849
+ const words2 = (0, import_records11.addressText)(value);
4850
+ const href = (0, import_records11.addressMapUrl)(value);
4836
4851
  if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4837
4852
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4838
4853
  "a",
@@ -4853,11 +4868,11 @@ function AddressLink({ value }) {
4853
4868
  }
4854
4869
  var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
4855
4870
  function statusMarkOf(field2, value, document2) {
4856
- if ((0, import_records10.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
4871
+ if ((0, import_records11.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
4857
4872
  const chosen = document2?.["_choices"]?.[field2.key];
4858
4873
  const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
4859
- const group = (0, import_records10.statusGroupOf)(field2, key);
4860
- return { mark: STATUS_GROUP_MARK[group], group, words: import_records10.STATUS_GROUP_WORDS[group] };
4874
+ const group = (0, import_records11.statusGroupOf)(field2, key);
4875
+ return { mark: STATUS_GROUP_MARK[group], group, words: import_records11.STATUS_GROUP_WORDS[group] };
4861
4876
  }
4862
4877
  function inline(text2, key) {
4863
4878
  const out = [];
@@ -4885,7 +4900,7 @@ function marks(text2, key) {
4885
4900
  if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: tok.slice(2, -2) }, k));
4886
4901
  else if (tok.startsWith("[")) {
4887
4902
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
4888
- const href = (0, import_records10.safeLinkHref)(link?.[2] ?? "");
4903
+ const href = (0, import_records11.safeLinkHref)(link?.[2] ?? "");
4889
4904
  out.push(
4890
4905
  href ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href, target: "_blank", rel: "noopener noreferrer", className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
4891
4906
  );
@@ -4950,7 +4965,7 @@ function SafeMarkdown({ text: text2, clipped }) {
4950
4965
  );
4951
4966
  }
4952
4967
  function newerKindControl(props) {
4953
- switch ((0, import_records10.newerKindOf)(props.field)) {
4968
+ switch ((0, import_records11.newerKindOf)(props.field)) {
4954
4969
  case "duration":
4955
4970
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DurationControl, { ...props });
4956
4971
  case "address":
@@ -4966,10 +4981,10 @@ function newerKindControl(props) {
4966
4981
  }
4967
4982
  }
4968
4983
  function DurationControl({ value, onChange, disabled, id }) {
4969
- const [text2, setText] = (0, import_react22.useState)(() => (0, import_records10.durationText)(value) ?? "");
4984
+ const [text2, setText] = (0, import_react22.useState)(() => (0, import_records11.durationText)(value) ?? "");
4970
4985
  const [wrong, setWrong] = (0, import_react22.useState)(false);
4971
4986
  (0, import_react22.useEffect)(() => {
4972
- setText((0, import_records10.durationText)(value) ?? "");
4987
+ setText((0, import_records11.durationText)(value) ?? "");
4973
4988
  }, [value]);
4974
4989
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex flex-col gap-1", children: [
4975
4990
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -4989,12 +5004,12 @@ function DurationControl({ value, onChange, disabled, id }) {
4989
5004
  onChange(null);
4990
5005
  return;
4991
5006
  }
4992
- const seconds = (0, import_records10.readTypedDuration)(e.target.value);
5007
+ const seconds = (0, import_records11.readTypedDuration)(e.target.value);
4993
5008
  setWrong(seconds === null);
4994
5009
  if (seconds !== null) onChange(seconds);
4995
5010
  },
4996
5011
  onBlur: () => {
4997
- if (!wrong) setText((0, import_records10.durationText)(value) ?? "");
5012
+ if (!wrong) setText((0, import_records11.durationText)(value) ?? "");
4998
5013
  }
4999
5014
  }
5000
5015
  ),
@@ -5016,13 +5031,13 @@ var ADDRESS_EXAMPLES = {
5016
5031
  country: "US"
5017
5032
  };
5018
5033
  function AddressControl({ value, onChange, disabled, id }) {
5019
- const held = (0, import_records10.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5034
+ const held = (0, import_records11.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5020
5035
  const set = (part, words2) => {
5021
5036
  const next = { ...held, [part]: words2 };
5022
5037
  const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
5023
5038
  onChange(Object.keys(kept).length === 0 ? null : kept);
5024
5039
  };
5025
- return /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)(
5040
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records11.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5026
5041
  import_design_system11.BasicInput,
5027
5042
  {
5028
5043
  "aria-label": ADDRESS_LABELS[part],
@@ -5099,7 +5114,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
5099
5114
 
5100
5115
  // src/RelationPicker.tsx
5101
5116
  var import_react23 = require("react");
5102
- var import_records11 = require("@ai-matrx/records");
5117
+ var import_records12 = require("@ai-matrx/records");
5103
5118
  var import_react24 = require("@ai-matrx/records/react");
5104
5119
  var import_design_system12 = require("@ai-matrx/design-system");
5105
5120
 
@@ -5289,7 +5304,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
5289
5304
  toggle(createdId);
5290
5305
  };
5291
5306
  const apart = tellApart(rows ?? [], titleOf);
5292
- const visible = (0, import_records11.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5307
+ const visible = (0, import_records12.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5293
5308
  const anchored = autoOpen === true;
5294
5309
  const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5295
5310
  RecordChip,
@@ -5677,14 +5692,14 @@ function AttachmentControl({
5677
5692
 
5678
5693
  // src/EntityReferenceControl.tsx
5679
5694
  var import_react28 = require("react");
5680
- var import_records12 = require("@ai-matrx/records");
5695
+ var import_records13 = require("@ai-matrx/records");
5681
5696
  var import_react29 = require("@ai-matrx/records/react");
5682
5697
  var import_design_system15 = require("@ai-matrx/design-system");
5683
5698
  var import_jsx_runtime17 = require("react/jsx-runtime");
5684
5699
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
5685
5700
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
5686
5701
  function entityReferenceText(value) {
5687
- const refs = (0, import_records12.entityRefsOf)(value);
5702
+ const refs = (0, import_records13.entityRefsOf)(value);
5688
5703
  if (refs.length === 0) return "\u2014";
5689
5704
  return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
5690
5705
  }
@@ -5698,7 +5713,7 @@ function EntityReferenceControl(props) {
5698
5713
  return client ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chips, { ...props, words: null, picker: null });
5699
5714
  }
5700
5715
  function WithWords(props) {
5701
- const refs = (0, import_react28.useMemo)(() => (0, import_records12.entityRefsOf)(props.value), [props.value]);
5716
+ const refs = (0, import_react28.useMemo)(() => (0, import_records13.entityRefsOf)(props.value), [props.value]);
5702
5717
  const [known, setKnown] = (0, import_react28.useState)([]);
5703
5718
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
5704
5719
  const unlabelled = (0, import_react28.useMemo)(
@@ -5716,7 +5731,7 @@ function WithWords(props) {
5716
5731
  setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
5717
5732
  const multi = Boolean(props.field.multi);
5718
5733
  const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
5719
- props.onChange((0, import_records12.entityRefsToWrite)(next, multi));
5734
+ props.onChange((0, import_records13.entityRefsToWrite)(next, multi));
5720
5735
  }
5721
5736
  }
5722
5737
  );
@@ -5805,7 +5820,7 @@ function Chips({
5805
5820
  words: words2,
5806
5821
  picker
5807
5822
  }) {
5808
- const refs = (0, import_react28.useMemo)(() => (0, import_records12.entityRefsOf)(value), [value]);
5823
+ const refs = (0, import_react28.useMemo)(() => (0, import_records13.entityRefsOf)(value), [value]);
5809
5824
  const labelOf = (token2, refId, own3) => {
5810
5825
  if (own3) return own3;
5811
5826
  const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
@@ -5829,7 +5844,7 @@ function Chips({
5829
5844
  "aria-label": `Take ${label} off`,
5830
5845
  onClick: () => {
5831
5846
  const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
5832
- onChange((0, import_records12.entityRefsToWrite)(rest, multi));
5847
+ onChange((0, import_records13.entityRefsToWrite)(rest, multi));
5833
5848
  },
5834
5849
  children: "\xD7"
5835
5850
  }
@@ -6159,7 +6174,7 @@ function formatControl(args) {
6159
6174
  // src/typedDateHelper.tsx
6160
6175
  var import_react33 = require("react");
6161
6176
  var import_design_system18 = require("@ai-matrx/design-system");
6162
- var import_records13 = require("@ai-matrx/records");
6177
+ var import_records14 = require("@ai-matrx/records");
6163
6178
  var import_jsx_runtime21 = require("react/jsx-runtime");
6164
6179
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
6165
6180
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -6168,12 +6183,12 @@ function pad2(n) {
6168
6183
  }
6169
6184
  function readBox(text2, kind) {
6170
6185
  if (kind === "time") {
6171
- const t = (0, import_records13.readTypedTime)(text2);
6186
+ const t = (0, import_records14.readTypedTime)(text2);
6172
6187
  if (!t.ok) return { day: null, time: null };
6173
6188
  const [h, m] = t.value.split(":").map(Number);
6174
6189
  return { day: null, time: { h, m } };
6175
6190
  }
6176
- const read = (0, import_records13.readTypedDate)(text2, { withTime: kind === "datetime" });
6191
+ const read = (0, import_records14.readTypedDate)(text2, { withTime: kind === "datetime" });
6177
6192
  if (!read.ok) return { day: null, time: null };
6178
6193
  if (kind === "datetime" && read.instant) {
6179
6194
  const at = new Date(read.instant);
@@ -6182,10 +6197,10 @@ function readBox(text2, kind) {
6182
6197
  return { day: read.day, time: null };
6183
6198
  }
6184
6199
  function wordsFor(kind, day, time) {
6185
- if (kind === "time") return time ? (0, import_records13.typedTimeText)(time.h, time.m) : "";
6200
+ if (kind === "time") return time ? (0, import_records14.typedTimeText)(time.h, time.m) : "";
6186
6201
  if (!day) return "";
6187
- const dayText = (0, import_records13.typedDateText)(day);
6188
- return kind === "datetime" && time ? `${dayText} ${(0, import_records13.typedTimeText)(time.h, time.m)}` : dayText;
6202
+ const dayText = (0, import_records14.typedDateText)(day);
6203
+ return kind === "datetime" && time ? `${dayText} ${(0, import_records14.typedTimeText)(time.h, time.m)}` : dayText;
6189
6204
  }
6190
6205
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
6191
6206
  function CalendarGlyph() {
@@ -6205,9 +6220,10 @@ function TypedDateHelper({
6205
6220
  text: text2,
6206
6221
  onText,
6207
6222
  label,
6208
- onPicked
6223
+ onPicked,
6224
+ startOpen = false
6209
6225
  }) {
6210
- const [open, setOpen] = (0, import_react33.useState)(false);
6226
+ const [open, setOpen] = (0, import_react33.useState)(startOpen);
6211
6227
  const held = readBox(text2, kind);
6212
6228
  usePersonTimeZone();
6213
6229
  const today = personWallNow();
@@ -6306,7 +6322,7 @@ function TypedDateHelper({
6306
6322
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
6307
6323
  ),
6308
6324
  onClick: () => pickTime(t),
6309
- children: (0, import_records13.typedTimeText)(t.h, t.m)
6325
+ children: (0, import_records14.typedTimeText)(t.h, t.m)
6310
6326
  },
6311
6327
  `${t.h}:${t.m}`
6312
6328
  )) })
@@ -6393,7 +6409,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
6393
6409
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
6394
6410
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
6395
6411
  field2.required ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
6396
- field2.unit && (0, import_records14.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
6412
+ field2.unit && (0, import_records15.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
6397
6413
  children
6398
6414
  ] });
6399
6415
  }
@@ -6428,21 +6444,21 @@ function judgeTyped(field2, text2, choices, nudge) {
6428
6444
  const format = formatForField(field2);
6429
6445
  if (trimmed === "") return { value: null };
6430
6446
  if (format && format.id === "time") {
6431
- const read2 = (0, import_records14.readTypedTime)(trimmed);
6447
+ const read2 = (0, import_records15.readTypedTime)(trimmed);
6432
6448
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
6433
6449
  }
6434
6450
  if (kind === "select" || kind === "multi_select") {
6435
6451
  if (!choices || nudge === null) return null;
6436
6452
  const several = field2.multi || kind === "multi_select";
6437
6453
  const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
6438
- const allowOther = (0, import_records14.allowsOtherValues)(field2);
6454
+ const allowOther = (0, import_records15.allowsOtherValues)(field2);
6439
6455
  const parts = [];
6440
6456
  const add = [];
6441
6457
  const ask = [];
6442
6458
  const notChoices = [];
6443
6459
  let keepOffered = allowOther;
6444
6460
  for (const word of words2) {
6445
- const decided = (0, import_records14.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
6461
+ const decided = (0, import_records15.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
6446
6462
  if (decided.decision === "empty") continue;
6447
6463
  if (decided.decision === "chosen") parts.push(decided.key);
6448
6464
  else {
@@ -6475,7 +6491,7 @@ function judgeTyped(field2, text2, choices, nudge) {
6475
6491
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
6476
6492
  }
6477
6493
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
6478
- const read = (0, import_records14.coerceTypedAnswer)(field2, text2, { label: fieldName(field2), showsAsPercent });
6494
+ const read = (0, import_records15.coerceTypedAnswer)(field2, text2, { label: fieldName(field2), showsAsPercent });
6479
6495
  if ("refusal" in read) {
6480
6496
  if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
6481
6497
  const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
@@ -6496,12 +6512,12 @@ function openingText(field2, value) {
6496
6512
  if (value === null || value === void 0 || value === "") return "";
6497
6513
  const helper = dateHelperKind(field2, value);
6498
6514
  if (helper === "time") {
6499
- const read = (0, import_records14.readTypedTime)(String(value));
6515
+ const read = (0, import_records15.readTypedTime)(String(value));
6500
6516
  if (!read.ok) return String(value);
6501
6517
  const [h, m] = read.value.split(":").map(Number);
6502
- return (0, import_records14.typedTimeText)(h, m);
6518
+ return (0, import_records15.typedTimeText)(h, m);
6503
6519
  }
6504
- if (helper) return (0, import_records14.typedDateText)(value, { withTime: helper === "datetime" });
6520
+ if (helper) return (0, import_records15.typedDateText)(value, { withTime: helper === "datetime" });
6505
6521
  const format = formatForField(field2);
6506
6522
  return format ? typedText(format, value) : String(value);
6507
6523
  }
@@ -6574,7 +6590,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
6574
6590
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
6575
6591
  helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
6576
6592
  box,
6577
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit })
6593
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
6578
6594
  ] }) : box,
6579
6595
  judged === null ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
6580
6596
  "Reading ",
@@ -6605,7 +6621,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
6605
6621
  " ",
6606
6622
  needsChoices ? String(
6607
6623
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
6608
- const option = choices?.find((o) => (0, import_records14.optionKey)(o) === k);
6624
+ const option = choices?.find((o) => (0, import_records15.optionKey)(o) === k);
6609
6625
  return option ? recordName(option.data, null, String(k)) : String(k);
6610
6626
  }).join(", ")
6611
6627
  ) : (() => {
@@ -6781,7 +6797,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
6781
6797
  function typedDatePlaceholder(helper) {
6782
6798
  const time = "h:mm AM";
6783
6799
  if (helper === "time") return time;
6784
- const pattern = (0, import_records14.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
6800
+ const pattern = (0, import_records15.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
6785
6801
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
6786
6802
  }
6787
6803
  function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
@@ -6920,15 +6936,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
6920
6936
  ChoiceAnswer,
6921
6937
  {
6922
6938
  field: field2,
6923
- choices: options.map((option) => ({ key: (0, import_records14.optionKey)(option), label: titled(option) })),
6939
+ choices: options.map((option) => ({ key: (0, import_records15.optionKey)(option), label: titled(option) })),
6924
6940
  value,
6925
6941
  onChange,
6926
6942
  disabled,
6927
6943
  id,
6928
6944
  onChosen,
6929
6945
  isChosen: (choice, v) => {
6930
- const option = options.find((o) => (0, import_records14.optionKey)(o) === choice.key);
6931
- return option ? (0, import_records14.isTheChosen)(option, v) : false;
6946
+ const option = options.find((o) => (0, import_records15.optionKey)(o) === choice.key);
6947
+ return option ? (0, import_records15.isTheChosen)(option, v) : false;
6932
6948
  }
6933
6949
  }
6934
6950
  );
@@ -6948,7 +6964,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
6948
6964
  onCancel,
6949
6965
  initialSearch,
6950
6966
  addsChoices,
6951
- allowOther: (0, import_records14.allowsOtherValues)(field2),
6967
+ allowOther: (0, import_records15.allowsOtherValues)(field2),
6952
6968
  onChoicesChanged: () => {
6953
6969
  if (client) forgetAsked(client, `field_options:${field2.id}`);
6954
6970
  setReread((n) => n + 1);
@@ -6961,19 +6977,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
6961
6977
  }
6962
6978
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
6963
6979
  if (field2.multi) {
6964
- const chosen = options.filter((option) => (0, import_records14.choiceValuesOf)(value).some((v) => (0, import_records14.isTheChosen)(option, v)));
6965
- const picked = new Set(chosen.map((option) => (0, import_records14.optionKey)(option)));
6980
+ const chosen = options.filter((option) => (0, import_records15.choiceValuesOf)(value).some((v) => (0, import_records15.isTheChosen)(option, v)));
6981
+ const picked = new Set(chosen.map((option) => (0, import_records15.optionKey)(option)));
6966
6982
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6967
6983
  import_design_system19.Button,
6968
6984
  {
6969
6985
  type: "button",
6970
6986
  size: "sm",
6971
- variant: picked.has((0, import_records14.optionKey)(option)) ? "default" : "outline",
6987
+ variant: picked.has((0, import_records15.optionKey)(option)) ? "default" : "outline",
6972
6988
  disabled,
6973
6989
  onClick: () => {
6974
6990
  const next = new Set(picked);
6975
- if (next.has((0, import_records14.optionKey)(option))) next.delete((0, import_records14.optionKey)(option));
6976
- else next.add((0, import_records14.optionKey)(option));
6991
+ if (next.has((0, import_records15.optionKey)(option))) next.delete((0, import_records15.optionKey)(option));
6992
+ else next.add((0, import_records15.optionKey)(option));
6977
6993
  onChange(next.size === 0 ? null : [...next]);
6978
6994
  },
6979
6995
  children: titleOf(option)
@@ -6995,11 +7011,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
6995
7011
  }
6996
7012
  );
6997
7013
  }
6998
- const current = options.find((option) => (0, import_records14.isTheChosen)(option, value));
7014
+ const current = options.find((option) => (0, import_records15.isTheChosen)(option, value));
6999
7015
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7000
7016
  import_design_system19.Select,
7001
7017
  {
7002
- value: current ? (0, import_records14.optionKey)(current) : "",
7018
+ value: current ? (0, import_records15.optionKey)(current) : "",
7003
7019
  disabled: disabled ?? false,
7004
7020
  onValueChange: (next) => onChange(next === "" ? null : next),
7005
7021
  ...autoOpen ? {
@@ -7011,7 +7027,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
7011
7027
  } : {},
7012
7028
  children: [
7013
7029
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectValue, { placeholder: "Choose" }) }),
7014
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectItem, { value: (0, import_records14.optionKey)(option), children: titleOf(option) }, option.id)) })
7030
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectItem, { value: (0, import_records15.optionKey)(option), children: titleOf(option) }, option.id)) })
7015
7031
  ]
7016
7032
  }
7017
7033
  );
@@ -7045,23 +7061,23 @@ function OpenChoicePicker({
7045
7061
  const [addRefused, setAddRefused] = (0, import_react36.useState)(null);
7046
7062
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
7047
7063
  const held = withoutAddition(value);
7048
- const current = (0, import_records14.choiceValuesOf)(held.value);
7064
+ const current = (0, import_records15.choiceValuesOf)(held.value);
7049
7065
  const pickedWords = current.map((v) => {
7050
- const option = options.find((o) => (0, import_records14.isTheChosen)(o, v));
7066
+ const option = options.find((o) => (0, import_records15.isTheChosen)(o, v));
7051
7067
  return option ? titleOf(option) : String(v);
7052
7068
  });
7053
- const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records14.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
7069
+ const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records15.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
7054
7070
  const q = search.trim();
7055
- const visible = (0, import_records14.rankTypedMatches)(options, q, titleOf);
7056
- const decided = (0, import_records14.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
7071
+ const visible = (0, import_records15.rankTypedMatches)(options, q, titleOf);
7072
+ const decided = (0, import_records15.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
7057
7073
  const choose = (word, addingIt = false) => {
7058
7074
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
7059
7075
  let next;
7060
7076
  let add2 = [...pending];
7061
7077
  if (field2.multi) {
7062
7078
  const existing = current.map((v) => {
7063
- const option = options.find((o) => (0, import_records14.isTheChosen)(o, v));
7064
- return option ? (0, import_records14.optionKey)(option) : String(v);
7079
+ const option = options.find((o) => (0, import_records15.isTheChosen)(o, v));
7080
+ return option ? (0, import_records15.optionKey)(option) : String(v);
7065
7081
  });
7066
7082
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
7067
7083
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -7097,7 +7113,7 @@ function OpenChoicePicker({
7097
7113
  const foot = null;
7098
7114
  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;
7099
7115
  const listed = visible;
7100
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records14.isTheChosen)(o, v)));
7116
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records15.isTheChosen)(o, v)));
7101
7117
  const cellChips = pickedWords.map((word, i) => {
7102
7118
  const chip = chipOf(pickedOptions[i], word);
7103
7119
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Badge, { variant: "outline", className: (0, import_design_system19.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -7109,7 +7125,7 @@ function OpenChoicePicker({
7109
7125
  label: word,
7110
7126
  chip: chipOf(option, word).className,
7111
7127
  onRemove: () => {
7112
- if (field2.multi) choose(option ? (0, import_records14.optionKey)(option) : String(current[i]));
7128
+ if (field2.multi) choose(option ? (0, import_records15.optionKey)(option) : String(current[i]));
7113
7129
  else onChange(null);
7114
7130
  }
7115
7131
  };
@@ -7140,11 +7156,11 @@ function OpenChoicePicker({
7140
7156
  id: option.id,
7141
7157
  label: titleOf(option),
7142
7158
  chip: chipOf(option, titleOf(option)).className,
7143
- picked: current.some((v) => (0, import_records14.isTheChosen)(option, v))
7159
+ picked: current.some((v) => (0, import_records15.isTheChosen)(option, v))
7144
7160
  })),
7145
7161
  onPick: (optionId) => {
7146
7162
  const option = options.find((o) => o.id === optionId);
7147
- if (option) choose((0, import_records14.optionKey)(option));
7163
+ if (option) choose((0, import_records15.optionKey)(option));
7148
7164
  },
7149
7165
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
7150
7166
  add,
@@ -7200,7 +7216,7 @@ function ChoiceAnswer({
7200
7216
  onChosen
7201
7217
  }) {
7202
7218
  const [search, setSearch] = (0, import_react36.useState)("");
7203
- const held = field2.multi ? (0, import_records14.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
7219
+ const held = field2.multi ? (0, import_records15.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
7204
7220
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
7205
7221
  const press = (choice) => {
7206
7222
  if (!field2.multi) {
@@ -8223,7 +8239,7 @@ function WholeValueEditor({
8223
8239
  var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
8224
8240
 
8225
8241
  // src/ReferenceChips.tsx
8226
- var import_records15 = require("@ai-matrx/records");
8242
+ var import_records16 = require("@ai-matrx/records");
8227
8243
  var import_design_system21 = require("@ai-matrx/design-system");
8228
8244
 
8229
8245
  // src/kindValues.ts
@@ -8295,7 +8311,7 @@ function iconOf(pair) {
8295
8311
  }
8296
8312
  function referencesOf(field2, value, kind, labels) {
8297
8313
  if (kind === "entity_reference") {
8298
- return (0, import_records15.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
8314
+ return (0, import_records16.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
8299
8315
  }
8300
8316
  const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
8301
8317
  const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
@@ -8474,7 +8490,7 @@ function ClampedChips({
8474
8490
  }
8475
8491
 
8476
8492
  // src/formulaNames.ts
8477
- var import_records16 = require("@ai-matrx/records");
8493
+ var import_records17 = require("@ai-matrx/records");
8478
8494
  function fieldRefsOf(expr) {
8479
8495
  const out = [];
8480
8496
  const walk = (node) => {
@@ -8582,7 +8598,7 @@ function formulaSourceArchived(field2, document2) {
8582
8598
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
8583
8599
  if (!Array.isArray(keys) || !document2) return null;
8584
8600
  for (const key of keys) {
8585
- const state = (0, import_records16.sourceArchivedOf)(document2[String(key)]);
8601
+ const state = (0, import_records17.sourceArchivedOf)(document2[String(key)]);
8586
8602
  if (state) return state;
8587
8603
  }
8588
8604
  return null;
@@ -8603,10 +8619,10 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
8603
8619
  }
8604
8620
 
8605
8621
  // src/values.tsx
8606
- var import_records18 = require("@ai-matrx/records");
8622
+ var import_records19 = require("@ai-matrx/records");
8607
8623
 
8608
8624
  // src/cellMarks.tsx
8609
- var import_records17 = require("@ai-matrx/records");
8625
+ var import_records18 = require("@ai-matrx/records");
8610
8626
 
8611
8627
  // src/RetiredValues.tsx
8612
8628
  var import_react43 = require("react");
@@ -8712,7 +8728,7 @@ function bound(value) {
8712
8728
  function keptAsideReason(field2, entry) {
8713
8729
  const rules = field2.rules ?? [];
8714
8730
  const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
8715
- const rule = (0, import_records17.ruleThatRefuses)(rules, numeric);
8731
+ const rule = (0, import_records18.ruleThatRefuses)(rules, numeric);
8716
8732
  let why = null;
8717
8733
  if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
8718
8734
  else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
@@ -8821,7 +8837,7 @@ function SourceArchivedValue({ state }) {
8821
8837
  }
8822
8838
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
8823
8839
  function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
8824
- const archivedSource = (0, import_records18.sourceArchivedOf)(value);
8840
+ const archivedSource = (0, import_records19.sourceArchivedOf)(value);
8825
8841
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SourceArchivedValue, { state: archivedSource });
8826
8842
  const envelope = envelopeFor(document2, field2.key);
8827
8843
  if (envelope?.absent) {
@@ -8930,9 +8946,9 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
8930
8946
  }
8931
8947
  function scalarText(field2, value, labels, stillWaitingFor) {
8932
8948
  if (value === null || value === void 0) return "\u2014";
8933
- if ((0, import_records18.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
8949
+ if ((0, import_records19.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
8934
8950
  if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
8935
- const newerWords = (0, import_records18.newerKindWords)(field2, value);
8951
+ const newerWords = (0, import_records19.newerKindWords)(field2, value);
8936
8952
  if (newerWords !== null) return newerWords;
8937
8953
  const kind = editorKindFor(field2);
8938
8954
  if (kind === "entity_reference") return entityReferenceText(value);
@@ -8997,7 +9013,7 @@ function RecordValue({
8997
9013
  const kept = keptAsideFor(document2, field2.key);
8998
9014
  if (kept) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
8999
9015
  }
9000
- const archivedSource = (0, import_records18.sourceArchivedOf)(value);
9016
+ const archivedSource = (0, import_records19.sourceArchivedOf)(value);
9001
9017
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SourceArchivedValue, { state: archivedSource });
9002
9018
  if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
9003
9019
  if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
@@ -9793,6 +9809,10 @@ function GridCell({
9793
9809
  openThisCell(event);
9794
9810
  return;
9795
9811
  }
9812
+ if (dateHelperKind(field2, value) !== null) {
9813
+ if (wasActive.current || event.target !== closedControl.current && event.target instanceof Node && closedControl.current?.contains(event.target)) openThisCell(event);
9814
+ return;
9815
+ }
9796
9816
  if (!opensAsAList(field2, hostTakesFiles(ui))) return;
9797
9817
  if (wasActive.current || clickLandsOnAChip(event.target)) openThisCell(event);
9798
9818
  };
@@ -10045,7 +10065,7 @@ function closesOnBlur(field2) {
10045
10065
  return true;
10046
10066
  }
10047
10067
  }
10048
- var LIST_CELL_CHIP = "[data-records-choice-chip], [data-records-person-chip], [data-records-reference-chip], [data-records-link-chip]";
10068
+ var LIST_CELL_CHIP = "[data-records-choice-chip], [data-records-person-chip]";
10049
10069
  function clickLandsOnAChip(target) {
10050
10070
  return target instanceof Element && target.closest(LIST_CELL_CHIP) !== null;
10051
10071
  }
@@ -10440,7 +10460,7 @@ function useWholeTableCount(args) {
10440
10460
  // src/Grid.tsx
10441
10461
  var import_react123 = require("react");
10442
10462
  var import_react124 = require("@ai-matrx/records/react");
10443
- var import_records36 = require("@ai-matrx/records");
10463
+ var import_records37 = require("@ai-matrx/records");
10444
10464
  var import_data_table13 = require("@ai-matrx/design-system/data-table");
10445
10465
  var import_core18 = require("@ai-matrx/records/core");
10446
10466
 
@@ -10507,7 +10527,7 @@ function useTableDecorations(tableId, revision) {
10507
10527
  }
10508
10528
 
10509
10529
  // src/emptyState.tsx
10510
- var import_records19 = require("@ai-matrx/records");
10530
+ var import_records20 = require("@ai-matrx/records");
10511
10531
  var import_design_system27 = require("@ai-matrx/design-system");
10512
10532
  var import_format3 = require("@ai-matrx/kit/format");
10513
10533
  var import_jsx_runtime33 = require("react/jsx-runtime");
@@ -10517,7 +10537,7 @@ function lockedRowsWords(count) {
10517
10537
  function questionIsAsked(args) {
10518
10538
  if ((args.search ?? "").trim() !== "") return true;
10519
10539
  if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
10520
- if (args.filter && (0, import_records19.stableFilterKey)(args.filter) !== "{}") return true;
10540
+ if (args.filter && (0, import_records20.stableFilterKey)(args.filter) !== "{}") return true;
10521
10541
  return Boolean(args.ruled);
10522
10542
  }
10523
10543
  function emptyCauseOf(args) {
@@ -10919,7 +10939,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
10919
10939
  // src/Condition.tsx
10920
10940
  var import_react59 = require("react");
10921
10941
  var import_design_system31 = require("@ai-matrx/design-system");
10922
- var import_records20 = require("@ai-matrx/records");
10942
+ var import_records21 = require("@ai-matrx/records");
10923
10943
  var import_react60 = require("@ai-matrx/records/react");
10924
10944
  var import_jsx_runtime37 = require("react/jsx-runtime");
10925
10945
  var CONDITION_OPS = [
@@ -10950,7 +10970,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
10950
10970
  void fieldOptionsOnce(client, field2.id).then((got) => {
10951
10971
  if (cancelled) return;
10952
10972
  setChoices(
10953
- got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records20.optionKey)(o), label: (0, import_records20.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
10973
+ got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records21.optionKey)(o), label: (0, import_records21.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
10954
10974
  );
10955
10975
  });
10956
10976
  return () => {
@@ -10968,7 +10988,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
10968
10988
  }
10969
10989
  );
10970
10990
  }
10971
- const shown4 = (0, import_records20.rankTypedMatches)(choices, search.trim(), (c) => c.label);
10991
+ const shown4 = (0, import_records21.rankTypedMatches)(choices, search.trim(), (c) => c.label);
10972
10992
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
10973
10993
  PickOrAdd,
10974
10994
  {
@@ -11339,7 +11359,7 @@ function ConditionGroup({
11339
11359
 
11340
11360
  // src/FieldRulePreview.tsx
11341
11361
  var import_react61 = require("react");
11342
- var import_records21 = require("@ai-matrx/records");
11362
+ var import_records22 = require("@ai-matrx/records");
11343
11363
  var import_react62 = require("@ai-matrx/records/react");
11344
11364
  var import_jsx_runtime38 = require("react/jsx-runtime");
11345
11365
  var PREVIEW_GROUPS2 = 1e3;
@@ -11378,7 +11398,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
11378
11398
  }
11379
11399
  const numbers = holdsNumbers2(field2);
11380
11400
  const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
11381
- setPreview((0, import_records21.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
11401
+ setPreview((0, import_records22.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
11382
11402
  });
11383
11403
  }, 300);
11384
11404
  return () => {
@@ -11487,7 +11507,7 @@ function choiceLookForNewList(multi, rows) {
11487
11507
 
11488
11508
  // src/ChoiceListEditor.tsx
11489
11509
  var import_react63 = require("react");
11490
- var import_records22 = require("@ai-matrx/records");
11510
+ var import_records23 = require("@ai-matrx/records");
11491
11511
  var import_react64 = require("@ai-matrx/records/react");
11492
11512
  var import_design_system32 = require("@ai-matrx/design-system");
11493
11513
  var import_data_table7 = require("@ai-matrx/design-system/data-table");
@@ -11496,7 +11516,7 @@ var rowSeed = 0;
11496
11516
  var nextRow = () => `new-${rowSeed += 1}`;
11497
11517
  function choiceRowsFrom(options, field2) {
11498
11518
  return inTheStoresOrder([...options]).map((option) => {
11499
- const words2 = (0, import_records22.optionLabel)(option);
11519
+ const words2 = (0, import_records23.optionLabel)(option);
11500
11520
  const key = option.data?.key;
11501
11521
  const color = field2 ? storedChoiceColor(field2, words2) ?? storedChoiceColor(field2, key) : void 0;
11502
11522
  return { id: option.id, words: words2, row: option.id, color: color ?? null };
@@ -11666,11 +11686,11 @@ function ChoiceListEditor({
11666
11686
  "div",
11667
11687
  {
11668
11688
  role: "group",
11669
- "aria-label": (0, import_records22.recordsUseSentence)(heldBy(asking), asking.words.trim()),
11689
+ "aria-label": (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()),
11670
11690
  "data-records-choice-removal-ask": "",
11671
11691
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
11672
11692
  children: [
11673
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs", children: (0, import_records22.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
11693
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs", children: (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
11674
11694
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
11675
11695
  targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
11676
11696
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system32.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
@@ -11689,7 +11709,7 @@ function ChoiceListEditor({
11689
11709
  ) : null,
11690
11710
  Object.entries(rehome).map(
11691
11711
  ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
11692
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: (0, import_records22.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
11712
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: (0, import_records23.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
11693
11713
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system32.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
11694
11714
  ] }, id) : null
11695
11715
  ),
@@ -11749,7 +11769,7 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
11749
11769
  }
11750
11770
 
11751
11771
  // src/NewerKindQuestions.tsx
11752
- var import_records23 = require("@ai-matrx/records");
11772
+ var import_records24 = require("@ai-matrx/records");
11753
11773
  var import_design_system33 = require("@ai-matrx/design-system");
11754
11774
  var import_jsx_runtime40 = require("react/jsx-runtime");
11755
11775
  var STATUS_STARTING_CHOICES = [
@@ -11770,7 +11790,7 @@ function statusGroupRows(field2, rows, keyOfId, changed) {
11770
11790
  if (words2 === "") continue;
11771
11791
  const ref = r.id ?? words2;
11772
11792
  const key = r.id ? keyOfId[r.id] : void 0;
11773
- const held = field2 && key ? (0, import_records23.statusGroupOf)(field2, key) : void 0;
11793
+ const held = field2 && key ? (0, import_records24.statusGroupOf)(field2, key) : void 0;
11774
11794
  out.push({ ref, words: words2, group: changed[ref] ?? held ?? guessStatusGroup(words2) });
11775
11795
  }
11776
11796
  return out;
@@ -11786,10 +11806,10 @@ function StatusGroupsQuestion({
11786
11806
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
11787
11807
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
11788
11808
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectValue, {}) }),
11789
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectContent, { children: import_records23.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.SelectItem, { value: g, children: [
11809
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectContent, { children: import_records24.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.SelectItem, { value: g, children: [
11790
11810
  STATUS_GROUP_MARK[g],
11791
11811
  " ",
11792
- import_records23.STATUS_GROUP_WORDS[g]
11812
+ import_records24.STATUS_GROUP_WORDS[g]
11793
11813
  ] }, g)) })
11794
11814
  ] })
11795
11815
  ] }, r.ref))
@@ -11827,7 +11847,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
11827
11847
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectValue, {}) }),
11828
11848
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.SelectContent, { children: [
11829
11849
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectItem, { value: "any", children: "Any code" }),
11830
- import_records23.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
11850
+ import_records24.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
11831
11851
  ] })
11832
11852
  ] })
11833
11853
  ] });
@@ -12126,11 +12146,11 @@ function FieldFormatPicker({
12126
12146
 
12127
12147
  // src/FieldEditor.tsx
12128
12148
  var import_text_case5 = require("@ai-matrx/kit/text-case");
12129
- var import_records24 = require("@ai-matrx/records");
12149
+ var import_records25 = require("@ai-matrx/records");
12130
12150
  var import_jsx_runtime42 = require("react/jsx-runtime");
12131
12151
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
12132
- var SENSITIVITIES = import_records24.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
12133
- var AGENT_VISIBILITY = import_records24.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
12152
+ var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
12153
+ var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
12134
12154
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
12135
12155
  value,
12136
12156
  label: ROLLUP_AGG_LABEL[value]
@@ -12143,7 +12163,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
12143
12163
  label: FORMULA_OP_LABEL[value],
12144
12164
  joins: FORMULA_OP_JOINS[value]
12145
12165
  }));
12146
- var STORE_BEHAVIOUR = new Map(import_records24.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
12166
+ var STORE_BEHAVIOUR = new Map(import_records25.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
12147
12167
  function holdsAValueOnAStandardTable(kind) {
12148
12168
  if (isSystemFieldKind(kind)) return false;
12149
12169
  const behaviour = STORE_BEHAVIOUR.get(kind);
@@ -12248,12 +12268,12 @@ function FieldEditor(props) {
12248
12268
  const [contextPolicy, setContextPolicy] = (0, import_react65.useState)(String(start?.context_policy ?? "include"));
12249
12269
  const [rules, setRules] = (0, import_react65.useState)(start?.rules ?? []);
12250
12270
  const [startsWith, setStartsWith] = (0, import_react65.useState)(start?.default ?? null);
12251
- const [ratingMax, setRatingMax] = (0, import_react65.useState)(() => start ? (0, import_records24.ratingMaxOf)(start) : 5);
12271
+ const [ratingMax, setRatingMax] = (0, import_react65.useState)(() => start ? (0, import_records25.ratingMaxOf)(start) : 5);
12252
12272
  const savedRules = (0, import_react65.useMemo)(
12253
- () => field2 ? type === "rating" ? (0, import_records24.rulesWithTopStar)(field2.rules ?? [], (0, import_records24.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
12273
+ () => field2 ? type === "rating" ? (0, import_records25.rulesWithTopStar)(field2.rules ?? [], (0, import_records25.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
12254
12274
  [field2, type]
12255
12275
  );
12256
- const editedRules = (0, import_react65.useMemo)(() => type === "rating" ? (0, import_records24.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
12276
+ const editedRules = (0, import_react65.useMemo)(() => type === "rating" ? (0, import_records25.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
12257
12277
  const [statusGroups, setStatusGroups] = (0, import_react65.useState)({});
12258
12278
  const [statusKeys, setStatusKeys] = (0, import_react65.useState)({});
12259
12279
  const [symbology, setSymbology] = (0, import_react65.useState)(String(start?.config?.["symbology"] ?? ""));
@@ -12261,7 +12281,7 @@ function FieldEditor(props) {
12261
12281
  if (!field2 || type !== "status") return;
12262
12282
  let live = true;
12263
12283
  void client.fieldOptions({ field_id: field2.id }).then((got) => {
12264
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records24.optionKey)(o)])));
12284
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records25.optionKey)(o)])));
12265
12285
  });
12266
12286
  return () => {
12267
12287
  live = false;
@@ -12415,7 +12435,7 @@ function FieldEditor(props) {
12415
12435
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
12416
12436
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
12417
12437
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
12418
- ...type === "rating" && ratingMax !== (0, import_records24.ratingMaxOf)(field2) ? { max: ratingMax } : {},
12438
+ ...type === "rating" && ratingMax !== (0, import_records25.ratingMaxOf)(field2) ? { max: ratingMax } : {},
12419
12439
  ...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
12420
12440
  // THE CHOICES, ONE ROW EACH, IN ORDER (CHOICE-COLUMN-EDIT): `{id, words}` re-words a
12421
12441
  // choice in place, plain words add one, a choice left out is retired. Sent only when the
@@ -13417,7 +13437,7 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
13417
13437
 
13418
13438
  // src/gridColors.tsx
13419
13439
  var import_react69 = require("react");
13420
- var import_records25 = require("@ai-matrx/records");
13440
+ var import_records26 = require("@ai-matrx/records");
13421
13441
  var import_react70 = require("@ai-matrx/records/react");
13422
13442
  var import_design_system37 = require("@ai-matrx/design-system");
13423
13443
  var import_data_table8 = require("@ai-matrx/design-system/data-table");
@@ -13478,7 +13498,7 @@ function useChoiceOptions(fields, keys) {
13478
13498
  function lookOf(option) {
13479
13499
  const raw = option.data?.["color"];
13480
13500
  const color = typeof raw === "string" && import_data_table8.STYLE_COLORS.includes(raw) ? raw : void 0;
13481
- return { id: String(option.id), key: (0, import_records25.optionKey)(option), label: (0, import_records25.optionLabel)(option), ...color ? { color } : {} };
13501
+ return { id: String(option.id), key: (0, import_records26.optionKey)(option), label: (0, import_records26.optionLabel)(option), ...color ? { color } : {} };
13482
13502
  }
13483
13503
  function paintByOption(style, _fields, index, lookup) {
13484
13504
  if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
@@ -14136,7 +14156,7 @@ function ActionRowPreview({
14136
14156
  // src/gridActions.tsx
14137
14157
  var import_react75 = require("react");
14138
14158
  var import_react76 = require("@ai-matrx/records/react");
14139
- var import_records26 = require("@ai-matrx/records");
14159
+ var import_records27 = require("@ai-matrx/records");
14140
14160
  var import_design_system40 = require("@ai-matrx/design-system");
14141
14161
  var import_jsx_runtime47 = require("react/jsx-runtime");
14142
14162
  var EMPTY_ACTIONS = [];
@@ -14217,7 +14237,7 @@ function useActionRunner(args) {
14217
14237
  const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
14218
14238
  setBusy(null);
14219
14239
  if (!answered.ok) {
14220
- const refusals = (0, import_records26.actionRefusals)(answered.error);
14240
+ const refusals = (0, import_records27.actionRefusals)(answered.error);
14221
14241
  setOutcome({
14222
14242
  kind: "refused",
14223
14243
  action: action3,
@@ -14995,7 +15015,7 @@ function RowActionsDialog({
14995
15015
  // src/gridSummaries.tsx
14996
15016
  var import_react79 = require("react");
14997
15017
  var import_react80 = require("@ai-matrx/records/react");
14998
- var import_records27 = require("@ai-matrx/records");
15018
+ var import_records28 = require("@ai-matrx/records");
14999
15019
  var import_design_system43 = require("@ai-matrx/design-system");
15000
15020
  var import_jsx_runtime50 = require("react/jsx-runtime");
15001
15021
  var SUMMARY_ROW_ID = "__records_ui_summary__";
@@ -15042,8 +15062,8 @@ function useColumnSummaries(args) {
15042
15062
  const why = {};
15043
15063
  for (const [key, op2] of entries) {
15044
15064
  const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
15045
- out[key] = row?.measures?.[(0, import_records27.measureKey)(measure)] ?? null;
15046
- const notice = row?.withheld?.[(0, import_records27.measureKey)(measure)];
15065
+ out[key] = row?.measures?.[(0, import_records28.measureKey)(measure)] ?? null;
15066
+ const notice = row?.withheld?.[(0, import_records28.measureKey)(measure)];
15047
15067
  if (notice) why[key] = notice;
15048
15068
  }
15049
15069
  setValues(out);
@@ -15603,7 +15623,7 @@ function WholeTextDialog({
15603
15623
 
15604
15624
  // src/pasteValues.ts
15605
15625
  var import_core10 = require("@ai-matrx/records/core");
15606
- var import_records28 = require("@ai-matrx/records");
15626
+ var import_records29 = require("@ai-matrx/records");
15607
15627
  function wordForStoredChoice(options, value) {
15608
15628
  if (options === void 0 || typeof value !== "string" || value === "") return null;
15609
15629
  for (const label of options.labels) {
@@ -15616,7 +15636,7 @@ function choiceOptionsOf(options) {
15616
15636
  const labels = [];
15617
15637
  for (const option of options) {
15618
15638
  const id = option.id;
15619
- const key = (0, import_records28.optionKey)(option);
15639
+ const key = (0, import_records29.optionKey)(option);
15620
15640
  const label = recordName(option.data, null, "");
15621
15641
  if (label) {
15622
15642
  labels.push(label);
@@ -15628,7 +15648,7 @@ function choiceOptionsOf(options) {
15628
15648
  return { byWord, labels };
15629
15649
  }
15630
15650
  function valueFromPastedText(field2, raw, options, relationNames) {
15631
- return (0, import_records28.coerceTypedAnswer)(field2, raw, {
15651
+ return (0, import_records29.coerceTypedAnswer)(field2, raw, {
15632
15652
  label: fieldName(field2),
15633
15653
  ...options ? { options } : {},
15634
15654
  ...relationNames ? { relationNames } : {}
@@ -17662,7 +17682,7 @@ function NewRecordControl({
17662
17682
  // src/gridDrill.tsx
17663
17683
  var import_react98 = require("react");
17664
17684
  var import_react99 = require("@ai-matrx/records/react");
17665
- var import_records29 = require("@ai-matrx/records");
17685
+ var import_records30 = require("@ai-matrx/records");
17666
17686
  var import_data_table11 = require("@ai-matrx/design-system/data-table");
17667
17687
 
17668
17688
  // src/drillLevel.ts
@@ -17929,7 +17949,7 @@ function useDrillAnswers(args) {
17929
17949
  across: question.across ?? null,
17930
17950
  show: question.show,
17931
17951
  where: args.where,
17932
- rule: args.rule && (0, import_records29.isRuleFilter)(args.rule) ? args.rule : null,
17952
+ rule: args.rule && (0, import_records30.isRuleFilter)(args.rule) ? args.rule : null,
17933
17953
  window: question.window ?? null,
17934
17954
  compare: question.compare ?? null,
17935
17955
  windowKey: args.windowKey ?? null,
@@ -18194,7 +18214,7 @@ function trailClause(fields, w) {
18194
18214
  }
18195
18215
  function filterWithTrail(fields, base, trail) {
18196
18216
  if (trail.length === 0) return base;
18197
- if (!base || !(0, import_records29.isRuleFilter)(base)) {
18217
+ if (!base || !(0, import_records30.isRuleFilter)(base)) {
18198
18218
  const flat = { ...base ?? {} };
18199
18219
  for (const w of trail) {
18200
18220
  const clause = trailClause(fields, w);
@@ -18217,7 +18237,7 @@ function filterWithTrail(fields, base, trail) {
18217
18237
  return { op: "and", args };
18218
18238
  }
18219
18239
  function filterWithWindow(fields, base, key, range) {
18220
- if (!base || !(0, import_records29.isRuleFilter)(base)) return { ...base ?? {}, [key]: { from: range.from, to: range.to } };
18240
+ if (!base || !(0, import_records30.isRuleFilter)(base)) return { ...base ?? {}, [key]: { from: range.from, to: range.to } };
18221
18241
  const field2 = fields.find((f) => f.key === key);
18222
18242
  if (!field2) return base;
18223
18243
  const ref = { field: field2.id };
@@ -18260,8 +18280,8 @@ function useGridDrillConfig(args) {
18260
18280
  },
18261
18281
  [setQuestion, onPresentationChange, presentation]
18262
18282
  );
18263
- const flat = state.filter && !(0, import_records29.isRuleFilter)(state.filter) ? state.filter : void 0;
18264
- const rule = state.filter && (0, import_records29.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
18283
+ const flat = state.filter && !(0, import_records30.isRuleFilter)(state.filter) ? state.filter : void 0;
18284
+ const rule = state.filter && (0, import_records30.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
18265
18285
  const { config } = useDrill({
18266
18286
  source: state.source,
18267
18287
  question: state.question,
@@ -18969,9 +18989,15 @@ var TYPE_ICON = {
18969
18989
  rollup: FORMULA,
18970
18990
  json: [["path", { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" }], ["path", { d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" }]]
18971
18991
  };
18992
+ var CLOCK = [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "M12 6v6l4 2" }]];
18993
+ var PERSON_PLUS = [["path", { d: "M2 21a8 8 0 0 1 13.292-6" }], ["circle", { cx: 10, cy: 8, r: 5 }], ["path", { d: "M19 16v6" }], ["path", { d: "M22 19h-6" }]];
18994
+ var PERSON_PEN = [["path", { d: "M11.5 15H7a4 4 0 0 0-4 4v2" }], ["path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }], ["circle", { cx: 10, cy: 7, r: 4 }]];
18995
+ var STAMP_ICON = { created_time: CLOCK, modified_time: CLOCK, created_by: PERSON_PLUS, modified_by: PERSON_PEN };
18972
18996
  function withTypeMark(field2, header) {
18973
- const kind = editorKindFor(field2);
18974
- const parts = TYPE_ICON[kind] ?? TYPE_ICON.text;
18997
+ const picked = pickableTypeOf(field2);
18998
+ const stamp = picked !== void 0 && picked in STAMP_ICON ? picked : void 0;
18999
+ const kind = stamp ?? editorKindFor(field2);
19000
+ const parts = (stamp ? STAMP_ICON[stamp] : TYPE_ICON[editorKindFor(field2)]) ?? TYPE_ICON.text;
18975
19001
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind, children: [
18976
19002
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
18977
19003
  "svg",
@@ -19000,7 +19026,7 @@ function withTypeMark(field2, header) {
19000
19026
 
19001
19027
  // src/ReverseColumns.tsx
19002
19028
  var import_react102 = require("react");
19003
- var import_records30 = require("@ai-matrx/records");
19029
+ var import_records31 = require("@ai-matrx/records");
19004
19030
  var import_react103 = require("@ai-matrx/records/react");
19005
19031
  var import_design_system54 = require("@ai-matrx/design-system");
19006
19032
  var import_jsx_runtime61 = require("react/jsx-runtime");
@@ -19139,7 +19165,7 @@ function useReverseField(tableId, column) {
19139
19165
  if (column.read_only || !client) return;
19140
19166
  let live = true;
19141
19167
  void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
19142
- if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records30.isReverseField)(f)) ?? null);
19168
+ if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records31.isReverseField)(f)) ?? null);
19143
19169
  });
19144
19170
  return () => {
19145
19171
  live = false;
@@ -19664,7 +19690,7 @@ var import_react105 = require("react");
19664
19690
  var import_react106 = require("@ai-matrx/records/react");
19665
19691
  var import_core14 = require("@ai-matrx/records/core");
19666
19692
  var import_design_system56 = require("@ai-matrx/design-system");
19667
- var import_records33 = require("@ai-matrx/records");
19693
+ var import_records34 = require("@ai-matrx/records");
19668
19694
 
19669
19695
  // src/importRuleCheck.ts
19670
19696
  var import_core13 = require("@ai-matrx/records/core");
@@ -19715,7 +19741,7 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
19715
19741
  var import_text_case8 = require("@ai-matrx/kit/text-case");
19716
19742
 
19717
19743
  // src/importKinds.ts
19718
- var import_records31 = require("@ai-matrx/records");
19744
+ var import_records32 = require("@ai-matrx/records");
19719
19745
  var IMPORT_KINDS = [
19720
19746
  { kind: "text", label: "Text" },
19721
19747
  { kind: "date", label: "Date" },
@@ -19743,7 +19769,7 @@ function datesOfColumn(rows, header, opts = {}) {
19743
19769
  const raw = String(r[header] ?? "").trim();
19744
19770
  if (raw === "") return;
19745
19771
  filled += 1;
19746
- const got = (0, import_records31.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
19772
+ const got = (0, import_records32.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
19747
19773
  if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
19748
19774
  else unreadable.push({ row: i, raw });
19749
19775
  });
@@ -19768,12 +19794,12 @@ function exactDuplicateRows(rows, headers) {
19768
19794
  }
19769
19795
 
19770
19796
  // src/importCombine.ts
19771
- var import_records32 = require("@ai-matrx/records");
19797
+ var import_records33 = require("@ai-matrx/records");
19772
19798
  function titleRepeats(rows, header) {
19773
19799
  const seen = /* @__PURE__ */ new Set();
19774
19800
  let filled = 0;
19775
19801
  for (const r of rows) {
19776
- const key = (0, import_records32.relationNameKey)(String(r[header] ?? ""));
19802
+ const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
19777
19803
  if (key === "") continue;
19778
19804
  filled += 1;
19779
19805
  seen.add(key);
@@ -19783,7 +19809,7 @@ function titleRepeats(rows, header) {
19783
19809
  function sameRecordLikely(rows, header) {
19784
19810
  const groups = /* @__PURE__ */ new Map();
19785
19811
  for (const r of rows) {
19786
- const key = (0, import_records32.relationNameKey)(String(r[header] ?? ""));
19812
+ const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
19787
19813
  if (key === "") continue;
19788
19814
  const held = groups.get(key);
19789
19815
  if (held) held.push(r);
@@ -19816,7 +19842,7 @@ function combineRows(rows, header) {
19816
19842
  const out = [];
19817
19843
  const outLines = [];
19818
19844
  rows.forEach((r, i) => {
19819
- const key = (0, import_records32.relationNameKey)(String(r[header] ?? ""));
19845
+ const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
19820
19846
  if (key === "") {
19821
19847
  out.push({ ...r });
19822
19848
  outLines.push([i + 1]);
@@ -20308,13 +20334,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20308
20334
  async (wanted) => {
20309
20335
  const next = /* @__PURE__ */ new Map();
20310
20336
  for (const { header, field: field2 } of wanted) {
20311
- const names = effectiveRows.flatMap((r) => (0, import_records33.relationNamesIn)(field2, String(r[header] ?? "")));
20337
+ const names = effectiveRows.flatMap((r) => (0, import_records34.relationNamesIn)(field2, String(r[header] ?? "")));
20312
20338
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
20313
20339
  if (!got.ok) {
20314
20340
  setRelationProblem(got.error);
20315
20341
  return null;
20316
20342
  }
20317
- next.set(field2.key, (0, import_records33.relationNameIndexOf)(got.data));
20343
+ next.set(field2.key, (0, import_records34.relationNameIndexOf)(got.data));
20318
20344
  }
20319
20345
  setRelationProblem(null);
20320
20346
  setRelationIndex(next);
@@ -20338,12 +20364,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20338
20364
  let linked = 0;
20339
20365
  let named = 0;
20340
20366
  effectiveRows.forEach((row, i) => {
20341
- const names = (0, import_records33.relationNamesIn)(field2, String(row[header] ?? ""));
20367
+ const names = (0, import_records34.relationNamesIn)(field2, String(row[header] ?? ""));
20342
20368
  if (String(row[header] ?? "").trim() === "") return;
20343
20369
  named += 1;
20344
20370
  let ok = true;
20345
20371
  for (const name of names) {
20346
- const hits = index.byName.get((0, import_records33.relationNameKey)(name)) ?? [];
20372
+ const hits = index.byName.get((0, import_records34.relationNameKey)(name)) ?? [];
20347
20373
  if (hits.length === 1) continue;
20348
20374
  ok = false;
20349
20375
  if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
@@ -20401,11 +20427,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20401
20427
  const named = index.get(field2.key);
20402
20428
  const text2 = String(row[header] ?? "").trim();
20403
20429
  if (!named || text2 === "") continue;
20404
- const parts = field2.multi ? (0, import_records33.splitListCell)(text2) : [text2];
20430
+ const parts = field2.multi ? (0, import_records34.splitListCell)(text2) : [text2];
20405
20431
  const ids = [];
20406
20432
  let skip = false;
20407
20433
  for (const part of parts) {
20408
- const hits = (0, import_records33.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records33.relationNameKey)(part)) ?? [];
20434
+ const hits = (0, import_records34.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records34.relationNameKey)(part)) ?? [];
20409
20435
  if (hits === null) ids.push(part);
20410
20436
  else if (hits.length === 1) ids.push(hits[0].id);
20411
20437
  else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
@@ -20445,7 +20471,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
20445
20471
  setPhase("linking");
20446
20472
  for (const ask of toMerge) {
20447
20473
  for (const [name] of ask.ambiguous) {
20448
- const hits = ask.index.byName.get((0, import_records33.relationNameKey)(name)) ?? [];
20474
+ const hits = ask.index.byName.get((0, import_records34.relationNameKey)(name)) ?? [];
20449
20475
  const winner = hits[0];
20450
20476
  if (!winner) continue;
20451
20477
  for (const loser of hits.slice(1)) {
@@ -22111,7 +22137,7 @@ function useStoreValueFacets(enabled, inputs) {
22111
22137
  // src/gridGrouping.tsx
22112
22138
  var import_react111 = require("react");
22113
22139
  var import_react112 = require("@ai-matrx/records/react");
22114
- var import_records34 = require("@ai-matrx/records");
22140
+ var import_records35 = require("@ai-matrx/records");
22115
22141
  var import_jsx_runtime68 = require("react/jsx-runtime");
22116
22142
  function groupValueKey(value) {
22117
22143
  if (value === null || value === void 0 || value === "") return "";
@@ -22148,8 +22174,8 @@ function useGroupFacts(args) {
22148
22174
  const withheld = {};
22149
22175
  for (const [fieldKey, op2] of entries) {
22150
22176
  const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
22151
- values[fieldKey] = row.measures?.[(0, import_records34.measureKey)(m)] ?? null;
22152
- const notice = row.withheld?.[(0, import_records34.measureKey)(m)];
22177
+ values[fieldKey] = row.measures?.[(0, import_records35.measureKey)(m)] ?? null;
22178
+ const notice = row.withheld?.[(0, import_records35.measureKey)(m)];
22153
22179
  if (notice) withheld[fieldKey] = notice;
22154
22180
  }
22155
22181
  out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
@@ -23199,7 +23225,7 @@ function BulkActions({
23199
23225
  // src/handOrder.tsx
23200
23226
  var import_react120 = require("react");
23201
23227
  var import_react121 = require("@ai-matrx/records/react");
23202
- var import_records35 = require("@ai-matrx/records");
23228
+ var import_records36 = require("@ai-matrx/records");
23203
23229
  var import_design_system60 = require("@ai-matrx/design-system");
23204
23230
  var import_jsx_runtime72 = require("react/jsx-runtime");
23205
23231
  function sortArrow(direction) {
@@ -23316,7 +23342,7 @@ function useHandOrderRows(args) {
23316
23342
  const client = (0, import_react121.useRecordsClient)();
23317
23343
  const { viewId, active, page, pageSize } = args;
23318
23344
  const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
23319
- const filterKey = filter ? (0, import_records35.stableFilterKey)(filter) : "";
23345
+ const filterKey = filter ? (0, import_records36.stableFilterKey)(filter) : "";
23320
23346
  const filterNow = (0, import_react120.useRef)(filter);
23321
23347
  filterNow.current = filter;
23322
23348
  const [answer, setAnswer] = (0, import_react120.useState)(null);
@@ -24029,7 +24055,7 @@ function GridBody({
24029
24055
  const names = wanted.get(field2.key) ?? [];
24030
24056
  if (names.length === 0) return;
24031
24057
  const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
24032
- if (got.ok) relationNames.current.set(field2.key, (0, import_records36.relationNameIndexOf)(got.data));
24058
+ if (got.ok) relationNames.current.set(field2.key, (0, import_records37.relationNameIndexOf)(got.data));
24033
24059
  })
24034
24060
  );
24035
24061
  },
@@ -24108,7 +24134,7 @@ function GridBody({
24108
24134
  field2.key,
24109
24135
  lines.flatMap((line) => {
24110
24136
  const cell2 = line[at];
24111
- return typeof cell2 === "string" ? (0, import_records36.relationNamesIn)(field2, cell2) : [];
24137
+ return typeof cell2 === "string" ? (0, import_records37.relationNamesIn)(field2, cell2) : [];
24112
24138
  })
24113
24139
  );
24114
24140
  }
@@ -24395,7 +24421,7 @@ function GridBody({
24395
24421
  tableName: table.data ? tableName(table.data) : "",
24396
24422
  fields: fields.data ?? [],
24397
24423
  document: row.document ?? {},
24398
- level: (0, import_records36.asPermissionLevel)(row.level)
24424
+ level: (0, import_records37.asPermissionLevel)(row.level)
24399
24425
  }),
24400
24426
  [host, tableId, table.data, fields.data]
24401
24427
  );
@@ -26301,7 +26327,7 @@ var import_design_system74 = require("@ai-matrx/design-system");
26301
26327
  var import_react143 = require("react");
26302
26328
  var import_react144 = require("@ai-matrx/records/react");
26303
26329
  var import_core20 = require("@ai-matrx/records/core");
26304
- var import_records41 = require("@ai-matrx/records");
26330
+ var import_records42 = require("@ai-matrx/records");
26305
26331
  var import_design_system73 = require("@ai-matrx/design-system");
26306
26332
 
26307
26333
  // src/newTableColumns.ts
@@ -26485,7 +26511,7 @@ function fieldsForNewColumns(columns) {
26485
26511
  var import_clipboard4 = require("@ai-matrx/kit/clipboard");
26486
26512
  var import_react139 = require("react");
26487
26513
  var import_react140 = require("@ai-matrx/records/react");
26488
- var import_records39 = require("@ai-matrx/records");
26514
+ var import_records40 = require("@ai-matrx/records");
26489
26515
  var import_design_system71 = require("@ai-matrx/design-system");
26490
26516
 
26491
26517
  // src/BookingBuilder.tsx
@@ -26494,7 +26520,7 @@ var import_design_system66 = require("@ai-matrx/design-system");
26494
26520
  var import_react135 = require("react");
26495
26521
  var import_react136 = require("@ai-matrx/records/react");
26496
26522
  var import_format7 = require("@ai-matrx/kit/format");
26497
- var import_records37 = require("@ai-matrx/records");
26523
+ var import_records38 = require("@ai-matrx/records");
26498
26524
  var import_design_system67 = require("@ai-matrx/design-system");
26499
26525
 
26500
26526
  // src/publicQuestions.ts
@@ -26775,7 +26801,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
26775
26801
  if (!rights.structure) {
26776
26802
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: (0, import_design_system67.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
26777
26803
  }
26778
- const url = formId ? `${publicOrigin}${(0, import_records37.bookingPath)(formId)}` : null;
26804
+ const url = formId ? `${publicOrigin}${(0, import_records38.bookingPath)(formId)}` : null;
26779
26805
  const shown4 = offer ?? null;
26780
26806
  return (
26781
26807
  // THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
@@ -27035,7 +27061,7 @@ function BuildOrAsk({
27035
27061
 
27036
27062
  // src/BuiltOnArchive.tsx
27037
27063
  var import_react137 = require("react");
27038
- var import_records38 = require("@ai-matrx/records");
27064
+ var import_records39 = require("@ai-matrx/records");
27039
27065
  var import_react138 = require("@ai-matrx/records/react");
27040
27066
  var import_design_system70 = require("@ai-matrx/design-system");
27041
27067
 
@@ -27476,9 +27502,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
27476
27502
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
27477
27503
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate text-sm", children: thing.title }),
27478
27504
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
27479
- import_records38.BUILT_KIND_WORD[thing.kind],
27505
+ import_records39.BUILT_KIND_WORD[thing.kind],
27480
27506
  " \xB7 archived ",
27481
- (0, import_records38.archivedWhen)(thing.archivedAt)
27507
+ (0, import_records39.archivedWhen)(thing.archivedAt)
27482
27508
  ] }),
27483
27509
  refusal3 && refusal3.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
27484
27510
  ] }),
@@ -27629,7 +27655,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
27629
27655
  " Open the table the appointments should land in to make one."
27630
27656
  ] }) : null,
27631
27657
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
27632
- const url = `${origin}${(0, import_records39.bookingPath)(page.form_id)}`;
27658
+ const url = `${origin}${(0, import_records40.bookingPath)(page.form_id)}`;
27633
27659
  const mayOpen = levels.data?.[page.table_id] === "admin";
27634
27660
  const open = page.published_at !== null && page.closed_at === null;
27635
27661
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
@@ -27749,7 +27775,7 @@ function nextInWords(page) {
27749
27775
 
27750
27776
  // src/WhereItLives.tsx
27751
27777
  var import_react141 = require("react");
27752
- var import_records40 = require("@ai-matrx/records");
27778
+ var import_records41 = require("@ai-matrx/records");
27753
27779
  var import_react142 = require("@ai-matrx/records/react");
27754
27780
  var import_design_system72 = require("@ai-matrx/design-system");
27755
27781
  var import_jsx_runtime85 = require("react/jsx-runtime");
@@ -27878,7 +27904,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
27878
27904
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
27879
27905
  "?"
27880
27906
  ] }),
27881
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-muted-foreground", children: (0, import_records40.moveConsequence)(answer.home, choosing) }),
27907
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-muted-foreground", children: (0, import_records41.moveConsequence)(answer.home, choosing) }),
27882
27908
  said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
27883
27909
  import_design_system72.ErrorBox,
27884
27910
  {
@@ -28035,7 +28061,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
28035
28061
  alive = false;
28036
28062
  };
28037
28063
  }, [client]);
28038
- const listed = facts.phase === "read" ? (0, import_records41.withTablePlacement)(
28064
+ const listed = facts.phase === "read" ? (0, import_records42.withTablePlacement)(
28039
28065
  (0, import_core20.withTableFacts)(tables.data ?? [], facts.rows, me),
28040
28066
  facts.rows
28041
28067
  ) : tables.data ?? [];
@@ -29153,7 +29179,7 @@ function TableRenameDialog({
29153
29179
 
29154
29180
  // src/TableSettings.tsx
29155
29181
  var import_react161 = require("react");
29156
- var import_records43 = require("@ai-matrx/records");
29182
+ var import_records44 = require("@ai-matrx/records");
29157
29183
 
29158
29184
  // src/ArchiveDeliberately.tsx
29159
29185
  var import_react151 = require("react");
@@ -29444,7 +29470,7 @@ function TableAccessLevel({ tableId, fields }) {
29444
29470
 
29445
29471
  // src/RowControls.tsx
29446
29472
  var import_react157 = require("react");
29447
- var import_records42 = require("@ai-matrx/records");
29473
+ var import_records43 = require("@ai-matrx/records");
29448
29474
  var import_react158 = require("@ai-matrx/records/react");
29449
29475
  var import_design_system80 = require("@ai-matrx/design-system");
29450
29476
  var import_jsx_runtime93 = require("react/jsx-runtime");
@@ -29472,9 +29498,9 @@ function ShownToSelect({
29472
29498
  onChange,
29473
29499
  testId
29474
29500
  }) {
29475
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_design_system80.Select, { value, onValueChange: (next) => (0, import_records42.isShownTo)(next) ? onChange(next) : void 0, children: [
29501
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_design_system80.Select, { value, onValueChange: (next) => (0, import_records43.isShownTo)(next) ? onChange(next) : void 0, children: [
29476
29502
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectTrigger, { size: "sm", "aria-label": label, className: "h-7 min-w-[8rem] text-xs", "data-testid": testId, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectValue, {}) }),
29477
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectItem, { value: word, children: import_records42.SHOWN_TO_LABEL[word] }, word)) })
29503
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectItem, { value: word, children: import_records43.SHOWN_TO_LABEL[word] }, word)) })
29478
29504
  ] });
29479
29505
  }
29480
29506
  function NewRowsDefaults({ tableId }) {
@@ -29512,10 +29538,10 @@ function NewRowsDefaults({ tableId }) {
29512
29538
  setError(null);
29513
29539
  setApplied(appliedLine(answer.data));
29514
29540
  };
29515
- if (!(0, import_records42.levelHasShownTo)(table.data?.level)) return null;
29541
+ if (!(0, import_records43.levelHasShownTo)(table.data?.level)) return null;
29516
29542
  if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(RefusalNotice, { error }) : null;
29517
29543
  const shown4 = d.shown_to ?? d.effective.shown_to;
29518
- const allowed = d.allowed_shown_to.filter(import_records42.isShownTo);
29544
+ const allowed = d.allowed_shown_to.filter(import_records43.isShownTo);
29519
29545
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
29520
29546
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
29521
29547
  /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -29529,7 +29555,7 @@ function NewRowsDefaults({ tableId }) {
29529
29555
  testId: "new-rows-shown-to",
29530
29556
  onChange: (next) => void set({ shown_to: next })
29531
29557
  }
29532
- ) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records42.SHOWN_TO_LABEL[shown4] })
29558
+ ) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records43.SHOWN_TO_LABEL[shown4] })
29533
29559
  ] }),
29534
29560
  /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
29535
29561
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
@@ -29580,10 +29606,10 @@ function RowShownTo({ recordId, tableId }) {
29580
29606
  }, [read]);
29581
29607
  if (error && !c) return null;
29582
29608
  if (tableId && table.loading && !table.data) return null;
29583
- if (!(0, import_records42.levelHasShownTo)(table.data?.level)) return null;
29584
- if (!c || c.shown_to.is_child || !(0, import_records42.isShownTo)(c.shown_to.effective)) return null;
29609
+ if (!(0, import_records43.levelHasShownTo)(table.data?.level)) return null;
29610
+ if (!c || c.shown_to.is_child || !(0, import_records43.isShownTo)(c.shown_to.effective)) return null;
29585
29611
  const effective = c.shown_to.effective;
29586
- const allowed = c.shown_to.allowed.filter(import_records42.isShownTo);
29612
+ const allowed = c.shown_to.allowed.filter(import_records43.isShownTo);
29587
29613
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "flex items-center gap-1.5", "data-testid": "row-shown-to", children: [
29588
29614
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
29589
29615
  c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
@@ -29602,7 +29628,7 @@ function RowShownTo({ recordId, tableId }) {
29602
29628
  }
29603
29629
  }
29604
29630
  ) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
29605
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records42.SHOWN_TO_LABEL[effective] }),
29631
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records43.SHOWN_TO_LABEL[effective] }),
29606
29632
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
29607
29633
  ] }),
29608
29634
  error ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(RefusalNotice, { error }) : null
@@ -29939,7 +29965,7 @@ function TableSettingsPanel({
29939
29965
  table.data ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
29940
29966
  table.data ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
29941
29967
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_design_system82.Separator, {}),
29942
- (0, import_records43.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
29968
+ (0, import_records44.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
29943
29969
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NewRowsDefaults, { tableId }),
29944
29970
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_design_system82.Separator, {})
29945
29971
  ] }) : null,
@@ -30023,7 +30049,7 @@ function TableSettingsPanel({
30023
30049
 
30024
30050
  // src/Peek.tsx
30025
30051
  var import_react170 = require("react");
30026
- var import_records45 = require("@ai-matrx/records");
30052
+ var import_records46 = require("@ai-matrx/records");
30027
30053
  var import_react171 = require("@ai-matrx/records/react");
30028
30054
  var import_react172 = require("@ai-matrx/alchemy/react");
30029
30055
 
@@ -30341,12 +30367,12 @@ function ShareForSomebodyElse({
30341
30367
  // src/RecordBody.tsx
30342
30368
  var import_react168 = require("react");
30343
30369
  var import_design_system85 = require("@ai-matrx/design-system");
30344
- var import_records44 = require("@ai-matrx/records");
30370
+ var import_records45 = require("@ai-matrx/records");
30345
30371
  var import_react169 = require("@ai-matrx/records/react");
30346
30372
  var import_jsx_runtime99 = require("react/jsx-runtime");
30347
30373
  var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
30348
30374
  function bodyFieldOf(fields) {
30349
- const rich2 = fields.filter((field2) => (0, import_records44.newerKindOf)(field2) === "rich_text");
30375
+ const rich2 = fields.filter((field2) => (0, import_records45.newerKindOf)(field2) === "rich_text");
30350
30376
  return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
30351
30377
  }
30352
30378
  var BODY_COLUMN_NAME = "Notes";
@@ -30470,7 +30496,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
30470
30496
  if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RefusalNotice, { error: record.error, className });
30471
30497
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RefusalNotice, { error: fields.error, className });
30472
30498
  const document2 = record.data?.document;
30473
- if (document2 && (0, import_records45.isLockedStub)({ document: document2, level: null })) {
30499
+ if (document2 && (0, import_records46.isLockedStub)({ document: document2, level: null })) {
30474
30500
  const filed = document2["submitted_at"];
30475
30501
  const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
30476
30502
  return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("p", { className: (0, import_design_system86.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
@@ -30753,7 +30779,7 @@ function usePlatformTable(spec) {
30753
30779
  // src/ViewSwitcher.tsx
30754
30780
  var import_react191 = require("react");
30755
30781
  var import_react192 = require("@ai-matrx/records/react");
30756
- var import_records47 = require("@ai-matrx/records");
30782
+ var import_records48 = require("@ai-matrx/records");
30757
30783
  var import_design_system94 = require("@ai-matrx/design-system");
30758
30784
  var import_data_table21 = require("@ai-matrx/design-system/data-table");
30759
30785
  var import_format8 = require("@ai-matrx/kit/format");
@@ -30908,7 +30934,7 @@ function MoveRefusedBadge({ refused }) {
30908
30934
  // src/Pipeline.tsx
30909
30935
  var import_react179 = require("react");
30910
30936
  var import_react180 = require("@ai-matrx/records/react");
30911
- var import_records46 = require("@ai-matrx/records");
30937
+ var import_records47 = require("@ai-matrx/records");
30912
30938
  var import_design_system89 = require("@ai-matrx/design-system");
30913
30939
  var import_data_table16 = require("@ai-matrx/design-system/data-table");
30914
30940
 
@@ -31241,7 +31267,7 @@ function PipelineBoard({
31241
31267
  alive.current = false;
31242
31268
  };
31243
31269
  }, []);
31244
- const filterKey = (0, import_records46.stableFilterKey)(filter);
31270
+ const filterKey = (0, import_records47.stableFilterKey)(filter);
31245
31271
  const reload = (0, import_react179.useCallback)(async () => {
31246
31272
  setLoading(true);
31247
31273
  const [read, board, held] = await Promise.all([
@@ -33971,7 +33997,7 @@ var NO_FIELDS2 = [];
33971
33997
  function useViewRecords(view, pageSize = 200, filter, viewId) {
33972
33998
  const client = (0, import_react192.useRecordsClient)();
33973
33999
  const [limit, setLimit] = (0, import_react191.useState)(pageSize);
33974
- const questionKey = `${view.subject}|${(0, import_records47.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
34000
+ const questionKey = `${view.subject}|${(0, import_records48.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
33975
34001
  (0, import_react191.useEffect)(() => {
33976
34002
  setLimit(pageSize);
33977
34003
  }, [questionKey, pageSize]);
@@ -34004,8 +34030,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
34004
34030
  cancelled = true;
34005
34031
  };
34006
34032
  }, [client, ruleId, pageSize]);
34007
- const asked3 = (0, import_records47.stableFilterKey)(filter ?? null);
34008
- const fromView = asked3 !== "{}" && (asked3 === (0, import_records47.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records47.stableFilterKey)(view.filters ?? null));
34033
+ const asked3 = (0, import_records48.stableFilterKey)(filter ?? null);
34034
+ const fromView = asked3 !== "{}" && (asked3 === (0, import_records48.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records48.stableFilterKey)(view.filters ?? null));
34009
34035
  const tableRows = (0, import_react191.useMemo)(() => table.data?.rows ?? [], [table.data]);
34010
34036
  const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
34011
34037
  const hand = useHandOrderRows({
@@ -35041,12 +35067,12 @@ function cardHiddenOf(presentation) {
35041
35067
  }
35042
35068
  var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
35043
35069
  function boardDefaultGroupField(eligible) {
35044
- return eligible.find((f) => (0, import_records47.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
35070
+ return eligible.find((f) => (0, import_records48.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
35045
35071
  }
35046
35072
 
35047
35073
  // src/ArchivedView.tsx
35048
35074
  var import_react193 = require("react");
35049
- var import_records48 = require("@ai-matrx/records");
35075
+ var import_records49 = require("@ai-matrx/records");
35050
35076
  var import_react194 = require("@ai-matrx/records/react");
35051
35077
  var import_design_system95 = require("@ai-matrx/design-system");
35052
35078
  var import_jsx_runtime112 = require("react/jsx-runtime");
@@ -35056,7 +35082,7 @@ function mayNotRestoreLine(why) {
35056
35082
  return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
35057
35083
  }
35058
35084
  function archivedRowLine(row, titleKey) {
35059
- return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records48.archivedByLine)(row)}`;
35085
+ return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records49.archivedByLine)(row)}`;
35060
35086
  }
35061
35087
  function ArchivedView({
35062
35088
  tableId,
@@ -35070,7 +35096,7 @@ function ArchivedView({
35070
35096
  const table = (0, import_react194.useTable)(tableId);
35071
35097
  const rights = useTableRights(table.data);
35072
35098
  const fields = (0, import_react194.useFields)(tableId);
35073
- const [lane, setLane] = (0, import_react193.useState)(laneFromHost ?? import_records48.DEFAULT_ARCHIVE_LANE);
35099
+ const [lane, setLane] = (0, import_react193.useState)(laneFromHost ?? import_records49.DEFAULT_ARCHIVE_LANE);
35074
35100
  const [rows, setRows] = (0, import_react193.useState)([]);
35075
35101
  const [loading, setLoading] = (0, import_react193.useState)(true);
35076
35102
  const [error, setError] = (0, import_react193.useState)(null);
@@ -35117,15 +35143,15 @@ function ArchivedView({
35117
35143
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_design_system95.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
35118
35144
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
35119
35145
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
35120
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records48.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
35146
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records49.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
35121
35147
  import_design_system95.Button,
35122
35148
  {
35123
35149
  size: "sm",
35124
35150
  variant: option === lane ? "secondary" : "ghost",
35125
35151
  "aria-pressed": option === lane,
35126
- title: import_records48.ARCHIVE_LANE_MEANS[option],
35152
+ title: import_records49.ARCHIVE_LANE_MEANS[option],
35127
35153
  onClick: () => pick(option),
35128
- children: import_records48.ARCHIVE_LANE_LABEL[option]
35154
+ children: import_records49.ARCHIVE_LANE_LABEL[option]
35129
35155
  },
35130
35156
  option
35131
35157
  )) })
@@ -35141,7 +35167,7 @@ function ArchivedView({
35141
35167
  ),
35142
35168
  error ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(RefusalNotice, { error }) : null,
35143
35169
  loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_design_system95.Skeleton, { className: "h-24 w-full" }) : null,
35144
- !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records48.emptyArchiveLine)(lane) }) : null,
35170
+ !loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records49.emptyArchiveLine)(lane) }) : null,
35145
35171
  !loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
35146
35172
  "li",
35147
35173
  {
@@ -35151,7 +35177,7 @@ function ArchivedView({
35151
35177
  children: [
35152
35178
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
35153
35179
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
35154
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records48.archivedByLine)(row) }),
35180
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records49.archivedByLine)(row) }),
35155
35181
  refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
35156
35182
  ] }),
35157
35183
  mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
@@ -35174,7 +35200,7 @@ function ArchivedView({
35174
35200
  ] });
35175
35201
  }
35176
35202
  function retiredColumnLine(row) {
35177
- return (0, import_records48.archivedByLine)(row);
35203
+ return (0, import_records49.archivedByLine)(row);
35178
35204
  }
35179
35205
  function RetiredColumns({ tableId, mayRestore, whyNot }) {
35180
35206
  const client = (0, import_react194.useRecordsClient)();
@@ -35238,7 +35264,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
35238
35264
 
35239
35265
  // src/ArchivedDisclosure.tsx
35240
35266
  var import_react195 = require("react");
35241
- var import_records49 = require("@ai-matrx/records");
35267
+ var import_records50 = require("@ai-matrx/records");
35242
35268
  var import_react196 = require("@ai-matrx/records/react");
35243
35269
  var import_design_system96 = require("@ai-matrx/design-system");
35244
35270
  var import_jsx_runtime113 = require("react/jsx-runtime");
@@ -35338,10 +35364,10 @@ function ArchivedPortals({
35338
35364
  error ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(RefusalNotice, { error }) : null,
35339
35365
  rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_design_system96.Skeleton, { className: "h-16 w-full" }) : null,
35340
35366
  said2 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
35341
- rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records49.emptyPortalArchiveLine)() }) : null,
35367
+ rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records50.emptyPortalArchiveLine)() }) : null,
35342
35368
  rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
35343
35369
  const asking = confirming === portal.portal_id;
35344
- const matches2 = (0, import_records49.portalTitleTypedBack)(typed2, portal.title);
35370
+ const matches2 = (0, import_records50.portalTitleTypedBack)(typed2, portal.title);
35345
35371
  return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
35346
35372
  "li",
35347
35373
  {
@@ -35380,7 +35406,7 @@ function ArchivedPortals({
35380
35406
  ] }),
35381
35407
  asking ? /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
35382
35408
  /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
35383
- (0, import_records49.portalConfirmLine)(portal.title),
35409
+ (0, import_records50.portalConfirmLine)(portal.title),
35384
35410
  " Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
35385
35411
  ] }),
35386
35412
  /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
@@ -38200,7 +38226,7 @@ function FieldHistoryPanel({
38200
38226
  }
38201
38227
 
38202
38228
  // src/forms.ts
38203
- var import_records50 = require("@ai-matrx/records");
38229
+ var import_records51 = require("@ai-matrx/records");
38204
38230
  var FORM_STATE_WORDS = {
38205
38231
  draft: "Not published \u2014 the link does not answer yet.",
38206
38232
  open: "Open \u2014 anyone with the link can answer it.",
@@ -38383,7 +38409,7 @@ function formLookFromDocument(raw) {
38383
38409
  const doc = raw;
38384
38410
  const id = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
38385
38411
  const look = {
38386
- accent: (0, import_records50.isPortalAccent)(doc["accent"]) ? doc["accent"] : null,
38412
+ accent: (0, import_records51.isPortalAccent)(doc["accent"]) ? doc["accent"] : null,
38387
38413
  logoFileId: id(doc["logo_file_id"]),
38388
38414
  coverFileId: id(doc["cover_file_id"])
38389
38415
  };
@@ -38493,7 +38519,7 @@ var import_design_system106 = require("@ai-matrx/design-system");
38493
38519
  // src/ChartBlock.tsx
38494
38520
  var import_react218 = require("react");
38495
38521
  var import_recharts = require("recharts");
38496
- var import_records51 = require("@ai-matrx/records");
38522
+ var import_records52 = require("@ai-matrx/records");
38497
38523
  var import_core21 = require("@ai-matrx/records/core");
38498
38524
  var import_design_system105 = require("@ai-matrx/design-system");
38499
38525
  var import_format11 = require("@ai-matrx/kit/format");
@@ -38971,7 +38997,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
38971
38997
  const kind = block.kind;
38972
38998
  const tableId = block.table_id ?? subject;
38973
38999
  const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
38974
- const primary = (0, import_records51.measureKey)(measures[0]);
39000
+ const primary = (0, import_records52.measureKey)(measures[0]);
38975
39001
  const windows = kind === "stuck" ? null : block.compare ?? null;
38976
39002
  const compared = !!windows;
38977
39003
  const grain = block.bucket?.by ?? null;
@@ -39923,7 +39949,7 @@ function clientNoun(table) {
39923
39949
  var import_clipboard7 = require("@ai-matrx/kit/clipboard");
39924
39950
  var import_react225 = require("react");
39925
39951
  var import_react226 = require("@ai-matrx/records/react");
39926
- var import_records53 = require("@ai-matrx/records");
39952
+ var import_records54 = require("@ai-matrx/records");
39927
39953
  var import_design_system111 = require("@ai-matrx/design-system");
39928
39954
 
39929
39955
  // src/PortalLookEditor.tsx
@@ -39932,11 +39958,11 @@ var import_react224 = require("@ai-matrx/records/react");
39932
39958
  var import_design_system110 = require("@ai-matrx/design-system");
39933
39959
 
39934
39960
  // src/AccentSwatches.tsx
39935
- var import_records52 = require("@ai-matrx/records");
39961
+ var import_records53 = require("@ai-matrx/records");
39936
39962
  var import_design_system108 = require("@ai-matrx/design-system");
39937
39963
  var import_data_table23 = require("@ai-matrx/design-system/data-table");
39938
39964
  var import_jsx_runtime125 = require("react/jsx-runtime");
39939
- function AccentSwatches({ value, onChange, options = import_records52.PORTAL_ACCENTS, noneLabel = "App colour" }) {
39965
+ function AccentSwatches({ value, onChange, options = import_records53.PORTAL_ACCENTS, noneLabel = "App colour" }) {
39940
39966
  return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
39941
39967
  /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
39942
39968
  "button",
@@ -40403,7 +40429,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
40403
40429
  ] }) : null,
40404
40430
  activePortalId && !shown4.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime128.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,
40405
40431
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("ul", { className: "flex flex-col gap-2", children: shown4.map((portal) => {
40406
- const url = `${origin}${(0, import_records53.portalPath)(portal.slug)}`;
40432
+ const url = `${origin}${(0, import_records54.portalPath)(portal.slug)}`;
40407
40433
  const open = openId === portal.portal_id;
40408
40434
  const linked = portal.portal_id === activePortalId;
40409
40435
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
@@ -40518,8 +40544,8 @@ function ArchivePortalControl({
40518
40544
  }
40519
40545
  ),
40520
40546
  asking ? /* @__PURE__ */ (0, import_jsx_runtime128.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: [
40521
- /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records53.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
40522
- /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records53.portalConfirmLine)(portal.title) }),
40547
+ /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records54.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
40548
+ /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records54.portalConfirmLine)(portal.title) }),
40523
40549
  /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
40524
40550
  /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
40525
40551
  import_design_system111.BasicInput,
@@ -40537,7 +40563,7 @@ function ArchivePortalControl({
40537
40563
  size: "sm",
40538
40564
  variant: "destructive",
40539
40565
  "data-testid": "portal-archive-do",
40540
- disabled: busy || !(0, import_records53.portalTitleTypedBack)(typed2, portal.title),
40566
+ disabled: busy || !(0, import_records54.portalTitleTypedBack)(typed2, portal.title),
40541
40567
  onClick: () => void go(),
40542
40568
  children: busy ? "Archiving\u2026" : "Archive it"
40543
40569
  }
@@ -41062,7 +41088,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
41062
41088
  // src/DigestScheduler.tsx
41063
41089
  var import_react227 = require("react");
41064
41090
  var import_react228 = require("@ai-matrx/records/react");
41065
- var import_records54 = require("@ai-matrx/records");
41091
+ var import_records55 = require("@ai-matrx/records");
41066
41092
  var import_design_system113 = require("@ai-matrx/design-system");
41067
41093
 
41068
41094
  // src/scheduleWords.ts
@@ -41148,7 +41174,7 @@ function DigestScheduler({
41148
41174
  const [channel, setChannel] = (0, import_react227.useState)(
41149
41175
  existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
41150
41176
  );
41151
- const [quiet2, setQuiet] = (0, import_react227.useState)((0, import_records54.hasQuietHours)(existing?.quiet_hours));
41177
+ const [quiet2, setQuiet] = (0, import_react227.useState)((0, import_records55.hasQuietHours)(existing?.quiet_hours));
41152
41178
  const [quietFrom, setQuietFrom] = (0, import_react227.useState)(existing?.quiet_hours?.start ?? "22:00");
41153
41179
  const [quietTo, setQuietTo] = (0, import_react227.useState)(existing?.quiet_hours?.end ?? "07:00");
41154
41180
  const [recipients, setRecipients] = (0, import_react227.useState)(
@@ -41434,7 +41460,7 @@ function DigestScheduler({
41434
41460
  // src/SubscriptionsPanel.tsx
41435
41461
  var import_react231 = require("react");
41436
41462
  var import_react232 = require("@ai-matrx/records/react");
41437
- var import_records55 = require("@ai-matrx/records");
41463
+ var import_records56 = require("@ai-matrx/records");
41438
41464
  var import_design_system115 = require("@ai-matrx/design-system");
41439
41465
 
41440
41466
  // src/WebhooksPanel.tsx
@@ -41797,7 +41823,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
41797
41823
  "Last told you ",
41798
41824
  new Date(subscription.last_sent_at).toLocaleString()
41799
41825
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: "It has not told you anything yet." }),
41800
- (0, import_records55.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("span", { children: [
41826
+ (0, import_records56.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("span", { children: [
41801
41827
  "Not between ",
41802
41828
  subscription.quiet_hours.start,
41803
41829
  " and ",
@@ -41868,7 +41894,7 @@ var import_core22 = require("@dnd-kit/core");
41868
41894
  var import_sortable = require("@dnd-kit/sortable");
41869
41895
  var import_utilities = require("@dnd-kit/utilities");
41870
41896
  var import_react237 = require("@ai-matrx/records/react");
41871
- var import_records56 = require("@ai-matrx/records");
41897
+ var import_records57 = require("@ai-matrx/records");
41872
41898
  var import_design_system119 = require("@ai-matrx/design-system");
41873
41899
 
41874
41900
  // src/FormFlowEditor.tsx
@@ -43191,7 +43217,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
43191
43217
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
43192
43218
  PublishRow,
43193
43219
  {
43194
- url: `${publicOrigin}${(0, import_records56.publicFormPath)(draft.id)}`,
43220
+ url: `${publicOrigin}${(0, import_records57.publicFormPath)(draft.id)}`,
43195
43221
  state: draft.state,
43196
43222
  mayPublish: rights.structure,
43197
43223
  why: rights.why("structure"),
@@ -43203,7 +43229,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
43203
43229
  unsaved: dirty
43204
43230
  }
43205
43231
  ),
43206
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records56.publicFormPath)(draft.id)}`, label: draft.name }),
43232
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records57.publicFormPath)(draft.id)}`, label: draft.name }),
43207
43233
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
43208
43234
  NotifyOnAnswer,
43209
43235
  {
@@ -44256,7 +44282,7 @@ function SignBlock({ tableId, recordId, render, className }) {
44256
44282
  // src/NotifyRuleEditor.tsx
44257
44283
  var import_react245 = require("react");
44258
44284
  var import_react246 = require("@ai-matrx/records/react");
44259
- var import_records57 = require("@ai-matrx/records");
44285
+ var import_records58 = require("@ai-matrx/records");
44260
44286
  var import_design_system123 = require("@ai-matrx/design-system");
44261
44287
  var import_jsx_runtime139 = require("react/jsx-runtime");
44262
44288
  var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
@@ -44407,7 +44433,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
44407
44433
  "next ",
44408
44434
  new Date(held.next_digest_at).toLocaleString()
44409
44435
  ] }) : null,
44410
- (0, import_records57.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { className: "text-muted-foreground", children: [
44436
+ (0, import_records58.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { className: "text-muted-foreground", children: [
44411
44437
  "quiet ",
44412
44438
  held.quiet_hours.start,
44413
44439
  "\u2013",
@@ -45093,7 +45119,7 @@ function AddChart({ subject, onAdd, onClose }) {
45093
45119
  }
45094
45120
 
45095
45121
  // src/pages.ts
45096
- var import_records58 = require("@ai-matrx/records");
45122
+ var import_records59 = require("@ai-matrx/records");
45097
45123
  var PAGE_BLOCK_KINDS = ["list", "record", "button", "form", "filter", "chart", "heading", "text", "applet"];
45098
45124
  var PAGE_BLOCK_LABEL = {
45099
45125
  list: "List",
@@ -45143,10 +45169,10 @@ function filterTargets(filter, blocks) {
45143
45169
  }
45144
45170
  function combineFilter(base, extra, fieldIdOf) {
45145
45171
  const extraKeys = Object.keys(extra);
45146
- if (!base || !(0, import_records58.isRuleFilter)(base) && Object.keys(base).length === 0) {
45172
+ if (!base || !(0, import_records59.isRuleFilter)(base) && Object.keys(base).length === 0) {
45147
45173
  return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
45148
45174
  }
45149
- if (!(0, import_records58.isRuleFilter)(base)) return { filter: { ...base, ...extra }, dropped: [] };
45175
+ if (!(0, import_records59.isRuleFilter)(base)) return { filter: { ...base, ...extra }, dropped: [] };
45150
45176
  const dropped = [];
45151
45177
  let rule = base;
45152
45178
  for (const key of extraKeys) {
@@ -45804,7 +45830,7 @@ var import_design_system128 = require("@ai-matrx/design-system");
45804
45830
  var import_react256 = require("@ai-matrx/records/react");
45805
45831
 
45806
45832
  // src/question.ts
45807
- var import_records59 = require("@ai-matrx/records");
45833
+ var import_records60 = require("@ai-matrx/records");
45808
45834
  var import_core24 = require("@ai-matrx/records/core");
45809
45835
  var QUESTION_OPS = ["count", "sum", "avg", "min", "max"];
45810
45836
  var QUESTION_LIMIT_DEFAULT = 25;
@@ -45883,7 +45909,7 @@ async function askQuestion(client, tableId, spec, fields) {
45883
45909
  for (const m of measures) {
45884
45910
  if (m.op !== "count" && !m.key) return refusal2(`Pick the column to ${m.op === "avg" ? "average" : m.op}.`);
45885
45911
  }
45886
- const keys = measures.map((m) => (0, import_records59.measureKey)({ op: m.op, ...m.key ? { key: m.key } : {} }));
45912
+ const keys = measures.map((m) => (0, import_records60.measureKey)({ op: m.op, ...m.key ? { key: m.key } : {} }));
45887
45913
  const group = spec.group;
45888
45914
  if (spec.asOf) return askAsOf(client, tableId, spec, fields, measures, keys);
45889
45915
  let filter = spec.where ?? {};
@@ -46728,7 +46754,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
46728
46754
  // src/TableAsk.tsx
46729
46755
  var import_react257 = require("react");
46730
46756
  var import_design_system129 = require("@ai-matrx/design-system");
46731
- var import_records60 = require("@ai-matrx/records");
46757
+ var import_records61 = require("@ai-matrx/records");
46732
46758
  var import_react258 = require("@ai-matrx/records/react");
46733
46759
 
46734
46760
  // src/askWords.ts
@@ -46958,7 +46984,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
46958
46984
  await Promise.all(
46959
46985
  all.filter(isChoiceField).map(async (field2) => {
46960
46986
  const got = await fieldOptionsOnce(client, field2.id);
46961
- if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records60.optionLabel)(o)).filter((w) => Boolean(w));
46987
+ if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records61.optionLabel)(o)).filter((w) => Boolean(w));
46962
46988
  })
46963
46989
  );
46964
46990
  const read = questionFromWords(words2, all, choices);
@@ -47808,7 +47834,7 @@ function onePerKey3(all) {
47808
47834
  var import_clipboard11 = require("@ai-matrx/kit/clipboard");
47809
47835
  var import_react261 = require("react");
47810
47836
  var import_react262 = require("@ai-matrx/records/react");
47811
- var import_records61 = require("@ai-matrx/records");
47837
+ var import_records62 = require("@ai-matrx/records");
47812
47838
  var import_design_system131 = require("@ai-matrx/design-system");
47813
47839
  var import_jsx_runtime148 = require("react/jsx-runtime");
47814
47840
  var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
@@ -47913,7 +47939,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
47913
47939
  }
47914
47940
  ) : null,
47915
47941
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
47916
- const url = `${origin}${(0, import_records61.publicFormPath)(form.form_id)}`;
47942
+ const url = `${origin}${(0, import_records62.publicFormPath)(form.form_id)}`;
47917
47943
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
47918
47944
  "li",
47919
47945
  {
@@ -47995,7 +48021,7 @@ var import_design_system133 = require("@ai-matrx/design-system");
47995
48021
 
47996
48022
  // src/CaptureRun.tsx
47997
48023
  var import_react263 = require("react");
47998
- var import_records62 = require("@ai-matrx/records");
48024
+ var import_records63 = require("@ai-matrx/records");
47999
48025
  var import_react264 = require("@ai-matrx/records/react");
48000
48026
  var import_design_system132 = require("@ai-matrx/design-system");
48001
48027
  var import_jsx_runtime149 = require("react/jsx-runtime");
@@ -48050,7 +48076,7 @@ function CaptureRun({ sheetId, face: given, className }) {
48050
48076
  const [sending, setSending] = (0, import_react263.useState)(false);
48051
48077
  const queueRef = (0, import_react263.useRef)(null);
48052
48078
  (0, import_react263.useEffect)(() => {
48053
- const q2 = (0, import_records62.openCaptureQueue)({
48079
+ const q2 = (0, import_records63.openCaptureQueue)({
48054
48080
  onChange: (c, all) => {
48055
48081
  setCounts(c);
48056
48082
  setItems(all);
@@ -48317,7 +48343,7 @@ function CaptureRun({ sheetId, face: given, className }) {
48317
48343
  value: String(answers[q.field] ?? ""),
48318
48344
  onChange: (e) => {
48319
48345
  const raw = e.target.value;
48320
- const answered2 = field2 ? (0, import_records62.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records62.coercionLabel)(field2) }) : { value: raw };
48346
+ const answered2 = field2 ? (0, import_records63.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records63.coercionLabel)(field2) }) : { value: raw };
48321
48347
  setAnswers((held) => ({
48322
48348
  ...held,
48323
48349
  [q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
@@ -48971,7 +48997,7 @@ function useEmbedHandshake(args) {
48971
48997
  // src/TablePage.tsx
48972
48998
  var import_clipboard14 = require("@ai-matrx/kit/clipboard");
48973
48999
  var import_react283 = require("react");
48974
- var import_records63 = require("@ai-matrx/records");
49000
+ var import_records64 = require("@ai-matrx/records");
48975
49001
  var import_react284 = require("@ai-matrx/records/react");
48976
49002
  var import_design_system143 = require("@ai-matrx/design-system");
48977
49003
  var import_text_case19 = require("@ai-matrx/kit/text-case");
@@ -49806,7 +49832,7 @@ function TableNotHere({
49806
49832
  return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: (0, import_design_system143.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
49807
49833
  /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
49808
49834
  /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
49809
- /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records63.archivedByLine)(row) }),
49835
+ /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records64.archivedByLine)(row) }),
49810
49836
  refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(RefusalNotice, { error: refusal3 }) : null,
49811
49837
  /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "flex gap-2", children: [
49812
49838
  /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
@@ -51261,7 +51287,7 @@ function TablePage2(props) {
51261
51287
 
51262
51288
  // src/DataBindingPicker.tsx
51263
51289
  var import_react287 = require("react");
51264
- var import_records64 = require("@ai-matrx/records");
51290
+ var import_records65 = require("@ai-matrx/records");
51265
51291
  var import_react288 = require("@ai-matrx/records/react");
51266
51292
  var import_design_system146 = require("@ai-matrx/design-system");
51267
51293
  var import_jsx_runtime163 = require("react/jsx-runtime");
@@ -51295,7 +51321,7 @@ function isCompleteDataBinding(binding) {
51295
51321
  }
51296
51322
  function bindingPlaceholdersFor(field2) {
51297
51323
  const label = fieldName(field2);
51298
- if ((0, import_records64.isEntityReferenceConfig)(field2.config)) {
51324
+ if ((0, import_records65.isEntityReferenceConfig)(field2.config)) {
51299
51325
  return [
51300
51326
  { token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
51301
51327
  { token: `{${field2.key}.id}`, label: `${label} \xB7 id` }