@ai-matrx/records-ui 0.103.6 → 0.103.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pickers.cjs CHANGED
@@ -42,8 +42,8 @@ __export(pickers_exports, {
42
42
  module.exports = __toCommonJS(pickers_exports);
43
43
 
44
44
  // src/TablePickers.tsx
45
- var import_react30 = require("react");
46
- var import_react31 = require("@ai-matrx/records/react");
45
+ var import_react31 = require("react");
46
+ var import_react32 = require("@ai-matrx/records/react");
47
47
  var import_design_system17 = require("@ai-matrx/design-system");
48
48
 
49
49
  // src/askOnce.ts
@@ -81,9 +81,9 @@ function fieldOptionsOnce(client, fieldId) {
81
81
  }
82
82
 
83
83
  // src/editors.tsx
84
- var import_react24 = require("react");
84
+ var import_react25 = require("react");
85
85
  var import_records10 = require("@ai-matrx/records");
86
- var import_react25 = require("@ai-matrx/records/react");
86
+ var import_react26 = require("@ai-matrx/records/react");
87
87
  var import_design_system15 = require("@ai-matrx/design-system");
88
88
 
89
89
  // src/dates.ts
@@ -2681,6 +2681,70 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2681
2681
  ] });
2682
2682
  }
2683
2683
 
2684
+ // src/FloatingRefusal.tsx
2685
+ var import_react19 = require("react");
2686
+ var import_react_dom = require("react-dom");
2687
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2688
+ var GAP = 4;
2689
+ function placeFor(anchor, note) {
2690
+ const a = anchor.getBoundingClientRect();
2691
+ const inGrid = anchor.closest("td") !== null;
2692
+ const height = note?.offsetHeight ?? 20;
2693
+ const width = note?.offsetWidth ?? 0;
2694
+ if (inGrid) {
2695
+ const above = a.top - GAP - height;
2696
+ const top = above >= 0 ? above : a.bottom + GAP;
2697
+ const left = Math.max(GAP, Math.min(a.left, window.innerWidth - width - GAP));
2698
+ return { position: "fixed", top, left };
2699
+ }
2700
+ return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
2701
+ }
2702
+ function FloatingRefusal({ text, why }) {
2703
+ const spot = (0, import_react19.useRef)(null);
2704
+ const note = (0, import_react19.useRef)(null);
2705
+ const [style, setStyle] = (0, import_react19.useState)(null);
2706
+ const [floating, setFloating] = (0, import_react19.useState)(false);
2707
+ (0, import_react19.useLayoutEffect)(() => {
2708
+ const here = spot.current;
2709
+ if (!here) return;
2710
+ const anchor = here.closest("[data-matrx-cell-editor]");
2711
+ setFloating(anchor !== null);
2712
+ if (!anchor) return;
2713
+ const place = () => setStyle(placeFor(anchor, note.current));
2714
+ place();
2715
+ const frame = requestAnimationFrame(place);
2716
+ window.addEventListener("scroll", place, true);
2717
+ window.addEventListener("resize", place);
2718
+ return () => {
2719
+ cancelAnimationFrame(frame);
2720
+ window.removeEventListener("scroll", place, true);
2721
+ window.removeEventListener("resize", place);
2722
+ };
2723
+ }, [text]);
2724
+ if (!floating) {
2725
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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 });
2726
+ }
2727
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2728
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
2729
+ typeof document === "undefined" ? null : (0, import_react_dom.createPortal)(
2730
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2731
+ "span",
2732
+ {
2733
+ ref: note,
2734
+ "data-records-typed-refusal": "",
2735
+ "data-records-floating-refusal": "",
2736
+ role: "status",
2737
+ title: why,
2738
+ style: { ...style ?? { position: "fixed", top: -9999, left: -9999 }, zIndex: 60 },
2739
+ className: "pointer-events-none w-max max-w-[24rem] rounded-md border bg-popover px-1.5 py-0.5 text-[11px] leading-snug text-amber-700 shadow-md dark:text-amber-400",
2740
+ children: text
2741
+ }
2742
+ ),
2743
+ document.body
2744
+ )
2745
+ ] });
2746
+ }
2747
+
2684
2748
  // src/presentation.ts
2685
2749
  var import_data_table2 = require("@ai-matrx/design-system/data-table");
2686
2750
  var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
@@ -2744,16 +2808,16 @@ function currencyCodeFor(unit) {
2744
2808
  }
2745
2809
 
2746
2810
  // src/formatControls.tsx
2747
- var import_react20 = require("react");
2811
+ var import_react21 = require("react");
2748
2812
  var import_design_system13 = require("@ai-matrx/design-system");
2749
2813
  var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
2750
2814
 
2751
2815
  // src/formattedValue.tsx
2752
- var import_react19 = require("react");
2816
+ var import_react20 = require("react");
2753
2817
  var import_data_table3 = require("@ai-matrx/design-system/data-table");
2754
2818
  var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
2755
2819
  var import_design_system12 = require("@ai-matrx/design-system");
2756
- var import_jsx_runtime14 = require("react/jsx-runtime");
2820
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2757
2821
  var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
2758
2822
  var own2 = (event) => event.stopPropagation();
2759
2823
  function numberOf(value) {
@@ -2771,11 +2835,11 @@ function RatingStars({
2771
2835
  label,
2772
2836
  selectFirst
2773
2837
  }) {
2774
- const armed = (0, import_react19.useRef)(true);
2838
+ const armed = (0, import_react20.useRef)(true);
2775
2839
  const score = numberOf(value) ?? 0;
2776
2840
  const shown2 = Math.round(score);
2777
2841
  const said = `${shown2} out of ${max}`;
2778
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2842
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2779
2843
  "span",
2780
2844
  {
2781
2845
  "data-records-rating": "",
@@ -2787,8 +2851,8 @@ function RatingStars({
2787
2851
  children: Array.from({ length: max }, (_, i) => {
2788
2852
  const n = i + 1;
2789
2853
  const lit = n <= shown2;
2790
- const star = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": true, className: (0, import_design_system12.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2791
- return onRate ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2854
+ const star = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": true, className: (0, import_design_system12.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2855
+ return onRate ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2792
2856
  "button",
2793
2857
  {
2794
2858
  type: "button",
@@ -2813,7 +2877,7 @@ function RatingStars({
2813
2877
  children: star
2814
2878
  },
2815
2879
  n
2816
- ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: star }, n);
2880
+ ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: star }, n);
2817
2881
  })
2818
2882
  }
2819
2883
  );
@@ -2821,13 +2885,13 @@ function RatingStars({
2821
2885
  function rich(id, text, raw, format) {
2822
2886
  switch (id) {
2823
2887
  case "email":
2824
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text }) });
2888
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate", children: text }) });
2825
2889
  case "url":
2826
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text }) });
2890
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate", children: text }) });
2827
2891
  case "phone":
2828
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats3.formatPhone)(text) }) });
2892
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats3.formatPhone)(text) }) });
2829
2893
  case "address":
2830
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2894
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2831
2895
  "a",
2832
2896
  {
2833
2897
  href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
@@ -2836,7 +2900,7 @@ function rich(id, text, raw, format) {
2836
2900
  className: LINK,
2837
2901
  title: "Open in maps",
2838
2902
  onClick: own2,
2839
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: text })
2903
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate", children: text })
2840
2904
  }
2841
2905
  );
2842
2906
  case "progress": {
@@ -2844,8 +2908,8 @@ function rich(id, text, raw, format) {
2844
2908
  if (n === null) return void 0;
2845
2909
  const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
2846
2910
  const clamped = Math.max(0, Math.min(100, pct));
2847
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2848
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2911
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2912
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2849
2913
  "span",
2850
2914
  {
2851
2915
  role: "progressbar",
@@ -2853,24 +2917,24 @@ function rich(id, text, raw, format) {
2853
2917
  "aria-valuemax": 100,
2854
2918
  "aria-valuenow": Math.round(clamped),
2855
2919
  className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
2856
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: (0, import_design_system12.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2920
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: (0, import_design_system12.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2857
2921
  }
2858
2922
  ),
2859
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2923
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2860
2924
  ] });
2861
2925
  }
2862
2926
  case "color":
2863
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2864
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2865
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { className: "font-mono text-xs", children: text })
2927
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2928
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2929
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "font-mono text-xs", children: text })
2866
2930
  ] });
2867
2931
  case "tags": {
2868
2932
  const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
2869
2933
  if (items.length === 0) return void 0;
2870
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2934
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2871
2935
  }
2872
2936
  case "rating":
