@ai-matrx/records-ui 0.115.94 → 0.115.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3985,7 +3985,7 @@ function ReferenceBuilder({
3985
3985
  }
3986
3986
 
3987
3987
  // src/gridEditing.tsx
3988
- import { useCallback as useCallback10, useEffect as useEffect27, useMemo as useMemo15, useRef as useRef22, useState as useState37 } from "react";
3988
+ import { useCallback as useCallback10, useEffect as useEffect28, useMemo as useMemo15, useRef as useRef23, useState as useState37 } from "react";
3989
3989
  import { isButtonField as isButtonField4 } from "@ai-matrx/records";
3990
3990
  import { asWriteConflict, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
3991
3991
  import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
@@ -4738,7 +4738,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
4738
4738
  }
4739
4739
 
4740
4740
  // src/editors.tsx
4741
- import { useCallback as useCallback8, useEffect as useEffect24, useLayoutEffect as useLayoutEffect3, useRef as useRef19, useState as useState35 } from "react";
4741
+ import { useCallback as useCallback8, useEffect as useEffect25, useLayoutEffect as useLayoutEffect3, useRef as useRef20, useState as useState35 } from "react";
4742
4742
  import { isButtonField as isButtonField3, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf5, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
4743
4743
  import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
4744
4744
  import {
@@ -5407,7 +5407,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
5407
5407
  }
5408
5408
 
5409
5409
  // src/buttonCell.tsx
5410
- import { useState as useState30 } from "react";
5410
+ import { useEffect as useEffect22, useRef as useRef17, useState as useState30 } from "react";
5411
5411
  import { Button as Button18, Dialog as Dialog2, DialogContent as DialogContent2, DialogDescription, DialogHeader as DialogHeader2, DialogTitle as DialogTitle2, Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn24 } from "@ai-matrx/design-system";
5412
5412
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2, NEUTRAL_CHIP_CLASS as NEUTRAL_CHIP_CLASS2, isStyleColor as isStyleColor2 } from "@ai-matrx/design-system/data-table";
5413
5413
  import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
@@ -10597,6 +10597,15 @@ function buttonPressWords(label, pressed) {
10597
10597
  const status = pressed.status ?? "ran";
10598
10598
  return [`${pressed.automation ?? label}: ${status}.`, pressed.says].filter(Boolean).join(" ");
10599
10599
  }
10600
+ var POLL_EVERY_MS = 1200;
10601
+ var POLL_FOR_MS = 12e4;
10602
+ function runAnswerWords(label, run) {
10603
+ const steps = run.steps ?? [];
10604
+ const failedStep = [...steps].reverse().find((s) => s.status === "failed");
10605
+ if (run.status === "failed") return [failedStep?.output_text ?? failedStep?.says, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.`;
10606
+ const answered = [...steps].reverse().find((s) => s.output_text && s.output_text.trim() !== "");
10607
+ return answered?.output_text?.trim() || run.says || `${label} ran.`;
10608
+ }
10600
10609
  var stop = (event) => event.stopPropagation();
10601
10610
  function ButtonValue({ field: field2, recordId, inCell }) {
10602
10611
  const client = useOptionalRecordsClient10();
@@ -10604,6 +10613,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
10604
10613
  const [busy, setBusy] = useState30(false);
10605
10614
  const [said2, setSaid] = useState30(null);
10606
10615
  const [settingUp, setSettingUp] = useState30(false);
10616
+ const waitingOn = useRef17(0);
10617
+ useEffect22(() => () => void (waitingOn.current += 1), []);
10607
10618
  if (!b) return null;
10608
10619
  const color = isStyleColor2(b.color) ? CHOICE_CHIP_CLASS2[b.color] : NEUTRAL_CHIP_CLASS2;
10609
10620
  const needs = buttonNeeds2(b);
@@ -10620,60 +10631,100 @@ function ButtonValue({ field: field2, recordId, inCell }) {
10620
10631
  const opened = typeof window !== "undefined" ? openOutbound(pressed.url, "_blank", "noopener") : null;
10621
10632
  return setSaid({ kind: "ran", says: opened ? `${b.label} opened.` : `${b.label} is ready:`, link: pressed.url });
10622
10633
  }
10623
- setSaid({ kind: "ran", says: buttonPressWords(b.label, pressed) });
10634
+ const words2 = buttonPressWords(b.label, pressed);
10635
+ if (pressed.do === "run_automation" && pressed.status === "waiting" && pressed.run_id && b.automation_id) {
10636
+ const mine = waitingOn.current += 1;
10637
+ setBusy(true);
10638
+ setSaid({ kind: "waiting", says: `${b.label} is running` });
10639
+ const until = Date.now() + POLL_FOR_MS;
10640
+ while (waitingOn.current === mine) {
10641
+ await new Promise((r) => setTimeout(r, POLL_EVERY_MS));
10642
+ if (waitingOn.current !== mine) return;
10643
+ const runs = await client.automationRuns({ automation_id: b.automation_id, limit: 10 });
10644
+ if (!runs.ok) {
10645
+ setBusy(false);
10646
+ return setSaid({ kind: "refused", error: runs.error });
10647
+ }
10648
+ const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
10649
+ if (run && run.status !== "waiting") {
10650
+ setBusy(false);
10651
+ return setSaid(run.status === "ran" ? { kind: "ran", says: runAnswerWords(b.label, run) } : { kind: "failed", says: runAnswerWords(b.label, run) });
10652
+ }
10653
+ if (Date.now() > until) {
10654
+ setBusy(false);
10655
+ return setSaid({ kind: "ran", says: `${b.label} is still running. Its answer will be in the automation's runs.` });
10656
+ }
10657
+ }
10658
+ return;
10659
+ }
10660
+ setSaid({ kind: "ran", says: words2 });
10624
10661
  };
