@ai-matrx/records-ui 0.102.8 → 0.102.11

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/pickers.cjs CHANGED
@@ -44,7 +44,7 @@ module.exports = __toCommonJS(pickers_exports);
44
44
  // src/TablePickers.tsx
45
45
  var import_react30 = require("react");
46
46
  var import_react31 = require("@ai-matrx/records/react");
47
- var import_design_system16 = require("@ai-matrx/design-system");
47
+ var import_design_system17 = require("@ai-matrx/design-system");
48
48
 
49
49
  // src/askOnce.ts
50
50
  var asked = /* @__PURE__ */ new WeakMap();
@@ -84,7 +84,7 @@ function fieldOptionsOnce(client, fieldId) {
84
84
  var import_react24 = require("react");
85
85
  var import_records10 = require("@ai-matrx/records");
86
86
  var import_react25 = require("@ai-matrx/records/react");
87
- var import_design_system14 = require("@ai-matrx/design-system");
87
+ var import_design_system15 = require("@ai-matrx/design-system");
88
88
 
89
89
  // src/dates.ts
90
90
  var import_field_formats = require("@ai-matrx/design-system/field-formats");
@@ -555,14 +555,54 @@ var UNREAD_RECORD_LABEL = "Couldn't load this name";
555
555
  var import_react3 = require("react");
556
556
  var import_records3 = require("@ai-matrx/records");
557
557
  var import_react4 = require("@ai-matrx/records/react");
558
- var import_design_system4 = require("@ai-matrx/design-system");
558
+ var import_design_system5 = require("@ai-matrx/design-system");
559
559
 
560
560
  // src/PickOrAdd.tsx
561
561
  var import_react2 = require("react");
562
+
563
+ // src/personChip.tsx
562
564
  var import_design_system2 = require("@ai-matrx/design-system");
563
565
  var import_jsx_runtime2 = require("react/jsx-runtime");
566
+ function initialsOf(name) {
567
+ const words = name.replace(/@.*$/, "").split(/[\s._-]+/).filter((w) => /\p{L}|\d/u.test(w));
568
+ const letters = words.filter((w) => !/^(dr|mr|mrs|ms|prof)\.?$/i.test(w)).slice(0, 2).map((w) => (w.match(/[\p{L}\d]/u)?.[0] ?? "").toUpperCase());
569
+ return letters.join("") || "?";
570
+ }
571
+ function PersonAvatar({ name, size = "sm" }) {
572
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
573
+ "span",
574
+ {
575
+ "aria-hidden": "true",
576
+ "data-records-person-avatar": "",
577
+ className: (0, import_design_system2.cn)(
578
+ "inline-flex shrink-0 items-center justify-center rounded-full bg-foreground/10 font-medium text-foreground/80",
579
+ size === "md" ? "size-5 text-[10px]" : "size-4 text-[9px]"
580
+ ),
581
+ children: initialsOf(name)
582
+ }
583
+ );
584
+ }
585
+ function PersonChip({ name, onRemove, className }) {
586
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
587
+ "span",
588
+ {
589
+ "data-records-person-chip": "",
590
+ title: name,
591
+ className: (0, import_design_system2.cn)("inline-flex min-w-0 max-w-full items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2 text-[11px] text-foreground", className),
592
+ children: [
593
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PersonAvatar, { name }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 truncate", children: name }),
595
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${name}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
596
+ ]
597
+ }
598
+ );
599
+ }
600
+
601
+ // src/PickOrAdd.tsx
602
+ var import_design_system3 = require("@ai-matrx/design-system");
603
+ var import_jsx_runtime3 = require("react/jsx-runtime");
564
604
  function Glyph({ d, className }) {
565
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d }) });
605
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d }) });
566
606
  }
567
607
  var TICK = "m5 12 4 4L19 6";
568
608
  var CROSS = "M18 6 6 18M6 6l12 12";
@@ -612,6 +652,7 @@ function PickRow({
612
652
  disabled,
613
653
  attrs,
614
654
  icon,
655
+ person,
615
656
  onPick,
616
657
  onPoint
617
658
  }) {
@@ -619,7 +660,7 @@ function PickRow({
619
660
  (0, import_react2.useEffect)(() => {
620
661
  if (highlighted) ref.current?.scrollIntoView?.({ block: "nearest" });
621
662
  }, [highlighted]);
622
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
663
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
623
664
  "button",
624
665
  {
625
666
  ref,
@@ -632,18 +673,19 @@ function PickRow({
632
673
  title: title ?? label,
633
674
  ...attrs ?? {},
634
675
  "data-pick-highlighted": highlighted ? "" : void 0,
635
- className: (0, import_design_system2.cn)(
676
+ className: (0, import_design_system3.cn)(
636
677
  "flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none disabled:opacity-50",
637
678
  highlighted ? "bg-accent text-accent-foreground" : ""
638
679
  ),
639
680
  children: [
640
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "flex size-3.5 shrink-0 items-center justify-center", children: [
641
- picked ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-pick-tick": "", className: "contents", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Glyph, { d: TICK, className: "size-3.5" }) }) : null,
642
- icon === "plus" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Glyph, { d: PLUS, className: "size-3.5 text-muted-foreground" }) : null
681
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "flex size-3.5 shrink-0 items-center justify-center", children: [
682
+ picked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "data-pick-tick": "", className: "contents", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Glyph, { d: TICK, className: "size-3.5" }) }) : null,
683
+ icon === "plus" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Glyph, { d: PLUS, className: "size-3.5 text-muted-foreground" }) : null
643
684
  ] }),
644
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "min-w-0 flex-1", children: [
645
- chip ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_design_system2.cn)("inline-flex max-w-full truncate rounded-md border px-1.5 py-0.5 text-xs font-medium", chip), "data-records-choice-chip": "", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "block truncate", children: label }),
646
- detail ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "block truncate text-xs text-muted-foreground", "data-tell-apart": "", children: detail }) : null
685
+ person ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PersonAvatar, { name: label, size: "md" }) : null,
686
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "min-w-0 flex-1", children: [
687
+ chip ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_design_system3.cn)("inline-flex max-w-full truncate rounded-md border px-1.5 py-0.5 text-xs font-medium", chip), "data-records-choice-chip": "", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "block truncate", children: label }),
688
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "block truncate text-xs text-muted-foreground", "data-tell-apart": "", children: detail }) : null
647
689
  ] })
648
690
  ]
649
691
  }
@@ -651,31 +693,33 @@ function PickRow({
651
693
  }
652
694
  function PickChips({ chips }) {
653
695
  if (chips.length === 0) return null;
654
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-wrap gap-1 px-1 pb-1", "data-pick-chips": "", children: chips.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
655
- "span",
656
- {
657
- "data-pick-chip": "",
658
- title: c.label,
659
- className: (0, import_design_system2.cn)(
660
- "inline-flex max-w-full items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs font-medium",
661
- c.chip ?? "bg-secondary text-secondary-foreground"
662
- ),
663
- children: [
664
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 truncate", children: c.label }),
665
- c.onRemove ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
666
- "button",
667
- {
668
- type: "button",
669
- "aria-label": `Remove ${c.label}`,
670
- onClick: c.onRemove,
671
- className: "shrink-0 rounded-sm opacity-60 hover:opacity-100",
672
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Glyph, { d: CROSS, className: "size-3" })
673
- }
674
- ) : null
675
- ]
676
- },
677
- c.id
678
- )) });
696
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex flex-wrap gap-1 px-1 pb-1", "data-pick-chips": "", children: chips.map(
697
+ (c) => c.person ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PersonChip, { name: c.label, onRemove: c.onRemove }, c.id) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
698
+ "span",
699
+ {
700
+ "data-pick-chip": "",
701
+ title: c.label,
702
+ className: (0, import_design_system3.cn)(
703
+ "inline-flex max-w-full items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs font-medium",
704
+ c.chip ?? "bg-secondary text-secondary-foreground"
705
+ ),
706
+ children: [
707
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-0 truncate", children: c.label }),
708
+ c.onRemove ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
709
+ "button",
710
+ {
711
+ type: "button",
712
+ "aria-label": `Remove ${c.label}`,
713
+ onClick: c.onRemove,
714
+ className: "shrink-0 rounded-sm opacity-60 hover:opacity-100",
715
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Glyph, { d: CROSS, className: "size-3" })
716
+ }
717
+ ) : null
718
+ ]
719
+ },
720
+ c.id
721
+ )
722
+ ) });
679
723
  }