2873
- return numberOf(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2937
+ return numberOf(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2874
2938
  default:
2875
2939
  return void 0;
2876
2940
  }
@@ -2885,11 +2949,11 @@ function FormattedValue({
2885
2949
  const score = numberOf(value);
2886
2950
  const max = format.options?.ratingMax ?? 5;
2887
2951
  if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
2888
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2952
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2889
2953
  }
2890
2954
  const result = (0, import_field_formats3.formatFieldValue)(value, format);
2891
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_data_table3.FormattedCell, { result });
2892
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_data_table3.FormattedCell, { result });
2955
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_data_table3.FormattedCell, { result });
2956
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_data_table3.FormattedCell, { result });
2893
2957
  }
2894
2958
  function linkChipText(raw) {
2895
2959
  try {
@@ -2903,7 +2967,7 @@ function linkChipText(raw) {
2903
2967
  }
2904
2968
 
2905
2969
  // src/formatControls.tsx
2906
- var import_jsx_runtime15 = require("react/jsx-runtime");
2970
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2907
2971
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
2908
2972
  function scaled(format) {
2909
2973
  return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
@@ -2920,13 +2984,13 @@ function keptValue(format, raw) {
2920
2984
  return parsed;
2921
2985
  }
2922
2986
  function NumberInFormat({ format, value, onChange, disabled, id }) {
2923
- const [text, setText] = (0, import_react20.useState)(() => typedText(format, value));
2924
- const lastSent = (0, import_react20.useRef)(void 0);
2925
- (0, import_react20.useEffect)(() => {
2987
+ const [text, setText] = (0, import_react21.useState)(() => typedText(format, value));
2988
+ const lastSent = (0, import_react21.useRef)(void 0);
2989
+ (0, import_react21.useEffect)(() => {
2926
2990
  if (value === lastSent.current) return;
2927
2991
  setText(typedText(format, value));
2928
2992
  }, [value, format]);
2929
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2993
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2930
2994
  import_design_system13.BasicInput,
2931
2995
  {
2932
2996
  id,
@@ -2951,16 +3015,16 @@ function formatControl(args) {
2951
3015
  const text = value === null || value === void 0 ? "" : String(value);
2952
3016
  const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats4.parseFieldInput)(raw, format));
2953
3017
  if (def.id === "rating") {
2954
- return disabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
3018
+ return disabled ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2955
3019
  }
2956
- if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NumberInFormat, { ...args });
3020
+ if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NumberInFormat, { ...args });
2957
3021
  switch (def.editor) {
2958
3022
  // A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
2959
3023
  // (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
2960
3024
  case "email":
2961
3025
  case "url":
2962
3026
  case "tel":
2963
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3027
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2964
3028
  import_design_system13.BasicInput,
2965
3029
  {
2966
3030
  id,
@@ -2972,8 +3036,8 @@ function formatControl(args) {
2972
3036
  }
2973
3037
  );
2974
3038
  case "color":
2975
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "flex items-center gap-2", children: [
2976
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3039
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex items-center gap-2", children: [
3040
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2977
3041
  import_design_system13.BasicInput,
2978
3042
  {
2979
3043
  id: `${id}-swatch`,
@@ -2985,20 +3049,20 @@ function formatControl(args) {
2985
3049
  onChange: (e) => commit(e.target.value)
2986
3050
  }
2987
3051
  ),
2988
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system13.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
3052
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system13.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2989
3053
  ] });
2990
3054
  case "textarea":
2991
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system13.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
3055
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system13.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2992
3056
  default:
2993
3057
  return null;
2994
3058
  }
2995
3059
  }
2996
3060
 
2997
3061
  // src/typedDateHelper.tsx
2998
- var import_react21 = require("react");
3062
+ var import_react22 = require("react");
2999
3063
  var import_design_system14 = require("@ai-matrx/design-system");
3000
3064
  var import_records9 = require("@ai-matrx/records");
3001
- var import_jsx_runtime16 = require("react/jsx-runtime");
3065
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3002
3066
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
3003
3067
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
3004
3068
  function pad(n) {
@@ -3027,15 +3091,15 @@ function wordsFor(kind, day, time) {
3027
3091
  }
3028
3092
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
3029
3093
  function CalendarGlyph() {
3030
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3031
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3032
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
3094
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3095
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3096
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
3033
3097
  ] });
3034
3098
  }
3035
3099
  function ClockGlyph() {
3036
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3037
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
3038
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M12 6v6l4 2" })
3100
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3101
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 6v6l4 2" })
3039
3103
  ] });
3040
3104
  }
3041
3105
  function TypedDateHelper({
@@ -3045,11 +3109,11 @@ function TypedDateHelper({
3045
3109
  label,
3046
3110
  onPicked
3047
3111
  }) {
3048
- const [open, setOpen] = (0, import_react21.useState)(false);
3112
+ const [open, setOpen] = (0, import_react22.useState)(false);
3049
3113
  const held = readBox(text, kind);
3050
3114
  const today = /* @__PURE__ */ new Date();
3051
3115
  const start = held.day ? new Date(Number(held.day.slice(0, 4)), Number(held.day.slice(5, 7)) - 1, 1) : new Date(today.getFullYear(), today.getMonth(), 1);
3052
- const [month, setMonth] = (0, import_react21.useState)(null);
3116
+ const [month, setMonth] = (0, import_react22.useState)(null);
3053
3117
  const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
3054
3118
  const first = new Date(shown2.y, shown2.m, 1).getDay();
3055
3119
  const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
@@ -3074,8 +3138,8 @@ function TypedDateHelper({
3074
3138
  const at = new Date(shown2.y, shown2.m + by, 1);
3075
3139
  setMonth({ y: at.getFullYear(), m: at.getMonth() });
3076
3140
  };
3077
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system14.Popover, { open, onOpenChange: setOpen, children: [
3078
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system14.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3141
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system14.Popover, { open, onOpenChange: setOpen, children: [
3142
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system14.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3079
3143
  "button",
3080
3144
  {
3081
3145
  type: "button",
@@ -3084,10 +3148,10 @@ function TypedDateHelper({
3084
3148
  "aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
3085
3149
  title: kind === "time" ? "Pick a time" : "Pick a date",
3086
3150
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
3087
- children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CalendarGlyph, {})
3151
+ children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CalendarGlyph, {})
3088
3152
  }
3089
3153
  ) }),
3090
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3154
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3091
3155
  import_design_system14.PopoverContent,
3092
3156
  {
3093
3157
  sizing: "content",
@@ -3097,23 +3161,23 @@ function TypedDateHelper({
3097
3161
  "data-records-date-helper-panel": "",
3098
3162
  onOpenAutoFocus: (e) => e.preventDefault(),
3099
3163
  onCloseAutoFocus: (e) => e.preventDefault(),
3100
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-2", children: [
3101
- kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3102
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3103
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3104
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
3164
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-2", children: [
3165
+ kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3166
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3167
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3168
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
3105
3169
  MONTHS[shown2.m],
3106
3170
  " ",
3107
3171
  shown2.y
3108
3172
  ] }),
3109
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3173
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3110
3174
  ] }),
3111
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3112
- WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
3175
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3176
+ WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
3113
3177
  cells.map((d, i) => {
3114
- if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", {}, `blank-${i}`);
3178
+ if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", {}, `blank-${i}`);
3115
3179
  const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
3116
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3180
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3117
3181
  "button",
3118
3182
  {
3119
3183
  type: "button",
@@ -3132,7 +3196,7 @@ function TypedDateHelper({
3132
3196
  })
3133
3197
  ] })
3134
3198
  ] }),
3135
- kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3199
+ kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3136
3200
  "button",
