@ai-matrx/records-ui 0.116.76 → 0.116.78

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.
@@ -2037,13 +2037,13 @@ function ReferenceBuilder({
2037
2037
  }
2038
2038
 
2039
2039
  // src/ChoiceListEditor.tsx
2040
- import { useEffect as useEffect23, useRef as useRef19, useState as useState33 } from "react";
2040
+ import { useEffect as useEffect23, useRef as useRef18, useState as useState33 } from "react";
2041
2041
  import { optionLabel as optionLabel2, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
2042
2042
  import { useRecordsClient as useRecordsClient9 } from "@ai-matrx/records/react";
2043
2043
  import {
2044
2044
  BasicInput as BasicInput11,
2045
2045
  Button as Button18,
2046
- Label as Label11,
2046
+ Label as Label12,
2047
2047
  Popover as Popover7,
2048
2048
  PopoverContent as PopoverContent7,
2049
2049
  PopoverTrigger as PopoverTrigger7,
@@ -2095,7 +2095,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
2095
2095
  }
2096
2096
 
2097
2097
  // src/editors.tsx
2098
- import { useCallback as useCallback7, useEffect as useEffect22, useLayoutEffect as useLayoutEffect3, useRef as useRef18, useState as useState32 } from "react";
2098
+ import { useCallback as useCallback7, useEffect as useEffect22, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as useState32 } from "react";
2099
2099
  import { isButtonField as isButtonField2, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf2, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
2100
2100
  import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
2101
2101
  import {
@@ -2103,8 +2103,8 @@ import {
2103
2103
  BasicTextarea as BasicTextarea5,
2104
2104
  Badge as Badge7,
2105
2105
  Button as Button17,
2106
- Checkbox as Checkbox5,
2107
- Label as Label10,
2106
+ Checkbox as Checkbox6,
2107
+ Label as Label11,
2108
2108
  Popover as Popover6,
2109
2109
  PopoverContent as PopoverContent6,
2110
2110
  PopoverTrigger as PopoverTrigger6,
@@ -2488,6 +2488,13 @@ function tellApart(rows, nameOf3) {
2488
2488
 
2489
2489
  // src/RelationPicker.tsx
2490
2490
  import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2491
+ function linkTargetsOf(field2) {
2492
+ const own3 = field2.relation_target ? String(field2.relation_target) : "";
2493
+ if (own3 === "") return [];
2494
+ const listed = field2.config?.["target_tables"];
2495
+ if (field2.config?.["target_mode"] !== "several" || !Array.isArray(listed)) return [own3];
2496
+ return [own3, ...listed.map(String).filter((t, i, all) => t !== own3 && all.indexOf(t) === i)];
2497
+ }
2491
2498
  function withoutSelf(rows, selfId) {
2492
2499
  return selfId ? rows.filter((row) => row.id !== selfId) : rows;
2493
2500
  }
@@ -2511,12 +2518,18 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2511
2518
  const [newTitle, setNewTitle] = useState10("");
2512
2519
  const [busy, setBusy] = useState10(false);
2513
2520
  const [createRefusal, setCreateRefusal] = useState10(null);
2521
+ const [tableNames, setTableNames] = useState10({});
2514
2522
  const picked = useMemo4(
2515
2523
  () => Array.isArray(value) ? value.map(String) : value === null || value === void 0 ? [] : [String(value)],
2516
2524
  [value]
2517
2525
  );
2518
2526
  const limitView = typeof field2.config?.["limit_to_view"] === "string" ? field2.config["limit_to_view"] : null;
2519
2527
  const [viewGone, setViewGone] = useState10(false);
2528
+ const targetsKey = linkTargetsOf(field2).join(",");
2529
+ const targets = useMemo4(() => targetsKey === "" ? [] : targetsKey.split(","), [targetsKey]);
2530
+ const several = targets.length > 1;
2531
+ const [rowTable, setRowTable] = useState10({});
2532
+ const viewFilter = useRef6(void 0);
2520
2533
  const readChoices = useCallback3(async () => {
2521
2534
  const target2 = field2.relation_target;
2522
2535
  if (!target2 || !client) return null;
@@ -2527,8 +2540,17 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2527
2540
  setViewGone(view === void 0);
2528
2541
  if (view) filter = view.filters;
2529
2542
  }
2530
- return client.list({ table_id: target2, limit: 200, ...filter ? { filter } : {} });
2531
- }, [client, field2.relation_target, limitView]);
2543
+ viewFilter.current = filter;
2544
+ const reads = await Promise.all(
2545
+ targets.map((t, i) => client.list({ table_id: t, limit: 200, ...i === 0 && filter ? { filter } : {} }))
2546
+ );
2547
+ const refused = reads.find((r) => !r.ok);
2548
+ if (refused) return refused;
2549
+ const learned = {};
2550
+ reads.forEach((r, i) => r.ok && r.data.rows.forEach((row) => learned[row.id] = targets[i]));
2551
+ setRowTable((current) => ({ ...current, ...learned }));
2552
+ return reads.length === 1 ? reads[0] : { ok: true, data: { rows: reads.flatMap((r) => r.ok ? r.data.rows : []), total: null } };
2553
+ }, [client, field2.relation_target, limitView, targets]);
2532
2554
  useEffect7(() => {
2533
2555
  let cancelled = false;
2534
2556
  void readChoices().then((result) => {
@@ -2540,6 +2562,45 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2540
2562
  cancelled = true;
2541
2563
  };
2542
2564
  }, [readChoices]);
2565
+ const [searchRefusal, setSearchRefusal] = useState10(null);
2566
+ useEffect7(() => {
2567
+ const q = search.trim();
2568
+ if (!open || q === "" || !client || targets.length === 0) {
2569
+ setSearchRefusal(null);
2570
+ return;
2571
+ }
2572
+ let cancelled = false;
2573
+ const timer = setTimeout(() => {
2574
+ void Promise.all(
2575
+ targets.map(
2576
+ (t, i) => client.listPage({ table_id: t, search: q, limit: 50, ...i === 0 && viewFilter.current ? { filter: viewFilter.current } : {} })
2577
+ )
2578
+ ).then((reads) => {
2579
+ if (cancelled) return;
2580
+ const refused = reads.find((r) => !r.ok);
2581
+ setSearchRefusal(refused && !refused.ok ? refused.error : null);
2582
+ const learned = {};
2583
+ const foundRows = [];
2584
+ reads.forEach(
2585
+ (r, i) => r.ok && r.data.rows.forEach((row) => {
2586
+ learned[row.id] = targets[i];
2587
+ foundRows.push(row);
2588
+ })
2589
+ );
2590
+ if (foundRows.length === 0) return;
2591
+ setRowTable((current) => ({ ...current, ...learned }));
2592
+ setRows((current) => {
2593
+ const have = new Set((current ?? []).map((row) => row.id));
2594
+ const added = withoutSelf(foundRows, excludeId).filter((row) => !have.has(row.id));
2595
+ return added.length === 0 ? current : [...current ?? [], ...added];
2596
+ });
2597
+ });
2598
+ }, 250);
2599
+ return () => {
2600
+ cancelled = true;
2601
+ clearTimeout(timer);
2602
+ };
2603
+ }, [client, open, search, targets, excludeId]);
2543
2604
  useEffect7(() => {
2544
2605
  if (!rows || !client) return;
2545
2606
  const wanted = [.../* @__PURE__ */ new Set([...rows.map((row) => row.id), ...picked])].filter(
@@ -2561,7 +2622,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2561
2622
  };
2562
2623
  }, [client, field2.id, rows, picked, words]);
2563
2624
  useEffect7(() => {
2564
- if (!open || !allowCreate || target || targetRefusal || !client) return;
2625
+ if (!open || !allowCreate && !several || target || targetRefusal || !client) return;
2565
2626
  const id2 = field2.relation_target;
2566
2627
  if (!id2) return;
2567
2628
  let cancelled = false;
@@ -2571,6 +2632,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2571
2632
  setTargetRefusal(result.error);
2572
2633
  return;
2573
2634
  }
2635
+ setTableNames(Object.fromEntries(result.data.map((t) => [t.id, (t.name ?? "").trim() || "A table"])));
2574
2636
  const found = result.data.find((t) => t.id === id2) ?? null;
2575
2637
  if (found) setTarget(found);
2576
2638
  else
@@ -2584,7 +2646,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2584
2646
  return () => {
2585
2647
  cancelled = true;
2586
2648
  };
2587
- }, [client, open, allowCreate, target, targetRefusal, field2.relation_target]);
2649
+ }, [client, open, allowCreate, several, target, targetRefusal, field2.relation_target]);
2588
2650
  if (!client) {
2589
2651
  return (
2590
2652
  // The Field's own name is already printed above this control by
@@ -2685,7 +2747,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2685
2747
  items: visible.map((row) => ({
2686
2748
  id: row.id,
2687
2749
  label: titleOf(row.id),
2688
- detail: apart.get(row.id) ?? null,
2750
+ detail: apart.get(row.id) ?? (several ? tableNames[rowTable[row.id] ?? ""] ?? null : null),
2689
2751
  picked: picked.includes(row.id),
2690
2752
  title: apart.has(row.id) ? `${titleOf(row.id)} \u2014 ${apart.get(row.id)}` : titleOf(row.id),
2691
2753
  attrs: { "data-relation-candidate": row.id }
@@ -2693,6 +2755,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
2693
2755
  onPick: toggle,
2694
2756
  notice: /* @__PURE__ */ jsxs9(Fragment5, { children: [
2695
2757
  refusal ? /* @__PURE__ */ jsx12(RefusalLine, { error: refusal, className: "p-2" }) : null,
2758
+ searchRefusal ? /* @__PURE__ */ jsx12(RefusalLine, { error: searchRefusal, className: "p-2" }) : null,
2696
2759
  !rows && !refusal ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
2697
2760
  viewGone ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", "data-relation-view-gone": "", children: "Its view is gone, so every record is offered." }) : null,
2698
2761
  full ? /* @__PURE__ */ jsxs9("p", { className: "p-2 text-xs text-muted-foreground", children: [
@@ -2781,7 +2844,7 @@ function readableLink(raw) {
2781
2844
  }
2782
2845
 
2783
2846
  // src/buttonCell.tsx
2784
- import { useContext as useContext3, useEffect as useEffect20, useRef as useRef15, useState as useState28 } from "react";
2847
+ import { useContext as useContext3, useEffect as useEffect20, useRef as useRef14, useState as useState28 } from "react";
2785
2848
  import { Button as Button16, Dialog as Dialog3, ErrorBox as ErrorBox2, DialogContent as DialogContent3, DialogDescription, DialogHeader as DialogHeader3, DialogTitle as DialogTitle3, Popover as Popover4, PopoverContent as PopoverContent4, PopoverTrigger as PopoverTrigger4, cn as cn18 } from "@ai-matrx/design-system";
2786
2849
  import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
2787
2850
  import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
@@ -2922,7 +2985,7 @@ function columnNameProblemLine(name, noun = "column") {
2922
2985
  }
2923
2986
 
2924
2987
  // src/FieldEditor.tsx
2925
- import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef14, useState as useState27 } from "react";
2988
+ import { useEffect as useEffect19, useMemo as useMemo11, useRef as useRef13, useState as useState27 } from "react";
2926
2989
  import {
2927
2990
  tableShapeChanged as tableShapeChanged3,
2928
2991
  useEntityFieldMutation,
@@ -2939,8 +3002,8 @@ import { announceRecordChanged } from "@ai-matrx/records/core";
2939
3002
  import {
2940
3003
  BasicInput as BasicInput8,
2941
3004
  Button as Button15,
2942
- Checkbox as Checkbox4,
2943
- Label as Label9,
3005
+ Checkbox as Checkbox5,
3006
+ Label as Label10,
2944
3007
  Select as Select5,
2945
3008
  SelectContent as SelectContent5,
2946
3009
  SelectGroup,
@@ -3588,23 +3651,47 @@ function WholeValueEditor({
3588
3651
  import { formatPhone as formatPhone2 } from "@ai-matrx/design-system/field-formats";
3589
3652
 
3590
3653
  // src/formattedValue.tsx
3591
- import { useRef as useRef10 } from "react";
3654
+ import { useRef as useRef9 } from "react";
3592
3655
  import { FormattedCell } from "@ai-matrx/design-system/data-table";
3593
3656
  import { formatFieldValue as formatFieldValue2, formatPhone, getFieldFormat } from "@ai-matrx/design-system/field-formats";
3594
3657
  import { cn as cn10 } from "@ai-matrx/design-system";
3595
3658
  import { OutboundLink as OutboundLink3 } from "@ai-matrx/kit/outbound-react";
3596
3659
 
3597
3660
  // src/LinkPreviewCard.tsx
3598
- import { useEffect as useEffect10, useRef as useRef9, useState as useState15 } from "react";
3599
- import { HoverCard, HoverCardContent, HoverCardTrigger, SiteIcon } from "@ai-matrx/design-system";
3600
- import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
3661
+ import { useEffect as useEffect10, useMemo as useMemo8, useState as useState15 } from "react";
3662
+ import { Peek, PeekHoverCard } from "@ai-matrx/design-system";
3663
+ import { Fragment as Fragment9, jsx as jsx19 } from "react/jsx-runtime";
3601
3664
  var answers = /* @__PURE__ */ new Map();
3665
+ function hostOf(url) {
3666
+ try {
3667
+ return new URL(url).hostname.replace(/^www\./, "");
3668
+ } catch {
3669
+ return url;
3670
+ }
3671
+ }
3672
+ function linkPreviewRecord(url, shown2) {
3673
+ const site = shown2.siteName?.trim() || hostOf(url);
3674
+ const title = shown2.title?.trim() || site;
3675
+ return {
3676
+ kind: "Link",
3677
+ id: url,
3678
+ showId: false,
3679
+ title,
3680
+ ...shown2.siteName || shown2.title ? { subtitle: site } : {},
3681
+ avatar: { initials: site.slice(0, 1).toUpperCase(), ...shown2.faviconUrl ? { src: shown2.faviconUrl } : {} },
3682
+ ...shown2.imageUrl ? { media: { alt: title, src: shown2.imageUrl, aspect: "16:9" } } : {},
3683
+ ...shown2.description ? { body: [{ section: "Description", text: shown2.description, clamp: 3 }] } : {},
3684
+ href: url,
3685
+ copyData: { url, title: shown2.title, description: shown2.description, site: shown2.siteName }
3686
+ };
3687
+ }
3602
3688
  function LinkPreviewCard({ url, children }) {
3603
3689
  const port = useRecordsUi().linkPreview;
3604
3690
  const [preview, setPreview] = useState15(void 0);
3605
3691
  const [open, setOpen] = useState15(false);
3606
- const timer = useRef9(null);
3607
- useEffect10(() => () => void (timer.current && clearTimeout(timer.current)), []);
3692
+ const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
3693
+ const record = useMemo8(() => shown2 ? linkPreviewRecord(url, shown2) : null, [url, shown2]);
3694
+ useEffect10(() => setPreview(void 0), [url]);
3608
3695
  if (!port) return /* @__PURE__ */ jsx19(Fragment9, { children });
3609
3696
  const ask = () => {
3610
3697
  if (preview !== void 0) return;
@@ -3615,35 +3702,27 @@ function LinkPreviewCard({ url, children }) {
3615
3702
  }
3616
3703
  void pending.then((found) => setPreview(found));
3617
3704
  };
3618
- const enter = () => {
3619
- ask();
3620
- if (timer.current) clearTimeout(timer.current);
3621
- timer.current = setTimeout(() => setOpen(true), 350);
3622
- };
3623
- const leave = () => {
3624
- if (timer.current) clearTimeout(timer.current);
3625
- setOpen(false);
3626
- };
3627
- const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
3628
- return /* @__PURE__ */ jsxs16(HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
3629
- /* @__PURE__ */ jsx19(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsx19("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
3630
- shown2 ? /* @__PURE__ */ jsxs16(HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
3631
- shown2.imageUrl ? (
3632
- // eslint-disable-next-line @next/next/no-img-element
3633
- /* @__PURE__ */ jsx19("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
3634
- ) : null,
3635
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1.5", children: [
3636
- /* @__PURE__ */ jsx19(SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
3637
- /* @__PURE__ */ jsx19("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
3638
- ] }),
3639
- shown2.title ? /* @__PURE__ */ jsx19("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
3640
- shown2.description ? /* @__PURE__ */ jsx19("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
3641
- ] }) : null
3642
- ] });
3705
+ const chip = /* @__PURE__ */ jsx19("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: ask, onFocus: ask, children });
3706
+ return /* @__PURE__ */ jsx19(
3707
+ PeekHoverCard,
3708
+ {
3709
+ trigger: chip,
3710
+ label: record?.title ?? "Link",
3711
+ side: "bottom",
3712
+ align: "start",
3713
+ presentation: "float",
3714
+ open: open && record !== null,
3715
+ onOpenChange: (next) => {
3716
+ if (next) ask();
3717
+ setOpen(next);
3718
+ },
3719
+ children: record ? /* @__PURE__ */ jsx19(Peek, { record, size: "sm" }) : /* @__PURE__ */ jsx19(Fragment9, {})
3720
+ }
3721
+ );
3643
3722
  }
3644
3723
 
3645
3724
  // src/formattedValue.tsx
3646
- import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
3725
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
3647
3726
  var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
3648
3727
  var own2 = (event) => event.stopPropagation();
3649
3728
  function numberOf3(value) {
@@ -3661,7 +3740,7 @@ function RatingStars({
3661
3740
  label,
3662
3741
  selectFirst
3663
3742
  }) {
3664
- const armed = useRef10(true);
3743
+ const armed = useRef9(true);
3665
3744
  const score = numberOf3(value) ?? 0;
3666
3745
  const shown2 = Math.round(score);
3667
3746
  const said2 = `${shown2} out of ${max}`;
@@ -3732,7 +3811,7 @@ function rich(id, text, raw, format) {
3732
3811
  if (n === null) return void 0;
3733
3812
  const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
3734
3813
  const clamped = Math.max(0, Math.min(100, pct));
3735
- return /* @__PURE__ */ jsxs17("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
3814
+ return /* @__PURE__ */ jsxs16("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
3736
3815
  /* @__PURE__ */ jsx20(
3737
3816
  "span",
3738
3817
  {
@@ -3748,7 +3827,7 @@ function rich(id, text, raw, format) {
3748
3827
  ] });
3749
3828
  }
3750
3829
  case "color":
3751
- return /* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1.5", children: [
3830
+ return /* @__PURE__ */ jsxs16("span", { className: "inline-flex items-center gap-1.5", children: [
3752
3831
  /* @__PURE__ */ jsx20("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
3753
3832
  /* @__PURE__ */ jsx20("code", { className: "font-mono text-xs", children: text })
3754
3833
  ] });
@@ -3796,11 +3875,11 @@ function linkChipText(raw) {
3796
3875
  }
3797
3876
 
3798
3877
  // src/gridAttachments.tsx
3799
- import { useEffect as useEffect11, useRef as useRef11, useState as useState16 } from "react";
3878
+ import { useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
3800
3879
  import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
3801
3880
  import { Badge as Badge3, Button as Button8, cn as cn11, Dialog, DialogContent, DialogHeader, DialogTitle } from "@ai-matrx/design-system";
3802
3881
  import { OutboundLink as OutboundLink4 } from "@ai-matrx/kit/outbound-react";
3803
- import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
3882
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
3804
3883
  function attachmentIdsOf(value) {
3805
3884
  return idsOf(value);
3806
3885
  }
@@ -3860,7 +3939,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
3860
3939
  const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
3861
3940
  const title = onPreview ? `Preview ${words}` : href ? `Open ${words}` : read?.why ?? FILE_CHIP_NO_PAGE;
3862
3941
  if (read?.fileId && read.mime?.startsWith("image/") && host.fileImage) {
3863
- return /* @__PURE__ */ jsxs18("span", { className: "relative inline-flex shrink-0", "data-records-file-thumb": id, children: [
3942
+ return /* @__PURE__ */ jsxs17("span", { className: "relative inline-flex shrink-0", "data-records-file-thumb": id, children: [
3864
3943
  /* @__PURE__ */ jsx21(
3865
3944
  "button",
3866
3945
  {
@@ -3896,7 +3975,7 @@ function AttachmentChip({ id, onRemove, onPreview }) {
3896
3975
  ) : null
3897
3976
  ] });
3898
3977
  }
3899
- return /* @__PURE__ */ jsxs18(
3978
+ return /* @__PURE__ */ jsxs17(
3900
3979
  Badge3,
3901
3980
  {
3902
3981
  variant: "secondary",
@@ -3960,7 +4039,7 @@ function AttachmentChips({ value, onRemove }) {
3960
4039
  const [viewing, setViewing] = useState16(null);
3961
4040
  if (ids.length === 0) return null;
3962
4041
  const canPreview = Boolean(host.fileImage);
3963
- return /* @__PURE__ */ jsxs18("span", { className: "flex flex-wrap gap-1", "data-records-file-chips": "", children: [
4042
+ return /* @__PURE__ */ jsxs17("span", { className: "flex flex-wrap gap-1", "data-records-file-chips": "", children: [
3964
4043
  ids.map((id, index) => /* @__PURE__ */ jsx21(
3965
4044
  AttachmentChip,
3966
4045
  {
@@ -3988,7 +4067,7 @@ function AttachmentViewer({
3988
4067
  const name = read?.name ?? (read ? FILE_CHIP_UNREAD : "\u2026");
3989
4068
  const href = read?.fileId ? host.hrefForFile?.({ fileId: read.fileId }) : void 0;
3990
4069
  const go = (way) => onIndex(stepAttachment(index, ids.length, way));
3991
- return /* @__PURE__ */ jsx21(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs18(
4070
+ return /* @__PURE__ */ jsx21(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs17(
3992
4071
  DialogContent,
3993
4072
  {
3994
4073
  className: "sm:max-w-3xl",
@@ -4018,10 +4097,10 @@ function AttachmentViewer({
4018
4097
  children: [
4019
4098
  /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "truncate text-sm", children: name }) }),
4020
4099
  /* @__PURE__ */ jsx21("div", { className: "relative h-[60vh] w-full overflow-hidden rounded-md bg-muted", "data-records-attachment-stage": "", children: read?.fileId ? host.fileImage?.({ fileId: read.fileId, alt: name }) : null }),
4021
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4100
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4022
4101
  /* @__PURE__ */ jsx21(Button8, { size: "sm", variant: "outline", "aria-label": "Previous file", disabled: index === 0, onClick: () => go(-1), "data-records-attachment-previous": "", children: "\u2190" }),
4023
4102
  /* @__PURE__ */ jsx21(Button8, { size: "sm", variant: "outline", "aria-label": "Next file", disabled: index >= ids.length - 1, onClick: () => go(1), "data-records-attachment-next": "", children: "\u2192" }),
4024
- /* @__PURE__ */ jsxs18("span", { className: "text-xs tabular-nums text-muted-foreground", "data-records-attachment-position": "", children: [
4103
+ /* @__PURE__ */ jsxs17("span", { className: "text-xs tabular-nums text-muted-foreground", "data-records-attachment-position": "", children: [
4025
4104
  index + 1,
4026
4105
  " of ",
4027
4106
  ids.length
@@ -4047,7 +4126,7 @@ function AttachmentControl({
4047
4126
  const host = useRecordsUi();
4048
4127
  const [busy, setBusy] = useState16(false);
4049
4128
  const [why, setWhy] = useState16(null);
4050
- const latest = useRef11(value);
4129
+ const latest = useRef10(value);
4051
4130
  latest.current = value;
4052
4131
  const multiple = Boolean(field2.multi);
4053
4132
  const pick = async () => {
@@ -4068,7 +4147,7 @@ function AttachmentControl({
4068
4147
  setBusy(false);
4069
4148
  onClose?.();
4070
4149
  };
4071
- const opened = useRef11(false);
4150
+ const opened = useRef10(false);
4072
4151
  useEffect11(() => {
4073
4152
  if (!autoOpen || opened.current || !host.pickFiles) return;
4074
4153
  opened.current = true;
@@ -4077,7 +4156,7 @@ function AttachmentControl({
4077
4156
  if (!hostTakesFiles(host)) {
4078
4157
  return /* @__PURE__ */ jsx21("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 });
4079
4158
  }
4080
- return /* @__PURE__ */ jsxs18("span", { id, className: "flex flex-col gap-1", "data-records-attachment-editor": "", children: [
4159
+ return /* @__PURE__ */ jsxs17("span", { id, className: "flex flex-col gap-1", "data-records-attachment-editor": "", children: [
4081
4160
  /* @__PURE__ */ jsx21(
4082
4161
  AttachmentChips,
4083
4162
  {
@@ -4085,7 +4164,7 @@ function AttachmentControl({
4085
4164
  ...disabled ? {} : { onRemove: (removed) => onChange(withoutAttached(field2, latest.current, removed)) }
4086
4165
  }
4087
4166
  ),
4088
- /* @__PURE__ */ jsxs18("span", { className: "flex flex-wrap items-center gap-1", children: [
4167
+ /* @__PURE__ */ jsxs17("span", { className: "flex flex-wrap items-center gap-1", children: [
4089
4168
  host.pickFiles ? /* @__PURE__ */ jsx21(Button8, { 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,
4090
4169
  host.upload ? /* @__PURE__ */ jsx21(
4091
4170
  FilePicker,
@@ -4114,7 +4193,7 @@ function AttachmentControl({
4114
4193
  // src/ReferenceChips.tsx
4115
4194
  import { entityRefsOf as entityRefsOf2 } from "@ai-matrx/records";
4116
4195
  import { Badge as Badge4, Skeleton as Skeleton2, cn as cn12 } from "@ai-matrx/design-system";
4117
- import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
4196
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
4118
4197
  function glyphOf(icon) {
4119
4198
  const text = (icon ?? "").trim();
4120
4199
  return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
@@ -4147,7 +4226,7 @@ function referenceChipsOf(field2, value, kind, labels) {
4147
4226
  var ARCHIVED_REFERENCE_WORD = "Archived";
4148
4227
  var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
4149
4228
  function PageGlyph() {
4150
- return /* @__PURE__ */ jsxs19("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: [
4229
+ return /* @__PURE__ */ jsxs18("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: [
4151
4230
  /* @__PURE__ */ jsx22("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4152
4231
  /* @__PURE__ */ jsx22("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4153
4232
  /* @__PURE__ */ jsx22("path", { d: "M10 13H8" }),
@@ -4162,7 +4241,7 @@ function ReferenceChip({ reference, waiting }) {
4162
4241
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4163
4242
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4164
4243
  if (look?.plainRelation) {
4165
- return /* @__PURE__ */ jsxs19(
4244
+ return /* @__PURE__ */ jsxs18(
4166
4245
  "span",
4167
4246
  {
4168
4247
  className: cn12(
@@ -4181,7 +4260,7 @@ function ReferenceChip({ reference, waiting }) {
4181
4260
  }
4182
4261
  );
4183
4262
  }
4184
- return /* @__PURE__ */ jsxs19(
4263
+ return /* @__PURE__ */ jsxs18(
4185
4264
  Badge4,
4186
4265
  {
4187
4266
  variant: "secondary",
@@ -4217,9 +4296,9 @@ function KindValueCell({
4217
4296
  }
4218
4297
 
4219
4298
  // src/ClampedChips.tsx
4220
- import { useCallback as useCallback5, useLayoutEffect, useRef as useRef12, useState as useState17 } from "react";
4299
+ import { useCallback as useCallback5, useLayoutEffect, useRef as useRef11, useState as useState17 } from "react";
4221
4300
  import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2, cn as cn13 } from "@ai-matrx/design-system";
4222
- import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
4301
+ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
4223
4302
  var GAP = 4;
4224
4303
  var OVERFLOW_ROOM = 34;
4225
4304
  function ClampedChips({
@@ -4229,7 +4308,7 @@ function ClampedChips({
4229
4308
  className,
4230
4309
  dataAttr
4231
4310
  }) {
4232
- const box = useRef12(null);
4311
+ const box = useRef11(null);
4233
4312
  const [fit, setFit] = useState17(null);
4234
4313
  const [measuring, setMeasuring] = useState17(true);
4235
4314
  const count = items.length;
@@ -4285,7 +4364,7 @@ function ClampedChips({
4285
4364
  }, []);
4286
4365
  const shown2 = measuring || fit === null ? items : items.slice(0, fit);
4287
4366
  const hidden = stands - shown2.length;
4288
- return /* @__PURE__ */ jsxs20(
4367
+ return /* @__PURE__ */ jsxs19(
4289
4368
  "span",
4290
4369
  {
4291
4370
  ref: box,
@@ -4293,8 +4372,8 @@ function ClampedChips({
4293
4372
  "data-records-clamped": dataAttr ?? "",
4294
4373
  children: [
4295
4374
  shown2.map((item) => /* @__PURE__ */ jsx23("span", { "data-clamp-item": "", className: "inline-flex min-w-0 shrink-0 max-w-full", children: item.node }, item.key)),
4296
- !measuring && hidden > 0 ? /* @__PURE__ */ jsxs20(Popover2, { children: [
4297
- /* @__PURE__ */ jsx23(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs20(
4375
+ !measuring && hidden > 0 ? /* @__PURE__ */ jsxs19(Popover2, { children: [
4376
+ /* @__PURE__ */ jsx23(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs19(
4298
4377
  "button",
4299
4378
  {
4300
4379
  type: "button",
@@ -4516,7 +4595,7 @@ import { Button as Button9 } from "@ai-matrx/design-system";
4516
4595
  import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
4517
4596
 
4518
4597
  // src/memberNames.ts
4519
- import { useEffect as useEffect12, useMemo as useMemo8, useState as useState18 } from "react";
4598
+ import { useEffect as useEffect12, useMemo as useMemo9, useState as useState18 } from "react";
4520
4599
  import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
4521
4600
  import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
4522
4601
  function memberWords(member) {
@@ -4562,7 +4641,7 @@ async function resolveKeptPerson(client, id, roster) {
4562
4641
  }
4563
4642
  function useKeptPeople(value, roster) {
4564
4643
  const client = useOptionalRecordsClient7();
4565
- const ids = useMemo8(() => (Array.isArray(value) ? value : [value]).filter(isUuidShape2), [value]);
4644
+ const ids = useMemo9(() => (Array.isArray(value) ? value : [value]).filter(isUuidShape2), [value]);
4566
4645
  const key = ids.join(",");
4567
4646
  const [people, setPeople] = useState18(null);
4568
4647
  useEffect12(() => {
@@ -4577,7 +4656,7 @@ function useKeptPeople(value, roster) {
4577
4656
  }
4578
4657
 
4579
4658
  // src/RetiredValues.tsx
4580
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
4659
+ import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
4581
4660
  function same(a, b) {
4582
4661
  return JSON.stringify(a) === JSON.stringify(b);
4583
4662
  }
@@ -4649,7 +4728,7 @@ function RetiredValues({
4649
4728
  setSaid(`Put back as version ${done.data.version}.`);
4650
4729
  onRestored?.();
4651
4730
  };
4652
- return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", "data-records-retired": "", children: [
4731
+ return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1", "data-records-retired": "", children: [
4653
4732
  /* @__PURE__ */ jsx24("span", { className: "font-medium", children: "Kept aside" }),
4654
4733
  kept.map((entry, index) => {
4655
4734
  const id = `${entry.key}-${index}`;
@@ -4657,15 +4736,15 @@ function RetiredValues({
4657
4736
  const name = field2 ? fieldName(field2) : entry.label ?? entry.key;
4658
4737
  const shown2 = field2 ? scalarText(field2, entry.value) : typeof entry.value === "string" ? entry.value : JSON.stringify(entry.value);
4659
4738
  const holdsUserId = (Array.isArray(entry.value) ? entry.value : [entry.value]).some(isUuidShape3);
4660
- return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-0.5", "data-records-retired-key": entry.key, children: [
4661
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap items-baseline gap-2", children: [
4739
+ return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-0.5", "data-records-retired-key": entry.key, children: [
4740
+ /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-baseline gap-2", children: [
4662
4741
  /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: name }),
4663
4742
  holdsUserId ? /* @__PURE__ */ jsx24(KeptPeople, { value: entry.value, roster }) : /* @__PURE__ */ jsx24("span", { className: "min-w-0 break-words", children: shown2 }),
4664
4743
  mayWrite ? /* @__PURE__ */ jsx24(Button9, { size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy !== null, onClick: () => void restore(entry, index), "data-records-retired-restore": "", children: busy === id ? "Restoring\u2026" : "Restore" }) : null
4665
4744
  ] }),
4666
4745
  entry.reason ? /* @__PURE__ */ jsx24("p", { className: "text-[11px] text-muted-foreground", children: withoutInternalCodes(entry.reason) }) : null,
4667
4746
  refusal?.key === id ? /* @__PURE__ */ jsx24(RefusalNotice, { error: refusal.error }) : null,
4668
- missing === id ? /* @__PURE__ */ jsxs21("p", { className: "text-[11px] text-muted-foreground", children: [
4747
+ missing === id ? /* @__PURE__ */ jsxs20("p", { className: "text-[11px] text-muted-foreground", children: [
4669
4748
  "No earlier version of ",
4670
4749
  name,
4671
4750
  " holds this value, so it cannot be put back from here."
@@ -4787,8 +4866,8 @@ import { AlchemyMenu } from "@ai-matrx/alchemy/react";
4787
4866
  import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4788
4867
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4789
4868
  import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
4790
- import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
4791
- var SaveToTable = lazy(() => import("./SaveToTable-HQREESNE.js").then((m) => ({ default: m.SaveToTable })));
4869
+ import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
4870
+ var SaveToTable = lazy(() => import("./SaveToTable-DQXFHYHS.js").then((m) => ({ default: m.SaveToTable })));
4792
4871
  var LONGEST_READ = 5e5;
4793
4872
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4794
4873
  function isPlainObject(v) {
@@ -4913,7 +4992,7 @@ function Thumb({ src, size }) {
4913
4992
  ) });
4914
4993
  }
4915
4994
  function LinkChip({ href, dense }) {
4916
- return /* @__PURE__ */ jsxs22(
4995
+ return /* @__PURE__ */ jsxs21(
4917
4996
  OutboundLink5,
4918
4997
  {
4919
4998
  href,
@@ -4957,8 +5036,8 @@ function RecordsTable({ items }) {
4957
5036
  const keys = keysOf(items).filter((k) => k !== "__kind");
4958
5037
  const pictureFirst = [...keys].sort((a, b) => rank(a, items) - rank(b, items)).slice(0, TABLE_COLUMNS);
4959
5038
  const shown2 = all ? items : items.slice(0, TABLE_ROWS);
4960
- return /* @__PURE__ */ jsxs22("div", { className: "min-w-0", "data-records-structured": "table", children: [
4961
- /* @__PURE__ */ jsx26("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ jsxs22("table", { className: "w-full border-collapse text-xs", children: [
5039
+ return /* @__PURE__ */ jsxs21("div", { className: "min-w-0", "data-records-structured": "table", children: [
5040
+ /* @__PURE__ */ jsx26("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ jsxs21("table", { className: "w-full border-collapse text-xs", children: [
4962
5041
  /* @__PURE__ */ jsx26("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ jsx26("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ jsx26("th", { scope: "col", className: "px-2 py-1 font-medium text-muted-foreground [overflow-wrap:anywhere]", children: structuredKeyWords(k) }, k)) }) }),
4963
5042
  /* @__PURE__ */ jsx26("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx26("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx26("td", { className: "min-w-[2rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ jsx26(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
4964
5043
  ] }) }),
@@ -5030,8 +5109,8 @@ function StructuredValueView({ structured, label, className }) {
5030
5109
  const ui = useRecordsUi();
5031
5110
  const savable = shapeOfValue(structured.data) !== null;
5032
5111
  const text = rawTextOf(structured);
5033
- return /* @__PURE__ */ jsxs22("div", { className: cn14("flex min-w-0 flex-col gap-1.5 whitespace-normal", className), "data-records-structured-view": "", children: [
5034
- /* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 items-center gap-1", onClick: stop, children: [
5112
+ return /* @__PURE__ */ jsxs21("div", { className: cn14("flex min-w-0 flex-col gap-1.5 whitespace-normal", className), "data-records-structured-view": "", children: [
5113
+ /* @__PURE__ */ jsxs21("div", { className: "flex min-w-0 items-center gap-1", onClick: stop, children: [
5035
5114
  /* @__PURE__ */ jsx26("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children: recordsCount(structured.data) }),
5036
5115
  savable ? /* @__PURE__ */ jsx26(Button10, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", onClick: () => setSaving(true), "data-records-structured-save": "", children: "Save as table" }) : null,
5037
5116
  /* @__PURE__ */ jsx26(
@@ -5052,8 +5131,8 @@ function StructuredValueView({ structured, label, className }) {
5052
5131
  raw ? /* @__PURE__ */ jsx26("pre", { className: "max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/60 p-2 font-mono text-xs", "data-records-structured-raw": "", children: structured.raw !== null ? prettyJsonText(structured.raw) : text }) : /* @__PURE__ */ jsx26(Shape, { data: structured.data }),
5053
5132
  saving ? /* @__PURE__ */ jsx26(Dialog2, { open: true, onOpenChange: (open) => {
5054
5133
  if (!open) setSaving(false);
5055
- }, children: /* @__PURE__ */ jsxs22(DialogContent2, { className: "max-h-[90vh] max-w-3xl overflow-y-auto", children: [
5056
- /* @__PURE__ */ jsx26(DialogHeader2, { children: /* @__PURE__ */ jsxs22(DialogTitle2, { children: [
5134
+ }, children: /* @__PURE__ */ jsxs21(DialogContent2, { className: "max-h-[90vh] max-w-3xl overflow-y-auto", children: [
5135
+ /* @__PURE__ */ jsx26(DialogHeader2, { children: /* @__PURE__ */ jsxs21(DialogTitle2, { children: [
5057
5136
  "Save ",
5058
5137
  label,
5059
5138
  " as a table"
@@ -5080,8 +5159,8 @@ function StructuredCell({ structured, label }) {
5080
5159
  const summary = structuredSummary(structured.data);
5081
5160
  const first = Array.isArray(structured.data) ? structured.data.find(isPlainObject) : structured.data;
5082
5161
  const picture = isPlainObject(first) ? Object.entries(first).find(([k, v]) => isImageUrl(v, k))?.[1] : void 0;
5083
- return /* @__PURE__ */ jsxs22(Popover3, { children: [
5084
- /* @__PURE__ */ jsx26(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs22(
5162
+ return /* @__PURE__ */ jsxs21(Popover3, { children: [
5163
+ /* @__PURE__ */ jsx26(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsxs21(
5085
5164
  "button",
5086
5165
  {
5087
5166
  type: "button",
@@ -5110,7 +5189,7 @@ function StructuredCell({ structured, label }) {
5110
5189
  }
5111
5190
 
5112
5191
  // src/values.tsx
5113
- import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
5192
+ import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
5114
5193
  function statusMark(field2, item, document2) {
5115
5194
  const mark = statusMarkOf(field2, item, document2);
5116
5195
  return mark ? /* @__PURE__ */ jsx27("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
@@ -5222,7 +5301,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
5222
5301
  const items = Array.isArray(value) ? value : [value];
5223
5302
  return /* @__PURE__ */ jsx27("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
5224
5303
  const chip = chipOf(item);
5225
- return /* @__PURE__ */ jsxs23(
5304
+ return /* @__PURE__ */ jsxs22(
5226
5305
  Badge6,
5227
5306
  {
5228
5307
  variant: "outline",
@@ -5247,7 +5326,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
5247
5326
  if (pictureAt) return /* @__PURE__ */ jsx27(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
5248
5327
  if (kind === "url" && typeof value === "string") {
5249
5328
  const href = value.includes("://") ? value : `https://${value}`;
5250
- return /* @__PURE__ */ jsx27(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs23(
5329
+ return /* @__PURE__ */ jsx27(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs22(
5251
5330
  OutboundLink6,
5252
5331
  {
5253
5332
  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",
@@ -5471,7 +5550,7 @@ function cardWords(record, field2, labels) {
5471
5550
  }
5472
5551
 
5473
5552
  // src/SourceArchivedNotice.tsx
5474
- import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
5553
+ import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
5475
5554
  function bringBackLabel(state) {
5476
5555
  return state.label ? `Bring back ${state.label}` : "Bring it back";
5477
5556
  }
@@ -5504,14 +5583,14 @@ function SourceArchivedNotice({ fieldId, tableId }) {
5504
5583
  tableShapeChanged(tableId);
5505
5584
  await read();
5506
5585
  };
5507
- return /* @__PURE__ */ jsxs24(
5586
+ return /* @__PURE__ */ jsxs23(
5508
5587
  "div",
5509
5588
  {
5510
5589
  className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
5511
5590
  "data-testid": "source-archived-notice",
5512
5591
  "data-field-id": state.field_id ?? "",
5513
5592
  children: [
5514
- /* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 flex-1 flex-col", children: [
5593
+ /* @__PURE__ */ jsxs23("div", { className: "flex min-w-0 flex-1 flex-col", children: [
5515
5594
  /* @__PURE__ */ jsx28("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
5516
5595
  /* @__PURE__ */ jsx28("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state) })
5517
5596
  ] }),
@@ -5527,7 +5606,7 @@ import { createContext as createContext3, useContext as useContext2, useEffect a
5527
5606
  import { BasicInput as BasicInput6, Button as Button12 } from "@ai-matrx/design-system";
5528
5607
  import { optionKey as optionKey2, optionLabel, rankTypedMatches as rankTypedMatches3 } from "@ai-matrx/records";
5529
5608
  import { useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
5530
- import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
5609
+ import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
5531
5610
  var CONDITION_OPS = [
5532
5611
  { op: "eq", label: "is" },
5533
5612
  { op: "ne", label: "is not" },
@@ -5664,7 +5743,7 @@ function ChoiceValues({ field: field2, value, onChange }) {
5664
5743
  }
5665
5744
  );
5666
5745
  }
5667
- return /* @__PURE__ */ jsxs25("span", { className: "inline-flex flex-wrap items-center gap-1", "data-records-condition-choices": "", "data-pick-values": value.join("|"), children: [
5746
+ return /* @__PURE__ */ jsxs24("span", { className: "inline-flex flex-wrap items-center gap-1", "data-records-condition-choices": "", "data-pick-values": value.join("|"), children: [
5668
5747
  choices.map((c) => /* @__PURE__ */ jsx29(
5669
5748
  Button12,
5670
5749
  {
@@ -5886,7 +5965,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
5886
5965
  VALUELESS_OPS.has(chosenOp) ? { op: chosenOp, args: [{ field: chosenField }] } : { op: chosenOp, args: [{ field: chosenField }, { const: chosenValue }] }
5887
5966
  );
5888
5967
  }
5889
- return /* @__PURE__ */ jsxs25("div", { className: className ?? "flex flex-wrap items-center gap-1 text-xs", children: [
5968
+ return /* @__PURE__ */ jsxs24("div", { className: className ?? "flex flex-wrap items-center gap-1 text-xs", children: [
5890
5969
  /* @__PURE__ */ jsx29("span", { className: "text-muted-foreground", children: lead }),
5891
5970
  /* @__PURE__ */ jsx29(
5892
5971
  PickOne,
@@ -5899,7 +5978,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
5899
5978
  attrs: { "data-condition": "field" }
5900
5979
  }
5901
5980
  ),
5902
- onField && !fields.some((f) => f.id === onField) && withheldFields.some((f) => f.id === onField) ? /* @__PURE__ */ jsxs25(
5981
+ onField && !fields.some((f) => f.id === onField) && withheldFields.some((f) => f.id === onField) ? /* @__PURE__ */ jsxs24(
5903
5982
  "span",
5904
5983
  {
5905
5984
  className: "rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",
@@ -5919,7 +5998,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
5919
5998
  children: "Missing question"
5920
5999
  }
5921
6000
  ) : null,
5922
- onField ? /* @__PURE__ */ jsxs25(Fragment11, { children: [
6001
+ onField ? /* @__PURE__ */ jsxs24(Fragment11, { children: [
5923
6002
  /* @__PURE__ */ jsx29(
5924
6003
  PickOne,
5925
6004
  {
@@ -6047,14 +6126,14 @@ function ConditionGroup({
6047
6126
  const joinWord = (index) => index === 0 ? lead : joiner === "or" || joiner === "none" ? "or" : "and";
6048
6127
  const showJoiner = nested || args.length > 1 || joiner === "none" || joiner === "notall";
6049
6128
  const opposite = joiner === "or" || joiner === "none" ? "and" : "or";
6050
- return /* @__PURE__ */ jsxs25(
6129
+ return /* @__PURE__ */ jsxs24(
6051
6130
  "div",
6052
6131
  {
6053
6132
  className: className ?? "flex flex-col gap-1 text-xs",
6054
6133
  "data-testid": nested ? "condition-nested-group" : "condition-group",
6055
6134
  "data-depth": depth,
6056
6135
  children: [
6057
- showJoiner ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
6136
+ showJoiner ? /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
6058
6137
  /* @__PURE__ */ jsx29("span", { className: "text-muted-foreground", children: nested ? "Group:" : lead }),
6059
6138
  /* @__PURE__ */ jsx29(
6060
6139
  PickOne,
@@ -6133,7 +6212,7 @@ function ConditionGroup({
6133
6212
  }
6134
6213
  }
6135
6214
  ) }) : null,
6136
- args.length > 0 && !drafting ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
6215
+ args.length > 0 && !drafting ? /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
6137
6216
  /* @__PURE__ */ jsx29(
6138
6217
  Button12,
6139
6218
  {
@@ -6275,7 +6354,7 @@ async function forgetWrittenWords(client, tableId, key, written) {
6275
6354
 
6276
6355
  // src/FieldRetype.tsx
6277
6356
  import { formatCount } from "@ai-matrx/kit/format";
6278
- import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
6357
+ import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
6279
6358
  var RETYPE_PREVIEW_DEBOUNCE_MS = 300;
6280
6359
  function scheduleRetypePreview(ask, ms = RETYPE_PREVIEW_DEBOUNCE_MS) {
6281
6360
  const timer = setTimeout(ask, ms);
@@ -6482,27 +6561,27 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
6482
6561
  tableShapeChanged2(tableId);
6483
6562
  onRetyped?.();
6484
6563
  };
6485
- return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
6486
- /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-2", children: [
6487
- /* @__PURE__ */ jsxs26(Select3, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
6564
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
6565
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
6566
+ /* @__PURE__ */ jsxs25(Select3, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
6488
6567
  /* @__PURE__ */ jsx30(SelectTrigger3, { size: "sm", "aria-label": "Change what this column holds", className: "w-auto min-w-[12rem]", children: /* @__PURE__ */ jsx30(SelectValue3, { placeholder: "Change what this column holds" }) }),
6489
6568
  /* @__PURE__ */ jsx30(SelectContent3, { children: targets.map((t) => /* @__PURE__ */ jsx30(SelectItem3, { value: t.id, children: t.label }, t.id)) })
6490
6569
  ] }),
6491
6570
  to ? /* @__PURE__ */ jsx30(Button13, { size: "sm", disabled: busy || asking || preview === null, onClick: () => void change(), "data-records-retype-go": "", children: busy ? "Changing\u2026" : `Change to ${to.label}` }) : null,
6492
6571
  to ? /* @__PURE__ */ jsx30(Button13, { size: "sm", variant: "ghost", onClick: () => setTo(null), disabled: busy, children: "Cancel" }) : null
6493
6572
  ] }),
6494
- to && asking ? /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-muted-foreground", children: [
6573
+ to && asking ? /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-muted-foreground", children: [
6495
6574
  "Counting ",
6496
6575
  name,
6497
6576
  "'s values\u2026"
6498
6577
  ] }) : null,
6499
- to && preview && limitedHeld !== null ? /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", "data-records-retype-limited": "", children: [
6578
+ to && preview && limitedHeld !== null ? /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", "data-records-retype-limited": "", children: [
6500
6579
  "About ",
6501
6580
  formatCount(limitedHeld),
6502
6581
  " values to change to ",
6503
6582
  to.label.toLowerCase(),
6504
6583
  "; any that do not fit are kept aside with their records, with the reason \u2014 nothing is deleted."
6505
- ] }) : to && preview ? /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", children: [
6584
+ ] }) : to && preview ? /* @__PURE__ */ jsxs25("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", children: [
6506
6585
  preview.converts,
6507
6586
  " ",
6508
6587
  preview.converts === 1 ? "value converts" : "values convert",
@@ -6517,10 +6596,10 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
6517
6596
  }
6518
6597
 
6519
6598
  // src/FieldRulePreview.tsx
6520
- import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef13, useState as useState24 } from "react";
6599
+ import { useEffect as useEffect16, useMemo as useMemo10, useRef as useRef12, useState as useState24 } from "react";
6521
6600
  import { previewRuleChange } from "@ai-matrx/records";
6522
6601
  import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
6523
- import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
6602
+ import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
6524
6603
  var PREVIEW_GROUPS = 1e3;
6525
6604
  function ruleWords(rules) {
6526
6605
  return rules.map((r) => JSON.stringify([r.kind, r.value === void 0 || r.value === "" ? null : String(r.value), r.min ?? null, r.example ?? null])).sort().join("|");
@@ -6540,8 +6619,8 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
6540
6619
  const client = useRecordsClient7();
6541
6620
  const [preview, setPreview] = useState24(null);
6542
6621
  const [refusal, setRefusal] = useState24(null);
6543
- const key = useMemo9(() => ruleWords(rules), [rules]);
6544
- const latest = useRef13(rules);
6622
+ const key = useMemo10(() => ruleWords(rules), [rules]);
6623
+ const latest = useRef12(rules);
6545
6624
  latest.current = rules;
6546
6625
  const name = fieldName(field2);
6547
6626
  useEffect16(() => {
@@ -6577,14 +6656,14 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
6577
6656
  }, [client, tableId, field2.key, key]);
6578
6657
  if (refusal) return /* @__PURE__ */ jsx31(RefusalNotice, { error: refusal });
6579
6658
  if (!preview) {
6580
- return /* @__PURE__ */ jsxs27("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "counting", children: [
6659
+ return /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "counting", children: [
6581
6660
  "Counting ",
6582
6661
  name,
6583
6662
  "'s values\u2026"
6584
6663
  ] });
6585
6664
  }
6586
6665
  if (preview.keptAside === 0) {
6587
- return /* @__PURE__ */ jsxs27("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "fits", children: [
6666
+ return /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-muted-foreground", "data-records-rule-preview": "fits", children: [
6588
6667
  "Every value already in ",
6589
6668
  name,
6590
6669
  " still fits",
@@ -6592,7 +6671,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
6592
6671
  "."
6593
6672
  ] });
6594
6673
  }
6595
- return /* @__PURE__ */ jsxs27("p", { className: "text-[11px] text-amber-700 dark:text-amber-400", role: "status", "data-records-rule-preview": "sets-aside", children: [
6674
+ return /* @__PURE__ */ jsxs26("p", { className: "text-[11px] text-amber-700 dark:text-amber-400", role: "status", "data-records-rule-preview": "sets-aside", children: [
6596
6675
  preview.keptAside,
6597
6676
  " ",
6598
6677
  preview.keptAside === 1 ? "value no longer fits and will be" : "values no longer fit and will be",
@@ -6682,7 +6761,7 @@ import {
6682
6761
  statusGroupOf as statusGroupOf2
6683
6762
  } from "@ai-matrx/records";
6684
6763
  import { Label as Label5, Select as Select4, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4 } from "@ai-matrx/design-system";
6685
- import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
6764
+ import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
6686
6765
  var STATUS_STARTING_CHOICES = [
6687
6766
  { words: "Not started", group: "todo" },
6688
6767
  { words: "In progress", group: "in_progress" },
@@ -6711,13 +6790,13 @@ function StatusGroupsQuestion({
6711
6790
  onGroup
6712
6791
  }) {
6713
6792
  if (rows.length === 0) return null;
6714
- return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", "data-records-status-groups": "", children: [
6793
+ return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", "data-records-status-groups": "", children: [
6715
6794
  /* @__PURE__ */ jsx32(Label5, { className: "text-xs", children: "Groups" }),
6716
- rows.map((r) => /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
6795
+ rows.map((r) => /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
6717
6796
  /* @__PURE__ */ jsx32("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
6718
- /* @__PURE__ */ jsxs28(Select4, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
6797
+ /* @__PURE__ */ jsxs27(Select4, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
6719
6798
  /* @__PURE__ */ jsx32(SelectTrigger4, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ jsx32(SelectValue4, {}) }),
6720
- /* @__PURE__ */ jsx32(SelectContent4, { children: STATUS_GROUPS.map((g) => /* @__PURE__ */ jsxs28(SelectItem4, { value: g, children: [
6799
+ /* @__PURE__ */ jsx32(SelectContent4, { children: STATUS_GROUPS.map((g) => /* @__PURE__ */ jsxs27(SelectItem4, { value: g, children: [
6721
6800
  STATUS_GROUP_MARK[g],
6722
6801
  " ",
6723
6802
  STATUS_GROUP_WORDS2[g]
@@ -6727,11 +6806,11 @@ function StatusGroupsQuestion({
6727
6806
  ] });
6728
6807
  }
6729
6808
  function RatingMaxQuestion({ value, onChange }) {
6730
- return /* @__PURE__ */ jsxs28("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
6809
+ return /* @__PURE__ */ jsxs27("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
6731
6810
  /* @__PURE__ */ jsx32(Label5, { className: "text-xs", children: "Out of" }),
6732
- /* @__PURE__ */ jsxs28(Select4, { value: String(value), onValueChange: (next) => onChange(Number(next)), children: [
6811
+ /* @__PURE__ */ jsxs27(Select4, { value: String(value), onValueChange: (next) => onChange(Number(next)), children: [
6733
6812
  /* @__PURE__ */ jsx32(SelectTrigger4, { size: "sm", "aria-label": "Out of", children: /* @__PURE__ */ jsx32(SelectValue4, {}) }),
6734
- /* @__PURE__ */ jsx32(SelectContent4, { children: Array.from({ length: 10 }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsxs28(SelectItem4, { value: String(n), children: [
6813
+ /* @__PURE__ */ jsx32(SelectContent4, { children: Array.from({ length: 10 }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsxs27(SelectItem4, { value: String(n), children: [
6735
6814
  n,
6736
6815
  " ",
6737
6816
  n === 1 ? "star" : "stars"
@@ -6752,11 +6831,11 @@ var SYMBOLOGY_WORDS = {
6752
6831
  pdf417: "PDF417"
6753
6832
  };
6754
6833
  function BarcodeSymbologyQuestion({ value, onChange }) {
6755
- return /* @__PURE__ */ jsxs28("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
6834
+ return /* @__PURE__ */ jsxs27("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
6756
6835
  /* @__PURE__ */ jsx32(Label5, { className: "text-xs", children: "Code type" }),
6757
- /* @__PURE__ */ jsxs28(Select4, { value: value === "" ? "any" : value, onValueChange: (next) => onChange(next === "any" ? "" : next), children: [
6836
+ /* @__PURE__ */ jsxs27(Select4, { value: value === "" ? "any" : value, onValueChange: (next) => onChange(next === "any" ? "" : next), children: [
6758
6837
  /* @__PURE__ */ jsx32(SelectTrigger4, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ jsx32(SelectValue4, {}) }),
6759
- /* @__PURE__ */ jsxs28(SelectContent4, { children: [
6838
+ /* @__PURE__ */ jsxs27(SelectContent4, { children: [
6760
6839
  /* @__PURE__ */ jsx32(SelectItem4, { value: "any", children: "Any code" }),
6761
6840
  BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ jsx32(SelectItem4, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
6762
6841
  ] })
@@ -6771,7 +6850,7 @@ import {
6771
6850
  getFieldFormat as getFieldFormat2,
6772
6851
  groupedFormatsForBase
6773
6852
  } from "@ai-matrx/design-system/field-formats";
6774
- import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
6853
+ import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
6775
6854
  var KIND_WORD = {
6776
6855
  choice: "select",
6777
6856
  multi_choice: "multi_select",
@@ -6894,11 +6973,11 @@ function FieldFormatPicker({
6894
6973
  else merged[key] = next;
6895
6974
  onValue({ ...value, format: Object.keys(merged).length > 0 ? { id: value.format.id, options: merged } : { id: value.format.id } });
6896
6975
  };
6897
- const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ jsxs29("label", { className: "flex min-w-[6rem] flex-col gap-0.5 text-[11px] text-muted-foreground", children: [
6976
+ const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ jsxs28("label", { className: "flex min-w-[6rem] flex-col gap-0.5 text-[11px] text-muted-foreground", children: [
6898
6977
  label,
6899
6978
  control
6900
6979
  ] }, key) : null;
6901
- return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1", "data-records-format-picker": "", children: [
6980
+ return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", "data-records-format-picker": "", children: [
6902
6981
  /* @__PURE__ */ jsx33(Label6, { className: "text-xs", htmlFor: `records-shows-as-${field2.id}`, children: "Shows as" }),
6903
6982
  /* @__PURE__ */ jsx33(
6904
6983
  PickOne,
@@ -6927,7 +7006,7 @@ function FieldFormatPicker({
6927
7006
  }
6928
7007
  ),
6929
7008
  /* @__PURE__ */ jsx33("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column holds, to ${storesWord(retypedTo.def)}. Each value that can convert does; you are told before anything that cannot is lost.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
6930
- optionKeys.length > 0 ? /* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-end gap-2", children: [
7009
+ optionKeys.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-end gap-2", children: [
6931
7010
  option(
6932
7011
  "currency",
6933
7012
  "Currency",
@@ -7043,7 +7122,7 @@ function FieldFormatPicker({
7043
7122
  "Suffix",
7044
7123
  /* @__PURE__ */ jsx33("input", { "data-records-format-option": "suffix", className: BOX, placeholder: "e.g. kg", value: options.suffix ?? "", onChange: (e) => setOption("suffix", e.target.value) })
7045
7124
  ),
7046
- optionKeys.includes("useGrouping") ? /* @__PURE__ */ jsxs29("label", { className: "flex items-center gap-1.5 pb-1 text-[11px] text-muted-foreground", children: [
7125
+ optionKeys.includes("useGrouping") ? /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-1.5 pb-1 text-[11px] text-muted-foreground", children: [
7047
7126
  /* @__PURE__ */ jsx33(
7048
7127
  "input",
7049
7128
  {
@@ -7059,6 +7138,40 @@ function FieldFormatPicker({
7059
7138
  ] });
7060
7139
  }
7061
7140
 
7141
+ // src/AlsoPointsAt.tsx
7142
+ import { Checkbox as Checkbox4, Label as Label7 } from "@ai-matrx/design-system";
7143
+ import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
7144
+ function AlsoPointsAt({ own: own3, value, onChange }) {
7145
+ const tables = usePickerTables();
7146
+ const entries = tablePickerEntries(
7147
+ tables.data.map((t) => ({ ...t, name: tableName(t) })),
7148
+ { keep: null }
7149
+ ).entries.filter((e) => e.id !== own3);
7150
+ const unseen = tables.loading ? [] : value.filter((id) => !entries.some((e) => e.id === id));
7151
+ const toggle = (id, on) => onChange(on ? [...value.filter((v) => v !== id), id] : value.filter((v) => v !== id));
7152
+ return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1", "data-records-link-also-points-at": "", children: [
7153
+ /* @__PURE__ */ jsx34(Label7, { className: "text-xs", children: "Also points at" }),
7154
+ tables.loading && entries.length === 0 ? /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "No other tables yet." }) : /* @__PURE__ */ jsxs29("div", { className: "flex max-h-40 flex-col gap-1 overflow-y-auto", children: [
7155
+ entries.map((e) => /* @__PURE__ */ jsxs29("label", { className: "flex items-center gap-1.5 text-sm", children: [
7156
+ /* @__PURE__ */ jsx34(
7157
+ Checkbox4,
7158
+ {
7159
+ checked: value.includes(e.id),
7160
+ "aria-label": `Also points at ${e.label}`,
7161
+ "data-records-also-target": e.id,
7162
+ onCheckedChange: (v) => toggle(e.id, v === true)
7163
+ }
7164
+ ),
7165
+ /* @__PURE__ */ jsx34("span", { className: "truncate", children: e.label })
7166
+ ] }, e.id)),
7167
+ unseen.map((id) => /* @__PURE__ */ jsxs29("label", { className: "flex items-center gap-1.5 text-sm", children: [
7168
+ /* @__PURE__ */ jsx34(Checkbox4, { checked: true, "aria-label": "Also points at a table you cannot open", "data-records-also-target": id, onCheckedChange: (v) => toggle(id, v === true) }),
7169
+ /* @__PURE__ */ jsx34("span", { className: "truncate text-muted-foreground", children: "A table you cannot open" })
7170
+ ] }, id))
7171
+ ] })
7172
+ ] });
7173
+ }
7174
+
7062
7175
  // src/FieldEditor.tsx
7063
7176
  import { humanizeIdentifier as humanizeIdentifier2 } from "@ai-matrx/kit/text-case";
7064
7177
 
@@ -8076,7 +8189,7 @@ import { autonumberPrefixOf as autonumberPrefixOf3, buttonNeeds, buttonOf } from
8076
8189
 
8077
8190
  // src/ButtonSettings.tsx
8078
8191
  import { useEffect as useEffect18, useState as useState26 } from "react";
8079
- import { BasicInput as BasicInput7, Button as Button14, Label as Label8 } from "@ai-matrx/design-system";
8192
+ import { BasicInput as BasicInput7, Button as Button14, Label as Label9 } from "@ai-matrx/design-system";
8080
8193
  import { STYLE_COLORS } from "@ai-matrx/design-system/data-table";
8081
8194
  import { buttonUrlPlaceholders } from "@ai-matrx/records";
8082
8195
  import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
@@ -8085,10 +8198,10 @@ import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matr
8085
8198
  import { PORTAL_ACCENTS } from "@ai-matrx/records";
8086
8199
  import { cn as cn16 } from "@ai-matrx/design-system";
8087
8200
  import { STYLE_COLOR_LABELS, SWATCH_CLASS as SWATCH_CLASS2 } from "@ai-matrx/design-system/data-table";
8088
- import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
8201
+ import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
8089
8202
  function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel = "App color" }) {
8090
8203
  return /* @__PURE__ */ jsxs30("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
8091
- /* @__PURE__ */ jsx34(
8204
+ /* @__PURE__ */ jsx35(
8092
8205
  "button",
8093
8206
  {
8094
8207
  type: "button",
@@ -8102,7 +8215,7 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
8102
8215
  children: noneLabel
8103
8216
  }
8104
8217
  ),
8105
- options.map((c) => /* @__PURE__ */ jsx34(
8218
+ options.map((c) => /* @__PURE__ */ jsx35(
8106
8219
  "button",
8107
8220
  {
8108
8221
  type: "button",
@@ -8119,10 +8232,10 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
8119
8232
  }
8120
8233
 
8121
8234
  // src/AddRowSettings.tsx
8122
- import { Label as Label7 } from "@ai-matrx/design-system";
8235
+ import { Label as Label8 } from "@ai-matrx/design-system";
8123
8236
  import { useFields as useFields3, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
8124
8237
  import { useEffect as useEffect17, useState as useState25 } from "react";
8125
- import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
8238
+ import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
8126
8239
  var THIS_ROW = "@row";
8127
8240
  var NOTHING = "";
8128
8241
  function prefillWith(prefill, key, from) {
@@ -8149,8 +8262,8 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
8149
8262
  }, [client, target]);
8150
8263
  return /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-2", "data-records-button-add-row": "", children: [
8151
8264
  /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
8152
- /* @__PURE__ */ jsx35(Label7, { className: "text-xs", children: "Adds to" }),
8153
- /* @__PURE__ */ jsx35(
8265
+ /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Adds to" }),
8266
+ /* @__PURE__ */ jsx36(
8154
8267
  PickOne,
8155
8268
  {
8156
8269
  label: "Table the new row goes in",
@@ -8162,8 +8275,8 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
8162
8275
  )
8163
8276
  ] }),
8164
8277
  templates.length || value.template_id ? /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-1", children: [
8165
- /* @__PURE__ */ jsx35(Label7, { className: "text-xs", children: "Starts from" }),
8166
- /* @__PURE__ */ jsx35(
8278
+ /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Starts from" }),
8279
+ /* @__PURE__ */ jsx36(
8167
8280
  PickOne,
8168
8281
  {
8169
8282
  label: "Row template the new row starts from",
@@ -8174,9 +8287,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
8174
8287
  }
8175
8288
  )
8176
8289
  ] }) : null,
8177
- typed.length ? /* @__PURE__ */ jsx35("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ jsxs31("div", { className: "contents", children: [
8178
- /* @__PURE__ */ jsx35("span", { className: "text-sm", children: f.label }),
8179
- /* @__PURE__ */ jsx35(
8290
+ typed.length ? /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ jsxs31("div", { className: "contents", children: [
8291
+ /* @__PURE__ */ jsx36("span", { className: "text-sm", children: f.label }),
8292
+ /* @__PURE__ */ jsx36(
8180
8293
  PickOne,
8181
8294
  {
8182
8295
  label: `${f.label} starts with`,
@@ -8191,7 +8304,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
8191
8304
  }
8192
8305
 
8193
8306
  // src/ButtonSettings.tsx
8194
- import { jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
8307
+ import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
8195
8308
  var DOES_WORDS = {
8196
8309
  none: "Nothing yet",
8197
8310
  open_url: "Open a link",
@@ -8241,12 +8354,12 @@ function ButtonSettingsEditor({
8241
8354
  return /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2 rounded-md border p-2", "data-records-button-settings": "", children: [
8242
8355
  /* @__PURE__ */ jsxs32("div", { className: "grid gap-2 sm:grid-cols-2", children: [
8243
8356
  /* @__PURE__ */ jsxs32("label", { className: "flex flex-col gap-1", children: [
8244
- /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Button label" }),
8245
- /* @__PURE__ */ jsx36(BasicInput7, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
8357
+ /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Button label" }),
8358
+ /* @__PURE__ */ jsx37(BasicInput7, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
8246
8359
  ] }),
8247
8360
  /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", children: [
8248
- /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Does" }),
8249
- /* @__PURE__ */ jsx36(
8361
+ /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Does" }),
8362
+ /* @__PURE__ */ jsx37(
8250
8363
  PickOne,
8251
8364
  {
8252
8365
  label: "What a press does",
@@ -8259,8 +8372,8 @@ function ButtonSettingsEditor({
8259
8372
  ] })
8260
8373
  ] }),
8261
8374
  /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", children: [
8262
- /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Color" }),
8263
- /* @__PURE__ */ jsx36(
8375
+ /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Color" }),
8376
+ /* @__PURE__ */ jsx37(
8264
8377
  AccentSwatches,
8265
8378
  {
8266
8379
  value: value.color ?? "",
@@ -8271,9 +8384,9 @@ function ButtonSettingsEditor({
8271
8384
  )
8272
8385
  ] }),
8273
8386
  value.do === "open_url" ? /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", children: [
8274
- /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "Link" }),
8387
+ /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Link" }),
8275
8388
  /* @__PURE__ */ jsxs32("div", { className: "flex gap-1", children: [
8276
- /* @__PURE__ */ jsx36(
8389
+ /* @__PURE__ */ jsx37(
8277
8390
  BasicInput7,
8278
8391
  {
8279
8392
  className: "h-8 flex-1 font-mono text-xs",
@@ -8283,7 +8396,7 @@ function ButtonSettingsEditor({
8283
8396
  onChange: (e) => set({ url: e.target.value })
8284
8397
  }
8285
8398
  ),
8286
- columns.length > 0 ? /* @__PURE__ */ jsx36(
8399
+ columns.length > 0 ? /* @__PURE__ */ jsx37(
8287
8400
  PickOne,
8288
8401
  {
8289
8402
  label: "Add a column's value",
@@ -8296,11 +8409,11 @@ function ButtonSettingsEditor({
8296
8409
  }
8297
8410
  ) : null
8298
8411
  ] }),
8299
- value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */ jsx36("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
8412
+ value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */ jsx37("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
8300
8413
  ] }) : null,
8301
- value.do === "add_row" ? /* @__PURE__ */ jsx36(AddRowSettings, { value, onChange, tableId, fields }) : null,
8302
- value.do === "run_action" ? !tableId ? /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ jsx36(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
8303
- actions === null || actions.length > 0 ? /* @__PURE__ */ jsx36(
8414
+ value.do === "add_row" ? /* @__PURE__ */ jsx37(AddRowSettings, { value, onChange, tableId, fields }) : null,
8415
+ value.do === "run_action" ? !tableId ? /* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ jsx37(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
8416
+ actions === null || actions.length > 0 ? /* @__PURE__ */ jsx37(
8304
8417
  PickOne,
8305
8418
  {
8306
8419
  label: "Row action",
@@ -8311,7 +8424,7 @@ function ButtonSettingsEditor({
8311
8424
  options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
8312
8425
  }
8313
8426
  ) : null,
8314
- actions !== null ? /* @__PURE__ */ jsx36(
8427
+ actions !== null ? /* @__PURE__ */ jsx37(
8315
8428
  NewRowAction,
8316
8429
  {
8317
8430
  tableId,
@@ -8325,7 +8438,7 @@ function ButtonSettingsEditor({
8325
8438
  }
8326
8439
  ) : null
8327
8440
  ] }) : null,
8328
- value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ jsx36(
8441
+ value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ jsx37(
8329
8442
  PickOne,
8330
8443
  {
8331
8444
  label: "Automation",
@@ -8356,7 +8469,7 @@ function NewRowAction({
8356
8469
  const [setTo, setSetTo] = useState26("");
8357
8470
  const [busy, setBusy] = useState26(false);
8358
8471
  const [refused, setRefused] = useState26(null);
8359
- if (settable.length === 0) return /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
8472
+ if (settable.length === 0) return /* @__PURE__ */ jsx37("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
8360
8473
  const make = async () => {
8361
8474
  if (!client || fieldId === "") return;
8362
8475
  setBusy(true);
@@ -8381,9 +8494,9 @@ function NewRowAction({
8381
8494
  onMade(made.id, all);
8382
8495
  };
8383
8496
  return /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
8384
- /* @__PURE__ */ jsx36(Label8, { className: "text-xs", children: "New row action" }),
8497
+ /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "New row action" }),
8385
8498
  /* @__PURE__ */ jsxs32("div", { className: "flex flex-wrap items-center gap-1", children: [
8386
- /* @__PURE__ */ jsx36(
8499
+ /* @__PURE__ */ jsx37(
8387
8500
  PickOne,
8388
8501
  {
8389
8502
  label: "Column to set",
@@ -8395,10 +8508,10 @@ function NewRowAction({
8395
8508
  options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
8396
8509
  }
8397
8510
  ),
8398
- /* @__PURE__ */ jsx36(BasicInput7, { className: "h-8 w-32 text-xs", placeholder: "Value", "aria-label": "Value", "data-records-button-action-value": "", value: setTo, onChange: (e) => setSetTo(e.target.value) }),
8399
- /* @__PURE__ */ jsx36(Button14, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
8511
+ /* @__PURE__ */ jsx37(BasicInput7, { className: "h-8 w-32 text-xs", placeholder: "Value", "aria-label": "Value", "data-records-button-action-value": "", value: setTo, onChange: (e) => setSetTo(e.target.value) }),
8512
+ /* @__PURE__ */ jsx37(Button14, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
8400
8513
  ] }),
8401
- refused ? /* @__PURE__ */ jsx36(RefusalLine, { error: refused }) : null
8514
+ refused ? /* @__PURE__ */ jsx37(RefusalLine, { error: refused }) : null
8402
8515
  ] });
8403
8516
  }
8404
8517
 
@@ -8422,7 +8535,7 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
8422
8535
  }));
8423
8536
 
8424
8537
  // src/FieldEditor.tsx
8425
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
8538
+ import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
8426
8539
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
8427
8540
  var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
8428
8541
  var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
@@ -8541,22 +8654,22 @@ function FieldEditor(props) {
8541
8654
  const [rules, setRules] = useState27(start?.rules ?? []);
8542
8655
  const [startsWith, setStartsWith] = useState27(start?.default ?? null);
8543
8656
  const [ratingMax, setRatingMax] = useState27(() => start ? ratingMaxOf(start) : 5);
8544
- const savedRules = useMemo10(
8657
+ const savedRules = useMemo11(
8545
8658
  () => field2 ? type === "rating" ? rulesWithTopStar(field2.rules ?? [], ratingMaxOf(field2)) : field2.rules ?? [] : [],
8546
8659
  [field2, type]
8547
8660
  );
8548
- const editedRules = useMemo10(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
8661
+ const editedRules = useMemo11(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
8549
8662
  const [statusGroups, setStatusGroups] = useState27({});
8550
8663
  const [statusKeys, setStatusKeys] = useState27({});
8551
8664
  const [symbology, setSymbology] = useState27(String(start?.config?.["symbology"] ?? ""));
8552
8665
  const descriptionStart = String(start?.config?.["description"] ?? "");
8553
8666
  const [description, setDescription] = useState27(descriptionStart);
8554
- const buttonStart = useMemo10(() => buttonOf(start) ?? { label: "" }, [start]);
8667
+ const buttonStart = useMemo11(() => buttonOf(start) ?? { label: "" }, [start]);
8555
8668
  const [buttonSettings, setButtonSettings] = useState27(buttonStart);
8556
8669
  const prefixStart = autonumberPrefixOf3(start);
8557
8670
  const [numberPrefix, setNumberPrefix] = useState27(prefixStart);
8558
8671
  const dependencyStart = start?.config?.["dependency"] === true;
8559
- const watchStart = useMemo10(() => watchedFieldsOf(start), [start]);
8672
+ const watchStart = useMemo11(() => watchedFieldsOf(start), [start]);
8560
8673
  const [watchFields, setWatchFields] = useState27(watchStart);
8561
8674
  const [dependency, setDependency] = useState27(dependencyStart);
8562
8675
  const limitViewStart = typeof start?.config?.["limit_to_view"] === "string" ? String(start.config["limit_to_view"]) : "";
@@ -8570,6 +8683,12 @@ function FieldEditor(props) {
8570
8683
  const loopsStart = start?.config?.["loops"] === true;
8571
8684
  const [loops, setLoops] = useState27(loopsStart);
8572
8685
  const [targetViews, setTargetViews] = useState27(null);
8686
+ const alsoStart = useMemo11(() => {
8687
+ const listed = start?.config?.["target_tables"];
8688
+ const own3 = String(start?.relation_target ?? "");
8689
+ return start?.config?.["target_mode"] === "several" && Array.isArray(listed) ? listed.map(String).filter((t) => t !== own3) : [];
8690
+ }, [start]);
8691
+ const [alsoTargets, setAlsoTargets] = useState27(alsoStart);
8573
8692
  const limitTarget = field2?.type === "relation" && field2.relation_target && !onEntity ? String(field2.relation_target) : null;
8574
8693
  useEffect19(() => {
8575
8694
  if (!limitTarget) return;
@@ -8665,7 +8784,7 @@ function FieldEditor(props) {
8665
8784
  const [allowedTypes, setAllowedTypes] = useState27(() => entityReferenceKindsOf(start));
8666
8785
  const startingFormulaText = start ? formulaTextNow(String(start.config?.["formula_text"] ?? ""), start.config?.["expr"] ?? start.expr, fields.data) : "";
8667
8786
  const [formulaText, setFormulaText] = useState27(startingFormulaText);
8668
- const shownFormula = useRef14(startingFormulaText);
8787
+ const shownFormula = useRef13(startingFormulaText);
8669
8788
  useEffect19(() => {
8670
8789
  if (shownFormula.current === startingFormulaText) return;
8671
8790
  setFormulaText((typed) => typed === shownFormula.current ? startingFormulaText : typed);
@@ -8680,7 +8799,7 @@ function FieldEditor(props) {
8680
8799
  const [notLanded, setNotLanded] = useState27(false);
8681
8800
  const liveField = field2 ? fields.data?.find((f) => f.id === field2.id) ?? field2 : void 0;
8682
8801
  const heldAs = liveField ? JSON.stringify([liveField.type, liveField.config?.["kind"] ?? null, liveField.format ?? null, liveField.multi ?? false, liveField.unit ?? null]) : "";
8683
- const seededAs = useRef14(heldAs);
8802
+ const seededAs = useRef13(heldAs);
8684
8803
  useEffect19(() => {
8685
8804
  if (!liveField || seededAs.current === heldAs) return;
8686
8805
  seededAs.current = heldAs;
@@ -8690,14 +8809,14 @@ function FieldEditor(props) {
8690
8809
  setUnit(liveField.unit ?? "$");
8691
8810
  setWithTime(String(liveField.config?.["kind"] ?? "date") === "datetime");
8692
8811
  }, [heldAs]);
8693
- const others = useMemo10(
8812
+ const others = useMemo11(
8694
8813
  () => (fields.data ?? []).filter((f) => f.id !== field2?.id),
8695
8814
  [fields.data, field2?.id]
8696
8815
  );
8697
- const relations = useMemo10(() => others.filter((f) => sourceKindOf(f) !== null), [others]);
8816
+ const relations = useMemo11(() => others.filter((f) => sourceKindOf(f) !== null), [others]);
8698
8817
  const reverse = useReverseColumns(onEntity ? null : tableId);
8699
- const backLinks = useMemo10(() => (reverse.data ?? []).map(backLinkAsSource), [reverse.data]);
8700
- const totalSources = useMemo10(() => [...relations, ...backLinks], [relations, backLinks]);
8818
+ const backLinks = useMemo11(() => (reverse.data ?? []).map(backLinkAsSource), [reverse.data]);
8819
+ const totalSources = useMemo11(() => [...relations, ...backLinks], [relations, backLinks]);
8701
8820
  const sourcesFor = (kind) => kind === "rollup" || kind === "count" ? totalSources : relations;
8702
8821
  const choice = fieldTypeChoice(type);
8703
8822
  const editing = Boolean(field2);
@@ -8707,7 +8826,7 @@ function FieldEditor(props) {
8707
8826
  const newDefault = !editing && !onEntity && newColumnTakesADefault(type) ? defaultToKeep(startsWith) : null;
8708
8827
  const farFieldsOfLink = useFields4(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
8709
8828
  const farTable = useTable2(field2 && sourceKindOf(field2) === "link" && !onEntity ? field2.relation_target ?? null : null);
8710
- const linkReaders = useMemo10(
8829
+ const linkReaders = useMemo11(
8711
8830
  () => field2 ? readingThroughLink(field2, farFieldsOfLink.data ?? []) : [],
8712
8831
  [field2, farFieldsOfLink.data]
8713
8832
  );
@@ -8715,7 +8834,7 @@ function FieldEditor(props) {
8715
8834
  const offersMany = multiApplies(type) && !isTitle;
8716
8835
  if (!mayShape) {
8717
8836
  if (onEntity && entityRights.loading) return null;
8718
- return /* @__PURE__ */ jsx37("p", { className: cn17("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
8837
+ return /* @__PURE__ */ jsx38("p", { className: cn17("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
8719
8838
  }
8720
8839
  const options = newChoices.map((r) => r.words.trim()).filter((word) => word !== "");
8721
8840
  const shownStatusRows = type !== "status" ? [] : statusGroupRows(field2, editing ? choiceList ?? [] : newChoices, statusKeys, statusGroups);
@@ -8778,6 +8897,7 @@ function FieldEditor(props) {
8778
8897
  ...field2.type === "relation" && carries !== carriesStart ? { carries } : {},
8779
8898
  ...field2.type === "relation" && carries && carriesMax !== carriesMaxStart ? { carries_max: carriesMax } : {},
8780
8899
  ...field2.type === "relation" && loops !== loopsStart ? { loops } : {},
8900
+ ...field2.type === "relation" && limitTarget && [...alsoTargets].sort().join(",") !== [...alsoStart].sort().join(",") ? { target_tables: alsoTargets.length === 0 ? null : alsoTargets } : {},
8781
8901
  ...type === "modified_time" ? watchedFieldsPatch(watchStart, watchFields) : {},
8782
8902
  ...type === "autonumber" && numberPrefix.trim() !== prefixStart ? { display_format: { id: "autonumber", options: numberPrefix.trim() === "" ? {} : { prefix: numberPrefix.trim() } } } : {},
8783
8903
  // THE CHOICES, ONE ROW EACH, IN ORDER (CHOICE-COLUMN-EDIT): `{id, words}` re-words a
@@ -8940,13 +9060,13 @@ function FieldEditor(props) {
8940
9060
  };
8941
9061
  return /* @__PURE__ */ jsxs33("div", { className: cn17("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
8942
9062
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
8943
- /* @__PURE__ */ jsx37("span", { className: "font-medium", children: field2 ? `Field \xB7 ${fieldName(field2)}` : "New field" }),
8944
- /* @__PURE__ */ jsx37("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
9063
+ /* @__PURE__ */ jsx38("span", { className: "font-medium", children: field2 ? `Field \xB7 ${fieldName(field2)}` : "New field" }),
9064
+ /* @__PURE__ */ jsx38("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
8945
9065
  ] }),
8946
9066
  /* @__PURE__ */ jsxs33("div", { className: "grid gap-3 sm:grid-cols-2", children: [
8947
9067
  /* @__PURE__ */ jsxs33("label", { className: "flex flex-col gap-1", children: [
8948
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Name" }),
8949
- /* @__PURE__ */ jsx37(
9068
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Name" }),
9069
+ /* @__PURE__ */ jsx38(
8950
9070
  BasicInput8,
8951
9071
  {
8952
9072
  value: label,
@@ -8962,7 +9082,7 @@ function FieldEditor(props) {
8962
9082
  ...nameLine ? { "aria-invalid": true, "aria-describedby": "field-editor-name-taken" } : {}
8963
9083
  }
8964
9084
  ),
8965
- nameLine ? /* @__PURE__ */ jsx37(
9085
+ nameLine ? /* @__PURE__ */ jsx38(
8966
9086
  "span",
8967
9087
  {
8968
9088
  id: "field-editor-name-taken",
@@ -8974,8 +9094,8 @@ function FieldEditor(props) {
8974
9094
  ) : null
8975
9095
  ] }),
8976
9096
  field2 ? /* @__PURE__ */ jsxs33("label", { className: "flex flex-col gap-1 sm:col-span-2", children: [
8977
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Help text" }),
8978
- /* @__PURE__ */ jsx37(
9097
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Help text" }),
9098
+ /* @__PURE__ */ jsx38(
8979
9099
  BasicInput8,
8980
9100
  {
8981
9101
  value: description,
@@ -8987,7 +9107,7 @@ function FieldEditor(props) {
8987
9107
  )
8988
9108
  ] }) : null,
8989
9109
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
8990
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "What it holds" }),
9110
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "What it holds" }),
8991
9111
  /* @__PURE__ */ jsxs33(
8992
9112
  Select5,
8993
9113
  {
@@ -8995,20 +9115,20 @@ function FieldEditor(props) {
8995
9115
  disabled: editing,
8996
9116
  onValueChange: (next) => setType(next),
8997
9117
  children: [
8998
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
8999
- /* @__PURE__ */ jsx37(SelectContent5, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ jsxs33(SelectGroup, { children: [
9000
- /* @__PURE__ */ jsx37(SelectLabel, { children: group }),
9001
- FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ jsx37(SelectItem5, { value: c.id, children: c.label }, c.id))
9118
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9119
+ /* @__PURE__ */ jsx38(SelectContent5, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ jsxs33(SelectGroup, { children: [
9120
+ /* @__PURE__ */ jsx38(SelectLabel, { children: group }),
9121
+ FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ jsx38(SelectItem5, { value: c.id, children: c.label }, c.id))
9002
9122
  ] }, group)) })
9003
9123
  ]
9004
9124
  }
9005
9125
  ),
9006
- editing && field2 ? /* @__PURE__ */ jsx37(FieldRetype, { field: liveField ?? field2, tableId }) : null
9126
+ editing && field2 ? /* @__PURE__ */ jsx38(FieldRetype, { field: liveField ?? field2, tableId }) : null
9007
9127
  ] })
9008
9128
  ] }),
9009
9129
  type === "formula" && others.length > 0 ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2", children: [
9010
- editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
9011
- /* @__PURE__ */ jsx37(
9130
+ editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
9131
+ /* @__PURE__ */ jsx38(
9012
9132
  Button15,
9013
9133
  {
9014
9134
  type: "button",
@@ -9019,7 +9139,7 @@ function FieldEditor(props) {
9019
9139
  children: "Pick the columns"
9020
9140
  }
9021
9141
  ),
9022
- /* @__PURE__ */ jsx37(
9142
+ /* @__PURE__ */ jsx38(
9023
9143
  Button15,
9024
9144
  {
9025
9145
  type: "button",
@@ -9031,7 +9151,7 @@ function FieldEditor(props) {
9031
9151
  }
9032
9152
  )
9033
9153
  ] }),
9034
- formulaWritten ? /* @__PURE__ */ jsx37(
9154
+ formulaWritten ? /* @__PURE__ */ jsx38(
9035
9155
  FormulaTextEditor,
9036
9156
  {
9037
9157
  tableId,
@@ -9041,9 +9161,9 @@ function FieldEditor(props) {
9041
9161
  columns: others
9042
9162
  }
9043
9163
  ) : null
9044
- ] }) : editing && type === "formula" ? /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
9045
- editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ jsx37(SourceArchivedNotice, { fieldId: field2.id, tableId }) : null,
9046
- !editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ jsx37(
9164
+ ] }) : editing && type === "formula" ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
9165
+ editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ jsx38(SourceArchivedNotice, { fieldId: field2.id, tableId }) : null,
9166
+ !editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ jsx38(
9047
9167
  TypeQuestions,
9048
9168
  {
9049
9169
  type,
@@ -9073,7 +9193,7 @@ function FieldEditor(props) {
9073
9193
  setFormulaSeparator,
9074
9194
  relations: sourcesFor(type),
9075
9195
  others,
9076
- choiceList: editing && field2 ? /* @__PURE__ */ jsx37(
9196
+ choiceList: editing && field2 ? /* @__PURE__ */ jsx38(
9077
9197
  ChoiceListEditor,
9078
9198
  {
9079
9199
  field: field2,
@@ -9084,10 +9204,10 @@ function FieldEditor(props) {
9084
9204
  rehome,
9085
9205
  onRehome: setRehome
9086
9206
  }
9087
- ) : /* @__PURE__ */ jsx37(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
9207
+ ) : /* @__PURE__ */ jsx38(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
9088
9208
  allowedTypes,
9089
9209
  setAllowedTypes,
9090
- newer: type === "rating" ? /* @__PURE__ */ jsx37(
9210
+ newer: type === "rating" ? /* @__PURE__ */ jsx38(
9091
9211
  RatingMaxQuestion,
9092
9212
  {
9093
9213
  value: ratingMax,
@@ -9095,55 +9215,56 @@ function FieldEditor(props) {
9095
9215
  setRatingMax(next);
9096
9216
  }
9097
9217
  }
9098
- ) : type === "status" ? /* @__PURE__ */ jsx37(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ jsx37(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
9218
+ ) : type === "status" ? /* @__PURE__ */ jsx38(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ jsx38(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
9099
9219
  }
9100
9220
  ) : null,
9101
- type === "button" ? /* @__PURE__ */ jsx37(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
9102
- type === "modified_time" ? /* @__PURE__ */ jsx37(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
9221
+ type === "button" ? /* @__PURE__ */ jsx38(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
9222
+ type === "modified_time" ? /* @__PURE__ */ jsx38(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
9103
9223
  type === "autonumber" ? /* @__PURE__ */ jsxs33("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
9104
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Prefix" }),
9105
- /* @__PURE__ */ jsx37(BasicInput8, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
9224
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Prefix" }),
9225
+ /* @__PURE__ */ jsx38(BasicInput8, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
9106
9226
  ] }) : null,
9107
9227
  editing && field2?.type === "relation" && field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5 text-sm", title: "A timeline draws a line to each record this one waits on", children: [
9108
- /* @__PURE__ */ jsx37(Checkbox4, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
9109
- /* @__PURE__ */ jsx37("span", { children: "Waits on the linked records" })
9228
+ /* @__PURE__ */ jsx38(Checkbox5, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
9229
+ /* @__PURE__ */ jsx38("span", { children: "Waits on the linked records" })
9110
9230
  ] }) : null,
9111
9231
  editing && limitTarget ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", "data-records-limit-to-view": "", children: [
9112
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Choices come from" }),
9232
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Choices come from" }),
9113
9233
  /* @__PURE__ */ jsxs33(Select5, { value: limitView === "" ? "__all" : limitView, onValueChange: (next) => setLimitView(next === "__all" ? "" : next), disabled: targetViews === null, children: [
9114
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "Limit the choices to a view", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9234
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "Limit the choices to a view", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9115
9235
  /* @__PURE__ */ jsxs33(SelectContent5, { children: [
9116
- /* @__PURE__ */ jsx37(SelectItem5, { value: "__all", children: "Every record" }),
9117
- (targetViews ?? []).map((v) => /* @__PURE__ */ jsx37(SelectItem5, { value: v.id, children: v.name }, v.id)),
9118
- limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ jsx37(SelectItem5, { value: limitView, children: "A view that is gone" }) : null
9236
+ /* @__PURE__ */ jsx38(SelectItem5, { value: "__all", children: "Every record" }),
9237
+ (targetViews ?? []).map((v) => /* @__PURE__ */ jsx38(SelectItem5, { value: v.id, children: v.name }, v.id)),
9238
+ limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ jsx38(SelectItem5, { value: limitView, children: "A view that is gone" }) : null
9119
9239
  ] })
9120
9240
  ] })
9121
9241
  ] }) : null,
9242
+ editing && limitTarget ? /* @__PURE__ */ jsx38(AlsoPointsAt, { own: limitTarget, value: alsoTargets, onChange: setAlsoTargets }) : null,
9122
9243
  editing && field2?.type === "relation" ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", "data-records-link-binding": "", children: [
9123
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "When a linked record changes" }),
9244
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "When a linked record changes" }),
9124
9245
  /* @__PURE__ */ jsxs33(Select5, { value: binding, onValueChange: (next) => setBinding(next === "snapshot" ? "snapshot" : "live"), children: [
9125
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "When a linked record changes", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9246
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "When a linked record changes", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9126
9247
  /* @__PURE__ */ jsxs33(SelectContent5, { children: [
9127
- /* @__PURE__ */ jsx37(SelectItem5, { value: "live", children: "Show its changes" }),
9128
- /* @__PURE__ */ jsx37(SelectItem5, { value: "snapshot", children: "Keep it as it was when linked" })
9248
+ /* @__PURE__ */ jsx38(SelectItem5, { value: "live", children: "Show its changes" }),
9249
+ /* @__PURE__ */ jsx38(SelectItem5, { value: "snapshot", children: "Keep it as it was when linked" })
9129
9250
  ] })
9130
9251
  ] })
9131
9252
  ] }) : null,
9132
9253
  editing && field2?.type === "relation" ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
9133
9254
  /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
9134
- /* @__PURE__ */ jsx37(Checkbox4, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
9135
- /* @__PURE__ */ jsx37("span", { children: "Whoever sees a linked record sees this one" })
9255
+ /* @__PURE__ */ jsx38(Checkbox5, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
9256
+ /* @__PURE__ */ jsx38("span", { children: "Whoever sees a linked record sees this one" })
9136
9257
  ] }),
9137
9258
  carries ? /* @__PURE__ */ jsxs33(Select5, { value: carriesMax, onValueChange: (next) => setCarriesMax(next === "editor" ? "editor" : "viewer"), children: [
9138
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "Carried access level", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9259
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "Carried access level", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9139
9260
  /* @__PURE__ */ jsxs33(SelectContent5, { children: [
9140
- /* @__PURE__ */ jsx37(SelectItem5, { value: "viewer", children: "Up to view" }),
9141
- /* @__PURE__ */ jsx37(SelectItem5, { value: "editor", children: "Up to edit" })
9261
+ /* @__PURE__ */ jsx38(SelectItem5, { value: "viewer", children: "Up to view" }),
9262
+ /* @__PURE__ */ jsx38(SelectItem5, { value: "editor", children: "Up to edit" })
9142
9263
  ] })
9143
9264
  ] }) : null,
9144
9265
  field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5 text-sm", title: "Two records may point at each other along this link", children: [
9145
- /* @__PURE__ */ jsx37(Checkbox4, { checked: loops, "aria-label": "Two records can link each other", onCheckedChange: (v) => setLoops(v === true) }),
9146
- /* @__PURE__ */ jsx37("span", { children: "Two records can link each other" })
9266
+ /* @__PURE__ */ jsx38(Checkbox5, { checked: loops, "aria-label": "Two records can link each other", onCheckedChange: (v) => setLoops(v === true) }),
9267
+ /* @__PURE__ */ jsx38("span", { children: "Two records can link each other" })
9147
9268
  ] }) : null,
9148
9269
  carries && loops ? /* @__PURE__ */ jsxs33("p", { className: "text-xs text-muted-foreground", "data-records-loop-consequence": "", children: [
9149
9270
  "Sharing one record shares the records it links to, and back again, ",
@@ -9152,8 +9273,8 @@ function FieldEditor(props) {
9152
9273
  ] }) : null
9153
9274
  ] }) : null,
9154
9275
  personColumn ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5 text-sm", title: "Each person added to this column gets a notice", children: [
9155
- /* @__PURE__ */ jsx37(
9156
- Checkbox4,
9276
+ /* @__PURE__ */ jsx38(
9277
+ Checkbox5,
9157
9278
  {
9158
9279
  checked: notify,
9159
9280
  disabled: notifyStart === null,
@@ -9162,10 +9283,10 @@ function FieldEditor(props) {
9162
9283
  onCheckedChange: (v) => setNotify(v === true)
9163
9284
  }
9164
9285
  ),
9165
- /* @__PURE__ */ jsx37("span", { children: "Notify people when they're added" })
9286
+ /* @__PURE__ */ jsx38("span", { children: "Notify people when they're added" })
9166
9287
  ] }) : null,
9167
- notifyReadError ? /* @__PURE__ */ jsx37(RefusalNotice, { error: notifyReadError }) : null,
9168
- type === "rollup" ? /* @__PURE__ */ jsx37(
9288
+ notifyReadError ? /* @__PURE__ */ jsx38(RefusalNotice, { error: notifyReadError }) : null,
9289
+ type === "rollup" ? /* @__PURE__ */ jsx38(
9169
9290
  RollupFilterQuestion,
9170
9291
  {
9171
9292
  relation: totalSources.find((f) => f.key === via),
@@ -9175,22 +9296,22 @@ function FieldEditor(props) {
9175
9296
  onChange: setRollupFilter
9176
9297
  }
9177
9298
  ) : null,
9178
- editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ jsx37(FieldFormatPicker, { field: field2, value: showsAs, onValue: setShowsAs }) : null,
9299
+ editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ jsx38(FieldFormatPicker, { field: field2, value: showsAs, onValue: setShowsAs }) : null,
9179
9300
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-wrap items-center gap-4", children: [
9180
9301
  /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9181
- /* @__PURE__ */ jsx37(
9182
- Checkbox4,
9302
+ /* @__PURE__ */ jsx38(
9303
+ Checkbox5,
9183
9304
  {
9184
9305
  checked: required,
9185
9306
  "aria-label": "Required",
9186
9307
  onCheckedChange: (v) => setRequired(v === true)
9187
9308
  }
9188
9309
  ),
9189
- /* @__PURE__ */ jsx37("span", { title: "Every record has to have one", children: "Required" })
9310
+ /* @__PURE__ */ jsx38("span", { title: "Every record has to have one", children: "Required" })
9190
9311
  ] }),
9191
9312
  offersMany ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9192
- /* @__PURE__ */ jsx37(
9193
- Checkbox4,
9313
+ /* @__PURE__ */ jsx38(
9314
+ Checkbox5,
9194
9315
  {
9195
9316
  checked: multi,
9196
9317
  "aria-label": "Can hold more than one",
@@ -9200,8 +9321,8 @@ function FieldEditor(props) {
9200
9321
  "Can hold more than one"
9201
9322
  ] }) : null,
9202
9323
  /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9203
- /* @__PURE__ */ jsx37(
9204
- Checkbox4,
9324
+ /* @__PURE__ */ jsx38(
9325
+ Checkbox5,
9205
9326
  {
9206
9327
  checked: dated,
9207
9328
  "aria-label": "Each value has its own date",
@@ -9211,8 +9332,8 @@ function FieldEditor(props) {
9211
9332
  "Each value has its own date"
9212
9333
  ] }),
9213
9334
  !field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9214
- /* @__PURE__ */ jsx37(
9215
- Checkbox4,
9335
+ /* @__PURE__ */ jsx38(
9336
+ Checkbox5,
9216
9337
  {
9217
9338
  checked: showOnOther,
9218
9339
  "aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
@@ -9224,12 +9345,12 @@ function FieldEditor(props) {
9224
9345
  otherTable.data.name ?? "the other table"
9225
9346
  ] }) : null,
9226
9347
  !field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
9227
- /* @__PURE__ */ jsx37(Checkbox4, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
9228
- /* @__PURE__ */ jsx37("span", { children: "Waits on the linked records" })
9348
+ /* @__PURE__ */ jsx38(Checkbox5, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
9349
+ /* @__PURE__ */ jsx38("span", { children: "Waits on the linked records" })
9229
9350
  ] }) : null,
9230
9351
  !field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9231
- /* @__PURE__ */ jsx37(
9232
- Checkbox4,
9352
+ /* @__PURE__ */ jsx38(
9353
+ Checkbox5,
9233
9354
  {
9234
9355
  checked: nestsSubItems,
9235
9356
  "aria-label": "Sub-items",
@@ -9240,11 +9361,11 @@ function FieldEditor(props) {
9240
9361
  "data-records-sub-items": ""
9241
9362
  }
9242
9363
  ),
9243
- /* @__PURE__ */ jsx37("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
9364
+ /* @__PURE__ */ jsx38("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
9244
9365
  ] }) : null,
9245
9366
  CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9246
- /* @__PURE__ */ jsx37(
9247
- Checkbox4,
9367
+ /* @__PURE__ */ jsx38(
9368
+ Checkbox5,
9248
9369
  {
9249
9370
  checked: allowOther,
9250
9371
  "aria-label": "A value that is not one of the choices is added to them",
@@ -9254,10 +9375,10 @@ function FieldEditor(props) {
9254
9375
  "A value that is not one of the choices is added to them"
9255
9376
  ] }) : null
9256
9377
  ] }),
9257
- !editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ jsx37(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
9378
+ !editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ jsx38(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
9258
9379
  editing && field2 && takesADefault(liveField ?? field2) ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", "data-records-field-default": "", children: [
9259
- /* @__PURE__ */ jsx37(Label9, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
9260
- /* @__PURE__ */ jsx37(
9380
+ /* @__PURE__ */ jsx38(Label10, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
9381
+ /* @__PURE__ */ jsx38(
9261
9382
  FieldControl,
9262
9383
  {
9263
9384
  id: "records-field-default",
@@ -9267,28 +9388,28 @@ function FieldEditor(props) {
9267
9388
  }
9268
9389
  )
9269
9390
  ] }) : null,
9270
- /* @__PURE__ */ jsx37(Separator, {}),
9391
+ /* @__PURE__ */ jsx38(Separator, {}),
9271
9392
  /* @__PURE__ */ jsxs33("div", { className: "grid gap-3 sm:grid-cols-2", children: [
9272
9393
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9273
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Who can see what is in it" }),
9394
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Who can see what is in it" }),
9274
9395
  /* @__PURE__ */ jsxs33(Select5, { value: sensitivity, onValueChange: setSensitivity, children: [
9275
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9276
- /* @__PURE__ */ jsx37(SelectContent5, { children: sensitivities.map((row) => /* @__PURE__ */ jsx37(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9396
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9397
+ /* @__PURE__ */ jsx38(SelectContent5, { children: sensitivities.map((row) => /* @__PURE__ */ jsx38(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9277
9398
  ] })
9278
9399
  ] }),
9279
9400
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9280
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Can an assistant read it" }),
9401
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Can an assistant read it" }),
9281
9402
  /* @__PURE__ */ jsxs33(Select5, { value: contextPolicy, onValueChange: setContextPolicy, children: [
9282
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9283
- /* @__PURE__ */ jsx37(SelectContent5, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx37(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9403
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9404
+ /* @__PURE__ */ jsx38(SelectContent5, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx38(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9284
9405
  ] })
9285
9406
  ] })
9286
9407
  ] }),
9287
- /* @__PURE__ */ jsx37(Separator, {}),
9408
+ /* @__PURE__ */ jsx38(Separator, {}),
9288
9409
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2", children: [
9289
9410
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
9290
- /* @__PURE__ */ jsx37("span", { className: "font-medium", children: "What counts as a good value" }),
9291
- /* @__PURE__ */ jsx37(
9411
+ /* @__PURE__ */ jsx38("span", { className: "font-medium", children: "What counts as a good value" }),
9412
+ /* @__PURE__ */ jsx38(
9292
9413
  Button15,
9293
9414
  {
9294
9415
  type: "button",
@@ -9301,8 +9422,8 @@ function FieldEditor(props) {
9301
9422
  )
9302
9423
  ] }),
9303
9424
  canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", "data-records-field-unique": "", children: [
9304
- /* @__PURE__ */ jsx37(
9305
- Checkbox4,
9425
+ /* @__PURE__ */ jsx38(
9426
+ Checkbox5,
9306
9427
  {
9307
9428
  checked: rules.some((r) => r.kind === "unique"),
9308
9429
  "aria-label": UNIQUE_LABEL,
@@ -9311,7 +9432,7 @@ function FieldEditor(props) {
9311
9432
  ),
9312
9433
  UNIQUE_LABEL
9313
9434
  ] }) : null,
9314
- rules.length === 0 ? /* @__PURE__ */ jsx37("p", { className: "text-muted-foreground", children: "No checks." }) : null,
9435
+ rules.length === 0 ? /* @__PURE__ */ jsx38("p", { className: "text-muted-foreground", children: "No checks." }) : null,
9315
9436
  rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-1", children: [
9316
9437
  /* @__PURE__ */ jsxs33(
9317
9438
  Select5,
@@ -9319,12 +9440,12 @@ function FieldEditor(props) {
9319
9440
  value: rule.kind,
9320
9441
  onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
9321
9442
  children: [
9322
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9323
- /* @__PURE__ */ jsx37(SelectContent5, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx37(SelectItem5, { value: row.kind, children: row.label }, row.kind)) })
9443
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9444
+ /* @__PURE__ */ jsx38(SelectContent5, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx38(SelectItem5, { value: row.kind, children: row.label }, row.kind)) })
9324
9445
  ]
9325
9446
  }
9326
9447
  ),
9327
- rule.kind === "length" ? /* @__PURE__ */ jsx37(
9448
+ rule.kind === "length" ? /* @__PURE__ */ jsx38(
9328
9449
  BasicInput8,
9329
9450
  {
9330
9451
  className: "h-8 w-24",
@@ -9335,7 +9456,7 @@ function FieldEditor(props) {
9335
9456
  onChange: (e) => setRules(rules.map((r, i) => i === index ? withNumber(r, "min", e.target.value) : r))
9336
9457
  }
9337
9458
  ) : null,
9338
- /* @__PURE__ */ jsx37(
9459
+ /* @__PURE__ */ jsx38(
9339
9460
  BasicInput8,
9340
9461
  {
9341
9462
  className: "h-8",
@@ -9345,7 +9466,7 @@ function FieldEditor(props) {
9345
9466
  onChange: (e) => setRules(rules.map((r, i) => i === index ? { ...r, value: e.target.value } : r))
9346
9467
  }
9347
9468
  ),
9348
- rule.kind === "pattern" ? /* @__PURE__ */ jsx37(
9469
+ rule.kind === "pattern" ? /* @__PURE__ */ jsx38(
9349
9470
  BasicInput8,
9350
9471
  {
9351
9472
  className: "h-8",
@@ -9355,7 +9476,7 @@ function FieldEditor(props) {
9355
9476
  onChange: (e) => setRules(rules.map((r, i) => i === index ? withText(r, "example", e.target.value) : r))
9356
9477
  }
9357
9478
  ) : null,
9358
- /* @__PURE__ */ jsx37(
9479
+ /* @__PURE__ */ jsx38(
9359
9480
  Button15,
9360
9481
  {
9361
9482
  type: "button",
@@ -9368,9 +9489,9 @@ function FieldEditor(props) {
9368
9489
  )
9369
9490
  ] }, `${rule.kind}-${index}`))
9370
9491
  ] }),
9371
- editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ jsx37(FieldRulePreview, { field: field2, tableId, rules: editedRules }) : null,
9372
- mutation.error ? /* @__PURE__ */ jsx37(RefusalNotice, { error: mutation.error }) : null,
9373
- notLanded ? /* @__PURE__ */ jsx37(
9492
+ editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ jsx38(FieldRulePreview, { field: field2, tableId, rules: editedRules }) : null,
9493
+ mutation.error ? /* @__PURE__ */ jsx38(RefusalNotice, { error: mutation.error }) : null,
9494
+ notLanded ? /* @__PURE__ */ jsx38(
9374
9495
  RefusalNotice,
9375
9496
  {
9376
9497
  error: (0, refusals_exports.refusal)(
@@ -9380,10 +9501,10 @@ function FieldEditor(props) {
9380
9501
  )
9381
9502
  }
9382
9503
  ) : null,
9383
- rehomeRefused ? /* @__PURE__ */ jsx37(RefusalNotice, { error: rehomeRefused }) : null,
9504
+ rehomeRefused ? /* @__PURE__ */ jsx38(RefusalNotice, { error: rehomeRefused }) : null,
9384
9505
  rehomed ? /* @__PURE__ */ jsxs33("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
9385
- /* @__PURE__ */ jsx37("span", { children: rehomed.said }),
9386
- rehomed.undo ? /* @__PURE__ */ jsx37(
9506
+ /* @__PURE__ */ jsx38("span", { children: rehomed.said }),
9507
+ rehomed.undo ? /* @__PURE__ */ jsx38(
9387
9508
  Button15,
9388
9509
  {
9389
9510
  type: "button",
@@ -9408,18 +9529,18 @@ function FieldEditor(props) {
9408
9529
  children: "Undo"
9409
9530
  }
9410
9531
  ) : null,
9411
- /* @__PURE__ */ jsx37(Button15, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
9532
+ /* @__PURE__ */ jsx38(Button15, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
9412
9533
  ] }) : null,
9413
9534
  reverseRefused ? /* @__PURE__ */ jsxs33("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
9414
- /* @__PURE__ */ jsx37("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
9415
- /* @__PURE__ */ jsx37(RefusalNotice, { error: reverseRefused })
9535
+ /* @__PURE__ */ jsx38("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
9536
+ /* @__PURE__ */ jsx38(RefusalNotice, { error: reverseRefused })
9416
9537
  ] }) : null,
9417
9538
  backfillError ? /* @__PURE__ */ jsxs33("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
9418
- /* @__PURE__ */ jsx37("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
9419
- /* @__PURE__ */ jsx37(RefusalNotice, { error: backfillError })
9539
+ /* @__PURE__ */ jsx38("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
9540
+ /* @__PURE__ */ jsx38(RefusalNotice, { error: backfillError })
9420
9541
  ] }) : null,
9421
9542
  /* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
9422
- /* @__PURE__ */ jsx37(
9543
+ /* @__PURE__ */ jsx38(
9423
9544
  Button15,
9424
9545
  {
9425
9546
  size: "sm",
@@ -9435,8 +9556,8 @@ function FieldEditor(props) {
9435
9556
  children: mutation.saving ? "Saving\u2026" : field2 ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
9436
9557
  }
9437
9558
  ),
9438
- onCancel ? /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
9439
- /* @__PURE__ */ jsx37(
9559
+ onCancel ? /* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
9560
+ /* @__PURE__ */ jsx38(
9440
9561
  "span",
9441
9562
  {
9442
9563
  id: "field-editor-missing",
@@ -9453,10 +9574,10 @@ function FieldEditor(props) {
9453
9574
  the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
9454
9575
  "Remove it" (interface-text: the slot holds a label, never a paragraph). */
9455
9576
  /* @__PURE__ */ jsxs33("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
9456
- /* @__PURE__ */ jsx37("div", { className: cn17("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
9577
+ /* @__PURE__ */ jsx38("div", { className: cn17("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
9457
9578
  /* @__PURE__ */ jsxs33("div", { className: cn17("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
9458
- /* @__PURE__ */ jsx37("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
9459
- /* @__PURE__ */ jsx37(
9579
+ /* @__PURE__ */ jsx38("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
9580
+ /* @__PURE__ */ jsx38(
9460
9581
  Button15,
9461
9582
  {
9462
9583
  size: "sm",
@@ -9469,7 +9590,7 @@ function FieldEditor(props) {
9469
9590
  children: "Remove it"
9470
9591
  }
9471
9592
  ),
9472
- /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
9593
+ /* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
9473
9594
  ] })
9474
9595
  ] })
9475
9596
  ) : null
@@ -9560,10 +9681,10 @@ function formulaSeparatorOf(field2) {
9560
9681
  function TypeQuestions(props) {
9561
9682
  const { type } = props;
9562
9683
  if (type === "entity_reference") {
9563
- return /* @__PURE__ */ jsx37(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
9684
+ return /* @__PURE__ */ jsx38(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
9564
9685
  }
9565
9686
  if (type === "relation") {
9566
- return /* @__PURE__ */ jsx37(
9687
+ return /* @__PURE__ */ jsx38(
9567
9688
  ReferenceBuilder,
9568
9689
  {
9569
9690
  tableId: props.tableId,
@@ -9576,7 +9697,7 @@ function TypeQuestions(props) {
9576
9697
  }
9577
9698
  );
9578
9699
  }
9579
- if (type === "rating" || type === "barcode") return /* @__PURE__ */ jsx37(Fragment12, { children: props.newer });
9700
+ if (type === "rating" || type === "barcode") return /* @__PURE__ */ jsx38(Fragment12, { children: props.newer });
9580
9701
  if (type === "status") {
9581
9702
  return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-3", children: [
9582
9703
  props.choiceList,
@@ -9584,12 +9705,12 @@ function TypeQuestions(props) {
9584
9705
  ] });
9585
9706
  }
9586
9707
  if (type === "select" || type === "multi_select") {
9587
- return /* @__PURE__ */ jsx37(Fragment12, { children: props.choiceList });
9708
+ return /* @__PURE__ */ jsx38(Fragment12, { children: props.choiceList });
9588
9709
  }
9589
9710
  if (type === "currency") {
9590
9711
  return /* @__PURE__ */ jsxs33("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
9591
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "The currency" }),
9592
- /* @__PURE__ */ jsx37(
9712
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "The currency" }),
9713
+ /* @__PURE__ */ jsx38(
9593
9714
  BasicInput8,
9594
9715
  {
9595
9716
  value: props.unit,
@@ -9602,8 +9723,8 @@ function TypeQuestions(props) {
9602
9723
  }
9603
9724
  if (type === "datetime") {
9604
9725
  return /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-1.5", children: [
9605
- /* @__PURE__ */ jsx37(
9606
- Checkbox4,
9726
+ /* @__PURE__ */ jsx38(
9727
+ Checkbox5,
9607
9728
  {
9608
9729
  checked: props.withTime,
9609
9730
  "aria-label": "Include a time of day",
@@ -9616,14 +9737,14 @@ function TypeQuestions(props) {
9616
9737
  if (type === "lookup" || type === "rollup" || type === "count") {
9617
9738
  const usable = props.relations;
9618
9739
  if (usable.length === 0) {
9619
- return /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
9740
+ return /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
9620
9741
  }
9621
9742
  return /* @__PURE__ */ jsxs33("div", { className: "grid gap-3 sm:grid-cols-2", children: [
9622
9743
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9623
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
9744
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
9624
9745
  /* @__PURE__ */ jsxs33(Select5, { value: props.via, onValueChange: props.setVia, children: [
9625
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx37(SelectValue5, { placeholder: "Choose a column" }) }),
9626
- /* @__PURE__ */ jsx37(SelectContent5, { children: usable.map((f) => /* @__PURE__ */ jsxs33(SelectItem5, { value: f.key, children: [
9746
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx38(SelectValue5, { placeholder: "Choose a column" }) }),
9747
+ /* @__PURE__ */ jsx38(SelectContent5, { children: usable.map((f) => /* @__PURE__ */ jsxs33(SelectItem5, { value: f.key, children: [
9627
9748
  fieldName(f),
9628
9749
  isBackLinkSource(f) ? BACK_LINK_SOURCE_SUFFIX : "",
9629
9750
  sourceKindOf(f) === "person" ? " \u2014 a person" : sourceKindOf(f) === "file" ? " \u2014 a file" : "",
@@ -9631,7 +9752,7 @@ function TypeQuestions(props) {
9631
9752
  ] }, f.id)) })
9632
9753
  ] })
9633
9754
  ] }),
9634
- type === "lookup" ? /* @__PURE__ */ jsx37(
9755
+ type === "lookup" ? /* @__PURE__ */ jsx38(
9635
9756
  ValueOnTheOtherSide,
9636
9757
  {
9637
9758
  label: "The value to read",
@@ -9641,12 +9762,12 @@ function TypeQuestions(props) {
9641
9762
  onChange: props.setPick
9642
9763
  }
9643
9764
  ) : type === "count" ? null : /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9644
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "What to work out" }),
9765
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "What to work out" }),
9645
9766
  /* @__PURE__ */ jsxs33(Select5, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
9646
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9647
- /* @__PURE__ */ jsx37(SelectContent5, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx37(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9767
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9768
+ /* @__PURE__ */ jsx38(SelectContent5, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx38(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9648
9769
  ] }),
9649
- props.agg !== "count" ? /* @__PURE__ */ jsx37(
9770
+ props.agg !== "count" ? /* @__PURE__ */ jsx38(
9650
9771
  ValueOnTheOtherSide,
9651
9772
  {
9652
9773
  label: "Of which value",
@@ -9662,21 +9783,21 @@ function TypeQuestions(props) {
9662
9783
  }
9663
9784
  if (type === "formula") {
9664
9785
  if (props.others.length === 0) {
9665
- return /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
9786
+ return /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
9666
9787
  }
9667
9788
  return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2", children: [
9668
9789
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9669
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "What to do" }),
9790
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "What to do" }),
9670
9791
  /* @__PURE__ */ jsxs33(Select5, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
9671
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9672
- /* @__PURE__ */ jsx37(SelectContent5, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx37(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9792
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9793
+ /* @__PURE__ */ jsx38(SelectContent5, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx38(SelectItem5, { value: row.value, children: row.label }, row.value)) })
9673
9794
  ] })
9674
9795
  ] }),
9675
9796
  /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9676
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Which columns" }),
9677
- /* @__PURE__ */ jsx37("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
9797
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Which columns" }),
9798
+ /* @__PURE__ */ jsx38("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
9678
9799
  const picked = props.formulaFields.includes(f.id);
9679
- return /* @__PURE__ */ jsx37(
9800
+ return /* @__PURE__ */ jsx38(
9680
9801
  Button15,
9681
9802
  {
9682
9803
  type: "button",
@@ -9692,8 +9813,8 @@ function TypeQuestions(props) {
9692
9813
  }) })
9693
9814
  ] }),
9694
9815
  props.formulaOp === "concat" ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9695
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
9696
- /* @__PURE__ */ jsx37(
9816
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
9817
+ /* @__PURE__ */ jsx38(
9697
9818
  BasicInput8,
9698
9819
  {
9699
9820
  value: props.formulaSeparator,
@@ -9744,25 +9865,25 @@ function RollupFilterQuestion({
9744
9865
  }) {
9745
9866
  const far = relation?.relation_target ?? null;
9746
9867
  const farFields = useFields4(far);
9747
- const conditionFields = useMemo10(
9868
+ const conditionFields = useMemo11(
9748
9869
  () => (farFields.data ?? []).filter((f) => f.type !== "formula").map((f) => ({ id: f.id, key: f.key, label: fieldName(f), field: f })),
9749
9870
  [farFields.data]
9750
9871
  );
9751
- const lastFar = useRef14(far);
9872
+ const lastFar = useRef13(far);
9752
9873
  useEffect19(() => {
9753
9874
  if (lastFar.current !== null && far !== lastFar.current && !editing) onChange(null);
9754
9875
  lastFar.current = far;
9755
9876
  }, [far, editing, onChange]);
9756
9877
  if (!relation || !far) return null;
9757
- return /* @__PURE__ */ jsx37("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
9878
+ return /* @__PURE__ */ jsx38("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
9758
9879
  /* @__PURE__ */ jsxs33("span", { className: "text-muted-foreground", children: [
9759
9880
  rollupFilterLead(agg),
9760
9881
  " ",
9761
9882
  conditionInWords(value, conditionFields),
9762
9883
  "."
9763
9884
  ] }),
9764
- /* @__PURE__ */ jsx37(Button15, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
9765
- ] }) : /* @__PURE__ */ jsx37(ChoiceListTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx37(
9885
+ /* @__PURE__ */ jsx38(Button15, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
9886
+ ] }) : /* @__PURE__ */ jsx38(ChoiceListTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx38(
9766
9887
  ConditionGroup,
9767
9888
  {
9768
9889
  lead: rollupFilterLead(agg),
@@ -9788,13 +9909,13 @@ function ValueOnTheOtherSide({
9788
9909
  const carried = sample.data?.rows[0]?.document ?? null;
9789
9910
  const offered = declared.length > 0 ? declared.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: humanizeIdentifier2(key) }));
9790
9911
  const stillAsking = columns.loading || declared.length === 0 && sample.loading;
9791
- const body = !relation ? /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx37("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ jsxs33(Select5, { value, onValueChange: onChange, children: [
9792
- /* @__PURE__ */ jsx37(SelectTrigger5, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx37(SelectValue5, { placeholder: "Choose a column" }) }),
9793
- /* @__PURE__ */ jsx37(SelectContent5, { children: offered.map((column) => /* @__PURE__ */ jsx37(SelectItem5, { value: column.key, children: column.name }, column.key)) })
9912
+ const body = !relation ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ jsxs33(Select5, { value, onValueChange: onChange, children: [
9913
+ /* @__PURE__ */ jsx38(SelectTrigger5, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx38(SelectValue5, { placeholder: "Choose a column" }) }),
9914
+ /* @__PURE__ */ jsx38(SelectContent5, { children: offered.map((column) => /* @__PURE__ */ jsx38(SelectItem5, { value: column.key, children: column.name }, column.key)) })
9794
9915
  ] });
9795
- if (compact) return /* @__PURE__ */ jsx37("div", { className: "mt-1 flex flex-col gap-1", children: body });
9916
+ if (compact) return /* @__PURE__ */ jsx38("div", { className: "mt-1 flex flex-col gap-1", children: body });
9796
9917
  return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
9797
- /* @__PURE__ */ jsx37(Label9, { className: "text-xs", title: help, children: label }),
9918
+ /* @__PURE__ */ jsx38(Label10, { className: "text-xs", title: help, children: label }),
9798
9919
  body
9799
9920
  ] });
9800
9921
  }
@@ -9821,17 +9942,17 @@ function NewColumnDefault({
9821
9942
  }) {
9822
9943
  const none = "__none__";
9823
9944
  return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", "data-records-field-default": "", "data-records-new-field-default": "", children: [
9824
- /* @__PURE__ */ jsx37(Label9, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
9945
+ /* @__PURE__ */ jsx38(Label10, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
9825
9946
  type === "checkbox" ? /* @__PURE__ */ jsxs33("label", { className: "flex items-center gap-2", children: [
9826
- /* @__PURE__ */ jsx37(Checkbox4, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
9827
- /* @__PURE__ */ jsx37("span", { children: "Ticked" })
9947
+ /* @__PURE__ */ jsx38(Checkbox5, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
9948
+ /* @__PURE__ */ jsx38("span", { children: "Ticked" })
9828
9949
  ] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ jsxs33(Select5, { value: typeof value === "string" && choices.includes(value) ? value : none, onValueChange: (v) => onChange(v === none ? null : v), children: [
9829
- /* @__PURE__ */ jsx37(SelectTrigger5, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ jsx37(SelectValue5, {}) }),
9950
+ /* @__PURE__ */ jsx38(SelectTrigger5, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ jsx38(SelectValue5, {}) }),
9830
9951
  /* @__PURE__ */ jsxs33(SelectContent5, { children: [
9831
- /* @__PURE__ */ jsx37(SelectItem5, { value: none, children: "Nothing" }),
9832
- choices.map((c) => /* @__PURE__ */ jsx37(SelectItem5, { value: c, children: c }, c))
9952
+ /* @__PURE__ */ jsx38(SelectItem5, { value: none, children: "Nothing" }),
9953
+ choices.map((c) => /* @__PURE__ */ jsx38(SelectItem5, { value: c, children: c }, c))
9833
9954
  ] })
9834
- ] }) : /* @__PURE__ */ jsx37(
9955
+ ] }) : /* @__PURE__ */ jsx38(
9835
9956
  BasicInput8,
9836
9957
  {
9837
9958
  id: "records-new-field-default",
@@ -9846,7 +9967,7 @@ function NewColumnDefault({
9846
9967
  // src/buttonCell.tsx
9847
9968
  import { OutboundLink as OutboundLink7 } from "@ai-matrx/kit/outbound-react";
9848
9969
  import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
9849
- import { Fragment as Fragment13, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
9970
+ import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
9850
9971
  function buttonPressWords(label, pressed) {
9851
9972
  if (pressed.do === "open_url") return `${label} opened ${readableLink(pressed.url)}`;
9852
9973
  if (pressed.do === "add_row") return `${label}: a row was added.`;
@@ -9916,14 +10037,14 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
9916
10037
  const here = useContext3(OpenRecordHereContext);
9917
10038
  const host = useRecordsUi();
9918
10039
  const addsTo = useTable3(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
9919
- const waitingOn = useRef15(0);
10040
+ const waitingOn = useRef14(0);
9920
10041
  useEffect20(() => () => void (waitingOn.current += 1), []);
9921
10042
  if (!b) return null;
9922
10043
  const color = isStyleColor(b.color) ? CHOICE_CHIP_CLASS[b.color] : NEUTRAL_CHIP_CLASS;
9923
10044
  if (beforeSave) {
9924
10045
  return /* @__PURE__ */ jsxs34("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field2.key, children: [
9925
- /* @__PURE__ */ jsx38(Button16, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field2.key}-before-save`, "data-records-button": field2.key, className: cn18("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ jsx38("span", { className: "truncate", children: b.label }) }),
9926
- /* @__PURE__ */ jsx38("span", { id: `${field2.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
10046
+ /* @__PURE__ */ jsx39(Button16, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field2.key}-before-save`, "data-records-button": field2.key, className: cn18("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ jsx39("span", { className: "truncate", children: b.label }) }),
10047
+ /* @__PURE__ */ jsx39("span", { id: `${field2.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
9927
10048
  ] });
9928
10049
  }
9929
10050
  const needs = buttonNeeds2(b);
@@ -10031,7 +10152,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
10031
10152
  setSaid(null);
10032
10153
  },
10033
10154
  children: [
10034
- /* @__PURE__ */ jsx38(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx38(
10155
+ /* @__PURE__ */ jsx39(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx39(
10035
10156
  Button16,
10036
10157
  {
10037
10158
  type: "button",
@@ -10050,22 +10171,22 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
10050
10171
  event.preventDefault();
10051
10172
  void press();
10052
10173
  },
10053
- children: /* @__PURE__ */ jsx38("span", { className: cn18("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
10174
+ children: /* @__PURE__ */ jsx39("span", { className: cn18("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
10054
10175
  }
10055
10176
  ) }),
10056
10177
  /* @__PURE__ */ jsxs34(PopoverContent4, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
10057
- said2?.kind === "refused" ? /* @__PURE__ */ jsx38(RefusalLine, { error: said2.error }) : null,
10058
- said2?.kind === "waiting" ? /* @__PURE__ */ jsx38("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
10059
- said2?.kind === "failed" ? /* @__PURE__ */ jsx38(ErrorBox2, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
10060
- said2?.kind === "public" ? /* @__PURE__ */ jsx38("p", { children: "Buttons run for signed-in people." }) : null,
10178
+ said2?.kind === "refused" ? /* @__PURE__ */ jsx39(RefusalLine, { error: said2.error }) : null,
10179
+ said2?.kind === "waiting" ? /* @__PURE__ */ jsx39("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
10180
+ said2?.kind === "failed" ? /* @__PURE__ */ jsx39(ErrorBox2, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
10181
+ said2?.kind === "public" ? /* @__PURE__ */ jsx39("p", { children: "Buttons run for signed-in people." }) : null,
10061
10182
  said2?.kind === "ran" ? /* @__PURE__ */ jsxs34("div", { className: "break-words", children: [
10062
- said2.value ? /* @__PURE__ */ jsx38(StructuredValueView, { structured: said2.value, label: b.label }) : null,
10183
+ said2.value ? /* @__PURE__ */ jsx39(StructuredValueView, { structured: said2.value, label: b.label }) : null,
10063
10184
  said2.says,
10064
10185
  " ",
10065
- said2.link ? /* @__PURE__ */ jsx38(OutboundLink7, { href: said2.link, className: "text-primary underline", children: readableLink(said2.link) }) : null
10186
+ said2.link ? /* @__PURE__ */ jsx39(OutboundLink7, { href: said2.link, className: "text-primary underline", children: readableLink(said2.link) }) : null
10066
10187
  ] }) : null,
10067
10188
  said2?.kind === "needs" ? /* @__PURE__ */ jsxs34(Fragment13, { children: [
10068
- /* @__PURE__ */ jsx38("p", { children: said2.says }),
10189
+ /* @__PURE__ */ jsx39("p", { children: said2.says }),
10069
10190
  tableId ? /* @__PURE__ */ jsxs34(
10070
10191
  Button16,
10071
10192
  {
@@ -10087,20 +10208,20 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
10087
10208
  ]
10088
10209
  }
10089
10210
  ),
10090
- settingUp && tableId ? /* @__PURE__ */ jsx38(Dialog3, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs34(DialogContent3, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
10211
+ settingUp && tableId ? /* @__PURE__ */ jsx39(Dialog3, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs34(DialogContent3, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
10091
10212
  /* @__PURE__ */ jsxs34(DialogHeader3, { children: [
10092
- /* @__PURE__ */ jsx38(DialogTitle3, { children: `Column settings \xB7 ${fieldName(field2)}` }),
10093
- /* @__PURE__ */ jsx38(DialogDescription, { className: "sr-only", children: "What the button does" })
10213
+ /* @__PURE__ */ jsx39(DialogTitle3, { children: `Column settings \xB7 ${fieldName(field2)}` }),
10214
+ /* @__PURE__ */ jsx39(DialogDescription, { className: "sr-only", children: "What the button does" })
10094
10215
  ] }),
10095
- /* @__PURE__ */ jsx38(FieldEditor, { tableId, field: field2, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
10216
+ /* @__PURE__ */ jsx39(FieldEditor, { tableId, field: field2, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
10096
10217
  ] }) }) : null
10097
10218
  ] });
10098
10219
  }
10099
10220
 
10100
10221
  // src/FloatingRefusal.tsx
10101
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef16, useState as useState29 } from "react";
10222
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef15, useState as useState29 } from "react";
10102
10223
  import { createPortal } from "react-dom";
10103
- import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
10224
+ import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
10104
10225
  var GAP2 = 4;
10105
10226
  function placeFor(anchor, note) {
10106
10227
  const a = anchor.getBoundingClientRect();
@@ -10116,8 +10237,8 @@ function placeFor(anchor, note) {
10116
10237
  return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
10117
10238
  }
10118
10239
  function FloatingRefusal({ text, why }) {
10119
- const spot = useRef16(null);
10120
- const note = useRef16(null);
10240
+ const spot = useRef15(null);
10241
+ const note = useRef15(null);
10121
10242
  const [style, setStyle] = useState29(null);
10122
10243
  const [floating, setFloating] = useState29(false);
10123
10244
  useLayoutEffect2(() => {
@@ -10138,12 +10259,12 @@ function FloatingRefusal({ text, why }) {
10138
10259
  };
10139
10260
  }, [text]);
10140
10261
  if (!floating) {
10141
- return /* @__PURE__ */ jsx39("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
10262
+ return /* @__PURE__ */ jsx40("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
10142
10263
  }
10143
10264
  return /* @__PURE__ */ jsxs35(Fragment14, { children: [
10144
- /* @__PURE__ */ jsx39("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
10265
+ /* @__PURE__ */ jsx40("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
10145
10266
  typeof document === "undefined" ? null : createPortal(
10146
- /* @__PURE__ */ jsx39(
10267
+ /* @__PURE__ */ jsx40(
10147
10268
  "span",
10148
10269
  {
10149
10270
  ref: note,
@@ -10162,10 +10283,10 @@ function FloatingRefusal({ text, why }) {
10162
10283
  }
10163
10284
 
10164
10285
  // src/formatControls.tsx
10165
- import { useEffect as useEffect21, useRef as useRef17, useState as useState30 } from "react";
10286
+ import { useEffect as useEffect21, useRef as useRef16, useState as useState30 } from "react";
10166
10287
  import { BasicInput as BasicInput9, BasicTextarea as BasicTextarea4 } from "@ai-matrx/design-system";
10167
10288
  import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
10168
- import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
10289
+ import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
10169
10290
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
10170
10291
  function scaled(format) {
10171
10292
  return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
@@ -10183,12 +10304,12 @@ function keptValue(format, raw) {
10183
10304
  }
10184
10305
  function NumberInFormat({ format, value, onChange, disabled, id }) {
10185
10306
  const [text, setText] = useState30(() => typedText(format, value));
10186
- const lastSent = useRef17(void 0);
10307
+ const lastSent = useRef16(void 0);
10187
10308
  useEffect21(() => {
10188
10309
  if (value === lastSent.current) return;
10189
10310
  setText(typedText(format, value));
10190
10311
  }, [value, format]);
10191
- return /* @__PURE__ */ jsx40(
10312
+ return /* @__PURE__ */ jsx41(
10192
10313
  BasicInput9,
10193
10314
  {
10194
10315
  id,
@@ -10213,21 +10334,21 @@ function formatControl(args) {
10213
10334
  const look = fieldLookFor(def.id);
10214
10335
  if (look?.Editor) {
10215
10336
  const Editor = look.Editor;
10216
- return /* @__PURE__ */ jsx40(Editor, { value, format, onChange, disabled, id, label });
10337
+ return /* @__PURE__ */ jsx41(Editor, { value, format, onChange, disabled, id, label });
10217
10338
  }
10218
10339
  const text = value === null || value === void 0 ? "" : String(value);
10219
10340
  const commit = (raw) => onChange(raw === "" ? null : parseFieldInput(raw, format));
10220
10341
  if (def.id === "rating") {
10221
- return disabled ? /* @__PURE__ */ jsx40(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx40("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx40(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
10342
+ return disabled ? /* @__PURE__ */ jsx41(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx41("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx41(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
10222
10343
  }
10223
- if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx40(NumberInFormat, { ...args });
10344
+ if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx41(NumberInFormat, { ...args });
10224
10345
  switch (def.editor) {
10225
10346
  // A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
10226
10347
  // (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
10227
10348
  case "email":
10228
10349
  case "url":
10229
10350
  case "tel":
10230
- return /* @__PURE__ */ jsx40(
10351
+ return /* @__PURE__ */ jsx41(
10231
10352
  BasicInput9,
10232
10353
  {
10233
10354
  id,
@@ -10241,7 +10362,7 @@ function formatControl(args) {
10241
10362
  );
10242
10363
  case "color":
10243
10364
  return /* @__PURE__ */ jsxs36("span", { className: "flex items-center gap-2", children: [
10244
- /* @__PURE__ */ jsx40(
10365
+ /* @__PURE__ */ jsx41(
10245
10366
  BasicInput9,
10246
10367
  {
10247
10368
  id: `${id}-swatch`,
@@ -10253,10 +10374,10 @@ function formatControl(args) {
10253
10374
  onChange: (e) => commit(e.target.value)
10254
10375
  }
10255
10376
  ),
10256
- /* @__PURE__ */ jsx40(BasicInput9, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
10377
+ /* @__PURE__ */ jsx41(BasicInput9, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
10257
10378
  ] });
10258
10379
  case "textarea":
10259
- return /* @__PURE__ */ jsx40(BasicTextarea4, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
10380
+ return /* @__PURE__ */ jsx41(BasicTextarea4, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
10260
10381
  default:
10261
10382
  return null;
10262
10383
  }
@@ -10266,7 +10387,7 @@ function formatControl(args) {
10266
10387
  import { useState as useState31 } from "react";
10267
10388
  import { Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn19 } from "@ai-matrx/design-system";
10268
10389
  import { readTypedDate, readTypedTime, typedDateText, typedTimeText, wallPartsInZone } from "@ai-matrx/records";
10269
- import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
10390
+ import { jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
10270
10391
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
10271
10392
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
10272
10393
  function pad(n) {
@@ -10296,14 +10417,14 @@ function wordsFor2(kind, day, time) {
10296
10417
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
10297
10418
  function CalendarGlyph() {
10298
10419
  return /* @__PURE__ */ jsxs37("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
10299
- /* @__PURE__ */ jsx41("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
10300
- /* @__PURE__ */ jsx41("path", { d: "M16 2v4M8 2v4M3 10h18" })
10420
+ /* @__PURE__ */ jsx42("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
10421
+ /* @__PURE__ */ jsx42("path", { d: "M16 2v4M8 2v4M3 10h18" })
10301
10422
  ] });
10302
10423
  }
10303
10424
  function ClockGlyph() {
10304
10425
  return /* @__PURE__ */ jsxs37("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
10305
- /* @__PURE__ */ jsx41("circle", { cx: "12", cy: "12", r: "10" }),
10306
- /* @__PURE__ */ jsx41("path", { d: "M12 6v6l4 2" })
10426
+ /* @__PURE__ */ jsx42("circle", { cx: "12", cy: "12", r: "10" }),
10427
+ /* @__PURE__ */ jsx42("path", { d: "M12 6v6l4 2" })
10307
10428
  ] });
10308
10429
  }
10309
10430
  function TypedDateHelper({
@@ -10345,7 +10466,7 @@ function TypedDateHelper({
10345
10466
  setMonth({ y: at.getFullYear(), m: at.getMonth() });
10346
10467
  };
10347
10468
  return /* @__PURE__ */ jsxs37(Popover5, { open, onOpenChange: setOpen, children: [
10348
- /* @__PURE__ */ jsx41(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx41(
10469
+ /* @__PURE__ */ jsx42(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx42(
10349
10470
  "button",
10350
10471
  {
10351
10472
  type: "button",
@@ -10354,10 +10475,10 @@ function TypedDateHelper({
10354
10475
  "aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
10355
10476
  title: kind === "time" ? "Pick a time" : "Pick a date",
10356
10477
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
10357
- children: kind === "time" ? /* @__PURE__ */ jsx41(ClockGlyph, {}) : /* @__PURE__ */ jsx41(CalendarGlyph, {})
10478
+ children: kind === "time" ? /* @__PURE__ */ jsx42(ClockGlyph, {}) : /* @__PURE__ */ jsx42(CalendarGlyph, {})
10358
10479
  }
10359
10480
  ) }),
10360
- /* @__PURE__ */ jsx41(
10481
+ /* @__PURE__ */ jsx42(
10361
10482
  PopoverContent5,
10362
10483
  {
10363
10484
  sizing: "content",
@@ -10370,20 +10491,20 @@ function TypedDateHelper({
10370
10491
  children: /* @__PURE__ */ jsxs37("div", { className: "flex gap-2", children: [
10371
10492
  kind === "time" ? null : /* @__PURE__ */ jsxs37("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
10372
10493
  /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between text-xs font-medium", children: [
10373
- /* @__PURE__ */ jsx41("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
10494
+ /* @__PURE__ */ jsx42("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
10374
10495
  /* @__PURE__ */ jsxs37("span", { children: [
10375
10496
  MONTHS[shown2.m],
10376
10497
  " ",
10377
10498
  shown2.y
10378
10499
  ] }),
10379
- /* @__PURE__ */ jsx41("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
10500
+ /* @__PURE__ */ jsx42("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
10380
10501
  ] }),
10381
10502
  /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
10382
- WEEK.map((w) => /* @__PURE__ */ jsx41("span", { className: "text-muted-foreground", children: w }, w)),
10503
+ WEEK.map((w) => /* @__PURE__ */ jsx42("span", { className: "text-muted-foreground", children: w }, w)),
10383
10504
  cells.map((d, i) => {
10384
- if (d === null) return /* @__PURE__ */ jsx41("span", {}, `blank-${i}`);
10505
+ if (d === null) return /* @__PURE__ */ jsx42("span", {}, `blank-${i}`);
10385
10506
  const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
10386
- return /* @__PURE__ */ jsx41(
10507
+ return /* @__PURE__ */ jsx42(
10387
10508
  "button",
10388
10509
  {
10389
10510
  type: "button",
@@ -10402,7 +10523,7 @@ function TypedDateHelper({
10402
10523
  })
10403
10524
  ] })
10404
10525
  ] }),
10405
- kind === "date" ? null : /* @__PURE__ */ jsx41("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx41(
10526
+ kind === "date" ? null : /* @__PURE__ */ jsx42("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx42(
10406
10527
  "button",
10407
10528
  {
10408
10529
  type: "button",
@@ -10424,7 +10545,7 @@ function TypedDateHelper({
10424
10545
  }
10425
10546
 
10426
10547
  // src/editors.tsx
10427
- import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
10548
+ import { Fragment as Fragment15, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
10428
10549
  var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
10429
10550
  function isChoiceAddition(value) {
10430
10551
  return typeof value === "object" && value !== null && value.addingChoices === true;
@@ -10455,20 +10576,20 @@ function ChoiceAskButtons({
10455
10576
  busy
10456
10577
  }) {
10457
10578
  return /* @__PURE__ */ jsxs38("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field2, words), className: "flex flex-col gap-1", children: [
10458
- /* @__PURE__ */ jsx42("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field2, words) }),
10579
+ /* @__PURE__ */ jsx43("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field2, words) }),
10459
10580
  /* @__PURE__ */ jsxs38("span", { className: "flex flex-wrap items-center gap-1", children: [
10460
- /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
10461
- keepOffered ? /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
10462
- /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
10581
+ /* @__PURE__ */ jsx43(Button17, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
10582
+ keepOffered ? /* @__PURE__ */ jsx43(Button17, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
10583
+ /* @__PURE__ */ jsx43(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
10463
10584
  ] })
10464
10585
  ] });
10465
10586
  }
10466
10587
  var FORMAT_BLIND_KINDS = /* @__PURE__ */ new Set(["formula", "lookup", "rollup", "json", "checkbox", "select", "multi_select", "member", "entity_reference", "relation", "attachment", "datetime"]);
10467
10588
  function FieldLabel({ field: field2, htmlFor, children }) {
10468
10589
  return /* @__PURE__ */ jsxs38("div", { className: "flex items-baseline gap-1.5", children: [
10469
- /* @__PURE__ */ jsx42(Label10, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
10470
- field2.required ? /* @__PURE__ */ jsx42("span", { className: "text-xs text-destructive", children: "required" }) : null,
10471
- field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */ jsx42("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
10590
+ /* @__PURE__ */ jsx43(Label11, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
10591
+ field2.required ? /* @__PURE__ */ jsx43("span", { className: "text-xs text-destructive", children: "required" }) : null,
10592
+ field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */ jsx43("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
10472
10593
  children
10473
10594
  ] });
10474
10595
  }
@@ -10597,7 +10718,7 @@ function draftFromTyping(field2, seed) {
10597
10718
  return { typedDraft: true, text: seed, judged: judgeTyped(field2, seed) };
10598
10719
  }
10599
10720
  function ReadsAsNote({ typed, always, children }) {
10600
- const note = useRef18(null);
10721
+ const note = useRef17(null);
10601
10722
  const [repeats, setRepeats] = useState32(false);
10602
10723
  useLayoutEffect3(() => {
10603
10724
  if (always) return;
@@ -10605,7 +10726,7 @@ function ReadsAsNote({ typed, always, children }) {
10605
10726
  setRepeats(words(note.current?.textContent) === words(typed));
10606
10727
  }, [typed, always]);
10607
10728
  if (repeats) return null;
10608
- return /* @__PURE__ */ jsx42("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
10729
+ return /* @__PURE__ */ jsx43("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
10609
10730
  }
10610
10731
  function TypedTextControl({ field: field2, value, onChange, disabled, id, onCommit, onCancel }) {
10611
10732
  const client = useOptionalRecordsClient12();
@@ -10635,7 +10756,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
10635
10756
  judged: judgeTyped(field2, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
10636
10757
  ...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
10637
10758
  });
10638
- const box = /* @__PURE__ */ jsx42(
10759
+ const box = /* @__PURE__ */ jsx43(
10639
10760
  BasicInput10,
10640
10761
  {
10641
10762
  id,
@@ -10650,13 +10771,13 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
10650
10771
  return /* @__PURE__ */ jsxs38("span", { className: "flex flex-col gap-0.5", children: [
10651
10772
  helper && !disabled ? /* @__PURE__ */ jsxs38("span", { className: "flex min-w-0 items-center gap-0.5", children: [
10652
10773
  box,
10653
- /* @__PURE__ */ jsx42(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
10774
+ /* @__PURE__ */ jsx43(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
10654
10775
  ] }) : box,
10655
10776
  judged === null ? /* @__PURE__ */ jsxs38("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
10656
10777
  "Reading ",
10657
10778
  fieldName(field2),
10658
10779
  "'s choices\u2026"
10659
- ] }) : "ask" in judged ? /* @__PURE__ */ jsx42(
10780
+ ] }) : "ask" in judged ? /* @__PURE__ */ jsx43(
10660
10781
  ChoiceAskButtons,
10661
10782
  {
10662
10783
  field: field2,
@@ -10673,8 +10794,8 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
10673
10794
  onCancel: () => onCancel?.()
10674
10795
  }
10675
10796
  ) : "refusal" in judged ? /* @__PURE__ */ jsxs38(Fragment15, { children: [
10676
- /* @__PURE__ */ jsx42(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
10677
- judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx42("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
10797
+ /* @__PURE__ */ jsx43(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
10798
+ judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx43("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx43(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
10678
10799
  ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs38(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
10679
10800
  isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field2)}. ` : null,
10680
10801
  "Reads as",
@@ -10686,7 +10807,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
10686
10807
  }).join(", ")
10687
10808
  ) : (() => {
10688
10809
  const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field2, judged.value) ? "datetime" : "date" } : void 0);
10689
- return shown2 ? /* @__PURE__ */ jsx42(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
10810
+ return shown2 ? /* @__PURE__ */ jsx43(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
10690
10811
  })()
10691
10812
  ] }, value.text)
10692
10813
  ] });
@@ -10700,19 +10821,19 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10700
10821
  const kind = editorKindFor(field2);
10701
10822
  const inputId = id ?? `field-${field2.key}`;
10702
10823
  const ownDetails = useOptionalRecordsClient12() === null;
10703
- if (isTypedDraft(value)) return /* @__PURE__ */ jsx42(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
10704
- if (isSignatureField(field2)) return /* @__PURE__ */ jsx42(SignaturePad, { id: inputId, value, onChange, disabled });
10705
- if (isButtonField2(field2)) return /* @__PURE__ */ jsx42(ButtonValue, { field: field2, recordId: recordId ?? null, beforeSave: !recordId });
10824
+ if (isTypedDraft(value)) return /* @__PURE__ */ jsx43(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
10825
+ if (isSignatureField(field2)) return /* @__PURE__ */ jsx43(SignaturePad, { id: inputId, value, onChange, disabled });
10826
+ if (isButtonField2(field2)) return /* @__PURE__ */ jsx43(ButtonValue, { field: field2, recordId: recordId ?? null, beforeSave: !recordId });
10706
10827
  const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
10707
10828
  if (newerControl !== void 0) return newerControl;
10708
10829
  const format = formatForField(field2);
10709
- if (format && format.id === "time") return /* @__PURE__ */ jsx42(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
10830
+ if (format && format.id === "time") return /* @__PURE__ */ jsx43(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
10710
10831
  if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
10711
10832
  const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field2), ownDetails });
10712
10833
  if (own3) return own3;
10713
10834
  }
10714
10835
  if ((kind === "text" || kind === "long_text") && typeof value === "string" && /^\s*(?:\[|\{|```json)/.test(value)) {
10715
- return /* @__PURE__ */ jsx42(StructuredTextControl, { field: field2, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
10836
+ return /* @__PURE__ */ jsx43(StructuredTextControl, { field: field2, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
10716
10837
  }
10717
10838
  switch (kind) {
10718
10839
  case "formula":
@@ -10726,7 +10847,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10726
10847
  ] })
10727
10848
  ] });
10728
10849
  case "json":
10729
- return /* @__PURE__ */ jsx42(JsonControl, { field: field2, value, onChange, disabled, id: inputId });
10850
+ return /* @__PURE__ */ jsx43(JsonControl, { field: field2, value, onChange, disabled, id: inputId });
10730
10851
  case "long_text":
10731
10852
  if (host.textBox) {
10732
10853
  return host.textBox({
@@ -10739,7 +10860,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10739
10860
  disabled
10740
10861
  });
10741
10862
  }
10742
- return /* @__PURE__ */ jsx42(
10863
+ return /* @__PURE__ */ jsx43(
10743
10864
  BasicTextarea5,
10744
10865
  {
10745
10866
  id: inputId,
@@ -10752,7 +10873,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10752
10873
  case "number":
10753
10874
  case "currency":
10754
10875
  case "percent":
10755
- return /* @__PURE__ */ jsx42(
10876
+ return /* @__PURE__ */ jsx43(
10756
10877
  BasicInput10,
10757
10878
  {
10758
10879
  id: inputId,
@@ -10765,11 +10886,11 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10765
10886
  }
10766
10887
  );
10767
10888
  case "datetime":
10768
- return /* @__PURE__ */ jsx42(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
10889
+ return /* @__PURE__ */ jsx43(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
10769
10890
  case "email":
10770
10891
  case "phone":
10771
10892
  case "url":
10772
- return /* @__PURE__ */ jsx42(
10893
+ return /* @__PURE__ */ jsx43(
10773
10894
  BasicInput10,
10774
10895
  {
10775
10896
  id: inputId,
@@ -10782,25 +10903,25 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10782
10903
  }
10783
10904
  );
10784
10905
  case "checkbox":
10785
- return /* @__PURE__ */ jsx42(CheckboxControl, { field: field2, value, onChange, disabled, id: inputId });
10906
+ return /* @__PURE__ */ jsx43(CheckboxControl, { field: field2, value, onChange, disabled, id: inputId });
10786
10907
  case "select":
10787
10908
  case "multi_select":
10788
- return /* @__PURE__ */ jsx42(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
10909
+ return /* @__PURE__ */ jsx43(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
10789
10910
  case "member":
10790
- return /* @__PURE__ */ jsx42(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
10911
+ return /* @__PURE__ */ jsx43(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
10791
10912
  case "entity_reference":
10792
- return /* @__PURE__ */ jsx42(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
10913
+ return /* @__PURE__ */ jsx43(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
10793
10914
  case "attachment":
10794
10915
  if (hostTakesFiles(host)) {
10795
- return /* @__PURE__ */ jsx42(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
10916
+ return /* @__PURE__ */ jsx43(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
10796
10917
  }
10797
- return /* @__PURE__ */ jsx42(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
10918
+ return /* @__PURE__ */ jsx43(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
10798
10919
  case "relation":
10799
- return /* @__PURE__ */ jsx42(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
10920
+ return /* @__PURE__ */ jsx43(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
10800
10921
  default:
10801
10922
  if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
10802
- return /* @__PURE__ */ jsx42(
10803
- Checkbox5,
10923
+ return /* @__PURE__ */ jsx43(
10924
+ Checkbox6,
10804
10925
  {
10805
10926
  id: inputId,
10806
10927
  checked: value === true,
@@ -10809,7 +10930,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
10809
10930
  }
10810
10931
  );
10811
10932
  }
10812
- return /* @__PURE__ */ jsx42(
10933
+ return /* @__PURE__ */ jsx43(
10813
10934
  BasicInput10,
10814
10935
  {
10815
10936
  id: inputId,
@@ -10825,7 +10946,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
10825
10946
  const [text, setText] = useState32(() => openingText(field2, value));
10826
10947
  const [refusal, setRefusal] = useState32(null);
10827
10948
  const [why, setWhy] = useState32(void 0);
10828
- const sent = useRef18(value);
10949
+ const sent = useRef17(value);
10829
10950
  useEffect22(() => {
10830
10951
  if (value === sent.current) return;
10831
10952
  sent.current = value;
@@ -10847,7 +10968,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
10847
10968
  };
10848
10969
  return /* @__PURE__ */ jsxs38("span", { className: "flex flex-col gap-0.5", children: [
10849
10970
  /* @__PURE__ */ jsxs38("span", { className: "flex min-w-0 items-center gap-0.5", children: [
10850
- /* @__PURE__ */ jsx42(
10971
+ /* @__PURE__ */ jsx43(
10851
10972
  BasicInput10,
10852
10973
  {
10853
10974
  id,
@@ -10864,9 +10985,9 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
10864
10985
  }
10865
10986
  }
10866
10987
  ),
10867
- helper && !disabled ? /* @__PURE__ */ jsx42(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field2) }) : null
10988
+ helper && !disabled ? /* @__PURE__ */ jsx43(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field2) }) : null
10868
10989
  ] }),
10869
- refusal ? /* @__PURE__ */ jsx42(FloatingRefusal, { text: refusal, why }) : null
10990
+ refusal ? /* @__PURE__ */ jsx43(FloatingRefusal, { text: refusal, why }) : null
10870
10991
  ] });
10871
10992
  }
10872
10993
  function typedDatePlaceholder(helper) {
@@ -10878,8 +10999,8 @@ function typedDatePlaceholder(helper) {
10878
10999
  function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
10879
11000
  const unanswered = value === null || value === void 0;
10880
11001
  return /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
10881
- /* @__PURE__ */ jsx42(
10882
- Checkbox5,
11002
+ /* @__PURE__ */ jsx43(
11003
+ Checkbox6,
10883
11004
  {
10884
11005
  id,
10885
11006
  checked: value === true,
@@ -10888,9 +11009,9 @@ function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
10888
11009
  onCheckedChange: (next) => onChange(next === true)
10889
11010
  }
10890
11011
  ),
10891
- unanswered ? /* @__PURE__ */ jsx42("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs38(Fragment15, { children: [
10892
- /* @__PURE__ */ jsx42("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
10893
- field2.required ? null : /* @__PURE__ */ jsx42(
11012
+ unanswered ? /* @__PURE__ */ jsx43("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs38(Fragment15, { children: [
11013
+ /* @__PURE__ */ jsx43("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
11014
+ field2.required ? null : /* @__PURE__ */ jsx43(
10894
11015
  Button17,
10895
11016
  {
10896
11017
  size: "sm",
@@ -10908,7 +11029,7 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
10908
11029
  const text = typeof value === "string" ? value : "";
10909
11030
  const reads = structuredOf(text) !== null;
10910
11031
  return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1", "data-records-structured-editor": "", children: [
10911
- /* @__PURE__ */ jsx42(
11032
+ /* @__PURE__ */ jsx43(
10912
11033
  BasicTextarea5,
10913
11034
  {
10914
11035
  id,
@@ -10920,7 +11041,7 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
10920
11041
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
10921
11042
  }
10922
11043
  ),
10923
- /* @__PURE__ */ jsx42("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ jsx42(
11044
+ /* @__PURE__ */ jsx43("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ jsx43(
10924
11045
  Button17,
10925
11046
  {
10926
11047
  type: "button",
@@ -10932,7 +11053,7 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
10932
11053
  "data-records-structured-format": "",
10933
11054
  children: "Format"
10934
11055
  }
10935
- ) : /* @__PURE__ */ jsx42("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
11056
+ ) : /* @__PURE__ */ jsx43("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
10936
11057
  ] });
10937
11058
  }
10938
11059
  function JsonControl({ field: field2, value, onChange, disabled, id }) {
@@ -10940,7 +11061,7 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
10940
11061
  const [text, setText] = useState32(initial);
10941
11062
  const [broken, setBroken] = useState32(null);
10942
11063
  return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1", children: [
10943
- /* @__PURE__ */ jsx42(
11064
+ /* @__PURE__ */ jsx43(
10944
11065
  BasicTextarea5,
10945
11066
  {
10946
11067
  id,
@@ -10975,7 +11096,7 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
10975
11096
  broken ? (
10976
11097
  // The typed text is still in the box: the notice owns the two doors out. In a grid cell it
10977
11098
  // floats over the table (`data-records-cell-note`), so the row never grows.
10978
- /* @__PURE__ */ jsx42("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx42(
11099
+ /* @__PURE__ */ jsx43("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx43(
10979
11100
  RefusalNotice,
10980
11101
  {
10981
11102
  error: broken,
@@ -11017,11 +11138,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11017
11138
  }, [client, field2.id, reread]);
11018
11139
  const handed = publicChoicesOf(field2);
11019
11140
  if (!client && handed.length > 0) {
11020
- return /* @__PURE__ */ jsx42(ChoiceAnswer, { field: field2, choices: handed, value, onChange, disabled, id, onChosen });
11141
+ return /* @__PURE__ */ jsx43(ChoiceAnswer, { field: field2, choices: handed, value, onChange, disabled, id, onChosen });
11021
11142
  }
11022
11143
  if (!client) {
11023
11144
  return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1", children: [
11024
- /* @__PURE__ */ jsx42(
11145
+ /* @__PURE__ */ jsx43(
11025
11146
  BasicInput10,
11026
11147
  {
11027
11148
  id,
@@ -11030,15 +11151,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11030
11151
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
11031
11152
  }
11032
11153
  ),
11033
- /* @__PURE__ */ jsx42("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." })
11154
+ /* @__PURE__ */ jsx43("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." })
11034
11155
  ] });
11035
11156
  }
11036
11157
  if (refusal)
11037
- return /* @__PURE__ */ jsx42("div", { id, children: /* @__PURE__ */ jsx42(RefusalLine, { error: refusal }) });
11038
- if (!options) return /* @__PURE__ */ jsx42("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
11158
+ return /* @__PURE__ */ jsx43("div", { id, children: /* @__PURE__ */ jsx43(RefusalLine, { error: refusal }) });
11159
+ if (!options) return /* @__PURE__ */ jsx43("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
11039
11160
  if (asForm && options.length > 0) {
11040
11161
  const titled = (option) => recordName(option.data, null, "Unnamed choice");
11041
- return /* @__PURE__ */ jsx42(
11162
+ return /* @__PURE__ */ jsx43(
11042
11163
  ChoiceAnswer,
11043
11164
  {
11044
11165
  field: field2,
@@ -11056,7 +11177,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11056
11177
  );
11057
11178
  }
11058
11179
  const noChoicesYet = client && options.length === 0 && !disabled;
11059
- const offerChoices = noChoicesYet ? /* @__PURE__ */ jsx42(
11180
+ const offerChoices = noChoicesYet ? /* @__PURE__ */ jsx43(
11060
11181
  AddChoicesInline,
11061
11182
  {
11062
11183
  field: field2,
@@ -11069,7 +11190,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11069
11190
  if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
11070
11191
  return /* @__PURE__ */ jsxs38(Fragment15, { children: [
11071
11192
  offerChoices,
11072
- /* @__PURE__ */ jsx42(
11193
+ /* @__PURE__ */ jsx43(
11073
11194
  OpenChoicePicker,
11074
11195
  {
11075
11196
  field: field2,
@@ -11093,13 +11214,13 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11093
11214
  ] });
11094
11215
  }
11095
11216
  if (options.length === 0) {
11096
- return /* @__PURE__ */ jsx42("p", { id, className: "text-xs text-muted-foreground", children: field2.options_table_id ? `${fieldName(field2)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field2)} 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.` });
11217
+ return /* @__PURE__ */ jsx43("p", { id, className: "text-xs text-muted-foreground", children: field2.options_table_id ? `${fieldName(field2)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field2)} 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.` });
11097
11218
  }
11098
11219
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
11099
11220
  if (field2.multi) {
11100
11221
  const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
11101
11222
  const picked = new Set(chosen.map((option) => optionKey4(option)));
11102
- const toggles = /* @__PURE__ */ jsx42("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx42(
11223
+ const toggles = /* @__PURE__ */ jsx43("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx43(
11103
11224
  Button17,
11104
11225
  {
11105
11226
  type: "button",
@@ -11125,8 +11246,8 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11125
11246
  if (!open) onClose?.();
11126
11247
  },
11127
11248
  children: [
11128
- /* @__PURE__ */ jsx42(PopoverTrigger6, { asChild: true, children: /* @__PURE__ */ jsx42(Button17, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
11129
- /* @__PURE__ */ jsx42(PopoverContent6, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
11249
+ /* @__PURE__ */ jsx43(PopoverTrigger6, { asChild: true, children: /* @__PURE__ */ jsx43(Button17, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
11250
+ /* @__PURE__ */ jsx43(PopoverContent6, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
11130
11251
  ]
11131
11252
  }
11132
11253
  );
@@ -11146,8 +11267,8 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11146
11267
  }
11147
11268
  } : {},
11148
11269
  children: [
11149
- /* @__PURE__ */ jsx42(SelectTrigger6, { id, size: "sm", children: /* @__PURE__ */ jsx42(SelectValue6, { placeholder: "Choose" }) }),
11150
- /* @__PURE__ */ jsx42(SelectContent6, { children: options.map((option) => /* @__PURE__ */ jsx42(SelectItem6, { value: optionKey4(option), children: titleOf(option) }, option.id)) })
11270
+ /* @__PURE__ */ jsx43(SelectTrigger6, { id, size: "sm", children: /* @__PURE__ */ jsx43(SelectValue6, { placeholder: "Choose" }) }),
11271
+ /* @__PURE__ */ jsx43(SelectContent6, { children: options.map((option) => /* @__PURE__ */ jsx43(SelectItem6, { value: optionKey4(option), children: titleOf(option) }, option.id)) })
11151
11272
  ]
11152
11273
  }
11153
11274
  );
@@ -11170,7 +11291,7 @@ function OpenChoicePicker({
11170
11291
  const client = useOptionalRecordsClient12();
11171
11292
  const nudge = useChoiceNudge();
11172
11293
  const [open, setOpenState] = useState32(autoOpen === true);
11173
- const onCloseRef = useRef18(onClose);
11294
+ const onCloseRef = useRef17(onClose);
11174
11295
  onCloseRef.current = onClose;
11175
11296
  const setOpen = useCallback7((next) => {
11176
11297
  setOpenState(next);
@@ -11236,7 +11357,7 @@ function OpenChoicePicker({
11236
11357
  const pickedOptions = current.map((v) => options.find((o) => isTheChosen(o, v)));
11237
11358
  const cellChips = pickedWords.map((word, i) => {
11238
11359
  const chip = chipOf(pickedOptions[i], word);
11239
- return /* @__PURE__ */ jsx42(Badge7, { variant: "outline", className: cn20("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
11360
+ return /* @__PURE__ */ jsx43(Badge7, { variant: "outline", className: cn20("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
11240
11361
  });
11241
11362
  const headChips = pickedWords.map((word, i) => {
11242
11363
  const option = pickedOptions[i];
@@ -11256,7 +11377,7 @@ function OpenChoicePicker({
11256
11377
  disabled ? cellChips : (
11257
11378
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
11258
11379
  // In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
11259
- /* @__PURE__ */ jsx42(
11380
+ /* @__PURE__ */ jsx43(
11260
11381
  PickOrAdd,
11261
11382
  {
11262
11383
  anchored,
@@ -11282,14 +11403,14 @@ function OpenChoicePicker({
11282
11403
  const option = options.find((o) => o.id === optionId);
11283
11404
  if (option) choose(optionKey4(option));
11284
11405
  },
11285
- empty: q === "" ? /* @__PURE__ */ jsx42("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
11406
+ empty: q === "" ? /* @__PURE__ */ jsx43("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
11286
11407
  add,
11287
11408
  foot,
11288
- footNote: addRefused ? /* @__PURE__ */ jsx42(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
11409
+ footNote: addRefused ? /* @__PURE__ */ jsx43(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
11289
11410
  // never_add on a column that takes only its choices: said, never a silent nothing.
11290
11411
  /* @__PURE__ */ jsxs38(Fragment15, { children: [
11291
- /* @__PURE__ */ jsx42("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) }),
11292
- autoOpen ? /* @__PURE__ */ jsx42("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
11412
+ /* @__PURE__ */ jsx43("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) }),
11413
+ autoOpen ? /* @__PURE__ */ jsx43("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx43(Button17, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
11293
11414
  ] })
11294
11415
  ) : null,
11295
11416
  children: anchored ? cellChips : null
@@ -11310,8 +11431,8 @@ function RecordChip({
11310
11431
  // its tooltip, rather than being cut mid-word by whatever box it landed in
11311
11432
  // (lane FIX-14, 2026-09-22).
11312
11433
  /* @__PURE__ */ jsxs38(Badge7, { variant: "secondary", className: cn20("max-w-full gap-1 text-[11px]", className), title, children: [
11313
- /* @__PURE__ */ jsx42("span", { className: "min-w-0 truncate", children: title }),
11314
- onRemove ? /* @__PURE__ */ jsx42("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
11434
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 truncate", children: title }),
11435
+ onRemove ? /* @__PURE__ */ jsx43("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
11315
11436
  ] })
11316
11437
  );
11317
11438
  }
@@ -11369,7 +11490,7 @@ function ChoiceAnswer({
11369
11490
  chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
11370
11491
  ),
11371
11492
  children: [
11372
- letter ? /* @__PURE__ */ jsx42(
11493
+ letter ? /* @__PURE__ */ jsx43(
11373
11494
  "kbd",
11374
11495
  {
11375
11496
  "aria-hidden": "true",
@@ -11380,8 +11501,8 @@ function ChoiceAnswer({
11380
11501
  children: letter
11381
11502
  }
11382
11503
  ) : null,
11383
- /* @__PURE__ */ jsx42("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
11384
- chosen ? /* @__PURE__ */ jsx42("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
11504
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
11505
+ chosen ? /* @__PURE__ */ jsx43("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
11385
11506
  ]
11386
11507
  },
11387
11508
  choice.key
@@ -11414,12 +11535,12 @@ function ChoiceAnswer({
11414
11535
  };
11415
11536
  const group = { role: field2.multi ? "group" : "radiogroup", "aria-label": fieldName(field2), onKeyDown };
11416
11537
  if (choices.length <= FORM_SEARCH_AFTER) {
11417
- return /* @__PURE__ */ jsx42("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
11538
+ return /* @__PURE__ */ jsx43("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
11418
11539
  }
11419
11540
  const q = search.trim().toLowerCase();
11420
11541
  const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
11421
11542
  return /* @__PURE__ */ jsxs38("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
11422
- /* @__PURE__ */ jsx42(
11543
+ /* @__PURE__ */ jsx43(
11423
11544
  BasicInput10,
11424
11545
  {
11425
11546
  value: search,
@@ -11432,13 +11553,13 @@ function ChoiceAnswer({
11432
11553
  ),
11433
11554
  /* @__PURE__ */ jsxs38("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
11434
11555
  shown2.map(option),
11435
- shown2.length === 0 ? /* @__PURE__ */ jsx42("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
11556
+ shown2.length === 0 ? /* @__PURE__ */ jsx43("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
11436
11557
  ] })
11437
11558
  ] });
11438
11559
  }
11439
11560
 
11440
11561
  // src/ChoiceListEditor.tsx
11441
- import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
11562
+ import { Fragment as Fragment16, jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
11442
11563
  var rowSeed = 0;
11443
11564
  var nextRow = () => `new-${rowSeed += 1}`;
11444
11565
  function choiceRowsFrom(options, field2) {
@@ -11485,7 +11606,7 @@ function ChoiceListEditor({
11485
11606
  const [usage, setUsage] = useState33(null);
11486
11607
  const [asking, setAsking] = useState33(null);
11487
11608
  const [moveTo, setMoveTo] = useState33("");
11488
- const focusRow = useRef19(null);
11609
+ const focusRow = useRef18(null);
11489
11610
  const [removed, setRemoved] = useState33({});
11490
11611
  const fieldId = field2?.id ?? null;
11491
11612
  useEffect23(() => {
@@ -11524,7 +11645,7 @@ function ChoiceListEditor({
11524
11645
  refused
11525
11646
  ] });
11526
11647
  }
11527
- if (rows === null) return /* @__PURE__ */ jsx43("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
11648
+ if (rows === null) return /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
11528
11649
  const set = (index, words) => onRows(rows.map((r, i) => i === index ? { ...r, words } : r));
11529
11650
  const paint = (index, color) => onRows(rows.map((r, i) => i === index ? { ...r, color } : r));
11530
11651
  const addRow = () => {
@@ -11583,11 +11704,11 @@ function ChoiceListEditor({
11583
11704
  const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
11584
11705
  const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
11585
11706
  return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
11586
- /* @__PURE__ */ jsx43(Label11, { className: "text-xs", children: "The choices" }),
11587
- rows.length === 0 ? /* @__PURE__ */ jsx43("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
11588
- /* @__PURE__ */ jsx43("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ jsxs39("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
11589
- /* @__PURE__ */ jsx43(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
11590
- /* @__PURE__ */ jsx43(
11707
+ /* @__PURE__ */ jsx44(Label12, { className: "text-xs", children: "The choices" }),
11708
+ rows.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
11709
+ /* @__PURE__ */ jsx44("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ jsxs39("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
11710
+ /* @__PURE__ */ jsx44(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
11711
+ /* @__PURE__ */ jsx44(
11591
11712
  BasicInput11,
11592
11713
  {
11593
11714
  value: r.words,
@@ -11603,9 +11724,9 @@ function ChoiceListEditor({
11603
11724
  onKeyDown: enterAdds(i)
11604
11725
  }
11605
11726
  ),
11606
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
11607
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
11608
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
11727
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
11728
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
11729
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
11609
11730
  ] }, r.row)) }),
11610
11731
  asking ? (
11611
11732
  // THE QUESTION, Notion-style: where do the records that hold it go?
@@ -11617,18 +11738,18 @@ function ChoiceListEditor({
11617
11738
  "data-records-choice-removal-ask": "",
11618
11739
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
11619
11740
  children: [
11620
- /* @__PURE__ */ jsx43("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
11741
+ /* @__PURE__ */ jsx44("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
11621
11742
  /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-1", children: [
11622
11743
  targets.length > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
11623
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
11744
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
11624
11745
  /* @__PURE__ */ jsxs39(Select7, { value: moveTo, onValueChange: setMoveTo, children: [
11625
- /* @__PURE__ */ jsx43(SelectTrigger7, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx43(SelectValue7, { placeholder: "Another choice" }) }),
11626
- /* @__PURE__ */ jsx43(SelectContent7, { children: targets.map((r) => /* @__PURE__ */ jsx43(SelectItem7, { value: r.id, children: r.words.trim() }, r.id)) })
11746
+ /* @__PURE__ */ jsx44(SelectTrigger7, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx44(SelectValue7, { placeholder: "Another choice" }) }),
11747
+ /* @__PURE__ */ jsx44(SelectContent7, { children: targets.map((r) => /* @__PURE__ */ jsx44(SelectItem7, { value: r.id, children: r.words.trim() }, r.id)) })
11627
11748
  ] })
11628
11749
  ] }) : null,
11629
- allowOther ? /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
11630
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
11631
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
11750
+ allowOther ? /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
11751
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
11752
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
11632
11753
  ] })
11633
11754
  ]
11634
11755
  }
@@ -11636,12 +11757,12 @@ function ChoiceListEditor({
11636
11757
  ) : null,
11637
11758
  Object.entries(rehome).map(
11638
11759
  ([id, spec]) => removed[id] ? /* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
11639
- /* @__PURE__ */ jsx43("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
11640
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
11760
+ /* @__PURE__ */ jsx44("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
11761
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
11641
11762
  ] }, id) : null
11642
11763
  ),
11643
- /* @__PURE__ */ jsx43(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
11644
- isNew ? null : /* @__PURE__ */ jsx43("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
11764
+ /* @__PURE__ */ jsx44(Button18, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
11765
+ isNew ? null : /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
11645
11766
  ] });
11646
11767
  }
11647
11768
  function ChoiceSwatch({ words, color, onColor }) {
@@ -11651,7 +11772,7 @@ function ChoiceSwatch({ words, color, onColor }) {
11651
11772
  setOpen(false);
11652
11773
  };
11653
11774
  return /* @__PURE__ */ jsxs39(Popover7, { open, onOpenChange: setOpen, children: [
11654
- /* @__PURE__ */ jsx43(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx43(
11775
+ /* @__PURE__ */ jsx44(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx44(
11655
11776
  "button",
11656
11777
  {
11657
11778
  type: "button",
@@ -11664,8 +11785,8 @@ function ChoiceSwatch({ words, color, onColor }) {
11664
11785
  )
11665
11786
  }
11666
11787
  ) }),
11667
- /* @__PURE__ */ jsx43(PopoverContent7, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words}`, children: [
11668
- /* @__PURE__ */ jsx43(
11788
+ /* @__PURE__ */ jsx44(PopoverContent7, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words}`, children: [
11789
+ /* @__PURE__ */ jsx44(
11669
11790
  "button",
11670
11791
  {
11671
11792
  type: "button",
@@ -11677,7 +11798,7 @@ function ChoiceSwatch({ words, color, onColor }) {
11677
11798
  className: cn21("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
11678
11799
  }
11679
11800
  ),
11680
- STYLE_COLORS2.map((c) => /* @__PURE__ */ jsx43(
11801
+ STYLE_COLORS2.map((c) => /* @__PURE__ */ jsx44(
11681
11802
  "button",
11682
11803
  {
11683
11804
  type: "button",
@@ -11757,7 +11878,7 @@ async function hasSession(getSession) {
11757
11878
  }
11758
11879
 
11759
11880
  // src/RecordsMount.tsx
11760
- import { useRef as useRef20 } from "react";
11881
+ import { useRef as useRef19 } from "react";
11761
11882
  import { RecordsProvider } from "@ai-matrx/records/react";
11762
11883
 
11763
11884
  // src/PersonNamesBridge.tsx
@@ -11785,7 +11906,7 @@ function PersonNamesBridge() {
11785
11906
  }
11786
11907
 
11787
11908
  // src/RecordsMount.tsx
11788
- import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
11909
+ import { jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
11789
11910
  var STORE_DECIDES_REASON = "This host offers exactly what this person may do, so a control they cannot use is never drawn in the first place.";
11790
11911
  function storeDecidesRights(_table) {
11791
11912
  return NO_RIGHTS;
@@ -11798,13 +11919,13 @@ function RecordsMount({
11798
11919
  }) {
11799
11920
  const bound2 = useShallowStableHost(host);
11800
11921
  void letTheStoreDecideRights;
11801
- return /* @__PURE__ */ jsx44(RecordsProvider, { config, children: /* @__PURE__ */ jsx44(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs40(RecordLabelProvider, { children: [
11802
- /* @__PURE__ */ jsx44(PersonNamesBridge, {}),
11922
+ return /* @__PURE__ */ jsx45(RecordsProvider, { config, children: /* @__PURE__ */ jsx45(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs40(RecordLabelProvider, { children: [
11923
+ /* @__PURE__ */ jsx45(PersonNamesBridge, {}),
11803
11924
  children
11804
11925
  ] }) }) });
11805
11926
  }
11806
11927
  function useShallowStableHost(host) {
11807
- const held = useRef20(null);
11928
+ const held = useRef19(null);
11808
11929
  const next = host ?? {};
11809
11930
  const previous = held.current;
11810
11931
  if (previous !== null && sameParts(previous, next)) return previous;
@@ -11821,11 +11942,11 @@ function sameParts(a, b) {
11821
11942
  }
11822
11943
 
11823
11944
  // src/TablePickers.tsx
11824
- import { useEffect as useEffect25, useMemo as useMemo11, useState as useState34 } from "react";
11945
+ import { useEffect as useEffect25, useMemo as useMemo12, useState as useState34 } from "react";
11825
11946
  import { RecordsProvider as RecordsProvider2, useFields as useFields5, useRecords as useRecords3, useTable as useTable4 } from "@ai-matrx/records/react";
11826
- import { Button as Button19, CreatablePicker } from "@ai-matrx/design-system";
11947
+ import { Button as Button19, CreatablePicker, displayId } from "@ai-matrx/design-system";
11827
11948
  import { momentZoneOptions as momentZoneOptions2 } from "@ai-matrx/design-system/field-formats";
11828
- import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
11949
+ import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
11829
11950
  var SHARED_FOR_MS = 5e3;
11830
11951
  var sharedReads = /* @__PURE__ */ new WeakMap();
11831
11952
  function readTablesAnywhere(dataSource) {
@@ -11887,7 +12008,7 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
11887
12008
  const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString(void 0, momentZoneOptions2(r.updated_at))}` : null].filter(Boolean).join(" \xB7 ");
11888
12009
  const base = secondOf(row);
11889
12010
  const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base).length;
11890
- const second = alike > 1 ? [base, `#${t.table_id.slice(0, 4)}`].filter(Boolean).join(" \xB7 ") : base;
12011
+ const second = alike > 1 ? [base, `#${displayId(t.table_id)}`].filter(Boolean).join(" \xB7 ") : base;
11891
12012
  return {
11892
12013
  value: t.table_id,
11893
12014
  // The organization hint already tells two same-named tables apart across organizations.
@@ -11896,15 +12017,15 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
11896
12017
  keywords: t.organization_name,
11897
12018
  ...twin && second ? {
11898
12019
  render: /* @__PURE__ */ jsxs41("span", { className: "flex min-w-0 flex-col", children: [
11899
- /* @__PURE__ */ jsx45("span", { className: "truncate", children: t.table_name }),
11900
- /* @__PURE__ */ jsx45("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
12020
+ /* @__PURE__ */ jsx46("span", { className: "truncate", children: t.table_name }),
12021
+ /* @__PURE__ */ jsx46("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
11901
12022
  ] })
11902
12023
  } : {}
11903
12024
  };
11904
12025
  });
11905
12026
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
11906
12027
  return /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-1", children: [
11907
- /* @__PURE__ */ jsx45(
12028
+ /* @__PURE__ */ jsx46(
11908
12029
  CreatablePicker,
11909
12030
  {
11910
12031
  value: value || null,
@@ -11918,22 +12039,22 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
11918
12039
  ariaLabel: "Table"
11919
12040
  }
11920
12041
  ),
11921
- list.error && /* @__PURE__ */ jsx45(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
11922
- missing && /* @__PURE__ */ jsx45("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
12042
+ list.error && /* @__PURE__ */ jsx46(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
12043
+ missing && /* @__PURE__ */ jsx46("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
11923
12044
  ] });
11924
12045
  }
11925
12046
  function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
11926
12047
  const own3 = useTablesAnywhere(dataSource);
11927
12048
  const list = tables ?? own3;
11928
12049
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
11929
- if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx45(Fragment17, { children: unavailable ?? fallback });
11930
- if (!tableId || !organizationId) return /* @__PURE__ */ jsx45(Fragment17, { children: fallback });
11931
- return /* @__PURE__ */ jsx45(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
12050
+ if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx46(Fragment17, { children: unavailable ?? fallback });
12051
+ if (!tableId || !organizationId) return /* @__PURE__ */ jsx46(Fragment17, { children: fallback });
12052
+ return /* @__PURE__ */ jsx46(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
11932
12053
  }
11933
12054
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
11934
12055
  const fields = useFields5(tableId);
11935
- const all = useMemo11(() => fields.data ?? [], [fields.data]);
11936
- const byKey = useMemo11(() => new Map(all.map((f) => [f.key, f])), [all]);
12056
+ const all = useMemo12(() => fields.data ?? [], [fields.data]);
12057
+ const byKey = useMemo12(() => new Map(all.map((f) => [f.key, f])), [all]);
11937
12058
  const keys = Object.keys(value);
11938
12059
  const [adding, setAdding] = useState34(false);
11939
12060
  const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
@@ -11949,10 +12070,10 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
11949
12070
  onChange(rest);
11950
12071
  };
11951
12072
  return /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-2", children: [
11952
- fields.error && /* @__PURE__ */ jsx45(RefusalLine, { error: fields.error }),
12073
+ fields.error && /* @__PURE__ */ jsx46(RefusalLine, { error: fields.error }),
11953
12074
  keys.map((key) => {
11954
12075
  const field2 = byKey.get(key);
11955
- return /* @__PURE__ */ jsx45(
12076
+ return /* @__PURE__ */ jsx46(
11956
12077
  ColumnValueRow,
11957
12078
  {
11958
12079
  columnKey: key,
@@ -11968,7 +12089,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
11968
12089
  key
11969
12090
  );
11970
12091
  }),
11971
- adding && /* @__PURE__ */ jsx45(
12092
+ adding && /* @__PURE__ */ jsx46(
11972
12093
  ColumnValueRow,
11973
12094
  {
11974
12095
  columnKey: null,
@@ -11985,7 +12106,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
11985
12106
  onRemove: () => setAdding(false)
11986
12107
  }
11987
12108
  ),
11988
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx45(Button19, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
12109
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx46(Button19, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
11989
12110
  ] });
11990
12111
  }
11991
12112
  function ColumnValueRow({
@@ -12003,7 +12124,7 @@ function ColumnValueRow({
12003
12124
  const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
12004
12125
  return /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
12005
12126
  /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
12006
- /* @__PURE__ */ jsx45("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx45(
12127
+ /* @__PURE__ */ jsx46("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx46(
12007
12128
  CreatablePicker,
12008
12129
  {
12009
12130
  value: columnKey,
@@ -12017,9 +12138,9 @@ function ColumnValueRow({
12017
12138
  ariaLabel: "Column"
12018
12139
  }
12019
12140
  ) }),
12020
- !disabled && /* @__PURE__ */ jsx45(Button19, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
12141
+ !disabled && /* @__PURE__ */ jsx46(Button19, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
12021
12142
  ] }),
12022
- field2 ? /* @__PURE__ */ jsx45(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx45("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
12143
+ field2 ? /* @__PURE__ */ jsx46(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx46("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
12023
12144
  ] });
12024
12145
  }
12025
12146
  function RecordPicker({ tableId, value, onChange, disabled }) {
@@ -12032,7 +12153,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
12032
12153
  }));
12033
12154
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
12034
12155
  return /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-1", children: [
12035
- /* @__PURE__ */ jsx45(
12156
+ /* @__PURE__ */ jsx46(
12036
12157
  CreatablePicker,
12037
12158
  {
12038
12159
  value: value || null,
@@ -12046,16 +12167,16 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
12046
12167
  ariaLabel: "Record"
12047
12168
  }
12048
12169
  ),
12049
- records.error && /* @__PURE__ */ jsx45(RefusalLine, { error: records.error })
12170
+ records.error && /* @__PURE__ */ jsx46(RefusalLine, { error: records.error })
12050
12171
  ] });
12051
12172
  }
12052
12173
 
12053
12174
  // src/DataBindingPicker.tsx
12054
- import { useEffect as useEffect26, useMemo as useMemo12 } from "react";
12175
+ import { useEffect as useEffect26, useMemo as useMemo13 } from "react";
12055
12176
  import { isEntityReferenceConfig } from "@ai-matrx/records";
12056
12177
  import { useFields as useFields6, useTable as useTable5 } from "@ai-matrx/records/react";
12057
12178
  import { BasicInput as BasicInput12, Button as Button20, CreatablePicker as CreatablePicker2, cn as cn22 } from "@ai-matrx/design-system";
12058
- import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
12179
+ import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
12059
12180
  var DATA_BINDING_SHAPES = [
12060
12181
  { value: "collection", label: "The whole table" },
12061
12182
  { value: "reference", label: "One record" },
@@ -12123,8 +12244,8 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
12123
12244
  });
12124
12245
  };
12125
12246
  return /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-2", children: [
12126
- /* @__PURE__ */ jsx46(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
12127
- /* @__PURE__ */ jsx46(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx46(
12247
+ /* @__PURE__ */ jsx47(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
12248
+ /* @__PURE__ */ jsx47(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx47(
12128
12249
  BindingDetails,
12129
12250
  {
12130
12251
  tableId,
@@ -12145,7 +12266,7 @@ function BindingDetails({
12145
12266
  }) {
12146
12267
  const table = useTable5(tableId);
12147
12268
  const fields = useFields6(tableId);
12148
- const fieldList = useMemo12(() => fields.data ?? [], [fields.data]);
12269
+ const fieldList = useMemo13(() => fields.data ?? [], [fields.data]);
12149
12270
  const shape = binding.semantic_type;
12150
12271
  useEffect26(() => {
12151
12272
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
@@ -12189,7 +12310,7 @@ function BindingDetails({
12189
12310
  const template = binding.transform?.template ?? "";
12190
12311
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
12191
12312
  return /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-2", children: [
12192
- /* @__PURE__ */ jsx46("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx46(
12313
+ /* @__PURE__ */ jsx47("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx47(
12193
12314
  Button20,
12194
12315
  {
12195
12316
  type: "button",
@@ -12203,7 +12324,7 @@ function BindingDetails({
12203
12324
  },
12204
12325
  s.value
12205
12326
  )) }),
12206
- shape !== "collection" && /* @__PURE__ */ jsx46(
12327
+ shape !== "collection" && /* @__PURE__ */ jsx47(
12207
12328
  RecordPicker,
12208
12329
  {
12209
12330
  tableId,
@@ -12212,7 +12333,7 @@ function BindingDetails({
12212
12333
  disabled: Boolean(disabled)
12213
12334
  }
12214
12335
  ),
12215
- shape === "value" && /* @__PURE__ */ jsx46(
12336
+ shape === "value" && /* @__PURE__ */ jsx47(
12216
12337
  CreatablePicker2,
12217
12338
  {
12218
12339
  value: binding.field_key ?? null,
@@ -12227,7 +12348,7 @@ function BindingDetails({
12227
12348
  }
12228
12349
  ),
12229
12350
  shape !== "value" && /* @__PURE__ */ jsxs42("div", { className: "flex flex-col gap-1", children: [
12230
- /* @__PURE__ */ jsx46(
12351
+ /* @__PURE__ */ jsx47(
12231
12352
  "textarea",
12232
12353
  {
12233
12354
  className: cn22(
@@ -12239,7 +12360,7 @@ function BindingDetails({
12239
12360
  onChange: (e) => setTemplate(e.target.value)
12240
12361
  }
12241
12362
  ),
12242
- !disabled && /* @__PURE__ */ jsx46("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx46(
12363
+ !disabled && /* @__PURE__ */ jsx47("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx47(
12243
12364
  Button20,
12244
12365
  {
12245
12366
  type: "button",
@@ -12254,7 +12375,7 @@ function BindingDetails({
12254
12375
  ] }),
12255
12376
  shape === "collection" && /* @__PURE__ */ jsxs42("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
12256
12377
  "Up to",
12257
- /* @__PURE__ */ jsx46(
12378
+ /* @__PURE__ */ jsx47(
12258
12379
  BasicInput12,
12259
12380
  {
12260
12381
  type: "number",
@@ -12272,8 +12393,8 @@ function BindingDetails({
12272
12393
  "rows"
12273
12394
  ] }),
12274
12395
  /* @__PURE__ */ jsxs42("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
12275
- /* @__PURE__ */ jsx46("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
12276
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx46(
12396
+ /* @__PURE__ */ jsx47("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
12397
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx47(
12277
12398
  Button20,
12278
12399
  {
12279
12400
  type: "button",
@@ -12293,13 +12414,13 @@ function BindingDetails({
12293
12414
 
12294
12415
  // src/PickedSummaries.tsx
12295
12416
  import { useFields as useFields7, useRecord, useTable as useTable6 } from "@ai-matrx/records/react";
12296
- import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
12417
+ import { Fragment as Fragment18, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
12297
12418
  function TableNameText({ dataSource, tableId }) {
12298
12419
  const tables = useTablesAnywhere(dataSource);
12299
- if (!tableId) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2014" });
12300
- if (tables.loading) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2026" });
12301
- if (tables.error) return /* @__PURE__ */ jsx47(Fragment18, { children: "Couldn't load the table's name" });
12302
- return /* @__PURE__ */ jsx47(Fragment18, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
12420
+ if (!tableId) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2014" });
12421
+ if (tables.loading) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2026" });
12422
+ if (tables.error) return /* @__PURE__ */ jsx48(Fragment18, { children: "Couldn't load the table's name" });
12423
+ return /* @__PURE__ */ jsx48(Fragment18, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
12303
12424
  }
12304
12425
  function ColumnValuesText({
12305
12426
  dataSource,
@@ -12307,29 +12428,29 @@ function ColumnValuesText({
12307
12428
  tableId,
12308
12429
  value
12309
12430
  }) {
12310
- if (!tableId) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2014" });
12311
- return /* @__PURE__ */ jsx47(
12431
+ if (!tableId) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2014" });
12432
+ return /* @__PURE__ */ jsx48(
12312
12433
  TableScope,
12313
12434
  {
12314
12435
  dataSource,
12315
12436
  userId,
12316
12437
  tableId,
12317
- fallback: /* @__PURE__ */ jsx47(Fragment18, { children: "\u2026" }),
12318
- unavailable: /* @__PURE__ */ jsx47(Fragment18, { children: "Couldn't load this table's columns" }),
12319
- children: /* @__PURE__ */ jsx47(RecordLabelProvider, { children: /* @__PURE__ */ jsx47(ColumnValuesWords, { tableId, value }) })
12438
+ fallback: /* @__PURE__ */ jsx48(Fragment18, { children: "\u2026" }),
12439
+ unavailable: /* @__PURE__ */ jsx48(Fragment18, { children: "Couldn't load this table's columns" }),
12440
+ children: /* @__PURE__ */ jsx48(RecordLabelProvider, { children: /* @__PURE__ */ jsx48(ColumnValuesWords, { tableId, value }) })
12320
12441
  }
12321
12442
  );
12322
12443
  }
12323
12444
  function ColumnValuesWords({ tableId, value }) {
12324
12445
  const fields = useFields7(tableId);
12325
12446
  const labels = useRecordLabels(fields.data ?? void 0);
12326
- if (fields.loading) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2026" });
12327
- if (fields.error) return /* @__PURE__ */ jsx47(Fragment18, { children: "Couldn't load this table's columns" });
12447
+ if (fields.loading) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2026" });
12448
+ if (fields.error) return /* @__PURE__ */ jsx48(Fragment18, { children: "Couldn't load this table's columns" });
12328
12449
  const parts = [];
12329
12450
  for (const [key, stored] of Object.entries(value)) {
12330
12451
  if (key.startsWith("_")) continue;
12331
12452
  const field2 = (fields.data ?? []).find((f) => f.key === key);
12332
- if (parts.length) parts.push(/* @__PURE__ */ jsx47("span", { children: ", " }, `${key}-sep`));
12453
+ if (parts.length) parts.push(/* @__PURE__ */ jsx48("span", { children: ", " }, `${key}-sep`));
12333
12454
  parts.push(
12334
12455
  /* @__PURE__ */ jsxs43("span", { children: [
12335
12456
  field2 ? fieldName(field2) : "A removed column",
@@ -12338,7 +12459,7 @@ function ColumnValuesWords({ tableId, value }) {
12338
12459
  ] }, key)
12339
12460
  );
12340
12461
  }
12341
- return parts.length ? /* @__PURE__ */ jsx47(Fragment18, { children: parts }) : /* @__PURE__ */ jsx47(Fragment18, { children: "\u2014" });
12462
+ return parts.length ? /* @__PURE__ */ jsx48(Fragment18, { children: parts }) : /* @__PURE__ */ jsx48(Fragment18, { children: "\u2014" });
12342
12463
  }
12343
12464
  function RecordNameText({
12344
12465
  dataSource,
@@ -12346,35 +12467,35 @@ function RecordNameText({
12346
12467
  tableId,
12347
12468
  recordId
12348
12469
  }) {
12349
- if (!tableId || !recordId) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2014" });
12350
- return /* @__PURE__ */ jsx47(
12470
+ if (!tableId || !recordId) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2014" });
12471
+ return /* @__PURE__ */ jsx48(
12351
12472
  TableScope,
12352
12473
  {
12353
12474
  dataSource,
12354
12475
  userId,
12355
12476
  tableId,
12356
- fallback: /* @__PURE__ */ jsx47(Fragment18, { children: "\u2026" }),
12357
- unavailable: /* @__PURE__ */ jsx47(Fragment18, { children: "Couldn't load this record" }),
12358
- children: /* @__PURE__ */ jsx47(RecordNameWords, { tableId, recordId })
12477
+ fallback: /* @__PURE__ */ jsx48(Fragment18, { children: "\u2026" }),
12478
+ unavailable: /* @__PURE__ */ jsx48(Fragment18, { children: "Couldn't load this record" }),
12479
+ children: /* @__PURE__ */ jsx48(RecordNameWords, { tableId, recordId })
12359
12480
  }
12360
12481
  );
12361
12482
  }
12362
12483
  function RecordNameWords({ tableId, recordId }) {
12363
12484
  const table = useTable6(tableId);
12364
12485
  const record = useRecord(recordId);
12365
- if (record.loading || table.loading) return /* @__PURE__ */ jsx47(Fragment18, { children: "\u2026" });
12366
- if (record.error) return /* @__PURE__ */ jsx47(Fragment18, { children: "Couldn't load this record" });
12367
- if (!record.data) return /* @__PURE__ */ jsx47(Fragment18, { children: "A record you cannot open" });
12368
- return /* @__PURE__ */ jsx47(Fragment18, { children: recordName(record.data.document, table.data?.title_field ?? null) });
12486
+ if (record.loading || table.loading) return /* @__PURE__ */ jsx48(Fragment18, { children: "\u2026" });
12487
+ if (record.error) return /* @__PURE__ */ jsx48(Fragment18, { children: "Couldn't load this record" });
12488
+ if (!record.data) return /* @__PURE__ */ jsx48(Fragment18, { children: "A record you cannot open" });
12489
+ return /* @__PURE__ */ jsx48(Fragment18, { children: recordName(record.data.document, table.data?.title_field ?? null) });
12369
12490
  }
12370
12491
 
12371
12492
  // src/HeldChangeDecision.tsx
12372
12493
  import { useEffect as useEffect27, useState as useState35 } from "react";
12373
12494
  import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient10 } from "@ai-matrx/records/react";
12374
12495
  import { Button as Button21 } from "@ai-matrx/design-system";
12375
- import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
12496
+ import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
12376
12497
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
12377
- return /* @__PURE__ */ jsx48(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx48(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
12498
+ return /* @__PURE__ */ jsx49(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx49(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
12378
12499
  }
12379
12500
  function Decision({
12380
12501
  approvalId,
@@ -12407,13 +12528,13 @@ function Decision({
12407
12528
  if (res.ok) onDecided(approve);
12408
12529
  else setError(res.error);
12409
12530
  };
12410
- if (may === null) return /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
12531
+ if (may === null) return /* @__PURE__ */ jsx49("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
12411
12532
  return /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-1.5", children: [
12412
12533
  may ? /* @__PURE__ */ jsxs44("div", { className: "flex gap-2", children: [
12413
- /* @__PURE__ */ jsx48(Button21, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
12414
- /* @__PURE__ */ jsx48(Button21, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
12415
- ] }) : !error && /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
12416
- error ? /* @__PURE__ */ jsx48(RefusalLine, { error }) : null
12534
+ /* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
12535
+ /* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
12536
+ ] }) : !error && /* @__PURE__ */ jsx49("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
12537
+ error ? /* @__PURE__ */ jsx49(RefusalLine, { error }) : null
12417
12538
  ] });
12418
12539
  }
12419
12540
 
@@ -12607,4 +12728,4 @@ export {
12607
12728
  RecordNameText,
12608
12729
  HeldChangeDecision
12609
12730
  };
12610
- //# sourceMappingURL=chunk-D2FZEAYO.js.map
12731
+ //# sourceMappingURL=chunk-AZZA7DQ4.js.map