680
724
  function PickOrAdd({
681
725
  triggerLabel,
@@ -696,19 +740,24 @@ function PickOrAdd({
696
740
  anchored,
697
741
  children,
698
742
  chips,
699
- multi
743
+ multi,
744
+ addFirst
700
745
  }) {
701
746
  const addRow = add && !foot ? add : null;
702
747
  const count = items.length + (addRow ? 1 : 0);
748
+ const addAt = addRow ? addFirst ? 0 : items.length : -1;
749
+ const itemAt = (index) => addRow && addFirst ? index - 1 : index;
703
750
  const removable = (chips ?? []).filter((c) => c.onRemove);
704
751
  const keys = useListKeys({
705
752
  count,
706
753
  resetOn: search,
707
754
  onPick: (index) => {
708
- const item = items[index];
709
- if (item) {
710
- if (!item.disabled) onPick(item.id);
711
- } else if (addRow && !addRow.disabled) addRow.onAdd();
755
+ if (index === addAt) {
756
+ if (addRow && !addRow.disabled) addRow.onAdd();
757
+ return;
758
+ }
759
+ const item = items[itemAt(index)];
760
+ if (item && !item.disabled) onPick(item.id);
712
761
  },
713
762
  onNothing: onEnterWithNoMatch ?? (add && !add.disabled ? add.onAdd : void 0),
714
763
  onClose: () => onOpenChange(false),
@@ -717,10 +766,23 @@ function PickOrAdd({
717
766
  searchEmpty: search === ""
718
767
  });
719
768
  const hasFoot = Boolean(foot) || Boolean(footNote);
720
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.Popover, { open, onOpenChange, children: [
721
- anchored ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_design_system2.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", "aria-label": triggerLabel, children: triggerText }) }),
722
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
723
- import_design_system2.PopoverContent,
769
+ const addRowNode = addRow ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
770
+ PickRow,
771
+ {
772
+ label: addRow.label,
773
+ picked: false,
774
+ icon: "plus",
775
+ disabled: addRow.disabled,
776
+ attrs: { "data-pick-add": "" },
777
+ highlighted: addAt === keys.highlight,
778
+ onPick: addRow.onAdd,
779
+ onPoint: () => keys.setHighlight(addAt)
780
+ }
781
+ ) : null;
782
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Popover, { open, onOpenChange, children: [
783
+ anchored ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", "aria-label": triggerLabel, children: triggerText }) }),
784
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
785
+ import_design_system3.PopoverContent,
724
786
  {
725
787
  sizing: "content",
726
788
  padding: "xs",
@@ -736,9 +798,9 @@ function PickOrAdd({
736
798
  if (anchored) event.preventDefault();
737
799
  },
738
800
  children: [
739
- chips ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PickChips, { chips }) : null,
740
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
741
- import_design_system2.BasicInput,
801
+ chips ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PickChips, { chips }) : null,
802
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
803
+ import_design_system3.BasicInput,
742
804
  {
743
805
  value: search,
744
806
  onChange: (e) => onSearch(e.target.value),
@@ -751,9 +813,10 @@ function PickOrAdd({
751
813
  }
752
814
  ),
753
815
  notice,
754
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_design_system2.ScrollArea, { className: "max-h-64", children: [
755
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { role: "listbox", "aria-label": triggerLabel, "aria-multiselectable": multi ? true : void 0, children: [
756
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
816
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.ScrollArea, { className: "max-h-64", children: [
817
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { role: "listbox", "aria-label": triggerLabel, "aria-multiselectable": multi ? true : void 0, children: [
818
+ addFirst ? addRowNode : null,
819
+ items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
757
820
  PickRow,
758
821
  {
759
822
  label: item.label,
@@ -763,29 +826,18 @@ function PickOrAdd({
763
826
  picked: item.picked,
764
827
  disabled: item.disabled,
765
828
  attrs: item.attrs,
766
- highlighted: index === keys.highlight,
829
+ person: item.person,
830
+ highlighted: (addRow && addFirst ? index + 1 : index) === keys.highlight,
767
831
  onPick: () => onPick(item.id),
768
- onPoint: () => keys.setHighlight(index)
832
+ onPoint: () => keys.setHighlight(addRow && addFirst ? index + 1 : index)
769
833
  },
770
834
  item.id
771
835
  )),
772
- addRow ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
773
- PickRow,
774
- {
775
- label: addRow.label,
776
- picked: false,
777
- icon: "plus",
778
- disabled: addRow.disabled,
779
- attrs: { "data-pick-add": "" },
780
- highlighted: items.length === keys.highlight,
781
- onPick: addRow.onAdd,
782
- onPoint: () => keys.setHighlight(items.length)
783
- }
784
- ) : null
836
+ addFirst ? null : addRowNode
785
837
  ] }),
786
838
  items.length === 0 && empty ? empty : null
787
839
  ] }),
788
- hasFoot ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mt-1 border-t pt-1", children: [
840
+ hasFoot ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mt-1 border-t pt-1", children: [
789
841
  foot,
790
842
  footNote
791
843
  ] }) : null
@@ -796,7 +848,7 @@ function PickOrAdd({
796
848
  }
797
849
 
798
850
  // src/Refusal.tsx
799
- var import_design_system3 = require("@ai-matrx/design-system");
851
+ var import_design_system4 = require("@ai-matrx/design-system");
800
852
 
801
853
  // src/plainWords.ts
802
854
  var MACHINE_IDENTITY = [
@@ -980,7 +1032,7 @@ function refusalLineForAPerson(error) {
980
1032
  }
981
1033
 
982
1034
  // src/Refusal.tsx
983
- var import_jsx_runtime3 = require("react/jsx-runtime");
1035
+ var import_jsx_runtime4 = require("react/jsx-runtime");
984
1036
  function RefusalNotice({
985
1037
  error,
986
1038
  className,
@@ -989,8 +1041,8 @@ function RefusalNotice({
989
1041
  onDiscard
990
1042
  }) {
991
1043
  const plain = refusalForAPerson(error);
992
- const doors = onKeepEditing || onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
993
- onKeepEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1044
+ const doors = onKeepEditing || onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
1045
+ onKeepEditing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
994
1046
  "button",
995
1047
  {
996
1048
  type: "button",
@@ -1000,7 +1052,7 @@ function RefusalNotice({
1000
1052
  children: "Keep editing"
1001
1053
  }
1002
1054
  ) : null,
1003
- onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1055
+ onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1004
1056
  "button",
1005
1057
  {
1006
1058
  type: "button",
@@ -1011,21 +1063,21 @@ function RefusalNotice({
1011
1063
  }
1012
1064
  ) : null
1013
1065
  ] }) : null;
1014
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1015
- import_design_system3.Alert,
1066
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1067
+ import_design_system4.Alert,
1016
1068
  {
1017
1069
  variant: "destructive",
1018
1070
  role: "alert",
1019
1071
  "data-refusal-notice": "",
1020
- className: (0, import_design_system3.cn)("text-xs", className),
1072
+ className: (0, import_design_system4.cn)("text-xs", className),
1021
1073
  errorFacts: { message: plain.sentence, title: plain.title, error, origin: "records-ui/RefusalNotice" },
1022
1074
  ...plain.forEngineers ? { "data-for-engineers": plain.forEngineers } : {},
1023
1075
  ...error.sqlstate ? { "data-sqlstate": error.sqlstate } : {},
1024
1076
  children: [
1025
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.AlertTitle, { className: "text-xs font-medium", children: plain.storeSaid ? plain.sentence : plain.title }),
1026
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.AlertDescription, { className: "space-y-1 text-xs", children: [
1027
- plain.storeSaid || plain.sentence.replace(/\.$/, "") === plain.title ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: plain.sentence }),
1028
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "opacity-80", children: plain.remedy }),
1077
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_design_system4.AlertTitle, { className: "text-xs font-medium", children: plain.storeSaid ? plain.sentence : plain.title }),
1078
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_design_system4.AlertDescription, { className: "space-y-1 text-xs", children: [
1079
+ plain.storeSaid || plain.sentence.replace(/\.$/, "") === plain.title ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: plain.sentence }),
1080
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "opacity-80", children: plain.remedy }),
1029
1081
  actions,
1030
1082
  doors
1031
1083
  ] })
@@ -1035,11 +1087,11 @@ function RefusalNotice({
1035
1087
  }
1036
1088
  function RefusalLine({ error, className }) {
1037
1089
  const plain = refusalForAPerson(error);
1038
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1039
- import_design_system3.ErrorBox,
1090
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1091
+ import_design_system4.ErrorBox,
1040
1092
  {
1041
1093
  "data-refusal-line": "",
1042
- className: (0, import_design_system3.cn)("text-xs text-destructive", className),
1094
+ className: (0, import_design_system4.cn)("text-xs text-destructive", className),
1043
1095
  message: refusalLineForAPerson(error),
1044
1096
  error,
1045
1097
  origin: "records-ui/RefusalLine",
@@ -1100,7 +1152,7 @@ function tellApart(rows, nameOf2) {
1100
1152
  }
1101
1153
 
1102
1154
  // src/RelationPicker.tsx
1103
- var import_jsx_runtime4 = (
1155
+ var import_jsx_runtime5 = (
1104
1156
  // The Field's own name is already printed above this control by
1105
1157
  // `FieldLabel`, so the sentence does not say it a second time.
1106
1158
  require("react/jsx-runtime")
@@ -1188,10 +1240,10 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1188
1240
  };
1189
1241
  }, [client, open, allowCreate, target, targetRefusal, field.relation_target]);
1190
1242
  if (!client) {
1191
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { id, className: (0, import_design_system4.cn)("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON });
1243
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id, className: (0, import_design_system5.cn)("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON });
1192
1244
  }
1193
1245
  if (!field.relation_target) {
1194
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
1246
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
1195
1247
  fieldName(field),
1196
1248
  " points at records, but it does not say which Table yet, so there is nothing to pick from. A table admin sets its target in the field editor."
1197
1249
  ] });
@@ -1251,7 +1303,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1251
1303
  const apart = tellApart(rows ?? [], titleOf);
1252
1304
  const visible = (0, import_records3.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
1253
1305
  const anchored = autoOpen === true;
1254
- const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1306
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1255
1307
  RecordChip,
1256
1308
  {
1257
1309
  title: titleOf(recordId),
@@ -1261,12 +1313,12 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1261
1313
  ));
1262
1314
  return (
1263
1315
  // Never wider than where it is drawn (a grid cell beside a sticky column: B3-07) — chips truncate, the button wraps.
1264
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_design_system4.cn)("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
1316
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_design_system5.cn)("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
1265
1317
  anchored && !disabled ? null : cellChips,
1266
1318
  disabled ? null : (
1267
1319
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
1268
1320
  // In a grid cell it hangs from the cell's own chips; what is picked heads the list with its ×.
1269
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1321
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1270
1322
  PickOrAdd,
1271
1323
  {
1272
1324
  anchored,
@@ -1288,17 +1340,17 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1288
1340
  attrs: { "data-relation-candidate": row.id }
1289
1341
  })),
1290
1342
  onPick: toggle,
1291
- notice: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1292
- refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RefusalLine, { error: refusal2, className: "p-2" }) : null,
1293
- !rows && !refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
1294
- full ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "p-2 text-xs text-muted-foreground", children: [
1343
+ notice: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1344
+ refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RefusalLine, { error: refusal2, className: "p-2" }) : null,
1345
+ !rows && !refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
1346
+ full ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "p-2 text-xs text-muted-foreground", children: [
1295
1347
  fieldName(field),
1296
1348
  " can point at ",
1297
1349
  field.relation_max,
1298
1350
  " at most. Remove one to add another."
1299
1351
  ] }) : null
1300
1352
  ] }),
1301
- empty: rows ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
1353
+ empty: rows ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
1302
1354
  add: allowCreate && !full && !targetRefusal && target && !creating ? {
1303
1355
  label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
1304
1356
  disabled: busy,
@@ -1313,9 +1365,9 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1313
1365
  }
1314
1366
  }
1315
1367
  } : null,
1316
- foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1 p-1", children: [
1317
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1318
- import_design_system4.BasicInput,
1368
+ foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1 p-1", children: [
1369
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1370
+ import_design_system5.BasicInput,
1319
1371
  {
1320
1372
  autoFocus: true,
1321
1373
  value: newTitle,
@@ -1331,8 +1383,8 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1331
1383
  "aria-label": `Name the new ${targetWord}`
1332
1384
  }
1333
1385
  ),
1334
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1335
- import_design_system4.Button,
1386
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1387
+ import_design_system5.Button,
1336
1388
  {
1337
1389
  type: "button",
1338
1390
  size: "sm",
@@ -1346,7 +1398,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1346
1398
  footNote: allowCreate && !full && createRefusal ? (
1347
1399
  // The typed title is still in the search box: the notice owns the
1348
1400
  // two doors out (lane REFUSAL-SWEEP).
1349
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1401
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1350
1402
  RefusalNotice,
1351
1403
  {
1352
1404
  error: createRefusal,
@@ -1370,7 +1422,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1370
1422
  // src/gridAttachments.tsx
1371
1423
  var import_react12 = require("react");
1372
1424
  var import_react13 = require("@ai-matrx/records/react");
1373
- var import_design_system7 = require("@ai-matrx/design-system");
1425
+ var import_design_system8 = require("@ai-matrx/design-system");
1374
1426
 
1375
1427
  // src/host.tsx
1376
1428
  var import_react5 = require("react");
@@ -1430,7 +1482,7 @@ function whatYouMayDo(level, known = true) {
1430
1482
  var NOT_ANSWERED_YET = whatYouMayDo(null, false);
1431
1483
 
1432
1484
  // src/host.tsx
1433
- var import_jsx_runtime5 = require("react/jsx-runtime");
1485
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1434
1486
  function tableRights(may, overallReason) {
1435
1487
  return {
1436
1488
  ...may,
@@ -1454,9 +1506,9 @@ var import_uuid2 = require("@ai-matrx/kit/uuid");
1454
1506
 
1455
1507
  // src/signature.tsx
1456
1508
  var import_react7 = require("react");
1457
- var import_design_system5 = require("@ai-matrx/design-system");
1509
+ var import_design_system6 = require("@ai-matrx/design-system");
1458
1510
  var import_react8 = require("@ai-matrx/records/react");
1459
- var import_jsx_runtime6 = require("react/jsx-runtime");
1511
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1460
1512
  var DRAWN = /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]{64,}$/;
1461
1513
  function drawnSignatureOf(value) {
1462
1514
  return typeof value === "string" && DRAWN.test(value) ? value : null;
@@ -1513,13 +1565,13 @@ function drawingOf(client, fileId) {
1513
1565
  return asked3;
1514
1566
  }
1515
1567
  function DrawnImage({ src, inCell }) {
1516
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1568
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1517
1569
  "img",
1518
1570
  {
1519
1571
  src,
1520
1572
  alt: SIGNED_WORD,
1521
1573
  "data-records-signature": "",
1522
- className: (0, import_design_system5.cn)("max-w-[12rem] object-contain object-left dark:invert", inCell ? "h-7" : "h-12")
1574
+ className: (0, import_design_system6.cn)("max-w-[12rem] object-contain object-left dark:invert", inCell ? "h-7" : "h-12")
1523
1575
  }
1524
1576
  );
1525
1577
  }
@@ -1547,11 +1599,11 @@ function SignatureDrawing({
1547
1599
  cancelled = true;
1548
1600
  };
1549
1601
  }, [client, recordId, fieldKey, knownFile]);
1550
- if (drawing?.src) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawnImage, { src: drawing.src, inCell });
1602
+ if (drawing?.src) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawnImage, { src: drawing.src, inCell });
1551
1603
  if (drawing?.hostFileId && host.fileImage) {
1552
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_design_system5.cn)("inline-block max-w-[12rem] dark:invert", inCell ? "h-7" : "h-12"), "data-records-signature": "", children: host.fileImage({ fileId: drawing.hostFileId, alt: SIGNED_WORD }) });
1604
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_design_system6.cn)("inline-block max-w-[12rem] dark:invert", inCell ? "h-7" : "h-12"), "data-records-signature": "", children: host.fileImage({ fileId: drawing.hostFileId, alt: SIGNED_WORD }) });
1553
1605
  }
1554
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-serif italic", children: String(value) });
1606
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-serif italic", children: String(value) });
1555
1607
  }
1556
1608
  function SignatureValue({
1557
1609
  value,
@@ -1561,12 +1613,12 @@ function SignatureValue({
1561
1613
  document: document2
1562
1614
  }) {
1563
1615
  const drawn = drawnSignatureOf(value);
1564
- if (drawn) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawnImage, { src: drawn, inCell });
1616
+ if (drawn) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawnImage, { src: drawn, inCell });
1565
1617
  const fileId = fieldKey ? signatureFileIn(document2, fieldKey) : null;
1566
1618
  if (value === SIGNED_WORD && (fileId || recordId && fieldKey)) {
1567
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SignatureDrawing, { recordId: recordId ?? null, fieldKey: fieldKey ?? null, fileId, value, inCell });
1619
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SignatureDrawing, { recordId: recordId ?? null, fieldKey: fieldKey ?? null, fileId, value, inCell });
1568
1620
  }
1569
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-serif italic", children: String(value) });
1621
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-serif italic", children: String(value) });
1570
1622
  }
1571
1623
  var INK = "#111827";
1572
1624
  var SIGNATURE_BUDGET_BYTES = 6e4;
@@ -1649,14 +1701,14 @@ function SignaturePad({
1649
1701
  onChange(null);
1650
1702
  };
1651
1703
  if (!showPad) {
1652
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { id, className: (0, import_design_system5.cn)("flex items-center justify-between gap-2 rounded-md border px-3 py-2", className), children: [
1653
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SignatureValue, { value }),
1654
- !disabled ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Button, { type: "button", variant: "ghost", size: "sm", onClick: clear, children: "Sign again" }) : null
1704
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { id, className: (0, import_design_system6.cn)("flex items-center justify-between gap-2 rounded-md border px-3 py-2", className), children: [
1705
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SignatureValue, { value }),
1706
+ !disabled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Button, { type: "button", variant: "ghost", size: "sm", onClick: clear, children: "Sign again" }) : null
1655
1707
  ] });
1656
1708
  }
1657
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_design_system5.cn)("flex w-full flex-col gap-1", className), children: [
1658
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
1659
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1709
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_design_system6.cn)("flex w-full flex-col gap-1", className), children: [
1710
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
1711
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1660
1712
  "canvas",
1661
1713
  {
1662
1714
  id,
@@ -1669,17 +1721,17 @@ function SignaturePad({
1669
1721
  onPointerUp: end,
1670
1722
  onPointerLeave: end,
1671
1723
  onPointerCancel: end,
1672
- className: (0, import_design_system5.cn)(
1724
+ className: (0, import_design_system6.cn)(
1673
1725
  "block h-36 w-full touch-none rounded-md border border-border bg-white",
1674
1726
  disabled ? "cursor-not-allowed opacity-60" : "cursor-crosshair"
1675
1727
  )
1676
1728
  }
1677
1729
  ),
1678
- !dirty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pointer-events-none absolute inset-x-0 bottom-3 text-center text-xs text-neutral-400", children: "Sign here" }) : null
1730
+ !dirty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pointer-events-none absolute inset-x-0 bottom-3 text-center text-xs text-neutral-400", children: "Sign here" }) : null
1679
1731
  ] }),