3137
3201
  {
3138
3202
  type: "button",
@@ -3154,8 +3218,8 @@ function TypedDateHelper({
3154
3218
  }
3155
3219
 
3156
3220
  // src/choiceNudge.ts
3157
- var import_react22 = require("react");
3158
- var import_react23 = require("@ai-matrx/records/react");
3221
+ var import_react23 = require("react");
3222
+ var import_react24 = require("@ai-matrx/records/react");
3159
3223
  var asked2 = /* @__PURE__ */ new WeakMap();
3160
3224
  function choiceNudgeOf(client) {
3161
3225
  let answer = asked2.get(client);
@@ -3169,9 +3233,9 @@ function choiceNudgeOf(client) {
3169
3233
  return answer;
3170
3234
  }
3171
3235
  function useChoiceNudge(enabled = true) {
3172
- const client = (0, import_react23.useOptionalRecordsClient)();
3173
- const [nudge, setNudge] = (0, import_react22.useState)(null);
3174
- (0, import_react22.useEffect)(() => {
3236
+ const client = (0, import_react24.useOptionalRecordsClient)();
3237
+ const [nudge, setNudge] = (0, import_react23.useState)(null);
3238
+ (0, import_react23.useEffect)(() => {
3175
3239
  if (!enabled || !client) return;
3176
3240
  let live = true;
3177
3241
  void choiceNudgeOf(client).then((answer) => {
@@ -3186,7 +3250,7 @@ function useChoiceNudge(enabled = true) {
3186
3250
  }
3187
3251
 
3188
3252
  // src/editors.tsx
3189
- var import_jsx_runtime17 = require("react/jsx-runtime");
3253
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3190
3254
  var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
3191
3255
  function isChoiceAddition(value) {
3192
3256
  return typeof value === "object" && value !== null && value.addingChoices === true;
@@ -3216,12 +3280,12 @@ function ChoiceAskButtons({
3216
3280
  onCancel,
3217
3281
  busy
3218
3282
  }) {
3219
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3220
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3221
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
3222
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3223
- keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3224
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3283
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3284
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3285
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
3286
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3287
+ keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3288
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3225
3289
  ] })
3226
3290
  ] });
3227
3291
  }
@@ -3322,23 +3386,23 @@ function openingText(field, value) {
3322
3386
  return format ? typedText(format, value) : String(value);
3323
3387
  }
3324
3388
  function ReadsAsNote({ typed, always, children }) {
3325
- const note = (0, import_react24.useRef)(null);
3326
- const [repeats, setRepeats] = (0, import_react24.useState)(false);
3327
- (0, import_react24.useLayoutEffect)(() => {
3389
+ const note = (0, import_react25.useRef)(null);
3390
+ const [repeats, setRepeats] = (0, import_react25.useState)(false);
3391
+ (0, import_react25.useLayoutEffect)(() => {
3328
3392
  if (always) return;
3329
3393
  const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
3330
3394
  setRepeats(words(note.current?.textContent) === words(typed));
3331
3395
  }, [typed, always]);
3332
3396
  if (repeats) return null;
3333
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
3397
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
3334
3398
  }
3335
3399
  function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
3336
- const client = (0, import_react25.useOptionalRecordsClient)();
3400
+ const client = (0, import_react26.useOptionalRecordsClient)();
3337
3401
  const kind = String(editorKindFor(field));
3338
3402
  const needsChoices = kind === "select" || kind === "multi_select";
3339
3403
  const nudge = useChoiceNudge(needsChoices);
3340
- const [choices, setChoices] = (0, import_react24.useState)(null);
3341
- (0, import_react24.useEffect)(() => {
3404
+ const [choices, setChoices] = (0, import_react25.useState)(null);
3405
+ (0, import_react25.useEffect)(() => {
3342
3406
  if (!needsChoices || !client) return;
3343
3407
  let cancelled = false;
3344
3408
  void fieldOptionsOnce(client, field.id).then((result) => {
@@ -3348,7 +3412,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3348
3412
  cancelled = true;
3349
3413
  };
3350
3414
  }, [client, field.id, needsChoices]);
3351
- (0, import_react24.useEffect)(() => {
3415
+ (0, import_react25.useEffect)(() => {
3352
3416
  if (choices && nudge && value.judged === null) onChange({ ...value, judged: judgeTyped(field, value.text, choices, nudge) });
3353
3417
  }, [choices, nudge, value, field, onChange]);
3354
3418
  const judged = value.judged;
@@ -3360,7 +3424,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3360
3424
  judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
3361
3425
  ...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
3362
3426
  });
3363
- const box = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3427
+ const box = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3364
3428
  import_design_system15.BasicInput,
3365
3429
  {
3366
3430
  id,
@@ -3372,16 +3436,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3372
3436
  onChange: (e) => retype(e.target.value)
3373
3437
  }
3374
3438
  );
3375
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3376
- helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3439
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3440
+ helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3377
3441
  box,
3378
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit })
3442
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit })
3379
3443
  ] }) : box,
3380
- judged === null ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
3444
+ judged === null ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
3381
3445
  "Reading ",
3382
3446
  fieldName(field),
3383
3447
  "'s choices\u2026"
3384
- ] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3448
+ ] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3385
3449
  ChoiceAskButtons,
3386
3450
  {
3387
3451
  field,
@@ -3397,19 +3461,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3397
3461
  },
3398
3462
  onCancel: () => onCancel?.()
3399
3463
  }
3400
- ) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "data-records-cell-note": "", className: "flex flex-col gap-1", children: [
3401
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3402
- "span",
3403
- {
3404
- "data-records-typed-refusal": "",
3405
- role: "status",
3406
- title: "why" in judged ? judged.why : void 0,
3407
- className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400",
3408
- children: judged.refusal
3409
- }
3410
- ),
3411
- judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3412
- ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
3464
+ ) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3465
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
3466
+ judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3467
+ ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
3413
3468
  isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
3414
3469
  "Reads as",
3415
3470
  " ",
@@ -3420,7 +3475,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3420
3475
  }).join(", ")
3421
3476
  ) : (() => {
3422
3477
  const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
3423
- return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3478
+ return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3424
3479
  })()
3425
3480
  ] }, value.text)
3426
3481
  ] });
@@ -3433,13 +3488,13 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3433
3488
  const host = useRecordsUi();
3434
3489
  const kind = editorKindFor(field);
3435
3490
  const inputId = id ?? `field-${field.key}`;
3436
- const ownDetails = (0, import_react25.useOptionalRecordsClient)() === null;
3437
- if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3438
- if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
3491
+ const ownDetails = (0, import_react26.useOptionalRecordsClient)() === null;
3492
+ if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3493
+ if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
3439
3494
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
3440
3495
  if (newerControl !== void 0) return newerControl;
3441
3496
  const format = formatForField(field);
3442
- if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3497
+ if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3443
3498
  if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
3444
3499
  const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
3445
3500
  if (own3) return own3;
@@ -3448,17 +3503,17 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3448
3503
  case "formula":
3449
3504
  case "lookup":
3450
3505
  case "rollup":
3451
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3506
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3452
3507
  value === null || value === void 0 ? "\u2014" : String(value),
3453
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ml-2 italic", children: [
3508
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "ml-2 italic", children: [
3454
3509
  fieldName(field),
3455
3510
  " is worked out by the system, so it cannot be typed in"
3456
3511
  ] })
3457
3512
  ] });
3458
3513
  case "json":
3459
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
3514
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
3460
3515
  case "long_text":
3461
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3516
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3462
3517
  import_design_system15.BasicTextarea,
3463
3518
  {
3464
3519
  id: inputId,
@@ -3471,7 +3526,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3471
3526
  case "number":
3472
3527
  case "currency":
3473
3528
  case "percent":
3474
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3529
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3475
3530
  import_design_system15.BasicInput,
3476
3531
  {
3477
3532
  id: inputId,
@@ -3484,11 +3539,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3484
3539
  }
3485
3540
  );
3486
3541
  case "datetime":
3487
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3542
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3488
3543
  case "email":
3489
3544
  case "phone":
3490
3545
  case "url":
3491
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3546
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3492
3547
  import_design_system15.BasicInput,
3493
3548
  {
3494
3549
  id: inputId,
@@ -3500,24 +3555,24 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3500
3555
  }
3501
3556
  );
3502
3557
  case "checkbox":
3503
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3558
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3504
3559
  case "select":
3505
3560
  case "multi_select":
3506
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm });
3561
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm });
3507
3562
  case "member":
3508
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
3563
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
3509
3564
  case "entity_reference":
3510
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3565
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3511
3566
  case "attachment":
3512
3567
  if (hostTakesFiles(host)) {
3513
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3568
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3514
3569
  }
3515
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId });
3570
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId });
3516
3571
  case "relation":
3517
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
3572
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
3518
3573
  default:
3519
3574
  if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
3520
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3575
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3521
3576
  import_design_system15.Checkbox,
3522
3577
  {
3523
3578
  id: inputId,
@@ -3527,7 +3582,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3527
3582
  }
3528
3583
  );
3529
3584
  }
3530
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3585
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3531
3586
  import_design_system15.BasicInput,
3532
3587
  {
3533
3588
  id: inputId,
@@ -3540,11 +3595,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3540
3595
  }
3541
3596
  }
