@ai-matrx/records-ui 0.116.7 → 0.116.8

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
@@ -2547,13 +2547,17 @@ function OpenCell({
2547
2547
  {
2548
2548
  ref: host,
2549
2549
  "data-matrx-cell-control": "",
2550
- ...widens ? { "data-matrx-cell-widens": "" } : { "data-matrx-cell-fill": "" },
2550
+ ...widens ? { "data-matrx-cell-widens": "" } : multiline ? { "data-matrx-cell-widens": "", "data-matrx-cell-fill": "", "data-records-cell-multiline": "" } : { "data-matrx-cell-fill": "" },
2551
2551
  style: wideTo ? { width: wideTo, minWidth: wideTo, maxWidth: "28rem", right: "auto" } : void 0,
2552
2552
  "data-matrx-cell-editor": "",
2553
2553
  tabIndex: -1,
2554
2554
  className: cn(
2555
2555
  // OVER the cell's ghost (see `data-records-open-cell`), never in the table's measuring.
2556
- "absolute inset-x-0 top-1/2 z-[25] flex w-full min-w-0 max-w-full -translate-y-1/2 flex-col gap-1 outline-none",
2556
+ "absolute inset-x-0 z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
2557
+ // A one-line control sits centred on the row; a multi-line box hangs from the cell's top and
2558
+ // grows downward over the rows below (Airtable's expanded long-text cell), never up over the
2559
+ // header (D10: centred, its first lines sat 58px above the cell, outside it).
2560
+ multiline ? "top-0 rounded-md bg-card shadow-md" : "top-1/2 -translate-y-1/2",
2557
2561
  // A box reaching over the next column is opaque, so what it covers never shows through it
2558
2562
  // (the calendar button sat over the Actions cell's copy icon, both drawn).
2559
2563
  widens && "rounded-md bg-card shadow-sm",
@@ -14174,7 +14178,7 @@ import { Button as Button44 } from "@ai-matrx/design-system";
14174
14178
  import { useFields as useFields15, useOptionalRecordsClient as useOptionalRecordsClient2, useTable as useTable16 } from "@ai-matrx/records/react";
14175
14179
 
14176
14180
  // src/RecordPanel.tsx
14177
- import { Fragment as Fragment24, useState as useState51 } from "react";
14181
+ import { Fragment as Fragment24, useEffect as useEffect45, useRef as useRef26, useState as useState51 } from "react";
14178
14182
  import { Separator as Separator6 } from "@ai-matrx/design-system";
14179
14183
  import { useFields as useFields14, useRecord as useRecord5 } from "@ai-matrx/records/react";
14180
14184
 
@@ -17196,9 +17200,17 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
17196
17200
  const [asking, setAsking] = useState51(null);
17197
17201
  const record = useRecord5(recordId, true, { tableId });
17198
17202
  const answered = Boolean(record.data) && !record.error;
17203
+ const panelRef = useRef26(null);
17204
+ useEffect45(() => {
17205
+ if (onPage) return;
17206
+ const panel = panelRef.current;
17207
+ if (!panel || panel.contains(document.activeElement)) return;
17208
+ panel.focus({ preventScroll: true });
17209
+ }, [recordId, onPage]);
17199
17210
  return /* @__PURE__ */ jsxs52(
17200
17211
  "div",
17201
17212
  {
17213
+ ref: panelRef,
17202
17214
  className: "space-y-3 outline-none",
17203
17215
  tabIndex: -1,
17204
17216
  "data-record-panel": recordId,
@@ -17570,7 +17582,7 @@ function ConnectedRecordsTableCard({
17570
17582
  // src/ExportMenu.tsx
17571
17583
  import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
17572
17584
  import { downloadFile } from "@ai-matrx/kit/download";
17573
- import { useEffect as useEffect45, useState as useState53 } from "react";
17585
+ import { useEffect as useEffect46, useState as useState53 } from "react";
17574
17586
  import { useFields as useFields16, useRecords as useRecords4, useRecordsClient as useRecordsClient46, useTable as useTable17 } from "@ai-matrx/records/react";
17575
17587
  import { exportCsv, exportMarkdown, exportXlsx, wholeValueOf as wholeValueOf4, withWholeValues } from "@ai-matrx/records/core";
17576
17588
 
@@ -17685,7 +17697,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
17685
17697
  const page = useRecords4(view ? null : tableId, { pageSize: 500 });
17686
17698
  const viewKey = view ? JSON.stringify([view.filter ?? null, view.sorts ?? [], view.viewId ?? null]) : "";
17687
17699
  const [viewRead, setViewRead] = useState53(null);
17688
- useEffect45(() => {
17700
+ useEffect46(() => {
17689
17701
  if (!view || !fields.data) return;
17690
17702
  let live = true;
17691
17703
  void readViewRows(client, tableId, fields.data, view).then((read) => {
@@ -17818,7 +17830,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
17818
17830
  }
17819
17831
 
17820
17832
  // src/ImportNotice.tsx
17821
- import { useCallback as useCallback27, useEffect as useEffect46, useMemo as useMemo33, useState as useState54 } from "react";
17833
+ import { useCallback as useCallback27, useEffect as useEffect47, useMemo as useMemo33, useState as useState54 } from "react";
17822
17834
  import { useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
17823
17835
  import { Button as Button46, cn as cn24 } from "@ai-matrx/design-system";
17824
17836
  import { jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
@@ -17849,7 +17861,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
17849
17861
  const [problem, setProblem] = useState54(null);
17850
17862
  const [report, setReport] = useState54(null);
17851
17863
  const [dismissed, setDismissed] = useState54(null);
17852
- useEffect46(() => {
17864
+ useEffect47(() => {
17853
17865
  let live = true;
17854
17866
  void client.imports({ table_id: tableId, limit: 5 }).then((answered) => {
17855
17867
  if (!live) return;
@@ -17864,7 +17876,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
17864
17876
  }, [client, tableId, epoch]);
17865
17877
  const run = useMemo33(() => runs ? runToNotice(runs) : null, [runs]);
17866
17878
  const shown4 = run && !wasDismissed(run.import_id) && dismissed !== run.import_id ? run : null;
17867
- useEffect46(() => {
17879
+ useEffect47(() => {
17868
17880
  if (!shown4 || report?.import_id === shown4.import_id) return;
17869
17881
  let live = true;
17870
17882
  void client.importReport({ import_id: shown4.import_id, state: "refused", limit: 500 }).then((answered) => {
@@ -17922,7 +17934,7 @@ function ImportNotice({ tableId, onOpenImport, epoch = 0, className }) {
17922
17934
  }
17923
17935
 
17924
17936
  // src/StageRules.tsx
17925
- import { useCallback as useCallback28, useEffect as useEffect47, useMemo as useMemo34, useState as useState55 } from "react";
17937
+ import { useCallback as useCallback28, useEffect as useEffect48, useMemo as useMemo34, useState as useState55 } from "react";
17926
17938
  import { useFields as useFields17, useRecordsClient as useRecordsClient48, useTable as useTable18 } from "@ai-matrx/records/react";
17927
17939
  import { BasicInput as BasicInput5, BasicTextarea as BasicTextarea4, Button as Button47, Separator as Separator7, Skeleton as Skeleton13, cn as cn25 } from "@ai-matrx/design-system";
17928
17940
  import { Select as Select4 } from "@ai-matrx/design-system/controls";
@@ -17978,7 +17990,7 @@ function StageRulesSection({ tableId, stage, className }) {
17978
17990
  if (mode.ok) setEnforcement(mode.data);
17979
17991
  setAsked(true);
17980
17992
  }, [client, tableId]);
17981
- useEffect47(() => {
17993
+ useEffect48(() => {
17982
17994
  void load();
17983
17995
  }, [load]);
17984
17996
  const stages = pipeline?.stages ?? [];
@@ -17989,7 +18001,7 @@ function StageRulesSection({ tableId, stage, className }) {
17989
18001
  () => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
17990
18002
  [fields.data]
17991
18003
  );
17992
- useEffect47(() => {
18004
+ useEffect48(() => {
17993
18005
  if (!draft || !stageKey || !draft.demands || Object.keys(draft.demands).length === 0) {
17994
18006
  setPreview(null);
17995
18007
  setPreviewError(null);
@@ -18209,7 +18221,7 @@ function Clause({
18209
18221
  }
18210
18222
 
18211
18223
  // src/TableRename.tsx
18212
- import { useCallback as useCallback29, useEffect as useEffect48, useRef as useRef26, useState as useState56 } from "react";
18224
+ import { useCallback as useCallback29, useEffect as useEffect49, useRef as useRef27, useState as useState56 } from "react";
18213
18225
  import { tableShapeChanged as tableShapeChanged5, useRecordsClient as useRecordsClient49 } from "@ai-matrx/records/react";
18214
18226
  import {
18215
18227
  Button as Button48,
@@ -18231,7 +18243,7 @@ function tableNameProblem(typed2) {
18231
18243
  }
18232
18244
  function useRenameFromMenu() {
18233
18245
  const [open, setOpen] = useState56(false);
18234
- const asked2 = useRef26(false);
18246
+ const asked2 = useRef27(false);
18235
18247
  const ask2 = useCallback29(() => {
18236
18248
  asked2.current = true;
18237
18249
  window.setTimeout(() => setOpen(true), 0);
@@ -18257,9 +18269,9 @@ function TableRenameDialog({
18257
18269
  const [typed2, setTyped] = useState56(name);
18258
18270
  const [busy, setBusy] = useState56(false);
18259
18271
  const [refused, setRefused] = useState56(null);
18260
- const box = useRef26(null);
18261
- const openedAt = useRef26(null);
18262
- useEffect48(() => {
18272
+ const box = useRef27(null);
18273
+ const openedAt = useRef27(null);
18274
+ useEffect49(() => {
18263
18275
  if (!open) return;
18264
18276
  openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
18265
18277
  setTyped(name);
@@ -18350,7 +18362,7 @@ function TableRenameDialog({
18350
18362
  }
18351
18363
 
18352
18364
  // src/TableSettings.tsx
18353
- import { useEffect as useEffect52, useMemo as useMemo37, useRef as useRef27, useState as useState61 } from "react";
18365
+ import { useEffect as useEffect53, useMemo as useMemo37, useRef as useRef28, useState as useState61 } from "react";
18354
18366
  import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
18355
18367
 
18356
18368
  // src/ArchiveDeliberately.tsx
@@ -18480,7 +18492,7 @@ function announceTableArchived({ notify, client, tableId, name, onRestored }) {
18480
18492
  }
18481
18493
 
18482
18494
  // src/TableFoundation.tsx
18483
- import { useEffect as useEffect49, useState as useState58 } from "react";
18495
+ import { useEffect as useEffect50, useState as useState58 } from "react";
18484
18496
  import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
18485
18497
  import { Switch as Switch3 } from "@ai-matrx/design-system";
18486
18498
  import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
@@ -18493,7 +18505,7 @@ function TableFoundationSwitch({ tableId, table }) {
18493
18505
  const [pending, setPending] = useState58(null);
18494
18506
  const [refused, setRefused] = useState58(null);
18495
18507
  const on = pending ?? stored;
18496
- useEffect49(() => {
18508
+ useEffect50(() => {
18497
18509
  if (pending !== null && stored === pending) setPending(null);
18498
18510
  }, [stored, pending]);
18499
18511
  const change = async (next) => {
@@ -18531,7 +18543,7 @@ function TableFoundationSwitch({ tableId, table }) {
18531
18543
  }
18532
18544
 
18533
18545
  // src/TableAccessLevel.tsx
18534
- import { useCallback as useCallback30, useEffect as useEffect50, useMemo as useMemo35, useState as useState59 } from "react";
18546
+ import { useCallback as useCallback30, useEffect as useEffect51, useMemo as useMemo35, useState as useState59 } from "react";
18535
18547
  import { tableShapeChanged as tableShapeChanged7, useRecordsClient as useRecordsClient52 } from "@ai-matrx/records/react";
18536
18548
  import { Badge as Badge8, Button as Button50, Textarea as Textarea5, cn as cn26 } from "@ai-matrx/design-system";
18537
18549
  import { Fragment as Fragment28, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
@@ -18562,7 +18574,7 @@ function TableAccessLevel({ tableId, fields }) {
18562
18574
  setPicked(answer.data.readers.map((r) => r.field));
18563
18575
  setReason("");
18564
18576
  }, [client, tableId]);
18565
- useEffect50(() => {
18577
+ useEffect51(() => {
18566
18578
  void load();
18567
18579
  }, [load]);
18568
18580
  if (failed) return /* @__PURE__ */ jsx66("p", { className: "text-destructive", "data-table-access-level": "", children: failed });
@@ -18652,7 +18664,7 @@ function TableAccessLevel({ tableId, fields }) {
18652
18664
  }
18653
18665
 
18654
18666
  // src/ColumnsAtOnce.tsx
18655
- import { useEffect as useEffect51, useMemo as useMemo36, useState as useState60 } from "react";
18667
+ import { useEffect as useEffect52, useMemo as useMemo36, useState as useState60 } from "react";
18656
18668
  import { useFieldMutation as useFieldMutation3 } from "@ai-matrx/records/react";
18657
18669
  import { Badge as Badge9, BasicInput as BasicInput6, Button as Button51, Checkbox as Checkbox5, cn as cn27 } from "@ai-matrx/design-system";
18658
18670
  import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
@@ -18686,10 +18698,10 @@ function ColumnsAtOnce({
18686
18698
  const shape = useFieldMutation3();
18687
18699
  const savedSignature = JSON.stringify(rows.map((f) => [f.id, f.label, f.sort]));
18688
18700
  const [draft, setDraft] = useState60(() => draftOf3(rows));
18689
- useEffect51(() => setDraft(draftOf3(rows)), [savedSignature]);
18701
+ useEffect52(() => setDraft(draftOf3(rows)), [savedSignature]);
18690
18702
  const hiddenSignature = JSON.stringify(look?.hidden ?? []);
18691
18703
  const [hidden, setHidden] = useState60(() => [...look?.hidden ?? []]);
18692
- useEffect51(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
18704
+ useEffect52(() => setHidden([...look?.hidden ?? []]), [hiddenSignature]);
18693
18705
  const [dragging, setDragging] = useState60(null);
18694
18706
  const [saving, setSaving] = useState60(false);
18695
18707
  const byId = useMemo36(() => new Map(rows.map((f) => [f.id, f])), [rows]);
@@ -18839,9 +18851,9 @@ function TableSettings(props) {
18839
18851
  const client = useRecordsClient53();
18840
18852
  const table = useTable19(props.tableId);
18841
18853
  const fields = useFields18(props.tableId);
18842
- const now = useRef27({ table: table.data ?? null, fields: fields.data ?? [] });
18854
+ const now = useRef28({ table: table.data ?? null, fields: fields.data ?? [] });
18843
18855
  now.current = { table: table.data ?? null, fields: fields.data ?? [] };
18844
- const slots = useRef27({ details: { current: null }, rowActions: { current: null } }).current;
18856
+ const slots = useRef28({ details: { current: null }, rowActions: { current: null } }).current;
18845
18857
  const agent = useMemo37(
18846
18858
  () => buildTableSettingsAgent(props.tableId, () => now.current, client, slots),
18847
18859
  [props.tableId, client, slots]
@@ -18865,7 +18877,7 @@ function TableSettingsPanel({
18865
18877
  const archive = useTableArchive(tableId);
18866
18878
  const client = useRecordsClient53();
18867
18879
  const ui = useRecordsUi();
18868
- useEffect52(() => {
18880
+ useEffect53(() => {
18869
18881
  let live = true;
18870
18882
  void archive.preview().then((answer) => {
18871
18883
  if (live && answer?.in_progress) setAskingToDelete(true);
@@ -18874,10 +18886,10 @@ function TableSettingsPanel({
18874
18886
  live = false;
18875
18887
  };
18876
18888
  }, [tableId]);
18877
- const askToArchiveRef = useRef27(null);
18878
- const archiveAskedSeen = useRef27(0);
18889
+ const askToArchiveRef = useRef28(null);
18890
+ const archiveAskedSeen = useRef28(0);
18879
18891
  const panelReady = Boolean(table.data && fields.data && rights.structure);
18880
- useEffect52(() => {
18892
+ useEffect53(() => {
18881
18893
  const ask2 = askToArchiveRef.current;
18882
18894
  if (!panelReady || !ask2 || archiveAsked <= archiveAskedSeen.current) return;
18883
18895
  archiveAskedSeen.current = archiveAsked;
@@ -19086,7 +19098,7 @@ function TableSettingsPanel({
19086
19098
  }
19087
19099
 
19088
19100
  // src/platformTable.ts
19089
- import { useEffect as useEffect53, useMemo as useMemo38, useState as useState62 } from "react";
19101
+ import { useEffect as useEffect54, useMemo as useMemo38, useState as useState62 } from "react";
19090
19102
  import { useRecordsClient as useRecordsClient54 } from "@ai-matrx/records/react";
19091
19103
  var inFlight = /* @__PURE__ */ new Map();
19092
19104
  async function ensurePlatformTable(client, spec) {
@@ -19219,7 +19231,7 @@ function usePlatformTable(spec) {
19219
19231
  const [state, setState] = useState62({ tableId: null, loading: true, error: null });
19220
19232
  const slug = spec.slug;
19221
19233
  const stable = useMemo38(() => spec, [slug]);
19222
- useEffect53(() => {
19234
+ useEffect54(() => {
19223
19235
  let cancelled = false;
19224
19236
  setState({ tableId: null, loading: true, error: null });
19225
19237
  void ensurePlatformTable(client, stable).then((result) => {
@@ -19266,7 +19278,7 @@ function lookAfterReset(look) {
19266
19278
  }
19267
19279
 
19268
19280
  // src/ViewSwitcher.tsx
19269
- import { useEffect as useEffect67, useMemo as useMemo51, useState as useState76 } from "react";
19281
+ import { useEffect as useEffect68, useMemo as useMemo51, useState as useState76 } from "react";
19270
19282
  import { mayDrag as mayDrag4, useFields as useFields20, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient59, useTable as useTable21 } from "@ai-matrx/records/react";
19271
19283
  import { isButtonField as isButtonField2, newerKindOf as newerKindOf2, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
19272
19284
  import { Button as Button60, Select as Select11, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9, cn as cn37 } from "@ai-matrx/design-system";
@@ -19280,7 +19292,7 @@ import {
19280
19292
  import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
19281
19293
 
19282
19294
  // src/recordMoves.tsx
19283
- import { useCallback as useCallback31, useEffect as useEffect54, useMemo as useMemo39, useRef as useRef28, useState as useState63 } from "react";
19295
+ import { useCallback as useCallback31, useEffect as useEffect55, useMemo as useMemo39, useRef as useRef29, useState as useState63 } from "react";
19284
19296
  import { useRecordsClient as useRecordsClient55 } from "@ai-matrx/records/react";
19285
19297
  import { Button as Button53 } from "@ai-matrx/design-system";
19286
19298
  import { Fragment as Fragment30, jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -19406,9 +19418,9 @@ function useRecordMoves({
19406
19418
  [client, undo, onMoved, preset]
19407
19419
  );
19408
19420
  const offering = Boolean(undo.notice);
19409
- const undoRef = useRef28(undo);
19421
+ const undoRef = useRef29(undo);
19410
19422
  undoRef.current = undo;
19411
- useEffect54(() => {
19423
+ useEffect55(() => {
19412
19424
  if (!offering || typeof document === "undefined") return;
19413
19425
  const onKey = (event) => {
19414
19426
  const which = undoKey(event);
@@ -19474,7 +19486,7 @@ function MoveRefusedBadge({ refused }) {
19474
19486
  }
19475
19487
 
19476
19488
  // src/Pipeline.tsx
19477
- import { useCallback as useCallback32, useEffect as useEffect55, useMemo as useMemo40, useRef as useRef29, useState as useState64 } from "react";
19489
+ import { useCallback as useCallback32, useEffect as useEffect56, useMemo as useMemo40, useRef as useRef30, useState as useState64 } from "react";
19478
19490
  import {
19479
19491
  mayDrag,
19480
19492
  useFields as useFields19,
@@ -19587,14 +19599,14 @@ function PipelineBoard({
19587
19599
  const [waiting, setWaiting] = useState64(/* @__PURE__ */ new Map());
19588
19600
  const [dragging, setDragging] = useState64(null);
19589
19601
  const [over, setOver] = useState64(null);
19590
- const alive = useRef29(true);
19602
+ const alive = useRef30(true);
19591
19603
  const [selected, setSelected] = useState64(/* @__PURE__ */ new Set());
19592
- const anchor = useRef29(null);
19604
+ const anchor = useRef30(null);
19593
19605
  const [batch, setBatch] = useState64(/* @__PURE__ */ new Map());
19594
19606
  const [batchSaid, setBatchSaid] = useState64(null);
19595
19607
  const [batchError, setBatchError] = useState64(null);
19596
19608
  const [moving, setMoving] = useState64(false);
19597
- useEffect55(() => {
19609
+ useEffect56(() => {
19598
19610
  alive.current = true;
19599
19611
  return () => {
19600
19612
  alive.current = false;
@@ -19619,11 +19631,11 @@ function PipelineBoard({
19619
19631
  setWaiting(held.ok ? new Map((held.data ?? []).map((p) => [p.record_id, p])) : /* @__PURE__ */ new Map());
19620
19632
  setColumns(board.ok ? board.data ?? [] : []);
19621
19633
  }, [client, tableId, measure, filterKey]);
19622
- useEffect55(() => {
19634
+ useEffect56(() => {
19623
19635
  void reload();
19624
19636
  }, [reload]);
19625
19637
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
19626
- const versionsRef = useRef29(versions);
19638
+ const versionsRef = useRef30(versions);
19627
19639
  versionsRef.current = versions;
19628
19640
  const drawnVersion = (id) => versionsRef.current.seen(id);
19629
19641
  const stageKey = definition?.stage_field ?? null;
@@ -20286,13 +20298,13 @@ function structuredWordsFor(field, value) {
20286
20298
  }
20287
20299
 
20288
20300
  // src/CalendarView.tsx
20289
- import { useEffect as useEffect57, useMemo as useMemo43, useRef as useRef30, useState as useState66 } from "react";
20301
+ import { useEffect as useEffect58, useMemo as useMemo43, useRef as useRef31, useState as useState66 } from "react";
20290
20302
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
20291
20303
  import { Button as Button55, Select as Select5, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3, cn as cn30 } from "@ai-matrx/design-system";
20292
20304
  import { CHOICE_CHIP_CLASS } from "@ai-matrx/design-system/data-table";
20293
20305
 
20294
20306
  // src/weekStart.ts
20295
- import { useEffect as useEffect56, useState as useState65 } from "react";
20307
+ import { useEffect as useEffect57, useState as useState65 } from "react";
20296
20308
  import { useOptionalRecordsClient as useOptionalRecordsClient3 } from "@ai-matrx/records/react";
20297
20309
  var DAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
20298
20310
  function weekStartIndex(word) {
@@ -20314,7 +20326,7 @@ function ask(client) {
20314
20326
  function useReaderWeekStart() {
20315
20327
  const client = useOptionalRecordsClient3();
20316
20328
  const [first, setFirst] = useState65(1);
20317
- useEffect56(() => {
20329
+ useEffect57(() => {
20318
20330
  if (!client) return;
20319
20331
  let live = true;
20320
20332
  void ask(client).then((n) => live && setFirst(n));
@@ -20550,7 +20562,7 @@ function useNarrow() {
20550
20562
  const query = "(max-width: 639px)";
20551
20563
  const read = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
20552
20564
  const [narrow, setNarrow] = useState66(read);
20553
- useEffect57(() => {
20565
+ useEffect58(() => {
20554
20566
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
20555
20567
  const list = window.matchMedia(query);
20556
20568
  const on = () => setNarrow(list.matches);
@@ -20621,9 +20633,9 @@ function CalendarView({
20621
20633
  const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
20622
20634
  const colorOf = useRowColorBy(all, colorKey, style);
20623
20635
  const [placedOver, setPlacedOver] = useState66(() => /* @__PURE__ */ new Map());
20624
- useEffect57(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
20636
+ useEffect58(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
20625
20637
  const undoneCount = moves.undo.depth.forward;
20626
- useEffect57(() => {
20638
+ useEffect58(() => {
20627
20639
  if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
20628
20640
  }, [undoneCount]);
20629
20641
  const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
@@ -20650,9 +20662,9 @@ function CalendarView({
20650
20662
  }, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
20651
20663
  const titleOf = (row) => cardWords(row, titleField, labels).text;
20652
20664
  const rowById = (id) => rows.find((r) => r.id === id);
20653
- const frame = useRef30(null);
20665
+ const frame = useRef31(null);
20654
20666
  const [focusOn, setFocusOn] = useState66(null);
20655
- useEffect57(() => {
20667
+ useEffect58(() => {
20656
20668
  if (!focusOn) return;
20657
20669
  const button = frame.current?.querySelector(`[data-calendar-card="${focusOn}"] button`);
20658
20670
  button?.focus({ preventScroll: true });
@@ -20699,10 +20711,10 @@ function CalendarView({
20699
20711
  const made = await moves.create({ tableId, data, label: `New record on ${where}` });
20700
20712
  if (made) onOpenRecord?.(made);
20701
20713
  };
20702
- const grabOffset = useRef30(0);
20714
+ const grabOffset = useRef31(0);
20703
20715
  const [resizing, setResizing] = useState66(null);
20704
20716
  const [ghost, setGhost] = useState66(null);
20705
- useEffect57(() => {
20717
+ useEffect58(() => {
20706
20718
  if (!ghost || typeof document === "undefined") return;
20707
20719
  const clear = () => setGhost(null);
20708
20720
  document.addEventListener("dragend", clear);
@@ -21251,13 +21263,13 @@ function WeekHours({
21251
21263
  render,
21252
21264
  overlay
21253
21265
  }) {
21254
- const frame = useRef30(null);
21255
- useEffect57(() => {
21266
+ const frame = useRef31(null);
21267
+ useEffect58(() => {
21256
21268
  if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
21257
21269
  }, []);
21258
21270
  usePersonTimeZone();
21259
21271
  const [now, setNow] = useState66(() => personWallNow());
21260
- useEffect57(() => {
21272
+ useEffect58(() => {
21261
21273
  const timer = setInterval(() => setNow(personWallNow()), 6e4);
21262
21274
  return () => clearInterval(timer);
21263
21275
  }, []);
@@ -21299,7 +21311,7 @@ function weekHeading(first) {
21299
21311
  }
21300
21312
 
21301
21313
  // src/TimelineView.tsx
21302
- import { useEffect as useEffect58, useMemo as useMemo44, useRef as useRef31, useState as useState67 } from "react";
21314
+ import { useEffect as useEffect59, useMemo as useMemo44, useRef as useRef32, useState as useState67 } from "react";
21303
21315
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
21304
21316
  import { DropdownMenu as DropdownMenu7, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent7, DropdownMenuItem as DropdownMenuItem6, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator3, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger as DropdownMenuTrigger7, Button as Button56, Select as Select6, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4, cn as cn31 } from "@ai-matrx/design-system";
21305
21317
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
@@ -21564,7 +21576,7 @@ function TimelineView({
21564
21576
  const dates = useMemo44(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
21565
21577
  const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
21566
21578
  const [picked, setPicked] = useState67({});
21567
- useEffect58(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
21579
+ useEffect59(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
21568
21580
  const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
21569
21581
  const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
21570
21582
  const endCandidates = useMemo44(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
@@ -21585,7 +21597,7 @@ function TimelineView({
21585
21597
  };
21586
21598
  const [ganttPicked, setGanttPicked] = useState67({});
21587
21599
  const ganttSaved = JSON.stringify(gantt ?? {});
21588
- useEffect58(() => setGanttPicked({}), [ganttSaved]);
21600
+ useEffect59(() => setGanttPicked({}), [ganttSaved]);
21589
21601
  const g = { ...gantt ?? {}, ...ganttPicked };
21590
21602
  const ganttOn = g.mode === true;
21591
21603
  const setGantt = (patch) => {
@@ -21609,7 +21621,7 @@ function TimelineView({
21609
21621
  const milestoneCandidates = useMemo44(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
21610
21622
  const knobClient = useOptionalRecordsClient4();
21611
21623
  const [shiftDependents, setShiftDependents] = useState67(true);
21612
- useEffect58(() => {
21624
+ useEffect59(() => {
21613
21625
  if (!depField || !knobClient) return;
21614
21626
  let live = true;
21615
21627
  void knobClient.timelineDependencyShift().then((got) => {
@@ -21625,9 +21637,9 @@ function TimelineView({
21625
21637
  const titleOf = (row) => cardWords(row, titleField, labels).text;
21626
21638
  const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
21627
21639
  const [placedOver, setPlacedOver] = useState67(() => /* @__PURE__ */ new Map());
21628
- useEffect58(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
21640
+ useEffect59(() => setPlacedOver(/* @__PURE__ */ new Map()), [rows]);
21629
21641
  const undoneCount = moves.undo.depth.forward;
21630
- useEffect58(() => {
21642
+ useEffect59(() => {
21631
21643
  if (undoneCount > 0) setPlacedOver(/* @__PURE__ */ new Map());
21632
21644
  }, [undoneCount]);
21633
21645
  const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : startField ? (row.document ?? {})[startField.key] : null;
@@ -21890,11 +21902,11 @@ function TimelineView({
21890
21902
  const width = days * px;
21891
21903
  const scale = useMemo44(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
21892
21904
  const xOf = (day2) => daysBetween(from, day2) * px;
21893
- const scroller = useRef31(null);
21905
+ const scroller = useRef32(null);
21894
21906
  const grouped = Boolean(groupField) && !ganttOn;
21895
21907
  const hasLabel = grouped || ganttOn;
21896
21908
  const [scrollX, setScrollX] = useState67(0);
21897
- const frame = useRef31(null);
21909
+ const frame = useRef32(null);
21898
21910
  const onScroll = () => {
21899
21911
  if (frame.current !== null) return;
21900
21912
  frame.current = requestAnimationFrame(() => {
@@ -21902,7 +21914,7 @@ function TimelineView({
21902
21914
  setScrollX(scroller.current?.scrollLeft ?? 0);
21903
21915
  });
21904
21916
  };
21905
- useEffect58(() => {
21917
+ useEffect59(() => {
21906
21918
  const el = scroller.current;
21907
21919
  if (!el) return;
21908
21920
  const label = el.querySelector("[data-timeline-label]")?.offsetWidth ?? 0;
@@ -22429,7 +22441,7 @@ function TimelineView({
22429
22441
  }
22430
22442
 
22431
22443
  // src/ViewNeeds.tsx
22432
- import { useEffect as useEffect59, useState as useState68 } from "react";
22444
+ import { useEffect as useEffect60, useState as useState68 } from "react";
22433
22445
  import { useFieldMutation as useFieldMutation5, useRecordsClient as useRecordsClient57, useTable as useTable20 } from "@ai-matrx/records/react";
22434
22446
  import { BasicInput as BasicInput7, Button as Button57, Label as Label7 } from "@ai-matrx/design-system";
22435
22447
  import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
@@ -22450,7 +22462,7 @@ function useAskedColumnLands(layout, tableId, fields, chosen, offerable, onMade)
22450
22462
  const wanted = askedFor.get(askKey(tableId, layout));
22451
22463
  const landed = wanted && !chosen ? offerable(fields).find((f) => fieldName(f).trim().toLowerCase() === wanted.trim().toLowerCase()) : void 0;
22452
22464
  const key = landed?.key ?? null;
22453
- useEffect59(() => {
22465
+ useEffect60(() => {
22454
22466
  if (!key) return;
22455
22467
  askedFor.delete(askKey(tableId, layout));
22456
22468
  onMade(key);
@@ -22562,7 +22574,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
22562
22574
  }
22563
22575
 
22564
22576
  // src/GalleryCover.tsx
22565
- import { useEffect as useEffect60, useState as useState69 } from "react";
22577
+ import { useEffect as useEffect61, useState as useState69 } from "react";
22566
22578
  import { useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
22567
22579
  import { Fragment as Fragment34, jsx as jsx76 } from "react/jsx-runtime";
22568
22580
  function isImageAddress(value) {
@@ -22584,7 +22596,7 @@ function FileCover({ recordId }) {
22584
22596
  const client = useOptionalRecordsClient5();
22585
22597
  const host = useRecordsUi();
22586
22598
  const [read, setRead] = useState69(null);
22587
- useEffect60(() => {
22599
+ useEffect61(() => {
22588
22600
  let cancelled = false;
22589
22601
  if (!client) {
22590
22602
  setRead({ fileId: recordId, name: "" });
@@ -22982,7 +22994,7 @@ function ListRow({
22982
22994
  }
22983
22995
 
22984
22996
  // src/ChartLayout.tsx
22985
- import { useEffect as useEffect64, useMemo as useMemo48, useState as useState73 } from "react";
22997
+ import { useEffect as useEffect65, useMemo as useMemo48, useState as useState73 } from "react";
22986
22998
  import { useRecordsClient as useRecordsClient58 } from "@ai-matrx/records/react";
22987
22999
  import { fieldKindFor, measureKey as measureKey4 } from "@ai-matrx/records";
22988
23000
  import { Select as Select8, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
@@ -23012,7 +23024,7 @@ import { cn as cn34 } from "@ai-matrx/design-system";
23012
23024
  import { formatCount as formatCount4 } from "@ai-matrx/kit/format";
23013
23025
 
23014
23026
  // src/linkWords.ts
23015
- import { useEffect as useEffect61, useMemo as useMemo46, useState as useState70 } from "react";
23027
+ import { useEffect as useEffect62, useMemo as useMemo46, useState as useState70 } from "react";
23016
23028
  import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
23017
23029
 
23018
23030
  // src/charts.ts
@@ -23230,7 +23242,7 @@ function useLinkGroupNamer(block, tableId) {
23230
23242
  const [named, setNamed] = useState70({});
23231
23243
  const [choices, setChoices] = useState70([]);
23232
23244
  const labels = useRecordLabels(choices);
23233
- useEffect61(() => {
23245
+ useEffect62(() => {
23234
23246
  if (!client || groupBy.length === 0 || rows.length === 0) return;
23235
23247
  let cancelled = false;
23236
23248
  void (async () => {
@@ -23273,7 +23285,7 @@ function useLinkGroupNamer(block, tableId) {
23273
23285
  }
23274
23286
 
23275
23287
  // src/measureWords.ts
23276
- import { useEffect as useEffect62, useState as useState71 } from "react";
23288
+ import { useEffect as useEffect63, useState as useState71 } from "react";
23277
23289
  import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
23278
23290
  import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
23279
23291
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
@@ -23292,7 +23304,7 @@ function useMeasureWords(key, tableId) {
23292
23304
  const client = useOptionalRecordsClient7();
23293
23305
  const [fields, setFields] = useState71(null);
23294
23306
  const needs = key !== "count";
23295
- useEffect62(() => {
23307
+ useEffect63(() => {
23296
23308
  if (!client || !tableId || !needs) return;
23297
23309
  let cancelled = false;
23298
23310
  void client.fields({ table_id: tableId }).then((result) => {
@@ -23307,17 +23319,17 @@ function useMeasureWords(key, tableId) {
23307
23319
 
23308
23320
  // src/chartFrame.tsx
23309
23321
  import {
23310
- useEffect as useEffect63,
23322
+ useEffect as useEffect64,
23311
23323
  useId as useId2,
23312
- useRef as useRef32,
23324
+ useRef as useRef33,
23313
23325
  useState as useState72
23314
23326
  } from "react";
23315
23327
  import { cn as cn33 } from "@ai-matrx/design-system";
23316
23328
  import { jsx as jsx79, jsxs as jsxs72 } from "react/jsx-runtime";
23317
23329
  function useMeasuredWidth(fallback = 480) {
23318
- const ref = useRef32(null);
23330
+ const ref = useRef33(null);
23319
23331
  const [width, setWidth] = useState72(fallback);
23320
- useEffect63(() => {
23332
+ useEffect64(() => {
23321
23333
  const node = ref.current;
23322
23334
  if (!node) return;
23323
23335
  const apply = () => {
@@ -23984,7 +23996,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
23984
23996
  const [state, setState] = useState73({ block: null, error: null });
23985
23997
  const filterKey = JSON.stringify(filter ?? {});
23986
23998
  const qKey = JSON.stringify(q);
23987
- useEffect64(() => {
23999
+ useEffect65(() => {
23988
24000
  let cancelled = false;
23989
24001
  const asked2 = JSON.parse(filterKey);
23990
24002
  const question = JSON.parse(qKey);
@@ -24054,7 +24066,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
24054
24066
  }
24055
24067
 
24056
24068
  // src/MapLayout.tsx
24057
- import { useEffect as useEffect65, useMemo as useMemo49, useRef as useRef33, useState as useState74 } from "react";
24069
+ import { useEffect as useEffect66, useMemo as useMemo49, useRef as useRef34, useState as useState74 } from "react";
24058
24070
  import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
24059
24071
  import { Button as Button58, Select as Select9, SelectContent as SelectContent7, SelectItem as SelectItem7, SelectTrigger as SelectTrigger7, SelectValue as SelectValue7, cn as cn35 } from "@ai-matrx/design-system";
24060
24072
 
@@ -24183,10 +24195,10 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
24183
24195
  const saved = !coordinateMode ? coordinateColumns(fields) : null;
24184
24196
  const [found, setFound] = useState74(() => /* @__PURE__ */ new Map());
24185
24197
  const [lookup, setLookup] = useState74({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
24186
- const tried = useRef33(/* @__PURE__ */ new Set());
24187
- const passing = useRef33(false);
24188
- const mounted = useRef33(true);
24189
- useEffect65(() => {
24198
+ const tried = useRef34(/* @__PURE__ */ new Set());
24199
+ const passing = useRef34(false);
24200
+ const mounted = useRef34(true);
24201
+ useEffect66(() => {
24190
24202
  mounted.current = true;
24191
24203
  return () => {
24192
24204
  mounted.current = false;
@@ -24202,7 +24214,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
24202
24214
  const geocode = host.geocodeAddress;
24203
24215
  const pending = placed.toLookUp.filter((r) => !tried.current.has(r.id));
24204
24216
  const pendingKey = pending.map((p) => p.id).join(",");
24205
- useEffect65(() => {
24217
+ useEffect66(() => {
24206
24218
  if (!geocode || pending.length === 0 || passing.current) return;
24207
24219
  passing.current = true;
24208
24220
  const cancelled = () => !mounted.current;
@@ -24314,7 +24326,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
24314
24326
  }
24315
24327
 
24316
24328
  // src/OrgChartLayout.tsx
24317
- import { useCallback as useCallback33, useEffect as useEffect66, useMemo as useMemo50, useRef as useRef34, useState as useState75 } from "react";
24329
+ import { useCallback as useCallback33, useEffect as useEffect67, useMemo as useMemo50, useRef as useRef35, useState as useState75 } from "react";
24318
24330
  import { Button as Button59, Select as Select10, SelectContent as SelectContent8, SelectItem as SelectItem8, SelectTrigger as SelectTrigger8, SelectValue as SelectValue8, cn as cn36 } from "@ai-matrx/design-system";
24319
24331
 
24320
24332
  // src/orgTree.ts
@@ -24478,24 +24490,24 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
24478
24490
  const forest = useMemo50(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
24479
24491
  const [collapsed, setCollapsed] = useState75(() => /* @__PURE__ */ new Set());
24480
24492
  const layout = useMemo50(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
24481
- const box = useRef34(null);
24493
+ const box = useRef35(null);
24482
24494
  const [view2, setView2] = useState75({ scale: 1, x: 16, y: 16 });
24483
- const fitted = useRef34("");
24495
+ const fitted = useRef35("");
24484
24496
  const fit = useCallback33(() => {
24485
24497
  const el = box.current;
24486
24498
  if (!el || !layout) return;
24487
24499
  setView2(fitTransform(layout.width, layout.height, el.clientWidth, el.clientHeight));
24488
24500
  }, [layout]);
24489
24501
  const shape = `${chosen?.key}|${rows.map((r) => r.id).join(",")}`;
24490
- useEffect66(() => {
24502
+ useEffect67(() => {
24491
24503
  if (fitted.current !== shape && layout) {
24492
24504
  fitted.current = shape;
24493
24505
  fit();
24494
24506
  }
24495
24507
  }, [shape, layout, fit]);
24496
- const pointers = useRef34(/* @__PURE__ */ new Map());
24497
- const gesture = useRef34(null);
24498
- const suppress = useRef34(false);
24508
+ const pointers = useRef35(/* @__PURE__ */ new Map());
24509
+ const gesture = useRef35(null);
24510
+ const suppress = useRef35(false);
24499
24511
  const onDown = (e) => {
24500
24512
  pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
24501
24513
  const pts = [...pointers.current.values()];
@@ -24527,7 +24539,7 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
24527
24539
  if (pointers.current.size === 0) gesture.current = null;
24528
24540
  };
24529
24541
  const zoomBy = (factor) => setView2((v) => ({ ...v, scale: Math.max(0.25, Math.min(2, v.scale * factor)) }));
24530
- useEffect66(() => {
24542
+ useEffect67(() => {
24531
24543
  const el = box.current;
24532
24544
  if (!el) return;
24533
24545
  const wheel = (e) => {
@@ -24667,7 +24679,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
24667
24679
  const client = useRecordsClient59();
24668
24680
  const [limit, setLimit] = useState76(pageSize);
24669
24681
  const questionKey = `${view.subject}|${stableFilterKey4(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
24670
- useEffect67(() => {
24682
+ useEffect68(() => {
24671
24683
  setLimit(pageSize);
24672
24684
  }, [questionKey, pageSize]);
24673
24685
  const storeSort = useMemo51(
@@ -24685,7 +24697,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
24685
24697
  error: null
24686
24698
  });
24687
24699
  const ruleId = view.ruleId ?? null;
24688
- useEffect67(() => {
24700
+ useEffect68(() => {
24689
24701
  if (!ruleId) return;
24690
24702
  let cancelled = false;
24691
24703
  setRuled({ rows: [], loading: true, error: null });
@@ -24811,7 +24823,7 @@ function ViewSwitcherBody({
24811
24823
  setSeenSignature(viewSignature);
24812
24824
  if (Object.keys(local).length > 0) setLocal({});
24813
24825
  }
24814
- useEffect67(() => {
24826
+ useEffect68(() => {
24815
24827
  setLayout(view.layout);
24816
24828
  setLocal({});
24817
24829
  }, [view.layout, view.name, view.subject]);
@@ -24910,7 +24922,7 @@ function useFarFields(all) {
24910
24922
  const client = useRecordsClient59();
24911
24923
  const targets = lookupTargets(all).sort().join(",");
24912
24924
  const [far, setFar] = useState76(() => /* @__PURE__ */ new Map());
24913
- useEffect67(() => {
24925
+ useEffect68(() => {
24914
24926
  let cancelled = false;
24915
24927
  const ids = targets ? targets.split(",") : [];
24916
24928
  if (ids.length === 0) {
@@ -24949,7 +24961,7 @@ function useStageField(tableId) {
24949
24961
  asked: false,
24950
24962
  key: null
24951
24963
  });
24952
- useEffect67(() => {
24964
+ useEffect68(() => {
24953
24965
  let cancelled = false;
24954
24966
  setStage({ asked: false, key: null });
24955
24967
  void client.tableStageField({ table_id: tableId }).then((r) => {
@@ -25884,7 +25896,7 @@ function boardDefaultGroupField(eligible) {
25884
25896
  }
25885
25897
 
25886
25898
  // src/ArchivedView.tsx
25887
- import { useCallback as useCallback34, useEffect as useEffect68, useState as useState77 } from "react";
25899
+ import { useCallback as useCallback34, useEffect as useEffect69, useState as useState77 } from "react";
25888
25900
  import {
25889
25901
  ARCHIVE_LANES,
25890
25902
  ARCHIVE_LANE_LABEL,
@@ -25922,7 +25934,7 @@ function ArchivedView({
25922
25934
  const [error, setError] = useState77(null);
25923
25935
  const [restoring, setRestoring] = useState77(null);
25924
25936
  const [refusal3, setRefusal] = useState77(null);
25925
- useEffect68(() => {
25937
+ useEffect69(() => {
25926
25938
  if (laneFromHost) setLane(laneFromHost);
25927
25939
  }, [laneFromHost]);
25928
25940
  const read = useCallback34(async () => {
@@ -25937,7 +25949,7 @@ function ArchivedView({
25937
25949
  }
25938
25950
  setLoading(false);
25939
25951
  }, [client, tableId, lane, pageSize]);
25940
- useEffect68(() => {
25952
+ useEffect69(() => {
25941
25953
  void read();
25942
25954
  }, [read]);
25943
25955
  const pick = (next) => {
@@ -26038,7 +26050,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
26038
26050
  setError(answer.error);
26039
26051
  }
26040
26052
  }, [client, tableId]);
26041
- useEffect68(() => {
26053
+ useEffect69(() => {
26042
26054
  void read();
26043
26055
  }, [read]);
26044
26056
  const restore = async (fieldId) => {
@@ -26083,7 +26095,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
26083
26095
  }
26084
26096
 
26085
26097
  // src/ArchivedDisclosure.tsx
26086
- import { useCallback as useCallback35, useEffect as useEffect69, useState as useState78 } from "react";
26098
+ import { useCallback as useCallback35, useEffect as useEffect70, useState as useState78 } from "react";
26087
26099
  import {
26088
26100
  emptyPortalArchiveLine,
26089
26101
  portalConfirmLine,
@@ -26152,7 +26164,7 @@ function ArchivedPortals({
26152
26164
  setError(answered.error);
26153
26165
  }
26154
26166
  }, [client]);
26155
- useEffect69(() => {
26167
+ useEffect70(() => {
26156
26168
  void read();
26157
26169
  }, [read, refreshToken]);
26158
26170
  const restore = async (portal) => {
@@ -26268,7 +26280,7 @@ function ArchivedPortals({
26268
26280
  }
26269
26281
 
26270
26282
  // src/ViewBar.tsx
26271
- import { useCallback as useCallback37, useEffect as useEffect70, useRef as useRef36, useState as useState79 } from "react";
26283
+ import { useCallback as useCallback37, useEffect as useEffect71, useRef as useRef37, useState as useState79 } from "react";
26272
26284
  import { useRecordsClient as useRecordsClient62 } from "@ai-matrx/records/react";
26273
26285
  import { Badge as Badge11, Button as Button63, Input as Input6, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, Skeleton as Skeleton17, cn as cn40 } from "@ai-matrx/design-system";
26274
26286
  import { Button as ControlButton2, Switch as Switch4, Tile } from "@ai-matrx/design-system/controls";
@@ -26277,9 +26289,9 @@ import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-
26277
26289
  import { CSS as CSS2 } from "@dnd-kit/utilities";
26278
26290
 
26279
26291
  // src/seedOnce.ts
26280
- import { useCallback as useCallback36, useRef as useRef35 } from "react";
26292
+ import { useCallback as useCallback36, useRef as useRef36 } from "react";
26281
26293
  function useSeedGuard() {
26282
- const claimed = useRef35(/* @__PURE__ */ new Set());
26294
+ const claimed = useRef36(/* @__PURE__ */ new Set());
26283
26295
  return useCallback36((name) => {
26284
26296
  if (claimed.current.has(name)) return false;
26285
26297
  claimed.current.add(name);
@@ -26394,8 +26406,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
26394
26406
  if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
26395
26407
  return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
26396
26408
  });
26397
- const readOnMount = useRef36(initialViews === void 0);
26398
- const pendingPick = useRef36(null);
26409
+ const readOnMount = useRef37(initialViews === void 0);
26410
+ const pendingPick = useRef37(null);
26399
26411
  const [naming, setNaming] = useState79(false);
26400
26412
  const [draftName, setDraftName] = useState79("");
26401
26413
  const [open, setOpen] = useState79(false);
@@ -26415,7 +26427,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
26415
26427
  });
26416
26428
  const [renamingSection, setRenamingSection] = useState79(null);
26417
26429
  const [dragging, setDragging] = useState79(false);
26418
- const justDragged = useRef36(false);
26430
+ const justDragged = useRef37(false);
26419
26431
  const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
26420
26432
  async function dropped(event) {
26421
26433
  setDragging(false);
@@ -26493,14 +26505,14 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
26493
26505
  setViews(mine);
26494
26506
  onViews?.(mine);
26495
26507
  }, [client, readViews, tableId, seedKey, tableThere]);
26496
- useEffect70(() => {
26508
+ useEffect71(() => {
26497
26509
  if (!readOnMount.current) {
26498
26510
  readOnMount.current = true;
26499
26511
  return;
26500
26512
  }
26501
26513
  void load();
26502
26514
  }, [load]);
26503
- useEffect70(() => {
26515
+ useEffect71(() => {
26504
26516
  if (!views || views.length === 0) return;
26505
26517
  const wanted = pendingPick.current;
26506
26518
  pendingPick.current = null;
@@ -26878,7 +26890,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
26878
26890
  }
26879
26891
 
26880
26892
  // src/ProposalRow.tsx
26881
- import { useEffect as useEffect71, useRef as useRef37, useState as useState80 } from "react";
26893
+ import { useEffect as useEffect72, useRef as useRef38, useState as useState80 } from "react";
26882
26894
  import { useRecordsClient as useRecordsClient63 } from "@ai-matrx/records/react";
26883
26895
  import { Badge as Badge12, Button as Button64, cn as cn41 } from "@ai-matrx/design-system";
26884
26896
  import { jsx as jsx88, jsxs as jsxs81 } from "react/jsx-runtime";
@@ -26896,9 +26908,9 @@ function ProposalRow({
26896
26908
  const [settled, setSettled] = useState80(outcome ?? null);
26897
26909
  const [busy, setBusy] = useState80(false);
26898
26910
  const [confirming, setConfirming] = useState80(false);
26899
- const drawnVersion = useRef37(null);
26911
+ const drawnVersion = useRef38(null);
26900
26912
  const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
26901
- useEffect71(() => {
26913
+ useEffect72(() => {
26902
26914
  if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
26903
26915
  }, [needsVersion, change.record, client]);
26904
26916
  async function applyThroughTheStore() {
@@ -26986,7 +26998,7 @@ function ProposalRow({
26986
26998
  }
26987
26999
 
26988
27000
  // src/ActionInbox.tsx
26989
- import { useCallback as useCallback38, useEffect as useEffect72, useMemo as useMemo52, useRef as useRef38, useState as useState81 } from "react";
27001
+ import { useCallback as useCallback38, useEffect as useEffect73, useMemo as useMemo52, useRef as useRef39, useState as useState81 } from "react";
26990
27002
  import { useRecordsClient as useRecordsClient64 } from "@ai-matrx/records/react";
26991
27003
  import { Badge as Badge13, Button as Button65, Checkbox as Checkbox6, Skeleton as Skeleton18, cn as cn42 } from "@ai-matrx/design-system";
26992
27004
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
@@ -27089,9 +27101,9 @@ function ActionInbox({
27089
27101
  const [outcome, setOutcome] = useState81({});
27090
27102
  const [busy, setBusy] = useState81(null);
27091
27103
  const [cursor, setCursor] = useState81(0);
27092
- const listRef = useRef38(null);
27104
+ const listRef = useRef39(null);
27093
27105
  const [selected, setSelected] = useState81(/* @__PURE__ */ new Set());
27094
- const anchor = useRef38(null);
27106
+ const anchor = useRef39(null);
27095
27107
  const [deciding, setDeciding] = useState81(false);
27096
27108
  const [batchSaid, setBatchSaid] = useState81(null);
27097
27109
  const [view, setView] = useState81("inbox");
@@ -27115,7 +27127,7 @@ function ActionInbox({
27115
27127
  setError(null);
27116
27128
  setItems(result.data);
27117
27129
  }, [client, showDecided, view]);
27118
- useEffect72(() => {
27130
+ useEffect73(() => {
27119
27131
  void load();
27120
27132
  }, [load]);
27121
27133
  const narrowed = useMemo52(() => {
@@ -27130,10 +27142,10 @@ function ActionInbox({
27130
27142
  const groups = useMemo52(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
27131
27143
  const shown4 = useMemo52(() => groups.flatMap((g) => g.items), [groups]);
27132
27144
  const elsewhere = (items?.length ?? 0) - narrowed.length;
27133
- useEffect72(() => {
27145
+ useEffect73(() => {
27134
27146
  if (cursor >= shown4.length) setCursor(Math.max(0, shown4.length - 1));
27135
27147
  }, [shown4.length, cursor]);
27136
- useEffect72(() => {
27148
+ useEffect73(() => {
27137
27149
  const list = listRef.current;
27138
27150
  const el = list?.querySelector(`[data-row="${cursor}"]`);
27139
27151
  if (list && el) scrollWithinList(list, el);
@@ -27155,11 +27167,11 @@ function ActionInbox({
27155
27167
  [client, load]
27156
27168
  );
27157
27169
  const [held, setHeld] = useState81({});
27158
- const holds2 = useRef38(/* @__PURE__ */ new Map());
27159
- const lastHold = useRef38(null);
27160
- const holdSeq = useRef38(0);
27170
+ const holds2 = useRef39(/* @__PURE__ */ new Map());
27171
+ const lastHold = useRef39(null);
27172
+ const holdSeq = useRef39(0);
27161
27173
  const [, tick] = useState81(0);
27162
- useEffect72(() => {
27174
+ useEffect73(() => {
27163
27175
  if (Object.keys(held).length === 0) return;
27164
27176
  const t = setInterval(() => tick((n) => n + 1), 250);
27165
27177
  return () => clearInterval(t);
@@ -27205,7 +27217,7 @@ function ActionInbox({
27205
27217
  });
27206
27218
  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 });
27207
27219
  }, []);
27208
- useEffect72(() => {
27220
+ useEffect73(() => {
27209
27221
  const flush = () => {
27210
27222
  for (const entry of [...holds2.current.values()]) entry.commit();
27211
27223
  };
@@ -27215,8 +27227,8 @@ function ActionInbox({
27215
27227
  flush();
27216
27228
  };
27217
27229
  }, []);
27218
- const resumed = useRef38(false);
27219
- useEffect72(() => {
27230
+ const resumed = useRef39(false);
27231
+ useEffect73(() => {
27220
27232
  if (resumed.current || items === null || view !== "inbox") return;
27221
27233
  resumed.current = true;
27222
27234
  const kept = readHolds();
@@ -27839,7 +27851,7 @@ function ActionInbox({
27839
27851
  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";
27840
27852
 
27841
27853
  // src/FormResultsPanel.tsx
27842
- import { useEffect as useEffect73, useMemo as useMemo53, useState as useState82 } from "react";
27854
+ import { useEffect as useEffect74, useMemo as useMemo53, useState as useState82 } from "react";
27843
27855
  import { useFields as useFields22, useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
27844
27856
  import { Button as Button66, Skeleton as Skeleton19, cn as cn43 } from "@ai-matrx/design-system";
27845
27857
  import { jsx as jsx90, jsxs as jsxs83 } from "react/jsx-runtime";
@@ -27868,7 +27880,7 @@ function FormResultsPanel({ form, className }) {
27868
27880
  const [results, setResults] = useState82(null);
27869
27881
  const [error, setError] = useState82(null);
27870
27882
  const [round, setRound] = useState82(0);
27871
- useEffect73(() => {
27883
+ useEffect74(() => {
27872
27884
  if (!client) {
27873
27885
  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."));
27874
27886
  return;
@@ -27966,7 +27978,7 @@ function FormResultsPanel({ form, className }) {
27966
27978
  }
27967
27979
 
27968
27980
  // src/PortalBuilder.tsx
27969
- import { useCallback as useCallback39, useEffect as useEffect74, useMemo as useMemo54, useRef as useRef39, useState as useState83 } from "react";
27981
+ import { useCallback as useCallback39, useEffect as useEffect75, useMemo as useMemo54, useRef as useRef40, useState as useState83 } from "react";
27970
27982
  import { useRecordsClient as useRecordsClient65, useTables } from "@ai-matrx/records/react";
27971
27983
  import { BasicInput as BasicInput9, Button as Button67, Checkbox as Checkbox7, Label as Label8, Separator as Separator9, Skeleton as Skeleton20, cn as cn44 } from "@ai-matrx/design-system";
27972
27984
  import { Select as Select12 } from "@ai-matrx/design-system/controls";
@@ -28000,7 +28012,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28000
28012
  },
28001
28013
  [client, fieldsByTable]
28002
28014
  );
28003
- useEffect74(() => {
28015
+ useEffect75(() => {
28004
28016
  if (!portalId) return;
28005
28017
  void (async () => {
28006
28018
  const answered = await client.portalCard({ portal_id: portalId });
@@ -28014,7 +28026,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28014
28026
  setClientTableId(answered.data.client_table_id);
28015
28027
  })();
28016
28028
  }, [client, portalId]);
28017
- useEffect74(() => {
28029
+ useEffect75(() => {
28018
28030
  if (!tableId) return;
28019
28031
  setExposures(
28020
28032
  (prev) => prev[tableId] ? prev : {
@@ -28027,7 +28039,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28027
28039
  const cameFromPeople = Boolean(
28028
28040
  tableId && (fieldsByTable[tableId] ?? []).some((f) => editorKindFor(f) === "email")
28029
28041
  );
28030
- useEffect74(() => {
28042
+ useEffect75(() => {
28031
28043
  if (!tableId || portalId || clientTableId !== null || !cameFromPeople) return;
28032
28044
  setClientTableId(tableId);
28033
28045
  setExposures((prev) => {
@@ -28042,7 +28054,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28042
28054
  ),
28043
28055
  [fieldsByTable, clientTableId]
28044
28056
  );
28045
- useEffect74(() => {
28057
+ useEffect75(() => {
28046
28058
  for (const e of Object.values(exposures)) {
28047
28059
  if (!e.on || e.namesVia.trim() !== "") continue;
28048
28060
  const ties = tiesTo(e.tableId);
@@ -28057,7 +28069,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28057
28069
  if (on) void loadFields(t.id);
28058
28070
  }
28059
28071
  const [linking, setLinking] = useState83(null);
28060
- const linkingNow = useRef39(null);
28072
+ const linkingNow = useRef40(null);
28061
28073
  async function addLinkBack(id) {
28062
28074
  const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
28063
28075
  if (!clientTableId || !clients) return;
@@ -28084,8 +28096,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
28084
28096
  linkingNow.current = null;
28085
28097
  setLinking(null);
28086
28098
  }
28087
- const autoLinked = useRef39(/* @__PURE__ */ new Set());
28088
- useEffect74(() => {
28099
+ const autoLinked = useRef40(/* @__PURE__ */ new Set());
28100
+ useEffect75(() => {
28089
28101
  if (linking !== null || !clientTableId) return;
28090
28102
  for (const e of Object.values(exposures)) {
28091
28103
  if (!e.on || !fieldsByTable[e.tableId] || autoLinked.current.has(e.tableId)) continue;
@@ -28359,7 +28371,7 @@ function clientNoun(table) {
28359
28371
 
28360
28372
  // src/PortalsPanel.tsx
28361
28373
  import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
28362
- import { useCallback as useCallback40, useEffect as useEffect76, useMemo as useMemo56, useState as useState85 } from "react";
28374
+ import { useCallback as useCallback40, useEffect as useEffect77, useMemo as useMemo56, useState as useState85 } from "react";
28363
28375
  import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
28364
28376
  import {
28365
28377
  portalArchiveConsequence,
@@ -28370,7 +28382,7 @@ import {
28370
28382
  import { Badge as Badge14, BasicInput as BasicInput11, Button as Button69, Separator as Separator10, Skeleton as Skeleton21, cn as cn47 } from "@ai-matrx/design-system";
28371
28383
 
28372
28384
  // src/PortalLookEditor.tsx
28373
- import { useEffect as useEffect75, useMemo as useMemo55, useState as useState84 } from "react";
28385
+ import { useEffect as useEffect76, useMemo as useMemo55, useState as useState84 } from "react";
28374
28386
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
28375
28387
  import { BasicInput as BasicInput10, Button as Button68, cn as cn46 } from "@ai-matrx/design-system";
28376
28388
 
@@ -28458,7 +28470,7 @@ function PortalLookEditor({ card, onSaved, className }) {
28458
28470
  const [said, setSaid] = useState84(null);
28459
28471
  const [formsError, setFormsError] = useState84(null);
28460
28472
  const [formsUnread, setFormsUnread] = useState84(false);
28461
- useEffect75(() => {
28473
+ useEffect76(() => {
28462
28474
  let cancelled = false;
28463
28475
  void (async () => {
28464
28476
  try {
@@ -28708,7 +28720,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
28708
28720
  const [exposures, setExposures] = useState85([]);
28709
28721
  const [listError, setListError] = useState85(null);
28710
28722
  const [openId, setOpenId] = useState85(activePortalId ?? null);
28711
- useEffect76(() => {
28723
+ useEffect77(() => {
28712
28724
  if (activePortalId) setOpenId(activePortalId);
28713
28725
  }, [activePortalId]);
28714
28726
  const [building, setBuilding] = useState85(false);
@@ -28726,7 +28738,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
28726
28738
  setPortals(answered.data);
28727
28739
  setExposures(mapped.ok ? mapped.data : []);
28728
28740
  }, [client]);
28729
- useEffect76(() => {
28741
+ useEffect77(() => {
28730
28742
  void load();
28731
28743
  }, [load]);
28732
28744
  if (portals === null) return /* @__PURE__ */ jsx94(Skeleton21, { className: cn47("h-32 w-full", className) });
@@ -29001,7 +29013,7 @@ function PortalDetail({
29001
29013
  setError(null);
29002
29014
  setCard(answered.data);
29003
29015
  }, [client, portalId]);
29004
- useEffect76(() => {
29016
+ useEffect77(() => {
29005
29017
  void load();
29006
29018
  }, [load]);
29007
29019
  const revoke = useCallback40(
@@ -29209,7 +29221,7 @@ function Preview({
29209
29221
  const [which, setWhich] = useState85(first?.table_id ?? null);
29210
29222
  const [rows, setRows] = useState85(null);
29211
29223
  const [error, setError] = useState85(null);
29212
- useEffect76(() => {
29224
+ useEffect77(() => {
29213
29225
  if (!which) return;
29214
29226
  let cancelled = false;
29215
29227
  setRows(null);
@@ -29255,7 +29267,7 @@ function Invite({ card, onInvited }) {
29255
29267
  const [busy, setBusy] = useState85(false);
29256
29268
  const [said, setSaid] = useState85(null);
29257
29269
  const [error, setError] = useState85(null);
29258
- useEffect76(() => {
29270
+ useEffect77(() => {
29259
29271
  let cancelled = false;
29260
29272
  void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
29261
29273
  if (cancelled) return;
@@ -29466,7 +29478,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
29466
29478
  }
29467
29479
 
29468
29480
  // src/DigestScheduler.tsx
29469
- import { useCallback as useCallback41, useEffect as useEffect77, useMemo as useMemo57, useState as useState86 } from "react";
29481
+ import { useCallback as useCallback41, useEffect as useEffect78, useMemo as useMemo57, useState as useState86 } from "react";
29470
29482
  import { useRecordsClient as useRecordsClient68, useTable as useTable24 } from "@ai-matrx/records/react";
29471
29483
  import { hasQuietHours } from "@ai-matrx/records";
29472
29484
  import { BasicInput as BasicInput12, Button as Button70, Checkbox as Checkbox8, Label as Label9, Separator as Separator11, Skeleton as Skeleton22, cn as cn49 } from "@ai-matrx/design-system";
@@ -29584,7 +29596,7 @@ function DigestScheduler({
29584
29596
  setMembers([]);
29585
29597
  }
29586
29598
  }, [client, tableId, host]);
29587
- useEffect77(() => {
29599
+ useEffect78(() => {
29588
29600
  void load();
29589
29601
  }, [load]);
29590
29602
  const schedule = useMemo57(() => {
@@ -29842,13 +29854,13 @@ function DigestScheduler({
29842
29854
  }
29843
29855
 
29844
29856
  // src/SubscriptionsPanel.tsx
29845
- import { useCallback as useCallback43, useEffect as useEffect79, useState as useState88 } from "react";
29857
+ import { useCallback as useCallback43, useEffect as useEffect80, useState as useState88 } from "react";
29846
29858
  import { useRecordsClient as useRecordsClient70 } from "@ai-matrx/records/react";
29847
29859
  import { hasQuietHours as hasQuietHours2 } from "@ai-matrx/records";
29848
29860
  import { Badge as Badge15, Button as Button72, Skeleton as Skeleton24, Switch as Switch5, cn as cn51 } from "@ai-matrx/design-system";
29849
29861
 
29850
29862
  // src/WebhooksPanel.tsx
29851
- import { useCallback as useCallback42, useEffect as useEffect78, useState as useState87 } from "react";
29863
+ import { useCallback as useCallback42, useEffect as useEffect79, useState as useState87 } from "react";
29852
29864
  import { useRecordsClient as useRecordsClient69, useTable as useTable25 } from "@ai-matrx/records/react";
29853
29865
  import { BasicInput as BasicInput13, Button as Button71, Checkbox as Checkbox9, ConfirmDialog as ConfirmDialog6, Label as Label10, Skeleton as Skeleton23, cn as cn50 } from "@ai-matrx/design-system";
29854
29866
  import { jsx as jsx97, jsxs as jsxs90 } from "react/jsx-runtime";
@@ -29894,7 +29906,7 @@ function WebhooksPanel({ tableId, className }) {
29894
29906
  setError(null);
29895
29907
  setHooks(answered.data ?? []);
29896
29908
  }, [client, tableId]);
29897
- useEffect78(() => {
29909
+ useEffect79(() => {
29898
29910
  void load();
29899
29911
  }, [load]);
29900
29912
  const declare2 = async () => {
@@ -30082,7 +30094,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
30082
30094
  setError(null);
30083
30095
  setRows(answered.data);
30084
30096
  }, [client, tableId]);
30085
- useEffect79(() => {
30097
+ useEffect80(() => {
30086
30098
  void load();
30087
30099
  }, [load]);
30088
30100
  const flip = useCallback43(
@@ -30274,7 +30286,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
30274
30286
  import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
30275
30287
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
30276
30288
  import { Select as Select14 } from "@ai-matrx/design-system/controls";
30277
- import { useCallback as useCallback45, useEffect as useEffect81, useMemo as useMemo59, useRef as useRef41, useState as useState91 } from "react";
30289
+ import { useCallback as useCallback45, useEffect as useEffect82, useMemo as useMemo59, useRef as useRef42, useState as useState91 } from "react";
30278
30290
  import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
30279
30291
  import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
30280
30292
  import { CSS as CSS3 } from "@dnd-kit/utilities";
@@ -30547,7 +30559,7 @@ function EmbedSnippets({ url, label }) {
30547
30559
  }
30548
30560
 
30549
30561
  // src/FormRunner.tsx
30550
- import { useCallback as useCallback44, useEffect as useEffect80, useMemo as useMemo58, useRef as useRef40, useState as useState90 } from "react";
30562
+ import { useCallback as useCallback44, useEffect as useEffect81, useMemo as useMemo58, useRef as useRef41, useState as useState90 } from "react";
30551
30563
  import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
30552
30564
  import { Button as Button74, Label as Label12, Progress, Skeleton as Skeleton25, cn as cn52, formThemeClasses } from "@ai-matrx/design-system";
30553
30565
  import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
@@ -30665,11 +30677,11 @@ function FormStage({
30665
30677
  const routes = formRoutes(form);
30666
30678
  const [routeKnown, setRouteKnown] = useState90(() => !routes || !whichAsked);
30667
30679
  const [stopped, setStopped] = useState90(null);
30668
- const answersRef = useRef40(answers);
30680
+ const answersRef = useRef41(answers);
30669
30681
  answersRef.current = answers;
30670
30682
  const choose = autoAdvance ?? form.autoAdvance ?? true;
30671
- const decoy = useRef40("");
30672
- const stage = useRef40(null);
30683
+ const decoy = useRef41("");
30684
+ const stage = useRef41(null);
30673
30685
  const questions = useMemo58(() => {
30674
30686
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
30675
30687
  return (form.questions ?? []).map((q) => {
@@ -30687,7 +30699,7 @@ function FormStage({
30687
30699
  };
30688
30700
  });
30689
30701
  }, [fields, form.questions]);
30690
- useEffect80(() => {
30702
+ useEffect81(() => {
30691
30703
  if (!whichAsked) return;
30692
30704
  if (!routes) return;
30693
30705
  let cancelled = false;
@@ -30732,19 +30744,19 @@ function FormStage({
30732
30744
  };
30733
30745
  }, [whichAsked, questions, answers]);
30734
30746
  const live = questions.filter((q) => !hidden[q.key]);
30735
- const told = useRef40(answers);
30736
- useEffect80(() => {
30747
+ const told = useRef41(answers);
30748
+ useEffect81(() => {
30737
30749
  if (told.current === answers) return;
30738
30750
  told.current = answers;
30739
30751
  onAnswersChange?.(answers);
30740
30752
  }, [answers, onAnswersChange]);
30741
- const resumeAt = useRef40(
30753
+ const resumeAt = useRef41(
30742
30754
  resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
30743
30755
  const v = initialAnswers[q.key];
30744
30756
  return v === void 0 || v === null || v === "";
30745
30757
  })?.key ?? null : null
30746
30758
  );
30747
- useEffect80(() => {
30759
+ useEffect81(() => {
30748
30760
  const key = resumeAt.current;
30749
30761
  if (!key) return;
30750
30762
  const i = live.findIndex((q) => q.key === key);
@@ -30852,10 +30864,10 @@ function FormStage({
30852
30864
  if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
30853
30865
  else void submit();
30854
30866
  }
30855
- const routing = useRef40(false);
30867
+ const routing = useRef41(false);
30856
30868
  const [routingNow, setRoutingNow] = useState90(false);
30857
- const typedAhead = useRef40("");
30858
- useEffect80(() => {
30869
+ const typedAhead = useRef41("");
30870
+ useEffect81(() => {
30859
30871
  if (!routingNow) return;
30860
30872
  const hold = (event) => {
30861
30873
  if (!routing.current || event.metaKey || event.ctrlKey || event.altKey || event.isComposing) return;
@@ -30885,10 +30897,10 @@ function FormStage({
30885
30897
  }
30886
30898
  for (const key of held) target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));
30887
30899
  }, [live, at]);
30888
- useEffect80(() => {
30900
+ useEffect81(() => {
30889
30901
  if (!routingNow) pourTypedAhead();
30890
30902
  }, [routingNow, at, pourTypedAhead]);
30891
- const advanceRef = useRef40(advance);
30903
+ const advanceRef = useRef41(advance);
30892
30904
  advanceRef.current = advance;
30893
30905
  const chosen = useCallback44(() => {
30894
30906
  if (!oneAtATime || !choose) return;
@@ -30910,23 +30922,23 @@ function FormStage({
30910
30922
  if (event.shiftKey) retreat();
30911
30923
  else advance();
30912
30924
  }
30913
- useEffect80(() => {
30925
+ useEffect81(() => {
30914
30926
  const input = stage.current?.querySelector("[role='radio'][aria-checked='true']") ?? stage.current?.querySelector(
30915
30927
  "input:not([tabindex='-1']), textarea, select, [role='combobox'], [role='radio'], [role='checkbox']"
30916
30928
  );
30917
30929
  input?.focus();
30918
30930
  pourTypedAhead();
30919
30931
  }, [index, done, started]);
30920
- const startTold = useRef40(false);
30921
- useEffect80(() => {
30932
+ const startTold = useRef41(false);
30933
+ useEffect81(() => {
30922
30934
  if (startTold.current || !onStart) return;
30923
30935
  if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
30924
30936
  startTold.current = true;
30925
30937
  onStart();
30926
30938
  }
30927
30939
  }, [answers, onStart]);
30928
- const shownTold = useRef40(/* @__PURE__ */ new Set());
30929
- useEffect80(() => {
30940
+ const shownTold = useRef41(/* @__PURE__ */ new Set());
30941
+ useEffect81(() => {
30930
30942
  if (!onQuestionShown || !started || done) return;
30931
30943
  for (const q of oneAtATime ? current ? [current] : [] : live) {
30932
30944
  if (shownTold.current.has(q.key)) continue;
@@ -31110,7 +31122,7 @@ function ThankYou({
31110
31122
  const title = rawTitle ? pipe(rawTitle) : rawTitle;
31111
31123
  const body = rawBody ? pipe(rawBody) : rawBody;
31112
31124
  const going = redirect !== null && done !== "preview";
31113
- useEffect80(() => {
31125
+ useEffect81(() => {
31114
31126
  if (!going || !redirect) return;
31115
31127
  const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
31116
31128
  return () => window.clearTimeout(timer);
@@ -31311,7 +31323,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31311
31323
  const [restoredAt, setRestoredAt] = useState91(null);
31312
31324
  const [showResults, setShowResults] = useState91(false);
31313
31325
  const [adding, setAdding] = useState91(false);
31314
- const keysBeforeAdd = useRef41(null);
31326
+ const keysBeforeAdd = useRef42(null);
31315
31327
  const [makeOnMount, setMakeOnMount] = useState91("waiting");
31316
31328
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
31317
31329
  const load = useCallback45(async () => {
@@ -31341,10 +31353,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31341
31353
  setError(null);
31342
31354
  setForms(mine);
31343
31355
  }, [client, tableId, seed, claimSeed]);
31344
- useEffect81(() => {
31356
+ useEffect82(() => {
31345
31357
  void load();
31346
31358
  }, [load]);
31347
- useEffect81(() => {
31359
+ useEffect82(() => {
31348
31360
  let cancelled = false;
31349
31361
  Promise.resolve().then(() => client.formKnobs()).then((r) => {
31350
31362
  if (!cancelled && r.ok) setOrgKnobs(r.data);
@@ -31353,7 +31365,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31353
31365
  cancelled = true;
31354
31366
  };
31355
31367
  }, [client]);
31356
- useEffect81(() => {
31368
+ useEffect82(() => {
31357
31369
  if (!forms || forms.length === 0) return;
31358
31370
  if (createOnMount && makeOnMount !== "made") return;
31359
31371
  const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
@@ -31377,7 +31389,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31377
31389
  );
31378
31390
  const stored = useMemo59(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
31379
31391
  const dirty = Boolean(draft && stored && !sameForm(draft, stored));
31380
- useEffect81(() => {
31392
+ useEffect82(() => {
31381
31393
  if (!draft || !stored) return;
31382
31394
  const timer = window.setTimeout(() => {
31383
31395
  if (sameForm(draft, stored)) dropKeptDraft(draft.id);
@@ -31386,7 +31398,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31386
31398
  return () => window.clearTimeout(timer);
31387
31399
  }, [draft, stored]);
31388
31400
  const lookKey = draft ? JSON.stringify(formLookDocument(draft.look ?? null)) : null;
31389
- useEffect81(() => {
31401
+ useEffect82(() => {
31390
31402
  if (lookKey === null) return;
31391
31403
  let cancelled = false;
31392
31404
  const timer = window.setTimeout(() => {
@@ -31403,7 +31415,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31403
31415
  window.clearTimeout(timer);
31404
31416
  };
31405
31417
  }, [client, lookKey]);
31406
- useEffect81(() => {
31418
+ useEffect82(() => {
31407
31419
  const before = keysBeforeAdd.current;
31408
31420
  if (!before || !fields.data) return;
31409
31421
  const made = askableFields(fields.data).filter((f) => !before.has(f.key));
@@ -31514,14 +31526,14 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
31514
31526
  return true;
31515
31527
  }
31516
31528
  const [started, setStarted] = useState91(false);
31517
- useEffect81(() => {
31529
+ useEffect82(() => {
31518
31530
  if (!startWithOne || started || forms === null || forms.length > 0) return;
31519
31531
  if (askableFields(fields.data ?? []).length === 0) return;
31520
31532
  if (!table.data && !table.error) return;
31521
31533
  setStarted(true);
31522
31534
  void create(table.data?.name?.trim() ? `${table.data.name.trim()} form` : "Form 1");
31523
31535
  }, [startWithOne, started, forms, fields.data, create, table.data, table.error]);
31524
- useEffect81(() => {
31536
+ useEffect82(() => {
31525
31537
  if (!createOnMount || makeOnMount !== "waiting" || forms === null) return;
31526
31538
  if (!table.data && !table.error) return;
31527
31539
  if (askableFields(fields.data ?? []).length === 0) {
@@ -32113,8 +32125,8 @@ function NotifyOnAnswer({
32113
32125
  const [error, setError] = useState91(null);
32114
32126
  const [said, setSaid] = useState91(null);
32115
32127
  const [url, setUrl] = useState91(notify?.webhookUrl ?? "");
32116
- useEffect81(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
32117
- useEffect81(() => {
32128
+ useEffect82(() => setUrl(notify?.webhookUrl ?? ""), [notify?.webhookUrl]);
32129
+ useEffect82(() => {
32118
32130
  let cancelled = false;
32119
32131
  void client.subscriptions({ table_id: tableId }).then((r) => {
32120
32132
  if (!cancelled && r.ok) setSubs(r.data);
@@ -32245,7 +32257,7 @@ function NotifyOnAnswer({
32245
32257
  }
32246
32258
 
32247
32259
  // src/DocTemplate.tsx
32248
- import { useCallback as useCallback46, useEffect as useEffect82, useState as useState92 } from "react";
32260
+ import { useCallback as useCallback46, useEffect as useEffect83, useState as useState92 } from "react";
32249
32261
  import { useFields as useFields25, useRecordsClient as useRecordsClient72, useTable as useTable27 } from "@ai-matrx/records/react";
32250
32262
  import { BasicInput as BasicInput16, BasicTextarea as BasicTextarea7, Button as Button76, Label as Label14, Skeleton as Skeleton27, cn as cn54 } from "@ai-matrx/design-system";
32251
32263
  import { jsx as jsx102, jsxs as jsxs95 } from "react/jsx-runtime";
@@ -32293,10 +32305,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
32293
32305
  setError(null);
32294
32306
  setTemplates(rows);
32295
32307
  }, [client, tableId, seed, fields.data]);
32296
- useEffect82(() => {
32308
+ useEffect83(() => {
32297
32309
  void load();
32298
32310
  }, [load]);
32299
- useEffect82(() => {
32311
+ useEffect83(() => {
32300
32312
  if (!templates || templates.length === 0) return;
32301
32313
  const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
32302
32314
  if (chosen.id !== activeId) setActiveId(chosen.id);
@@ -32304,7 +32316,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
32304
32316
  setDraftBody(chosen.body);
32305
32317
  onActiveTemplate?.(chosen);
32306
32318
  }, [templates, activeTemplateId]);
32307
- useEffect82(() => {
32319
+ useEffect83(() => {
32308
32320
  let cancelled = false;
32309
32321
  if (draftBody.trim() === "") {
32310
32322
  setUnresolved([]);
@@ -32429,7 +32441,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
32429
32441
  }
32430
32442
 
32431
32443
  // src/DocRender.tsx
32432
- import { useCallback as useCallback47, useEffect as useEffect83, useRef as useRef42, useState as useState93 } from "react";
32444
+ import { useCallback as useCallback47, useEffect as useEffect84, useRef as useRef43, useState as useState93 } from "react";
32433
32445
  import { useRecordsClient as useRecordsClient73 } from "@ai-matrx/records/react";
32434
32446
  import { Button as Button77, Skeleton as Skeleton28, cn as cn55 } from "@ai-matrx/design-system";
32435
32447
  import { jsx as jsx103, jsxs as jsxs96 } from "react/jsx-runtime";
@@ -32440,7 +32452,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
32440
32452
  const [showing, setShowing] = useState93(null);
32441
32453
  const [error, setError] = useState93(null);
32442
32454
  const [busy, setBusy] = useState93(null);
32443
- const paper = useRef42(null);
32455
+ const paper = useRef43(null);
32444
32456
  const load = useCallback47(async () => {
32445
32457
  const [body, held] = await Promise.all([
32446
32458
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -32458,7 +32470,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
32458
32470
  setPreview(body.data);
32459
32471
  setRenders(held.data.filter((r) => r.template_id === templateId));
32460
32472
  }, [client, templateId, recordId]);
32461
- useEffect83(() => {
32473
+ useEffect84(() => {
32462
32474
  void load();
32463
32475
  }, [load]);
32464
32476
  async function freeze() {
@@ -32545,7 +32557,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
32545
32557
  }
32546
32558
 
32547
32559
  // src/SignBlock.tsx
32548
- import { useCallback as useCallback48, useEffect as useEffect84, useState as useState94 } from "react";
32560
+ import { useCallback as useCallback48, useEffect as useEffect85, useState as useState94 } from "react";
32549
32561
  import { useFields as useFields26, useRecordsClient as useRecordsClient74 } from "@ai-matrx/records/react";
32550
32562
  import { BasicInput as BasicInput17, Button as Button78, Skeleton as Skeleton29, cn as cn56 } from "@ai-matrx/design-system";
32551
32563
  import { useTable as useTable28 } from "@ai-matrx/records/react";
@@ -32575,7 +32587,7 @@ function SignBlock({ tableId, recordId, render, className }) {
32575
32587
  }
32576
32588
  setVerdicts(answers);
32577
32589
  }, [client, recordId]);
32578
- useEffect84(() => {
32590
+ useEffect85(() => {
32579
32591
  void load();
32580
32592
  }, [load]);
32581
32593
  async function sign(field) {
@@ -32696,7 +32708,7 @@ function SignBlock({ tableId, recordId, render, className }) {
32696
32708
  }
32697
32709
 
32698
32710
  // src/NotifyRuleEditor.tsx
32699
- import { useCallback as useCallback49, useEffect as useEffect85, useState as useState95 } from "react";
32711
+ import { useCallback as useCallback49, useEffect as useEffect86, useState as useState95 } from "react";
32700
32712
  import { useRecordsClient as useRecordsClient75, useTable as useTable29 } from "@ai-matrx/records/react";
32701
32713
  import { hasQuietHours as hasQuietHours3 } from "@ai-matrx/records";
32702
32714
  import { Button as Button79, Skeleton as Skeleton30, cn as cn57 } from "@ai-matrx/design-system";
@@ -32746,7 +32758,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
32746
32758
  }
32747
32759
  setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
32748
32760
  }, [client, host, tableId]);
32749
- useEffect85(() => {
32761
+ useEffect86(() => {
32750
32762
  void load();
32751
32763
  }, [load]);
32752
32764
  const write = useCallback49(
@@ -32774,7 +32786,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
32774
32786
  },
32775
32787
  [client, tableId]
32776
32788
  );
32777
- useEffect85(() => {
32789
+ useEffect86(() => {
32778
32790
  if (!subscriptions || !seed || seed.length === 0) return;
32779
32791
  const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
32780
32792
  if (missing.length === 0) return;
@@ -32982,7 +32994,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
32982
32994
  }
32983
32995
 
32984
32996
  // src/DashboardCanvas.tsx
32985
- import { useCallback as useCallback50, useEffect as useEffect86, useMemo as useMemo61, useState as useState97 } from "react";
32997
+ import { useCallback as useCallback50, useEffect as useEffect87, useMemo as useMemo61, useState as useState97 } from "react";
32986
32998
  import { useFields as useFields28, useRecordsClient as useRecordsClient77, useTable as useTable30 } from "@ai-matrx/records/react";
32987
32999
  import {
32988
33000
  BasicInput as BasicInput18,
@@ -33607,10 +33619,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
33607
33619
  return read;
33608
33620
  }, [client, tableId]);
33609
33621
  const [notKept, setNotKept] = useState97(null);
33610
- useEffect86(() => {
33622
+ useEffect87(() => {
33611
33623
  void load();
33612
33624
  }, [load]);
33613
- useEffect86(() => {
33625
+ useEffect87(() => {
33614
33626
  if (!boards || boards.length === 0) return;
33615
33627
  if (createOnMount && madeOnMount !== "done") return;
33616
33628
  const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
@@ -33618,7 +33630,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
33618
33630
  }, [boards, activeDashboardId, madeOnMount]);
33619
33631
  const board = useMemo61(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
33620
33632
  const filterKey = JSON.stringify(filter ?? {});
33621
- useEffect86(() => {
33633
+ useEffect87(() => {
33622
33634
  if (!activeId) {
33623
33635
  setRun(null);
33624
33636
  return;
@@ -33688,7 +33700,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
33688
33700
  ]
33689
33701
  );
33690
33702
  }
33691
- useEffect86(() => {
33703
+ useEffect87(() => {
33692
33704
  if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
33693
33705
  setMadeOnMount("making");
33694
33706
  void create().then(() => setMadeOnMount("done"));
@@ -34143,7 +34155,7 @@ function TargetControl({
34143
34155
  const [mode, setMode] = useState97(saved);
34144
34156
  const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
34145
34157
  const [draft, setDraft] = useState97(savedValue === null ? "" : String(savedValue));
34146
- useEffect86(() => {
34158
+ useEffect87(() => {
34147
34159
  setMode(saved);
34148
34160
  setDraft(savedValue === null ? "" : String(savedValue));
34149
34161
  }, [saved, savedValue]);
@@ -34211,7 +34223,7 @@ function TargetControl({
34211
34223
 
34212
34224
  // src/QuestionPanel.tsx
34213
34225
  import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
34214
- import { useEffect as useEffect87, useMemo as useMemo62, useRef as useRef43, useState as useState98 } from "react";
34226
+ import { useEffect as useEffect88, useMemo as useMemo62, useRef as useRef44, useState as useState98 } from "react";
34215
34227
  import { Badge as Badge16, BasicInput as BasicInput19, Button as Button82, Checkbox as Checkbox11, Label as Label15, Skeleton as Skeleton32, cn as cn60 } from "@ai-matrx/design-system";
34216
34228
  import { useFields as useFields29, useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
34217
34229
 
@@ -34267,7 +34279,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
34267
34279
  const me = client.config.actor?.user_id ?? null;
34268
34280
  const [hidden, setHidden] = useState98(null);
34269
34281
  const [related, setRelated] = useState98({});
34270
- useEffect87(() => {
34282
+ useEffect88(() => {
34271
34283
  if (all.length === 0) {
34272
34284
  if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
34273
34285
  return;
@@ -34300,8 +34312,8 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
34300
34312
  const [saveError, setSaveError] = useState98(null);
34301
34313
  const [saving, setSaving] = useState98(false);
34302
34314
  const [linkMissed, setLinkMissed] = useState98(false);
34303
- const openedFromLink = useRef43(false);
34304
- useEffect87(() => {
34315
+ const openedFromLink = useRef44(false);
34316
+ useEffect88(() => {
34305
34317
  let live = true;
34306
34318
  void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
34307
34319
  if (!live) return;
@@ -34324,7 +34336,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
34324
34336
  setShared(q ? q.shared : true);
34325
34337
  setSaveError(null);
34326
34338
  };
34327
- useEffect87(() => {
34339
+ useEffect88(() => {
34328
34340
  if (!draft) return;
34329
34341
  open(null);
34330
34342
  setSpec(draft);
@@ -34333,7 +34345,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
34333
34345
  const [answer, setAnswer] = useState98(null);
34334
34346
  const [asking, setAsking] = useState98(false);
34335
34347
  const specKey = JSON.stringify(spec);
34336
- useEffect87(() => {
34348
+ useEffect88(() => {
34337
34349
  if (all.length === 0) return;
34338
34350
  let live = true;
34339
34351
  setAsking(true);
@@ -34775,7 +34787,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
34775
34787
  }
34776
34788
 
34777
34789
  // src/TableAsk.tsx
34778
- import { useEffect as useEffect88, useState as useState99 } from "react";
34790
+ import { useEffect as useEffect89, useState as useState99 } from "react";
34779
34791
  import { formatPoints as formatPoints2 } from "@ai-matrx/kit/format";
34780
34792
  import { BasicInput as BasicInput20, Button as Button83, Popover as Popover10, PopoverContent as PopoverContent10, PopoverTrigger as PopoverTrigger10, Skeleton as Skeleton33 } from "@ai-matrx/design-system";
34781
34793
  import { optionLabel as optionLabel2 } from "@ai-matrx/records";
@@ -35093,7 +35105,7 @@ function useNames(tableId, ids) {
35093
35105
  const [names, setNames] = useState99({});
35094
35106
  const titleField = table.data?.title_field ?? null;
35095
35107
  const key = ids.join("|");
35096
- useEffect88(() => {
35108
+ useEffect89(() => {
35097
35109
  let live = true;
35098
35110
  void Promise.all(
35099
35111
  ids.map(async (id) => {
@@ -35185,12 +35197,12 @@ function AgentAnswer({
35185
35197
  }
35186
35198
 
35187
35199
  // src/PageScreen.tsx
35188
- import { useCallback as useCallback51, useEffect as useEffect90, useMemo as useMemo64, useRef as useRef44, useState as useState101 } from "react";
35200
+ import { useCallback as useCallback51, useEffect as useEffect91, useMemo as useMemo64, useRef as useRef45, useState as useState101 } from "react";
35189
35201
  import { useRecordsClient as useRecordsClient81 } from "@ai-matrx/records/react";
35190
35202
  import { BasicInput as BasicInput22, Button as Button85, Skeleton as Skeleton35, cn as cn62 } from "@ai-matrx/design-system";
35191
35203
 
35192
35204
  // src/PageCanvas.tsx
35193
- import { createContext as createContext7, useContext as useContext7, useEffect as useEffect89, useMemo as useMemo63, useState as useState100 } from "react";
35205
+ import { createContext as createContext7, useContext as useContext7, useEffect as useEffect90, useMemo as useMemo63, useState as useState100 } from "react";
35194
35206
  import {
35195
35207
  useFields as useFields31,
35196
35208
  useRecordPage as useRecordPage3,
@@ -35231,7 +35243,7 @@ function useDoorRows(door, elementId, recordId) {
35231
35243
  error: null
35232
35244
  });
35233
35245
  const [tick, setTick] = useState100(0);
35234
- useEffect89(() => {
35246
+ useEffect90(() => {
35235
35247
  if (!door) return;
35236
35248
  let live = true;
35237
35249
  setState((s) => ({ ...s, loading: true }));
@@ -35342,7 +35354,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
35342
35354
  const fields = useFields31(enabled ? block.table_id : null);
35343
35355
  const all = useMemo63(() => onePerKey3(fields.data ?? []), [fields.data]);
35344
35356
  const [view, setView] = useState100(block.view_id ? "reading" : null);
35345
- useEffect89(() => {
35357
+ useEffect90(() => {
35346
35358
  if (!block.view_id || !enabled) {
35347
35359
  setView(null);
35348
35360
  return;
@@ -35361,7 +35373,7 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
35361
35373
  const mine = mineOn || block.me_only === true;
35362
35374
  const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
35363
35375
  const [me, setMe] = useState100(null);
35364
- useEffect89(() => {
35376
+ useEffect90(() => {
35365
35377
  if (!enabled || !mine || !meField?.relation_target || !viewerUserId) {
35366
35378
  setMe(null);
35367
35379
  return;
@@ -35395,7 +35407,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
35395
35407
  ...q.sort.length > 0 ? { sort: q.sort } : {}
35396
35408
  });
35397
35409
  const reload = page.reload;
35398
- useEffect89(() => onRecordChanged2(() => reload()), [reload]);
35410
+ useEffect90(() => onRecordChanged2(() => reload()), [reload]);
35399
35411
  return { q, page };
35400
35412
  }
35401
35413
  function BlockBody(inner) {
@@ -35476,7 +35488,7 @@ function AppletBlockView({ block }) {
35476
35488
  function AppletPick({ value, onChange }) {
35477
35489
  const host = useRecordsUi();
35478
35490
  const [options, setOptions] = useState100(null);
35479
- useEffect89(() => {
35491
+ useEffect90(() => {
35480
35492
  let live = true;
35481
35493
  host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
35482
35494
  return () => {
@@ -35549,10 +35561,10 @@ function ListBlockView({
35549
35561
  const { rows, all } = read;
35550
35562
  const columns = shownColumns(all, block.columns);
35551
35563
  const name = block.title ?? table.data?.name ?? "List";
35552
- useEffect89(() => onRows(rows), [rows, onRows]);
35564
+ useEffect90(() => onRows(rows), [rows, onRows]);
35553
35565
  const firstId = rows[0]?.id ?? null;
35554
35566
  const stillThere = selected !== null && rows.some((r) => r.id === selected);
35555
- useEffect89(() => {
35567
+ useEffect90(() => {
35556
35568
  if (read.loading || read.waiting) return;
35557
35569
  if (!stillThere) onSelect(firstId);
35558
35570
  }, [firstId, stillThere, read.loading, read.waiting]);
@@ -35819,7 +35831,7 @@ function ActionButton2({ block, recordId }) {
35819
35831
  const [running, setRunning] = useState100(false);
35820
35832
  const [done, setDone] = useState100(null);
35821
35833
  const [error, setError] = useState100(null);
35822
- useEffect89(() => {
35834
+ useEffect90(() => {
35823
35835
  setDone(null);
35824
35836
  setError(null);
35825
35837
  setAsking(false);
@@ -35860,7 +35872,7 @@ function FormBlockView({ block }) {
35860
35872
  const client = useRecordsClient80();
35861
35873
  const [form, setForm] = useState100("reading");
35862
35874
  const [sent, setSent] = useState100(0);
35863
- useEffect89(() => {
35875
+ useEffect90(() => {
35864
35876
  if (!block.form_id) {
35865
35877
  setForm(null);
35866
35878
  return;
@@ -35993,7 +36005,7 @@ function ScopeSettings({
35993
36005
  const [views, setViews] = useState100([]);
35994
36006
  const fields = useFields31(block.table_id);
35995
36007
  const all = onePerKey3(fields.data ?? []);
35996
- useEffect89(() => {
36008
+ useEffect90(() => {
35997
36009
  let live = true;
35998
36010
  void client.views({ table_id: block.table_id }).then((answered) => {
35999
36011
  if (live) setViews(answered.ok ? answered.data : []);
@@ -36148,7 +36160,7 @@ function ListSettings({ block, onChange }) {
36148
36160
  const [views, setViews] = useState100([]);
36149
36161
  const fields = useFields31(block.table_id);
36150
36162
  const all = onePerKey3(fields.data ?? []);
36151
- useEffect89(() => {
36163
+ useEffect90(() => {
36152
36164
  let live = true;
36153
36165
  void client.views({ table_id: block.table_id }).then((answered) => {
36154
36166
  if (live) setViews(answered.ok ? answered.data : []);
@@ -36231,7 +36243,7 @@ function ActionPicker({ tableId, value, onChange }) {
36231
36243
  function FormPicker({ tableId, value, onChange }) {
36232
36244
  const client = useRecordsClient80();
36233
36245
  const [forms, setForms] = useState100([]);
36234
- useEffect89(() => {
36246
+ useEffect90(() => {
36235
36247
  let live = true;
36236
36248
  void client.forms({ table_id: tableId }).then((answered) => {
36237
36249
  if (live) setForms(answered.ok ? answered.data : []);
@@ -36317,7 +36329,7 @@ function PageScreen({
36317
36329
  const [run, setRun] = useState101(null);
36318
36330
  const [saveError, setSaveError] = useState101(null);
36319
36331
  const [askingToArchive, setAskingToArchive] = useState101(false);
36320
- const canvas = useRef44(null);
36332
+ const canvas = useRef45(null);
36321
36333
  const [making, setMaking] = useState101("waiting");
36322
36334
  const id = page?.id ?? pageId ?? null;
36323
36335
  const load = useCallback51(
@@ -36339,7 +36351,7 @@ function PageScreen({
36339
36351
  },
36340
36352
  [client]
36341
36353
  );
36342
- useEffect90(() => {
36354
+ useEffect91(() => {
36343
36355
  if (!newOnTable || pageId || making !== "waiting") return;
36344
36356
  setMaking("making");
36345
36357
  void client.dashboardDeclare({
@@ -36359,11 +36371,11 @@ function PageScreen({
36359
36371
  onCreated?.(made.data);
36360
36372
  });
36361
36373
  }, [client, newOnTable, pageId, making, load, onCreated]);
36362
- useEffect90(() => {
36374
+ useEffect91(() => {
36363
36375
  if (!pageId) return;
36364
36376
  void load(pageId);
36365
36377
  }, [pageId, load]);
36366
- useEffect90(() => {
36378
+ useEffect91(() => {
36367
36379
  if (!id) return;
36368
36380
  let live = true;
36369
36381
  void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
@@ -36375,7 +36387,7 @@ function PageScreen({
36375
36387
  }, [client, id]);
36376
36388
  const canEdit = level !== null && EDIT_LEVELS.has(level);
36377
36389
  const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
36378
- useEffect90(() => {
36390
+ useEffect91(() => {
36379
36391
  if (!page || page.blocks.length === 0) {
36380
36392
  setRun(null);
36381
36393
  return;
@@ -36518,7 +36530,7 @@ function PageScreen({
36518
36530
  }
36519
36531
 
36520
36532
  // src/InterfaceScreen.tsx
36521
- import { useCallback as useCallback52, useEffect as useEffect91, useMemo as useMemo65, useRef as useRef45, useState as useState102 } from "react";
36533
+ import { useCallback as useCallback52, useEffect as useEffect92, useMemo as useMemo65, useRef as useRef46, useState as useState102 } from "react";
36522
36534
  import { useRecordsClient as useRecordsClient82 } from "@ai-matrx/records/react";
36523
36535
  import { BasicInput as BasicInput23, Button as Button86, Skeleton as Skeleton36, cn as cn63 } from "@ai-matrx/design-system";
36524
36536
  import { Fragment as Fragment51, jsx as jsx113, jsxs as jsxs106 } from "react/jsx-runtime";
@@ -36555,7 +36567,7 @@ function InterfaceScreen({
36555
36567
  const [making, setMaking] = useState102("waiting");
36556
36568
  const [askingToArchive, setAskingToArchive] = useState102(false);
36557
36569
  const [localPage, setLocalPage] = useState102(null);
36558
- const canvas = useRef45(null);
36570
+ const canvas = useRef46(null);
36559
36571
  const load = useCallback52(
36560
36572
  async (want) => {
36561
36573
  const answered = await client.interfaceRead({ interface_id: want });
@@ -36572,10 +36584,10 @@ function InterfaceScreen({
36572
36584
  },
36573
36585
  [client]
36574
36586
  );
36575
- useEffect91(() => {
36587
+ useEffect92(() => {
36576
36588
  if (interfaceId) void load(interfaceId);
36577
36589
  }, [interfaceId, load]);
36578
- useEffect91(() => {
36590
+ useEffect92(() => {
36579
36591
  if (!newOnTable || interfaceId || making !== "waiting") return;
36580
36592
  setMaking("making");
36581
36593
  const shape2 = newInterfaceShape(newOnTable);
@@ -36598,7 +36610,7 @@ function InterfaceScreen({
36598
36610
  const charts = useMemo65(() => shape ? interfaceCharts(shape) : [], [shape]);
36599
36611
  const through = !!read && !read.member;
36600
36612
  const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
36601
- useEffect91(() => {
36613
+ useEffect92(() => {
36602
36614
  if (!read || through || charts.length === 0) {
36603
36615
  setRun(null);
36604
36616
  return;
@@ -36832,7 +36844,7 @@ function InterfaceScreen({
36832
36844
 
36833
36845
  // src/FormsPanel.tsx
36834
36846
  import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
36835
- import { useCallback as useCallback53, useEffect as useEffect92, useRef as useRef46, useState as useState103 } from "react";
36847
+ import { useCallback as useCallback53, useEffect as useEffect93, useRef as useRef47, useState as useState103 } from "react";
36836
36848
  import { useRecordsClient as useRecordsClient83, useTable as useTable33 } from "@ai-matrx/records/react";
36837
36849
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
36838
36850
  import { Badge as Badge17, Button as Button87, Skeleton as Skeleton37, cn as cn64 } from "@ai-matrx/design-system";
@@ -36858,11 +36870,11 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
36858
36870
  const [archivedSaid, setArchivedSaid] = useState103(null);
36859
36871
  const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
36860
36872
  const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
36861
- useEffect92(() => {
36873
+ useEffect93(() => {
36862
36874
  if (linked && rights.structure) setBuilding(true);
36863
36875
  }, [linked, rights.structure]);
36864
- const openedAsView = useRef46(false);
36865
- useEffect92(() => {
36876
+ const openedAsView = useRef47(false);
36877
+ useEffect93(() => {
36866
36878
  if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
36867
36879
  openedAsView.current = true;
36868
36880
  setBuilding(true);
@@ -36877,7 +36889,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
36877
36889
  setError(null);
36878
36890
  setForms(answered.data);
36879
36891
  }, [client, tableId]);
36880
- useEffect92(() => {
36892
+ useEffect93(() => {
36881
36893
  void load();
36882
36894
  }, [load]);
36883
36895
  const toggle = useCallback53(
@@ -37022,12 +37034,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
37022
37034
  }
37023
37035
 
37024
37036
  // src/CaptureSheet.tsx
37025
- import { useCallback as useCallback55, useEffect as useEffect94, useRef as useRef48, useState as useState105 } from "react";
37037
+ import { useCallback as useCallback55, useEffect as useEffect95, useRef as useRef49, useState as useState105 } from "react";
37026
37038
  import { useFields as useFields32, useRecordsClient as useRecordsClient85, useTable as useTable34 } from "@ai-matrx/records/react";
37027
37039
  import { Button as Button89, Input as Input8, Skeleton as Skeleton39, Textarea as Textarea7, cn as cn66 } from "@ai-matrx/design-system";
37028
37040
 
37029
37041
  // src/CaptureRun.tsx
37030
- import { useCallback as useCallback54, useEffect as useEffect93, useMemo as useMemo66, useRef as useRef47, useState as useState104 } from "react";
37042
+ import { useCallback as useCallback54, useEffect as useEffect94, useMemo as useMemo66, useRef as useRef48, useState as useState104 } from "react";
37031
37043
  import {
37032
37044
  coerceTypedAnswer,
37033
37045
  coercionLabel,
@@ -37085,8 +37097,8 @@ function CaptureRun({ sheetId, face: given, className }) {
37085
37097
  const [items, setItems] = useState104([]);
37086
37098
  const [lastSynced, setLastSynced] = useState104(null);
37087
37099
  const [sending, setSending] = useState104(false);
37088
- const queueRef = useRef47(null);
37089
- useEffect93(() => {
37100
+ const queueRef = useRef48(null);
37101
+ useEffect94(() => {
37090
37102
  const q2 = openCaptureQueue({
37091
37103
  onChange: (c, all) => {
37092
37104
  setCounts(c);
@@ -37124,7 +37136,7 @@ function CaptureRun({ sheetId, face: given, className }) {
37124
37136
  void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
37125
37137
  return () => q2.dispose();
37126
37138
  }, [client, host]);
37127
- useEffect93(() => {
37139
+ useEffect94(() => {
37128
37140
  if (given !== void 0) return;
37129
37141
  let cancelled = false;
37130
37142
  void client.captureOpen({ sheet_id: sheetId }).then((res) => {
@@ -37465,7 +37477,7 @@ function AdHocCaptureSheet({
37465
37477
  const [error, setError] = useState105(null);
37466
37478
  const [uploadError, setUploadError] = useState105(null);
37467
37479
  const [flushing, setFlushing] = useState105(false);
37468
- const queue = useRef48([]);
37480
+ const queue = useRef49([]);
37469
37481
  const keep = useCallback55(
37470
37482
  async (next) => {
37471
37483
  queue.current = next;
@@ -37474,7 +37486,7 @@ function AdHocCaptureSheet({
37474
37486
  },
37475
37487
  [host]
37476
37488
  );
37477
- useEffect94(() => {
37489
+ useEffect95(() => {
37478
37490
  let cancelled = false;
37479
37491
  void (async () => {
37480
37492
  const held = host.captureQueue ? await host.captureQueue.load() : [];
@@ -37653,7 +37665,7 @@ function AdHocCaptureSheet({
37653
37665
  }
37654
37666
 
37655
37667
  // src/PortalShell.tsx
37656
- import { useCallback as useCallback56, useEffect as useEffect95, useState as useState106 } from "react";
37668
+ import { useCallback as useCallback56, useEffect as useEffect96, useState as useState106 } from "react";
37657
37669
  import { useRecordsClient as useRecordsClient86 } from "@ai-matrx/records/react";
37658
37670
  import { Button as Button90, Skeleton as Skeleton40, cn as cn67 } from "@ai-matrx/design-system";
37659
37671
  import { jsx as jsx117, jsxs as jsxs110 } from "react/jsx-runtime";
@@ -37679,7 +37691,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
37679
37691
  }
37680
37692
  setReach(reached.data.map((row) => row.resource_id));
37681
37693
  }, [client, resourceType]);
37682
- useEffect95(() => {
37694
+ useEffect96(() => {
37683
37695
  void load();
37684
37696
  }, [load]);
37685
37697
  if (error) {
@@ -37739,7 +37751,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
37739
37751
  function PortalRow({ tableId, recordId }) {
37740
37752
  const client = useRecordsClient86();
37741
37753
  const [title, setTitle] = useState106(null);
37742
- useEffect95(() => {
37754
+ useEffect96(() => {
37743
37755
  let cancelled = false;
37744
37756
  void client.recordRead({ record_id: recordId }).then((answered) => {
37745
37757
  if (cancelled) return;
@@ -37759,7 +37771,7 @@ function PortalRow({ tableId, recordId }) {
37759
37771
  }
37760
37772
 
37761
37773
  // src/PublicViewPage.tsx
37762
- import { useCallback as useCallback57, useEffect as useEffect96, useState as useState107 } from "react";
37774
+ import { useCallback as useCallback57, useEffect as useEffect97, useState as useState107 } from "react";
37763
37775
  import { useRecordsClient as useRecordsClient87 } from "@ai-matrx/records/react";
37764
37776
  import { Skeleton as Skeleton41, cn as cn68 } from "@ai-matrx/design-system";
37765
37777
  import { publicReadOf } from "@ai-matrx/records/forms";
@@ -37822,7 +37834,7 @@ function PublicViewPage({ slug, className }) {
37822
37834
  }
37823
37835
  setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
37824
37836
  }, [client, slug]);
37825
- useEffect96(() => {
37837
+ useEffect97(() => {
37826
37838
  void load();
37827
37839
  }, [load]);
37828
37840
  if (error) return /* @__PURE__ */ jsx118(RefusalNotice, { error, className });
@@ -37860,7 +37872,7 @@ function PublicRow({ row, fields }) {
37860
37872
 
37861
37873
  // src/EmbedFrame.tsx
37862
37874
  import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
37863
- import { useCallback as useCallback58, useEffect as useEffect97, useState as useState108 } from "react";
37875
+ import { useCallback as useCallback58, useEffect as useEffect98, useState as useState108 } from "react";
37864
37876
  import { useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
37865
37877
  import { Button as Button91, Input as Input9, Skeleton as Skeleton42, Textarea as Textarea8, cn as cn69 } from "@ai-matrx/design-system";
37866
37878
  import { useTable as useTable35 } from "@ai-matrx/records/react";
@@ -37973,7 +37985,7 @@ function useEmbedHandshake(args) {
37973
37985
  const [loading, setLoading] = useState108(true);
37974
37986
  const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
37975
37987
  const { secret, requiredMode } = args;
37976
- useEffect97(() => {
37988
+ useEffect98(() => {
37977
37989
  let cancelled = false;
37978
37990
  setLoading(true);
37979
37991
  setError(null);
@@ -37996,7 +38008,7 @@ function useEmbedHandshake(args) {
37996
38008
 
37997
38009
  // src/TablePage.tsx
37998
38010
  import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
37999
- import { useCallback as useCallback60, useEffect as useEffect102, useMemo as useMemo71, useRef as useRef50, useState as useState117 } from "react";
38011
+ import { useCallback as useCallback60, useEffect as useEffect103, useMemo as useMemo71, useRef as useRef51, useState as useState117 } from "react";
38000
38012
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
38001
38013
  import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient90, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
38002
38014
  import {
@@ -38261,7 +38273,7 @@ async function runTablePageAction(kind2, args) {
38261
38273
  }
38262
38274
 
38263
38275
  // src/GridShortcutsHelp.tsx
38264
- import { useEffect as useEffect98, useState as useState110 } from "react";
38276
+ import { useEffect as useEffect99, useState as useState110 } from "react";
38265
38277
  import { Dialog as Dialog17, DialogContent as DialogContent17, DialogHeader as DialogHeader17, DialogTitle as DialogTitle17 } from "@ai-matrx/design-system";
38266
38278
 
38267
38279
  // src/gridShortcuts.ts
@@ -38331,7 +38343,7 @@ function asksShortcutHelp(event) {
38331
38343
  }
38332
38344
  function GridShortcutsHelp() {
38333
38345
  const [open, setOpen] = useState110(false);
38334
- useEffect98(() => {
38346
+ useEffect99(() => {
38335
38347
  const onKey = (event) => {
38336
38348
  if (!asksShortcutHelp(event)) return;
38337
38349
  event.preventDefault();
@@ -38588,7 +38600,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
38588
38600
  }
38589
38601
 
38590
38602
  // src/ViewFilter.tsx
38591
- import { useEffect as useEffect99, useMemo as useMemo69, useState as useState114 } from "react";
38603
+ import { useEffect as useEffect100, useMemo as useMemo69, useState as useState114 } from "react";
38592
38604
  import { Button as Button96, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11 } from "@ai-matrx/design-system";
38593
38605
  import { useFields as useFields33, useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
38594
38606
  import { jsx as jsx125, jsxs as jsxs118 } from "react/jsx-runtime";
@@ -38606,7 +38618,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
38606
38618
  const saved = view?.where ?? null;
38607
38619
  const [draft, setDraft] = useState114(saved);
38608
38620
  const savedKey = JSON.stringify(saved);
38609
- useEffect99(() => {
38621
+ useEffect100(() => {
38610
38622
  setDraft(saved);
38611
38623
  }, [view?.id, savedKey]);
38612
38624
  const client = useOptionalRecordsClient10();
@@ -38615,7 +38627,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
38615
38627
  [fields.data]
38616
38628
  );
38617
38629
  const [linkedFields, setLinkedFields] = useState114({});
38618
- useEffect99(() => {
38630
+ useEffect100(() => {
38619
38631
  if (!open || !client) return;
38620
38632
  let cancelled = false;
38621
38633
  for (const rel of relations) {
@@ -38810,7 +38822,7 @@ function phoneTableActions(actions) {
38810
38822
  }
38811
38823
 
38812
38824
  // src/presence.tsx
38813
- import { useEffect as useEffect100, useMemo as useMemo70, useRef as useRef49, useState as useState115, useSyncExternalStore as useSyncExternalStore4 } from "react";
38825
+ import { useEffect as useEffect101, useMemo as useMemo70, useRef as useRef50, useState as useState115, useSyncExternalStore as useSyncExternalStore4 } from "react";
38814
38826
  import { jsx as jsx127, jsxs as jsxs120 } from "react/jsx-runtime";
38815
38827
  var NO_PEOPLE = [];
38816
38828
  var MAX_AVATARS = 4;
@@ -38818,7 +38830,7 @@ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
38818
38830
  function useTablePresence(tableId) {
38819
38831
  const port = useRecordsUi().presence;
38820
38832
  const [session, setSession] = useState115(null);
38821
- useEffect100(() => {
38833
+ useEffect101(() => {
38822
38834
  if (!port) {
38823
38835
  setSession(null);
38824
38836
  return;
@@ -38848,9 +38860,9 @@ function initials(name) {
38848
38860
  }
38849
38861
  function TablePresence({ tableId }) {
38850
38862
  const { session, people } = useTablePresence(tableId);
38851
- const root = useRef49(null);
38863
+ const root = useRef50(null);
38852
38864
  const css = useMemo70(() => presenceOutlineCss(people), [people]);
38853
- useEffect100(() => {
38865
+ useEffect101(() => {
38854
38866
  if (!session || typeof MutationObserver === "undefined") return;
38855
38867
  const scope = document.body;
38856
38868
  const read = () => {
@@ -38888,7 +38900,7 @@ function TablePresence({ tableId }) {
38888
38900
  }
38889
38901
 
38890
38902
  // src/toolbarFit.ts
38891
- import { useEffect as useEffect101, useLayoutEffect as useLayoutEffect3, useState as useState116 } from "react";
38903
+ import { useEffect as useEffect102, useLayoutEffect as useLayoutEffect3, useState as useState116 } from "react";
38892
38904
  import { flushSync } from "react-dom";
38893
38905
  function widthAtFold(piece, fold) {
38894
38906
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
@@ -38980,7 +38992,7 @@ function createFitMemory() {
38980
38992
  }
38981
38993
  };
38982
38994
  }
38983
- var useIsoLayoutEffect = typeof window === "undefined" ? useEffect101 : useLayoutEffect3;
38995
+ var useIsoLayoutEffect = typeof window === "undefined" ? useEffect102 : useLayoutEffect3;
38984
38996
  function useToolbarFit(row) {
38985
38997
  const [fold, setFold] = useState116(0);
38986
38998
  useIsoLayoutEffect(() => {
@@ -39059,7 +39071,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
39059
39071
  }
39060
39072
  function useSlotScroll(slot) {
39061
39073
  const [ends, setEnds] = useState116("none");
39062
- useEffect101(() => {
39074
+ useEffect102(() => {
39063
39075
  if (!slot) return;
39064
39076
  let pending = 0;
39065
39077
  const read = () => {
@@ -39210,7 +39222,7 @@ function TableNotHere({
39210
39222
  const [archived, setArchived] = useState117({ phase: "asking" });
39211
39223
  const [restoring, setRestoring] = useState117(false);
39212
39224
  const [refusal3, setRefusal] = useState117(null);
39213
- useEffect102(() => {
39225
+ useEffect103(() => {
39214
39226
  let alive = true;
39215
39227
  void client.tableArchived({ table_id: tableId }).then((answered) => {
39216
39228
  if (!alive) return;
@@ -39438,8 +39450,8 @@ function TablePage({
39438
39450
  return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
39439
39451
  });
39440
39452
  const [looks, setLooks] = useState117(() => seededViews ? seededOpening?.looks : void 0);
39441
- const looksSeededFor = useRef50(seededViews && seededOpening ? tableId : null);
39442
- useEffect102(() => {
39453
+ const looksSeededFor = useRef51(seededViews && seededOpening ? tableId : null);
39454
+ useEffect103(() => {
39443
39455
  if (looksSeededFor.current === tableId) {
39444
39456
  looksSeededFor.current = null;
39445
39457
  return;
@@ -39466,7 +39478,7 @@ function TablePage({
39466
39478
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
39467
39479
  const [views, setViews] = useState117(() => seededViews);
39468
39480
  const [pickedViewId, setPickedViewId] = useState117(savedFromLink);
39469
- const viewSeen = useRef50(null);
39481
+ const viewSeen = useRef51(null);
39470
39482
  const [viewLinkMissed, setViewLinkMissed] = useState117(false);
39471
39483
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
39472
39484
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
@@ -39489,7 +39501,7 @@ function TablePage({
39489
39501
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
39490
39502
  const [archiveAsked, setArchiveAsked] = useState117(0);
39491
39503
  const pageArchive = useTableArchive2(tableId);
39492
- const archiveRunning = useRef50(false);
39504
+ const archiveRunning = useRef51(false);
39493
39505
  const archiveFromMenu = useCallback60(async () => {
39494
39506
  if (archiveRunning.current) return;
39495
39507
  archiveRunning.current = true;
@@ -39552,7 +39564,7 @@ function TablePage({
39552
39564
  const skeletonFace = skeletonLayoutFor(
39553
39565
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
39554
39566
  );
39555
- useEffect102(() => {
39567
+ useEffect103(() => {
39556
39568
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
39557
39569
  rememberLayout(tableId, shownLayout);
39558
39570
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -39570,9 +39582,9 @@ function TablePage({
39570
39582
  lookDiffers: view ? lookDiffers(view, look) : false
39571
39583
  };
39572
39584
  const shownSignature = JSON.stringify(shownReport);
39573
- const reportRef = useRef50(onShownViewChange);
39585
+ const reportRef = useRef51(onShownViewChange);
39574
39586
  reportRef.current = onShownViewChange;
39575
- useEffect102(() => {
39587
+ useEffect103(() => {
39576
39588
  reportRef.current?.(JSON.parse(shownSignature));
39577
39589
  }, [shownSignature]);
39578
39590
  const pickLayout = (next) => {
@@ -39581,9 +39593,9 @@ function TablePage({
39581
39593
  onViewChanged?.(addressForView(view, next));
39582
39594
  void patchView({ layout: next });
39583
39595
  };
39584
- const reportedRecords = useRef50(/* @__PURE__ */ new Set());
39585
- const lastActiveRecord = useRef50(activeRecordId ?? null);
39586
- useEffect102(() => {
39596
+ const reportedRecords = useRef51(/* @__PURE__ */ new Set());
39597
+ const lastActiveRecord = useRef51(activeRecordId ?? null);
39598
+ useEffect103(() => {
39587
39599
  const before = lastActiveRecord.current;
39588
39600
  lastActiveRecord.current = activeRecordId ?? null;
39589
39601
  if (!activeRecordId) {
@@ -39601,25 +39613,25 @@ function TablePage({
39601
39613
  );
39602
39614
  const [recordExpanded, setRecordExpanded] = useState117(false);
39603
39615
  const [recordFull, setRecordFull] = useState117(false);
39604
- useEffect102(() => {
39616
+ useEffect103(() => {
39605
39617
  if (rail !== "record") setRecordFull(false);
39606
39618
  }, [rail]);
39607
39619
  const shownRecord = rail === "record" ? openRecord : null;
39608
- const reportedRecord = useRef50(activeRecordId ?? null);
39609
- useEffect102(() => {
39620
+ const reportedRecord = useRef51(activeRecordId ?? null);
39621
+ useEffect103(() => {
39610
39622
  if (shownRecord === reportedRecord.current) return;
39611
39623
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
39612
39624
  reportedRecord.current = shownRecord;
39613
39625
  if (shownRecord) reportedRecords.current.add(shownRecord);
39614
39626
  onRecordChange?.(shownRecord, how);
39615
39627
  }, [shownRecord, onRecordChange]);
39616
- useEffect102(() => {
39628
+ useEffect103(() => {
39617
39629
  if (activeRecordId) return;
39618
39630
  const named = railFromParam(activeRail);
39619
39631
  if (named === null || named === "share") return;
39620
39632
  setSurface((now) => ({ ...now, rail: named }));
39621
39633
  }, [activeRail, activeRecordId]);
39622
- useEffect102(() => {
39634
+ useEffect103(() => {
39623
39635
  if (formFromParam(activeView)) {
39624
39636
  setSurface((now) => ({ ...now, main: "form" }));
39625
39637
  return;
@@ -39664,7 +39676,7 @@ function TablePage({
39664
39676
  },
39665
39677
  [client, tableId, view, looks, viewLocked, sayLocked]
39666
39678
  );
39667
- const arrival = useRef50(viewAddress ?? null);
39679
+ const arrival = useRef51(viewAddress ?? null);
39668
39680
  const [gridQuery, setGridQuery] = useState117(null);
39669
39681
  const [addressResetEpoch, setAddressResetEpoch] = useState117(0);
39670
39682
  const reportGrid = useCallback60((q) => {
@@ -39675,8 +39687,8 @@ function TablePage({
39675
39687
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
39676
39688
  [reportGrid, addressResetEpoch]
39677
39689
  );
39678
- const hiddenApplied = useRef50(false);
39679
- useEffect102(() => {
39690
+ const hiddenApplied = useRef51(false);
39691
+ useEffect103(() => {
39680
39692
  const hidden = arrival.current?.hidden;
39681
39693
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
39682
39694
  hiddenApplied.current = true;
@@ -39696,10 +39708,10 @@ function TablePage({
39696
39708
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
39697
39709
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
39698
39710
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
39699
- const addressReportRef = useRef50(onViewAddressChange);
39711
+ const addressReportRef = useRef51(onViewAddressChange);
39700
39712
  addressReportRef.current = onViewAddressChange;
39701
- const addressSent = useRef50(null);
39702
- useEffect102(() => {
39713
+ const addressSent = useRef51(null);
39714
+ useEffect103(() => {
39703
39715
  if (!addressReady) return;
39704
39716
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
39705
39717
  addressSent.current = addressSignature;
@@ -40021,14 +40033,14 @@ function TablePage({
40021
40033
  }
40022
40034
  });
40023
40035
  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;
40024
- const actionsRef = useRef50(actions);
40036
+ const actionsRef = useRef51(actions);
40025
40037
  actionsRef.current = actions;
40026
- const onActionsRef = useRef50(onActions);
40038
+ const onActionsRef = useRef51(onActions);
40027
40039
  onActionsRef.current = onActions;
40028
- useEffect102(() => {
40040
+ useEffect103(() => {
40029
40041
  onActionsRef.current?.(actionsRef.current);
40030
40042
  });
40031
- useEffect102(() => {
40043
+ useEffect103(() => {
40032
40044
  const onKey = (event) => {
40033
40045
  const asked2 = objectActionForKey(actionsRef.current, event);
40034
40046
  if (!asked2) return;
@@ -40629,7 +40641,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40629
40641
  const readOnly = rights.known && rights.read && !rights.write;
40630
40642
  const marked = table?.published_to_web;
40631
40643
  const [isPublic, setIsPublic] = useState117(false);
40632
- useEffect102(() => {
40644
+ useEffect103(() => {
40633
40645
  if (!readOnly || !table) {
40634
40646
  setIsPublic(false);
40635
40647
  return;
@@ -40655,7 +40667,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40655
40667
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
40656
40668
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
40657
40669
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
40658
- import { useEffect as useEffect103, useMemo as useMemo72, useRef as useRef51, useState as useState118 } from "react";
40670
+ import { useEffect as useEffect104, useMemo as useMemo72, useRef as useRef52, useState as useState118 } from "react";
40659
40671
  import { Button as Button98, ErrorBox as ErrorBox5, Input as Input12, cn as cn72 } from "@ai-matrx/design-system";
40660
40672
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient91, useSeededAnswerAt } from "@ai-matrx/records/react";
40661
40673
  import { Fragment as Fragment57, jsx as jsx129, jsxs as jsxs122 } from "react/jsx-runtime";
@@ -40762,8 +40774,8 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40762
40774
  const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
40763
40775
  const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
40764
40776
  const [block, setBlock] = useState118(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
40765
- const seededFor = useRef51(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40766
- useEffect103(() => {
40777
+ const seededFor = useRef52(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40778
+ useEffect104(() => {
40767
40779
  const held = seededFor.current;
40768
40780
  if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
40769
40781
  seededFor.current = null;
@@ -40812,7 +40824,7 @@ function EntityTablePageBody({
40812
40824
  const term = searchOverride ?? typed2;
40813
40825
  const entity = useEntityTable(source.token, { pageSize, search: term });
40814
40826
  const [layout, setLayout] = useState118(opened);
40815
- useEffect103(() => setLayout(opened), [opened]);
40827
+ useEffect104(() => setLayout(opened), [opened]);
40816
40828
  const choose = (next) => {
40817
40829
  setLayout(next);
40818
40830
  onLayoutChange?.(next);
@@ -40938,7 +40950,7 @@ function TablePage2(props) {
40938
40950
  }
40939
40951
 
40940
40952
  // src/CalendarLinks.tsx
40941
- import { useCallback as useCallback61, useEffect as useEffect104, useState as useState119 } from "react";
40953
+ import { useCallback as useCallback61, useEffect as useEffect105, useState as useState119 } from "react";
40942
40954
  import { Button as Button99 } from "@ai-matrx/design-system";
40943
40955
  import { jsx as jsx131, jsxs as jsxs123 } from "react/jsx-runtime";
40944
40956
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
@@ -40954,7 +40966,7 @@ function CalendarLinks({ port }) {
40954
40966
  setError(asRefusal3(e, "The links could not be read"));
40955
40967
  }
40956
40968
  }, [port]);
40957
- useEffect104(() => {
40969
+ useEffect105(() => {
40958
40970
  void load();
40959
40971
  }, [load]);
40960
40972
  const act = async (run) => {
@@ -41019,7 +41031,7 @@ function CalendarLinks({ port }) {
41019
41031
  }
41020
41032
 
41021
41033
  // src/TemplatePreview.tsx
41022
- import { useEffect as useEffect105, useMemo as useMemo73, useState as useState120 } from "react";
41034
+ import { useEffect as useEffect106, useMemo as useMemo73, useState as useState120 } from "react";
41023
41035
  import { templatePreview } from "@ai-matrx/records/memory";
41024
41036
  import { useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
41025
41037
  import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
@@ -41071,7 +41083,7 @@ function PreviewForms({ preview, booking }) {
41071
41083
  const client = useRecordsClient92();
41072
41084
  const [forms, setForms] = useState120(null);
41073
41085
  const [pages, setPages] = useState120([]);
41074
- useEffect105(() => {
41086
+ useEffect106(() => {
41075
41087
  let gone = false;
41076
41088
  void client.forms().then((answered) => {
41077
41089
  if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
@@ -41104,7 +41116,7 @@ function PreviewForms({ preview, booking }) {
41104
41116
  }
41105
41117
 
41106
41118
  // src/SectionCard.tsx
41107
- import { useEffect as useEffect106, useRef as useRef52, useState as useState121 } from "react";
41119
+ import { useEffect as useEffect107, useRef as useRef53, useState as useState121 } from "react";
41108
41120
  import { atLeast } from "@ai-matrx/records/field-kinds";
41109
41121
  import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useTable as useTable37 } from "@ai-matrx/records/react";
41110
41122
  import {
@@ -41172,11 +41184,11 @@ function columnsOf(values) {
41172
41184
  var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
41173
41185
  function useDraft(stored, save) {
41174
41186
  const [draft, setDraft] = useState121(null);
41175
- const latest = useRef52({ draft, save, stored });
41176
- useEffect106(() => {
41187
+ const latest = useRef53({ draft, save, stored });
41188
+ useEffect107(() => {
41177
41189
  latest.current = { draft, save, stored };
41178
41190
  });
41179
- useEffect106(() => {
41191
+ useEffect107(() => {
41180
41192
  if (!draft || draft.phase !== "typing") return;
41181
41193
  const timer = setTimeout(() => {
41182
41194
  const sending = draft.value;
@@ -41188,7 +41200,7 @@ function useDraft(stored, save) {
41188
41200
  }, SAVE_AFTER_MS);
41189
41201
  return () => clearTimeout(timer);
41190
41202
  }, [draft]);
41191
- useEffect106(
41203
+ useEffect107(
41192
41204
  () => () => {
41193
41205
  const held = latest.current;
41194
41206
  if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);