1680
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-end gap-2", children: [
1681
- tooBig ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1682
- import_design_system5.ErrorBox,
1732
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-end gap-2", children: [
1733
+ tooBig ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1734
+ import_design_system6.ErrorBox,
1683
1735
  {
1684
1736
  as: "span",
1685
1737
  className: "mr-auto text-xs text-destructive",
@@ -1688,7 +1740,7 @@ function SignaturePad({
1688
1740
  origin: "records-ui/signature"
1689
1741
  }
1690
1742
  ) : null,
1691
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Button, { type: "button", variant: "ghost", size: "sm", onClick: clear, disabled: disabled || !dirty, children: "Clear" })
1743
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Button, { type: "button", variant: "ghost", size: "sm", onClick: clear, disabled: disabled || !dirty, children: "Clear" })
1692
1744
  ] })
1693
1745
  ] });
1694
1746
  }
@@ -1723,7 +1775,7 @@ function encodeAt(canvas, type, maxWidth, quality) {
1723
1775
  }
1724
1776
 
1725
1777
  // src/labels.tsx
1726
- var import_jsx_runtime7 = require("react/jsx-runtime");
1778
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1727
1779
  var LabelContext = (0, import_react9.createContext)({
1728
1780
  // With no provider the resolver is ABSENT, not silently empty: a caller gets
1729
1781
  // null and says "Loading…" forever, which is visible. The mount always
@@ -1911,7 +1963,7 @@ function RecordLabelProvider({ children }) {
1911
1963
  );
1912
1964
  const waiting = (0, import_react9.useCallback)((field) => waitingLines[field.id] ?? null, [waitingLines]);
1913
1965
  const value = (0, import_react9.useMemo)(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
1914
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LabelContext.Provider, { value, children });
1966
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LabelContext.Provider, { value, children });
1915
1967
  }
1916
1968
  function useRecordLabels(fields) {
1917
1969
  const { lookup, want } = (0, import_react9.useContext)(LabelContext);
@@ -1923,8 +1975,8 @@ function useRecordLabels(fields) {
1923
1975
 
1924
1976
  // src/FilePicker.tsx
1925
1977
  var import_react11 = require("react");
1926
- var import_design_system6 = require("@ai-matrx/design-system");
1927
- var import_jsx_runtime8 = require("react/jsx-runtime");
1978
+ var import_design_system7 = require("@ai-matrx/design-system");
1979
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1928
1980
  function FilePicker({
1929
1981
  label,
1930
1982
  accept,
@@ -1954,11 +2006,11 @@ function FilePicker({
1954
2006
  },
1955
2007
  [take]
1956
2008
  );
1957
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2009
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1958
2010
  "div",
1959
2011
  {
1960
2012
  "data-matrx-file-picker": true,
1961
- className: (0, import_design_system6.cn)("flex min-w-0 flex-col gap-1", className),
2013
+ className: (0, import_design_system7.cn)("flex min-w-0 flex-col gap-1", className),
1962
2014
  onDragOver: (e) => {
1963
2015
  if (disabled) return;
1964
2016
  e.preventDefault();
@@ -1967,16 +2019,16 @@ function FilePicker({
1967
2019
  onDragLeave: () => setOver(false),
1968
2020
  onDrop,
1969
2021
  children: [
1970
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2022
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1971
2023
  "div",
1972
2024
  {
1973
- className: (0, import_design_system6.cn)(
2025
+ className: (0, import_design_system7.cn)(
1974
2026
  "flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-dashed px-2 py-1.5",
1975
2027
  over ? "border-primary bg-primary/5" : "border-border",
1976
2028
  disabled && "opacity-60"
1977
2029
  ),
1978
2030
  children: [
1979
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2031
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1980
2032
  "input",
1981
2033
  {
1982
2034
  ref: input,
@@ -1993,8 +2045,8 @@ function FilePicker({
1993
2045
  }
1994
2046
  }
1995
2047
  ),
1996
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1997
- import_design_system6.Button,
2048
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2049
+ import_design_system7.Button,
1998
2050
  {
1999
2051
  type: "button",
2000
2052
  size: "sm",
@@ -2004,19 +2056,19 @@ function FilePicker({
2004
2056
  children: chosenName ? "Choose a different file" : label
2005
2057
  }
2006
2058
  ),
2007
- chosenName ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 flex-1 truncate text-xs", title: chosenName, children: chosenName }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-xs text-muted-foreground", children: "or drop it here" }),
2008
- chosenName && onClear ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system6.Button, { type: "button", size: "sm", variant: "ghost", disabled, onClick: onClear, children: "Cancel" }) : null
2059
+ chosenName ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 flex-1 truncate text-xs", title: chosenName, children: chosenName }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-muted-foreground", children: "or drop it here" }),
2060
+ chosenName && onClear ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system7.Button, { type: "button", size: "sm", variant: "ghost", disabled, onClick: onClear, children: "Cancel" }) : null
2009
2061
  ]
2010
2062
  }
2011
2063
  ),
2012
- hint && !chosenName ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-muted-foreground", children: hint }) : null
2064
+ hint && !chosenName ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-muted-foreground", children: hint }) : null
2013
2065
  ]
2014
2066
  }
2015
2067
  );
2016
2068
  }
2017
2069
 
2018
2070
  // src/gridAttachments.tsx
2019
- var import_jsx_runtime9 = require("react/jsx-runtime");
2071
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2020
2072
  function attachmentIdsOf(value) {
2021
2073
  return idsOf(value);
2022
2074
  }
@@ -2070,8 +2122,8 @@ function AttachmentChip({ id, onRemove }) {
2070
2122
  const words = read?.name ?? (read ? FILE_CHIP_UNREAD : "\u2026");
2071
2123
  const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
2072
2124
  const title = href ? `Open ${words}` : read?.why ?? FILE_CHIP_NO_PAGE;
2073
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_design_system7.Badge, { variant: "secondary", className: "max-w-[14rem] gap-1 text-[11px]", "data-records-file-chip": id, title, children: [
2074
- href ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2125
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system8.Badge, { variant: "secondary", className: "max-w-[14rem] gap-1 text-[11px]", "data-records-file-chip": id, title, children: [
2126
+ href ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2075
2127
  "a",
2076
2128
  {
2077
2129
  href,
@@ -2083,8 +2135,8 @@ function AttachmentChip({ id, onRemove }) {
2083
2135
  onMouseDown: (event) => event.stopPropagation(),
2084
2136
  children: words
2085
2137
  }
2086
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "truncate", children: words }),
2087
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2138
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "truncate", children: words }),
2139
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2088
2140
  "button",
2089
2141
  {
2090
2142
  type: "button",
@@ -2102,7 +2154,7 @@ function AttachmentChip({ id, onRemove }) {
2102
2154
  function AttachmentChips({ value, onRemove }) {
2103
2155
  const ids = attachmentIdsOf(value);
2104
2156
  if (ids.length === 0) return null;
2105
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-file-chips": "", children: ids.map((id) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AttachmentChip, { id, ...onRemove ? { onRemove: () => onRemove(id) } : {} }, id)) });
2157
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-file-chips": "", children: ids.map((id) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AttachmentChip, { id, ...onRemove ? { onRemove: () => onRemove(id) } : {} }, id)) });
2106
2158
  }
2107
2159
  function hostTakesFiles(host) {
2108
2160
  return Boolean(host.pickFiles || host.upload);
@@ -2147,19 +2199,19 @@ function AttachmentControl({
2147
2199
  void pick();
2148
2200
  }, [autoOpen]);
2149
2201
  if (!hostTakesFiles(host)) {
2150
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id, className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", "data-records-no-file-door": "", children: NO_UPLOAD_REASON });
2202
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { id, className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", "data-records-no-file-door": "", children: NO_UPLOAD_REASON });
2151
2203
  }
2152
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { id, className: "flex flex-col gap-1", "data-records-attachment-editor": "", children: [
2153
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2204
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { id, className: "flex flex-col gap-1", "data-records-attachment-editor": "", children: [
2205
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2154
2206
  AttachmentChips,
2155
2207
  {
2156
2208
  value,
2157
2209
  ...disabled ? {} : { onRemove: (removed) => onChange(withoutAttached(field, latest.current, removed)) }
2158
2210
  }
2159
2211
  ),
2160
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
2161
- host.pickFiles ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system7.Button, { size: "sm", variant: "outline", disabled: disabled || busy, onClick: () => void pick(), "data-records-attach-files": "", children: busy ? "Choosing\u2026" : attachmentIdsOf(value).length > 0 ? "Add files\u2026" : "Attach files\u2026" }) : null,
2162
- host.upload ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2212
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
2213
+ host.pickFiles ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.Button, { size: "sm", variant: "outline", disabled: disabled || busy, onClick: () => void pick(), "data-records-attach-files": "", children: busy ? "Choosing\u2026" : attachmentIdsOf(value).length > 0 ? "Add files\u2026" : "Attach files\u2026" }) : null,
2214
+ host.upload ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2163
2215
  FilePicker,
2164
2216
  {
2165
2217
  label: "Upload a file",
@@ -2179,7 +2231,7 @@ function AttachmentControl({
2179
2231
  }
2180
2232
  ) : null
2181
2233
  ] }),
2182
- why ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RefusalLine, { error: refusal("invalid_argument", why, "Pick another file, or try this one again.") }) : null
2234
+ why ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RefusalLine, { error: refusal("invalid_argument", why, "Pick another file, or try this one again.") }) : null
2183
2235
  ] });
2184
2236
  }
2185
2237
 
@@ -2187,12 +2239,12 @@ function AttachmentControl({
2187
2239
  var import_react15 = require("react");
2188
2240
  var import_records6 = require("@ai-matrx/records");
2189
2241
  var import_react16 = require("@ai-matrx/records/react");
2190
- var import_design_system9 = require("@ai-matrx/design-system");
2242
+ var import_design_system10 = require("@ai-matrx/design-system");
2191
2243
 
2192
2244
  // src/PickOne.tsx
2193
2245
  var import_react14 = require("react");
2194
- var import_design_system8 = require("@ai-matrx/design-system");
2195
- var import_jsx_runtime10 = require("react/jsx-runtime");
2246
+ var import_design_system9 = require("@ai-matrx/design-system");
2247
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2196
2248
  var PICK_ONE_SEARCH_AFTER = 7;
2197
2249
  var EMPTY = "__records_pick_one_empty__";
2198
2250
  var inner = (v) => v === "" ? EMPTY : v;
@@ -2214,7 +2266,7 @@ function PickOne({
2214
2266
  if (options.length > PICK_ONE_SEARCH_AFTER) {
2215
2267
  const q = search.trim().toLowerCase();
2216
2268
  const shown2 = q === "" ? options : options.filter((o) => o.label.toLowerCase().includes(q));
2217
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: (0, import_design_system8.cn)("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2269
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: (0, import_design_system9.cn)("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2218
2270
  PickOrAdd,
2219
2271
  {
2220
2272
  triggerLabel: label,
@@ -2239,29 +2291,29 @@ function PickOne({
2239
2291
  setOpen(false);
2240
2292
  setSearch("");
2241
2293
  },
2242
- empty: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
2294
+ empty: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
2243
2295
  }
2244
2296
  ) });
2245
2297
  }
2246
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system8.Select, { value: current ? inner(current.value) : "", onValueChange: (v) => onChange(outer(v)), disabled: disabled ?? false, children: [
2247
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2248
- import_design_system8.SelectTrigger,
2298
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system9.Select, { value: current ? inner(current.value) : "", onValueChange: (v) => onChange(outer(v)), disabled: disabled ?? false, children: [
2299
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2300
+ import_design_system9.SelectTrigger,
2249
2301
  {
2250
2302
  id,
2251
2303
  size: "sm",
2252
2304
  "aria-label": label,
2253
- className: (0, import_design_system8.cn)("h-7 w-auto min-w-[7rem] text-xs", className),
2305
+ className: (0, import_design_system9.cn)("h-7 w-auto min-w-[7rem] text-xs", className),
2254
2306
  "data-records-pick-one": "list",
2255
2307
  "data-pick-value": value,
2256
2308
  ...attrs ?? {},
2257
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.SelectValue, { placeholder })
2309
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system9.SelectValue, { placeholder })
2258
2310
  }
2259
2311
  ),
2260
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.SelectContent, { children: groupsOf(options).map(
2261
- ([group, items]) => group ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system8.SelectGroup, { children: [
2262
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.SelectLabel, { children: group }),
2263
- items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.SelectItem, { value: inner(o.value), "data-pick-value": o.value, "data-pick-group": group, children: o.label }, inner(o.value)))
2264
- ] }, group) : items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system8.SelectItem, { value: inner(o.value), "data-pick-value": o.value, children: o.label }, inner(o.value)))
2312
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system9.SelectContent, { children: groupsOf(options).map(
2313
+ ([group, items]) => group ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system9.SelectGroup, { children: [
2314
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system9.SelectLabel, { children: group }),
2315
+ items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system9.SelectItem, { value: inner(o.value), "data-pick-value": o.value, "data-pick-group": group, children: o.label }, inner(o.value)))
2316
+ ] }, group) : items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system9.SelectItem, { value: inner(o.value), "data-pick-value": o.value, children: o.label }, inner(o.value)))
2265
2317
  ) })