3542
3597
  function TypedWordsControl({ field, value, onChange, disabled, id }) {
3543
- const [text, setText] = (0, import_react24.useState)(() => openingText(field, value));
3544
- const [refusal2, setRefusal] = (0, import_react24.useState)(null);
3545
- const [why, setWhy] = (0, import_react24.useState)(void 0);
3546
- const sent = (0, import_react24.useRef)(value);
3547
- (0, import_react24.useEffect)(() => {
3598
+ const [text, setText] = (0, import_react25.useState)(() => openingText(field, value));
3599
+ const [refusal2, setRefusal] = (0, import_react25.useState)(null);
3600
+ const [why, setWhy] = (0, import_react25.useState)(void 0);
3601
+ const sent = (0, import_react25.useRef)(value);
3602
+ (0, import_react25.useEffect)(() => {
3548
3603
  if (value === sent.current) return;
3549
3604
  sent.current = value;
3550
3605
  setText(openingText(field, value));
@@ -3563,9 +3618,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3563
3618
  setWhy("why" in judged ? judged.why : void 0);
3564
3619
  }
3565
3620
  };
3566
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3567
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3568
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3621
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
3622
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3623
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3569
3624
  import_design_system15.BasicInput,
3570
3625
  {
3571
3626
  id,
@@ -3582,9 +3637,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3582
3637
  }
3583
3638
  }
3584
3639
  ),
3585
- helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3640
+ helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3586
3641
  ] }),
3587
- refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-typed-refusal": "", "data-records-cell-note": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3642
+ refusal2 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FloatingRefusal, { text: refusal2, why }) : null
3588
3643
  ] });
3589
3644
  }
3590
3645
  function typedDatePlaceholder(helper) {
@@ -3595,8 +3650,8 @@ function typedDatePlaceholder(helper) {
3595
3650
  }
3596
3651
  function CheckboxControl({ field, value, onChange, disabled, id }) {
3597
3652
  const unanswered = value === null || value === void 0;
3598
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
3599
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3653
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3654
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3600
3655
  import_design_system15.Checkbox,
3601
3656
  {
3602
3657
  id,
@@ -3606,9 +3661,9 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3606
3661
  onCheckedChange: (next) => onChange(next === true)
3607
3662
  }
3608
3663
  ),
3609
- unanswered ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3610
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3611
- field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3664
+ unanswered ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3665
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3666
+ field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3612
3667
  import_design_system15.Button,
3613
3668
  {
3614
3669
  size: "sm",
@@ -3624,10 +3679,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3624
3679
  }
3625
3680
  function JsonControl({ field, value, onChange, disabled, id }) {
3626
3681
  const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
3627
- const [text, setText] = (0, import_react24.useState)(initial);
3628
- const [broken, setBroken] = (0, import_react24.useState)(null);
3629
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", children: [
3630
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3682
+ const [text, setText] = (0, import_react25.useState)(initial);
3683
+ const [broken, setBroken] = (0, import_react25.useState)(null);
3684
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", children: [
3685
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3631
3686
  import_design_system15.BasicTextarea,
3632
3687
  {
3633
3688
  id,
@@ -3662,7 +3717,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
3662
3717
  broken ? (
3663
3718
  // The typed text is still in the box: the notice owns the two doors out. In a grid cell it
3664
3719
  // floats over the table (`data-records-cell-note`), so the row never grows.
3665
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3720
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3666
3721
  RefusalNotice,
3667
3722
  {
3668
3723
  error: broken,
@@ -3686,11 +3741,11 @@ function inTheStoresOrder(options) {
3686
3741
  return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
3687
3742
  }
3688
3743
  function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm }) {
3689
- const client = (0, import_react25.useOptionalRecordsClient)();
3690
- const [options, setOptions] = (0, import_react24.useState)(null);
3691
- const [refusal2, setRefusal] = (0, import_react24.useState)(null);
3692
- const [reread, setReread] = (0, import_react24.useState)(0);
3693
- (0, import_react24.useEffect)(() => {
3744
+ const client = (0, import_react26.useOptionalRecordsClient)();
3745
+ const [options, setOptions] = (0, import_react25.useState)(null);
3746
+ const [refusal2, setRefusal] = (0, import_react25.useState)(null);
3747
+ const [reread, setReread] = (0, import_react25.useState)(0);
3748
+ (0, import_react25.useEffect)(() => {
3694
3749
  if (!client) return;
3695
3750
  let cancelled = false;
3696
3751
  void fieldOptionsOnce(client, field.id).then((result) => {
@@ -3704,11 +3759,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3704
3759
  }, [client, field.id, reread]);
3705
3760
  const handed = publicChoicesOf(field);
3706
3761
  if (!client && handed.length > 0) {
3707
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3762
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3708
3763
  }
3709
3764
  if (!client) {
3710
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", children: [
3711
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3765
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", children: [
3766
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3712
3767
  import_design_system15.BasicInput,
3713
3768
  {
3714
3769
  id,
@@ -3717,15 +3772,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3717
3772
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
3718
3773
  }
3719
3774
  ),
3720
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3775
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3721
3776
  ] });
3722
3777
  }
3723
3778
  if (refusal2)
3724
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RefusalLine, { error: refusal2 }) });
3725
- if (!options) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3779
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RefusalLine, { error: refusal2 }) });
3780
+ if (!options) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3726
3781
  if (asForm && options.length > 0) {
3727
3782
  const titled = (option) => recordName(option.data, null, "Unnamed choice");
3728
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3783
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3729
3784
  ChoiceAnswer,
3730
3785
  {
3731
3786
  field,
@@ -3742,7 +3797,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3742
3797
  );
3743
3798
  }
3744
3799
  if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
3745
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3800
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3746
3801
  OpenChoicePicker,
3747
3802
  {
3748
3803
  field,
@@ -3765,13 +3820,13 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3765
3820
  );
3766
3821
  }
3767
3822
  if (options.length === 0) {
3768
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3823
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3769
3824
  }
3770
3825
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3771
3826
  if (field.multi) {
3772
3827
  const chosen = options.filter((option) => (0, import_records10.choiceValuesOf)(value).some((v) => (0, import_records10.isTheChosen)(option, v)));
3773
3828
  const picked = new Set(chosen.map((option) => (0, import_records10.optionKey)(option)));
3774
- const toggles = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3829
+ const toggles = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3775
3830
  import_design_system15.Button,
3776
3831
  {
3777
3832
  type: "button",
@@ -3789,7 +3844,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3789
3844
  option.id
3790
3845
  )) });
3791
3846
  if (!autoOpen) return toggles;
3792
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3847
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3793
3848
  import_design_system15.Popover,
3794
3849
  {
3795
3850
  defaultOpen: true,
@@ -3797,14 +3852,14 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3797
3852
  if (!open) onClose?.();
3798
3853
  },
3799
3854
  children: [
3800
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3801
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3855
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3856
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3802
3857
  ]
3803
3858
  }
3804
3859
  );
3805
3860
  }
3806
3861
  const current = options.find((option) => (0, import_records10.isTheChosen)(option, value));
3807
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3862
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3808
3863
  import_design_system15.Select,
3809
3864
  {
3810
3865
  value: current ? (0, import_records10.optionKey)(current) : "",
@@ -3818,8 +3873,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3818
3873
  }
3819
3874
  } : {},
3820
3875
  children: [
3821
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectValue, { placeholder: "Choose" }) }),
3822
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.SelectItem, { value: (0, import_records10.optionKey)(option), children: titleOf(option) }, option.id)) })
3876
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.SelectValue, { placeholder: "Choose" }) }),
3877
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.SelectItem, { value: (0, import_records10.optionKey)(option), children: titleOf(option) }, option.id)) })
3823
3878
  ]
3824
3879
  }
3825
3880
  );