10625
10662
  return /* @__PURE__ */ jsxs36(Fragment12, { children: [
10626
- /* @__PURE__ */ jsxs36(Popover5, { open: said2 !== null, onOpenChange: (open) => open ? null : setSaid(null), children: [
10627
- /* @__PURE__ */ jsx40(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx40(
10628
- Button18,
10629
- {
10630
- type: "button",
10631
- size: "xs",
10632
- variant: "outline",
10633
- "data-records-button": field2.key,
10634
- "data-records-button-unset": needs ? "" : void 0,
10635
- "aria-busy": busy || void 0,
10636
- disabled: busy,
10637
- className: cn24("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
10638
- onPointerDown: stop,
10639
- onDoubleClick: stop,
10640
- onClick: (event) => {
10641
- event.stopPropagation();
10642
- event.preventDefault();
10643
- void press();
10644
- },
10645
- children: /* @__PURE__ */ jsx40("span", { className: "truncate", children: b.label })
10646
- }
10647
- ) }),
10648
- /* @__PURE__ */ jsxs36(PopoverContent5, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
10649
- said2?.kind === "refused" ? /* @__PURE__ */ jsx40(RefusalLine, { error: said2.error }) : null,
10650
- said2?.kind === "public" ? /* @__PURE__ */ jsx40("p", { children: "Buttons run for signed-in people." }) : null,
10651
- said2?.kind === "ran" ? /* @__PURE__ */ jsxs36("p", { className: "break-words", children: [
10652
- said2.says,
10653
- " ",
10654
- said2.link ? /* @__PURE__ */ jsx40(OutboundLink6, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
10655
- ] }) : null,
10656
- said2?.kind === "needs" ? /* @__PURE__ */ jsxs36(Fragment12, { children: [
10657
- /* @__PURE__ */ jsx40("p", { children: said2.says }),
10658
- tableId ? /* @__PURE__ */ jsxs36(
10663
+ /* @__PURE__ */ jsxs36(
10664
+ Popover5,
10665
+ {
10666
+ open: said2 !== null,
10667
+ onOpenChange: (open) => {
10668
+ if (open) return;
10669
+ waitingOn.current += 1;
10670
+ setBusy(false);
10671
+ setSaid(null);
10672
+ },
10673
+ children: [
10674
+ /* @__PURE__ */ jsx40(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx40(
10659
10675
  Button18,
10660
10676
  {
10661
10677
  type: "button",
10662
- size: "sm",
10663
- "data-records-button-set-up": "",
10664
- onClick: () => {
10665
- setSaid(null);
10666
- setSettingUp(true);
10678
+ size: "xs",
10679
+ variant: "outline",
10680
+ "data-records-button": field2.key,
10681
+ "data-records-button-unset": needs ? "" : void 0,
10682
+ "aria-busy": busy || void 0,
10683
+ disabled: busy,
10684
+ className: cn24("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
10685
+ onPointerDown: stop,
10686
+ onDoubleClick: stop,
10687
+ onClick: (event) => {
10688
+ event.stopPropagation();
10689
+ event.preventDefault();
10690
+ void press();
10667
10691
  },
10668
- children: [
10669
- "Set up ",
10670
- b.label
10671
- ]
10692
+ children: /* @__PURE__ */ jsx40("span", { className: "truncate", children: b.label })
10672
10693
  }
10673
- ) : null
10674
- ] }) : null
10675
- ] })
10676
- ] }),
10694
+ ) }),
10695
+ /* @__PURE__ */ jsxs36(PopoverContent5, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
10696
+ said2?.kind === "refused" ? /* @__PURE__ */ jsx40(RefusalLine, { error: said2.error }) : null,
10697
+ said2?.kind === "waiting" ? /* @__PURE__ */ jsx40("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
10698
+ said2?.kind === "failed" ? /* @__PURE__ */ jsx40("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
10699
+ said2?.kind === "public" ? /* @__PURE__ */ jsx40("p", { children: "Buttons run for signed-in people." }) : null,
10700
+ said2?.kind === "ran" ? /* @__PURE__ */ jsxs36("p", { className: "break-words", children: [
10701
+ said2.says,
10702
+ " ",
10703
+ said2.link ? /* @__PURE__ */ jsx40(OutboundLink6, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
10704
+ ] }) : null,
10705
+ said2?.kind === "needs" ? /* @__PURE__ */ jsxs36(Fragment12, { children: [
10706
+ /* @__PURE__ */ jsx40("p", { children: said2.says }),
10707
+ tableId ? /* @__PURE__ */ jsxs36(
10708
+ Button18,
10709
+ {
10710
+ type: "button",
10711
+ size: "sm",
10712
+ "data-records-button-set-up": "",
10713
+ onClick: () => {
10714
+ setSaid(null);
10715
+ setSettingUp(true);
10716
+ },
10717
+ children: [
10718
+ "Set up ",
10719
+ b.label
10720
+ ]
10721
+ }
10722
+ ) : null
10723
+ ] }) : null
10724
+ ] })
10725
+ ]
10726
+ }
10727
+ ),
10677
10728
  settingUp && tableId ? /* @__PURE__ */ jsx40(Dialog2, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs36(DialogContent2, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop, onPointerDown: stop, children: [
10678
10729
  /* @__PURE__ */ jsxs36(DialogHeader2, { children: [
10679
10730
  /* @__PURE__ */ jsx40(DialogTitle2, { children: `Column settings \xB7 ${fieldName(field2)}` }),
@@ -10685,7 +10736,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
10685
10736
  }
10686
10737
 
10687
10738
  // src/FloatingRefusal.tsx
10688
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef17, useState as useState31 } from "react";
10739
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef18, useState as useState31 } from "react";
10689
10740
  import { createPortal } from "react-dom";
10690
10741
  import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
10691
10742
  var GAP2 = 4;
@@ -10703,8 +10754,8 @@ function placeFor(anchor, note) {
10703
10754
  return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
10704
10755
  }
10705
10756
  function FloatingRefusal({ text, why }) {
10706
- const spot = useRef17(null);
10707
- const note = useRef17(null);
10757
+ const spot = useRef18(null);
10758
+ const note = useRef18(null);
10708
10759
  const [style, setStyle] = useState31(null);
10709
10760
  const [floating, setFloating] = useState31(false);
10710
10761
  useLayoutEffect2(() => {
@@ -10749,7 +10800,7 @@ function FloatingRefusal({ text, why }) {
10749
10800
  }
10750
10801
 
10751
10802
  // src/formatControls.tsx
10752
- import { useEffect as useEffect22, useRef as useRef18, useState as useState32 } from "react";
10803
+ import { useEffect as useEffect23, useRef as useRef19, useState as useState32 } from "react";
10753
10804
  import { BasicInput as BasicInput10, BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
10754
10805
  import { getFieldFormat as getFieldFormat4, parseFieldInput } from "@ai-matrx/design-system/field-formats";
10755
10806
  import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -10770,8 +10821,8 @@ function keptValue(format, raw) {
10770
10821
  }
10771
10822
  function NumberInFormat({ format, value, onChange, disabled, id }) {
10772
10823
  const [text, setText] = useState32(() => typedText(format, value));
10773
- const lastSent = useRef18(void 0);
10774
- useEffect22(() => {
10824
+ const lastSent = useRef19(void 0);
10825
+ useEffect23(() => {
10775
10826
  if (value === lastSent.current) return;
10776
10827
  setText(typedText(format, value));
10777
10828
  }, [value, format]);
@@ -11006,7 +11057,7 @@ function TypedDateHelper({
11006
11057
  }
11007
11058
 
11008
11059
  // src/choiceNudge.ts
11009
- import { useEffect as useEffect23, useState as useState34 } from "react";
11060
+ import { useEffect as useEffect24, useState as useState34 } from "react";
11010
11061
  import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
11011
11062
  var asked2 = /* @__PURE__ */ new WeakMap();
11012
11063
  function choiceNudgeOf(client) {
@@ -11023,7 +11074,7 @@ function choiceNudgeOf(client) {
11023
11074
  function useChoiceNudge(enabled = true) {
11024
11075
  const client = useOptionalRecordsClient11();
11025
11076
  const [nudge, setNudge] = useState34(null);
11026
- useEffect23(() => {
11077
+ useEffect24(() => {
11027
11078
  if (!enabled || !client) return;
11028
11079
  let live = true;
11029
11080
  void choiceNudgeOf(client).then((answer) => {
@@ -11211,7 +11262,7 @@ function draftFromTyping(field2, seed) {
11211
11262
  return { typedDraft: true, text: seed, judged: judgeTyped(field2, seed) };
11212
11263
  }
11213
11264
  function ReadsAsNote({ typed: typed2, always, children }) {
11214
- const note = useRef19(null);
11265
+ const note = useRef20(null);
11215
11266
  const [repeats, setRepeats] = useState35(false);
11216
11267
  useLayoutEffect3(() => {
11217
11268
  if (always) return;
@@ -11227,7 +11278,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
11227
11278
  const needsChoices = kind2 === "select" || kind2 === "multi_select";
11228
11279
  const nudge = useChoiceNudge(needsChoices);
11229
11280
  const [choices, setChoices] = useState35(null);
11230
- useEffect24(() => {
11281
+ useEffect25(() => {
11231
11282
  if (!needsChoices || !client) return;
11232
11283
  let cancelled = false;
11233
11284
  void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((result) => {
@@ -11237,7 +11288,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
11237
11288
  cancelled = true;
11238
11289
  };
11239
11290
  }, [client, field2.id, needsChoices]);
11240
- useEffect24(() => {
11291
+ useEffect25(() => {
11241
11292
  if (choices && nudge && value.judged === null) onChange({ ...value, judged: judgeTyped(field2, value.text, choices, nudge) });
11242
11293
  }, [choices, nudge, value, field2, onChange]);
11243
11294
  const judged = value.judged;
@@ -11436,8 +11487,8 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
11436
11487
  const [text, setText] = useState35(() => openingText(field2, value));
11437
11488
  const [refusal3, setRefusal] = useState35(null);
11438
11489
  const [why, setWhy] = useState35(void 0);
11439
- const sent = useRef19(value);
11440
- useEffect24(() => {
11490
+ const sent = useRef20(value);
11491
+ useEffect25(() => {
11441
11492
  if (value === sent.current) return;
11442
11493
  sent.current = value;
11443
11494
  setText(openingText(field2, value));
@@ -11583,7 +11634,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
11583
11634
  const [options, setOptions] = useState35(null);
11584
11635
  const [refusal3, setRefusal] = useState35(null);
11585
11636
  const [reread, setReread] = useState35(0);
11586
- useEffect24(() => {
11637
+ useEffect25(() => {
11587
11638
  if (!client) return;
11588
11639
  let cancelled = false;
11589
11640
  void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((result) => {
@@ -11750,7 +11801,7 @@ function OpenChoicePicker({
11750
11801
  const client = useOptionalRecordsClient12();
11751
11802
  const nudge = useChoiceNudge();
11752
11803
  const [open, setOpenState] = useState35(autoOpen === true);
11753
- const onCloseRef = useRef19(onClose);
11804
+ const onCloseRef = useRef20(onClose);
11754
11805
  onCloseRef.current = onClose;
11755
11806
  const setOpen = useCallback8((next) => {
11756
11807
  setOpenState(next);
@@ -12018,7 +12069,7 @@ function ChoiceAnswer({
12018
12069
  }
12019
12070
 
12020
12071
  // src/whoChangedSource.tsx
12021
- import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as useEffect25, useMemo as useMemo14, useRef as useRef20, useState as useState36 } from "react";
12072
+ import { createContext as createContext6, useCallback as useCallback9, useContext as useContext6, useEffect as useEffect26, useMemo as useMemo14, useRef as useRef21, useState as useState36 } from "react";
12022
12073
  import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
12023
12074
 
12024
12075
  // src/whoChanged.ts
@@ -12094,8 +12145,8 @@ function WhoChangedSource({
12094
12145
  const membersPort = host.members;
12095
12146
  const [answers2, setAnswers] = useState36({});
12096
12147
  const [roster, setRoster] = useState36({});
12097
- const asked4 = useRef20(/* @__PURE__ */ new Set());
12098
- useEffect25(() => {
12148
+ const asked4 = useRef21(/* @__PURE__ */ new Set());
12149
+ useEffect26(() => {
12099
12150
  if (!membersPort) return;
12100
12151
  let cancelled = false;
12101
12152
  void membersPort().then((people) => {
@@ -12246,7 +12297,7 @@ function holdKeys() {
12246
12297
  }
12247
12298
 
12248
12299
  // src/unsentWrites.ts
12249
- import { useEffect as useEffect26, useRef as useRef21 } from "react";
12300
+ import { useEffect as useEffect27, useRef as useRef22 } from "react";
12250
12301
  var UNSENT_LINE = "Not saved";
12251
12302
  function browserIsOffline() {
12252
12303
  return typeof navigator !== "undefined" && navigator.onLine === false;
@@ -12255,9 +12306,9 @@ function isUnsentWrite(error) {
12255
12306
  return error.code === "unreachable" || browserIsOffline();
12256
12307
  }
12257
12308
  function useWhenBackOnline(resend) {
12258
- const latest = useRef21(resend);
12309
+ const latest = useRef22(resend);
12259
12310
  latest.current = resend;
12260
- useEffect26(() => {
12311
+ useEffect27(() => {
12261
12312
  if (typeof window === "undefined") return;
12262
12313
  const onOnline = () => latest.current();
12263
12314
  window.addEventListener("online", onOnline);
@@ -12305,23 +12356,23 @@ function rememberVersion(cache, recordId, version2) {
12305
12356
  }
12306
12357
  function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWrite, mayWriteRow, onWritten, onEnded, versions: shared }) {
12307
12358
  const afterWrite = reloadAfterWrite ?? reload;
12308
- const endedRef = useRef22(onEnded);
12359
+ const endedRef = useRef23(onEnded);
12309
12360
  endedRef.current = onEnded;
12310
12361
  const client = useRecordsClient13();
12311
12362
  const own3 = (0, recordVersions_exports.useRecordVersions)(client, shared ? NO_ROWS : rows);
12312
12363
  const source = shared ?? own3;
12313
- const rowsNow = useRef22(rows);
12364
+ const rowsNow = useRef23(rows);
12314
12365
  rowsNow.current = rows;
12315
12366
  const [editing, setEditing] = useState37(null);
12316
12367
  const [draft, setDraft] = useState37(null);
12317
- const searchSeed = useRef22(null);
12318
- const typed2 = useRef22(null);
12319
- const startedFrom = useRef22(null);
12320
- const startedStored = useRef22(null);
12368
+ const searchSeed = useRef23(null);
12369
+ const typed2 = useRef23(null);
12370
+ const startedFrom = useRef23(null);
12371
+ const startedStored = useRef23(null);
12321
12372
  const host = useRecordsUi();
12322
- const fieldsRef = useRef22(fields);
12373
+ const fieldsRef = useRef23(fields);
12323
12374
  fieldsRef.current = fields;
12324
- const forceNext = useRef22(/* @__PURE__ */ new Set());
12375
+ const forceNext = useRef23(/* @__PURE__ */ new Set());
12325
12376
  const type = useCallback10((value) => {
12326
12377
  typed2.current = value;
12327
12378
  setDraft(value);
@@ -12331,10 +12382,10 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
12331
12382
  const [refusals, setRefusals] = useState37({});
12332
12383
  const [rowError, setRowError] = useState37(null);
12333
12384
  const [busy, setBusy] = useState37(false);
12334
- const versions = useRef22(/* @__PURE__ */ new Map());
12335
- const versionReads = useRef22(/* @__PURE__ */ new Map());
12336
- const queues = useRef22(/* @__PURE__ */ new Map());
12337
- const writtenRef = useRef22(onWritten);
12385
+ const versions = useRef23(/* @__PURE__ */ new Map());
12386
+ const versionReads = useRef23(/* @__PURE__ */ new Map());
12387
+ const queues = useRef23(/* @__PURE__ */ new Map());
12388
+ const writtenRef = useRef23(onWritten);
12338
12389
  writtenRef.current = onWritten;
12339
12390
  const editable = useMemo15(() => fields.filter(fieldIsEditable), [fields]);
12340
12391
  const order = useMemo15(() => editable.map((f) => f.key), [editable]);
@@ -12364,8 +12415,8 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
12364
12415
  (rowId, key) => refusals[cellKey(rowId, key)] ?? null,
12365
12416
  [refusals]
12366
12417
  );
12367
- const settling = useRef22(/* @__PURE__ */ new Map());
12368
- useEffect27(() => {
12418
+ const settling = useRef23(/* @__PURE__ */ new Map());
12419
+ useEffect28(() => {
12369
12420
  if (settling.current.size === 0) return;
12370
12421
  const released = [];
12371
12422
  for (const [id, before] of settling.current) {
@@ -12455,7 +12506,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
12455
12506
  },
12456
12507
  [writable, client, editing, shownValue2, optimistic, rows, host, fields]
12457
12508
  );
12458
- const openRef = useRef22(null);
12509
+ const openRef = useRef23(null);
12459
12510
  openRef.current = editing;
12460
12511
  const cancel = useCallback10((via = "key") => {
12461
12512
  const open = openRef.current;
@@ -12894,7 +12945,7 @@ function GridCell({
12894
12945
  clickOpens = false
12895
12946
  }) {
12896
12947
  const ui = useRecordsUi();
12897
- const saidAt = useRef22(0);
12948
+ const saidAt = useRef23(0);
12898
12949
  const sayWhyNot = () => {
12899
12950
  if (Date.now() - saidAt.current < 4e3) return;
12900
12951
  saidAt.current = Date.now();
@@ -12904,9 +12955,9 @@ function GridCell({
12904
12955
  const open = Boolean(
12905
12956
  editing && editing.editing?.rowId === row.id && editing.editing.key === field2.key
12906
12957
  );
12907
- const closedControl = useRef22(null);
12908
- const wasOpen = useRef22(false);
12909
- useEffect27(() => {
12958
+ const closedControl = useRef23(null);
12959
+ const wasOpen = useRef23(false);
12960
+ useEffect28(() => {
12910
12961
  if (open) {
12911
12962
  wasOpen.current = true;
12912
12963
  return;
@@ -12920,13 +12971,13 @@ function GridCell({
12920
12971
  });
12921
12972
  return () => cancelAnimationFrame(frame);
12922
12973
  }, [open, clickOpens]);
12923
- const wasActive = useRef22(false);
12924
- const singlePress = useRef22(null);
12974
+ const wasActive = useRef23(false);
12975
+ const singlePress = useRef23(null);
12925
12976
  const cancelSinglePress = () => {
12926
12977
  if (singlePress.current) clearTimeout(singlePress.current);
12927
12978
  singlePress.current = null;
12928
12979
  };
12929
- useEffect27(() => cancelSinglePress, []);
12980
+ useEffect28(() => cancelSinglePress, []);
12930
12981
  const afterSinglePress = (act) => {
12931
12982
  cancelSinglePress();
12932
12983
  singlePress.current = setTimeout(() => {
@@ -13338,14 +13389,14 @@ function OpenCell({
13338
13389
  const typedWords = isTypedDraft(draft) ? draft.text : typeof draft === "string" ? draft : null;
13339
13390
  const widens = !picker && !multiline && typedWords !== null;
13340
13391
  const wideTo = widens ? `max(100%, calc(${Math.max(typedWords.length, 8) + 3}ch + ${dateHelperKind(field2) ? "2.75rem" : "1rem"}))` : void 0;
13341
- const done = useRef22(false);
13392
+ const done = useRef23(false);
13342
13393
  const once = (run) => {
13343
13394
  if (done.current) return;
13344
13395
  done.current = true;
13345
13396
  if (run() === false) done.current = false;
13346
13397
  };
13347
- const host = useRef22(null);
13348
- useEffect27(() => {
13398
+ const host = useRef23(null);
13399
+ useEffect28(() => {
13349
13400
  const active = document.activeElement;
13350
13401
  if (active instanceof HTMLElement && active.closest("[data-matrx-cell-editor]") && !host.current?.contains(active)) return;
13351
13402
  const control = host.current?.querySelector("input, textarea, [role='combobox'], button");
@@ -13363,7 +13414,7 @@ function OpenCell({
13363
13414
  }
13364
13415
  }, [field2.id]);
13365
13416
  const typedNow = isTypedDraft(draft);
13366
- useEffect27(() => {
13417
+ useEffect28(() => {
13367
13418
  if (!typedNow) return;
13368
13419
  const active = document.activeElement;
13369
13420
  if (active instanceof HTMLElement && host.current?.contains(active)) return;
@@ -13683,12 +13734,12 @@ function TablePageSkeleton({
13683
13734
  }
13684
13735
 
13685
13736
  // src/wholeTableCount.ts
13686
- import { useEffect as useEffect28, useState as useState38 } from "react";
13737
+ import { useEffect as useEffect29, useState as useState38 } from "react";
13687
13738
  import { useRecordsClient as useRecordsClient14 } from "@ai-matrx/records/react";
13688
13739
  function useWholeTableCount(args) {
13689
13740
  const client = useRecordsClient14();
13690
13741
  const [count, setCount] = useState38(null);
13691
- useEffect28(() => {
13742
+ useEffect29(() => {
13692
13743
  if (!args.needed) return;
13693
13744
  let live = true;
13694
13745
  void client.recordAggregate({ table_id: args.tableId, measures: [{ op: "count" }] }).then((answer) => {
@@ -13705,7 +13756,7 @@ function useWholeTableCount(args) {
13705
13756
  }
13706
13757
 
13707
13758
  // src/Grid.tsx
13708
- import { useCallback as useCallback28, useEffect as useEffect58, useMemo as useMemo40, useRef as useRef38, useState as useState73 } from "react";
13759
+ import { useCallback as useCallback28, useEffect as useEffect59, useMemo as useMemo40, useRef as useRef39, useState as useState73 } from "react";
13709
13760
  import {
13710
13761
  useFields as useFields12,
13711
13762
  useRecordPage,
@@ -13719,14 +13770,14 @@ import { MatrxDataTable as MatrxDataTable2, MatrxTableCardShowMore, tableStyleIs
13719
13770
  import { announceRecordChanged as announceRecordChanged4, predictWriteRefusals as predictWriteRefusals2 } from "@ai-matrx/records/core";
13720
13771
 
13721
13772
  // src/tableDecorations.ts
13722
- import { useCallback as useCallback11, useEffect as useEffect29, useRef as useRef23, useState as useState39 } from "react";
13773
+ import { useCallback as useCallback11, useEffect as useEffect30, useRef as useRef24, useState as useState39 } from "react";
13723
13774
  import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
13724
13775
  function useTableDecorations(tableId, revision) {
13725
13776
  const client = useRecordsClient15();
13726
13777
  const [state2, setState] = useState39({ data: null, loading: Boolean(tableId) });
13727
- const seen = useRef23({ tableId: void 0, revision: void 0 });
13728
- const ticket = useRef23(0);
13729
- useEffect29(() => {
13778
+ const seen = useRef24({ tableId: void 0, revision: void 0 });
13779
+ const ticket = useRef24(0);
13780
+ useEffect30(() => {
13730
13781
  if (!tableId) {
13731
13782
  ticket.current += 1;
13732
13783
  setState({ data: null, loading: false });
@@ -13745,7 +13796,7 @@ function useTableDecorations(tableId, revision) {
13745
13796
  setState({ data: result.ok ? result.data : null, loading: false });
13746
13797
  });
13747
13798
  }, [client, tableId, revision]);
13748
- useEffect29(() => () => {
13799
+ useEffect30(() => () => {
13749
13800
  ticket.current += 1;
13750
13801
  }, []);
13751
13802
  const apply = useCallback11((next) => setState({ data: next, loading: false }), []);
@@ -13857,7 +13908,7 @@ function useTableCanBeCleaned(tableId) {
13857
13908
  // src/gridControls.tsx
13858
13909
  import { copyText as writeClipboardText, readText as readClipboardText } from "@ai-matrx/kit/clipboard";
13859
13910
  import { onRecordChanged } from "@ai-matrx/records/core";
13860
- import { useCallback as useCallback17, useEffect as useEffect41, useMemo as useMemo25, useRef as useRef27, useState as useState53 } from "react";
13911
+ import { useCallback as useCallback17, useEffect as useEffect42, useMemo as useMemo25, useRef as useRef28, useState as useState53 } from "react";
13861
13912
  import { tableShapeChanged as tableShapeChanged5, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient27, useReverseColumns as useReverseColumns2 } from "@ai-matrx/records/react";
13862
13913
  import {
13863
13914
  BasicInput as BasicInput14,
@@ -14436,12 +14487,12 @@ import {
14436
14487
  } from "@ai-matrx/design-system";
14437
14488
 
14438
14489
  // src/TablePickers.tsx
14439
- import { useEffect as useEffect31, useMemo as useMemo18, useState as useState42 } from "react";
14490
+ import { useEffect as useEffect32, useMemo as useMemo18, useState as useState42 } from "react";
14440
14491
  import { RecordsProvider as RecordsProvider2, useFields as useFields4, useRecords as useRecords4, useTable as useTable4 } from "@ai-matrx/records/react";
14441
14492
  import { Button as Button24, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
14442
14493
 
14443
14494
  // src/RecordsMount.tsx
14444
- import { useRef as useRef24 } from "react";
14495
+ import { useRef as useRef25 } from "react";
14445
14496
 
14446
14497
  // src/dataSource.ts
14447
14498
  import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
@@ -14498,12 +14549,12 @@ async function hasSession(getSession) {
14498
14549
  import { RecordsProvider } from "@ai-matrx/records/react";
14499
14550
 
14500
14551
  // src/PersonNamesBridge.tsx
14501
- import { useEffect as useEffect30 } from "react";
14552
+ import { useEffect as useEffect31 } from "react";
14502
14553
  import { useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
14503
14554
  function PersonNamesBridge() {
14504
14555
  const client = useOptionalRecordsClient13();
14505
14556
  const roster = useMemberRoster();
14506
- useEffect30(() => {
14557
+ useEffect31(() => {
14507
14558
  if (!roster) return;
14508
14559
  setPersonResolver(async (id) => {
14509
14560
  const who = await resolveKeptPerson(client, id, roster);
@@ -14541,7 +14592,7 @@ function RecordsMount({
14541
14592
  ] }) }) });
14542
14593
  }
14543
14594
  function useShallowStableHost(host) {
14544
- const held = useRef24(null);
14595
+ const held = useRef25(null);
14545
14596
  const next = host ?? {};
14546
14597
  const previous = held.current;
14547
14598
  if (previous !== null && sameParts(previous, next)) return previous;
@@ -14591,7 +14642,7 @@ function readTablesAnywhere(dataSource) {
14591
14642
  }
14592
14643
  function useTablesAnywhere(dataSource) {
14593
14644
  const [state2, setState] = useState42({ loading: true, error: null, rows: [] });
14594
- useEffect31(() => {
14645
+ useEffect32(() => {
14595
14646
  let live = true;
14596
14647
  void readTablesAnywhere(dataSource).then((result) => {
14597
14648
  if (live) setState(result);
@@ -14951,7 +15002,7 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
14951
15002
  }
14952
15003
 
14953
15004
  // src/gridColors.tsx
14954
- import { useCallback as useCallback12, useEffect as useEffect32, useMemo as useMemo20, useState as useState44 } from "react";
15005
+ import { useCallback as useCallback12, useEffect as useEffect33, useMemo as useMemo20, useState as useState44 } from "react";
14955
15006
  import { optionKey as optionKey5, optionLabel as optionLabel3 } from "@ai-matrx/records";
14956
15007
  import { useRecordsClient as useRecordsClient19 } from "@ai-matrx/records/react";
14957
15008
  import {
@@ -15002,7 +15053,7 @@ function useChoiceOptions(fields, keys) {
15002
15053
  const client = useRecordsClient19();
15003
15054
  const [index, setIndex] = useState44(() => /* @__PURE__ */ new Map());
15004
15055
  const wantedKey = keys.join("\0");
15005
- useEffect32(() => {
15056
+ useEffect33(() => {
15006
15057
  const missing = keys.map((key) => fields.find((f) => f.key === key)).filter((f) => f !== void 0 && !index.has(f.key));
15007
15058
  if (missing.length === 0) return;
15008
15059
  let cancelled = false;
@@ -15494,7 +15545,7 @@ function ColourRulesDialog({
15494
15545
  }
15495
15546
 
15496
15547
  // src/gridRowLabel.tsx
15497
- import { useEffect as useEffect33, useState as useState45 } from "react";
15548
+ import { useEffect as useEffect34, useState as useState45 } from "react";
15498
15549
  import { ROW_LABEL_FORMULA_MAX_LENGTH, clearsRowLabel } from "@ai-matrx/records";
15499
15550
  import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
15500
15551
  import {
@@ -15531,7 +15582,7 @@ function RowLabelPicker({
15531
15582
  const [kept, setKept] = useState45(null);
15532
15583
  const [formula, setFormula] = useState45("");
15533
15584
  const [formulaOk, setFormulaOk] = useState45(null);
15534
- useEffect33(() => {
15585
+ useEffect34(() => {
15535
15586
  if (!open) return;
15536
15587
  setMode("column");
15537
15588
  setPicked(current ?? labelColumns(fields)[0]?.key ?? "");
@@ -15690,7 +15741,7 @@ function RowLabelPicker({
15690
15741
  import { Button as Button30, Dialog as Dialog8, DialogContent as DialogContent8, DialogHeader as DialogHeader8, DialogTitle as DialogTitle8 } from "@ai-matrx/design-system";
15691
15742
 
15692
15743
  // src/RowActionsEditor.tsx
15693
- import { useCallback as useCallback14, useEffect as useEffect36, useMemo as useMemo22, useRef as useRef25, useState as useState48 } from "react";
15744
+ import { useCallback as useCallback14, useEffect as useEffect37, useMemo as useMemo22, useRef as useRef26, useState as useState48 } from "react";
15694
15745
  import { useFields as useFields6, useRecords as useRecords5, useRecordsClient as useRecordsClient23 } from "@ai-matrx/records/react";
15695
15746
  import {
15696
15747
  Badge as Badge7,
@@ -15708,7 +15759,7 @@ import {
15708
15759
  } from "@ai-matrx/design-system";
15709
15760
 
15710
15761
  // src/rowActionPreview.tsx
15711
- import { useEffect as useEffect34, useState as useState46 } from "react";
15762
+ import { useEffect as useEffect35, useState as useState46 } from "react";
15712
15763
  import { useRecordsClient as useRecordsClient21 } from "@ai-matrx/records/react";
15713
15764
  import { cn as cn29 } from "@ai-matrx/design-system";
15714
15765
  import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
@@ -15763,7 +15814,7 @@ function useFormulaReadings(tableId, formulas) {
15763
15814
  const client = useRecordsClient21();
15764
15815
  const [readings, setReadings] = useState46({});
15765
15816
  const key = formulas.join("\0");
15766
- useEffect34(() => {
15817
+ useEffect35(() => {
15767
15818
  if (!tableId) return;
15768
15819
  let live = true;
15769
15820
  for (const text of formulas) {
@@ -15849,7 +15900,7 @@ function ActionRowPreview({
15849
15900
  }
15850
15901
 
15851
15902
  // src/gridActions.tsx
15852
- import { useCallback as useCallback13, useEffect as useEffect35, useMemo as useMemo21, useState as useState47 } from "react";
15903
+ import { useCallback as useCallback13, useEffect as useEffect36, useMemo as useMemo21, useState as useState47 } from "react";
15853
15904
  import { useRecordsClient as useRecordsClient22, useRowActions } from "@ai-matrx/records/react";
15854
15905
  import { actionRefusals } from "@ai-matrx/records";
15855
15906
  import { Button as Button28, ConfirmDialog, cn as cn30 } from "@ai-matrx/design-system";
@@ -15866,7 +15917,7 @@ function useTableActions(tableId, enabled) {
15866
15917
  const loaded = enabled && (!read.loading || read.data !== null || read.error !== null);
15867
15918
  const refetch = read.reload;
15868
15919
  const reload = useCallback13(async () => refetch(), [refetch]);
15869
- useEffect35(() => {
15920
+ useEffect36(() => {
15870
15921
  if (!enabled) return;
15871
15922
  const listener = () => void reload();
15872
15923
  const set = actionListeners.get(tableId) ?? /* @__PURE__ */ new Set();
@@ -16202,10 +16253,10 @@ function RowActionsSection({
16202
16253
  const [addStarted, setAddStarted] = useState48(false);
16203
16254
  const slots = useSettingsAgentSlots();
16204
16255
  const [seed, setSeed] = useState48(null);
16205
- const openForm = useRef25(null);
16206
- const now = useRef25({ actions, editing });
16256
+ const openForm = useRef26(null);
16257
+ const now = useRef26({ actions, editing });
16207
16258
  now.current = { actions, editing };
16208
- useEffect36(() => {
16259
+ useEffect37(() => {
16209
16260
  if (!slots) return void 0;
16210
16261
  const slot = {
16211
16262
  saved: () => now.current.actions,
@@ -16223,7 +16274,7 @@ function RowActionsSection({
16223
16274
  if (slots.rowActions.current === slot) slots.rowActions.current = null;
16224
16275
  };
16225
16276
  }, [slots]);
16226
- useEffect36(() => {
16277
+ useEffect37(() => {
16227
16278
  if (!editing) {
16228
16279
  setSeed(null);
16229
16280
  openForm.current = null;
@@ -16240,10 +16291,10 @@ function RowActionsSection({
16240
16291
  setActions(answered.data?.actions ?? []);
16241
16292
  setStale((answered.data?.stale ?? []).length);
16242
16293
  }, [client, tableId]);
16243
- useEffect36(() => {
16294
+ useEffect37(() => {
16244
16295
  void reload();
16245
16296
  }, [reload]);
16246
- useEffect36(() => {
16297
+ useEffect37(() => {
16247
16298
  let live = true;
16248
16299
  void client.tableDecorations({ table_id: tableId }).then((answered) => {
16249
16300
  if (live && answered.ok) setColors(answered.data?.colors ?? []);
@@ -16288,7 +16339,7 @@ function RowActionsSection({
16288
16339
  if (await declare2(next)) setRetired(null);
16289
16340
  };
16290
16341
  const allFields = fields.data ?? [];
16291
- useEffect36(() => {
16342
+ useEffect37(() => {
16292
16343
  if (!startAdding || addStarted || !loaded || readError) return;
16293
16344
  setAddStarted(true);
16294
16345
  setEditing("new");
@@ -16448,7 +16499,7 @@ function ActionForm({
16448
16499
  const complete = draft.steps.every((s) => s.field !== "");
16449
16500
  const [formulaChecks, setFormulaChecks] = useState48({});
16450
16501
  const formulaWrong = draft.steps.some((s, i) => s.set === "compute" && formulaChecks[i] === false);
16451
- useEffect36(() => {
16502
+ useEffect37(() => {
16452
16503
  if (seed) setDraft(draftOf(seed.action));
16453
16504
  }, [seed]);
16454
16505
  const problems = [
@@ -16722,7 +16773,7 @@ function RowActionsDialog({
16722
16773
  }
16723
16774
 
16724
16775
  // src/gridSummaries.tsx
16725
- import { useCallback as useCallback15, useEffect as useEffect37, useMemo as useMemo23, useRef as useRef26, useState as useState49 } from "react";
16776
+ import { useCallback as useCallback15, useEffect as useEffect38, useMemo as useMemo23, useRef as useRef27, useState as useState49 } from "react";
16726
16777
  import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
16727
16778
  import { measureKey } from "@ai-matrx/records";
16728
16779
  import {
@@ -16754,7 +16805,7 @@ function useColumnSummaries(args) {
16754
16805
  const [operations, setOperations] = useState49(null);
16755
16806
  const chosenKey = JSON.stringify(Object.entries(chosen).sort());
16756
16807
  const filterKey = JSON.stringify(args.filter ?? {});
16757
- useEffect37(() => {
16808
+ useEffect38(() => {
16758
16809
  const entries = JSON.parse(chosenKey);
16759
16810
  const asked4 = JSON.parse(filterKey);
16760
16811
  const filter = Object.keys(asked4).length > 0 ? asked4 : void 0;
@@ -16792,7 +16843,7 @@ function useColumnSummaries(args) {
16792
16843
  cancelled = true;
16793
16844
  };
16794
16845
  }, [client, tableId, chosenKey, filterKey, version2]);
16795
- const asking = useRef26(false);
16846
+ const asking = useRef27(false);
16796
16847
  const askOperations = useCallback15(() => {
16797
16848
  if (operations !== null || asking.current) return;
16798
16849
  asking.current = true;
@@ -16940,7 +16991,7 @@ function SummarySheetControls({
16940
16991
  }
16941
16992
 
16942
16993
  // src/ColumnCleanDialog.tsx
16943
- import { useEffect as useEffect38, useMemo as useMemo24, useState as useState50 } from "react";
16994
+ import { useEffect as useEffect39, useMemo as useMemo24, useState as useState50 } from "react";
16944
16995
  import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
16945
16996
  import {
16946
16997
  Button as Button32,
@@ -17110,7 +17161,7 @@ function ColumnCleanDialog({
17110
17161
  const [failed, setFailed] = useState50(null);
17111
17162
  const [enabled, setEnabled] = useState50(() => new Set(DEFAULT_CLEAN_OPERATIONS));
17112
17163
  const [busy, setBusy] = useState50(false);
17113
- useEffect38(() => {
17164
+ useEffect39(() => {
17114
17165
  if (row) {
17115
17166
  setRows([row]);
17116
17167
  return;
@@ -17216,7 +17267,7 @@ function ColumnCleanDialog({
17216
17267
  }
17217
17268
 
17218
17269
  // src/gridRowTemplates.tsx
17219
- import { useCallback as useCallback16, useEffect as useEffect39, useState as useState51 } from "react";
17270
+ import { useCallback as useCallback16, useEffect as useEffect40, useState as useState51 } from "react";
17220
17271
  import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
17221
17272
  import {
17222
17273
  BasicInput as BasicInput13,
@@ -17261,7 +17312,7 @@ function SaveAsTemplateDialog(props) {
17261
17312
  const [name, setName] = useState51("");
17262
17313
  const [busy, setBusy] = useState51(false);
17263
17314
  const [refused, setRefused] = useState51(null);
17264
- useEffect39(() => {
17315
+ useEffect40(() => {
17265
17316
  setName("");
17266
17317
  setRefused(null);
17267
17318
  }, [props.row]);
@@ -17303,7 +17354,7 @@ function SaveAsTemplateDialog(props) {
17303
17354
  }
17304
17355
 
17305
17356
  // src/gridLongText.tsx
17306
- import { useEffect as useEffect40, useState as useState52 } from "react";
17357
+ import { useEffect as useEffect41, useState as useState52 } from "react";
17307
17358
  import {
17308
17359
  BasicTextarea as BasicTextarea6,
17309
17360
  Button as Button34,
@@ -17346,11 +17397,11 @@ function WholeTextDialog({
17346
17397
  const { renderText, textBox } = useRecordsUi();
17347
17398
  const [reading, setReading] = useState52(false);
17348
17399
  const startingText = target === null ? null : target.pointer ? whole.state === "ready" ? whole.text : null : typeof target.value === "string" ? target.value : target.value === null || target.value === void 0 ? "" : String(target.value);
17349
- useEffect40(() => {
17400
+ useEffect41(() => {
17350
17401
  setDraft(startingText);
17351
17402
  setCleanNote(null);
17352
17403
  }, [target?.rowId, target?.key, startingText]);
17353
- useEffect40(() => {
17404
+ useEffect41(() => {
17354
17405
  setReading(!mayWrite && Boolean(renderText));
17355
17406
  }, [target?.rowId, target?.key, mayWrite, renderText]);
17356
17407
  const open = target !== null;
@@ -17709,9 +17760,9 @@ function useMergedGridControls(args) {
17709
17760
  const mutation = useFieldMutation2();
17710
17761
  const [dialog, setDialog] = useState53(null);
17711
17762
  const canClean = Boolean(enabled && args.bulkApply);
17712
- useEffect41(() => canClean ? hearTableCleanAsks(tableId, () => setDialog({ kind: "cleanTable" })) : void 0, [canClean, tableId]);
17713
- const lastColumnDialog = useRef27(null);
17714
- const insertEpoch = useRef27(0);
17763
+ useEffect42(() => canClean ? hearTableCleanAsks(tableId, () => setDialog({ kind: "cleanTable" })) : void 0, [canClean, tableId]);
17764
+ const lastColumnDialog = useRef28(null);
17765
+ const insertEpoch = useRef28(0);
17715
17766
  if (dialog?.kind === "settings" || dialog?.kind === "insert") {
17716
17767
  if (dialog !== lastColumnDialog.current) insertEpoch.current += 1;
17717
17768
  lastColumnDialog.current = dialog;
@@ -17740,7 +17791,7 @@ function useMergedGridControls(args) {
17740
17791
  const keptOrder = presentation.columnOrder;
17741
17792
  const keptHidden = presentation.hiddenFields;
17742
17793
  const keptKey = JSON.stringify([keptOrder ?? [], keptHidden ?? []]);
17743
- useEffect41(() => {
17794
+ useEffect42(() => {
17744
17795
  setHeld(null);
17745
17796
  }, [keptKey]);
17746
17797
  const order = useMemo25(() => {
@@ -17770,8 +17821,8 @@ function useMergedGridControls(args) {
17770
17821
  },
17771
17822
  [presentation, writeLook, naturalOrder]
17772
17823
  );
17773
- const pendingInsert = useRef27(null);
17774
- useEffect41(() => {
17824
+ const pendingInsert = useRef28(null);
17825
+ useEffect42(() => {
17775
17826
  const pending = pendingInsert.current;
17776
17827
  if (!pending) return;
17777
17828
  const made = fieldKeys.find((k) => !pending.before.has(k));
@@ -17791,11 +17842,11 @@ function useMergedGridControls(args) {
17791
17842
  const searchWords = (args.search ?? "").trim();
17792
17843
  const countQuestionKey = JSON.stringify([choiceKeys, query.columnFilters, args.filter ?? null, searchWords]);
17793
17844
  const rowsKey = rows.map((row) => `${row.id}:${row.version ?? ""}`).join(",");
17794
- const fieldsRef = useRef27(fields);
17845
+ const fieldsRef = useRef28(fields);
17795
17846
  fieldsRef.current = fields;
17796
17847
  const [choiceCounts, setChoiceCounts] = useState53({});
17797
- useEffect41(() => onRecordChanged(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
17798
- useEffect41(() => {
17848
+ useEffect42(() => onRecordChanged(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
17849
+ useEffect42(() => {
17799
17850
  if (!enabled || choiceKeys.length === 0) {
17800
17851
  setChoiceCounts({});
17801
17852
  return;
@@ -18519,7 +18570,7 @@ function selectOpenCellText() {
18519
18570
  import { Button as Button49, ConfirmDialog as ConfirmDialog5, TapTargetSearchGroup, cn as cn41, useIsMobile } from "@ai-matrx/design-system";
18520
18571
 
18521
18572
  // src/gridAddRow.tsx
18522
- import { useCallback as useCallback18, useEffect as useEffect44, useMemo as useMemo28, useRef as useRef30, useState as useState57 } from "react";
18573
+ import { useCallback as useCallback18, useEffect as useEffect45, useMemo as useMemo28, useRef as useRef31, useState as useState57 } from "react";
18523
18574
  import { useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
18524
18575
  import {
18525
18576
  Button as Button38,
@@ -18534,7 +18585,7 @@ import {
18534
18585
  } from "@ai-matrx/design-system";
18535
18586
 
18536
18587
  // src/RecordForm.tsx
18537
- import { useEffect as useEffect43, useMemo as useMemo27, useRef as useRef29, useState as useState56 } from "react";
18588
+ import { useEffect as useEffect44, useMemo as useMemo27, useRef as useRef30, useState as useState56 } from "react";
18538
18589
  import {
18539
18590
  useFields as useFields7,
18540
18591
  useRecord,
@@ -18551,7 +18602,7 @@ import { useEntityRecord as useEntityRecord2, useRecordsClient as useRecordsClie
18551
18602
  import { Input as Input2, Textarea as Textarea2, cn as cn34 } from "@ai-matrx/design-system";
18552
18603
 
18553
18604
  // src/CustomFieldsSection.tsx
18554
- import { useEffect as useEffect42, useMemo as useMemo26, useRef as useRef28, useState as useState54 } from "react";
18605
+ import { useEffect as useEffect43, useMemo as useMemo26, useRef as useRef29, useState as useState54 } from "react";
18555
18606
  import {
18556
18607
  useEntityFieldMutation as useEntityFieldMutation2,
18557
18608
  useEntityFieldRights as useEntityFieldRights2,
@@ -18701,11 +18752,11 @@ function CustomFieldsSection({
18701
18752
  read.reload();
18702
18753
  };
18703
18754
  const mayAdd = rights.data?.may_declare === true;
18704
- const live = useRef28({ fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} });
18705
- useEffect42(() => {
18755
+ const live = useRef29({ fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} });
18756
+ useEffect43(() => {
18706
18757
  live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} };
18707
18758
  });
18708
- useEffect42(() => {
18759
+ useEffect43(() => {
18709
18760
  if (!agentDoor) return;
18710
18761
  const state2 = () => {
18711
18762
  const now = live.current;
@@ -19160,8 +19211,8 @@ function CustomRecordForm({
19160
19211
  };
19161
19212
  const [draft, setDraft] = useState56(() => recordId ? {} : { ...initial ?? {} });
19162
19213
  const [touched, setTouched] = useState56(false);
19163
- const seededStarts = useRef29(false);
19164
- useEffect43(() => {
19214
+ const seededStarts = useRef30(false);
19215
+ useEffect44(() => {
19165
19216
  if (recordId || seededStarts.current || !fields.data) return;
19166
19217
  seededStarts.current = true;
19167
19218
  const starts = {};
@@ -19171,8 +19222,8 @@ function CustomRecordForm({
19171
19222
  }
19172
19223
  if (Object.keys(starts).length > 0) setDraft((held) => ({ ...starts, ...held }));
19173
19224
  }, [recordId, fields.data]);
19174
- const focusedFirst = useRef29(false);
19175
- useEffect43(() => {
19225
+ const focusedFirst = useRef30(false);
19226
+ useEffect44(() => {
19176
19227
  if (!focusFirstRequired || recordId || focusedFirst.current || !fields.data) return;
19177
19228
  focusedFirst.current = true;
19178
19229
  const first = fields.data.find((f) => f.required && (draft[f.key] === void 0 || draft[f.key] === null || draft[f.key] === ""));
@@ -19187,13 +19238,13 @@ function CustomRecordForm({
19187
19238
  [existing.data]
19188
19239
  );
19189
19240
  const versions = (0, recordVersions_exports.useRecordVersions)(client, formRows);
19190
- const pinned = useRef29(null);
19241
+ const pinned = useRef30(null);
19191
19242
  const pin = () => {
19192
19243
  if (recordId && !pinned.current) pinned.current = versions.seen(recordId);
19193
19244
  };
19194
- const changedRef = useRef29({});
19245
+ const changedRef = useRef30({});
19195
19246
  changedRef.current = changed2;
19196
- useEffect43(() => {
19247
+ useEffect44(() => {
19197
19248
  const document3 = existing.data?.document;
19198
19249
  if (!document3) return;
19199
19250
  const mine = changedRef.current;
@@ -19415,13 +19466,13 @@ function useAddedRows(args) {
19415
19466
  const [added, setAdded] = useState57([]);
19416
19467
  const [anchors, setAnchors] = useState57(() => /* @__PURE__ */ new Map());
19417
19468
  const [busy, setBusy] = useState57(false);
19418
- useEffect44(() => {
19469
+ useEffect45(() => {
19419
19470
  setAdded([]);
19420
19471
  setAnchors(/* @__PURE__ */ new Map());
19421
19472
  }, [pageKey, tableId]);
19422
19473
  const pinnedKey = added.map((r) => r.id).join(",");
19423
- const asked4 = useRef30(0);
19424
- useEffect44(() => {
19474
+ const asked4 = useRef31(0);
19475
+ useEffect45(() => {
19425
19476
  if (!enabled || added.length === 0) return;
19426
19477
  const onPage = new Set(pageRows.map((r) => r.id));
19427
19478
  const missing = added.filter((r) => !onPage.has(r.id)).map((r) => r.id);
@@ -19553,8 +19604,8 @@ function NewRecordControl({
19553
19604
  }) {
19554
19605
  const [formOpen, setFormOpen] = useState57(false);
19555
19606
  const [formInitial, setFormInitial] = useState57({});
19556
- const seenAsk = useRef30(0);
19557
- useEffect44(() => {
19607
+ const seenAsk = useRef31(0);
19608
+ useEffect45(() => {
19558
19609
  if (!ask2 || ask2.n === seenAsk.current) return;
19559
19610
  seenAsk.current = ask2.n;
19560
19611
  setFormInitial(ask2.initial);
@@ -19604,7 +19655,7 @@ function NewRecordControl({
19604
19655
  }
19605
19656
 
19606
19657
  // src/gridDrill.tsx
19607
- import { useEffect as useEffect46, useMemo as useMemo29, useState as useState59 } from "react";
19658
+ import { useEffect as useEffect47, useMemo as useMemo29, useState as useState59 } from "react";
19608
19659
  import { useRecordsClient as useRecordsClient33 } from "@ai-matrx/records/react";
19609
19660
  import {
19610
19661
  isRuleFilter as isRuleFilter2
@@ -19618,7 +19669,7 @@ import {
19618
19669
  } from "@ai-matrx/design-system/data-table";
19619
19670
 
19620
19671
  // src/drillLevel.ts
19621
- import { useEffect as useEffect45, useState as useState58 } from "react";
19672
+ import { useEffect as useEffect46, useState as useState58 } from "react";
19622
19673
  import { useRecordsClient as useRecordsClient32 } from "@ai-matrx/records/react";
19623
19674
  import {
19624
19675
  drillFocus,
@@ -19693,7 +19744,7 @@ function useDrillLevelReads(args) {
19693
19744
  const all = [...asks.attributes, ...asks.focus, ...asks.names];
19694
19745
  const key = JSON.stringify({ source, all, window: args.window ?? null, lane: args.lane ?? null });
19695
19746
  const [state2, setState] = useState58({ key: "", held: {}, failed: {} });
19696
- useEffect45(() => {
19747
+ useEffect46(() => {
19697
19748
  if (!enabled || !source || all.length === 0) return;
19698
19749
  let cancelled = false;
19699
19750
  const parsed = JSON.parse(key);
@@ -19815,7 +19866,7 @@ function useDrillDefinition(source) {
19815
19866
  const client = useRecordsClient33();
19816
19867
  const key = source ? JSON.stringify(source) : null;
19817
19868
  const [state2, setState] = useState59({ key: null, def: null, error: null });
19818
- useEffect46(() => {
19869
+ useEffect47(() => {
19819
19870
  if (!key) return;
19820
19871
  let cancelled = false;
19821
19872
  void client.drillDescribe({ source: JSON.parse(key) }).then(
@@ -19891,7 +19942,7 @@ function useDrillAnswers(args) {
19891
19942
  windowKey: args.windowKey ?? null,
19892
19943
  lane: args.lane ?? null
19893
19944
  });
19894
- useEffect46(() => {
19945
+ useEffect47(() => {
19895
19946
  if (!enabled || !source || question.by.length === 0) return;
19896
19947
  const asked4 = JSON.parse(askKey2);
19897
19948
  const range = asked4.window && asked4.windowKey ? drillWindowRange(asked4.window) : null;
@@ -20243,7 +20294,7 @@ function costInPoints(cents, rate) {
20243
20294
  }
20244
20295
 
20245
20296
  // src/Enrich.tsx
20246
- import { useCallback as useCallback19, useEffect as useEffect47, useMemo as useMemo30, useState as useState60 } from "react";
20297
+ import { useCallback as useCallback19, useEffect as useEffect48, useMemo as useMemo30, useState as useState60 } from "react";
20247
20298
  import {
20248
20299
  useFields as useFields8,
20249
20300
  useRecordsClient as useRecordsClient34,
@@ -20360,7 +20411,7 @@ function useEnrichCells(tableId, recordIds) {
20360
20411
  setCells(next);
20361
20412
  }, [client, tableId, key]);
20362
20413
  const refresh = useCallback19(() => load(true), [load]);
20363
- useEffect47(() => {
20414
+ useEffect48(() => {
20364
20415
  void load(false);
20365
20416
  }, [load]);
20366
20417
  return { cells, refresh, error };
@@ -20387,7 +20438,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
20387
20438
  setError(null);
20388
20439
  setRows(answered.data);
20389
20440
  }, [client, tableId]);
20390
- useEffect47(() => {
20441
+ useEffect48(() => {
20391
20442
  void load();
20392
20443
  }, [load]);
20393
20444
  const shown5 = useMemo30(
@@ -21044,7 +21095,7 @@ function withTypeMark(field2, header) {
21044
21095
  }
21045
21096
 
21046
21097
  // src/ReverseColumns.tsx
21047
- import { useCallback as useCallback20, useEffect as useEffect48, useMemo as useMemo31, useRef as useRef31, useState as useState61, useSyncExternalStore as useSyncExternalStore5 } from "react";
21098
+ import { useCallback as useCallback20, useEffect as useEffect49, useMemo as useMemo31, useRef as useRef32, useState as useState61, useSyncExternalStore as useSyncExternalStore5 } from "react";
21048
21099
  import { isReverseField } from "@ai-matrx/records";
21049
21100
 
21050
21101
  // src/groupReads.ts
@@ -21157,14 +21208,14 @@ function useReverseGridColumns(tableId, rowIds) {
21157
21208
  }
21158
21209
  var NO_GRID_COLUMNS = [];
21159
21210
  function useStableColumns(listed) {
21160
- const held = useRef31({ key: "", columns: EMPTY_COLUMNS });
21211
+ const held = useRef32({ key: "", columns: EMPTY_COLUMNS });
21161
21212
  const key = JSON.stringify(listed ?? []);
21162
21213
  if (held.current.key !== key) held.current = { key, columns: listed && listed.length > 0 ? listed : EMPTY_COLUMNS };
21163
21214
  return held.current.columns;
21164
21215
  }
21165
21216
  function useLinksStore(answers2, reading) {
21166
- const store = useRef31({ answers: null, reading: true, listeners: /* @__PURE__ */ new Set() }).current;
21167
- useEffect48(() => {
21217
+ const store = useRef32({ answers: null, reading: true, listeners: /* @__PURE__ */ new Set() }).current;
21218
+ useEffect49(() => {
21168
21219
  store.answers = answers2;
21169
21220
  store.reading = reading;
21170
21221
  for (const listener of [...store.listeners]) listener();
@@ -21199,7 +21250,7 @@ function openReverseCell(rowId, columnId2) {
21199
21250
  function useReverseField(tableId, column) {
21200
21251
  const client = useOptionalRecordsClient14();
21201
21252
  const [field2, setField] = useState61(null);
21202
- useEffect48(() => {
21253
+ useEffect49(() => {
21203
21254
  if (column.read_only || !client) return;
21204
21255
  let live = true;
21205
21256
  void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
@@ -21240,7 +21291,7 @@ var REVERSE_LINKS_EDIT_MAX = 50;
21240
21291
  function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
21241
21292
  const [open, setOpen] = useState61(false);
21242
21293
  const key = `${recordId}|${reverseColumnId(column)}`;
21243
- useEffect48(() => {
21294
+ useEffect49(() => {
21244
21295
  reverseCellOpeners.set(key, () => setOpen(true));
21245
21296
  return () => {
21246
21297
  reverseCellOpeners.delete(key);
@@ -22076,7 +22127,7 @@ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf, navigat
22076
22127
  }
22077
22128
 
22078
22129
  // src/ImportWizard.tsx
22079
- import { useCallback as useCallback22, useEffect as useEffect49, useMemo as useMemo33, useState as useState64 } from "react";
22130
+ import { useCallback as useCallback22, useEffect as useEffect50, useMemo as useMemo33, useState as useState64 } from "react";
22080
22131
  import { useFields as useFields11, useRecordsClient as useRecordsClient36, useTable as useTable9 } from "@ai-matrx/records/react";
22081
22132
  import {
22082
22133
  importCsv,
@@ -22492,7 +22543,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22492
22543
  const [repeatsSkipped, setRepeatsSkipped] = useState64(0);
22493
22544
  const [unmapped, setUnmapped] = useState64("propose");
22494
22545
  const [unmappedChosen, setUnmappedChosen] = useState64(false);
22495
- useEffect49(() => {
22546
+ useEffect50(() => {
22496
22547
  if (rights.admin && !unmappedChosen) setUnmapped("create");
22497
22548
  }, [rights.admin, unmappedChosen]);
22498
22549
  const [fileName, setFileName] = useState64("");
@@ -22519,7 +22570,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22519
22570
  setRunsProblem(null);
22520
22571
  } else setRunsProblem(answered.error);
22521
22572
  }, [client, tableId]);
22522
- useEffect49(() => {
22573
+ useEffect50(() => {
22523
22574
  void loadRuns();
22524
22575
  }, [loadRuns]);
22525
22576
  const openRefusals = useCallback22(
@@ -22576,7 +22627,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22576
22627
  const combining = titleRepeating && (combine ?? combineDefault) === "combine";
22577
22628
  const combined = useMemo33(() => combining && titleHeader ? combineRows(rows, titleHeader) : null, [combining, rows, titleHeader]);
22578
22629
  const effectiveRows = combined?.rows ?? rows;
22579
- useEffect49(() => {
22630
+ useEffect50(() => {
22580
22631
  if (dedupeChosen) return;
22581
22632
  setDedupeKey(combining && titleKey ? titleKey : "");
22582
22633
  }, [combining, titleKey, dedupeChosen]);
@@ -22671,7 +22722,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22671
22722
  [planFrom, reset]
22672
22723
  );
22673
22724
  const [tookSource, setTookSource] = useState64(null);
22674
- useEffect49(() => {
22725
+ useEffect50(() => {
22675
22726
  if (!source || tookSource === source || !fields.data || !table.data) return;
22676
22727
  setTookSource(source);
22677
22728
  reset();
@@ -22707,7 +22758,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22707
22758
  },
22708
22759
  [client]
22709
22760
  );
22710
- useEffect49(() => {
22761
+ useEffect50(() => {
22711
22762
  if (!choiceKeysToRead) return;
22712
22763
  void readChoices(mappedChoiceFields.filter((f) => choiceKeysToRead.split(",").includes(f.key)));
22713
22764
  }, [choiceKeysToRead, readChoices]);
@@ -22779,7 +22830,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
22779
22830
  },
22780
22831
  [client, effectiveRows]
22781
22832
  );
22782
- useEffect49(() => {
22833
+ useEffect50(() => {
22783
22834
  if (mappedRelations.length === 0) {
22784
22835
  setRelationIndex(/* @__PURE__ */ new Map());
22785
22836
  return;
@@ -23122,9 +23173,9 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
23122
23173
  const ruleVerdictOf = useMemo33(() => new Map(ruleVerdicts.map((v) => [v.header, v])), [ruleVerdicts]);
23123
23174
  const refusedByRules = ruleVerdicts.reduce((n, v) => n + v.refused, 0);
23124
23175
  const verdictKey = ruleVerdicts.map((v) => `${v.header}:${v.refused}/${v.judged}`).join("|");
23125
- useEffect49(() => setGoAheadAnyway(false), [verdictKey]);
23176
+ useEffect50(() => setGoAheadAnyway(false), [verdictKey]);
23126
23177
  const [autoRan, setAutoRan] = useState64(false);
23127
- useEffect49(() => {
23178
+ useEffect50(() => {
23128
23179
  if (!autoRun || autoRan || !source || phase !== "ready" || !plan) return;
23129
23180
  if (busy || !rights.write || rows.length === 0 || titleMissing || ruleVerdicts.length > 0) return;
23130
23181
  setAutoRan(true);
@@ -24392,7 +24443,7 @@ function useTableToolbarSheetExtras() {
24392
24443
  }
24393
24444
 
24394
24445
  // src/GridLayoutMenu.tsx
24395
- import { useEffect as useEffect50, useState as useState65 } from "react";
24446
+ import { useEffect as useEffect51, useState as useState65 } from "react";
24396
24447
  import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
24397
24448
  import {
24398
24449
  Button as Button44,
@@ -24413,7 +24464,7 @@ function useStoreGridLayout(tableId) {
24413
24464
  layout: null,
24414
24465
  error: null
24415
24466
  });
24416
- useEffect50(() => {
24467
+ useEffect51(() => {
24417
24468
  let alive = true;
24418
24469
  void client.gridLayout({ table_id: tableId, view_id: null }).then((answered) => {
24419
24470
  if (!alive) return;
@@ -24637,7 +24688,7 @@ function SortPanel({
24637
24688
  import { pageSortFor as pageSortFor2, pageSortsFor, thenSortsOf } from "@ai-matrx/records/first-page";
24638
24689
 
24639
24690
  // src/gridValueFilter.ts
24640
- import { useMemo as useMemo34, useRef as useRef32 } from "react";
24691
+ import { useMemo as useMemo34, useRef as useRef33 } from "react";
24641
24692
  var LONGEST_LISTABLE = 300;
24642
24693
  var MOST_VALUES = 500;
24643
24694
  function valueListKind(field2) {
@@ -24746,7 +24797,7 @@ async function askColumnValues(inputs, args) {
24746
24797
  return facetsFromGroups(args.columnId, field2.key, rows, limit, distinct, kind2 === "numbers" ? "number" : kind2 === "days" ? "newest" : "count");
24747
24798
  }
24748
24799
  function useStoreValueFacets(enabled, inputs) {
24749
- const latest = useRef32(inputs);
24800
+ const latest = useRef33(inputs);
24750
24801
  latest.current = inputs;
24751
24802
  return useMemo34(
24752
24803
  () => enabled ? { source: (args) => askColumnValues(latest.current, args) } : void 0,
@@ -24755,7 +24806,7 @@ function useStoreValueFacets(enabled, inputs) {
24755
24806
  }
24756
24807
 
24757
24808
  // src/gridGrouping.tsx
24758
- import { useEffect as useEffect51, useMemo as useMemo35, useState as useState67 } from "react";
24809
+ import { useEffect as useEffect52, useMemo as useMemo35, useState as useState67 } from "react";
24759
24810
  import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
24760
24811
  import { measureKey as measureKey2 } from "@ai-matrx/records";
24761
24812
  import { jsx as jsx83, jsxs as jsxs75 } from "react/jsx-runtime";
@@ -24770,7 +24821,7 @@ function useGroupFacts(args) {
24770
24821
  const [facts, setFacts] = useState67(null);
24771
24822
  const chosenKey = JSON.stringify(Object.entries(args.chosen).filter(([, op2]) => op2 in MEASURE_LABEL).sort());
24772
24823
  const filterKey = JSON.stringify(args.filter ?? {});
24773
- useEffect51(() => {
24824
+ useEffect52(() => {
24774
24825
  if (!groupKey) {
24775
24826
  setFacts(null);
24776
24827
  return;
@@ -24866,7 +24917,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
24866
24917
  }
24867
24918
 
24868
24919
  // src/gridUndo.tsx
24869
- import { useCallback as useCallback23, useEffect as useEffect52, useLayoutEffect as useLayoutEffect4, useMemo as useMemo36, useRef as useRef33, useState as useState68, useSyncExternalStore as useSyncExternalStore6 } from "react";
24920
+ import { useCallback as useCallback23, useEffect as useEffect53, useLayoutEffect as useLayoutEffect4, useMemo as useMemo36, useRef as useRef34, useState as useState68, useSyncExternalStore as useSyncExternalStore6 } from "react";
24870
24921
  import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
24871
24922
  import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
24872
24923
  import { Button as Button46 } from "@ai-matrx/design-system";
@@ -24894,16 +24945,16 @@ function changesFor(step2, direction, versions = /* @__PURE__ */ new Map()) {
24894
24945
  function useGridUndo(args) {
24895
24946
  const client = useRecordsClient39();
24896
24947
  const { tableId, reload, forget } = args;
24897
- const onVersionsRef = useRef33(args.onVersions);
24948
+ const onVersionsRef = useRef34(args.onVersions);
24898
24949
  onVersionsRef.current = args.onVersions;
24899
24950
  const onVersions = (versions) => onVersionsRef.current?.(versions);
24900
- const known = useRef33(/* @__PURE__ */ new Map());
24951
+ const known = useRef34(/* @__PURE__ */ new Map());
24901
24952
  const [held, setHeld] = useState68(() => ({ stack: createUndoStack(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
24902
- const heldRef = useRef33(held);
24953
+ const heldRef = useRef34(held);
24903
24954
  heldRef.current = held;
24904
24955
  const [busy, setBusy] = useState68(false);
24905
24956
  const [notice, setNotice] = useState68(null);
24906
- const counter = useRef33(0);
24957
+ const counter = useRef34(0);
24907
24958
  const dismiss = useCallback23(() => setNotice(null), []);
24908
24959
  const push = useCallback23((step2) => {
24909
24960
  if (step2.cells.length === 0 && !step2.created?.length && !step2.archived?.length && !step2.retiredField) return;
@@ -25000,7 +25051,7 @@ function useGridUndo(args) {
25000
25051
  );
25001
25052
  }
25002
25053
  function useUndoSource(undo) {
25003
- const box = useRef33({
25054
+ const box = useRef34({
25004
25055
  undo,
25005
25056
  face: { back: undo.depth.back, forward: undo.depth.forward, busy: undo.busy },
25006
25057
  listeners: /* @__PURE__ */ new Set()
@@ -25074,7 +25125,7 @@ function UndoRedoPair({ face, onUndo, onRedo }) {
25074
25125
  function UndoNotice({ undo, placement = "frame" }) {
25075
25126
  const notice = undo.notice;
25076
25127
  const dismiss = undo.dismiss;
25077
- useEffect52(() => {
25128
+ useEffect53(() => {
25078
25129
  if (!notice || notice.refusal) return;
25079
25130
  const timer = setTimeout(dismiss, 8e3);
25080
25131
  return () => clearTimeout(timer);
@@ -25107,7 +25158,7 @@ function undoKey(event) {
25107
25158
  }
25108
25159
 
25109
25160
  // src/gridViewMove.ts
25110
- import { useCallback as useCallback24, useEffect as useEffect53, useRef as useRef34 } from "react";
25161
+ import { useCallback as useCallback24, useEffect as useEffect54, useRef as useRef35 } from "react";
25111
25162
  function viewMoveLine(name, move, sortedBy = null) {
25112
25163
  const who = name.trim() === "" ? "The row" : name;
25113
25164
  if (move === "filter") return `${who} moved out of this filter`;
@@ -25127,10 +25178,10 @@ function sameReading(a, b) {
25127
25178
  }
25128
25179
  var WATCH_MS = 15e3;
25129
25180
  function useEditKeepsTheView(args) {
25130
- const pending = useRef34(null);
25131
- const latest = useRef34(args);
25181
+ const pending = useRef35(null);
25182
+ const latest = useRef35(args);
25132
25183
  latest.current = args;
25133
- useEffect53(() => {
25184
+ useEffect54(() => {
25134
25185
  const held = pending.current;
25135
25186
  if (!held || args.rows === held.rows) return;
25136
25187
  if (Date.now() - held.at > WATCH_MS) {
@@ -25154,7 +25205,7 @@ function useEditKeepsTheView(args) {
25154
25205
  }
25155
25206
 
25156
25207
  // src/gridRowMove.ts
25157
- import { useCallback as useCallback25, useEffect as useEffect54, useLayoutEffect as useLayoutEffect5, useRef as useRef35 } from "react";
25208
+ import { useCallback as useCallback25, useEffect as useEffect55, useLayoutEffect as useLayoutEffect5, useRef as useRef36 } from "react";
25158
25209
  var WATCH_MS2 = 15e3;
25159
25210
  function token(el, name, fallback) {
25160
25211
  const read = getComputedStyle(el).getPropertyValue(name).trim();
@@ -25193,12 +25244,12 @@ function bringIntoView(box, rowId, index, ids) {
25193
25244
  scroller.scrollTop += (index - at) * any.getBoundingClientRect().height;
25194
25245
  }
25195
25246
  function useRowFollowsItsMove(args) {
25196
- const held = useRef35(null);
25197
- const latest = useRef35(args);
25247
+ const held = useRef36(null);
25248
+ const latest = useRef36(args);
25198
25249
  latest.current = args;
25199
- const lastIds = useRef35(args.rowIds);
25200
- const frame = useRef35(0);
25201
- useEffect54(() => () => cancelAnimationFrame(frame.current), []);
25250
+ const lastIds = useRef36(args.rowIds);
25251
+ const frame = useRef36(0);
25252
+ useEffect55(() => () => cancelAnimationFrame(frame.current), []);
25202
25253
  const noteWrite = useCallback25((rowId, key) => {
25203
25254
  const box = latest.current.box.current;
25204
25255
  if (!box) return;
@@ -25258,7 +25309,7 @@ function useRowFollowsItsMove(args) {
25258
25309
 
25259
25310
  // src/gridAssist.tsx
25260
25311
  import { copyText as copyText2 } from "@ai-matrx/kit/clipboard";
25261
- import { useCallback as useCallback26, useEffect as useEffect55, useMemo as useMemo37, useRef as useRef36, useState as useState69 } from "react";
25312
+ import { useCallback as useCallback26, useEffect as useEffect56, useMemo as useMemo37, useRef as useRef37, useState as useState69 } from "react";
25262
25313
  import { tableKindSlug, wholeValueOf as wholeValueOf4 } from "@ai-matrx/records/core";
25263
25314
  import { useContentTransferCapabilities } from "@ai-matrx/alchemy/react/workspace";
25264
25315
 
@@ -25347,10 +25398,10 @@ function useGridAssist(args) {
25347
25398
  );
25348
25399
  const fieldOf2 = useCallback26((key) => fields.find((f) => f.key === key), [fields]);
25349
25400
  const onGridContext = host.onGridContext;
25350
- const lastKey = useRef36("");
25401
+ const lastKey = useRef37("");
25351
25402
  const editingAt = editing.editing;
25352
25403
  const draft = editing.draft;
25353
- useEffect55(() => {
25404
+ useEffect56(() => {
25354
25405
  if (!enabled || !onGridContext) return;
25355
25406
  const snapshot = gridContextSnapshot({
25356
25407
  tableId,
@@ -25778,7 +25829,7 @@ function BulkActions({
25778
25829
  }
25779
25830
 
25780
25831
  // src/handOrder.tsx
25781
- import { useEffect as useEffect56, useMemo as useMemo39, useRef as useRef37, useState as useState71 } from "react";
25832
+ import { useEffect as useEffect57, useMemo as useMemo39, useRef as useRef38, useState as useState71 } from "react";
25782
25833
  import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
25783
25834
  import { stableFilterKey as stableFilterKey2 } from "@ai-matrx/records";
25784
25835
  import { Button as Button48, ConfirmDialog as ConfirmDialog4, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, cn as cn40 } from "@ai-matrx/design-system";
@@ -25929,14 +25980,14 @@ function useHandOrderRows(args) {
25929
25980
  const { viewId, active, page, pageSize } = args;
25930
25981
  const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
25931
25982
  const filterKey = filter ? stableFilterKey2(filter) : "";
25932
- const filterNow = useRef37(filter);
25983
+ const filterNow = useRef38(filter);
25933
25984
  filterNow.current = filter;
25934
25985
  const [answer, setAnswer] = useState71(null);
25935
25986
  const [tick, setTick] = useState71(0);
25936
25987
  const limit = Math.max(1, Math.min(pageSize, DOOR_PAGE_MAX));
25937
25988
  const offset = Math.max(0, page) * limit;
25938
25989
  const key = `${viewId ?? ""}:${limit}:${offset}:${filterKey}`;
25939
- useEffect56(() => {
25990
+ useEffect57(() => {
25940
25991
  if (!active || !viewId) return;
25941
25992
  let cancelled = false;
25942
25993
  void client.readInViewOrder({ view_id: viewId, filter: filterNow.current, limit, offset }).then((result) => {
@@ -25975,7 +26026,7 @@ function HandOrderDialog({
25975
26026
  const [dragging, setDragging] = useState71(null);
25976
26027
  const [busy, setBusy] = useState71(false);
25977
26028
  const [refused, setRefused] = useState71(null);
25978
- useEffect56(() => {
26029
+ useEffect57(() => {
25979
26030
  if (open) {
25980
26031
  setList([...items]);
25981
26032
  setRefused(null);
@@ -26047,7 +26098,7 @@ function HandOrderDialog({
26047
26098
  }
26048
26099
 
26049
26100
  // src/structureHidden.tsx
26050
- import { useEffect as useEffect57, useState as useState72 } from "react";
26101
+ import { useEffect as useEffect58, useState as useState72 } from "react";
26051
26102
  import { useRecordsClient as useRecordsClient42 } from "@ai-matrx/records/react";
26052
26103
  import { jsx as jsx88 } from "react/jsx-runtime";
26053
26104
  var STRUCTURE_LOCKED = "Confidential. Rows and columns are visible to people it\u2019s shared with.";
@@ -26056,7 +26107,7 @@ function useStructureHidden(tableId, level) {
26056
26107
  const client = useRecordsClient42();
26057
26108
  const asks = tableId !== null && mayHideStructure(level);
26058
26109
  const [answer, setAnswer] = useState72(null);
26059
- useEffect57(() => {
26110
+ useEffect58(() => {
26060
26111
  if (!asks || tableId === null) return;
26061
26112
  let live = true;
26062
26113
  void client.tableLevelFacts({ table_id: tableId }).then((facts) => {
@@ -26213,7 +26264,7 @@ function GridBody({
26213
26264
  const [heldOrder, setHeldOrder] = useState73(null);
26214
26265
  const sortsKey = JSON.stringify(viewOrder?.sorts ?? []);
26215
26266
  const [heldThen, setHeldThen] = useState73(null);
26216
- useEffect58(() => {
26267
+ useEffect59(() => {
26217
26268
  setHeldOrder(null);
26218
26269
  setHeldThen(null);
26219
26270
  }, [viewOrder?.viewId, viewOrder?.order, sortsKey]);
@@ -26231,8 +26282,8 @@ function GridBody({
26231
26282
  const openingSort = manual ? null : viewSort ?? defaultSort;
26232
26283
  const openingKey = openingSort ? `${openingSort.id}:${openingSort.direction}` : "none";
26233
26284
  const address = useViewAddress();
26234
- const addressSeed = useRef38(address?.initial ?? null);
26235
- const addressSort = useRef38(
26285
+ const addressSeed = useRef39(address?.initial ?? null);
26286
+ const addressSort = useRef39(
26236
26287
  address?.initial?.sort ? { id: address.initial.sort.field, direction: address.initial.sort.direction } : null
26237
26288
  );
26238
26289
  const [query, setQuery] = useState73(() => ({
@@ -26244,7 +26295,7 @@ function GridBody({
26244
26295
  sort: addressSeed.current?.sort ? { id: addressSeed.current.sort.field, direction: addressSeed.current.sort.direction } : openingSort
26245
26296
  }));
26246
26297
  const [seatedOn, setSeatedOn] = useState73(openingKey);
26247
- useEffect58(() => {
26298
+ useEffect59(() => {
26248
26299
  const seed = addressSeed.current;
26249
26300
  if (seed && fields.data) addressSeed.current = null;
26250
26301
  setQuery((held) => ({
@@ -26254,14 +26305,14 @@ function GridBody({
26254
26305
  }));
26255
26306
  setSeatedOn(openingKey);
26256
26307
  }, [openingKey]);
26257
- useEffect58(() => {
26308
+ useEffect59(() => {
26258
26309
  const held = addressSort.current;
26259
26310
  if (held && (query.sort?.id !== held.id || query.sort?.direction !== held.direction)) addressSort.current = null;
26260
26311
  }, [query.sort]);
26261
26312
  const columnSort = query.sort;
26262
26313
  const overrideKey = sortOverride ? `${sortOverride.field}:${sortOverride.direction}` : "";
26263
- const overrideSeen = useRef38(overrideKey);
26264
- useEffect58(() => {
26314
+ const overrideSeen = useRef39(overrideKey);
26315
+ useEffect59(() => {
26265
26316
  if (overrideSeen.current === overrideKey) return;
26266
26317
  overrideSeen.current = overrideKey;
26267
26318
  setQuery((held) => ({
@@ -26270,8 +26321,8 @@ function GridBody({
26270
26321
  page: 1
26271
26322
  }));
26272
26323
  }, [overrideKey]);
26273
- const overrideSearchSeen = useRef38(void 0);
26274
- useEffect58(() => {
26324
+ const overrideSearchSeen = useRef39(void 0);
26325
+ useEffect59(() => {
26275
26326
  if (searchOverride === void 0) return;
26276
26327
  const wanted = searchOverride ?? "";
26277
26328
  if (overrideSearchSeen.current === wanted) return;
@@ -26279,7 +26330,7 @@ function GridBody({
26279
26330
  setQuery((held) => held.search === wanted ? held : { ...held, search: wanted, page: 1 });
26280
26331
  }, [searchOverride]);
26281
26332
  const reportQuery = address?.report;
26282
- useEffect58(() => {
26333
+ useEffect59(() => {
26283
26334
  if (!reportQuery) return;
26284
26335
  const sort = query.sort && `${query.sort.id}:${query.sort.direction}` !== openingKey ? { field: query.sort.id, direction: query.sort.direction } : null;
26285
26336
  reportQuery({
@@ -26290,13 +26341,13 @@ function GridBody({
26290
26341
  });
26291
26342
  }, [reportQuery, query.sort, query.columnFilters, query.search, query.page, openingKey]);
26292
26343
  const liveKeys = useMemo40(() => fields.data ? new Set(fields.data.map((f) => f.key)) : null, [fields.data]);
26293
- useEffect58(() => {
26344
+ useEffect59(() => {
26294
26345
  if (!liveKeys) return;
26295
26346
  setQuery((held) => withoutGoneColumns(held, liveKeys, openingSort));
26296
26347
  }, [liveKeys]);
26297
26348
  const resetEpoch = address?.resetEpoch ?? 0;
26298
- const resetSeen = useRef38(resetEpoch);
26299
- useEffect58(() => {
26349
+ const resetSeen = useRef39(resetEpoch);
26350
+ useEffect59(() => {
26300
26351
  if (resetSeen.current === resetEpoch) return;
26301
26352
  resetSeen.current = resetEpoch;
26302
26353
  addressSeed.current = null;
@@ -26305,7 +26356,7 @@ function GridBody({
26305
26356
  }, [resetEpoch]);
26306
26357
  const [page, setPage] = useState73(0);
26307
26358
  const [searchTerm, setSearchTerm] = useState73("");
26308
- useEffect58(() => {
26359
+ useEffect59(() => {
26309
26360
  if (!storePaged) return;
26310
26361
  const wanted = query.search.trim();
26311
26362
  if (wanted === searchTerm) return;
@@ -26374,7 +26425,7 @@ function GridBody({
26374
26425
  page: classicInCard ? 0 : page,
26375
26426
  ...readFilter ? { filter: readFilter } : {}
26376
26427
  });
26377
- const pageAskedFor = useRef38(null);
26428
+ const pageAskedFor = useRef39(null);
26378
26429
  if (fields.data && !table.loading) pageAskedFor.current = tableId;
26379
26430
  const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
26380
26431
  const numberAsked = useMemo40(() => autonumberSearchOf(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
@@ -26404,9 +26455,9 @@ function GridBody({
26404
26455
  const [appending, setAppending] = useState73(false);
26405
26456
  const pageDoorViewId = manual && pageSort.length === 0 ? viewId : null;
26406
26457
  const askKey2 = embeddedPageAskKey(tableId, pageSearch, pageSort, pageFilter ?? null, pageDoorViewId);
26407
- const embeddedAskKey = useRef38(askKey2);
26458
+ const embeddedAskKey = useRef39(askKey2);
26408
26459
  embeddedAskKey.current = askKey2;
26409
- useEffect58(() => {
26460
+ useEffect59(() => {
26410
26461
  setAppendedRows([]);
26411
26462
  setAppendedPhysicalPages(0);
26412
26463
  setAppending(false);
@@ -26447,16 +26498,16 @@ function GridBody({
26447
26498
  const rows = added.rows;
26448
26499
  const lockedRows = records.data?.locked ?? 0;
26449
26500
  const rowIds = useMemo40(() => rows.map((row) => row.id), [rows]);
26450
- const rowsShownRef = useRef38(onRowsShown);
26501
+ const rowsShownRef = useRef39(onRowsShown);
26451
26502
  rowsShownRef.current = onRowsShown;
26452
- useEffect58(() => {
26503
+ useEffect59(() => {
26453
26504
  rowsShownRef.current?.(rowIds);
26454
26505
  }, [rowIds]);
26455
26506
  const countedButNotReturned = !records.error && !records.loading && rows.length === 0 && typeof records.data?.total === "number" && records.data.total > 0 && (storePaged ? query.page <= 1 : page <= 0);
26456
- const reReads = useRef38(0);
26457
- const reloadRecords = useRef38(records.reload);
26507
+ const reReads = useRef39(0);
26508
+ const reloadRecords = useRef39(records.reload);
26458
26509
  reloadRecords.current = records.reload;
26459
- useEffect58(() => {
26510
+ useEffect59(() => {
26460
26511
  if (!countedButNotReturned) {
26461
26512
  reReads.current = 0;
26462
26513
  return;
@@ -26488,10 +26539,10 @@ function GridBody({
26488
26539
  );
26489
26540
  const canWrite = Boolean(editable) && (rights.write || askPerRow && rowIds.some(mayWriteRow));
26490
26541
  const readOnly = !editable || Boolean(host.rights) && !rights.write && !rights.structure;
26491
- const gridBox = useRef38(null);
26492
- const lastExit = useRef38(null);
26493
- const pushWritten = useRef38(null);
26494
- const sheetController = useRef38(null);
26542
+ const gridBox = useRef39(null);
26543
+ const lastExit = useRef39(null);
26544
+ const pushWritten = useRef39(null);
26545
+ const sheetController = useRef39(null);
26495
26546
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
26496
26547
  const editing = useGridEditing({
26497
26548
  tableId,
@@ -26516,7 +26567,7 @@ function GridBody({
26516
26567
  }
26517
26568
  } : {}
26518
26569
  });
26519
- const editingNow = useRef38(editing);
26570
+ const editingNow = useRef39(editing);
26520
26571
  editingNow.current = editing;
26521
26572
  const editingHandle = useMemo40(
26522
26573
  () => new Proxy({}, {
@@ -26714,8 +26765,8 @@ function GridBody({
26714
26765
  const [deleting, setDeleting] = useState73(null);
26715
26766
  const [deleteBusy, setDeleteBusy] = useState73(false);
26716
26767
  const [archived, setArchived] = useState73(null);
26717
- const choiceOptions = useRef38(/* @__PURE__ */ new Map());
26718
- const relationNames = useRef38(/* @__PURE__ */ new Map());
26768
+ const choiceOptions = useRef39(/* @__PURE__ */ new Map());
26769
+ const relationNames = useRef39(/* @__PURE__ */ new Map());
26719
26770
  const loadRelationNames = useCallback28(
26720
26771
  async (fieldList, wanted) => {
26721
26772
  relationNames.current = /* @__PURE__ */ new Map();
@@ -26942,7 +26993,7 @@ function GridBody({
26942
26993
  },
26943
26994
  [rows, client, tableId, editing, undo, records, versions, fields.data]
26944
26995
  );
26945
- const pasteAtOnce = useRef38(applyPasteAsOne);
26996
+ const pasteAtOnce = useRef39(applyPasteAsOne);
26946
26997
  pasteAtOnce.current = applyPasteAsOne;
26947
26998
  const writeRange = useCallback28(
26948
26999
  async (patches, intent) => {
@@ -27046,7 +27097,7 @@ function GridBody({
27046
27097
  return { written, readBack, missing, refusals };
27047
27098
  }, [pastePlan, client, tableId, records, merged, applyPasteAsOne, versions, fields.data]);
27048
27099
  const columnIds = useMemo40(() => ordered.map((field2) => field2.key), [ordered]);
27049
- const lookWrites = useRef38(null);
27100
+ const lookWrites = useRef39(null);
27050
27101
  const writeLook = useCallback28(
27051
27102
  (next) => {
27052
27103
  if (!onPresentationChange) return;
@@ -27118,7 +27169,7 @@ function GridBody({
27118
27169
  total: typeof records.data?.total === "number" ? records.data.total : null,
27119
27170
  search: searchTerm
27120
27171
  });
27121
- const followRef = useRef38({ openRecordId, onOpenRecord, onCloseRecord });
27172
+ const followRef = useRef39({ openRecordId, onOpenRecord, onCloseRecord });
27122
27173
  followRef.current = { openRecordId, onOpenRecord, onCloseRecord };
27123
27174
  const toggleRecord = useCallback28((rowId) => {
27124
27175
  const { openRecordId: open, onOpenRecord: openIt, onCloseRecord: closeIt } = followRef.current;
@@ -27135,7 +27186,7 @@ function GridBody({
27135
27186
  },
27136
27187
  [assist.onSelectionChange]
27137
27188
  );
27138
- const addRowRef = useRef38(() => void 0);
27189
+ const addRowRef = useRef39(() => void 0);
27139
27190
  const valueFacets = useStoreValueFacets(merged && storePaged, {
27140
27191
  client,
27141
27192
  tableId,
@@ -27144,7 +27195,7 @@ function GridBody({
27144
27195
  columnFilters: query.columnFilters
27145
27196
  });
27146
27197
  const [localWidths, setLocalWidths] = useState73(null);
27147
- const widthsNow = useRef38({ localWidths, presentation, writeLook });
27198
+ const widthsNow = useRef39({ localWidths, presentation, writeLook });
27148
27199
  widthsNow.current = { localWidths, presentation, writeLook };
27149
27200
  const forgetWidth = useCallback28((key) => {
27150
27201
  const { localWidths: held, presentation: look2, writeLook: write } = widthsNow.current;
@@ -27248,19 +27299,19 @@ function GridBody({
27248
27299
  }
27249
27300
  }, [added, controls.columns, columnIds, fields.data, editing, records, undo, formHosted, presetValues]);
27250
27301
  addRowRef.current = () => void addRowHere();
27251
- const addFromTemplateRef = useRef38(() => void 0);
27302
+ const addFromTemplateRef = useRef39(() => void 0);
27252
27303
  addFromTemplateRef.current = (values) => void addRowHere(values);
27253
- const formCreatedRef = useRef38(() => void 0);
27304
+ const formCreatedRef = useRef39(() => void 0);
27254
27305
  formCreatedRef.current = (id) => {
27255
27306
  added.pin({ id, document: {}, level: "editor", hidden: {} });
27256
27307
  undo.push({ label: "Added a record", cells: [], created: [id] });
27257
27308
  records.reload();
27258
27309
  };
27259
27310
  const labels = useRecordLabels(ordered);
27260
- const labelsNow = useRef38(labels);
27311
+ const labelsNow = useRef39(labels);
27261
27312
  labelsNow.current = labels;
27262
27313
  const labelFor = useCallback28((field2, id) => labelsNow.current(field2, id), []);
27263
- useEffect58(() => {
27314
+ useEffect59(() => {
27264
27315
  for (const field2 of ordered) {
27265
27316
  if (!pointsAtRecords(field2)) continue;
27266
27317
  for (const row of rows) for (const id of idsOf(row.document?.[field2.key])) labels(field2, id);
@@ -27309,7 +27360,7 @@ function GridBody({
27309
27360
  pinCell
27310
27361
  ]
27311
27362
  );
27312
- const footerNow = useRef38({
27363
+ const footerNow = useRef39({
27313
27364
  summaryCell: () => null,
27314
27365
  addLine: () => null,
27315
27366
  choose: () => void 0,
@@ -27338,7 +27389,7 @@ function GridBody({
27338
27389
  },
27339
27390
  addLine: () => /* @__PURE__ */ jsx89(AddRowLine, { onAdd: () => footerNow.current.add(), busy: added.busy, label: newRowLabel ?? "Add row" })
27340
27391
  };
27341
- const addColumnNow = useRef38(controls.addColumn);
27392
+ const addColumnNow = useRef39(controls.addColumn);
27342
27393
  addColumnNow.current = controls.addColumn;
27343
27394
  const rowIdsOnScreen = useMemo40(() => rows.map((row) => row.id), [rows]);
27344
27395
  const reverseGridColumns = useReverseGridColumns(tableId, rowIdsOnScreen);
@@ -27402,7 +27453,7 @@ function GridBody({
27402
27453
  [treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord, navigate]
27403
27454
  );
27404
27455
  const isRowSelectable = useCallback28((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
27405
- const viewRowsNow = useRef38([]);
27456
+ const viewRowsNow = useRef39([]);
27406
27457
  viewRowsNow.current = rows.filter((row) => row.id !== SUMMARY_ROW.id);
27407
27458
  const copyConfig = useMemo40(
27408
27459
  () => table.data ? gridCopyConfig({
@@ -27428,7 +27479,7 @@ function GridBody({
27428
27479
  },
27429
27480
  [paint]
27430
27481
  );
27431
- const rowActionsNow = useRef38({ runner, handToAgent, host, table: table.data, duplicate });
27482
+ const rowActionsNow = useRef39({ runner, handToAgent, host, table: table.data, duplicate });
27432
27483
  rowActionsNow.current = { runner, handToAgent, host, table: table.data, duplicate };
27433
27484
  const offersRowActions = !embedded && (canWrite || Boolean(host.talkToRecord) || Boolean(!readOnly && host.runAgentAction && tableActions2.agent.length > 0));
27434
27485
  const hasTalk = Boolean(host.talkToRecord);
@@ -27504,8 +27555,8 @@ function GridBody({
27504
27555
  // eslint-disable-next-line react-hooks/exhaustive-deps -- `hasTalk`/`hasAgent` stand for the host ports the JSX reads; handlers run through `rowActionsNow`.
27505
27556
  [canWrite, mayWriteRow, tableActions2.runnable, tableActions2.agent, runner.busy, hasTalk, hasAgent, editable, rights.write, readOnly]
27506
27557
  );
27507
- const headerHeld = useRef38(/* @__PURE__ */ new Map());
27508
- const menuLatest = useRef38(/* @__PURE__ */ new Map());
27558
+ const headerHeld = useRef39(/* @__PURE__ */ new Map());
27559
+ const menuLatest = useRef39(/* @__PURE__ */ new Map());
27509
27560
  const addColumnDef = useMemo40(() => addColumnColumn(() => addColumnNow.current()), []);
27510
27561
  const drawnColumns = useMemo40(
27511
27562
  () => {
@@ -27520,7 +27571,7 @@ function GridBody({
27520
27571
  },
27521
27572
  [bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef, offersRowActions, mayManageActions]
27522
27573
  );
27523
- const columnsHeld = useRef38(null);
27574
+ const columnsHeld = useRef39(null);
27524
27575
  const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
27525
27576
  columnsHeld.current = columns;
27526
27577
  const tableColumns = useMemo40(
@@ -27668,7 +27719,7 @@ function GridBody({
27668
27719
  }),
27669
27720
  [storePaged, coverageTotal]
27670
27721
  );
27671
- const sheetNow = useRef38({ merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify });
27722
+ const sheetNow = useRef39({ merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify });
27672
27723
  sheetNow.current = { merged, writeRange, editing, fields: fields.data ?? [], rows, mayWriteRow, notify: host.notify };
27673
27724
  const hasNotify = Boolean(host.notify);
27674
27725
  const readOnlyReason = !editable || !rights.known || rights.write ? "Editing is off here, so this table can be copied but not changed." : rights.why("write");
@@ -28017,7 +28068,7 @@ function GridBody({
28017
28068
  );
28018
28069
  const rowMemoryKey = `${tableId}:${embedded ? "embedded" : "page"}:${openingKey}`;
28019
28070
  const rowsAnswered = Boolean(records.data) && !records.loading && !table.loading && !fields.loading;
28020
- useEffect58(() => {
28071
+ useEffect59(() => {
28021
28072
  if (rowsAnswered) {
28022
28073
  rememberRowCount(rowMemoryKey, rows.length);
28023
28074
  if (!embedded) rememberRowCount(`${tableId}:page:last`, rows.length);
@@ -28779,7 +28830,7 @@ function ConnectedRecordsTableCard({
28779
28830
  // src/ExportMenu.tsx
28780
28831
  import { copyText as copyText3 } from "@ai-matrx/kit/clipboard";
28781
28832
  import { downloadFile as downloadFile2 } from "@ai-matrx/kit/download";
28782
- import { useEffect as useEffect59, useState as useState74 } from "react";
28833
+ import { useEffect as useEffect60, useState as useState74 } from "react";
28783
28834
  import { useFields as useFields14, useRecords as useRecords7, useRecordsClient as useRecordsClient45, useTable as useTable12 } from "@ai-matrx/records/react";
28784
28835
  import { exportCsv, exportMarkdown, exportXlsx, wholeValueOf as wholeValueOf5, withWholeValues } from "@ai-matrx/records/core";
28785
28836
 
@@ -28894,7 +28945,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
28894
28945
  const page = useRecords7(view ? null : tableId, { pageSize: 500 });
28895
28946
  const viewKey = view ? JSON.stringify([view.filter ?? null, view.sorts ?? [], view.viewId ?? null]) : "";
28896
28947
  const [viewRead, setViewRead] = useState74(null);
28897
- useEffect59(() => {
28948
+ useEffect60(() => {
28898
28949
  if (!view || !fields.data) return;
28899
28950
  let live = true;
28900
28951
  void readViewRows(client, tableId, fields.data, view).then((read) => {
@@ -29027,7 +29078,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
29027
29078
  }
29028
29079
 
29029
29080
  // src/ImportNotice.tsx
29030
- import { useCallback as useCallback29, useEffect as useEffect60, useMemo as useMemo42, useState as useState75 } from "react";
29081
+ import { useCallback as useCallback29, useEffect as useEffect61, useMemo as useMemo42, useState as useState75 } from "react";
29031
29082
  import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
29032
29083
  import { Button as Button52, cn as cn43 } from "@ai-matrx/design-system";
29033
29084
  import { jsx as jsx93, jsxs as jsxs82 } from "react/jsx-runtime";
@@ -29058,7 +29109,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
29058
29109
  const [problem, setProblem] = useState75(null);
29059
29110
  const [report, setReport] = useState75(null);
29060
29111
  const [dismissed, setDismissed] = useState75(null);
29061
- useEffect60(() => {
29112
+ useEffect61(() => {
29062
29113
  let live = true;
29063
29114
  void client.imports({ table_id: tableId, limit: 5 }).then((answered) => {
29064
29115
  if (!live) return;
@@ -29073,7 +29124,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
29073
29124
  }, [client, tableId, epoch]);
29074
29125
  const run = useMemo42(() => runs ? runToNotice(runs) : null, [runs]);
29075
29126
  const shown5 = run && !wasDismissed(run.import_id) && dismissed !== run.import_id ? run : null;
29076
- useEffect60(() => {
29127
+ useEffect61(() => {
29077
29128
  if (!shown5 || report?.import_id === shown5.import_id) return;
29078
29129
  let live = true;
29079
29130
  void client.importReport({ import_id: shown5.import_id, state: "refused", limit: 500 }).then((answered) => {
@@ -29131,7 +29182,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
29131
29182
  }
29132
29183
 
29133
29184
  // src/SaveToTable.tsx
29134
- import { useEffect as useEffect66, useMemo as useMemo46, useRef as useRef41, useState as useState82 } from "react";
29185
+ import { useEffect as useEffect67, useMemo as useMemo46, useRef as useRef42, useState as useState82 } from "react";
29135
29186
  import { useRecordsClient as useRecordsClient53, useMyLevels as useMyLevels3, useTables as useTables3 } from "@ai-matrx/records/react";
29136
29187
  import {
29137
29188
  Button as Button60,
@@ -29182,14 +29233,14 @@ async function findUnfinishedTable(client, wantedName, wantedKeys, wantedRows, n
29182
29233
  }
29183
29234
 
29184
29235
  // src/TablesHome.tsx
29185
- import { useEffect as useEffect65, useState as useState81 } from "react";
29236
+ import { useEffect as useEffect66, useState as useState81 } from "react";
29186
29237
  import { useRecordsClient as useRecordsClient52, useTables as useTables2 } from "@ai-matrx/records/react";
29187
29238
  import { withTableFacts } from "@ai-matrx/records/core";
29188
29239
  import { withTablePlacement as withTablePlacement2 } from "@ai-matrx/records";
29189
29240
  import { Button as Button59, Skeleton as Skeleton10, cn as cn48 } from "@ai-matrx/design-system";
29190
29241
 
29191
29242
  // src/NewTableStart.tsx
29192
- import { useCallback as useCallback30, useMemo as useMemo43, useRef as useRef39, useState as useState76 } from "react";
29243
+ import { useCallback as useCallback30, useMemo as useMemo43, useRef as useRef40, useState as useState76 } from "react";
29193
29244
  import { tableShapeChanged as tableShapeChanged7, useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
29194
29245
  import {
29195
29246
  BasicInput as BasicInput15,
@@ -29482,7 +29533,7 @@ function NewTableStart({
29482
29533
  const [busy, setBusy] = useState76(false);
29483
29534
  const [error, setError] = useState76(null);
29484
29535
  const [name, setName] = useState76("");
29485
- const nameTyped = useRef39("");
29536
+ const nameTyped = useRef40("");
29486
29537
  nameTyped.current = name;
29487
29538
  const [columnWords2, setColumnWords] = useState76("");
29488
29539
  const [columns, setColumns] = useState76([]);
@@ -29495,7 +29546,7 @@ function NewTableStart({
29495
29546
  const [importName, setImportName] = useState76("");
29496
29547
  const [target, setTarget] = useState76(NEW_TABLE2);
29497
29548
  const [dragging, setDragging] = useState76(false);
29498
- const fileInput = useRef39(null);
29549
+ const fileInput = useRef40(null);
29499
29550
  const parsed = useMemo43(() => read ? importFromGrid(read.grid, headerRow) : null, [read, headerRow]);
29500
29551
  const intoTables = useMemo43(
29501
29552
  () => (existingTables ?? []).filter((t) => !t.is_kernel).slice().sort((a, b) => tableName(a).localeCompare(tableName(b))),
@@ -29888,7 +29939,7 @@ function NewTableColumns({
29888
29939
 
29889
29940
  // src/BookingSlots.tsx
29890
29941
  import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
29891
- import { useCallback as useCallback33, useEffect as useEffect63, useMemo as useMemo45, useState as useState79 } from "react";
29942
+ import { useCallback as useCallback33, useEffect as useEffect64, useMemo as useMemo45, useState as useState79 } from "react";
29892
29943
  import { useRecordsClient as useRecordsClient50, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
29893
29944
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
29894
29945
  import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47 } from "@ai-matrx/design-system";
@@ -29896,7 +29947,7 @@ import { Badge as Badge11, Button as Button57, Skeleton as Skeleton9, cn as cn47
29896
29947
  // src/BookingBuilder.tsx
29897
29948
  import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
29898
29949
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
29899
- import { useCallback as useCallback31, useEffect as useEffect61, useMemo as useMemo44, useRef as useRef40, useState as useState77 } from "react";
29950
+ import { useCallback as useCallback31, useEffect as useEffect62, useMemo as useMemo44, useRef as useRef41, useState as useState77 } from "react";
29900
29951
  import { useFields as useFields15, useRecordsClient as useRecordsClient48, useTable as useTable13 } from "@ai-matrx/records/react";
29901
29952
  import { formatDurationMinutes } from "@ai-matrx/kit/format";
29902
29953
  import {
@@ -30034,7 +30085,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
30034
30085
  const [confirmation, setConfirmation] = useState77("");
30035
30086
  const [offer, setOffer] = useState77(null);
30036
30087
  const [formId, setFormId] = useState77(bookingId ?? null);
30037
- const madeRef = useRef40(null);
30088
+ const madeRef = useRef41(null);
30038
30089
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
30039
30090
  const askable = useMemo44(
30040
30091
  () => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
@@ -30070,19 +30121,19 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
30070
30121
  }
30071
30122
  setLoaded(true);
30072
30123
  }, [client, tableId, bookingId, startNew]);
30073
- useEffect61(() => {
30124
+ useEffect62(() => {
30074
30125
  void load();
30075
30126
  }, [load]);
30076
- useEffect61(() => {
30127
+ useEffect62(() => {
30077
30128
  if (title !== "" || !table.data) return;
30078
30129
  setTitle(existing?.title ?? `Book a ${minutes}-minute ${singularNoun(table.data, "appointment")}`);
30079
30130
  }, [table.data, existing]);
30080
- useEffect61(() => {
30131
+ useEffect62(() => {
30081
30132
  if (!existing) return;
30082
30133
  setMinutes(existing.slot_minutes);
30083
30134
  if (existing.timezone && existing.timezone !== "UTC") setTimezone(existing.timezone);
30084
30135
  }, [existing]);
30085
- useEffect61(() => {
30136
+ useEffect62(() => {
30086
30137
  if (!offer) return;
30087
30138
  setWindows(draftWindows(offer));
30088
30139
  setMinutes(offer.slot_minutes);
@@ -30104,8 +30155,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
30104
30155
  }),
30105
30156
  [timezone, minutes, buffer, lead, perDay, days, windows]
30106
30157
  );
30107
- const startedAsking = useRef40(false);
30108
- useEffect61(() => {
30158
+ const startedAsking = useRef41(false);
30159
+ useEffect62(() => {
30109
30160
  if (startedAsking.current || !loaded || existing || formId || !fields.data) return;
30110
30161
  startedAsking.current = true;
30111
30162
  if (asked4.length > 0) return;
@@ -30133,7 +30184,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
30133
30184
  setWhoAdded(true);
30134
30185
  }
30135
30186
  const [whoAdded, setWhoAdded] = useState77(false);
30136
- useEffect61(() => {
30187
+ useEffect62(() => {
30137
30188
  if (!whoAdded) return;
30138
30189
  const who = askable.filter((f) => isWhoField(f)).map((f) => f.key);
30139
30190
  if (who.length === 0) return;
@@ -30439,7 +30490,7 @@ function BuildOrAsk({
30439
30490
  }
30440
30491
 
30441
30492
  // src/BuiltOnArchive.tsx
30442
- import { useCallback as useCallback32, useEffect as useEffect62, useState as useState78 } from "react";
30493
+ import { useCallback as useCallback32, useEffect as useEffect63, useState as useState78 } from "react";
30443
30494
  import {
30444
30495
  archivedWhen,
30445
30496
  BUILT_KIND_WORD
@@ -30539,7 +30590,7 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
30539
30590
  setError(null);
30540
30591
  setThings(archivedThings(forms.data, checklists.data));
30541
30592
  }, [client, tableId]);
30542
- useEffect62(() => {
30593
+ useEffect63(() => {
30543
30594
  void read();
30544
30595
  }, [read]);
30545
30596
  const restore = async (thing) => {
@@ -30631,7 +30682,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
30631
30682
  setError(null);
30632
30683
  setPages(answered.data);
30633
30684
  }, [client, tableId]);
30634
- useEffect63(() => {
30685
+ useEffect64(() => {
30635
30686
  void load();
30636
30687
  }, [load]);
30637
30688
  const subjectIds = useMemo45(
@@ -30848,7 +30899,7 @@ function nextInWords(page) {
30848
30899
  }
30849
30900
 
30850
30901
  // src/WhereItLives.tsx
30851
- import { useEffect as useEffect64, useState as useState80 } from "react";
30902
+ import { useEffect as useEffect65, useState as useState80 } from "react";
30852
30903
  import { moveConsequence } from "@ai-matrx/records";
30853
30904
  import { useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
30854
30905
  import { Button as Button58, ErrorBox as ErrorBox4, Popover as Popover12, PopoverContent as PopoverContent12, PopoverTrigger as PopoverTrigger12 } from "@ai-matrx/design-system";
@@ -30860,7 +30911,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
30860
30911
  const [attempt, setAttempt] = useState80(0);
30861
30912
  const [open, setOpen] = useState80(false);
30862
30913
  const [armed, setArmed] = useState80(variant === "anchor" ? false : variant !== "row" || !knownOrganizationName);
30863
- useEffect64(() => {
30914
+ useEffect65(() => {
30864
30915
  if (openAsked <= 0) return;
30865
30916
  setArmed(true);
30866
30917
  setOpen(true);
@@ -30868,7 +30919,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
30868
30919
  const [choosing, setChoosing] = useState80(null);
30869
30920
  const [moving, setMoving] = useState80(false);
30870
30921
  const [said2, setSaid] = useState80(null);
30871
- useEffect64(() => {
30922
+ useEffect65(() => {
30872
30923
  if (!armed) return;
30873
30924
  let alive = true;
30874
30925
  setAnswer(null);
@@ -31126,7 +31177,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
31126
31177
  const tables = useTables2();
31127
31178
  const me = client.config.actor.user_id ?? null;
31128
31179
  const [facts, setFacts] = useState81({ phase: "reading" });
31129
- useEffect65(() => {
31180
+ useEffect66(() => {
31130
31181
  let alive = true;
31131
31182
  void client.tableFacts().then((answered) => {
31132
31183
  if (!alive) return;
@@ -31144,7 +31195,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
31144
31195
  const keptCount = listed.filter((t) => laneFor(t) === "app").length;
31145
31196
  const [askedName, setAskedName] = useState81(null);
31146
31197
  const firstTableId = listed[0]?.id ?? null;
31147
- useEffect65(() => {
31198
+ useEffect66(() => {
31148
31199
  if (organizationName || !firstTableId) return;
31149
31200
  let alive = true;
31150
31201
  void client.tableHome({ table_id: firstTableId }).then((answered) => {
@@ -31159,12 +31210,12 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
31159
31210
  const sectionsKnown = facts.phase !== "failed";
31160
31211
  const [creating, setCreating] = useState81(() => (askedBy?.create ?? 0) > 0);
31161
31212
  const createAsked = askedBy?.create ?? 0;
31162
- useEffect65(() => {
31213
+ useEffect66(() => {
31163
31214
  if (createAsked > 0) setCreating(true);
31164
31215
  }, [createAsked]);
31165
31216
  const hostButtons = askedBy !== void 0;
31166
31217
  const [boards, setBoards] = useState81(null);
31167
- useEffect65(() => {
31218
+ useEffect66(() => {
31168
31219
  if (makingOnly) return;
31169
31220
  let cancelled = false;
31170
31221
  void client.dashboards({}).then((result) => {
@@ -31371,10 +31422,10 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
31371
31422
  const [phase, setPhase] = useState82("ready");
31372
31423
  const [made, setMade] = useState82(null);
31373
31424
  const sourceName = source.title?.trim() || shape?.name || "the rows above";
31374
- const makeRef = useRef41(null);
31375
- const madeAtOnce = useRef41(false);
31425
+ const makeRef = useRef42(null);
31426
+ const madeAtOnce = useRef42(false);
31376
31427
  const tablesKnown = tables.data !== void 0;
31377
- useEffect66(() => {
31428
+ useEffect67(() => {
31378
31429
  if (!makeAtOnce || madeAtOnce.current || !shape || !tablesKnown || !makeRef.current) return;
31379
31430
  madeAtOnce.current = true;
31380
31431
  void makeRef.current();
@@ -31750,7 +31801,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
31750
31801
  }
31751
31802
 
31752
31803
  // src/StageRules.tsx
31753
- import { useCallback as useCallback34, useEffect as useEffect67, useMemo as useMemo47, useState as useState83 } from "react";
31804
+ import { useCallback as useCallback34, useEffect as useEffect68, useMemo as useMemo47, useState as useState83 } from "react";
31754
31805
  import { useFields as useFields16, useRecordsClient as useRecordsClient54, useTable as useTable14 } from "@ai-matrx/records/react";
31755
31806
  import { BasicInput as BasicInput18, BasicTextarea as BasicTextarea8, Button as Button61, Separator as Separator7, Skeleton as Skeleton11, cn as cn50 } from "@ai-matrx/design-system";
31756
31807
  import { Select as Select13 } from "@ai-matrx/design-system/controls";
@@ -31806,7 +31857,7 @@ function StageRulesSection({ tableId, stage, className }) {
31806
31857
  if (mode.ok) setEnforcement(mode.data);
31807
31858
  setAsked(true);
31808
31859
  }, [client, tableId]);
31809
- useEffect67(() => {
31860
+ useEffect68(() => {
31810
31861
  void load();
31811
31862
  }, [load]);
31812
31863
  const stages = pipeline?.stages ?? [];
@@ -31817,7 +31868,7 @@ function StageRulesSection({ tableId, stage, className }) {
31817
31868
  () => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
31818
31869
  [fields.data]
31819
31870
  );
31820
- useEffect67(() => {
31871
+ useEffect68(() => {
31821
31872
  if (!draft || !stageKey || !draft.demands || Object.keys(draft.demands).length === 0) {
31822
31873
  setPreview(null);
31823
31874
  setPreviewError(null);
@@ -32037,7 +32088,7 @@ function Clause({
32037
32088
  }
32038
32089
 
32039
32090
  // src/TableRename.tsx
32040
- import { useCallback as useCallback35, useEffect as useEffect68, useRef as useRef42, useState as useState84 } from "react";
32091
+ import { useCallback as useCallback35, useEffect as useEffect69, useRef as useRef43, useState as useState84 } from "react";
32041
32092
  import { tableShapeChanged as tableShapeChanged8, useRecordsClient as useRecordsClient55 } from "@ai-matrx/records/react";
32042
32093
  import {
32043
32094
  Button as Button62,
@@ -32059,7 +32110,7 @@ function tableNameProblem(typed2) {
32059
32110
  }
32060
32111
  function useRenameFromMenu() {
32061
32112
  const [open, setOpen] = useState84(false);
32062
- const asked4 = useRef42(false);
32113
+ const asked4 = useRef43(false);
32063
32114
  const ask2 = useCallback35(() => {
32064
32115
  asked4.current = true;
32065
32116
  window.setTimeout(() => setOpen(true), 0);
@@ -32085,9 +32136,9 @@ function TableRenameDialog({
32085
32136
  const [typed2, setTyped] = useState84(name);
32086
32137
  const [busy, setBusy] = useState84(false);
32087
32138
  const [refused, setRefused] = useState84(null);
32088
- const box = useRef42(null);
32089
- const openedAt = useRef42(null);
32090
- useEffect68(() => {
32139
+ const box = useRef43(null);
32140
+ const openedAt = useRef43(null);
32141
+ useEffect69(() => {
32091
32142
  if (!open) return;
32092
32143
  openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
32093
32144
  setTyped(name);
@@ -32178,7 +32229,7 @@ function TableRenameDialog({
32178
32229
  }
32179
32230
 
32180
32231
  // src/TableSettings.tsx
32181
- import { useEffect as useEffect73, useMemo as useMemo50, useRef as useRef43, useState as useState90 } from "react";
32232
+ import { useEffect as useEffect74, useMemo as useMemo50, useRef as useRef44, useState as useState90 } from "react";
32182
32233
  import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
32183
32234
 
32184
32235
  // src/ArchiveDeliberately.tsx
@@ -32304,7 +32355,7 @@ function announceTableArchived({ notify, client, tableId, name, onRestored }) {
32304
32355
  }
32305
32356
 
32306
32357
  // src/TableFoundation.tsx
32307
- import { useEffect as useEffect69, useState as useState86 } from "react";
32358
+ import { useEffect as useEffect70, useState as useState86 } from "react";
32308
32359
  import { tableShapeChanged as tableShapeChanged9, useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
32309
32360
  import { Switch as Switch3 } from "@ai-matrx/design-system";
32310
32361
  import { jsx as jsx106, jsxs as jsxs95 } from "react/jsx-runtime";
@@ -32317,7 +32368,7 @@ function TableFoundationSwitch({ tableId, table }) {
32317
32368
  const [pending, setPending] = useState86(null);
32318
32369
  const [refused, setRefused] = useState86(null);
32319
32370
  const on = pending ?? stored;
32320
- useEffect69(() => {
32371
+ useEffect70(() => {
32321
32372
  if (pending !== null && stored === pending) setPending(null);
32322
32373
  }, [stored, pending]);
32323
32374
  const change = async (next) => {
@@ -32355,7 +32406,7 @@ function TableFoundationSwitch({ tableId, table }) {
32355
32406
  }
32356
32407
 
32357
32408
  // src/TableAccessLevel.tsx
32358
- import { useCallback as useCallback36, useEffect as useEffect70, useMemo as useMemo48, useState as useState87 } from "react";
32409
+ import { useCallback as useCallback36, useEffect as useEffect71, useMemo as useMemo48, useState as useState87 } from "react";
32359
32410
  import { tableShapeChanged as tableShapeChanged10, useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
32360
32411
  import { Badge as Badge12, Button as Button64, Textarea as Textarea5, cn as cn51 } from "@ai-matrx/design-system";
32361
32412
  import { Fragment as Fragment38, jsx as jsx107, jsxs as jsxs96 } from "react/jsx-runtime";
@@ -32386,7 +32437,7 @@ function TableAccessLevel({ tableId, fields }) {
32386
32437
  setPicked(answer.data.readers.map((r) => r.field));
32387
32438
  setReason("");
32388
32439
  }, [client, tableId]);
32389
- useEffect70(() => {
32440
+ useEffect71(() => {
32390
32441
  void load();
32391
32442
  }, [load]);
32392
32443
  if (failed) return /* @__PURE__ */ jsx107("p", { className: "text-destructive", "data-table-access-level": "", children: failed });
@@ -32476,7 +32527,7 @@ function TableAccessLevel({ tableId, fields }) {
32476
32527
  }
32477
32528
 
32478
32529
  // src/RowControls.tsx
32479
- import { useCallback as useCallback37, useEffect as useEffect71, useState as useState88 } from "react";
32530
+ import { useCallback as useCallback37, useEffect as useEffect72, useState as useState88 } from "react";
32480
32531
  import {
32481
32532
  isShownTo,
32482
32533
  levelHasShownTo,
@@ -32536,7 +32587,7 @@ function NewRowsDefaults({ tableId }) {
32536
32587
  setError(null);
32537
32588
  } else setError(answer.error);
32538
32589
  }, [client, tableId]);
32539
- useEffect71(() => {
32590
+ useEffect72(() => {
32540
32591
  void read();
32541
32592
  }, [read]);
32542
32593
  const set = async (patch) => {
@@ -32619,7 +32670,7 @@ function RowShownTo({ recordId, tableId }) {
32619
32670
  setError(null);
32620
32671
  } else setError(answer.error);
32621
32672
  }, [client, recordId]);
32622
- useEffect71(() => {
32673
+ useEffect72(() => {
32623
32674
  setC(null);
32624
32675
  void read();
32625
32676
  }, [read]);
@@ -32655,7 +32706,7 @@ function RowShownTo({ recordId, tableId }) {
32655
32706
  }
32656
32707
 
32657
32708
  // src/ColumnsAtOnce.tsx
32658
- import { useEffect as useEffect72, useMemo as useMemo49, useState as useState89 } from "react";
32709
+ import { useEffect as useEffect73, useMemo as useMemo49, useState as useState89 } from "react";
32659
32710
  import { useFieldMutation as useFieldMutation3 } from "@ai-matrx/records/react";
32660
32711
  import { Badge as Badge13, BasicInput as BasicInput19, Button as Button66, Checkbox as Checkbox12, cn as cn52 } from "@ai-matrx/design-system";
32661
32712
  import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
@@ -32689,10 +32740,10 @@ function ColumnsAtOnce({
32689
32740
  const shape = useFieldMutation3();
32690
32741
  const savedSignature = JSON.stringify(rows.map((f) => [f.id, f.label, f.sort]));
32691
32742
  const [draft, setDraft] = useState89(() => draftOf3(rows));
32692
- useEffect72(() => setDraft(draftOf3(rows)), [savedSignature]);
32743
+ useEffect73(() => setDraft(draftOf3(rows)), [savedSignature]);
32693
32744
  const hiddenSignature = JSON.stringify(look?.hidden ?? []);
32694
32745
  const [hidden, setHidden] = useState89(() => [...look?.hidden ?? []]);
32695
- useEffect72(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
32746
+ useEffect73(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
32696
32747
  const [dragging, setDragging] = useState89(null);
32697
32748
  const [saving, setSaving] = useState89(false);
32698
32749
  const byId = useMemo49(() => new Map(rows.map((f) => [f.id, f])), [rows]);
@@ -32842,9 +32893,9 @@ function TableSettings(props) {
32842
32893
  const client = useRecordsClient60();
32843
32894
  const table = useTable16(props.tableId);
32844
32895
  const fields = useFields17(props.tableId);
32845
- const now = useRef43({ table: table.data ?? null, fields: fields.data ?? [] });
32896
+ const now = useRef44({ table: table.data ?? null, fields: fields.data ?? [] });
32846
32897
  now.current = { table: table.data ?? null, fields: fields.data ?? [] };
32847
- const slots = useRef43({ details: { current: null }, rowActions: { current: null } }).current;
32898
+ const slots = useRef44({ details: { current: null }, rowActions: { current: null } }).current;
32848
32899
  const agent = useMemo50(
32849
32900
  () => buildTableSettingsAgent(props.tableId, () => now.current, client, slots),
32850
32901
  [props.tableId, client, slots]
@@ -32868,7 +32919,7 @@ function TableSettingsPanel({
32868
32919
  const archive = useTableArchive(tableId);
32869
32920
  const client = useRecordsClient60();
32870
32921
  const ui = useRecordsUi();
32871
- useEffect73(() => {
32922
+ useEffect74(() => {
32872
32923
  let live = true;
32873
32924
  void archive.preview().then((answer) => {
32874
32925
  if (live && answer?.in_progress) setAskingToDelete(true);
@@ -32877,10 +32928,10 @@ function TableSettingsPanel({
32877
32928
  live = false;
32878
32929
  };
32879
32930
  }, [tableId]);
32880
- const askToArchiveRef = useRef43(null);
32881
- const archiveAskedSeen = useRef43(0);
32931
+ const askToArchiveRef = useRef44(null);
32932
+ const archiveAskedSeen = useRef44(0);
32882
32933
  const panelReady = Boolean(table.data && fields.data && rights.structure);
32883
- useEffect73(() => {
32934
+ useEffect74(() => {
32884
32935
  const ask2 = askToArchiveRef.current;
32885
32936
  if (!panelReady || !ask2 || archiveAsked <= archiveAskedSeen.current) return;
32886
32937
  archiveAskedSeen.current = archiveAsked;
@@ -33089,13 +33140,13 @@ function TableSettingsPanel({
33089
33140
  }
33090
33141
 
33091
33142
  // src/Peek.tsx
33092
- import { useEffect as useEffect77, useState as useState95 } from "react";
33143
+ import { useEffect as useEffect78, useState as useState95 } from "react";
33093
33144
  import { isLockedStub } from "@ai-matrx/records";
33094
33145
  import { useFields as useFields19, useRecord as useRecord3, useRecordsClient as useRecordsClient65, useTable as useTable19 } from "@ai-matrx/records/react";
33095
33146
  import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
33096
33147
 
33097
33148
  // src/RecordChat.tsx
33098
- import { useEffect as useEffect74, useMemo as useMemo51, useState as useState91 } from "react";
33149
+ import { useEffect as useEffect75, useMemo as useMemo51, useState as useState91 } from "react";
33099
33150
  import { useRecordsClient as useRecordsClient61 } from "@ai-matrx/records/react";
33100
33151
  import { Skeleton as Skeleton12, cn as cn54 } from "@ai-matrx/design-system";
33101
33152
  import { jsx as jsx111, jsxs as jsxs100 } from "react/jsx-runtime";
@@ -33105,7 +33156,7 @@ function RecordChat({ tableId, recordId, className }) {
33105
33156
  const host = useRecordsUi();
33106
33157
  const [scope, setScope] = useState91(null);
33107
33158
  const [error, setError] = useState91(null);
33108
- useEffect74(() => {
33159
+ useEffect75(() => {
33109
33160
  let cancelled = false;
33110
33161
  setScope(null);
33111
33162
  setError(null);
@@ -33222,7 +33273,7 @@ function entriesFor(scope) {
33222
33273
  import { Button as Button71, Separator as Separator9, Skeleton as Skeleton14, cn as cn56 } from "@ai-matrx/design-system";
33223
33274
 
33224
33275
  // src/recordInPlace.tsx
33225
- import { useMemo as useMemo52, useRef as useRef44 } from "react";
33276
+ import { useMemo as useMemo52, useRef as useRef45 } from "react";
33226
33277
  import { useRecordsClient as useRecordsClient62, useTable as useTable17 } from "@ai-matrx/records/react";
33227
33278
  import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
33228
33279
  import { jsx as jsx112, jsxs as jsxs101 } from "react/jsx-runtime";
@@ -33246,7 +33297,7 @@ function RecordFieldsInPlace({
33246
33297
  );
33247
33298
  const rows = useMemo52(() => [row], [row]);
33248
33299
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows);
33249
- const pushWritten = useRef44(null);
33300
+ const pushWritten = useRef45(null);
33250
33301
  const editing = useGridEditing({
33251
33302
  tableId,
33252
33303
  fields,
@@ -33419,7 +33470,7 @@ function ValueAlternates({
33419
33470
 
33420
33471
  // src/ShareControl.tsx
33421
33472
  import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
33422
- import { useEffect as useEffect75, useState as useState93 } from "react";
33473
+ import { useEffect as useEffect76, useState as useState93 } from "react";
33423
33474
  import { Button as Button69, Popover as Popover14, PopoverContent as PopoverContent14, PopoverTrigger as PopoverTrigger14 } from "@ai-matrx/design-system";
33424
33475
  import { Fragment as Fragment41, jsx as jsx114, jsxs as jsxs103 } from "react/jsx-runtime";
33425
33476
  function useCanShare() {
@@ -33442,7 +33493,7 @@ function ShareControl({
33442
33493
  }) {
33443
33494
  const host = useRecordsUi();
33444
33495
  const [open, setOpen] = useState93(initiallyOpen);
33445
- useEffect75(() => {
33496
+ useEffect76(() => {
33446
33497
  if (initiallyOpen) setOpen(true);
33447
33498
  }, [initiallyOpen]);
33448
33499
  const asked4 = useRecordRights(may === void 0 ? subjectId : null);
@@ -33506,7 +33557,7 @@ function ShareForSomebodyElse({
33506
33557
  }
33507
33558
 
33508
33559
  // src/RecordBody.tsx
33509
- import { useEffect as useEffect76, useRef as useRef45, useState as useState94 } from "react";
33560
+ import { useEffect as useEffect77, useRef as useRef46, useState as useState94 } from "react";
33510
33561
  import { Button as Button70, cn as cn55 } from "@ai-matrx/design-system";
33511
33562
  import { newerKindOf as newerKindOf6 } from "@ai-matrx/records";
33512
33563
  import { tableShapeChanged as tableShapeChanged12, useFieldMutation as useFieldMutation5, useFields as useFields18, useRecord as useRecord2, useRecordsClient as useRecordsClient64, useTable as useTable18 } from "@ai-matrx/records/react";
@@ -33543,9 +33594,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
33543
33594
  const raw = record.data?.document?.[field2.key];
33544
33595
  const stored = typeof raw === "string" ? raw : "";
33545
33596
  const [saving, setSaving] = useState94({ phase: "idle" });
33546
- const lastSaved = useRef45(null);
33547
- const waiting = useRef45(null);
33548
- const timer = useRef45(null);
33597
+ const lastSaved = useRef46(null);
33598
+ const waiting = useRef46(null);
33599
+ const timer = useRef46(null);
33549
33600
  if (lastSaved.current === null && record.data) lastSaved.current = stored;
33550
33601
  const write = async () => {
33551
33602
  if (timer.current) clearTimeout(timer.current);
@@ -33566,9 +33617,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
33566
33617
  setSaving({ phase: "refused", error: answered.error });
33567
33618
  }
33568
33619
  };
33569
- const writeRef = useRef45(write);
33620
+ const writeRef = useRef46(write);
33570
33621
  writeRef.current = write;
33571
- useEffect76(
33622
+ useEffect77(
33572
33623
  () => () => {
33573
33624
  if (waiting.current !== null) void writeRef.current();
33574
33625
  },
@@ -33632,7 +33683,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
33632
33683
  const shownFieldCount = (fields.data ?? []).filter(
33633
33684
  (field2) => !onPage || !drawnBelowOnPage(field2, onPage ? bodyFieldOf(fields.data ?? [])?.key : void 0)
33634
33685
  ).length;
33635
- useEffect77(() => {
33686
+ useEffect78(() => {
33636
33687
  if (fields.data) rememberRowCount(peekMemoryKey, shownFieldCount);
33637
33688
  }, [fields.data, peekMemoryKey, shownFieldCount]);
33638
33689
  if (record.error) return /* @__PURE__ */ jsx116(RefusalNotice, { error: record.error, className });
@@ -33771,7 +33822,7 @@ function computedInPlainWords(row, field2) {
33771
33822
  }
33772
33823
 
33773
33824
  // src/platformTable.ts
33774
- import { useEffect as useEffect78, useMemo as useMemo53, useState as useState96 } from "react";
33825
+ import { useEffect as useEffect79, useMemo as useMemo53, useState as useState96 } from "react";
33775
33826
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
33776
33827
  var inFlight = /* @__PURE__ */ new Map();
33777
33828
  async function ensurePlatformTable(client, spec) {
@@ -33904,7 +33955,7 @@ function usePlatformTable(spec) {
33904
33955
  const [state2, setState] = useState96({ tableId: null, loading: true, error: null });
33905
33956
  const slug = spec.slug;
33906
33957
  const stable = useMemo53(() => spec, [slug]);
33907
- useEffect78(() => {
33958
+ useEffect79(() => {
33908
33959
  let cancelled = false;
33909
33960
  setState({ tableId: null, loading: true, error: null });
33910
33961
  void ensurePlatformTable(client, stable).then((result) => {
@@ -33951,7 +34002,7 @@ function lookAfterReset(look) {
33951
34002
  }
33952
34003
 
33953
34004
  // src/ViewSwitcher.tsx
33954
- import { useEffect as useEffect90, useMemo as useMemo63, useState as useState108 } from "react";
34005
+ import { useEffect as useEffect91, useMemo as useMemo63, useState as useState108 } from "react";
33955
34006
  import { mayDrag as mayDrag4, useFields as useFields21, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient71, useTable as useTable21 } from "@ai-matrx/records/react";
33956
34007
  import { isButtonField as isButtonField5, newerKindOf as newerKindOf7, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
33957
34008
  import { Button as Button77, Select as Select19, SelectContent as SelectContent17, SelectItem as SelectItem17, SelectTrigger as SelectTrigger17, SelectValue as SelectValue17, cn as cn63 } from "@ai-matrx/design-system";
@@ -33965,7 +34016,7 @@ import {
33965
34016
  import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
33966
34017
 
33967
34018
  // src/recordMoves.tsx
33968
- import { useCallback as useCallback38, useEffect as useEffect79, useMemo as useMemo54, useRef as useRef46, useState as useState97 } from "react";
34019
+ import { useCallback as useCallback38, useEffect as useEffect80, useMemo as useMemo54, useRef as useRef47, useState as useState97 } from "react";
33969
34020
  import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
33970
34021
  import { Button as Button72 } from "@ai-matrx/design-system";
33971
34022
  import { Fragment as Fragment44, jsx as jsx117, jsxs as jsxs106 } from "react/jsx-runtime";
@@ -34091,9 +34142,9 @@ function useRecordMoves({
34091
34142
  [client, undo, onMoved, preset]
34092
34143
  );
34093
34144
  const offering = Boolean(undo.notice);
34094
- const undoRef = useRef46(undo);
34145
+ const undoRef = useRef47(undo);
34095
34146
  undoRef.current = undo;
34096
- useEffect79(() => {
34147
+ useEffect80(() => {
34097
34148
  if (!offering || typeof document === "undefined") return;
34098
34149
  const onKey = (event) => {
34099
34150
  const which = undoKey(event);
@@ -34159,7 +34210,7 @@ function MoveRefusedBadge({ refused }) {
34159
34210
  }
34160
34211
 
34161
34212
  // src/Pipeline.tsx
34162
- import { useCallback as useCallback39, useEffect as useEffect80, useMemo as useMemo55, useRef as useRef47, useState as useState98 } from "react";
34213
+ import { useCallback as useCallback39, useEffect as useEffect81, useMemo as useMemo55, useRef as useRef48, useState as useState98 } from "react";
34163
34214
  import {
34164
34215
  mayDrag,
34165
34216
  useFields as useFields20,
@@ -34272,14 +34323,14 @@ function PipelineBoard({
34272
34323
  const [waiting, setWaiting] = useState98(/* @__PURE__ */ new Map());
34273
34324
  const [dragging, setDragging] = useState98(null);
34274
34325
  const [over, setOver] = useState98(null);
34275
- const alive = useRef47(true);
34326
+ const alive = useRef48(true);
34276
34327
  const [selected, setSelected] = useState98(/* @__PURE__ */ new Set());
34277
- const anchor = useRef47(null);
34328
+ const anchor = useRef48(null);
34278
34329
  const [batch, setBatch] = useState98(/* @__PURE__ */ new Map());
34279
34330
  const [batchSaid, setBatchSaid] = useState98(null);
34280
34331
  const [batchError, setBatchError] = useState98(null);
34281
34332
  const [moving, setMoving] = useState98(false);
34282
- useEffect80(() => {
34333
+ useEffect81(() => {
34283
34334
  alive.current = true;
34284
34335
  return () => {
34285
34336
  alive.current = false;
@@ -34304,11 +34355,11 @@ function PipelineBoard({
34304
34355
  setWaiting(held.ok ? new Map((held.data ?? []).map((p) => [p.record_id, p])) : /* @__PURE__ */ new Map());
34305
34356
  setColumns(board.ok ? board.data ?? [] : []);
34306
34357
  }, [client, tableId, measure, filterKey]);
34307
- useEffect80(() => {
34358
+ useEffect81(() => {
34308
34359
  void reload();
34309
34360
  }, [reload]);
34310
34361
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
34311
- const versionsRef = useRef47(versions);
34362
+ const versionsRef = useRef48(versions);
34312
34363
  versionsRef.current = versions;
34313
34364
  const drawnVersion = (id) => versionsRef.current.seen(id);
34314
34365
  const stageKey = definition?.stage_field ?? null;
@@ -34964,13 +35015,13 @@ function CardFieldsInline({ row, fields }) {
34964
35015
  }
34965
35016
 
34966
35017
  // src/CalendarView.tsx
34967
- import { useEffect as useEffect82, useMemo as useMemo57, useRef as useRef48, useState as useState100 } from "react";
35018
+ import { useEffect as useEffect83, useMemo as useMemo57, useRef as useRef49, useState as useState100 } from "react";
34968
35019
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
34969
35020
  import { Button as Button74, Select as Select15, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn58 } from "@ai-matrx/design-system";
34970
35021
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
34971
35022
 
34972
35023
  // src/weekStart.ts
34973
- import { useEffect as useEffect81, useState as useState99 } from "react";
35024
+ import { useEffect as useEffect82, useState as useState99 } from "react";
34974
35025
  import { useOptionalRecordsClient as useOptionalRecordsClient16 } from "@ai-matrx/records/react";
34975
35026
  var DAYS2 = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
34976
35027
  function weekStartIndex(word) {
@@ -34992,7 +35043,7 @@ function ask(client) {
34992
35043
  function useReaderWeekStart() {
34993
35044
  const client = useOptionalRecordsClient16();
34994
35045
  const [first, setFirst] = useState99(1);
34995
- useEffect81(() => {
35046
+ useEffect82(() => {
34996
35047
  if (!client) return;
34997
35048
  let live = true;
34998
35049
  void ask(client).then((n) => live && setFirst(n));
@@ -35228,7 +35279,7 @@ function useNarrow() {
35228
35279
  const query = "(max-width: 639px)";
35229
35280
  const read = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
35230
35281
  const [narrow, setNarrow] = useState100(read);
35231
- useEffect82(() => {
35282
+ useEffect83(() => {
35232
35283
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
35233
35284
  const list = window.matchMedia(query);
35234
35285
  const on = () => setNarrow(list.matches);
@@ -35299,9 +35350,9 @@ function CalendarView({
35299
35350
  const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
35300
35351
  const colorOf = useRowColorBy(all, colorKey, style);
35301
35352
  const [placedOver, setPlacedOver] = useState100(() => /* @__PURE__ */ new Map());
35302
- useEffect82(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
35353
+ useEffect83(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
35303
35354
  const undoneCount = moves.undo.depth.forward;
35304
- useEffect82(() => {
35355
+ useEffect83(() => {
35305
35356
  if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
35306
35357
  }, [undoneCount]);
35307
35358
  const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
@@ -35328,9 +35379,9 @@ function CalendarView({
35328
35379
  }, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
35329
35380
  const titleOf = (row) => cardWords(row, titleField, labels).text;
35330
35381
  const rowById = (id) => rows.find((r) => r.id === id);
35331
- const frame = useRef48(null);
35382
+ const frame = useRef49(null);
35332
35383
  const [focusOn, setFocusOn] = useState100(null);
35333
- useEffect82(() => {
35384
+ useEffect83(() => {
35334
35385
  if (!focusOn) return;
35335
35386
  const button = frame.current?.querySelector(`[data-calendar-card="${focusOn}"] button`);
35336
35387
  button?.focus({ preventScroll: true });
@@ -35377,10 +35428,10 @@ function CalendarView({
35377
35428
  const made = await moves.create({ tableId, data, label: `New record on ${where}` });
35378
35429
  if (made) onOpenRecord?.(made);
35379
35430
  };
35380
- const grabOffset = useRef48(0);
35431
+ const grabOffset = useRef49(0);
35381
35432
  const [resizing, setResizing] = useState100(null);
35382
35433
  const [ghost, setGhost] = useState100(null);
35383
- useEffect82(() => {
35434
+ useEffect83(() => {
35384
35435
  if (!ghost || typeof document === "undefined") return;
35385
35436
  const clear = () => setGhost(null);
35386
35437
  document.addEventListener("dragend", clear);
@@ -35927,13 +35978,13 @@ function WeekHours({
35927
35978
  render,
35928
35979
  overlay
35929
35980
  }) {
35930
- const frame = useRef48(null);
35931
- useEffect82(() => {
35981
+ const frame = useRef49(null);
35982
+ useEffect83(() => {
35932
35983
  if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
35933
35984
  }, []);
35934
35985
  usePersonTimeZone();
35935
35986
  const [now, setNow] = useState100(() => personWallNow());
35936
- useEffect82(() => {
35987
+ useEffect83(() => {
35937
35988
  const timer = setInterval(() => setNow(personWallNow()), 6e4);
35938
35989
  return () => clearInterval(timer);
35939
35990
  }, []);
@@ -35975,7 +36026,7 @@ function weekHeading(first) {
35975
36026
  }
35976
36027
 
35977
36028
  // src/TimelineView.tsx
35978
- import { useEffect as useEffect83, useMemo as useMemo58, useRef as useRef49, useState as useState101 } from "react";
36029
+ import { useEffect as useEffect84, useMemo as useMemo58, useRef as useRef50, useState as useState101 } from "react";
35979
36030
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
35980
36031
  import { DropdownMenu as DropdownMenu8, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent8, DropdownMenuItem as DropdownMenuItem7, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator4, DropdownMenuSub as DropdownMenuSub2, DropdownMenuSubContent as DropdownMenuSubContent2, DropdownMenuSubTrigger as DropdownMenuSubTrigger2, DropdownMenuTrigger as DropdownMenuTrigger8, Button as Button75, Select as Select16, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn59 } from "@ai-matrx/design-system";
35981
36032
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS4 } from "@ai-matrx/design-system/data-table";
@@ -36240,7 +36291,7 @@ function TimelineView({
36240
36291
  const dates = useMemo58(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
36241
36292
  const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
36242
36293
  const [picked, setPicked] = useState101({});
36243
- useEffect83(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
36294
+ useEffect84(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
36244
36295
  const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
36245
36296
  const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
36246
36297
  const endCandidates = useMemo58(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
@@ -36261,7 +36312,7 @@ function TimelineView({
36261
36312
  };
36262
36313
  const [ganttPicked, setGanttPicked] = useState101({});
36263
36314
  const ganttSaved = JSON.stringify(gantt ?? {});
36264
- useEffect83(() => setGanttPicked({}), [ganttSaved]);
36315
+ useEffect84(() => setGanttPicked({}), [ganttSaved]);
36265
36316
  const g = { ...gantt ?? {}, ...ganttPicked };
36266
36317
  const ganttOn = g.mode === true;
36267
36318
  const setGantt = (patch) => {
@@ -36285,7 +36336,7 @@ function TimelineView({
36285
36336
  const milestoneCandidates = useMemo58(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
36286
36337
  const knobClient = useOptionalRecordsClient17();
36287
36338
  const [shiftDependents, setShiftDependents] = useState101(true);
36288
- useEffect83(() => {
36339
+ useEffect84(() => {
36289
36340
  if (!depField || !knobClient) return;
36290
36341
  let live = true;
36291
36342
  void knobClient.timelineDependencyShift().then((got) => {
@@ -36301,9 +36352,9 @@ function TimelineView({
36301
36352
  const titleOf = (row) => cardWords(row, titleField, labels).text;
36302
36353
  const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
36303
36354
  const [placedOver, setPlacedOver] = useState101(() => /* @__PURE__ */ new Map());
36304
- useEffect83(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
36355
+ useEffect84(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
36305
36356
  const undoneCount = moves.undo.depth.forward;
36306
- useEffect83(() => {
36357
+ useEffect84(() => {
36307
36358
  if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
36308
36359
  }, [undoneCount]);
36309
36360
  const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : startField ? (row.document ?? {})[startField.key] : null;
@@ -36566,11 +36617,11 @@ function TimelineView({
36566
36617
  const width = days * px;
36567
36618
  const scale = useMemo58(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
36568
36619
  const xOf = (day2) => daysBetween(from, day2) * px;
36569
- const scroller = useRef49(null);
36620
+ const scroller = useRef50(null);
36570
36621
  const grouped = Boolean(groupField) && !ganttOn;
36571
36622
  const hasLabel = grouped || ganttOn;
36572
36623
  const [scrollX, setScrollX] = useState101(0);
36573
- const frame = useRef49(null);
36624
+ const frame = useRef50(null);
36574
36625
  const onScroll = () => {
36575
36626
  if (frame.current !== null) return;
36576
36627
  frame.current = requestAnimationFrame(() => {
@@ -36578,7 +36629,7 @@ function TimelineView({
36578
36629
  setScrollX(scroller.current?.scrollLeft ?? 0);
36579
36630
  });
36580
36631
  };
36581
- useEffect83(() => {
36632
+ useEffect84(() => {
36582
36633
  const el = scroller.current;
36583
36634
  if (!el) return;
36584
36635
  const label = el.querySelector("[data-timeline-label]")?.offsetWidth ?? 0;
@@ -37105,7 +37156,7 @@ function TimelineView({
37105
37156
  }
37106
37157
 
37107
37158
  // src/ViewNeeds.tsx
37108
- import { useEffect as useEffect84, useState as useState102 } from "react";
37159
+ import { useEffect as useEffect85, useState as useState102 } from "react";
37109
37160
  import { useFieldMutation as useFieldMutation6, useRecordsClient as useRecordsClient69, useTable as useTable20 } from "@ai-matrx/records/react";
37110
37161
  import { BasicInput as BasicInput20, Button as Button76, Label as Label19 } from "@ai-matrx/design-system";
37111
37162
  import { jsx as jsx123, jsxs as jsxs112 } from "react/jsx-runtime";
@@ -37126,7 +37177,7 @@ function useAskedColumnLands(layout, tableId, fields, chosen, offerable, onMade)
37126
37177
  const wanted = askedFor.get(askKey(tableId, layout));
37127
37178
  const landed = wanted && !chosen ? offerable(fields).find((f) => fieldName(f).trim().toLowerCase() === wanted.trim().toLowerCase()) : void 0;
37128
37179
  const key = landed?.key ?? null;
37129
- useEffect84(() => {
37180
+ useEffect85(() => {
37130
37181
  if (!key) return;
37131
37182
  askedFor.delete(askKey(tableId, layout));
37132
37183
  onMade(key);
@@ -37238,7 +37289,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
37238
37289
  }
37239
37290
 
37240
37291
  // src/GalleryCover.tsx
37241
- import { useEffect as useEffect85, useState as useState103 } from "react";
37292
+ import { useEffect as useEffect86, useState as useState103 } from "react";
37242
37293
  import { useOptionalRecordsClient as useOptionalRecordsClient18 } from "@ai-matrx/records/react";
37243
37294
  import { Fragment as Fragment48, jsx as jsx124 } from "react/jsx-runtime";
37244
37295
  function isImageAddress(value) {
@@ -37260,7 +37311,7 @@ function FileCover({ recordId }) {
37260
37311
  const client = useOptionalRecordsClient18();
37261
37312
  const host = useRecordsUi();
37262
37313
  const [read, setRead] = useState103(null);
37263
- useEffect85(() => {
37314
+ useEffect86(() => {
37264
37315
  let cancelled = false;
37265
37316
  if (!client) {
37266
37317
  setRead({ fileId: recordId, name: "" });
@@ -37658,7 +37709,7 @@ function ListRow({
37658
37709
  }
37659
37710
 
37660
37711
  // src/ChartLayout.tsx
37661
- import { useEffect as useEffect89, useMemo as useMemo62, useState as useState107 } from "react";
37712
+ import { useEffect as useEffect90, useMemo as useMemo62, useState as useState107 } from "react";
37662
37713
  import { useRecordsClient as useRecordsClient70 } from "@ai-matrx/records/react";
37663
37714
  import { fieldKindFor as fieldKindFor2, measureKey as measureKey4 } from "@ai-matrx/records";
37664
37715
  import { Select as Select18, SelectContent as SelectContent16, SelectItem as SelectItem16, SelectTrigger as SelectTrigger16, SelectValue as SelectValue16 } from "@ai-matrx/design-system";
@@ -37688,7 +37739,7 @@ import { cn as cn62 } from "@ai-matrx/design-system";
37688
37739
  import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
37689
37740
 
37690
37741
  // src/linkWords.ts
37691
- import { useEffect as useEffect86, useMemo as useMemo60, useState as useState104 } from "react";
37742
+ import { useEffect as useEffect87, useMemo as useMemo60, useState as useState104 } from "react";
37692
37743
  import { useOptionalRecordsClient as useOptionalRecordsClient19 } from "@ai-matrx/records/react";
37693
37744
 
37694
37745
  // src/charts.ts
@@ -37906,7 +37957,7 @@ function useLinkGroupNamer(block, tableId) {
37906
37957
  const [named, setNamed] = useState104({});
37907
37958
  const [choices, setChoices] = useState104([]);
37908
37959
  const labels = useRecordLabels(choices);
37909
- useEffect86(() => {
37960
+ useEffect87(() => {
37910
37961
  if (!client || groupBy.length === 0 || rows.length === 0) return;
37911
37962
  let cancelled = false;
37912
37963
  void (async () => {
@@ -37949,7 +38000,7 @@ function useLinkGroupNamer(block, tableId) {
37949
38000
  }
37950
38001
 
37951
38002
  // src/measureWords.ts
37952
- import { useEffect as useEffect87, useState as useState105 } from "react";
38003
+ import { useEffect as useEffect88, useState as useState105 } from "react";
37953
38004
  import { useOptionalRecordsClient as useOptionalRecordsClient20 } from "@ai-matrx/records/react";
37954
38005
  import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
37955
38006
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
@@ -37968,7 +38019,7 @@ function useMeasureWords(key, tableId) {
37968
38019
  const client = useOptionalRecordsClient20();
37969
38020
  const [fields, setFields] = useState105(null);
37970
38021
  const needs = key !== "count";
37971
- useEffect87(() => {
38022
+ useEffect88(() => {
37972
38023
  if (!client || !tableId || !needs) return;
37973
38024
  let cancelled = false;
37974
38025
  void client.fields({ table_id: tableId }).then((result) => {
@@ -37983,17 +38034,17 @@ function useMeasureWords(key, tableId) {
37983
38034
 
37984
38035
  // src/chartFrame.tsx
37985
38036
  import {
37986
- useEffect as useEffect88,
38037
+ useEffect as useEffect89,
37987
38038
  useId as useId4,
37988
- useRef as useRef50,
38039
+ useRef as useRef51,
37989
38040
  useState as useState106
37990
38041
  } from "react";
37991
38042
  import { cn as cn61 } from "@ai-matrx/design-system";
37992
38043
  import { jsx as jsx127, jsxs as jsxs115 } from "react/jsx-runtime";
37993
38044
  function useMeasuredWidth(fallback = 480) {
37994
- const ref = useRef50(null);
38045
+ const ref = useRef51(null);
37995
38046
  const [width, setWidth] = useState106(fallback);
37996
- useEffect88(() => {
38047
+ useEffect89(() => {
37997
38048
  const node = ref.current;
37998
38049
  if (!node) return;
37999
38050
  const apply = () => {
@@ -38631,7 +38682,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
38631
38682
  const [state2, setState] = useState107({ block: null, error: null });
38632
38683
  const filterKey = JSON.stringify(filter ?? {});
38633
38684
  const qKey = JSON.stringify(q);
38634
- useEffect89(() => {
38685
+ useEffect90(() => {
38635
38686
  let cancelled = false;
38636
38687
  const asked4 = JSON.parse(filterKey);
38637
38688
  const question = JSON.parse(qKey);
@@ -38707,7 +38758,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
38707
38758
  const client = useRecordsClient71();
38708
38759
  const [limit, setLimit] = useState108(pageSize);
38709
38760
  const questionKey = `${view.subject}|${stableFilterKey4(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
38710
- useEffect90(() => {
38761
+ useEffect91(() => {
38711
38762
  setLimit(pageSize);
38712
38763
  }, [questionKey, pageSize]);
38713
38764
  const storeSort = useMemo63(
@@ -38725,7 +38776,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
38725
38776
  error: null
38726
38777
  });
38727
38778
  const ruleId = view.ruleId ?? null;
38728
- useEffect90(() => {
38779
+ useEffect91(() => {
38729
38780
  if (!ruleId) return;
38730
38781
  let cancelled = false;
38731
38782
  setRuled({ rows: [], loading: true, error: null });
@@ -38851,7 +38902,7 @@ function ViewSwitcherBody({
38851
38902
  setSeenSignature(viewSignature);
38852
38903
  if (Object.keys(local).length > 0) setLocal({});
38853
38904
  }
38854
- useEffect90(() => {
38905
+ useEffect91(() => {
38855
38906
  setLayout(view.layout);
38856
38907
  setLocal({});
38857
38908
  }, [view.layout, view.name, view.subject]);
@@ -38950,7 +39001,7 @@ function useFarFields(all) {
38950
39001
  const client = useRecordsClient71();
38951
39002
  const targets = lookupTargets(all).sort().join(",");
38952
39003
  const [far, setFar] = useState108(() => /* @__PURE__ */ new Map());
38953
- useEffect90(() => {
39004
+ useEffect91(() => {
38954
39005
  let cancelled = false;
38955
39006
  const ids = targets ? targets.split(",") : [];
38956
39007
  if (ids.length === 0) {
@@ -38989,7 +39040,7 @@ function useStageField(tableId) {
38989
39040
  asked: false,
38990
39041
  key: null
38991
39042
  });
38992
- useEffect90(() => {
39043
+ useEffect91(() => {
38993
39044
  let cancelled = false;
38994
39045
  setStage({ asked: false, key: null });
38995
39046
  void client.tableStageField({ table_id: tableId }).then((r) => {
@@ -39883,7 +39934,7 @@ function boardDefaultGroupField(eligible) {
39883
39934
  }
39884
39935
 
39885
39936
  // src/ArchivedView.tsx
39886
- import { useCallback as useCallback40, useEffect as useEffect91, useState as useState109 } from "react";
39937
+ import { useCallback as useCallback40, useEffect as useEffect92, useState as useState109 } from "react";
39887
39938
  import {
39888
39939
  ARCHIVE_LANES,
39889
39940
  ARCHIVE_LANE_LABEL,
@@ -39921,7 +39972,7 @@ function ArchivedView({
39921
39972
  const [error, setError] = useState109(null);
39922
39973
  const [restoring, setRestoring] = useState109(null);
39923
39974
  const [refusal3, setRefusal] = useState109(null);
39924
- useEffect91(() => {
39975
+ useEffect92(() => {
39925
39976
  if (laneFromHost) setLane(laneFromHost);
39926
39977
  }, [laneFromHost]);
39927
39978
  const read = useCallback40(async () => {
@@ -39936,7 +39987,7 @@ function ArchivedView({
39936
39987
  }
39937
39988
  setLoading(false);
39938
39989
  }, [client, tableId, lane, pageSize]);
39939
- useEffect91(() => {
39990
+ useEffect92(() => {
39940
39991
  void read();
39941
39992
  }, [read]);
39942
39993
  const pick = (next) => {
@@ -40037,7 +40088,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
40037
40088
  setError(answer.error);
40038
40089
  }
40039
40090
  }, [client, tableId]);
40040
- useEffect91(() => {
40091
+ useEffect92(() => {
40041
40092
  void read();
40042
40093
  }, [read]);
40043
40094
  const restore = async (fieldId) => {
@@ -40082,7 +40133,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
40082
40133
  }
40083
40134
 
40084
40135
  // src/ArchivedDisclosure.tsx
40085
- import { useCallback as useCallback41, useEffect as useEffect92, useState as useState110 } from "react";
40136
+ import { useCallback as useCallback41, useEffect as useEffect93, useState as useState110 } from "react";
40086
40137
  import {
40087
40138
  emptyPortalArchiveLine,
40088
40139
  portalConfirmLine,
@@ -40151,7 +40202,7 @@ function ArchivedPortals({
40151
40202
  setError(answered.error);
40152
40203
  }
40153
40204
  }, [client]);
40154
- useEffect92(() => {
40205
+ useEffect93(() => {
40155
40206
  void read();
40156
40207
  }, [read, refreshToken]);
40157
40208
  const restore = async (portal) => {
@@ -40267,7 +40318,7 @@ function ArchivedPortals({
40267
40318
  }
40268
40319
 
40269
40320
  // src/ViewBar.tsx
40270
- import { useCallback as useCallback43, useEffect as useEffect93, useRef as useRef52, useState as useState111 } from "react";
40321
+ import { useCallback as useCallback43, useEffect as useEffect94, useRef as useRef53, useState as useState111 } from "react";
40271
40322
  import { useRecordsClient as useRecordsClient74 } from "@ai-matrx/records/react";
40272
40323
  import { Badge as Badge15, Button as Button80, Input as Input7, Popover as Popover16, PopoverContent as PopoverContent16, PopoverTrigger as PopoverTrigger16, Skeleton as Skeleton18, cn as cn66 } from "@ai-matrx/design-system";
40273
40324
  import { Button as ControlButton, Switch as Switch5, Tile as Tile2 } from "@ai-matrx/design-system/controls";
@@ -40276,9 +40327,9 @@ import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-
40276
40327
  import { CSS as CSS2 } from "@dnd-kit/utilities";
40277
40328
 
40278
40329
  // src/seedOnce.ts
40279
- import { useCallback as useCallback42, useRef as useRef51 } from "react";
40330
+ import { useCallback as useCallback42, useRef as useRef52 } from "react";
40280
40331
  function useSeedGuard() {
40281
- const claimed = useRef51(/* @__PURE__ */ new Set());
40332
+ const claimed = useRef52(/* @__PURE__ */ new Set());
40282
40333
  return useCallback42((name) => {
40283
40334
  if (claimed.current.has(name)) return false;
40284
40335
  claimed.current.add(name);
@@ -40393,8 +40444,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
40393
40444
  if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
40394
40445
  return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
40395
40446
  });
40396
- const readOnMount = useRef52(initialViews === void 0);
40397
- const pendingPick = useRef52(null);
40447
+ const readOnMount = useRef53(initialViews === void 0);
40448
+ const pendingPick = useRef53(null);
40398
40449
  const [naming, setNaming] = useState111(false);
40399
40450
  const [draftName, setDraftName] = useState111("");
40400
40451
  const [open, setOpen] = useState111(false);
@@ -40414,7 +40465,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
40414
40465
  });
40415
40466
  const [renamingSection, setRenamingSection] = useState111(null);
40416
40467
  const [dragging, setDragging] = useState111(false);
40417
- const justDragged = useRef52(false);
40468
+ const justDragged = useRef53(false);
40418
40469
  const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
40419
40470
  async function dropped(event) {
40420
40471
  setDragging(false);
@@ -40492,14 +40543,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
40492
40543
  setViews(mine);
40493
40544
  onViews?.(mine);
40494
40545
  }, [client, readViews, tableId, seedKey, tableThere]);
40495
- useEffect93(() => {
40546
+ useEffect94(() => {
40496
40547
  if (!readOnMount.current) {
40497
40548
  readOnMount.current = true;
40498
40549
  return;
40499
40550
  }
40500
40551
  void load();
40501
40552
  }, [load]);
40502
- useEffect93(() => {
40553
+ useEffect94(() => {
40503
40554
  if (!views || views.length === 0) return;
40504
40555
  const wanted = pendingPick.current;
40505
40556
  pendingPick.current = null;
@@ -40877,7 +40928,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
40877
40928
  }
40878
40929
 
40879
40930
  // src/ProposalRow.tsx
40880
- import { useEffect as useEffect94, useRef as useRef53, useState as useState112 } from "react";
40931
+ import { useEffect as useEffect95, useRef as useRef54, useState as useState112 } from "react";
40881
40932
  import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
40882
40933
  import { Badge as Badge16, Button as Button81, cn as cn67 } from "@ai-matrx/design-system";
40883
40934
  import { jsx as jsx134, jsxs as jsxs122 } from "react/jsx-runtime";
@@ -40895,9 +40946,9 @@ function ProposalRow({
40895
40946
  const [settled, setSettled] = useState112(outcome ?? null);
40896
40947
  const [busy, setBusy] = useState112(false);
40897
40948
  const [confirming, setConfirming] = useState112(false);
40898
- const drawnVersion = useRef53(null);
40949
+ const drawnVersion = useRef54(null);
40899
40950
  const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
40900
- useEffect94(() => {
40951
+ useEffect95(() => {
40901
40952
  if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
40902
40953
  }, [needsVersion, change.record, client]);
40903
40954
  async function applyThroughTheStore() {
@@ -40985,14 +41036,14 @@ function ProposalRow({
40985
41036
  }
40986
41037
 
40987
41038
  // src/ActionInbox.tsx
40988
- import { useCallback as useCallback45, useEffect as useEffect96, useMemo as useMemo65, useRef as useRef54, useState as useState114 } from "react";
41039
+ import { useCallback as useCallback45, useEffect as useEffect97, useMemo as useMemo65, useRef as useRef55, useState as useState114 } from "react";
40989
41040
  import { useRecordsClient as useRecordsClient77 } from "@ai-matrx/records/react";
40990
41041
  import { Badge as Badge18, Button as Button83, Checkbox as Checkbox13, Skeleton as Skeleton20, cn as cn69 } from "@ai-matrx/design-system";
40991
41042
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
40992
41043
  import { formatAbsoluteDate, formatDurationMs } from "@ai-matrx/kit/format";
40993
41044
 
40994
41045
  // src/ChecklistRunner.tsx
40995
- import { useCallback as useCallback44, useEffect as useEffect95, useMemo as useMemo64, useState as useState113 } from "react";
41046
+ import { useCallback as useCallback44, useEffect as useEffect96, useMemo as useMemo64, useState as useState113 } from "react";
40996
41047
  import { useRecordsClient as useRecordsClient76, useTable as useTable24 } from "@ai-matrx/records/react";
40997
41048
  import { Badge as Badge17, BasicInput as BasicInput22, BasicTextarea as BasicTextarea9, Button as Button82, Skeleton as Skeleton19, cn as cn68 } from "@ai-matrx/design-system";
40998
41049
  import { Select as Select20 } from "@ai-matrx/design-system/controls";
@@ -41043,10 +41094,10 @@ function ChecklistRunner({
41043
41094
  (held) => held && answered.data.some((r) => r.run_id === held) ? held : answered.data[0]?.run_id ?? null
41044
41095
  );
41045
41096
  }, [client, includeClosed, recordId, runId, tableId]);
41046
- useEffect95(() => {
41097
+ useEffect96(() => {
41047
41098
  void loadRuns();
41048
41099
  }, [loadRuns]);
41049
- useEffect95(() => {
41100
+ useEffect96(() => {
41050
41101
  if (runId) setActiveId(runId);
41051
41102
  }, [runId]);
41052
41103
  const loadSteps = useCallback44(async () => {
@@ -41063,10 +41114,10 @@ function ChecklistRunner({
41063
41114
  setError(null);
41064
41115
  setSteps(answered.data);
41065
41116
  }, [client, activeId]);
41066
- useEffect95(() => {
41117
+ useEffect96(() => {
41067
41118
  void loadSteps();
41068
41119
  }, [loadSteps]);
41069
- useEffect95(() => {
41120
+ useEffect96(() => {
41070
41121
  if (!mayStart || !tableId) return;
41071
41122
  let cancelled = false;
41072
41123
  void client.checklistTemplates({ about_table_id: tableId, limit: 50 }).then((answered) => {
@@ -41197,7 +41248,7 @@ function StepRow({
41197
41248
  const host = useRecordsUi();
41198
41249
  const [members, setMembers] = useState113(null);
41199
41250
  const unassigned = !step2.finished && !step2.assignee_user_id && Boolean(step2.role);
41200
- useEffect95(() => {
41251
+ useEffect96(() => {
41201
41252
  if (!unassigned || !onAssign || !host.members || members !== null) return;
41202
41253
  let alive = true;
41203
41254
  void host.members().then((roster) => {
@@ -41331,7 +41382,7 @@ function useMyChecklistSteps(limit = 25) {
41331
41382
  setSteps(held);
41332
41383
  setLoading(false);
41333
41384
  }, [client, limit, me]);
41334
- useEffect95(() => {
41385
+ useEffect96(() => {
41335
41386
  void refresh();
41336
41387
  }, [refresh]);
41337
41388
  return { steps, loading, error, refresh };
@@ -41344,7 +41395,7 @@ function MyChecklistSteps({
41344
41395
  }) {
41345
41396
  const client = useRecordsClient76();
41346
41397
  const { steps: held, loading, error, refresh } = useMyChecklistSteps();
41347
- useEffect95(() => {
41398
+ useEffect96(() => {
41348
41399
  onSteps?.(held.map((s) => s.step_id));
41349
41400
  }, [held, onSteps]);
41350
41401
  const steps = onlyIds ? held.filter((s) => onlyIds.has(s.step_id)) : held;
@@ -41413,7 +41464,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
41413
41464
  if (!r.ok) setRuns([]);
41414
41465
  else setRuns(r.data);
41415
41466
  }, [client, tableId]);
41416
- useEffect95(() => {
41467
+ useEffect96(() => {
41417
41468
  void load();
41418
41469
  }, [load]);
41419
41470
  if (templates === null) return /* @__PURE__ */ jsx135(Skeleton19, { className: cn68("h-40 w-full", className) });
@@ -41576,7 +41627,7 @@ function ChecklistTemplateEditor({
41576
41627
  const [error, setError] = useState113(null);
41577
41628
  const [busy, setBusy] = useState113(false);
41578
41629
  const [loading, setLoading] = useState113(Boolean(templateId));
41579
- useEffect95(() => {
41630
+ useEffect96(() => {
41580
41631
  if (!templateId) return;
41581
41632
  let cancelled = false;
41582
41633
  void client.checklistTemplateShape({ template_id: templateId }).then((answered) => {
@@ -41613,8 +41664,8 @@ function ChecklistTemplateEditor({
41613
41664
  }),
41614
41665
  [aboutTableId, name, rows]
41615
41666
  );
41616
- useEffect95(() => setSaved(false), [spec]);
41617
- useEffect95(() => {
41667
+ useEffect96(() => setSaved(false), [spec]);
41668
+ useEffect96(() => {
41618
41669
  if (spec.steps.length === 0 || spec.name.length === 0) {
41619
41670
  setRefusal(null);
41620
41671
  return;
@@ -41883,9 +41934,9 @@ function ActionInbox({
41883
41934
  const [outcome, setOutcome] = useState114({});
41884
41935
  const [busy, setBusy] = useState114(null);
41885
41936
  const [cursor, setCursor] = useState114(0);
41886
- const listRef = useRef54(null);
41937
+ const listRef = useRef55(null);
41887
41938
  const [selected, setSelected] = useState114(/* @__PURE__ */ new Set());
41888
- const anchor = useRef54(null);
41939
+ const anchor = useRef55(null);
41889
41940
  const [deciding, setDeciding] = useState114(false);
41890
41941
  const [batchSaid, setBatchSaid] = useState114(null);
41891
41942
  const [view, setView] = useState114("inbox");
@@ -41909,7 +41960,7 @@ function ActionInbox({
41909
41960
  setError(null);
41910
41961
  setItems(result.data);
41911
41962
  }, [client, showDecided, view]);
41912
- useEffect96(() => {
41963
+ useEffect97(() => {
41913
41964
  void load();
41914
41965
  }, [load]);
41915
41966
  const narrowed = useMemo65(() => {
@@ -41924,10 +41975,10 @@ function ActionInbox({
41924
41975
  const groups = useMemo65(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
41925
41976
  const shown5 = useMemo65(() => groups.flatMap((g) => g.items), [groups]);
41926
41977
  const elsewhere = (items?.length ?? 0) - narrowed.length;
41927
- useEffect96(() => {
41978
+ useEffect97(() => {
41928
41979
  if (cursor >= shown5.length) setCursor(Math.max(0, shown5.length - 1));
41929
41980
  }, [shown5.length, cursor]);
41930
- useEffect96(() => {
41981
+ useEffect97(() => {
41931
41982
  const list = listRef.current;
41932
41983
  const el = list?.querySelector(`[data-row="${cursor}"]`);
41933
41984
  if (list && el) scrollWithinList(list, el);
@@ -41949,11 +42000,11 @@ function ActionInbox({
41949
42000
  [client, load]
41950
42001
  );
41951
42002
  const [held, setHeld] = useState114({});
41952
- const holds2 = useRef54(/* @__PURE__ */ new Map());
41953
- const lastHold = useRef54(null);
41954
- const holdSeq = useRef54(0);
42003
+ const holds2 = useRef55(/* @__PURE__ */ new Map());
42004
+ const lastHold = useRef55(null);
42005
+ const holdSeq = useRef55(0);
41955
42006
  const [, tick] = useState114(0);
41956
- useEffect96(() => {
42007
+ useEffect97(() => {
41957
42008
  if (Object.keys(held).length === 0) return;
41958
42009
  const t = setInterval(() => tick((n) => n + 1), 250);
41959
42010
  return () => clearInterval(t);
@@ -41999,7 +42050,7 @@ function ActionInbox({
41999
42050
  });
42000
42051
  setSaid({ text: entry.ids.length === 1 ? "Undone. It is waiting on you again, exactly as it was." : `Undone. All ${entry.ids.length} are waiting on you again, exactly as they were.`, undo: null });
42001
42052
  }, []);
42002
- useEffect96(() => {
42053
+ useEffect97(() => {
42003
42054
  const flush = () => {
42004
42055
  for (const entry of [...holds2.current.values()]) entry.commit();
42005
42056
  };
@@ -42009,8 +42060,8 @@ function ActionInbox({
42009
42060
  flush();
42010
42061
  };
42011
42062
  }, []);
42012
- const resumed = useRef54(false);
42013
- useEffect96(() => {
42063
+ const resumed = useRef55(false);
42064
+ useEffect97(() => {
42014
42065
  if (resumed.current || items === null || view !== "inbox") return;
42015
42066
  resumed.current = true;
42016
42067
  const kept = readHolds();
@@ -42631,7 +42682,7 @@ function ActionInbox({
42631
42682
 
42632
42683
  // src/HistoryPanel.tsx
42633
42684
  import { isUuidShape as isUuidShape8 } from "@ai-matrx/kit/uuid";
42634
- import { useCallback as useCallback47, useEffect as useEffect99, useRef as useRef55, useState as useState117 } from "react";
42685
+ import { useCallback as useCallback47, useEffect as useEffect100, useRef as useRef56, useState as useState117 } from "react";
42635
42686
 
42636
42687
  // src/undoChange.ts
42637
42688
  function blank(value) {
@@ -42678,7 +42729,7 @@ import { Badge as Badge19, Button as Button86, Skeleton as Skeleton22, cn as cn7
42678
42729
  import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
42679
42730
 
42680
42731
  // src/AsOfReading.tsx
42681
- import { useEffect as useEffect97, useMemo as useMemo66, useState as useState115 } from "react";
42732
+ import { useEffect as useEffect98, useMemo as useMemo66, useState as useState115 } from "react";
42682
42733
  import { readTypedDate as readTypedDate3, typedDateText as typedDateText3 } from "@ai-matrx/records";
42683
42734
  import { useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
42684
42735
  import { Button as Button84, Skeleton as Skeleton21, cn as cn70 } from "@ai-matrx/design-system";
@@ -42806,7 +42857,7 @@ function AsOfReading({
42806
42857
  const zone = usePersonTimeZone();
42807
42858
  const [answer, setAnswer] = useState115(null);
42808
42859
  const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone ?? ""}`;
42809
- useEffect97(() => {
42860
+ useEffect98(() => {
42810
42861
  let live = true;
42811
42862
  void client.recordAsOf(asOfArgs(recordId, asOf, zone)).then((got) => {
42812
42863
  if (!live) return;
@@ -42841,7 +42892,7 @@ function AsOfReading({
42841
42892
  import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
42842
42893
 
42843
42894
  // src/MigrationLog.tsx
42844
- import { useCallback as useCallback46, useEffect as useEffect98, useState as useState116 } from "react";
42895
+ import { useCallback as useCallback46, useEffect as useEffect99, useState as useState116 } from "react";
42845
42896
  import { useRecordsClient as useRecordsClient79 } from "@ai-matrx/records/react";
42846
42897
  import { Button as Button85, cn as cn71 } from "@ai-matrx/design-system";
42847
42898
  import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
@@ -42882,7 +42933,7 @@ function useMigrationLog(recordId) {
42882
42933
  setError(null);
42883
42934
  setEntries(answered.data);
42884
42935
  }, [client, recordId]);
42885
- useEffect98(() => {
42936
+ useEffect99(() => {
42886
42937
  void reload();
42887
42938
  }, [reload]);
42888
42939
  return { entries, error, reload };
@@ -42948,9 +42999,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
42948
42999
  const [open, setOpen] = useState117(null);
42949
43000
  const [pending, setPending] = useState117({ phase: "idle" });
42950
43001
  const [undo, setUndo] = useState117({ phase: "idle" });
42951
- const seenAtPreview = useRef55(null);
43002
+ const seenAtPreview = useRef56(null);
42952
43003
  const [said2, setSaid] = useState117(null);
42953
- const listRef = useRef55(null);
43004
+ const listRef = useRef56(null);
42954
43005
  const [asOf, setAsOf] = useState117(null);
42955
43006
  const today = useRecord4(recordId, false, { tableId });
42956
43007
  const changed2 = useRecordChangeRevision(recordId);
@@ -42964,7 +43015,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
42964
43015
  setError(null);
42965
43016
  setEntries(answered.data);
42966
43017
  }, [client, recordId, changed2]);
42967
- useEffect99(() => {
43018
+ useEffect100(() => {
42968
43019
  void load();
42969
43020
  }, [load]);
42970
43021
  if (error) return /* @__PURE__ */ jsx139(RefusalNotice, { error, className });
@@ -43394,7 +43445,7 @@ function say(value, field2) {
43394
43445
 
43395
43446
  // src/CommentThread.tsx
43396
43447
  import { isUuidShape as isUuidShape9 } from "@ai-matrx/kit/uuid";
43397
- import { useCallback as useCallback48, useEffect as useEffect100, useMemo as useMemo67, useRef as useRef56, useState as useState118 } from "react";
43448
+ import { useCallback as useCallback48, useEffect as useEffect101, useMemo as useMemo67, useRef as useRef57, useState as useState118 } from "react";
43398
43449
  import {
43399
43450
  useFields as useFields24,
43400
43451
  useRecordsClient as useRecordsClient81,
@@ -43418,7 +43469,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
43418
43469
  const [people, setPeople] = useState118([]);
43419
43470
  const [mentionQuery, setMentionQuery] = useState118(null);
43420
43471
  const [picked, setPicked] = useState118([]);
43421
- const box = useRef56(null);
43472
+ const box = useRef57(null);
43422
43473
  const load = useCallback48(async () => {
43423
43474
  const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
43424
43475
  if (!answered.ok) {
@@ -43432,10 +43483,10 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
43432
43483
  mayResolve: answered.data.may_resolve
43433
43484
  });
43434
43485
  }, [client, recordId, showResolved]);
43435
- useEffect100(() => {
43486
+ useEffect101(() => {
43436
43487
  void load();
43437
43488
  }, [load]);
43438
- useEffect100(() => {
43489
+ useEffect101(() => {
43439
43490
  let alive = true;
43440
43491
  if (!host.members) return;
43441
43492
  void host.members().then((roster) => {
@@ -43638,7 +43689,7 @@ function Line2({
43638
43689
  }
43639
43690
 
43640
43691
  // src/FieldHistoryPanel.tsx
43641
- import { useCallback as useCallback49, useEffect as useEffect101, useRef as useRef57, useState as useState119 } from "react";
43692
+ import { useCallback as useCallback49, useEffect as useEffect102, useRef as useRef58, useState as useState119 } from "react";
43642
43693
  import {
43643
43694
  useFields as useFields25,
43644
43695
  useRecordsClient as useRecordsClient82,
@@ -43663,7 +43714,7 @@ function FieldHistoryPanel({
43663
43714
  const [rows, setRows] = useState119(null);
43664
43715
  const [error, setError] = useState119(null);
43665
43716
  const [pending, setPending] = useState119({ phase: "idle" });
43666
- const seenAtPreview = useRef57(null);
43717
+ const seenAtPreview = useRef58(null);
43667
43718
  const [said2, setSaid] = useState119(null);
43668
43719
  const load = useCallback49(async () => {
43669
43720
  const answered = await client.fieldHistory(
@@ -43676,7 +43727,7 @@ function FieldHistoryPanel({
43676
43727
  setError(null);
43677
43728
  setRows(answered.data);
43678
43729
  }, [client, tableId, fieldKey, recordId]);
43679
- useEffect101(() => {
43730
+ useEffect102(() => {
43680
43731
  void load();
43681
43732
  }, [load]);
43682
43733
  const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier20(fieldKey);
@@ -43811,7 +43862,7 @@ function FieldHistoryPanel({
43811
43862
  import { FORM_FLOWS as FORM_FLOWS2, FORM_EMBEDS as FORM_EMBEDS2, formDeclareArgs as formDeclareArgs2, formFromSummary as formFromSummary4, formPresentation, formLookDocument as formLookDocument2, formLookFromDocument, submissionStamp as submissionStamp2, formEmbedSnippet as formEmbedSnippet2, formRoutes as formRoutes2, hiddenFromLink, endingsFromDocument, welcomeFromDocument, themeFromDocument } from "@ai-matrx/records/forms";
43812
43863
 
43813
43864
  // src/FormResultsPanel.tsx
43814
- import { useEffect as useEffect102, useMemo as useMemo68, useState as useState120 } from "react";
43865
+ import { useEffect as useEffect103, useMemo as useMemo68, useState as useState120 } from "react";
43815
43866
  import { useFields as useFields26, useOptionalRecordsClient as useOptionalRecordsClient21 } from "@ai-matrx/records/react";
43816
43867
  import { Button as Button89, Skeleton as Skeleton25, cn as cn75 } from "@ai-matrx/design-system";
43817
43868
  import { jsx as jsx142, jsxs as jsxs130 } from "react/jsx-runtime";
@@ -43840,7 +43891,7 @@ function FormResultsPanel({ form, className }) {
43840
43891
  const [results, setResults] = useState120(null);
43841
43892
  const [error, setError] = useState120(null);
43842
43893
  const [round, setRound] = useState120(0);
43843
- useEffect102(() => {
43894
+ useEffect103(() => {
43844
43895
  if (!client) {
43845
43896
  setError((0, refusals_exports.refusal)("not_supported", "Results are read from the record store, and this screen has none.", "Open the form inside the app."));
43846
43897
  return;
@@ -43938,7 +43989,7 @@ function FormResultsPanel({ form, className }) {
43938
43989
  }
43939
43990
 
43940
43991
  // src/PortalBuilder.tsx
43941
- import { useCallback as useCallback50, useEffect as useEffect103, useMemo as useMemo69, useRef as useRef58, useState as useState121 } from "react";
43992
+ import { useCallback as useCallback50, useEffect as useEffect104, useMemo as useMemo69, useRef as useRef59, useState as useState121 } from "react";
43942
43993
  import { useRecordsClient as useRecordsClient83, useTables as useTables4 } from "@ai-matrx/records/react";
43943
43994
  import { BasicInput as BasicInput23, Button as Button90, Checkbox as Checkbox14, Label as Label20, Separator as Separator10, Skeleton as Skeleton26, cn as cn76 } from "@ai-matrx/design-system";
43944
43995
  import { Select as Select21 } from "@ai-matrx/design-system/controls";
@@ -43972,7 +44023,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
43972
44023
  },
43973
44024
  [client, fieldsByTable]
43974
44025
  );
43975
- useEffect103(() => {
44026
+ useEffect104(() => {
43976
44027
  if (!portalId) return;
43977
44028
  void (async () => {
43978
44029
  const answered = await client.portalCard({ portal_id: portalId });
@@ -43986,7 +44037,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
43986
44037
  setClientTableId(answered.data.client_table_id);
43987
44038
  })();
43988
44039
  }, [client, portalId]);
43989
- useEffect103(() => {
44040
+ useEffect104(() => {
43990
44041
  if (!tableId) return;
43991
44042
  setExposures(
43992
44043
  (prev) => prev[tableId] ? prev : {
@@ -43999,7 +44050,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
43999
44050
  const cameFromPeople = Boolean(
44000
44051
  tableId && (fieldsByTable[tableId] ?? []).some((f) => editorKindFor(f) === "email")
44001
44052
  );
44002
- useEffect103(() => {
44053
+ useEffect104(() => {
44003
44054
  if (!tableId || portalId || clientTableId !== null || !cameFromPeople) return;
44004
44055
  setClientTableId(tableId);
44005
44056
  setExposures((prev) => {
@@ -44014,7 +44065,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
44014
44065
  ),
44015
44066
  [fieldsByTable, clientTableId]
44016
44067
  );
44017
- useEffect103(() => {
44068
+ useEffect104(() => {
44018
44069
  for (const e of Object.values(exposures)) {
44019
44070
  if (!e.on || e.namesVia.trim() !== "") continue;
44020
44071
  const ties = tiesTo(e.tableId);
@@ -44029,7 +44080,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
44029
44080
  if (on) void loadFields(t.id);
44030
44081
  }
44031
44082
  const [linking, setLinking] = useState121(null);
44032
- const linkingNow = useRef58(null);
44083
+ const linkingNow = useRef59(null);
44033
44084
  async function addLinkBack(id) {
44034
44085
  const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
44035
44086
  if (!clientTableId || !clients) return;
@@ -44056,8 +44107,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
44056
44107
  linkingNow.current = null;
44057
44108
  setLinking(null);
44058
44109
  }
44059
- const autoLinked = useRef58(/* @__PURE__ */ new Set());
44060
- useEffect103(() => {
44110
+ const autoLinked = useRef59(/* @__PURE__ */ new Set());
44111
+ useEffect104(() => {
44061
44112
  if (linking !== null || !clientTableId) return;
44062
44113
  for (const e of Object.values(exposures)) {
44063
44114
  if (!e.on || !fieldsByTable[e.tableId] || autoLinked.current.has(e.tableId)) continue;
@@ -44331,7 +44382,7 @@ function clientNoun(table) {
44331
44382
 
44332
44383
  // src/PortalsPanel.tsx
44333
44384
  import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
44334
- import { useCallback as useCallback51, useEffect as useEffect105, useMemo as useMemo71, useState as useState123 } from "react";
44385
+ import { useCallback as useCallback51, useEffect as useEffect106, useMemo as useMemo71, useState as useState123 } from "react";
44335
44386
  import { useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
44336
44387
  import {
44337
44388
  portalArchiveConsequence,
@@ -44342,7 +44393,7 @@ import {
44342
44393
  import { Badge as Badge22, BasicInput as BasicInput25, Button as Button92, Separator as Separator11, Skeleton as Skeleton27, cn as cn79 } from "@ai-matrx/design-system";
44343
44394
 
44344
44395
  // src/PortalLookEditor.tsx
44345
- import { useEffect as useEffect104, useMemo as useMemo70, useState as useState122 } from "react";
44396
+ import { useEffect as useEffect105, useMemo as useMemo70, useState as useState122 } from "react";
44346
44397
  import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
44347
44398
  import { BasicInput as BasicInput24, Button as Button91, cn as cn78 } from "@ai-matrx/design-system";
44348
44399
 
@@ -44430,7 +44481,7 @@ function PortalLookEditor({ card, onSaved, className }) {
44430
44481
  const [said2, setSaid] = useState122(null);
44431
44482
  const [formsError, setFormsError] = useState122(null);
44432
44483
  const [formsUnread, setFormsUnread] = useState122(false);
44433
- useEffect104(() => {
44484
+ useEffect105(() => {
44434
44485
  let cancelled = false;
44435
44486
  void (async () => {
44436
44487
  try {
@@ -44680,7 +44731,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
44680
44731
  const [exposures, setExposures] = useState123([]);
44681
44732
  const [listError, setListError] = useState123(null);
44682
44733
  const [openId, setOpenId] = useState123(activePortalId ?? null);
44683
- useEffect105(() => {
44734
+ useEffect106(() => {
44684
44735
  if (activePortalId) setOpenId(activePortalId);
44685
44736
  }, [activePortalId]);
44686
44737
  const [building, setBuilding] = useState123(false);
@@ -44698,7 +44749,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
44698
44749
  setPortals(answered.data);
44699
44750
  setExposures(mapped.ok ? mapped.data : []);
44700
44751
  }, [client]);
44701
- useEffect105(() => {
44752
+ useEffect106(() => {
44702
44753
  void load();
44703
44754
  }, [load]);
44704
44755
  if (portals === null) return /* @__PURE__ */ jsx146(Skeleton27, { className: cn79("h-32 w-full", className) });
@@ -44973,7 +45024,7 @@ function PortalDetail({
44973
45024
  setError(null);
44974
45025
  setCard(answered.data);
44975
45026
  }, [client, portalId]);
44976
- useEffect105(() => {
45027
+ useEffect106(() => {
44977
45028
  void load();
44978
45029
  }, [load]);
44979
45030
  const revoke = useCallback51(
@@ -45181,7 +45232,7 @@ function Preview({
45181
45232
  const [which, setWhich] = useState123(first?.table_id ?? null);
45182
45233
  const [rows, setRows] = useState123(null);
45183
45234
  const [error, setError] = useState123(null);
45184
- useEffect105(() => {
45235
+ useEffect106(() => {
45185
45236
  if (!which) return;
45186
45237
  let cancelled = false;
45187
45238
  setRows(null);
@@ -45227,7 +45278,7 @@ function Invite({ card, onInvited }) {
45227
45278
  const [busy, setBusy] = useState123(false);
45228
45279
  const [said2, setSaid] = useState123(null);
45229
45280
  const [error, setError] = useState123(null);
45230
- useEffect105(() => {
45281
+ useEffect106(() => {
45231
45282
  let cancelled = false;
45232
45283
  void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
45233
45284
  if (cancelled) return;
@@ -45438,7 +45489,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
45438
45489
  }
45439
45490
 
45440
45491
  // src/DigestScheduler.tsx
45441
- import { useCallback as useCallback52, useEffect as useEffect106, useMemo as useMemo72, useState as useState124 } from "react";
45492
+ import { useCallback as useCallback52, useEffect as useEffect107, useMemo as useMemo72, useState as useState124 } from "react";
45442
45493
  import { useRecordsClient as useRecordsClient86, useTable as useTable28 } from "@ai-matrx/records/react";
45443
45494
  import { hasQuietHours } from "@ai-matrx/records";
45444
45495
  import { BasicInput as BasicInput26, Button as Button93, Checkbox as Checkbox15, Label as Label21, Separator as Separator12, Skeleton as Skeleton28, cn as cn81 } from "@ai-matrx/design-system";
@@ -45556,7 +45607,7 @@ function DigestScheduler({
45556
45607
  setMembers([]);
45557
45608
  }
45558
45609
  }, [client, tableId, host]);
45559
- useEffect106(() => {
45610
+ useEffect107(() => {
45560
45611
  void load();
45561
45612
  }, [load]);
45562
45613
  const schedule = useMemo72(() => {
@@ -45814,13 +45865,13 @@ function DigestScheduler({
45814
45865
  }
45815
45866
 
45816
45867
  // src/SubscriptionsPanel.tsx
45817
- import { useCallback as useCallback54, useEffect as useEffect108, useState as useState126 } from "react";
45868
+ import { useCallback as useCallback54, useEffect as useEffect109, useState as useState126 } from "react";
45818
45869
  import { useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
45819
45870
  import { hasQuietHours as hasQuietHours2 } from "@ai-matrx/records";
45820
45871
  import { Badge as Badge23, Button as Button95, Skeleton as Skeleton30, Switch as Switch6, cn as cn83 } from "@ai-matrx/design-system";
45821
45872
 
45822
45873
  // src/WebhooksPanel.tsx
45823
- import { useCallback as useCallback53, useEffect as useEffect107, useState as useState125 } from "react";
45874
+ import { useCallback as useCallback53, useEffect as useEffect108, useState as useState125 } from "react";
45824
45875
  import { useRecordsClient as useRecordsClient87, useTable as useTable29 } from "@ai-matrx/records/react";
45825
45876
  import { BasicInput as BasicInput27, Button as Button94, Checkbox as Checkbox16, ConfirmDialog as ConfirmDialog7, Label as Label22, Skeleton as Skeleton29, cn as cn82 } from "@ai-matrx/design-system";
45826
45877
  import { jsx as jsx149, jsxs as jsxs137 } from "react/jsx-runtime";
@@ -45866,7 +45917,7 @@ function WebhooksPanel({ tableId, className }) {
45866
45917
  setError(null);
45867
45918
  setHooks(answered.data ?? []);
45868
45919
  }, [client, tableId]);
45869
- useEffect107(() => {
45920
+ useEffect108(() => {
45870
45921
  void load();
45871
45922
  }, [load]);
45872
45923
  const declare2 = async () => {
@@ -46054,7 +46105,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
46054
46105
  setError(null);
46055
46106
  setRows(answered.data);
46056
46107
  }, [client, tableId]);
46057
- useEffect108(() => {
46108
+ useEffect109(() => {
46058
46109
  void load();
46059
46110
  }, [load]);
46060
46111
  const flip = useCallback54(
@@ -46246,7 +46297,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
46246
46297
  import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
46247
46298
  import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
46248
46299
  import { Select as Select23 } from "@ai-matrx/design-system/controls";
46249
- import { useCallback as useCallback56, useEffect as useEffect110, useMemo as useMemo74, useRef as useRef60, useState as useState129 } from "react";
46300
+ import { useCallback as useCallback56, useEffect as useEffect111, useMemo as useMemo74, useRef as useRef61, useState as useState129 } from "react";
46250
46301
  import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
46251
46302
  import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
46252
46303
  import { CSS as CSS3 } from "@dnd-kit/utilities";
@@ -46519,7 +46570,7 @@ function EmbedSnippets({ url, label }) {
46519
46570
  }
46520
46571
 
46521
46572
  // src/FormRunner.tsx
46522
- import { useCallback as useCallback55, useEffect as useEffect109, useMemo as useMemo73, useRef as useRef59, useState as useState128 } from "react";
46573
+ import { useCallback as useCallback55, useEffect as useEffect110, useMemo as useMemo73, useRef as useRef60, useState as useState128 } from "react";
46523
46574
  import { useFields as useFields27, useOptionalRecordsClient as useOptionalRecordsClient22 } from "@ai-matrx/records/react";
46524
46575
  import { Button as Button97, Label as Label24, Progress, Skeleton as Skeleton31, cn as cn84, formThemeClasses } from "@ai-matrx/design-system";
46525
46576
  import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
@@ -46637,11 +46688,11 @@ function FormStage({
46637
46688
  const routes = formRoutes(form);
46638
46689
  const [routeKnown, setRouteKnown] = useState128(() => !routes || !whichAsked);
46639
46690
  const [stopped, setStopped] = useState128(null);
46640
- const answersRef = useRef59(answers2);
46691
+ const answersRef = useRef60(answers2);
46641
46692
  answersRef.current = answers2;
46642
46693
  const choose = autoAdvance ?? form.autoAdvance ?? true;
46643
- const decoy = useRef59("");
46644
- const stage = useRef59(null);
46694
+ const decoy = useRef60("");
46695
+ const stage = useRef60(null);
46645
46696
  const questions = useMemo73(() => {
46646
46697
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
46647
46698
  return (form.questions ?? []).map((q) => {
@@ -46659,7 +46710,7 @@ function FormStage({
46659
46710
  };
46660
46711
  });
46661
46712
  }, [fields, form.questions]);
46662
- useEffect109(() => {
46713
+ useEffect110(() => {
46663
46714
  if (!whichAsked) return;
46664
46715
  if (!routes) return;
46665
46716
  let cancelled = false;
@@ -46704,19 +46755,19 @@ function FormStage({
46704
46755
  };
46705
46756
  }, [whichAsked, questions, answers2]);
46706
46757
  const live = questions.filter((q) => !hidden[q.key]);
46707
- const told = useRef59(answers2);
46708
- useEffect109(() => {
46758
+ const told = useRef60(answers2);
46759
+ useEffect110(() => {
46709
46760
  if (told.current === answers2) return;
46710
46761
  told.current = answers2;
46711
46762
  onAnswersChange?.(answers2);
46712
46763
  }, [answers2, onAnswersChange]);
46713
- const resumeAt = useRef59(
46764
+ const resumeAt = useRef60(
46714
46765
  resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
46715
46766
  const v = initialAnswers[q.key];
46716
46767
  return v === void 0 || v === null || v === "";
46717
46768
  })?.key ?? null : null
46718
46769
  );
46719
- useEffect109(() => {
46770
+ useEffect110(() => {
46720
46771
  const key = resumeAt.current;
46721
46772
  if (!key) return;
46722
46773
  const i = live.findIndex((q) => q.key === key);
@@ -46824,10 +46875,10 @@ function FormStage({
46824
46875
  if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
46825
46876
  else void submit();
46826
46877
  }
46827
- const routing = useRef59(false);
46878
+ const routing = useRef60(false);
46828
46879
  const [routingNow, setRoutingNow] = useState128(false);
46829
- const typedAhead = useRef59("");
46830
- useEffect109(() => {
46880
+ const typedAhead = useRef60("");
46881
+ useEffect110(() => {
46831
46882
  if (!routingNow) return;
46832
46883
  const hold = (event) => {
46833
46884
  if (!routing.current || event.metaKey || event.ctrlKey || event.altKey || event.isComposing) return;
@@ -46857,10 +46908,10 @@ function FormStage({
46857
46908
  }
46858
46909
  for (const key of held) target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));
46859
46910
  }, [live, at]);
46860
- useEffect109(() => {
46911
+ useEffect110(() => {
46861
46912
  if (!routingNow) pourTypedAhead();
46862
46913
  }, [routingNow, at, pourTypedAhead]);
46863
- const advanceRef = useRef59(advance);
46914
+ const advanceRef = useRef60(advance);
46864
46915
  advanceRef.current = advance;
46865
46916
  const chosen = useCallback55(() => {
46866
46917
  if (!oneAtATime || !choose) return;
@@ -46882,23 +46933,23 @@ function FormStage({
46882
46933
  if (event.shiftKey) retreat();
46883
46934
  else advance();
46884
46935
  }
46885
- useEffect109(() => {
46936
+ useEffect110(() => {
46886
46937
  const input = stage.current?.querySelector("[role='radio'][aria-checked='true']") ?? stage.current?.querySelector(
46887
46938
  "input:not([tabindex='-1']), textarea, select, [role='combobox'], [role='radio'], [role='checkbox']"
46888
46939
  );
46889
46940
  input?.focus();
46890
46941
  pourTypedAhead();
46891
46942
  }, [index, done, started]);
46892
- const startTold = useRef59(false);
46893
- useEffect109(() => {
46943
+ const startTold = useRef60(false);
46944
+ useEffect110(() => {
46894
46945
  if (startTold.current || !onStart) return;
46895
46946
  if (Object.values(answers2).some((v) => v !== void 0 && v !== null && v !== "")) {
46896
46947
  startTold.current = true;
46897
46948
  onStart();
46898
46949
  }
46899
46950
  }, [answers2, onStart]);
46900
- const shownTold = useRef59(/* @__PURE__ */ new Set());
46901
- useEffect109(() => {
46951
+ const shownTold = useRef60(/* @__PURE__ */ new Set());
46952
+ useEffect110(() => {
46902
46953
  if (!onQuestionShown || !started || done) return;
46903
46954
  for (const q of oneAtATime ? current ? [current] : [] : live) {
46904
46955
  if (shownTold.current.has(q.key)) continue;
@@ -47082,7 +47133,7 @@ function ThankYou({
47082
47133
  const title = rawTitle ? pipe(rawTitle) : rawTitle;
47083
47134
  const body = rawBody ? pipe(rawBody) : rawBody;
47084
47135
  const going = redirect !== null && done !== "preview";
47085
- useEffect109(() => {
47136
+ useEffect110(() => {
47086
47137
  if (!going || !redirect) return;
47087
47138
  const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
47088
47139
  return () => window.clearTimeout(timer);
@@ -47283,7 +47334,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47283
47334
  const [restoredAt, setRestoredAt] = useState129(null);
47284
47335
  const [showResults, setShowResults] = useState129(false);
47285
47336
  const [adding, setAdding] = useState129(false);
47286
- const keysBeforeAdd = useRef60(null);
47337
+ const keysBeforeAdd = useRef61(null);
47287
47338
  const [makeOnMount, setMakeOnMount] = useState129("waiting");
47288
47339
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
47289
47340
  const load = useCallback56(async () => {
@@ -47313,10 +47364,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47313
47364
  setError(null);
47314
47365
  setForms(mine);
47315
47366
  }, [client, tableId, seed, claimSeed]);
47316
- useEffect110(() => {
47367
+ useEffect111(() => {
47317
47368
  void load();
47318
47369
  }, [load]);
47319
- useEffect110(() => {
47370
+ useEffect111(() => {
47320
47371
  let cancelled = false;
47321
47372
  Promise.resolve().then(() => client.formKnobs()).then((r) => {
47322
47373
  if (!cancelled && r.ok) setOrgKnobs(r.data);
@@ -47325,7 +47376,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47325
47376
  cancelled = true;
47326
47377
  };
47327
47378
  }, [client]);
47328
- useEffect110(() => {
47379
+ useEffect111(() => {
47329
47380
  if (!forms || forms.length === 0) return;
47330
47381
  if (createOnMount && makeOnMount !== "made") return;
47331
47382
  const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
@@ -47349,7 +47400,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47349
47400
  );
47350
47401
  const stored = useMemo74(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
47351
47402
  const dirty = Boolean(draft && stored && !sameForm(draft, stored));
47352
- useEffect110(() => {
47403
+ useEffect111(() => {
47353
47404
  if (!draft || !stored) return;
47354
47405
  const timer = window.setTimeout(() => {
47355
47406
  if (sameForm(draft, stored)) dropKeptDraft(draft.id);
@@ -47358,7 +47409,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47358
47409
  return () => window.clearTimeout(timer);
47359
47410
  }, [draft, stored]);
47360
47411
  const lookKey = draft ? JSON.stringify(formLookDocument(draft.look ?? null)) : null;
47361
- useEffect110(() => {
47412
+ useEffect111(() => {
47362
47413
  if (lookKey === null) return;
47363
47414
  let cancelled = false;
47364
47415
  const timer = window.setTimeout(() => {
@@ -47375,7 +47426,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47375
47426
  window.clearTimeout(timer);
47376
47427
  };
47377
47428
  }, [client, lookKey]);
47378
- useEffect110(() => {
47429
+ useEffect111(() => {
47379
47430
  const before = keysBeforeAdd.current;
47380
47431
  if (!before || !fields.data) return;
47381
47432
  const made = askableFields(fields.data).filter((f) => !before.has(f.key));
@@ -47486,14 +47537,14 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47486
47537
  return true;
47487
47538
  }
47488
47539
  const [started, setStarted] = useState129(false);
47489
- useEffect110(() => {
47540
+ useEffect111(() => {
47490
47541
  if (!startWithOne || started || forms === null || forms.length > 0) return;
47491
47542
  if (askableFields(fields.data ?? []).length === 0) return;
47492
47543
  if (!table.data && !table.error) return;
47493
47544
  setStarted(true);
47494
47545
  void create(table.data?.name?.trim() ? `${table.data.name.trim()} form` : "Form 1");
47495
47546
  }, [startWithOne, started, forms, fields.data, create, table.data, table.error]);
47496
- useEffect110(() => {
47547
+ useEffect111(() => {
47497
47548
  if (!createOnMount || makeOnMount !== "waiting" || forms === null) return;
47498
47549
  if (!table.data && !table.error) return;
47499
47550
  if (askableFields(fields.data ?? []).length === 0) {
@@ -48085,8 +48136,8 @@ function NotifyOnAnswer({
48085
48136
  const [error, setError] = useState129(null);
48086
48137
  const [said2, setSaid] = useState129(null);
48087
48138
  const [url, setUrl] = useState129(notify?.webhookUrl ?? "");
48088
- useEffect110(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
48089
- useEffect110(() => {
48139
+ useEffect111(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
48140
+ useEffect111(() => {
48090
48141
  let cancelled = false;
48091
48142
  void client.subscriptions({ table_id: tableId }).then((r) => {
48092
48143
  if (!cancelled && r.ok) setSubs(r.data);
@@ -48217,7 +48268,7 @@ function NotifyOnAnswer({
48217
48268
  }
48218
48269
 
48219
48270
  // src/DocTemplate.tsx
48220
- import { useCallback as useCallback57, useEffect as useEffect111, useState as useState130 } from "react";
48271
+ import { useCallback as useCallback57, useEffect as useEffect112, useState as useState130 } from "react";
48221
48272
  import { useFields as useFields29, useRecordsClient as useRecordsClient90, useTable as useTable31 } from "@ai-matrx/records/react";
48222
48273
  import { BasicInput as BasicInput30, BasicTextarea as BasicTextarea12, Button as Button99, Label as Label26, Skeleton as Skeleton33, cn as cn86 } from "@ai-matrx/design-system";
48223
48274
  import { jsx as jsx154, jsxs as jsxs142 } from "react/jsx-runtime";
@@ -48265,10 +48316,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
48265
48316
  setError(null);
48266
48317
  setTemplates(rows);
48267
48318
  }, [client, tableId, seed, fields.data]);
48268
- useEffect111(() => {
48319
+ useEffect112(() => {
48269
48320
  void load();
48270
48321
  }, [load]);
48271
- useEffect111(() => {
48322
+ useEffect112(() => {
48272
48323
  if (!templates || templates.length === 0) return;
48273
48324
  const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
48274
48325
  if (chosen.id !== activeId) setActiveId(chosen.id);
@@ -48276,7 +48327,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
48276
48327
  setDraftBody(chosen.body);
48277
48328
  onActiveTemplate?.(chosen);
48278
48329
  }, [templates, activeTemplateId]);
48279
- useEffect111(() => {
48330
+ useEffect112(() => {
48280
48331
  let cancelled = false;
48281
48332
  if (draftBody.trim() === "") {
48282
48333
  setUnresolved([]);
@@ -48401,7 +48452,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
48401
48452
  }
48402
48453
 
48403
48454
  // src/DocRender.tsx
48404
- import { useCallback as useCallback58, useEffect as useEffect112, useRef as useRef61, useState as useState131 } from "react";
48455
+ import { useCallback as useCallback58, useEffect as useEffect113, useRef as useRef62, useState as useState131 } from "react";
48405
48456
  import { useRecordsClient as useRecordsClient91 } from "@ai-matrx/records/react";
48406
48457
  import { Button as Button100, Skeleton as Skeleton34, cn as cn87 } from "@ai-matrx/design-system";
48407
48458
  import { jsx as jsx155, jsxs as jsxs143 } from "react/jsx-runtime";
@@ -48412,7 +48463,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
48412
48463
  const [showing, setShowing] = useState131(null);
48413
48464
  const [error, setError] = useState131(null);
48414
48465
  const [busy, setBusy] = useState131(null);
48415
- const paper = useRef61(null);
48466
+ const paper = useRef62(null);
48416
48467
  const load = useCallback58(async () => {
48417
48468
  const [body, held] = await Promise.all([
48418
48469
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -48430,7 +48481,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
48430
48481
  setPreview(body.data);
48431
48482
  setRenders(held.data.filter((r) => r.template_id === templateId));
48432
48483
  }, [client, templateId, recordId]);
48433
- useEffect112(() => {
48484
+ useEffect113(() => {
48434
48485
  void load();
48435
48486
  }, [load]);
48436
48487
  async function freeze() {
@@ -48517,7 +48568,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
48517
48568
  }
48518
48569
 
48519
48570
  // src/SignBlock.tsx
48520
- import { useCallback as useCallback59, useEffect as useEffect113, useState as useState132 } from "react";
48571
+ import { useCallback as useCallback59, useEffect as useEffect114, useState as useState132 } from "react";
48521
48572
  import { useFields as useFields30, useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
48522
48573
  import { BasicInput as BasicInput31, Button as Button101, Skeleton as Skeleton35, cn as cn88 } from "@ai-matrx/design-system";
48523
48574
  import { useTable as useTable32 } from "@ai-matrx/records/react";
@@ -48547,7 +48598,7 @@ function SignBlock({ tableId, recordId, render, className }) {
48547
48598
  }
48548
48599
  setVerdicts(answers2);
48549
48600
  }, [client, recordId]);
48550
- useEffect113(() => {
48601
+ useEffect114(() => {
48551
48602
  void load();
48552
48603
  }, [load]);
48553
48604
  async function sign(field2) {
@@ -48668,7 +48719,7 @@ function SignBlock({ tableId, recordId, render, className }) {
48668
48719
  }
48669
48720
 
48670
48721
  // src/NotifyRuleEditor.tsx
48671
- import { useCallback as useCallback60, useEffect as useEffect114, useState as useState133 } from "react";
48722
+ import { useCallback as useCallback60, useEffect as useEffect115, useState as useState133 } from "react";
48672
48723
  import { useRecordsClient as useRecordsClient93, useTable as useTable33 } from "@ai-matrx/records/react";
48673
48724
  import { hasQuietHours as hasQuietHours3 } from "@ai-matrx/records";
48674
48725
  import { Button as Button102, Skeleton as Skeleton36, cn as cn89 } from "@ai-matrx/design-system";
@@ -48718,7 +48769,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
48718
48769
  }
48719
48770
  setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
48720
48771
  }, [client, host, tableId]);
48721
- useEffect114(() => {
48772
+ useEffect115(() => {
48722
48773
  void load();
48723
48774
  }, [load]);
48724
48775
  const write = useCallback60(
@@ -48746,7 +48797,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
48746
48797
  },
48747
48798
  [client, tableId]
48748
48799
  );
48749
- useEffect114(() => {
48800
+ useEffect115(() => {
48750
48801
  if (!subscriptions || !seed || seed.length === 0) return;
48751
48802
  const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
48752
48803
  if (missing.length === 0) return;
@@ -48954,7 +49005,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
48954
49005
  }
48955
49006
 
48956
49007
  // src/DashboardCanvas.tsx
48957
- import { useCallback as useCallback61, useEffect as useEffect115, useMemo as useMemo76, useState as useState135 } from "react";
49008
+ import { useCallback as useCallback61, useEffect as useEffect116, useMemo as useMemo76, useState as useState135 } from "react";
48958
49009
  import { useFields as useFields32, useRecordsClient as useRecordsClient95, useTable as useTable34 } from "@ai-matrx/records/react";
48959
49010
  import {
48960
49011
  BasicInput as BasicInput32,
@@ -49577,10 +49628,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
49577
49628
  return read;
49578
49629
  }, [client, tableId]);
49579
49630
  const [notKept, setNotKept] = useState135(null);
49580
- useEffect115(() => {
49631
+ useEffect116(() => {
49581
49632
  void load();
49582
49633
  }, [load]);
49583
- useEffect115(() => {
49634
+ useEffect116(() => {
49584
49635
  if (!boards || boards.length === 0) return;
49585
49636
  if (createOnMount && madeOnMount !== "done") return;
49586
49637
  const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
@@ -49588,7 +49639,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
49588
49639
  }, [boards, activeDashboardId, madeOnMount]);
49589
49640
  const board = useMemo76(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
49590
49641
  const filterKey = JSON.stringify(filter ?? {});
49591
- useEffect115(() => {
49642
+ useEffect116(() => {
49592
49643
  if (!activeId) {
49593
49644
  setRun(null);
49594
49645
  return;
@@ -49658,7 +49709,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
49658
49709
  ]
49659
49710
  );
49660
49711
  }
49661
- useEffect115(() => {
49712
+ useEffect116(() => {
49662
49713
  if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
49663
49714
  setMadeOnMount("making");
49664
49715
  void create().then(() => setMadeOnMount("done"));
@@ -50113,7 +50164,7 @@ function TargetControl({
50113
50164
  const [mode, setMode] = useState135(saved);
50114
50165
  const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
50115
50166
  const [draft, setDraft] = useState135(savedValue === null ? "" : String(savedValue));
50116
- useEffect115(() => {
50167
+ useEffect116(() => {
50117
50168
  setMode(saved);
50118
50169
  setDraft(savedValue === null ? "" : String(savedValue));
50119
50170
  }, [saved, savedValue]);
@@ -50181,7 +50232,7 @@ function TargetControl({
50181
50232
 
50182
50233
  // src/QuestionPanel.tsx
50183
50234
  import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
50184
- import { useEffect as useEffect116, useMemo as useMemo77, useRef as useRef62, useState as useState136 } from "react";
50235
+ import { useEffect as useEffect117, useMemo as useMemo77, useRef as useRef63, useState as useState136 } from "react";
50185
50236
  import { Badge as Badge24, BasicInput as BasicInput33, Button as Button105, Checkbox as Checkbox18, Label as Label27, Skeleton as Skeleton38, cn as cn92 } from "@ai-matrx/design-system";
50186
50237
  import { useFields as useFields33, useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
50187
50238
 
@@ -50237,7 +50288,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
50237
50288
  const me = client.config.actor?.user_id ?? null;
50238
50289
  const [hidden, setHidden] = useState136(null);
50239
50290
  const [related, setRelated] = useState136({});
50240
- useEffect116(() => {
50291
+ useEffect117(() => {
50241
50292
  if (all.length === 0) {
50242
50293
  if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
50243
50294
  return;
@@ -50270,8 +50321,8 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
50270
50321
  const [saveError, setSaveError] = useState136(null);
50271
50322
  const [saving, setSaving] = useState136(false);
50272
50323
  const [linkMissed, setLinkMissed] = useState136(false);
50273
- const openedFromLink = useRef62(false);
50274
- useEffect116(() => {
50324
+ const openedFromLink = useRef63(false);
50325
+ useEffect117(() => {
50275
50326
  let live = true;
50276
50327
  void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
50277
50328
  if (!live) return;
@@ -50294,7 +50345,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
50294
50345
  setShared(q ? q.shared : true);
50295
50346
  setSaveError(null);
50296
50347
  };
50297
- useEffect116(() => {
50348
+ useEffect117(() => {
50298
50349
  if (!draft) return;
50299
50350
  open(null);
50300
50351
  setSpec(draft);
@@ -50303,7 +50354,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
50303
50354
  const [answer, setAnswer] = useState136(null);
50304
50355
  const [asking, setAsking] = useState136(false);
50305
50356
  const specKey = JSON.stringify(spec);
50306
- useEffect116(() => {
50357
+ useEffect117(() => {
50307
50358
  if (all.length === 0) return;
50308
50359
  let live = true;
50309
50360
  setAsking(true);
@@ -50745,7 +50796,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
50745
50796
  }
50746
50797
 
50747
50798
  // src/TableAsk.tsx
50748
- import { useEffect as useEffect117, useState as useState137 } from "react";
50799
+ import { useEffect as useEffect118, useState as useState137 } from "react";
50749
50800
  import { formatPoints as formatPoints2 } from "@ai-matrx/kit/format";
50750
50801
  import { BasicInput as BasicInput34, Button as Button106, Popover as Popover18, PopoverContent as PopoverContent18, PopoverTrigger as PopoverTrigger18, Skeleton as Skeleton39 } from "@ai-matrx/design-system";
50751
50802
  import { optionLabel as optionLabel4 } from "@ai-matrx/records";
@@ -51063,7 +51114,7 @@ function useNames(tableId, ids) {
51063
51114
  const [names2, setNames] = useState137({});
51064
51115
  const titleField = table.data?.title_field ?? null;
51065
51116
  const key = ids.join("|");
51066
- useEffect117(() => {
51117
+ useEffect118(() => {
51067
51118
  let live = true;
51068
51119
  void Promise.all(
51069
51120
  ids.map(async (id) => {
@@ -51155,12 +51206,12 @@ function AgentAnswer({
51155
51206
  }
51156
51207
 
51157
51208
  // src/PageScreen.tsx
51158
- import { useCallback as useCallback62, useEffect as useEffect119, useMemo as useMemo79, useRef as useRef63, useState as useState139 } from "react";
51209
+ import { useCallback as useCallback62, useEffect as useEffect120, useMemo as useMemo79, useRef as useRef64, useState as useState139 } from "react";
51159
51210
  import { useRecordsClient as useRecordsClient99 } from "@ai-matrx/records/react";
51160
51211
  import { BasicInput as BasicInput36, Button as Button109, Skeleton as Skeleton41, cn as cn94 } from "@ai-matrx/design-system";
51161
51212
 
51162
51213
  // src/PageCanvas.tsx
51163
- import { createContext as createContext10, useContext as useContext10, useEffect as useEffect118, useMemo as useMemo78, useState as useState138 } from "react";
51214
+ import { createContext as createContext10, useContext as useContext10, useEffect as useEffect119, useMemo as useMemo78, useState as useState138 } from "react";
51164
51215
  import {
51165
51216
  useFields as useFields35,
51166
51217
  useRecordPage as useRecordPage3,
@@ -51277,7 +51328,7 @@ function useDoorRows(door, elementId, recordId) {
51277
51328
  error: null
51278
51329
  });
51279
51330
  const [tick, setTick] = useState138(0);
51280
- useEffect118(() => {
51331
+ useEffect119(() => {
51281
51332
  if (!door) return;
51282
51333
  let live = true;
51283
51334
  setState((s) => ({ ...s, loading: true }));
@@ -51388,7 +51439,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
51388
51439
  const fields = useFields35(enabled ? block.table_id : null);
51389
51440
  const all = useMemo78(() => onePerKey3(fields.data ?? []), [fields.data]);
51390
51441
  const [view, setView] = useState138(block.view_id ? "reading" : null);
51391
- useEffect118(() => {
51442
+ useEffect119(() => {
51392
51443
  if (!block.view_id || !enabled) {
51393
51444
  setView(null);
51394
51445
  return;
@@ -51407,7 +51458,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
51407
51458
  const mine = mineOn || block.me_only === true;
51408
51459
  const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
51409
51460
  const [me, setMe] = useState138(null);
51410
- useEffect118(() => {
51461
+ useEffect119(() => {
51411
51462
  if (!enabled || !mine || !meField?.relation_target || !viewerUserId) {
51412
51463
  setMe(null);
51413
51464
  return;
@@ -51441,7 +51492,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
51441
51492
  ...q.sort.length > 0 ? { sort: q.sort } : {}
51442
51493
  });
51443
51494
  const reload = page.reload;
51444
- useEffect118(() => onRecordChanged2(() => reload()), [reload]);
51495
+ useEffect119(() => onRecordChanged2(() => reload()), [reload]);
51445
51496
  return { q, page };
51446
51497
  }
51447
51498
  function BlockBody(inner2) {
@@ -51522,7 +51573,7 @@ function AppletBlockView({ block }) {
51522
51573
  function AppletPick({ value, onChange }) {
51523
51574
  const host = useRecordsUi();
51524
51575
  const [options, setOptions] = useState138(null);
51525
- useEffect118(() => {
51576
+ useEffect119(() => {
51526
51577
  let live = true;
51527
51578
  host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
51528
51579
  return () => {
@@ -51595,10 +51646,10 @@ function ListBlockView({
51595
51646
  const { rows, all } = read;
51596
51647
  const columns = shownColumns(all, block.columns);
51597
51648
  const name = block.title ?? table.data?.name ?? "List";
51598
- useEffect118(() => onRows(rows), [rows, onRows]);
51649
+ useEffect119(() => onRows(rows), [rows, onRows]);
51599
51650
  const firstId = rows[0]?.id ?? null;
51600
51651
  const stillThere = selected !== null && rows.some((r) => r.id === selected);
51601
- useEffect118(() => {
51652
+ useEffect119(() => {
51602
51653
  if (read.loading || read.waiting) return;
51603
51654
  if (!stillThere) onSelect(firstId);
51604
51655
  }, [firstId, stillThere, read.loading, read.waiting]);
@@ -51862,7 +51913,7 @@ function ActionButton2({ block, recordId }) {
51862
51913
  const [running, setRunning] = useState138(false);
51863
51914
  const [done, setDone] = useState138(null);
51864
51915
  const [error, setError] = useState138(null);
51865
- useEffect118(() => {
51916
+ useEffect119(() => {
51866
51917
  setDone(null);
51867
51918
  setError(null);
51868
51919
  setAsking(false);
@@ -51903,7 +51954,7 @@ function FormBlockView({ block }) {
51903
51954
  const client = useRecordsClient98();
51904
51955
  const [form, setForm] = useState138("reading");
51905
51956
  const [sent, setSent] = useState138(0);
51906
- useEffect118(() => {
51957
+ useEffect119(() => {
51907
51958
  if (!block.form_id) {
51908
51959
  setForm(null);
51909
51960
  return;
@@ -52036,7 +52087,7 @@ function ScopeSettings({
52036
52087
  const [views, setViews] = useState138([]);
52037
52088
  const fields = useFields35(block.table_id);
52038
52089
  const all = onePerKey3(fields.data ?? []);
52039
- useEffect118(() => {
52090
+ useEffect119(() => {
52040
52091
  let live = true;
52041
52092
  void client.views({ table_id: block.table_id }).then((answered) => {
52042
52093
  if (live) setViews(answered.ok ? answered.data : []);
@@ -52186,7 +52237,7 @@ function ListSettings({ block, onChange }) {
52186
52237
  const [views, setViews] = useState138([]);
52187
52238
  const fields = useFields35(block.table_id);
52188
52239
  const all = onePerKey3(fields.data ?? []);
52189
- useEffect118(() => {
52240
+ useEffect119(() => {
52190
52241
  let live = true;
52191
52242
  void client.views({ table_id: block.table_id }).then((answered) => {
52192
52243
  if (live) setViews(answered.ok ? answered.data : []);
@@ -52269,7 +52320,7 @@ function ActionPicker({ tableId, value, onChange }) {
52269
52320
  function FormPicker({ tableId, value, onChange }) {
52270
52321
  const client = useRecordsClient98();
52271
52322
  const [forms, setForms] = useState138([]);
52272
- useEffect118(() => {
52323
+ useEffect119(() => {
52273
52324
  let live = true;
52274
52325
  void client.forms({ table_id: tableId }).then((answered) => {
52275
52326
  if (live) setForms(answered.ok ? answered.data : []);
@@ -52355,7 +52406,7 @@ function PageScreen({
52355
52406
  const [run, setRun] = useState139(null);
52356
52407
  const [saveError, setSaveError] = useState139(null);
52357
52408
  const [askingToArchive, setAskingToArchive] = useState139(false);
52358
- const canvas = useRef63(null);
52409
+ const canvas = useRef64(null);
52359
52410
  const [making, setMaking] = useState139("waiting");
52360
52411
  const id = page?.id ?? pageId ?? null;
52361
52412
  const load = useCallback62(
@@ -52377,7 +52428,7 @@ function PageScreen({
52377
52428
  },
52378
52429
  [client]
52379
52430
  );
52380
- useEffect119(() => {
52431
+ useEffect120(() => {
52381
52432
  if (!newOnTable || pageId || making !== "waiting") return;
52382
52433
  setMaking("making");
52383
52434
  void client.dashboardDeclare({
@@ -52397,11 +52448,11 @@ function PageScreen({
52397
52448
  onCreated?.(made.data);
52398
52449
  });
52399
52450
  }, [client, newOnTable, pageId, making, load, onCreated]);
52400
- useEffect119(() => {
52451
+ useEffect120(() => {
52401
52452
  if (!pageId) return;
52402
52453
  void load(pageId);
52403
52454
  }, [pageId, load]);
52404
- useEffect119(() => {
52455
+ useEffect120(() => {
52405
52456
  if (!id) return;
52406
52457
  let live = true;
52407
52458
  void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
@@ -52413,7 +52464,7 @@ function PageScreen({
52413
52464
  }, [client, id]);
52414
52465
  const canEdit = level !== null && EDIT_LEVELS.has(level);
52415
52466
  const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
52416
- useEffect119(() => {
52467
+ useEffect120(() => {
52417
52468
  if (!page || page.blocks.length === 0) {
52418
52469
  setRun(null);
52419
52470
  return;
@@ -52556,7 +52607,7 @@ function PageScreen({
52556
52607
  }
52557
52608
 
52558
52609
  // src/InterfaceScreen.tsx
52559
- import { useCallback as useCallback63, useEffect as useEffect120, useMemo as useMemo80, useRef as useRef64, useState as useState140 } from "react";
52610
+ import { useCallback as useCallback63, useEffect as useEffect121, useMemo as useMemo80, useRef as useRef65, useState as useState140 } from "react";
52560
52611
  import { useRecordsClient as useRecordsClient100 } from "@ai-matrx/records/react";
52561
52612
  import { BasicInput as BasicInput37, Button as Button110, Skeleton as Skeleton42, cn as cn95 } from "@ai-matrx/design-system";
52562
52613
  import { Fragment as Fragment68, jsx as jsx166, jsxs as jsxs154 } from "react/jsx-runtime";
@@ -52593,7 +52644,7 @@ function InterfaceScreen({
52593
52644
  const [making, setMaking] = useState140("waiting");
52594
52645
  const [askingToArchive, setAskingToArchive] = useState140(false);
52595
52646
  const [localPage, setLocalPage] = useState140(null);
52596
- const canvas = useRef64(null);
52647
+ const canvas = useRef65(null);
52597
52648
  const load = useCallback63(
52598
52649
  async (want) => {
52599
52650
  const answered = await client.interfaceRead({ interface_id: want });
@@ -52610,10 +52661,10 @@ function InterfaceScreen({
52610
52661
  },
52611
52662
  [client]
52612
52663
  );
52613
- useEffect120(() => {
52664
+ useEffect121(() => {
52614
52665
  if (interfaceId) void load(interfaceId);
52615
52666
  }, [interfaceId, load]);
52616
- useEffect120(() => {
52667
+ useEffect121(() => {
52617
52668
  if (!newOnTable || interfaceId || making !== "waiting") return;
52618
52669
  setMaking("making");
52619
52670
  const shape2 = newInterfaceShape(newOnTable);
@@ -52636,7 +52687,7 @@ function InterfaceScreen({
52636
52687
  const charts = useMemo80(() => shape ? interfaceCharts(shape) : [], [shape]);
52637
52688
  const through = !!read && !read.member;
52638
52689
  const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
52639
- useEffect120(() => {
52690
+ useEffect121(() => {
52640
52691
  if (!read || through || charts.length === 0) {
52641
52692
  setRun(null);
52642
52693
  return;
@@ -52870,7 +52921,7 @@ function InterfaceScreen({
52870
52921
 
52871
52922
  // src/FormsPanel.tsx
52872
52923
  import { copyText as copyText10 } from "@ai-matrx/kit/clipboard";
52873
- import { useCallback as useCallback64, useEffect as useEffect121, useState as useState141 } from "react";
52924
+ import { useCallback as useCallback64, useEffect as useEffect122, useState as useState141 } from "react";
52874
52925
  import { useRecordsClient as useRecordsClient101, useTable as useTable37 } from "@ai-matrx/records/react";
52875
52926
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
52876
52927
  import { Badge as Badge25, Button as Button111, Skeleton as Skeleton43, cn as cn96 } from "@ai-matrx/design-system";
@@ -52896,7 +52947,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
52896
52947
  const [archivedSaid, setArchivedSaid] = useState141(null);
52897
52948
  const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
52898
52949
  const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
52899
- useEffect121(() => {
52950
+ useEffect122(() => {
52900
52951
  if (linked && rights.structure) setBuilding(true);
52901
52952
  }, [linked, rights.structure]);
52902
52953
  const load = useCallback64(async () => {
@@ -52909,7 +52960,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
52909
52960
  setError(null);
52910
52961
  setForms(answered.data);
52911
52962
  }, [client, tableId]);
52912
- useEffect121(() => {
52963
+ useEffect122(() => {
52913
52964
  void load();
52914
52965
  }, [load]);
52915
52966
  const toggle = useCallback64(
@@ -53054,12 +53105,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
53054
53105
  }
53055
53106
 
53056
53107
  // src/CaptureSheet.tsx
53057
- import { useCallback as useCallback66, useEffect as useEffect123, useRef as useRef66, useState as useState143 } from "react";
53108
+ import { useCallback as useCallback66, useEffect as useEffect124, useRef as useRef67, useState as useState143 } from "react";
53058
53109
  import { useFields as useFields36, useRecordsClient as useRecordsClient103, useTable as useTable38 } from "@ai-matrx/records/react";
53059
53110
  import { Button as Button113, Input as Input9, Skeleton as Skeleton45, Textarea as Textarea8, cn as cn98 } from "@ai-matrx/design-system";
53060
53111
 
53061
53112
  // src/CaptureRun.tsx
53062
- import { useCallback as useCallback65, useEffect as useEffect122, useMemo as useMemo81, useRef as useRef65, useState as useState142 } from "react";
53113
+ import { useCallback as useCallback65, useEffect as useEffect123, useMemo as useMemo81, useRef as useRef66, useState as useState142 } from "react";
53063
53114
  import {
53064
53115
  coerceTypedAnswer as coerceTypedAnswer3,
53065
53116
  coercionLabel,
@@ -53117,8 +53168,8 @@ function CaptureRun({ sheetId, face: given, className }) {
53117
53168
  const [items, setItems] = useState142([]);
53118
53169
  const [lastSynced, setLastSynced] = useState142(null);
53119
53170
  const [sending, setSending] = useState142(false);
53120
- const queueRef = useRef65(null);
53121
- useEffect122(() => {
53171
+ const queueRef = useRef66(null);
53172
+ useEffect123(() => {
53122
53173
  const q2 = openCaptureQueue({
53123
53174
  onChange: (c, all) => {
53124
53175
  setCounts(c);
@@ -53156,7 +53207,7 @@ function CaptureRun({ sheetId, face: given, className }) {
53156
53207
  void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
53157
53208
  return () => q2.dispose();
53158
53209
  }, [client, host]);
53159
- useEffect122(() => {
53210
+ useEffect123(() => {
53160
53211
  if (given !== void 0) return;
53161
53212
  let cancelled = false;
53162
53213
  void client.captureOpen({ sheet_id: sheetId }).then((res) => {
@@ -53497,7 +53548,7 @@ function AdHocCaptureSheet({
53497
53548
  const [error, setError] = useState143(null);
53498
53549
  const [uploadError, setUploadError] = useState143(null);
53499
53550
  const [flushing, setFlushing] = useState143(false);
53500
- const queue = useRef66([]);
53551
+ const queue = useRef67([]);
53501
53552
  const keep = useCallback66(
53502
53553
  async (next) => {
53503
53554
  queue.current = next;
@@ -53506,7 +53557,7 @@ function AdHocCaptureSheet({
53506
53557
  },
53507
53558
  [host]
53508
53559
  );
53509
- useEffect123(() => {
53560
+ useEffect124(() => {
53510
53561
  let cancelled = false;
53511
53562
  void (async () => {
53512
53563
  const held = host.captureQueue ? await host.captureQueue.load() : [];
@@ -53685,7 +53736,7 @@ function AdHocCaptureSheet({
53685
53736
  }
53686
53737
 
53687
53738
  // src/PortalShell.tsx
53688
- import { useCallback as useCallback67, useEffect as useEffect124, useState as useState144 } from "react";
53739
+ import { useCallback as useCallback67, useEffect as useEffect125, useState as useState144 } from "react";
53689
53740
  import { useRecordsClient as useRecordsClient104 } from "@ai-matrx/records/react";
53690
53741
  import { Button as Button114, Skeleton as Skeleton46, cn as cn99 } from "@ai-matrx/design-system";
53691
53742
  import { jsx as jsx170, jsxs as jsxs158 } from "react/jsx-runtime";
@@ -53711,7 +53762,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
53711
53762
  }
53712
53763
  setReach(reached.data.map((row) => row.resource_id));
53713
53764
  }, [client, resourceType]);
53714
- useEffect124(() => {
53765
+ useEffect125(() => {
53715
53766
  void load();
53716
53767
  }, [load]);
53717
53768
  if (error) {
@@ -53771,7 +53822,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
53771
53822
  function PortalRow({ tableId, recordId }) {
53772
53823
  const client = useRecordsClient104();
53773
53824
  const [title, setTitle] = useState144(null);
53774
- useEffect124(() => {
53825
+ useEffect125(() => {
53775
53826
  let cancelled = false;
53776
53827
  void client.recordRead({ record_id: recordId }).then((answered) => {
53777
53828
  if (cancelled) return;
@@ -53791,7 +53842,7 @@ function PortalRow({ tableId, recordId }) {
53791
53842
  }
53792
53843
 
53793
53844
  // src/PublicViewPage.tsx
53794
- import { useCallback as useCallback68, useEffect as useEffect125, useState as useState145 } from "react";
53845
+ import { useCallback as useCallback68, useEffect as useEffect126, useState as useState145 } from "react";
53795
53846
  import { useRecordsClient as useRecordsClient105 } from "@ai-matrx/records/react";
53796
53847
  import { Skeleton as Skeleton47, cn as cn100 } from "@ai-matrx/design-system";
53797
53848
  import { publicReadOf } from "@ai-matrx/records/forms";
@@ -53854,7 +53905,7 @@ function PublicViewPage({ slug, className }) {
53854
53905
  }
53855
53906
  setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
53856
53907
  }, [client, slug]);
53857
- useEffect125(() => {
53908
+ useEffect126(() => {
53858
53909
  void load();
53859
53910
  }, [load]);
53860
53911
  if (error) return /* @__PURE__ */ jsx171(RefusalNotice, { error, className });
@@ -53892,7 +53943,7 @@ function PublicRow({ row, fields }) {
53892
53943
 
53893
53944
  // src/EmbedFrame.tsx
53894
53945
  import { copyText as copyText11 } from "@ai-matrx/kit/clipboard";
53895
- import { useCallback as useCallback69, useEffect as useEffect126, useState as useState146 } from "react";
53946
+ import { useCallback as useCallback69, useEffect as useEffect127, useState as useState146 } from "react";
53896
53947
  import { useRecordsClient as useRecordsClient106 } from "@ai-matrx/records/react";
53897
53948
  import { Button as Button115, Input as Input10, Skeleton as Skeleton48, Textarea as Textarea9, cn as cn101 } from "@ai-matrx/design-system";
53898
53949
  import { useTable as useTable39 } from "@ai-matrx/records/react";
@@ -54005,7 +54056,7 @@ function useEmbedHandshake(args) {
54005
54056
  const [loading, setLoading] = useState146(true);
54006
54057
  const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
54007
54058
  const { secret, requiredMode } = args;
54008
- useEffect126(() => {
54059
+ useEffect127(() => {
54009
54060
  let cancelled = false;
54010
54061
  setLoading(true);
54011
54062
  setError(null);
@@ -54028,7 +54079,7 @@ function useEmbedHandshake(args) {
54028
54079
 
54029
54080
  // src/TablePage.tsx
54030
54081
  import { copyText as copyText15 } from "@ai-matrx/kit/clipboard";
54031
- import { useCallback as useCallback71, useEffect as useEffect130, useMemo as useMemo85, useRef as useRef67, useState as useState155 } from "react";
54082
+ import { useCallback as useCallback71, useEffect as useEffect131, useMemo as useMemo85, useRef as useRef68, useState as useState155 } from "react";
54032
54083
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
54033
54084
  import { tableShapeChanged as tableShapeChanged15, useFields as useFields39, useRecordsClient as useRecordsClient108, useSeededAnswer, useTable as useTable40, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
54034
54085
  import {
@@ -54293,7 +54344,7 @@ async function runTablePageAction(kind2, args) {
54293
54344
  }
54294
54345
 
54295
54346
  // src/GridShortcutsHelp.tsx
54296
- import { useEffect as useEffect127, useState as useState148 } from "react";
54347
+ import { useEffect as useEffect128, useState as useState148 } from "react";
54297
54348
  import { Dialog as Dialog19, DialogContent as DialogContent19, DialogHeader as DialogHeader19, DialogTitle as DialogTitle19 } from "@ai-matrx/design-system";
54298
54349
 
54299
54350
  // src/gridShortcuts.ts
@@ -54363,7 +54414,7 @@ function asksShortcutHelp(event) {
54363
54414
  }
54364
54415
  function GridShortcutsHelp() {
54365
54416
  const [open, setOpen] = useState148(false);
54366
- useEffect127(() => {
54417
+ useEffect128(() => {
54367
54418
  const onKey = (event) => {
54368
54419
  if (!asksShortcutHelp(event)) return;
54369
54420
  event.preventDefault();
@@ -54739,7 +54790,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
54739
54790
  }
54740
54791
 
54741
54792
  // src/ViewFilter.tsx
54742
- import { useEffect as useEffect128, useMemo as useMemo84, useState as useState153 } from "react";
54793
+ import { useEffect as useEffect129, useMemo as useMemo84, useState as useState153 } from "react";
54743
54794
  import { Button as Button121, Popover as Popover19, PopoverContent as PopoverContent19, PopoverTrigger as PopoverTrigger19 } from "@ai-matrx/design-system";
54744
54795
  import { useFields as useFields38, useOptionalRecordsClient as useOptionalRecordsClient23 } from "@ai-matrx/records/react";
54745
54796
  import { jsx as jsx179, jsxs as jsxs167 } from "react/jsx-runtime";
@@ -54757,7 +54808,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
54757
54808
  const saved = view?.where ?? null;
54758
54809
  const [draft, setDraft] = useState153(saved);
54759
54810
  const savedKey = JSON.stringify(saved);
54760
- useEffect128(() => {
54811
+ useEffect129(() => {
54761
54812
  setDraft(saved);
54762
54813
  }, [view?.id, savedKey]);
54763
54814
  const client = useOptionalRecordsClient23();
@@ -54766,7 +54817,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
54766
54817
  [fields.data]
54767
54818
  );
54768
54819
  const [linkedFields, setLinkedFields] = useState153({});
54769
- useEffect128(() => {
54820
+ useEffect129(() => {
54770
54821
  if (!open || !client) return;
54771
54822
  let cancelled = false;
54772
54823
  for (const rel of relations) {
@@ -54961,7 +55012,7 @@ function phoneTableActions(actions) {
54961
55012
  }
54962
55013
 
54963
55014
  // src/toolbarFit.ts
54964
- import { useEffect as useEffect129, useLayoutEffect as useLayoutEffect6, useState as useState154 } from "react";
55015
+ import { useEffect as useEffect130, useLayoutEffect as useLayoutEffect6, useState as useState154 } from "react";
54965
55016
  function widthAtFold(piece, fold) {
54966
55017
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
54967
55018
  const w = piece.byFold?.[f];
@@ -55052,7 +55103,7 @@ function createFitMemory() {
55052
55103
  }
55053
55104
  };
55054
55105
  }
55055
- var useIsoLayoutEffect = typeof window === "undefined" ? useEffect129 : useLayoutEffect6;
55106
+ var useIsoLayoutEffect = typeof window === "undefined" ? useEffect130 : useLayoutEffect6;
55056
55107
  function useToolbarFit(row) {
55057
55108
  const [fold, setFold] = useState154(0);
55058
55109
  useIsoLayoutEffect(() => {
@@ -55129,7 +55180,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
55129
55180
  }
55130
55181
  function useSlotScroll(slot) {
55131
55182
  const [ends, setEnds] = useState154("none");
55132
- useEffect129(() => {
55183
+ useEffect130(() => {
55133
55184
  if (!slot) return;
55134
55185
  let pending = 0;
55135
55186
  const read = () => {
@@ -55267,7 +55318,7 @@ function TableNotHere({
55267
55318
  const [archived, setArchived] = useState155({ phase: "asking" });
55268
55319
  const [restoring, setRestoring] = useState155(false);
55269
55320
  const [refusal3, setRefusal] = useState155(null);
55270
- useEffect130(() => {
55321
+ useEffect131(() => {
55271
55322
  let alive = true;
55272
55323
  void client.tableArchived({ table_id: tableId }).then((answered) => {
55273
55324
  if (!alive) return;
@@ -55489,8 +55540,8 @@ function TablePage({
55489
55540
  return seededViews.find((v) => v.id === asked4) ?? defaultViewOf(seededViews) ?? seededViews[0];
55490
55541
  });
55491
55542
  const [looks, setLooks] = useState155(() => seededViews ? seededOpening?.looks : void 0);
55492
- const looksSeededFor = useRef67(seededViews && seededOpening ? tableId : null);
55493
- useEffect130(() => {
55543
+ const looksSeededFor = useRef68(seededViews && seededOpening ? tableId : null);
55544
+ useEffect131(() => {
55494
55545
  if (looksSeededFor.current === tableId) {
55495
55546
  looksSeededFor.current = null;
55496
55547
  return;
@@ -55516,7 +55567,7 @@ function TablePage({
55516
55567
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : openedByPackage;
55517
55568
  const [views, setViews] = useState155(() => seededViews);
55518
55569
  const [pickedViewId, setPickedViewId] = useState155(savedFromLink);
55519
- const viewSeen = useRef67(null);
55570
+ const viewSeen = useRef68(null);
55520
55571
  const [viewLinkMissed, setViewLinkMissed] = useState155(false);
55521
55572
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
55522
55573
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
@@ -55539,7 +55590,7 @@ function TablePage({
55539
55590
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
55540
55591
  const [archiveAsked, setArchiveAsked] = useState155(0);
55541
55592
  const pageArchive = useTableArchive2(tableId);
55542
- const archiveRunning = useRef67(false);
55593
+ const archiveRunning = useRef68(false);
55543
55594
  const archiveFromMenu = useCallback71(async () => {
55544
55595
  if (archiveRunning.current) return;
55545
55596
  archiveRunning.current = true;
@@ -55602,7 +55653,7 @@ function TablePage({
55602
55653
  const skeletonFace = skeletonLayoutFor(
55603
55654
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
55604
55655
  );
55605
- useEffect130(() => {
55656
+ useEffect131(() => {
55606
55657
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
55607
55658
  rememberLayout(tableId, shownLayout);
55608
55659
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -55620,9 +55671,9 @@ function TablePage({
55620
55671
  lookDiffers: view ? lookDiffers(view, look) : false
55621
55672
  };
55622
55673
  const shownSignature = JSON.stringify(shownReport);
55623
- const reportRef = useRef67(onShownViewChange);
55674
+ const reportRef = useRef68(onShownViewChange);
55624
55675
  reportRef.current = onShownViewChange;
55625
- useEffect130(() => {
55676
+ useEffect131(() => {
55626
55677
  reportRef.current?.(JSON.parse(shownSignature));
55627
55678
  }, [shownSignature]);
55628
55679
  const pickLayout = (next) => {
@@ -55631,9 +55682,9 @@ function TablePage({
55631
55682
  onViewChanged?.(addressForView(view, next));
55632
55683
  void patchView({ layout: next });
55633
55684
  };
55634
- const reportedRecords = useRef67(/* @__PURE__ */ new Set());
55635
- const lastActiveRecord = useRef67(activeRecordId ?? null);
55636
- useEffect130(() => {
55685
+ const reportedRecords = useRef68(/* @__PURE__ */ new Set());
55686
+ const lastActiveRecord = useRef68(activeRecordId ?? null);
55687
+ useEffect131(() => {
55637
55688
  const before = lastActiveRecord.current;
55638
55689
  lastActiveRecord.current = activeRecordId ?? null;
55639
55690
  if (!activeRecordId) {
@@ -55651,21 +55702,21 @@ function TablePage({
55651
55702
  );
55652
55703
  const [recordExpanded, setRecordExpanded] = useState155(false);
55653
55704
  const shownRecord = rail === "record" ? openRecord : null;
55654
- const reportedRecord = useRef67(activeRecordId ?? null);
55655
- useEffect130(() => {
55705
+ const reportedRecord = useRef68(activeRecordId ?? null);
55706
+ useEffect131(() => {
55656
55707
  if (shownRecord === reportedRecord.current) return;
55657
55708
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
55658
55709
  reportedRecord.current = shownRecord;
55659
55710
  if (shownRecord) reportedRecords.current.add(shownRecord);
55660
55711
  onRecordChange?.(shownRecord, how);
55661
55712
  }, [shownRecord, onRecordChange]);
55662
- useEffect130(() => {
55713
+ useEffect131(() => {
55663
55714
  if (activeRecordId) return;
55664
55715
  const named = railFromParam(activeRail);
55665
55716
  if (named === null || named === "share") return;
55666
55717
  setSurface((now) => ({ ...now, rail: named }));
55667
55718
  }, [activeRail, activeRecordId]);
55668
- useEffect130(() => {
55719
+ useEffect131(() => {
55669
55720
  const named = pageViewFromParam(activeView);
55670
55721
  if (named === null) return;
55671
55722
  const isLayout = named !== "dashboards" && named !== "archived";
@@ -55706,7 +55757,7 @@ function TablePage({
55706
55757
  },
55707
55758
  [client, tableId, view, looks, viewLocked, sayLocked]
55708
55759
  );
55709
- const arrival = useRef67(viewAddress ?? null);
55760
+ const arrival = useRef68(viewAddress ?? null);
55710
55761
  const [gridQuery, setGridQuery] = useState155(null);
55711
55762
  const [addressResetEpoch, setAddressResetEpoch] = useState155(0);
55712
55763
  const reportGrid = useCallback71((q) => {
@@ -55717,8 +55768,8 @@ function TablePage({
55717
55768
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
55718
55769
  [reportGrid, addressResetEpoch]
55719
55770
  );
55720
- const hiddenApplied = useRef67(false);
55721
- useEffect130(() => {
55771
+ const hiddenApplied = useRef68(false);
55772
+ useEffect131(() => {
55722
55773
  const hidden = arrival.current?.hidden;
55723
55774
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
55724
55775
  hiddenApplied.current = true;
@@ -55738,10 +55789,10 @@ function TablePage({
55738
55789
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
55739
55790
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
55740
55791
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
55741
- const addressReportRef = useRef67(onViewAddressChange);
55792
+ const addressReportRef = useRef68(onViewAddressChange);
55742
55793
  addressReportRef.current = onViewAddressChange;
55743
- const addressSent = useRef67(null);
55744
- useEffect130(() => {
55794
+ const addressSent = useRef68(null);
55795
+ useEffect131(() => {
55745
55796
  if (!addressReady) return;
55746
55797
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
55747
55798
  addressSent.current = addressSignature;
@@ -56056,14 +56107,14 @@ function TablePage({
56056
56107
  }
56057
56108
  });
56058
56109
  const openedEntry = ACTION_PRESS.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? ACTION_PRESS.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
56059
- const actionsRef = useRef67(actions);
56110
+ const actionsRef = useRef68(actions);
56060
56111
  actionsRef.current = actions;
56061
- const onActionsRef = useRef67(onActions);
56112
+ const onActionsRef = useRef68(onActions);
56062
56113
  onActionsRef.current = onActions;
56063
- useEffect130(() => {
56114
+ useEffect131(() => {
56064
56115
  onActionsRef.current?.(actionsRef.current);
56065
56116
  });
56066
- useEffect130(() => {
56117
+ useEffect131(() => {
56067
56118
  const onKey = (event) => {
56068
56119
  const asked4 = objectActionForKey(actionsRef.current, event);
56069
56120
  if (!asked4) return;
@@ -56648,7 +56699,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
56648
56699
  const readOnly = rights.known && rights.read && !rights.write;
56649
56700
  const marked = table?.published_to_web;
56650
56701
  const [isPublic, setIsPublic] = useState155(false);
56651
- useEffect130(() => {
56702
+ useEffect131(() => {
56652
56703
  if (!readOnly || !table) {
56653
56704
  setIsPublic(false);
56654
56705
  return;
@@ -56674,7 +56725,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
56674
56725
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
56675
56726
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
56676
56727
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
56677
- import { useEffect as useEffect131, useMemo as useMemo86, useRef as useRef68, useState as useState156 } from "react";
56728
+ import { useEffect as useEffect132, useMemo as useMemo86, useRef as useRef69, useState as useState156 } from "react";
56678
56729
  import { Button as Button123, ErrorBox as ErrorBox9, Input as Input13, cn as cn104 } from "@ai-matrx/design-system";
56679
56730
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient109, useSeededAnswerAt } from "@ai-matrx/records/react";
56680
56731
  import { Fragment as Fragment76, jsx as jsx182, jsxs as jsxs170 } from "react/jsx-runtime";
@@ -56781,8 +56832,8 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
56781
56832
  const base2 = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
56782
56833
  const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
56783
56834
  const [block, setBlock] = useState156(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
56784
- const seededFor = useRef68(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
56785
- useEffect131(() => {
56835
+ const seededFor = useRef69(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
56836
+ useEffect132(() => {
56786
56837
  const held = seededFor.current;
56787
56838
  if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
56788
56839
  seededFor.current = null;
@@ -56831,7 +56882,7 @@ function EntityTablePageBody({
56831
56882
  const term = searchOverride ?? typed2;
56832
56883
  const entity = useEntityTable(source.token, { pageSize, search: term });
56833
56884
  const [layout, setLayout] = useState156(opened);
56834
- useEffect131(() => setLayout(opened), [opened]);
56885
+ useEffect132(() => setLayout(opened), [opened]);
56835
56886
  const choose = (next) => {
56836
56887
  setLayout(next);
56837
56888
  onLayoutChange?.(next);
@@ -56957,7 +57008,7 @@ function TablePage2(props) {
56957
57008
  }
56958
57009
 
56959
57010
  // src/DataBindingPicker.tsx
56960
- import { useEffect as useEffect132, useMemo as useMemo87 } from "react";
57011
+ import { useEffect as useEffect133, useMemo as useMemo87 } from "react";
56961
57012
  import { isEntityReferenceConfig } from "@ai-matrx/records";
56962
57013
  import { useFields as useFields40, useTable as useTable41 } from "@ai-matrx/records/react";
56963
57014
  import { BasicInput as BasicInput38, Button as Button124, CreatablePicker as CreatablePicker3, cn as cn105 } from "@ai-matrx/design-system";
@@ -57053,7 +57104,7 @@ function BindingDetails({
57053
57104
  const fields = useFields40(tableId);
57054
57105
  const fieldList = useMemo87(() => fields.data ?? [], [fields.data]);
57055
57106
  const shape = binding.semantic_type;
57056
- useEffect132(() => {
57107
+ useEffect133(() => {
57057
57108
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
57058
57109
  onChange({
57059
57110
  ...binding,
@@ -57275,7 +57326,7 @@ function RecordNameWords({ tableId, recordId }) {
57275
57326
  }
57276
57327
 
57277
57328
  // src/HeldChangeDecision.tsx
57278
- import { useEffect as useEffect133, useState as useState157 } from "react";
57329
+ import { useEffect as useEffect134, useState as useState157 } from "react";
57279
57330
  import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient110 } from "@ai-matrx/records/react";
57280
57331
  import { Button as Button125 } from "@ai-matrx/design-system";
57281
57332
  import { jsx as jsx186, jsxs as jsxs173 } from "react/jsx-runtime";
@@ -57291,7 +57342,7 @@ function Decision({
57291
57342
  const [may, setMay] = useState157(null);
57292
57343
  const [busy, setBusy] = useState157(null);
57293
57344
  const [error, setError] = useState157(null);
57294
- useEffect133(() => {
57345
+ useEffect134(() => {
57295
57346
  let live = true;
57296
57347
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
57297
57348
  if (!live) return;
@@ -57324,7 +57375,7 @@ function Decision({
57324
57375
  }
57325
57376
 
57326
57377
  // src/CalendarLinks.tsx
57327
- import { useCallback as useCallback72, useEffect as useEffect134, useState as useState158 } from "react";
57378
+ import { useCallback as useCallback72, useEffect as useEffect135, useState as useState158 } from "react";
57328
57379
  import { Button as Button126 } from "@ai-matrx/design-system";
57329
57380
  import { jsx as jsx187, jsxs as jsxs174 } from "react/jsx-runtime";
57330
57381
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
@@ -57340,7 +57391,7 @@ function CalendarLinks({ port }) {
57340
57391
  setError(asRefusal3(e, "The links could not be read"));
57341
57392
  }
57342
57393
  }, [port]);
57343
- useEffect134(() => {
57394
+ useEffect135(() => {
57344
57395
  void load();
57345
57396
  }, [load]);
57346
57397
  const act = async (run) => {
@@ -57405,7 +57456,7 @@ function CalendarLinks({ port }) {
57405
57456
  }
57406
57457
 
57407
57458
  // src/TemplatePreview.tsx
57408
- import { useEffect as useEffect135, useMemo as useMemo88, useState as useState159 } from "react";
57459
+ import { useEffect as useEffect136, useMemo as useMemo88, useState as useState159 } from "react";
57409
57460
  import { templatePreview } from "@ai-matrx/records/memory";
57410
57461
  import { useRecordsClient as useRecordsClient111 } from "@ai-matrx/records/react";
57411
57462
  import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
@@ -57457,7 +57508,7 @@ function PreviewForms({ preview, booking }) {
57457
57508
  const client = useRecordsClient111();
57458
57509
  const [forms, setForms] = useState159(null);
57459
57510
  const [pages, setPages] = useState159([]);
57460
- useEffect135(() => {
57511
+ useEffect136(() => {
57461
57512
  let gone = false;
57462
57513
  void client.forms().then((answered) => {
57463
57514
  if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);