2266
2318
  ] });
2267
2319
  }
@@ -2276,7 +2328,7 @@ function groupsOf(options) {
2276
2328
  }
2277
2329
 
2278
2330
  // src/EntityReferenceControl.tsx
2279
- var import_jsx_runtime11 = require("react/jsx-runtime");
2331
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2280
2332
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
2281
2333
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
2282
2334
  function entityReferenceText(value) {
@@ -2291,7 +2343,7 @@ function allowedKindsOf(field) {
2291
2343
  }
2292
2344
  function EntityReferenceControl(props) {
2293
2345
  const client = (0, import_react16.useOptionalRecordsClient)();
2294
- return client ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Chips, { ...props, words: null, picker: null });
2346
+ return client ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Chips, { ...props, words: null, picker: null });
2295
2347
  }
2296
2348
  function WithWords(props) {
2297
2349
  const refs = (0, import_react15.useMemo)(() => (0, import_records6.entityRefsOf)(props.value), [props.value]);
@@ -2303,7 +2355,7 @@ function WithWords(props) {
2303
2355
  [JSON.stringify(withKnown)]
2304
2356
  );
2305
2357
  const words = (0, import_react16.useEntityReferenceWords)(unlabelled);
2306
- const picker = props.disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2358
+ const picker = props.disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2307
2359
  EntityReferencePicker,
2308
2360
  {
2309
2361
  field: props.field,
@@ -2316,7 +2368,7 @@ function WithWords(props) {
2316
2368
  }
2317
2369
  }
2318
2370
  );
2319
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Chips, { ...props, value: withKnown, words, picker });
2371
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Chips, { ...props, value: withKnown, words, picker });
2320
2372
  }
2321
2373
  function EntityReferencePicker({
2322
2374
  field,
@@ -2339,8 +2391,8 @@ function EntityReferencePicker({
2339
2391
  picked: refs.some((x) => x.token === r.token && x.id === r.id),
2340
2392
  attrs: { "data-entity-reference-candidate": `${r.token}:${r.id}` }
2341
2393
  }));
2342
- const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-1 flex flex-wrap gap-1", role: "group", "aria-label": `Which kind \u2014 ${field.label}`, children: [null, ...allowed].map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2343
- import_design_system9.Button,
2394
+ const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-1 flex flex-wrap gap-1", role: "group", "aria-label": `Which kind \u2014 ${field.label}`, children: [null, ...allowed].map((token) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2395
+ import_design_system10.Button,
2344
2396
  {
2345
2397
  type: "button",
2346
2398
  size: "sm",
@@ -2351,7 +2403,7 @@ function EntityReferencePicker({
2351
2403
  children: token ? labelOfKind(token) : "Any"
2352
2404
  },
2353
2405
  token ?? "any"
2354
- )) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2406
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2355
2407
  PickOne,
2356
2408
  {
2357
2409
  label: `Which kind \u2014 ${field.label}`,
@@ -2361,13 +2413,13 @@ function EntityReferencePicker({
2361
2413
  options: [{ value: "", label: "Any kind" }, ...allowed.map((token) => ({ value: token, label: labelOfKind(token) }))]
2362
2414
  }
2363
2415
  ) : null;
2364
- const notice = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2416
+ const notice = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2365
2417
  kindChoice,
2366
- found.error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RefusalLine, { error: found.error, className: "px-2 py-1 text-[11px]" }) : null,
2367
- found.loading && !found.data ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: "Searching\u2026" }) : null
2418
+ found.error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RefusalLine, { error: found.error, className: "px-2 py-1 text-[11px]" }) : null,
2419
+ found.loading && !found.data ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: "Searching\u2026" }) : null
2368
2420
  ] });
2369
2421
  const kindWords = allowed.length === 1 ? labelOfKind(allowed[0]).toLowerCase() : "thing";
2370
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2422
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2371
2423
  PickOrAdd,
2372
2424
  {
2373
2425
  triggerLabel: `Pick for ${field.label}`,
@@ -2381,7 +2433,7 @@ function EntityReferencePicker({
2381
2433
  onSearch: setSearch,
2382
2434
  items,
2383
2435
  notice,
2384
- empty: found.loading ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: search.trim() ? `No ${kindWords} you can open is called \u201C${search.trim()}\u201D.` : `There is no ${kindWords} you can open yet.` }),
2436
+ empty: found.loading ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: search.trim() ? `No ${kindWords} you can open is called \u201C${search.trim()}\u201D.` : `There is no ${kindWords} you can open yet.` }),
2385
2437
  onPick: (key) => {
2386
2438
  const r = (found.data ?? []).find((x) => `${x.token}:${x.id}` === key);
2387
2439
  if (!r) return;
@@ -2411,13 +2463,13 @@ function Chips({
2411
2463
  return WITHHELD_ENTITY_LABEL;
2412
2464
  };
2413
2465
  const multi = Boolean(field.multi);
2414
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { id, className: (0, import_design_system9.cn)("flex flex-wrap items-center gap-1", className), "aria-label": `What ${field.label} points at`, children: [
2415
- refs.length === 0 && !picker ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_EMPTY }) : null,
2466
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { id, className: (0, import_design_system10.cn)("flex flex-wrap items-center gap-1", className), "aria-label": `What ${field.label} points at`, children: [
2467
+ refs.length === 0 && !picker ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_EMPTY }) : null,
2416
2468
  refs.map((r) => {
2417
2469
  const label = labelOf(r.token, r.id, r.label);
2418
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system9.Badge, { variant: "secondary", className: "gap-1 text-[11px]", "data-entity-reference-chip": `${r.token}:${r.id}`, children: [
2470
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system10.Badge, { variant: "secondary", className: "gap-1 text-[11px]", "data-entity-reference-chip": `${r.token}:${r.id}`, children: [
2419
2471
  label,
2420
- disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2472
+ disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2421
2473
  "button",
2422
2474
  {
2423
2475
  type: "button",
@@ -2440,8 +2492,8 @@ function Chips({
2440
2492
  var import_react17 = require("react");
2441
2493
  var import_records7 = require("@ai-matrx/records");
2442
2494
  var import_react18 = require("@ai-matrx/records/react");
2443
- var import_design_system10 = require("@ai-matrx/design-system");
2444
- var import_jsx_runtime12 = require("react/jsx-runtime");
2495
+ var import_design_system11 = require("@ai-matrx/design-system");
2496
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2445
2497
  function personFromRow(row) {
2446
2498
  const data = row.document ?? {};
2447
2499
  const userId = data["user_id"];
@@ -2522,10 +2574,10 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2522
2574
  }, [client, personTable, picked.length, people.length]);
2523
2575
  const listed = (0, import_records7.rankTypedMatches)(members ?? [], search, memberName);
2524
2576
  if (!membersPort || !client) {
2525
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: (0, import_design_system10.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
2577
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: (0, import_design_system11.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
2526
2578
  }
2527
2579
  if (!personTable) {
2528
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: (0, import_design_system10.cn)("text-xs text-muted-foreground", className), children: [
2580
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: (0, import_design_system11.cn)("text-xs text-muted-foreground", className), children: [
2529
2581
  fieldName(field),
2530
2582
  " is a person field, but it does not say which Table the people are records of yet, so there is nothing to pick from. A table admin sets its target in the field editor."
2531
2583
  ] });
@@ -2575,21 +2627,14 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2575
2627
  picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
2576
2628
  );
2577
2629
  const anchored = autoOpen === true;
2578
- const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2579
- RecordChip,
2580
- {
2581
- title: nameOfRecord(recordId),
2582
- ...disabled || anchored ? {} : { onRemove: () => drop(recordId) }
2583
- },
2584
- recordId
2585
- ));
2586
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_design_system10.cn)("flex flex-wrap items-center gap-1", className), children: [
2630
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
2631
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_design_system11.cn)("flex flex-wrap items-center gap-1", className), children: [
2587
2632
  anchored && !disabled ? null : cellChips,
2588
2633
  disabled ? null : (
2589
2634
  // THE ONE "PICK OR ADD" BUILDER (lane CELL-EDITORS, 2026-10-06): the person list used to carry
2590
2635
  // its own copy of the list's layout and keys; it now draws the same rows, ticks, highlight and
2591
2636
  // head chips as every other picker, and in a grid cell hangs from the cell.
2592
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2637
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2593
2638
  PickOrAdd,
2594
2639
  {
2595
2640
  anchored,
@@ -2601,7 +2646,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2601
2646
  onOpenChange: setOpen,
2602
2647
  search,
2603
2648
  onSearch: setSearch,
2604
- chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), onRemove: () => drop(recordId) })),
2649
+ chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), person: true, onRemove: () => drop(recordId) })),
2605
2650
  items: visible.map((member) => ({
2606
2651
  id: member.userId,
2607
2652
  label: displayNameOf(member.userId) ?? memberName(member),
@@ -2609,17 +2654,18 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2609
2654
  // 19 September). They are two facts, so they are drawn as two.
2610
2655
  detail: displayNameOf(member.userId) !== null && member.email ? member.email : null,
2611
2656
  picked: pickedUserIds.has(member.userId),
2657
+ person: true,
2612
2658
  disabled: busy
2613
2659
  })),
2614
2660
  onPick: (userId) => {
2615
2661
  const member = visible.find((m) => m.userId === userId);
2616
2662
  if (member && !busy) void pick(member);
2617
2663
  },
2618
- notice: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2619
- error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RefusalLine, { error, className: "p-2" }) : null,
2620
- members === null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
2664
+ notice: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2665
+ error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RefusalLine, { error, className: "p-2" }) : null,
2666
+ members === null ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
2621
2667
  ] }),
2622
- empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
2668
+ empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
2623
2669
  children: anchored ? cellChips : null
2624
2670
  }
2625
2671
  )
@@ -2691,15 +2737,15 @@ function currencyCodeFor(unit) {
2691
2737
 
2692
2738
  // src/formatControls.tsx
2693
2739
  var import_react20 = require("react");
2694
- var import_design_system12 = require("@ai-matrx/design-system");
2740
+ var import_design_system13 = require("@ai-matrx/design-system");
2695
2741
  var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
2696
2742
 
2697
2743
  // src/formattedValue.tsx
2698
2744
  var import_react19 = require("react");
2699
2745
  var import_data_table3 = require("@ai-matrx/design-system/data-table");
2700
2746
  var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
2701
- var import_design_system11 = require("@ai-matrx/design-system");
2702
- var import_jsx_runtime13 = require("react/jsx-runtime");
2747
+ var import_design_system12 = require("@ai-matrx/design-system");
2748
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2703
2749
  var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
2704
2750
  var own2 = (event) => event.stopPropagation();
2705
2751
  function numberOf(value) {
@@ -2721,7 +2767,7 @@ function RatingStars({
2721
2767
  const score = numberOf(value) ?? 0;
2722
2768
  const shown2 = Math.round(score);
2723
2769
  const said = `${shown2} out of ${max}`;
2724
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2770
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2725
2771
  "span",
2726
2772
  {
2727
2773
  "data-records-rating": "",
@@ -2733,8 +2779,8 @@ function RatingStars({
2733
2779
  children: Array.from({ length: max }, (_, i) => {
2734
2780
  const n = i + 1;
2735
2781
  const lit = n <= shown2;
2736
- const star = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": true, className: (0, import_design_system11.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2737
- return onRate ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2782
+ const star = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": true, className: (0, import_design_system12.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2783
+ return onRate ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2738
2784
  "button",
2739
2785
  {
2740
2786
  type: "button",
@@ -2759,7 +2805,7 @@ function RatingStars({
2759
2805
  children: star
2760
2806
  },
2761
2807
  n
2762
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: star }, n);
2808
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: star }, n);
2763
2809
  })
2764
2810
  }
2765
2811
  );
@@ -2767,13 +2813,13 @@ function RatingStars({
2767
2813
  function rich(id, text, raw, format) {
2768
2814
  switch (id) {
2769
2815
  case "email":
2770
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate", children: text }) });
2816
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text }) });
2771
2817
  case "url":
2772
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate", children: text }) });
2818
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text }) });
2773
2819
  case "phone":
2774
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats3.formatPhone)(text) }) });
2820
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats3.formatPhone)(text) }) });
2775
2821
  case "address":
2776
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2822
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2777
2823
  "a",
2778
2824
  {
2779
2825
  href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
@@ -2782,7 +2828,7 @@ function rich(id, text, raw, format) {
2782
2828
  className: LINK,
2783
2829
  title: "Open in maps",
2784
2830
  onClick: own2,
2785
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "truncate", children: text })
2831
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text })
2786
2832
  }
2787
2833
  );
2788
2834
  case "progress": {
@@ -2790,8 +2836,8 @@ function rich(id, text, raw, format) {
2790
2836
  if (n === null) return void 0;
2791
2837
  const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
2792
2838
  const clamped = Math.max(0, Math.min(100, pct));
2793
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2794
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2839
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2840
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2795
2841
  "span",
2796
2842
  {
2797
2843
  role: "progressbar",
@@ -2799,24 +2845,24 @@ function rich(id, text, raw, format) {
2799
2845
  "aria-valuemax": 100,
2800
2846
  "aria-valuenow": Math.round(clamped),
2801
2847
  className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
2802
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: (0, import_design_system11.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2848
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: (0, import_design_system12.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2803
2849
  }
2804
2850
  ),
2805
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2851
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2806
2852
  ] });
2807
2853
  }
2808
2854
  case "color":