@@ -3839,18 +3894,18 @@ function OpenChoicePicker({
3839
3894
  allowOther = true,
3840
3895
  onChoicesChanged
3841
3896
  }) {
3842
- const client = (0, import_react25.useOptionalRecordsClient)();
3897
+ const client = (0, import_react26.useOptionalRecordsClient)();
3843
3898
  const nudge = useChoiceNudge();
3844
- const [open, setOpenState] = (0, import_react24.useState)(autoOpen === true);
3845
- const onCloseRef = (0, import_react24.useRef)(onClose);
3899
+ const [open, setOpenState] = (0, import_react25.useState)(autoOpen === true);
3900
+ const onCloseRef = (0, import_react25.useRef)(onClose);
3846
3901
  onCloseRef.current = onClose;
3847
- const setOpen = (0, import_react24.useCallback)((next) => {
3902
+ const setOpen = (0, import_react25.useCallback)((next) => {
3848
3903
  setOpenState(next);
3849
3904
  if (!next) onCloseRef.current?.();
3850
3905
  }, []);
3851
- const [search, setSearch] = (0, import_react24.useState)(initialSearch ?? "");
3852
- const [adding, setAdding] = (0, import_react24.useState)(false);
3853
- const [addRefused, setAddRefused] = (0, import_react24.useState)(null);
3906
+ const [search, setSearch] = (0, import_react25.useState)(initialSearch ?? "");
3907
+ const [adding, setAdding] = (0, import_react25.useState)(false);
3908
+ const [addRefused, setAddRefused] = (0, import_react25.useState)(null);
3854
3909
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3855
3910
  const held = withoutAddition(value);
3856
3911
  const current = (0, import_records10.choiceValuesOf)(held.value);
@@ -3908,7 +3963,7 @@ function OpenChoicePicker({
3908
3963
  const pickedOptions = current.map((v) => options.find((o) => (0, import_records10.isTheChosen)(o, v)));
3909
3964
  const cellChips = pickedWords.map((word, i) => {
3910
3965
  const chip = chipOf(pickedOptions[i], word);
3911
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Badge, { variant: "outline", className: (0, import_design_system15.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3966
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Badge, { variant: "outline", className: (0, import_design_system15.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3912
3967
  });
3913
3968
  const headChips = pickedWords.map((word, i) => {
3914
3969
  const option = pickedOptions[i];
@@ -3923,12 +3978,12 @@ function OpenChoicePicker({
3923
3978
  };
3924
3979
  });
3925
3980
  const anchored = autoOpen === true;
3926
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3981
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3927
3982
  anchored || disabled ? null : cellChips,
3928
3983
  disabled ? cellChips : (
3929
3984
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
3930
3985
  // In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
3931
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3986
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3932
3987
  PickOrAdd,
3933
3988
  {
3934
3989
  anchored,
@@ -3954,14 +4009,14 @@ function OpenChoicePicker({
3954
4009
  const option = options.find((o) => o.id === optionId);
3955
4010
  if (option) choose((0, import_records10.optionKey)(option));
3956
4011
  },
3957
- empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
4012
+ empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3958
4013
  add,
3959
4014
  foot,
3960
- footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
4015
+ footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3961
4016
  // never_add on a column that takes only its choices: said, never a silent nothing.
3962
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3963
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3964
- autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
4017
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4018
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
4019
+ autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3965
4020
  ] })
3966
4021
  ) : null,
3967
4022
  children: anchored ? cellChips : null
@@ -3981,9 +4036,9 @@ function RecordChip({
3981
4036
  // name. So it caps at its container and ends in an ellipsis with the whole name in
3982
4037
  // its tooltip, rather than being cut mid-word by whatever box it landed in
3983
4038
  // (lane FIX-14, 2026-09-22).
3984
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system15.Badge, { variant: "secondary", className: (0, import_design_system15.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
3985
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "min-w-0 truncate", children: title }),
3986
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
4039
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system15.Badge, { variant: "secondary", className: (0, import_design_system15.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
4040
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "min-w-0 truncate", children: title }),
4041
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3987
4042
  ] })
3988
4043
  );
3989
4044
  }
@@ -4006,7 +4061,7 @@ function ChoiceAnswer({
4006
4061
  id,
4007
4062
  isChosen
4008
4063
  }) {
4009
- const [search, setSearch] = (0, import_react24.useState)("");
4064
+ const [search, setSearch] = (0, import_react25.useState)("");
4010
4065
  const held = field.multi ? (0, import_records10.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
4011
4066
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
4012
4067
  const press = (choice) => {
@@ -4021,7 +4076,7 @@ function ChoiceAnswer({
4021
4076
  const option = (choice) => {
4022
4077
  const chosen = on(choice);
4023
4078
  const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
4024
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4079
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4025
4080
  "button",
4026
4081
  {
4027
4082
  type: "button",
@@ -4036,7 +4091,7 @@ function ChoiceAnswer({
4036
4091
  chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
4037
4092
  ),
4038
4093
  children: [
4039
- letter ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4094
+ letter ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4040
4095
  "kbd",
4041
4096
  {
4042
4097
  "aria-hidden": "true",
@@ -4047,8 +4102,8 @@ function ChoiceAnswer({
4047
4102
  children: letter
4048
4103
  }
4049
4104
  ) : null,
4050
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
4051
- chosen ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
4105
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
4106
+ chosen ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
4052
4107
  ]
4053
4108
  },
4054
4109
  choice.key
@@ -4064,12 +4119,12 @@ function ChoiceAnswer({
4064
4119
  };
4065
4120
  const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
4066
4121
  if (choices.length <= FORM_SEARCH_AFTER) {
4067
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
4122
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
4068
4123
  }
4069
4124
  const q = search.trim().toLowerCase();
4070
4125
  const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
4071
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
4072
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4126
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
4127
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4073
4128
  import_design_system15.BasicInput,
4074
4129
  {
4075
4130
  value: search,
@@ -4080,27 +4135,27 @@ function ChoiceAnswer({
4080
4135
  className: "h-11 text-base sm:h-9 sm:text-sm"
4081
4136
  }
4082
4137
  ),
4083
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
4138
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
4084
4139
  shown2.map(option),
4085
- shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
4140
+ shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
4086
4141
  ] })
4087
4142
  ] });
4088
4143
  }
4089
4144
 
4090
4145
  // src/RecordsMount.tsx
4091
- var import_react26 = require("react");
4092
- var import_react27 = require("@ai-matrx/records/react");
4093
- var import_jsx_runtime18 = require("react/jsx-runtime");
4146
+ var import_react27 = require("react");
4147
+ var import_react28 = require("@ai-matrx/records/react");
4148
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4094
4149
  function personActor(userId) {
4095
4150
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
4096
4151
  }
4097
4152
 
4098
4153
  // src/tablePicking.tsx
4099
- var import_react28 = require("react");
4154
+ var import_react29 = require("react");
4100
4155
  var import_records11 = require("@ai-matrx/records");
4101
- var import_react29 = require("@ai-matrx/records/react");
4156
+ var import_react30 = require("@ai-matrx/records/react");
4102
4157
  var import_design_system16 = require("@ai-matrx/design-system");
4103
- var import_jsx_runtime19 = require("react/jsx-runtime");
4158
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4104
4159
  var APP_TABLE_PREFIX = "records_ui_";
4105
4160
  function isValueSet(table) {
4106
4161
  if (table.kept_for === "choices") return true;
@@ -4143,7 +4198,7 @@ function madeOn(stamp) {
4143
4198
  }
4144
4199
 
4145
4200
  // src/TablePickers.tsx
4146
- var import_jsx_runtime20 = require("react/jsx-runtime");
4201
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4147
4202
  var SHARED_FOR_MS = 5e3;
4148
4203
  var sharedReads = /* @__PURE__ */ new WeakMap();
4149
4204
  function readTablesAnywhere(dataSource) {
@@ -4175,8 +4230,8 @@ function readTablesAnywhere(dataSource) {
4175
4230
  return read;
4176
4231
  }
4177
4232
  function useTablesAnywhere(dataSource) {
4178
- const [state, setState] = (0, import_react30.useState)({ loading: true, error: null, rows: [] });
4179
- (0, import_react30.useEffect)(() => {
4233
+ const [state, setState] = (0, import_react31.useState)({ loading: true, error: null, rows: [] });
4234
+ (0, import_react31.useEffect)(() => {
4180
4235
  let live = true;
4181
4236
  void readTablesAnywhere(dataSource).then((result) => {
4182
4237
  if (live) setState(result);
@@ -4213,16 +4268,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4213
4268
  hint: t.organization_name,
4214
4269
  keywords: t.organization_name,
4215
4270
  ...twin && second ? {
4216
- render: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
4217
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate", children: t.table_name }),
4218
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4271
+ render: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
4272
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: t.table_name }),
4273
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4219
4274
  ] })
4220
4275
  } : {}
4221
4276
  };
4222
4277
  });
4223
4278
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
4224
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
4225
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4279
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4280
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4226
4281
  import_design_system17.CreatablePicker,
4227
4282
  {
4228
4283
  value: value || null,
@@ -4236,24 +4291,24 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4236
4291
  ariaLabel: "Table"
4237
4292
  }
4238
4293
  ),
4239
- list.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4240
- missing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4294
+ list.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4295
+ missing && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4241
4296
  ] });
4242
4297
  }
4243
4298
  function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
4244
4299
  const own3 = useTablesAnywhere(dataSource);
4245
4300
  const list = tables ?? own3;
4246
4301
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
4247
- if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: unavailable ?? fallback });
4248
- if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: fallback });
4249
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react31.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4302
+ if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: unavailable ?? fallback });
4303
+ if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: fallback });
4304
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react32.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4250
4305
  }
4251
4306
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4252
- const fields = (0, import_react31.useFields)(tableId);
4253
- const all = (0, import_react30.useMemo)(() => fields.data ?? [], [fields.data]);
4254
- const byKey = (0, import_react30.useMemo)(() => new Map(all.map((f) => [f.key, f])), [all]);
4307
+ const fields = (0, import_react32.useFields)(tableId);
4308
+ const all = (0, import_react31.useMemo)(() => fields.data ?? [], [fields.data]);
4309
+ const byKey = (0, import_react31.useMemo)(() => new Map(all.map((f) => [f.key, f])), [all]);
4255
4310
  const keys = Object.keys(value);
4256
- const [adding, setAdding] = (0, import_react30.useState)(false);
4311
+ const [adding, setAdding] = (0, import_react31.useState)(false);
4257
4312
  const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
4258
4313
  const rename = (from, to) => {
4259
4314
  if (from === to) return;
@@ -4266,11 +4321,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4266
4321
  void _gone;
4267
4322
  onChange(rest);
4268
4323
  };
4269
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-2", children: [
4270
- fields.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: fields.error }),
4324
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
4325
+ fields.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RefusalLine, { error: fields.error }),
4271
4326
  keys.map((key) => {
4272
4327
  const field = byKey.get(key);
4273
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4328
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4274
4329
  ColumnValueRow,
4275
4330
  {
4276
4331
  columnKey: key,
@@ -4286,7 +4341,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4286
4341
  key
4287
4342
  );
4288
4343
  }),
4289
- adding && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4344
+ adding && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4290
4345
  ColumnValueRow,
4291
4346
  {
4292
4347
  columnKey: null,
@@ -4303,7 +4358,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4303
4358
  onRemove: () => setAdding(false)
4304
4359
  }
4305
4360
  ),
4306
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system17.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4361
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4307
4362
  ] });
4308
4363
  }
4309
4364
  function ColumnValueRow({
@@ -4319,9 +4374,9 @@ function ColumnValueRow({
4319
4374
  }) {
4320
4375
  const orphan = columnKey !== null && !loading && field === void 0;
4321
4376
  const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
4322
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4323
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
4324
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4377
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4378
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
4379
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4325
4380
  import_design_system17.CreatablePicker,
4326
4381
  {
4327
4382
  value: columnKey,
@@ -4335,22 +4390,22 @@ function ColumnValueRow({
4335
4390
  ariaLabel: "Column"
4336
4391
  }
4337
4392
  ) }),
4338
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system17.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4393
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4339
4394
  ] }),
4340
- field ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4395
+ field ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4341
4396
  ] });
4342
4397
  }
4343
4398
  function RecordPicker({ tableId, value, onChange, disabled }) {
4344
- const table = (0, import_react31.useTable)(tableId);
4345
- const records = (0, import_react31.useRecords)(tableId, { pageSize: 200 });
4399
+ const table = (0, import_react32.useTable)(tableId);
4400
+ const records = (0, import_react32.useRecords)(tableId, { pageSize: 200 });
4346
4401
  const rows = records.data?.rows ?? [];
4347
4402
  const options = rows.map((row) => ({
4348
4403
  value: row.id,
4349
4404
  label: rowNameIn(table.data ?? null, row)
4350
4405
  }));
4351
4406
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
4352
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
4353
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4407
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4408
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4354
4409
  import_design_system17.CreatablePicker,
4355
4410
  {
4356
4411
  value: value || null,
@@ -4364,16 +4419,16 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4364
4419
  ariaLabel: "Record"
4365
4420
  }
4366
4421
  ),
4367
- records.error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RefusalLine, { error: records.error })
4422
+ records.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RefusalLine, { error: records.error })
4368
4423
  ] });
4369
4424
  }
4370
4425
 
4371
4426
  // src/DataBindingPicker.tsx
4372
- var import_react32 = require("react");
4427
+ var import_react33 = require("react");
4373
4428
  var import_records12 = require("@ai-matrx/records");
4374
- var import_react33 = require("@ai-matrx/records/react");
4429
+ var import_react34 = require("@ai-matrx/records/react");
4375
4430
  var import_design_system18 = require("@ai-matrx/design-system");
4376
- var import_jsx_runtime21 = require("react/jsx-runtime");
4431
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4377
4432
  var DATA_BINDING_SHAPES = [
4378
4433
  { value: "collection", label: "The whole table" },
4379
4434
  { value: "reference", label: "One record" },
@@ -4440,9 +4495,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
4440
4495
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
4441
4496
  });
4442
4497
  };
4443
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
4444
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4445
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4498
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", children: [
4499
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4500
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4446
4501
  BindingDetails,
4447
4502
  {
4448
4503
  tableId,
@@ -4461,11 +4516,11 @@ function BindingDetails({
4461
4516
  disabled,
4462
4517
  defaultRowLimit
4463
4518
  }) {
4464
- const table = (0, import_react33.useTable)(tableId);
4465
- const fields = (0, import_react33.useFields)(tableId);
4466
- const fieldList = (0, import_react32.useMemo)(() => fields.data ?? [], [fields.data]);
4519
+ const table = (0, import_react34.useTable)(tableId);
4520
+ const fields = (0, import_react34.useFields)(tableId);
4521
+ const fieldList = (0, import_react33.useMemo)(() => fields.data ?? [], [fields.data]);
4467
4522
  const shape = binding.semantic_type;
4468
- (0, import_react32.useEffect)(() => {
4523
+ (0, import_react33.useEffect)(() => {
4469
4524
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
4470
4525
  onChange({
4471
4526
  ...binding,
@@ -4506,8 +4561,8 @@ function BindingDetails({
4506
4561
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
4507
4562
  const template = binding.transform?.template ?? "";
4508
4563
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
4509
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-2", children: [
4510
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4564
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", children: [
4565
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4511
4566
  import_design_system18.Button,
4512
4567
  {
4513
4568
  type: "button",
@@ -4521,7 +4576,7 @@ function BindingDetails({
4521
4576
  },
4522
4577
  s.value
4523
4578
  )) }),
4524
- shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4579
+ shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4525
4580
  RecordPicker,
4526
4581
  {
4527
4582
  tableId,
@@ -4530,7 +4585,7 @@ function BindingDetails({
4530
4585
  disabled: Boolean(disabled)
4531
4586
  }
4532
4587
  ),
4533
- shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4588
+ shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4534
4589
  import_design_system18.CreatablePicker,
4535
4590
  {
4536
4591
  value: binding.field_key ?? null,
@@ -4544,8 +4599,8 @@ function BindingDetails({
4544
4599
  ariaLabel: "Column"
4545
4600
  }
4546
4601
  ),
4547
- shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
4548
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4602
+ shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", children: [
4603
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4549
4604
  "textarea",
4550
4605
  {
4551
4606
  className: (0, import_design_system18.cn)(
@@ -4557,7 +4612,7 @@ function BindingDetails({
4557
4612
  onChange: (e) => setTemplate(e.target.value)
4558
4613
  }
4559
4614
  ),
4560
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4615
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4561
4616
  import_design_system18.Button,
4562
4617
  {
4563
4618
  type: "button",
@@ -4570,9 +4625,9 @@ function BindingDetails({
4570
4625
  p.token
4571
4626
  )) })
4572
4627
  ] }),
4573
- shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4628
+ shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4574
4629
  "Up to",
4575
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4630
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4576
4631
  import_design_system18.BasicInput,
4577
4632
  {
4578
4633
  type: "number",
@@ -4589,9 +4644,9 @@ function BindingDetails({
4589
4644
  ),
4590
4645
  "rows"
4591
4646
  ] }),
4592
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4593
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4594
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4647
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4648
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4649
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4595
4650
  import_design_system18.Button,
4596
4651
  {
4597
4652
  type: "button",
@@ -4610,7 +4665,7 @@ function BindingDetails({
4610
4665
  }
4611
4666
 
4612
4667
  // src/PickedSummaries.tsx
4613
- var import_react36 = require("@ai-matrx/records/react");
4668
+ var import_react37 = require("@ai-matrx/records/react");
4614
4669
 
4615
4670
  // src/values.tsx
4616
4671
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
@@ -4618,11 +4673,11 @@ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
4618
4673
  var import_design_system21 = require("@ai-matrx/design-system");
4619
4674
 
4620
4675
  // src/embeddedLook.tsx
4621
- var import_react34 = require("react");
4622
- var EmbeddedLookContext = (0, import_react34.createContext)(null);
4676
+ var import_react35 = require("react");
4677
+ var EmbeddedLookContext = (0, import_react35.createContext)(null);
4623
4678
  var EmbeddedLookProvider = EmbeddedLookContext.Provider;
4624
4679
  function useEmbeddedLook() {
4625
- return (0, import_react34.useContext)(EmbeddedLookContext);
4680
+ return (0, import_react35.useContext)(EmbeddedLookContext);
4626
4681
  }
4627
4682
  var EMBEDDED_TABLE_CLASS = [
4628
4683
  "[&_tbody_td]:h-10",
@@ -4670,10 +4725,10 @@ var ABSENCE_WORD_LABEL = {
4670
4725
  var import_core2 = require("@ai-matrx/records/core");
4671
4726
 
4672
4727
  // src/WholeValue.tsx
4673
- var import_react35 = require("react");
4728
+ var import_react36 = require("react");
4674
4729
  var import_core = require("@ai-matrx/records/core");
4675
4730
  var import_design_system19 = require("@ai-matrx/design-system");
4676
- var import_jsx_runtime22 = require("react/jsx-runtime");
4731
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4677
4732
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
4678
4733
  function wholeValueLine(pointer) {
4679
4734
  return `Open the whole text (${(0, import_core.wholeValueSize)(pointer)})`;
@@ -4682,12 +4737,12 @@ function WholeValueCell({ words, pointer }) {
4682
4737
  const host = useRecordsUi();
4683
4738
  const href = host.hrefForFile?.({ fileId: pointer.file_id });
4684
4739
  const line = wholeValueLine(pointer);
4685
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4686
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4740
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4741
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4687
4742
  words,
4688
4743
  "\u2026"
4689
4744
  ] }),
4690
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core.wholeValueSize)(pointer)} in a file` })
4745
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core.wholeValueSize)(pointer)} in a file` })
4691
4746
  ] });
4692
4747
  }
4693
4748
 
@@ -4750,7 +4805,7 @@ function kindLabel(kind) {
4750
4805
  }
4751
4806
 
4752
4807
  // src/ReferenceChips.tsx
4753
- var import_jsx_runtime23 = require("react/jsx-runtime");
4808
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4754
4809
  function glyphOf(icon) {
4755
4810
  const text = (icon ?? "").trim();
4756
4811
  return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
@@ -4783,22 +4838,22 @@ function referencesOf(field, value, kind, labels) {
4783
4838
  var ARCHIVED_REFERENCE_WORD = "Archived";
4784
4839
  var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
4785
4840
  function PageGlyph() {
4786
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4787
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4788
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4789
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M10 13H8" }),
4790
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 17H8" })
4841
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4842
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4843
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4844
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M10 13H8" }),
4845
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M16 17H8" })
4791
4846
  ] });
4792
4847
  }
4793
4848
  function ReferenceChip({ reference, waiting }) {
4794
4849
  const host = useRecordsUi();
4795
4850
  const look = useEmbeddedLook();
4796
4851
  const pending = reference.label == null && reference.token === "record" && !waiting && !host.renderReference;
4797
- const pendingMark = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
4852
+ const pendingMark = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
4798
4853
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4799
4854
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4800
4855
  if (look?.plainRelation) {
4801
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4856
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4802
4857
  "span",
4803
4858
  {
4804
4859
  className: (0, import_design_system20.cn)(
@@ -4810,14 +4865,14 @@ function ReferenceChip({ reference, waiting }) {
4810
4865
  "data-records-reference-archived": reference.archived ? "" : void 0,
4811
4866
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4812
4867
  children: [
4813
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PageGlyph, {}) }),
4814
- drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words })),
4815
- reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4868
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PageGlyph, {}) }),
4869
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: words })),
4870
+ reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4816
4871
  ]