2809
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2810
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2811
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { className: "font-mono text-xs", children: text })
2855
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2856
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2857
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { className: "font-mono text-xs", children: text })
2812
2858
  ] });
2813
2859
  case "tags": {
2814
2860
  const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
2815
2861
  if (items.length === 0) return void 0;
2816
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2862
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2817
2863
  }
2818
2864
  case "rating":
2819
- return numberOf(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2865
+ return numberOf(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2820
2866
  default:
2821
2867
  return void 0;
2822
2868
  }
@@ -2831,11 +2877,11 @@ function FormattedValue({
2831
2877
  const score = numberOf(value);
2832
2878
  const max = format.options?.ratingMax ?? 5;
2833
2879
  if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
2834
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2880
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2835
2881
  }
2836
2882
  const result = (0, import_field_formats3.formatFieldValue)(value, format);
2837
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_data_table3.FormattedCell, { result });
2838
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_data_table3.FormattedCell, { result });
2883
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_data_table3.FormattedCell, { result });
2884
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_data_table3.FormattedCell, { result });
2839
2885
  }
2840
2886
  function linkChipText(raw) {
2841
2887
  try {
@@ -2849,7 +2895,7 @@ function linkChipText(raw) {
2849
2895
  }
2850
2896
 
2851
2897
  // src/formatControls.tsx
2852
- var import_jsx_runtime14 = require("react/jsx-runtime");
2898
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2853
2899
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
2854
2900
  function scaled(format) {
2855
2901
  return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
@@ -2872,8 +2918,8 @@ function NumberInFormat({ format, value, onChange, disabled, id }) {
2872
2918
  if (value === lastSent.current) return;
2873
2919
  setText(typedText(format, value));
2874
2920
  }, [value, format]);
2875
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2876
- import_design_system12.BasicInput,
2921
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2922
+ import_design_system13.BasicInput,
2877
2923
  {
2878
2924
  id,
2879
2925
  inputMode: "decimal",
@@ -2897,17 +2943,17 @@ function formatControl(args) {
2897
2943
  const text = value === null || value === void 0 ? "" : String(value);
2898
2944
  const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats4.parseFieldInput)(raw, format));
2899
2945
  if (def.id === "rating") {
2900
- return disabled ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2946
+ return disabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2901
2947
  }
2902
- if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NumberInFormat, { ...args });
2948
+ if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NumberInFormat, { ...args });
2903
2949
  switch (def.editor) {
2904
2950
  // A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
2905
2951
  // (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
2906
2952
  case "email":
2907
2953
  case "url":
2908
2954
  case "tel":
2909
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2910
- import_design_system12.BasicInput,
2955
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2956
+ import_design_system13.BasicInput,
2911
2957
  {
2912
2958
  id,
2913
2959
  type: def.editor,
@@ -2918,9 +2964,9 @@ function formatControl(args) {
2918
2964
  }
2919
2965
  );
2920
2966
  case "color":
2921
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex items-center gap-2", children: [
2922
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2923
- import_design_system12.BasicInput,
2967
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "flex items-center gap-2", children: [
2968
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2969
+ import_design_system13.BasicInput,
2924
2970
  {
2925
2971
  id: `${id}-swatch`,
2926
2972
  type: "color",
@@ -2931,10 +2977,10 @@ function formatControl(args) {
2931
2977
  onChange: (e) => commit(e.target.value)
2932
2978
  }
2933
2979
  ),
2934
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system12.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2980
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system13.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2935
2981
  ] });
2936
2982
  case "textarea":
2937
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system12.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2983
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system13.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2938
2984
  default:
2939
2985
  return null;
2940
2986
  }
@@ -2942,9 +2988,9 @@ function formatControl(args) {
2942
2988
 
2943
2989
  // src/typedDateHelper.tsx
2944
2990
  var import_react21 = require("react");
2945
- var import_design_system13 = require("@ai-matrx/design-system");
2991
+ var import_design_system14 = require("@ai-matrx/design-system");
2946
2992
  var import_records9 = require("@ai-matrx/records");
2947
- var import_jsx_runtime15 = require("react/jsx-runtime");
2993
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2948
2994
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2949
2995
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2950
2996
  function pad(n) {
@@ -2973,15 +3019,15 @@ function wordsFor(kind, day, time) {
2973
3019
  }
2974
3020
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
2975
3021
  function CalendarGlyph() {
2976
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2977
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2978
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
3022
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3023
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3024
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
2979
3025
  ] });
2980
3026
  }
2981
3027
  function ClockGlyph() {
2982
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2983
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
2984
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M12 6v6l4 2" })
3028
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3029
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
3030
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M12 6v6l4 2" })
2985
3031
  ] });
2986
3032
  }
2987
3033
  function TypedDateHelper({ kind, text, onText, label }) {
@@ -3010,8 +3056,8 @@ function TypedDateHelper({ kind, text, onText, label }) {
3010
3056
  const at = new Date(shown2.y, shown2.m + by, 1);
3011
3057
  setMonth({ y: at.getFullYear(), m: at.getMonth() });
3012
3058
  };
3013
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system13.Popover, { open, onOpenChange: setOpen, children: [
3014
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system13.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3059
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system14.Popover, { open, onOpenChange: setOpen, children: [
3060
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3015
3061
  "button",
3016
3062
  {
3017
3063
  type: "button",
@@ -3020,11 +3066,11 @@ function TypedDateHelper({ kind, text, onText, label }) {
3020
3066
  "aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
3021
3067
  title: kind === "time" ? "Pick a time" : "Pick a date",
3022
3068
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
3023
- children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CalendarGlyph, {})
3069
+ children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CalendarGlyph, {})
3024
3070
  }
3025
3071
  ) }),
3026
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3027
- import_design_system13.PopoverContent,
3072
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3073
+ import_design_system14.PopoverContent,
3028
3074
  {
3029
3075
  sizing: "content",
3030
3076
  align: "start",
@@ -3033,29 +3079,29 @@ function TypedDateHelper({ kind, text, onText, label }) {
3033
3079
  "data-records-date-helper-panel": "",
3034
3080
  onOpenAutoFocus: (e) => e.preventDefault(),
3035
3081
  onCloseAutoFocus: (e) => e.preventDefault(),
3036
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-2", children: [
3037
- kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3038
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3039
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3040
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
3082
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-2", children: [
3083
+ kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3084
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3085
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3086
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
3041
3087
  MONTHS[shown2.m],
3042
3088
  " ",
3043
3089
  shown2.y
3044
3090
  ] }),
3045
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3091
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3046
3092
  ] }),
3047
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3048
- WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3094
+ WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
3049
3095
  cells.map((d, i) => {
3050
- if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", {}, `blank-${i}`);
3096
+ if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", {}, `blank-${i}`);
3051
3097
  const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
3052
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3098
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3053
3099
  "button",
3054
3100
  {
3055
3101
  type: "button",
3056
3102
  ...keepFocus,
3057
3103
  "data-records-date-helper-day": key,
3058
- className: (0, import_design_system13.cn)(
3104
+ className: (0, import_design_system14.cn)(
3059
3105
  "h-6 w-6 rounded tabular-nums hover:bg-muted",
3060
3106
  key === held.day ? "bg-primary text-primary-foreground hover:bg-primary" : "",
3061
3107
  key === todayKey && key !== held.day ? "ring-1 ring-ring" : ""
@@ -3068,13 +3114,13 @@ function TypedDateHelper({ kind, text, onText, label }) {
3068
3114
  })
3069
3115
  ] })
3070
3116
  ] }),
3071
- kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3117
+ kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3072
3118
  "button",
3073
3119
  {
3074
3120
  type: "button",
3075
3121
  ...keepFocus,
3076
3122
  "data-records-date-helper-time": `${pad(t.h)}:${pad(t.m)}`,
3077
- className: (0, import_design_system13.cn)(
3123
+ className: (0, import_design_system14.cn)(
3078
3124
  "whitespace-nowrap rounded px-2 py-0.5 text-left tabular-nums hover:bg-muted",
3079
3125
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
3080
3126
  ),
@@ -3122,7 +3168,7 @@ function useChoiceNudge(enabled = true) {
3122
3168
  }
3123
3169
 
3124
3170
  // src/editors.tsx
3125
- var import_jsx_runtime16 = require("react/jsx-runtime");
3171
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3126
3172
  var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
3127
3173
  function isChoiceAddition(value) {
3128
3174
  return typeof value === "object" && value !== null && value.addingChoices === true;
@@ -3152,12 +3198,12 @@ function ChoiceAskButtons({
3152
3198
  onCancel,
3153
3199
  busy
3154
3200
  }) {
3155
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "data-records-choice-ask": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3156
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3157
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
3158
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3159
- keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3160
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3201
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-choice-ask": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3202
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3203
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
3204
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3205
+ keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3206
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3161
3207
  ] })
3162
3208
  ] });
3163
3209
  }
@@ -3165,6 +3211,11 @@ var FORMAT_BLIND_KINDS = /* @__PURE__ */ new Set(["formula", "lookup", "rollup",
3165
3211
  function isTypedDraft(value) {
3166
3212
  return typeof value === "object" && value !== null && value.typedDraft === true;
3167
3213
  }
3214
+ var SHORT_REFUSAL = {
3215
+ email: "Enter a valid email",
3216
+ url: "Enter a valid link",
3217
+ phone: "Enter a valid phone number"
3218
+ };
3168
3219
  function judgeTyped(field, text, choices, nudge) {
3169
3220
  const trimmed = text.trim();
3170
3221
  const kind = String(editorKindFor(field));
@@ -3212,9 +3263,14 @@ function judgeTyped(field, text, choices, nudge) {
3212
3263
  const max = format.options?.ratingMax ?? 5;
3213
3264
  return Number.isInteger(n) && n >= 0 && n <= max ? { value: n === 0 ? null : n } : { refusal: `${fieldName(field)} is a rating from 1 to ${max}, and \u201C${text}\u201D is not one.` };
3214
3265
  }
3266
+ if (kind === "phone" || format && format.id === "phone") {
3267
+ const digits = trimmed.replace(/\D/g, "");
3268
+ const usual = /^\+?[\d\s().-]+(\s*(x|ext\.?)\s*\d+)?$/i.test(trimmed);
3269
+ return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
3270
+ }
3215
3271
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
3216
3272
  const read = (0, import_records10.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
3217
- if ("refusal" in read) return { refusal: read.refusal };
3273
+ if ("refusal" in read) return { refusal: kind === "email" || kind === "url" ? SHORT_REFUSAL[kind] : read.refusal };
3218
3274
  if (typeof read.value === "number" && format && (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction") {
3219
3275
  return { value: Math.round(read.value / 100 * 1e9) / 1e9 };
3220
3276
  }
@@ -3267,8 +3323,8 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3267
3323
  judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
3268
3324
  ...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
3269
3325
  });
3270
- const box = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3271
- import_design_system14.BasicInput,
3326
+ const box = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3327
+ import_design_system15.BasicInput,
3272
3328
  {
3273
3329
  id,
3274
3330
  value: value.text,
@@ -3279,16 +3335,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3279
3335
  onChange: (e) => retype(e.target.value)
3280
3336
  }
3281
3337
  );
3282
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3283
- helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3338
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3339
+ helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3284
3340
  box,
3285
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field) })
3341
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field) })
3286
3342
  ] }) : box,
3287
- judged === null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
3343
+ judged === null ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
3288
3344
  "Reading ",
3289
3345
  fieldName(field),
3290
3346
  "'s choices\u2026"
3291
- ] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3347
+ ] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3292
3348
  ChoiceAskButtons,
3293
3349
  {
3294
3350
  field,
@@ -3304,10 +3360,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3304
3360
  },
3305
3361
  onCancel: () => onCancel?.()
3306
3362
  }
3307
- ) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-1", children: [
3308
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: judged.refusal }),
3309
- judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3310
- ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "data-records-typed-reads-as": "", className: "text-[10px] text-muted-foreground", children: [
3363
+ ) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-1", children: [
3364
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: judged.refusal }),
3365
+ judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3366
+ ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-typed-reads-as": "", className: "text-[10px] text-muted-foreground", children: [
3311
3367
  isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
3312
3368
  "Reads as",
3313
3369
  " ",
@@ -3318,7 +3374,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3318
3374
  }).join(", ")
3319
3375
  ) : (() => {
3320
3376
  const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
3321
- return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3377
+ return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3322
3378
  })()
3323
3379
  ] })
3324
3380
  ] });
@@ -3332,12 +3388,12 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3332
3388
  const kind = editorKindFor(field);
3333
3389
  const inputId = id ?? `field-${field.key}`;
3334
3390
  const ownDetails = (0, import_react25.useOptionalRecordsClient)() === null;
3335
- if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3336
- if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
3391
+ if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3392
+ if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
3337
3393
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
3338
3394
  if (newerControl !== void 0) return newerControl;
3339
3395
  const format = formatForField(field);
3340
- if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3396
+ if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3341
3397
  if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
3342
3398
  const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
3343
3399
  if (own3) return own3;
@@ -3346,18 +3402,18 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3346
3402
  case "formula":
3347
3403
  case "lookup":
3348
3404
  case "rollup":
3349
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3405
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3350
3406
  value === null || value === void 0 ? "\u2014" : String(value),
3351
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "ml-2 italic", children: [
3407
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ml-2 italic", children: [
3352
3408
  fieldName(field),
3353
3409
  " is worked out by the system, so it cannot be typed in"
3354
3410
  ] })
3355
3411
  ] });
3356
3412
  case "json":
3357
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
3413
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
3358
3414
  case "long_text":