4817
4872
  }
4818
4873
  );
4819
4874
  }
4820
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4875
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4821
4876
  import_design_system20.Badge,
4822
4877
  {
4823
4878
  variant: "secondary",
@@ -4829,15 +4884,15 @@ function ReferenceChip({ reference, waiting }) {
4829
4884
  "data-records-reference-archived": reference.archived ? "" : void 0,
4830
4885
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4831
4886
  children: [
4832
- drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: words })),
4833
- reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4887
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: words })),
4888
+ reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4834
4889
  ]
4835
4890
  }
4836
4891
  );
4837
4892
  }
4838
4893
  function ReferenceChips({ refs, waiting }) {
4839
- if (refs.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4840
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4894
+ if (refs.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4895
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4841
4896
  }
4842
4897
  function KindValueCell({
4843
4898
  kv,
@@ -4846,10 +4901,10 @@ function KindValueCell({
4846
4901
  }) {
4847
4902
  const host = useRecordsUi();
4848
4903
  if (host.renderKind) {
4849
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4904
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4850
4905
  }
4851
4906
  const named = kv.items.map(kindItemWords).filter((w) => w !== null);
4852
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: (0, import_design_system20.cn)("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Badge, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system20.Badge, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4907
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: (0, import_design_system20.cn)("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.Badge, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.Badge, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4853
4908
  }
4854
4909
 
4855
4910
  // src/formulaNames.ts
@@ -4867,10 +4922,10 @@ function formulaSourceArchived(field, document2) {
4867
4922
 
4868
4923
  // src/values.tsx
4869
4924
  var import_records15 = require("@ai-matrx/records");
4870
- var import_jsx_runtime24 = require("react/jsx-runtime");
4925
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4871
4926
  function statusMark(field, item, document2) {
4872
4927
  const mark = statusMarkOf(field, item, document2);
4873
- return mark ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4928
+ return mark ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4874
4929
  }
4875
4930
  function envelopeFor(document2, key) {
4876
4931
  const block = document2?._values;
@@ -4916,47 +4971,47 @@ function sourceArchivedSentence(state) {
4916
4971
  return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
4917
4972
  }
4918
4973
  function SourceArchivedValue({ state }) {
4919
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4974
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4920
4975
  }
4921
4976
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
4922
4977
  function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4923
4978
  const archivedSource = (0, import_records15.sourceArchivedOf)(value);
4924
- if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SourceArchivedValue, { state: archivedSource });
4979
+ if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SourceArchivedValue, { state: archivedSource });
4925
4980
  const envelope = envelopeFor(document2, field.key);
4926
4981
  if (envelope?.absent) {
4927
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4982
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4928
4983
  }
4929
4984
  if (value === null || value === void 0 || value === "") {
4930
4985
  const gone = unresolvedFor(document2, field.key);
4931
4986
  if (gone) {
4932
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4987
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4933
4988
  }
4934
4989
  const archivedInput = formulaSourceArchived(field, document2);
4935
- if (archivedInput) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SourceArchivedValue, { state: archivedInput });
4990
+ if (archivedInput) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SourceArchivedValue, { state: archivedInput });
4936
4991
  const computed = computedEmptyOf(field, document2);
4937
- if (computed?.sentence) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4938
- if (computed?.words) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "data-records-empty-why": computed.kind, children: computed.words });
4992
+ if (computed?.sentence) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4993
+ if (computed?.words) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "data-records-empty-why": computed.kind, children: computed.words });
4939
4994
  if (computed?.why) {
4940
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4995
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4941
4996
  }
4942
4997
  if (look?.blankEmpty) return null;
4943
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4998
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4944
4999
  }
4945
- if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
5000
+ if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
4946
5001
  const newer = newerKindValue(field, value);
4947
5002
  if (newer !== void 0) return newer;
4948
5003
  const whole = typeof value === "string" ? (0, import_core2.wholeValueOf)(document2, field.key) : null;
4949
- if (whole) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WholeValueCell, { words: value, pointer: whole });
5004
+ if (whole) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(WholeValueCell, { words: value, pointer: whole });
4950
5005
  const kind = editorKindFor(field);
4951
5006
  if (kind === "relation" || kind === "entity_reference") {
4952
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
5007
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4953
5008
  }