3359
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3360
- import_design_system14.BasicTextarea,
3415
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3416
+ import_design_system15.BasicTextarea,
3361
3417
  {
3362
3418
  id: inputId,
3363
3419
  rows: 3,
@@ -3369,8 +3425,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3369
3425
  case "number":
3370
3426
  case "currency":
3371
3427
  case "percent":
3372
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3373
- import_design_system14.BasicInput,
3428
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3429
+ import_design_system15.BasicInput,
3374
3430
  {
3375
3431
  id: inputId,
3376
3432
  type: "number",
@@ -3382,12 +3438,12 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3382
3438
  }
3383
3439
  );
3384
3440
  case "datetime":
3385
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3441
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3386
3442
  case "email":
3387
3443
  case "phone":
3388
3444
  case "url":
3389
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3390
- import_design_system14.BasicInput,
3445
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3446
+ import_design_system15.BasicInput,
3391
3447
  {
3392
3448
  id: inputId,
3393
3449
  type: kind === "email" ? "email" : kind === "phone" ? "tel" : "url",
@@ -3398,25 +3454,25 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3398
3454
  }
3399
3455
  );
3400
3456
  case "checkbox":
3401
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3457
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3402
3458
  case "select":
3403
3459
  case "multi_select":
3404
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, addsChoices, initialSearch, asForm });
3460
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, addsChoices, initialSearch, asForm });
3405
3461
  case "member":
3406
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, initialSearch });
3462
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, initialSearch });
3407
3463
  case "entity_reference":
3408
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3464
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3409
3465
  case "attachment":
3410
3466
  if (hostTakesFiles(host)) {
3411
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3467
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3412
3468
  }
3413
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId });
3469
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId });
3414
3470
  case "relation":
3415
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose });
3471
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose });
3416
3472
  default:
3417
3473
  if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
3418
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3419
- import_design_system14.Checkbox,
3474
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3475
+ import_design_system15.Checkbox,
3420
3476
  {
3421
3477
  id: inputId,
3422
3478
  checked: value === true,
@@ -3425,8 +3481,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3425
3481
  }
3426
3482
  );
3427
3483
  }
3428
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3429
- import_design_system14.BasicInput,
3484
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3485
+ import_design_system15.BasicInput,
3430
3486
  {
3431
3487
  id: inputId,
3432
3488
  ...ownDetails && isPersonsName(field) ? { autoComplete: "name" } : {},
@@ -3459,10 +3515,10 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3459
3515
  setRefusal(judged.refusal);
3460
3516
  }
3461
3517
  };
3462
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3463
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3464
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3465
- import_design_system14.BasicInput,
3518
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3519
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3520
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3521
+ import_design_system15.BasicInput,
3466
3522
  {
3467
3523
  id,
3468
3524
  value: text,
@@ -3478,16 +3534,16 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3478
3534
  }
3479
3535
  }
3480
3536
  ),
3481
- helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3537
+ helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3482
3538
  ] }),
3483
- refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3539
+ refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3484
3540
  ] });
3485
3541
  }
3486
3542
  function CheckboxControl({ field, value, onChange, disabled, id }) {
3487
3543
  const unanswered = value === null || value === void 0;
3488
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3489
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3490
- import_design_system14.Checkbox,
3544
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
3545
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3546
+ import_design_system15.Checkbox,
3491
3547
  {
3492
3548
  id,
3493
3549
  checked: value === true,
@@ -3496,10 +3552,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3496
3552
  onCheckedChange: (next) => onChange(next === true)
3497
3553
  }
3498
3554
  ),
3499
- unanswered ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3500
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3501
- field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3502
- import_design_system14.Button,
3555
+ unanswered ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3556
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3557
+ field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3558
+ import_design_system15.Button,
3503
3559
  {
3504
3560
  size: "sm",
3505
3561
  variant: "ghost",
@@ -3516,9 +3572,9 @@ function JsonControl({ field, value, onChange, disabled, id }) {
3516
3572
  const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
3517
3573
  const [text, setText] = (0, import_react24.useState)(initial);
3518
3574
  const [broken, setBroken] = (0, import_react24.useState)(null);
3519
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", children: [
3520
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3521
- import_design_system14.BasicTextarea,
3575
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", children: [
3576
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3577
+ import_design_system15.BasicTextarea,
3522
3578
  {
3523
3579
  id,
3524
3580
  rows: 4,
@@ -3551,7 +3607,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
3551
3607
  ),
3552
3608
  broken ? (
3553
3609
  // The typed text is still in the box: the notice owns the two doors out.
3554
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3610
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3555
3611
  RefusalNotice,
3556
3612
  {
3557
3613
  error: broken,
@@ -3593,12 +3649,12 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3593
3649
  }, [client, field.id, reread]);
3594
3650
  const handed = publicChoicesOf(field);
3595
3651
  if (!client && handed.length > 0) {
3596
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3652
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3597
3653
  }
3598
3654
  if (!client) {
3599
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", children: [
3600
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3601
- import_design_system14.BasicInput,
3655
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", children: [
3656
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3657
+ import_design_system15.BasicInput,
3602
3658
  {
3603
3659
  id,
3604
3660
  value: value === null || value === void 0 ? "" : String(value),
@@ -3606,15 +3662,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3606
3662
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
3607
3663
  }
3608
3664
  ),
3609
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3665
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3610
3666
  ] });
3611
3667
  }
3612
3668
  if (refusal2)
3613
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RefusalLine, { error: refusal2 }) });
3614
- if (!options) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3669
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RefusalLine, { error: refusal2 }) });
3670
+ if (!options) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3615
3671
  if (asForm && options.length > 0) {
3616
3672
  const titled = (option) => recordName(option.data, null, "Unnamed choice");
3617
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3673
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3618
3674
  ChoiceAnswer,
3619
3675
  {
3620
3676
  field,
@@ -3631,7 +3687,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3631
3687
  );
3632
3688
  }
3633
3689
  if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
3634
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3690
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3635
3691
  OpenChoicePicker,
3636
3692
  {
3637
3693
  field,
@@ -3653,14 +3709,14 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3653
3709
  );
3654
3710
  }
3655
3711
  if (options.length === 0) {
3656
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3712
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3657
3713
  }
3658
3714
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3659
3715
  if (field.multi) {
3660
3716
  const chosen = options.filter((option) => (0, import_records10.choiceValuesOf)(value).some((v) => (0, import_records10.isTheChosen)(option, v)));
3661
3717
  const picked = new Set(chosen.map((option) => (0, import_records10.optionKey)(option)));
3662
- const toggles = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3663
- import_design_system14.Button,
3718
+ const toggles = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3719
+ import_design_system15.Button,
3664
3720
  {
3665
3721
  type: "button",
3666
3722
  size: "sm",
@@ -3677,23 +3733,23 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3677
3733
  option.id
3678
3734
  )) });
3679
3735
  if (!autoOpen) return toggles;
3680
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3681
- import_design_system14.Popover,
3736
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3737
+ import_design_system15.Popover,
3682
3738
  {
3683
3739
  defaultOpen: true,
3684
3740
  onOpenChange: (open) => {
3685
3741
  if (!open) onClose?.();
3686
3742
  },
3687
3743
  children: [
3688
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3689
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3744
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3745
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3690
3746
  ]
3691
3747
  }
3692
3748
  );
3693
3749
  }
3694
3750
  const current = options.find((option) => (0, import_records10.isTheChosen)(option, value));
3695
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3696
- import_design_system14.Select,
3751
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3752
+ import_design_system15.Select,
3697
3753
  {
3698
3754
  value: current ? (0, import_records10.optionKey)(current) : "",
3699
3755
  disabled: disabled ?? false,
@@ -3706,8 +3762,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3706
3762
  }
3707
3763
  } : {},
3708
3764
  children: [
3709
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.SelectValue, { placeholder: "Choose" }) }),
3710
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.SelectItem, { value: (0, import_records10.optionKey)(option), children: titleOf(option) }, option.id)) })
3765
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectValue, { placeholder: "Choose" }) }),
3766
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectItem, { value: (0, import_records10.optionKey)(option), children: titleOf(option) }, option.id)) })
3711
3767
  ]
3712
3768
  }
3713
3769
  );
@@ -3789,29 +3845,14 @@ function OpenChoicePicker({
3789
3845
  });
3790
3846
  };
3791
3847
  const offList = q !== "" && decided.decision !== "chosen" && decided.decision !== "empty";