4954
5009
  if (kind === "member") {
4955
5010
  const ids = (Array.isArray(value) ? value : [value]).filter((v) => v !== null && v !== void 0 && v !== "");
4956
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PersonChip, { name: scalarText(field, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
5011
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PersonChip, { name: scalarText(field, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
4957
5012
  }
4958
5013
  const kv = kind === "attachment" ? null : kindValueOf(value);
4959
- if (kv) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KindValueCell, { kv, where: "cell", title: field.label });
5014
+ if (kv) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KindValueCell, { kv, where: "cell", title: field.label });
4960
5015
  const chosen = kind === "select" || kind === "multi_select";
4961
5016
  const chipOf = (item) => {
4962
5017
  const chipLook = choiceChipLookOf(field, item, scalarText(field, item, labels));
@@ -4964,9 +5019,9 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4964
5019
  };
4965
5020
  if (chosen) {
4966
5021
  const items = Array.isArray(value) ? value : [value];
4967
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
5022
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4968
5023
  const chip = chipOf(item);
4969
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5024
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4970
5025
  import_design_system21.Badge,
4971
5026
  {
4972
5027
  variant: "outline",
@@ -4974,7 +5029,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4974
5029
  "data-records-choice-chip": "",
4975
5030
  ...chip.tinted ? { "data-records-choice-tint": "" } : {},
4976
5031
  children: [
4977
- look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: (0, import_design_system21.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
5032
+ look?.choiceDot ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: (0, import_design_system21.cn)("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4978
5033
  statusMark(field, item, Array.isArray(value) ? void 0 : document2),
4979
5034
  scalarText(field, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
4980
5035
  ]
@@ -4983,13 +5038,13 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4983
5038
  );
4984
5039
  }) });
4985
5040
  }
4986
- if (kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AttachmentChips, { value });
5041
+ if (kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AttachmentChips, { value });
4987
5042
  if (Array.isArray(value)) {
4988
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system21.Badge, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
5043
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system21.Badge, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4989
5044
  }
4990
5045
  if (kind === "url" && typeof value === "string") {
4991
5046
  const href = value.includes("://") ? value : `https://${value}`;
4992
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5047
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4993
5048
  "a",
4994
5049
  {
4995
5050
  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",
@@ -5000,14 +5055,14 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
5000
5055
  "data-records-link-chip": "",
5001
5056
  onClick: (event) => event.stopPropagation(),
5002
5057
  children: [
5003
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
5004
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: linkChipText(value) })
5058
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
5059
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate", children: linkChipText(value) })
5005
5060
  ]
5006
5061
  }
5007
5062
  );
5008
5063
  }
5009
5064
  if (kind === "phone" && typeof value === "string" && value.trim() !== "") {
5010
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5065
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5011
5066
  "a",
5012
5067
  {
5013
5068
  className: "truncate tabular-nums text-primary underline-offset-2 hover:underline",
@@ -5020,12 +5075,12 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
5020
5075
  );
5021
5076
  }
5022
5077
  if (kind === "email" && typeof value === "string") {
5023
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
5078
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
5024
5079
  }
5025
5080
  if (typeof value === "boolean") {
5026
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
5081
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
5027
5082
  }
5028
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: (0, import_design_system21.cn)("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
5083
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: (0, import_design_system21.cn)("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
5029
5084
  }
5030
5085
  function scalarText(field, value, labels, stillWaitingFor) {
5031
5086
  if (value === null || value === void 0) return "\u2014";
@@ -5067,13 +5122,13 @@ function scalarText(field, value, labels, stillWaitingFor) {
5067
5122
  }
5068
5123
 
5069
5124
  // src/PickedSummaries.tsx
5070
- var import_jsx_runtime25 = require("react/jsx-runtime");
5125
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5071
5126
  function TableNameText({ dataSource, tableId }) {
5072
5127
  const tables = useTablesAnywhere(dataSource);
5073
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5074
- if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5075
- if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load the table's name" });
5076
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
5128
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2014" });
5129
+ if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" });
5130
+ if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load the table's name" });
5131
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
5077
5132
  }
5078
5133
  function ColumnValuesText({
5079
5134
  dataSource,
@@ -5081,38 +5136,38 @@ function ColumnValuesText({
5081
5136
  tableId,
5082
5137
  value
5083
5138
  }) {
5084
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5085
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5139
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2014" });
5140
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5086
5141
  TableScope,
5087
5142
  {
5088
5143
  dataSource,
5089
5144
  userId,
5090
5145
  tableId,
5091
- fallback: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" }),
5092
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this table's columns" }),
5093
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ColumnValuesWords, { tableId, value }) })
5146
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" }),
5147
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this table's columns" }),
5148
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColumnValuesWords, { tableId, value }) })
5094
5149
  }
5095
5150
  );
5096
5151
  }
5097
5152
  function ColumnValuesWords({ tableId, value }) {
5098
- const fields = (0, import_react36.useFields)(tableId);
5153
+ const fields = (0, import_react37.useFields)(tableId);
5099
5154
  const labels = useRecordLabels(fields.data ?? void 0);
5100
- if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5101
- if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this table's columns" });
5155
+ if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" });
5156
+ if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this table's columns" });
5102
5157
  const parts = [];
5103
5158
  for (const [key, stored] of Object.entries(value)) {
5104
5159
  if (key.startsWith("_")) continue;
5105
5160
  const field = (fields.data ?? []).find((f) => f.key === key);
5106
- if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: ", " }, `${key}-sep`));
5161
+ if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: ", " }, `${key}-sep`));
5107
5162
  parts.push(
5108
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
5163
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
5109
5164
  field ? fieldName(field) : "A removed column",
5110
5165
  " is ",
5111
5166
  field ? renderValue(field, stored, void 0, labels) : "\u2014"
5112
5167
  ] }, key)
5113
5168
  );
5114
5169
  }
5115
- return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5170
+ return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2014" });
5116
5171
  }
5117
5172
  function RecordNameText({
5118
5173
  dataSource,
@@ -5120,42 +5175,42 @@ function RecordNameText({
5120
5175
  tableId,
5121
5176
  recordId
5122
5177
  }) {
5123
- if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2014" });
5124
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5178
+ if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2014" });
5179
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5125
5180
  TableScope,
5126
5181
  {
5127
5182
  dataSource,
5128
5183
  userId,
5129
5184
  tableId,
5130
- fallback: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" }),
5131
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this record" }),
5132
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RecordNameWords, { tableId, recordId })
5185
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" }),
5186
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this record" }),
5187
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RecordNameWords, { tableId, recordId })
5133
5188
  }
5134
5189
  );
5135
5190
  }
5136
5191
  function RecordNameWords({ tableId, recordId }) {
5137
- const table = (0, import_react36.useTable)(tableId);
5138
- const record = (0, import_react36.useRecord)(recordId);
5139
- if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "\u2026" });
5140
- if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "Couldn't load this record" });
5141
- if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: "A record you cannot open" });
5142
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5192
+ const table = (0, import_react37.useTable)(tableId);
5193
+ const record = (0, import_react37.useRecord)(recordId);
5194
+ if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" });
5195
+ if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this record" });
5196
+ if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "A record you cannot open" });
5197
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5143
5198
  }
5144
5199
 
5145
5200
  // src/HeldChangeDecision.tsx
5146
- var import_react37 = require("react");
5147
- var import_react38 = require("@ai-matrx/records/react");
5201
+ var import_react38 = require("react");
5202
+ var import_react39 = require("@ai-matrx/records/react");
5148
5203
  var import_design_system22 = require("@ai-matrx/design-system");
5149
- var import_jsx_runtime26 = require("react/jsx-runtime");
5204
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5150
5205
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
5151
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react38.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Decision, { approvalId, onDecided }) });
5206
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react39.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Decision, { approvalId, onDecided }) });
5152
5207
  }
5153
5208
  function Decision({ approvalId, onDecided }) {
5154
- const client = (0, import_react38.useRecordsClient)();
5155
- const [may, setMay] = (0, import_react37.useState)(null);
5156
- const [busy, setBusy] = (0, import_react37.useState)(null);
5157
- const [error, setError] = (0, import_react37.useState)(null);
5158
- (0, import_react37.useEffect)(() => {
5209
+ const client = (0, import_react39.useRecordsClient)();
5210
+ const [may, setMay] = (0, import_react38.useState)(null);
5211
+ const [busy, setBusy] = (0, import_react38.useState)(null);
5212
+ const [error, setError] = (0, import_react38.useState)(null);
5213
+ (0, import_react38.useEffect)(() => {
5159
5214
  let live = true;
5160
5215
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
5161
5216
  if (!live) return;
@@ -5177,13 +5232,13 @@ function Decision({ approvalId, onDecided }) {
5177
5232
  if (res.ok) onDecided(approve);
5178
5233
  else setError(res.error);
5179
5234
  };
5180
- if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5181
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
5182
- may ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-2", children: [
5183
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5184
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5185
- ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5186
- error ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RefusalLine, { error }) : null
5235
+ if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5236
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
5237
+ may ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
5238
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_design_system22.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5239
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_design_system22.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5240
+ ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5241
+ error ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RefusalLine, { error }) : null
5187
5242
  ] });
5188
5243
  }
5189
5244
  //# sourceMappingURL=pickers.cjs.map