3792
- const [askingFor, setAskingFor] = (0, import_react24.useState)(null);
3793
- const asks = offList && decided.decision === "ask" && (visible.length === 0 || askingFor === q);
3794
- const foot = asks ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3795
- ChoiceAskButtons,
3796
- {
3797
- field,
3798
- words: [q],
3799
- keepOffered: decided.keepOffered,
3800
- busy: adding,
3801
- onAdd: addTyped,
3802
- onKeep: () => choose(q),
3803
- onCancel: () => {
3804
- setSearch("");
3805
- setAddRefused(null);
3806
- if (autoOpen) setOpen(false);
3807
- }
3808
- }
3809
- ) : null;
3810
- const add = offList && decided.decision === "ask" && !asks ? { label: `Add \u201C${q}\u201D\u2026`, onAdd: () => setAskingFor(q) } : offList && decided.decision === "add" ? { label: `Add \u201C${q}\u201D to the choices`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Keep \u201C${q}\u201D as typed`, onAdd: () => choose(q) } : null;
3848
+ const nothingMatches = q !== "" && visible.length === 0;
3849
+ const foot = null;
3850
+ 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;
3851
+ const listed = nothingMatches && add ? options : visible;
3811
3852
  const pickedOptions = current.map((v) => options.find((o) => (0, import_records10.isTheChosen)(o, v)));
3812
3853
  const cellChips = pickedWords.map((word, i) => {
3813
3854
  const chip = chipOf(pickedOptions[i], word);
3814
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Badge, { variant: "outline", className: (0, import_design_system14.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3855
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Badge, { variant: "outline", className: (0, import_design_system15.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3815
3856
  });
3816
3857
  const headChips = pickedWords.map((word, i) => {
3817
3858
  const option = pickedOptions[i];
@@ -3826,12 +3867,12 @@ function OpenChoicePicker({
3826
3867
  };
3827
3868
  });
3828
3869
  const anchored = autoOpen === true;
3829
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3870
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3830
3871
  anchored || disabled ? null : cellChips,
3831
3872
  disabled ? cellChips : (
3832
3873
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
3833
3874
  // In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
3834
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3875
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3835
3876
  PickOrAdd,
3836
3877
  {
3837
3878
  anchored,
@@ -3845,9 +3886,9 @@ function OpenChoicePicker({
3845
3886
  onSearch: (next) => {
3846
3887
  setSearch(next);
3847
3888
  setAddRefused(null);
3848
- setAskingFor(null);
3849
3889
  },
3850
- items: visible.map((option) => ({
3890
+ addFirst: nothingMatches,
3891
+ items: listed.map((option) => ({
3851
3892
  id: option.id,
3852
3893
  label: titleOf(option),
3853
3894
  chip: chipOf(option, titleOf(option)).className,
@@ -3857,15 +3898,14 @@ function OpenChoicePicker({
3857
3898
  const option = options.find((o) => o.id === optionId);
3858
3899
  if (option) choose((0, import_records10.optionKey)(option));
3859
3900
  },
3860
- empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3901
+ empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3861
3902
  add,
3862
3903
  foot,
3863
- ...asks && !adding ? { onEnterWithNoMatch: addTyped } : {},
3864
- footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3904
+ footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3865
3905
  // never_add on a column that takes only its choices: said, never a silent nothing.
3866
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3867
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3868
- autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3906
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3907
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3908
+ autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3869
3909
  ] })
3870
3910
  ) : null,
3871
3911
  children: anchored ? cellChips : null
@@ -3885,9 +3925,9 @@ function RecordChip({
3885
3925
  // name. So it caps at its container and ends in an ellipsis with the whole name in
3886
3926
  // its tooltip, rather than being cut mid-word by whatever box it landed in
3887
3927
  // (lane FIX-14, 2026-09-22).
3888
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system14.Badge, { variant: "secondary", className: (0, import_design_system14.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
3889
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 truncate", children: title }),
3890
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3928
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system15.Badge, { variant: "secondary", className: (0, import_design_system15.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
3929
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "min-w-0 truncate", children: title }),
3930
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3891
3931
  ] })
3892
3932
  );
3893
3933
  }
@@ -3925,7 +3965,7 @@ function ChoiceAnswer({
3925
3965
  const option = (choice) => {
3926
3966
  const chosen = on(choice);
3927
3967
  const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
3928
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3968
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3929
3969
  "button",
3930
3970
  {
3931
3971
  type: "button",
@@ -3935,24 +3975,24 @@ function ChoiceAnswer({
3935
3975
  disabled,
3936
3976
  onClick: () => press(choice),
3937
3977
  "data-records-choice-answer": choice.key,
3938
- className: (0, import_design_system14.cn)(
3978
+ className: (0, import_design_system15.cn)(
3939
3979
  "flex min-h-11 w-full items-center gap-3 rounded-md border px-3 py-2 text-left text-base font-medium text-foreground transition-colors sm:min-h-10 sm:text-sm",
3940
3980
  chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
3941
3981
  ),
3942
3982
  children: [
3943
- letter ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3983
+ letter ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3944
3984
  "kbd",
3945
3985
  {
3946
3986
  "aria-hidden": "true",
3947
- className: (0, import_design_system14.cn)(
3987
+ className: (0, import_design_system15.cn)(
3948
3988
  "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border font-sans text-xs font-semibold",
3949
3989
  chosen ? "border-primary bg-primary text-primary-foreground" : "border-primary/40 text-primary"
3950
3990
  ),
3951
3991
  children: letter
3952
3992
  }
3953
3993
  ) : null,
3954
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
3955
- chosen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
3994
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
3995
+ chosen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
3956
3996
  ]
3957
3997
  },
3958
3998
  choice.key
@@ -3968,13 +4008,13 @@ function ChoiceAnswer({
3968
4008
  };
3969
4009
  const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
3970
4010
  if (choices.length <= FORM_SEARCH_AFTER) {
3971
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
4011
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
3972
4012
  }
3973
4013
  const q = search.trim().toLowerCase();
3974
4014
  const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
3975
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
3976
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3977
- import_design_system14.BasicInput,
4015
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
4016
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4017
+ import_design_system15.BasicInput,
3978
4018
  {
3979
4019
  value: search,
3980
4020
  onChange: (e) => setSearch(e.target.value),
@@ -3984,9 +4024,9 @@ function ChoiceAnswer({
3984
4024
  className: "h-11 text-base sm:h-9 sm:text-sm"
3985
4025
  }
3986
4026
  ),
3987
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
4027
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
3988
4028
  shown2.map(option),
3989
- shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
4029
+ shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
3990
4030
  ] })
3991
4031
  ] });
3992
4032
  }
@@ -3994,7 +4034,7 @@ function ChoiceAnswer({
3994
4034
  // src/RecordsMount.tsx
3995
4035
  var import_react26 = require("react");
3996
4036
  var import_react27 = require("@ai-matrx/records/react");
3997
- var import_jsx_runtime17 = require("react/jsx-runtime");
4037
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3998
4038
  function personActor(userId) {
3999
4039
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
4000
4040
  }
@@ -4003,8 +4043,8 @@ function personActor(userId) {
4003
4043
  var import_react28 = require("react");
4004
4044
  var import_records11 = require("@ai-matrx/records");
4005
4045
  var import_react29 = require("@ai-matrx/records/react");
4006
- var import_design_system15 = require("@ai-matrx/design-system");
4007
- var import_jsx_runtime18 = require("react/jsx-runtime");
4046
+ var import_design_system16 = require("@ai-matrx/design-system");
4047
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4008
4048
  var APP_TABLE_PREFIX = "records_ui_";
4009
4049
  function isValueSet(table) {
4010
4050
  if (table.kept_for === "choices") return true;
@@ -4047,7 +4087,7 @@ function madeOn(stamp) {
4047
4087
  }
4048
4088
 
4049
4089
  // src/TablePickers.tsx
4050
- var import_jsx_runtime19 = require("react/jsx-runtime");
4090
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4051
4091
  var SHARED_FOR_MS = 5e3;
4052
4092
  var sharedReads = /* @__PURE__ */ new WeakMap();
4053
4093
  function readTablesAnywhere(dataSource) {
@@ -4117,17 +4157,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4117
4157
  hint: t.organization_name,
4118
4158
  keywords: t.organization_name,
4119
4159
  ...twin && second ? {
4120
- render: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
4121
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate", children: t.table_name }),
4122
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4160
+ render: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
4161
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate", children: t.table_name }),
4162
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4123
4163
  ] })
4124
4164
  } : {}
4125
4165
  };
4126
4166
  });
4127
4167
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
4128
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", children: [
4129
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4130
- import_design_system16.CreatablePicker,
4168
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
4169
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4170
+ import_design_system17.CreatablePicker,
4131
4171
  {
4132
4172
  value: value || null,
4133
4173
  options: pickerOptions,
@@ -4140,17 +4180,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4140
4180
  ariaLabel: "Table"
4141
4181
  }
4142
4182
  ),
4143
- list.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4144
- missing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4183
+ list.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4184
+ missing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4145
4185
  ] });
4146
4186
  }
4147
4187
  function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
4148
4188
  const own3 = useTablesAnywhere(dataSource);
4149
4189
  const list = tables ?? own3;
4150
4190
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
4151
- if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: unavailable ?? fallback });
4152
- if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: fallback });
4153
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react31.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4191
+ if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: unavailable ?? fallback });
4192
+ if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: fallback });
4193
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react31.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4154
4194
  }
4155
4195
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4156
4196
  const fields = (0, import_react31.useFields)(tableId);
@@ -4170,11 +4210,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4170
4210
  void _gone;
4171
4211
  onChange(rest);
4172
4212
  };
4173
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-2", children: [
4174
- fields.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RefusalLine, { error: fields.error }),
4213
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2", children: [
4214
+ fields.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: fields.error }),
4175
4215
  keys.map((key) => {
4176
4216
  const field = byKey.get(key);
4177
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4217
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4178
4218
  ColumnValueRow,
4179
4219
  {
4180
4220
  columnKey: key,
@@ -4190,7 +4230,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4190
4230
  key
4191
4231
  );
4192
4232
  }),
4193
- adding && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4233
+ adding && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4194
4234
  ColumnValueRow,
4195
4235
  {
4196
4236
  columnKey: null,
@@ -4207,7 +4247,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4207
4247
  onRemove: () => setAdding(false)
4208
4248
  }
4209
4249
  ),
4210
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system16.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4250
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system17.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4211
4251
  ] });
4212
4252
  }
4213
4253
  function ColumnValueRow({
@@ -4223,10 +4263,10 @@ function ColumnValueRow({
4223
4263
  }) {
4224
4264
  const orphan = columnKey !== null && !loading && field === void 0;
4225
4265
  const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
4226
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4227
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
4228
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4229
- import_design_system16.CreatablePicker,
4266
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4267
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
4268
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4269
+ import_design_system17.CreatablePicker,
4230
4270
  {
4231
4271
  value: columnKey,
4232
4272
  options: shown2,
@@ -4239,9 +4279,9 @@ function ColumnValueRow({
4239
4279
  ariaLabel: "Column"
4240
4280
  }
4241
4281
  ) }),
4242
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system16.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4282
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system17.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4243
4283
  ] }),
4244
- field ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4284
+ field ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4245
4285
  ] });
4246
4286
  }
4247
4287
  function RecordPicker({ tableId, value, onChange, disabled }) {
@@ -4253,9 +4293,9 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4253
4293
  label: rowNameIn(table.data ?? null, row)
4254
4294
  }));
4255
4295
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
4256
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", children: [
4257
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4258
- import_design_system16.CreatablePicker,
4296
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
4297
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4298
+ import_design_system17.CreatablePicker,
4259
4299
  {
4260
4300
  value: value || null,
4261
4301
  options,
@@ -4268,7 +4308,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4268
4308
  ariaLabel: "Record"
4269
4309
  }
4270
4310
  ),
4271
- records.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RefusalLine, { error: records.error })
4311
+ records.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: records.error })
4272
4312
  ] });
4273
4313
  }
4274
4314
 
@@ -4276,8 +4316,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4276
4316
  var import_react32 = require("react");
4277
4317
  var import_records12 = require("@ai-matrx/records");
4278
4318
  var import_react33 = require("@ai-matrx/records/react");
4279
- var import_design_system17 = require("@ai-matrx/design-system");
4280
- var import_jsx_runtime20 = require("react/jsx-runtime");
4319
+ var import_design_system18 = require("@ai-matrx/design-system");
4320
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4281
4321
  var DATA_BINDING_SHAPES = [
4282
4322
  { value: "collection", label: "The whole table" },
4283
4323
  { value: "reference", label: "One record" },
@@ -4344,9 +4384,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
4344
4384
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
4345
4385
  });
4346
4386
  };
4347
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2", children: [
4348
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4349
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4387
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
4388
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4389
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4350
4390
  BindingDetails,
4351
4391
  {
4352
4392
  tableId,
@@ -4410,9 +4450,9 @@ function BindingDetails({
4410
4450
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
4411
4451
  const template = binding.transform?.template ?? "";
4412
4452
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
4413
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2", children: [
4414
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4415
- import_design_system17.Button,
4453
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
4454
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4455
+ import_design_system18.Button,
4416
4456
  {
4417
4457
  type: "button",
4418
4458
  size: "sm",
@@ -4425,7 +4465,7 @@ function BindingDetails({
4425
4465
  },
4426
4466
  s.value
4427
4467
  )) }),
4428
- shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4468
+ shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4429
4469
  RecordPicker,
4430
4470
  {
4431
4471
  tableId,
@@ -4434,8 +4474,8 @@ function BindingDetails({
4434
4474
  disabled: Boolean(disabled)
4435
4475
  }
4436
4476
  ),
4437
- shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4438
- import_design_system17.CreatablePicker,
4477
+ shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4478
+ import_design_system18.CreatablePicker,
4439
4479
  {
4440
4480
  value: binding.field_key ?? null,
4441
4481
  options: fieldOptions,
@@ -4448,11 +4488,11 @@ function BindingDetails({
4448
4488
  ariaLabel: "Column"
4449
4489
  }
4450
4490
  ),
4451
- shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
4452
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4491
+ shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4492
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4453
4493
  "textarea",
4454
4494
  {
4455
- className: (0, import_design_system17.cn)(
4495
+ className: (0, import_design_system18.cn)(
4456
4496
  "min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
4457
4497
  ),
4458
4498
  "aria-label": "Each row reads as",
@@ -4461,8 +4501,8 @@ function BindingDetails({
4461
4501
  onChange: (e) => setTemplate(e.target.value)
4462
4502
  }
4463
4503
  ),
4464
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4465
- import_design_system17.Button,
4504
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4505
+ import_design_system18.Button,
4466
4506
  {
4467
4507
  type: "button",
4468
4508
  size: "sm",
@@ -4474,10 +4514,10 @@ function BindingDetails({
4474
4514
  p.token
4475
4515
  )) })
4476
4516
  ] }),
4477
- shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4517
+ shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4478
4518
  "Up to",
4479
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4480
- import_design_system17.BasicInput,
4519
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4520
+ import_design_system18.BasicInput,
4481
4521
  {
4482
4522
  type: "number",
4483
4523
  min: 1,
@@ -4493,10 +4533,10 @@ function BindingDetails({
4493
4533
  ),
4494
4534
  "rows"
4495
4535
  ] }),
4496
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4497
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4498
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4499
- import_design_system17.Button,
4536
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4537
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4538
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4539
+ import_design_system18.Button,
4500
4540
  {
4501
4541
  type: "button",
4502
4542
  size: "sm",
@@ -4519,7 +4559,7 @@ var import_react36 = require("@ai-matrx/records/react");
4519
4559
  // src/values.tsx
4520
4560
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
4521
4561
  var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
4522
- var import_design_system20 = require("@ai-matrx/design-system");
4562
+ var import_design_system21 = require("@ai-matrx/design-system");
4523
4563
 
4524
4564
  // src/embeddedLook.tsx
4525
4565
  var import_react34 = require("react");
@@ -4576,8 +4616,8 @@ var import_core2 = require("@ai-matrx/records/core");
4576
4616
  // src/WholeValue.tsx
4577
4617
  var import_react35 = require("react");
4578
4618
  var import_core = require("@ai-matrx/records/core");
4579
- var import_design_system18 = require("@ai-matrx/design-system");
4580
- var import_jsx_runtime21 = require("react/jsx-runtime");
4619
+ var import_design_system19 = require("@ai-matrx/design-system");
4620
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4581
4621
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
4582
4622
  function wholeValueLine(pointer) {
4583
4623
  return `Open the whole text (${(0, import_core.wholeValueSize)(pointer)})`;
@@ -4586,12 +4626,12 @@ function WholeValueCell({ words, pointer }) {
4586
4626
  const host = useRecordsUi();
4587
4627
  const href = host.hrefForFile?.({ fileId: pointer.file_id });
4588
4628
  const line = wholeValueLine(pointer);
4589
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4590
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4629
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4630
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4591
4631
  words,
4592
4632
  "\u2026"
4593
4633
  ] }),
4594
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core.wholeValueSize)(pointer)} in a file` })
4634
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core.wholeValueSize)(pointer)} in a file` })
4595
4635
  ] });
4596
4636
  }
4597
4637
 
@@ -4600,7 +4640,7 @@ var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
4600
4640
 
4601
4641
  // src/ReferenceChips.tsx
4602
4642
  var import_records13 = require("@ai-matrx/records");
4603
- var import_design_system19 = require("@ai-matrx/design-system");
4643
+ var import_design_system20 = require("@ai-matrx/design-system");
4604
4644
 
4605
4645
  // src/kindValues.ts
4606
4646
  var import_directives = require("@ai-matrx/content-ir/directives");
@@ -4654,7 +4694,7 @@ function kindLabel(kind) {
4654
4694
  }
4655
4695
 
4656
4696
  // src/ReferenceChips.tsx
4657
- var import_jsx_runtime22 = require("react/jsx-runtime");
4697
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4658
4698
  function glyphOf(icon) {
4659
4699
  const text = (icon ?? "").trim();
4660
4700
  return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
@@ -4687,23 +4727,25 @@ function referencesOf(field, value, kind, labels) {
4687
4727
  var ARCHIVED_REFERENCE_WORD = "Archived";
4688
4728
  var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
4689
4729
  function PageGlyph() {
4690
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4691
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4692
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4693
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10 13H8" }),
4694
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 17H8" })
4730
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4731
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4732
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4733
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M10 13H8" }),
4734
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 17H8" })
4695
4735
  ] });
4696
4736
  }
4697
4737
  function ReferenceChip({ reference, waiting }) {
4698
4738
  const host = useRecordsUi();
4739
+ const look = useEmbeddedLook();
4740
+ const pending = reference.label == null && reference.token === "record" && !waiting && !host.renderReference;
4741
+ const pendingMark = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
4699
4742
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4700
4743
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4701
- const look = useEmbeddedLook();
4702
4744
  if (look?.plainRelation) {
4703
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4745
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4704
4746
  "span",
4705
4747
  {
4706
- className: (0, import_design_system19.cn)(
4748
+ className: (0, import_design_system20.cn)(
4707
4749
  "inline-flex max-w-full min-w-0 items-center gap-1.5 text-sm text-foreground hover:underline [&_a]:text-inherit [&_a]:no-underline [&_a:hover]:underline",
4708
4750
  reference.archived && "opacity-70"
4709
4751
  ),
@@ -4712,18 +4754,18 @@ function ReferenceChip({ reference, waiting }) {
4712
4754
  "data-records-reference-archived": reference.archived ? "" : void 0,
4713
4755
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4714
4756
  children: [
4715
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
4716
- drawn ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: words }),
4717
- reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4757
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PageGlyph, {}) }),
4758
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words })),
4759
+ reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4718
4760
  ]
4719
4761
  }
4720
4762
  );
4721
4763
  }
4722
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4723
- import_design_system19.Badge,
4764
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4765
+ import_design_system20.Badge,
4724
4766
  {
4725
4767
  variant: "secondary",
4726
- className: (0, import_design_system19.cn)(
4768
+ className: (0, import_design_system20.cn)(
4727
4769
  "max-w-full min-w-0 gap-1 px-1.5 py-0 text-[11px] font-normal",
4728
4770
  reference.archived && "opacity-70"
4729
4771
  ),
@@ -4731,15 +4773,15 @@ function ReferenceChip({ reference, waiting }) {
4731
4773
  "data-records-reference-archived": reference.archived ? "" : void 0,
4732
4774
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4733
4775
  children: [
4734
- drawn ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: words }),
4735
- reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4776
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words })),
4777
+ reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4736
4778
  ]
4737
4779
  }
4738
4780
  );
4739
4781
  }
4740
4782
  function ReferenceChips({ refs, waiting }) {
4741
- if (refs.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4742
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4783
+ if (refs.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4784
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4743
4785
  }
4744
4786
  function KindValueCell({
4745
4787
  kv,
@@ -4748,10 +4790,10 @@ function KindValueCell({
4748
4790
  }) {
4749
4791
  const host = useRecordsUi();
4750
4792
  if (host.renderKind) {
4751
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4793
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4752
4794
  }
4753
4795
  const named = kv.items.map(kindItemWords).filter((w) => w !== null);
4754
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_design_system19.cn)("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Badge, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Badge, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4796
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: (0, import_design_system20.cn)("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Badge, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Badge, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4755
4797
  }
4756
4798
 
4757
4799
  // src/formulaNames.ts
@@ -4769,10 +4811,10 @@ function formulaSourceArchived(field, document2) {
4769
4811
 
4770
4812
  // src/values.tsx
4771
4813
  var import_records15 = require("@ai-matrx/records");
4772
- var import_jsx_runtime23 = require("react/jsx-runtime");
4814
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4773
4815
  function statusMark(field, item, document2) {
4774
4816
  const mark = statusMarkOf(field, item, document2);
4775
- return mark ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4817
+ return mark ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4776
4818
  }
4777
4819
  function envelopeFor(document2, key) {
4778
4820
  const block = document2?._values;
@@ -4818,43 +4860,47 @@ function sourceArchivedSentence(state) {
4818
4860
  return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
4819
4861
  }
4820
4862
  function SourceArchivedValue({ state }) {
4821
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4863
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4822
4864
  }
4823
4865
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
4824
4866
  function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4825
4867
  const archivedSource = (0, import_records15.sourceArchivedOf)(value);
4826
- if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SourceArchivedValue, { state: archivedSource });
4868
+ if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SourceArchivedValue, { state: archivedSource });
4827
4869
  const envelope = envelopeFor(document2, field.key);
4828
4870
  if (envelope?.absent) {
4829
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4871
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4830
4872
  }
4831
4873
  if (value === null || value === void 0 || value === "") {
4832
4874
  const gone = unresolvedFor(document2, field.key);
4833
4875
  if (gone) {
4834
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4876
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4835
4877
  }
4836
4878
  const archivedInput = formulaSourceArchived(field, document2);
4837
- if (archivedInput) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SourceArchivedValue, { state: archivedInput });
4879
+ if (archivedInput) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SourceArchivedValue, { state: archivedInput });
4838
4880
  const computed = computedEmptyOf(field, document2);
4839
- if (computed?.sentence) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4840
- if (computed?.words) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "data-records-empty-why": computed.kind, children: computed.words });
4881
+ if (computed?.sentence) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4882
+ if (computed?.words) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "data-records-empty-why": computed.kind, children: computed.words });
4841
4883
  if (computed?.why) {
4842
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4884
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4843
4885
  }
4844
4886
  if (look?.blankEmpty) return null;
4845
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4887
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4846
4888
  }
4847
- if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
4889
+ if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
4848
4890
  const newer = newerKindValue(field, value);
4849
4891
  if (newer !== void 0) return newer;
4850
4892
  const whole = typeof value === "string" ? (0, import_core2.wholeValueOf)(document2, field.key) : null;
4851
- if (whole) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(WholeValueCell, { words: value, pointer: whole });
4893
+ if (whole) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WholeValueCell, { words: value, pointer: whole });
4852
4894
  const kind = editorKindFor(field);
4853
4895
  if (kind === "relation" || kind === "entity_reference") {
4854
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4896
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4897
+ }
4898
+ if (kind === "member") {
4899
+ const ids = (Array.isArray(value) ? value : [value]).filter((v) => v !== null && v !== void 0 && v !== "");
4900
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PersonChip, { name: scalarText(field, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
4855
4901
  }
4856
- const kv = kind === "attachment" || kind === "member" ? null : kindValueOf(value);
4857
- if (kv) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KindValueCell, { kv, where: "cell", title: field.label });
4902
+ const kv = kind === "attachment" ? null : kindValueOf(value);
4903
+ if (kv) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KindValueCell, { kv, where: "cell", title: field.label });
4858
4904
  const chosen = kind === "select" || kind === "multi_select";
4859
4905
  const chipOf = (item) => {
4860
4906
  const chipLook = choiceChipLookOf(field, item, scalarText(field, item, labels));
@@ -4862,17 +4908,17 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4862
4908
  };
4863
4909
  if (chosen) {
4864
4910
  const items = Array.isArray(value) ? value : [value];
4865
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4911
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4866
4912
  const chip = chipOf(item);
4867
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4868
- import_design_system20.Badge,
4913
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4914
+ import_design_system21.Badge,
4869
4915
  {
4870
4916
  variant: "outline",
4871
- className: (0, import_design_system20.cn)("text-[11px]", chip.className),
4917
+ className: (0, import_design_system21.cn)("text-[11px]", chip.className),
4872
4918
  "data-records-choice-chip": "",
4873
4919
  ...chip.tinted ? { "data-records-choice-tint": "" } : {},
4874
4920
  children: [
4875
- look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: (0, import_design_system20.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4921
+ look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: (0, import_design_system21.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4876
4922
  statusMark(field, item, Array.isArray(value) ? void 0 : document2),
4877
4923
  scalarText(field, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
4878
4924
  ]
@@ -4881,13 +4927,13 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4881
4927
  );
4882
4928
  }) });
4883
4929
  }
4884
- if (kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AttachmentChips, { value });
4930
+ if (kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AttachmentChips, { value });
4885
4931
  if (Array.isArray(value)) {
4886
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Badge, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4932
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system21.Badge, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4887
4933
  }
4888
4934
  if (kind === "url" && typeof value === "string") {
4889
4935
  const href = value.includes("://") ? value : `https://${value}`;
4890
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4936
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4891
4937
  "a",
4892
4938
  {
4893
4939
  className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
@@ -4898,14 +4944,14 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4898
4944
  "data-records-link-chip": "",
4899
4945
  onClick: (event) => event.stopPropagation(),
4900
4946
  children: [
4901
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
4902
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: linkChipText(value) })
4947
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
4948
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: linkChipText(value) })
4903
4949
  ]
4904
4950
  }
4905
4951
  );
4906
4952
  }
4907
4953
  if (kind === "phone" && typeof value === "string" && value.trim() !== "") {
4908
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4954
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4909
4955
  "a",
4910
4956
  {
4911
4957
  className: "truncate tabular-nums text-primary underline-offset-2 hover:underline",
@@ -4918,12 +4964,12 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4918
4964
  );
4919
4965
  }
4920
4966
  if (kind === "email" && typeof value === "string") {
4921
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
4967
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
4922
4968
  }
4923
4969
  if (typeof value === "boolean") {
4924
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
4970
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
4925
4971
  }
4926
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: (0, import_design_system20.cn)("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
4972
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: (0, import_design_system21.cn)("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
4927
4973
  }
4928
4974
  function scalarText(field, value, labels, stillWaitingFor) {
4929
4975
  if (value === null || value === void 0) return "\u2014";
@@ -4965,13 +5011,13 @@ function scalarText(field, value, labels, stillWaitingFor) {
4965
5011
  }
4966
5012
 
4967
5013
  // src/PickedSummaries.tsx
4968
- var import_jsx_runtime24 = require("react/jsx-runtime");
5014
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4969
5015
  function TableNameText({ dataSource, tableId }) {
4970
5016
  const tables = useTablesAnywhere(dataSource);
4971
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2014" });
4972
- if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" });
4973
- if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load the table's name" });
4974
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
5017
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5018
+ if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5019
+ if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load the table's name" });
5020
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
4975
5021
  }
4976
5022
  function ColumnValuesText({
4977
5023
  dataSource,
@@ -4979,38 +5025,38 @@ function ColumnValuesText({
4979
5025
  tableId,
4980
5026
  value
4981
5027
  }) {
4982
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2014" });
4983
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5028
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5029
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4984
5030
  TableScope,
4985
5031
  {
4986
5032
  dataSource,
4987
5033
  userId,
4988
5034
  tableId,
4989
- fallback: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" }),
4990
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this table's columns" }),
4991
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColumnValuesWords, { tableId, value }) })
5035
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" }),
5036
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this table's columns" }),
5037
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ColumnValuesWords, { tableId, value }) })
4992
5038
  }
4993
5039
  );
4994
5040
  }
4995
5041
  function ColumnValuesWords({ tableId, value }) {
4996
5042
  const fields = (0, import_react36.useFields)(tableId);
4997
5043
  const labels = useRecordLabels(fields.data ?? void 0);
4998
- if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" });
4999
- if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this table's columns" });
5044
+ if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5045
+ if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this table's columns" });
5000
5046
  const parts = [];
5001
5047
  for (const [key, stored] of Object.entries(value)) {
5002
5048
  if (key.startsWith("_")) continue;
5003
5049
  const field = (fields.data ?? []).find((f) => f.key === key);
5004
- if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: ", " }, `${key}-sep`));
5050
+ if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: ", " }, `${key}-sep`));
5005
5051
  parts.push(
5006
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
5052
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
5007
5053
  field ? fieldName(field) : "A removed column",
5008
5054
  " is ",
5009
5055
  field ? renderValue(field, stored, void 0, labels) : "\u2014"
5010
5056
  ] }, key)
5011
5057
  );
5012
5058
  }
5013
- return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2014" });
5059
+ return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5014
5060
  }
5015
5061
  function RecordNameText({
5016
5062
  dataSource,
@@ -5018,35 +5064,35 @@ function RecordNameText({
5018
5064
  tableId,
5019
5065
  recordId
5020
5066
  }) {
5021
- if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2014" });
5022
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5067
+ if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5068
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5023
5069
  TableScope,
5024
5070
  {
5025
5071
  dataSource,
5026
5072
  userId,
5027
5073
  tableId,
5028
- fallback: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" }),
5029
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this record" }),
5030
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RecordNameWords, { tableId, recordId })
5074
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" }),
5075
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this record" }),
5076
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RecordNameWords, { tableId, recordId })
5031
5077
  }
5032
5078
  );
5033
5079
  }
5034
5080
  function RecordNameWords({ tableId, recordId }) {
5035
5081
  const table = (0, import_react36.useTable)(tableId);
5036
5082
  const record = (0, import_react36.useRecord)(recordId);
5037
- if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "\u2026" });
5038
- if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "Couldn't load this record" });
5039
- if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: "A record you cannot open" });
5040
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5083
+ if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5084
+ if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this record" });
5085
+ if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "A record you cannot open" });
5086
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5041
5087
  }
5042
5088
 
5043
5089
  // src/HeldChangeDecision.tsx
5044
5090
  var import_react37 = require("react");
5045
5091
  var import_react38 = require("@ai-matrx/records/react");
5046
- var import_design_system21 = require("@ai-matrx/design-system");
5047
- var import_jsx_runtime25 = require("react/jsx-runtime");
5092
+ var import_design_system22 = require("@ai-matrx/design-system");
5093
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5048
5094
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
5049
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react38.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Decision, { approvalId, onDecided }) });
5095
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react38.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Decision, { approvalId, onDecided }) });
5050
5096
  }
5051
5097
  function Decision({ approvalId, onDecided }) {
5052
5098
  const client = (0, import_react38.useRecordsClient)();
@@ -5075,13 +5121,13 @@ function Decision({ approvalId, onDecided }) {
5075
5121
  if (res.ok) onDecided(approve);
5076
5122
  else setError(res.error);
5077
5123
  };
5078
- if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5079
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
5080
- may ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2", children: [
5081
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system21.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5082
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system21.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5083
- ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5084
- error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalLine, { error }) : null
5124
+ if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5125
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
5126
+ may ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-2", children: [
5127
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5128
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5129
+ ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5130
+ error ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RefusalLine, { error }) : null
5085
5131
  ] });
5086
5132
  }
5087
5133
  //# sourceMappingURL=pickers.cjs.map