@ai-matrx/records-ui 0.116.6 → 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
@@ -169,7 +169,7 @@ import {
169
169
  withoutAddition,
170
170
  withoutLeadingBlank,
171
171
  workedOutErrorFor
172
- } from "./chunk-PF2SAQEH.js";
172
+ } from "./chunk-IYJVE222.js";
173
173
  import {
174
174
  CHART_PLOT_PX,
175
175
  RECORDS_GRID_ROW_PX,
@@ -270,7 +270,7 @@ import {
270
270
  visibilityLaneFor,
271
271
  whyNotAskable,
272
272
  writeOnTheWinningVersion_exports
273
- } from "./chunk-5NPKASE5.js";
273
+ } from "./chunk-HUPBD4JF.js";
274
274
  import {
275
275
  ACTION_CHECKING_ACCESS_REASON,
276
276
  ACTION_NOT_HERE_REASON,
@@ -377,7 +377,7 @@ import {
377
377
  useRowRights,
378
378
  useTableRights,
379
379
  withoutInternalCodes
380
- } from "./chunk-IIAT5WYZ.js";
380
+ } from "./chunk-RQL7QRGR.js";
381
381
  import {
382
382
  FEWEST_KEY_VALUE_PAIRS,
383
383
  FEWEST_LIST_ITEMS,
@@ -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 useEffect101, useMemo as useMemo70, useRef as useRef49, useState as useState116 } 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) {
@@ -38809,8 +38821,86 @@ function phoneTableActions(actions) {
38809
38821
  return out;
38810
38822
  }
38811
38823
 
38824
+ // src/presence.tsx
38825
+ import { useEffect as useEffect101, useMemo as useMemo70, useRef as useRef50, useState as useState115, useSyncExternalStore as useSyncExternalStore4 } from "react";
38826
+ import { jsx as jsx127, jsxs as jsxs120 } from "react/jsx-runtime";
38827
+ var NO_PEOPLE = [];
38828
+ var MAX_AVATARS = 4;
38829
+ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
38830
+ function useTablePresence(tableId) {
38831
+ const port = useRecordsUi().presence;
38832
+ const [session, setSession] = useState115(null);
38833
+ useEffect101(() => {
38834
+ if (!port) {
38835
+ setSession(null);
38836
+ return;
38837
+ }
38838
+ const joined = port.join({ tableId });
38839
+ setSession(joined);
38840
+ return () => {
38841
+ joined.close();
38842
+ setSession(null);
38843
+ };
38844
+ }, [port, tableId]);
38845
+ const people = useSyncExternalStore4(
38846
+ (listener) => session ? session.subscribe(listener) : () => void 0,
38847
+ () => session ? session.getSnapshot() : NO_PEOPLE,
38848
+ () => NO_PEOPLE
38849
+ );
38850
+ return { session, people };
38851
+ }
38852
+ function presenceOutlineCss(people) {
38853
+ return people.filter((p) => p.cell && SAFE.test(p.cell.recordId) && SAFE.test(p.cell.fieldKey) && /^hsl\([0-9 %.]+\)$|^#[0-9a-fA-F]{3,8}$/.test(p.color)).map(
38854
+ (p) => `td[data-matrx-cell-row="${p.cell.recordId}"][data-matrx-cell-col="${p.cell.fieldKey}"]{outline:2px solid ${p.color};outline-offset:-2px;}`
38855
+ ).join("\n");
38856
+ }
38857
+ function initials(name) {
38858
+ const parts = name.trim().split(/\s+/).filter(Boolean);
38859
+ return ((parts[0]?.[0] ?? "?") + (parts.length > 1 ? parts[parts.length - 1][0] : "")).toUpperCase();
38860
+ }
38861
+ function TablePresence({ tableId }) {
38862
+ const { session, people } = useTablePresence(tableId);
38863
+ const root = useRef50(null);
38864
+ const css = useMemo70(() => presenceOutlineCss(people), [people]);
38865
+ useEffect101(() => {
38866
+ if (!session || typeof MutationObserver === "undefined") return;
38867
+ const scope = document.body;
38868
+ const read = () => {
38869
+ const td = scope.querySelector("td[data-matrx-cell-active]");
38870
+ const recordId = td?.getAttribute("data-matrx-cell-row");
38871
+ const fieldKey = td?.getAttribute("data-matrx-cell-col");
38872
+ session.selectCell(recordId && fieldKey ? { recordId, fieldKey } : null);
38873
+ };
38874
+ const watch = new MutationObserver(read);
38875
+ watch.observe(scope, { subtree: true, attributes: true, attributeFilter: ["data-matrx-cell-active"] });
38876
+ read();
38877
+ return () => watch.disconnect();
38878
+ }, [session]);
38879
+ if (!session) return null;
38880
+ const shown4 = people.slice(0, MAX_AVATARS);
38881
+ const more = people.length - shown4.length;
38882
+ return /* @__PURE__ */ jsxs120("span", { ref: root, className: "flex shrink-0 items-center -space-x-1.5", "data-table-presence": "", "data-count": people.length, "aria-label": people.length ? `${people.length} other ${people.length === 1 ? "person is" : "people are"} looking at this table` : void 0, children: [
38883
+ css ? /* @__PURE__ */ jsx127("style", { "data-table-presence-outlines": "", children: css }) : null,
38884
+ shown4.map((p) => /* @__PURE__ */ jsx127(
38885
+ "span",
38886
+ {
38887
+ title: p.name,
38888
+ "data-table-presence-person": p.name,
38889
+ className: "inline-flex h-6 w-6 items-center justify-center overflow-hidden rounded-full border-2 bg-muted text-[10px] font-medium text-foreground",
38890
+ style: { borderColor: p.color },
38891
+ children: p.avatarUrl ? /* @__PURE__ */ jsx127("img", { src: p.avatarUrl, alt: "", className: "h-full w-full object-cover" }) : initials(p.name)
38892
+ },
38893
+ p.key
38894
+ )),
38895
+ more > 0 ? /* @__PURE__ */ jsxs120("span", { className: "inline-flex h-6 min-w-6 items-center justify-center rounded-full border border-border bg-muted px-1 text-[10px]", "data-table-presence-more": "", children: [
38896
+ "+",
38897
+ more
38898
+ ] }) : null
38899
+ ] });
38900
+ }
38901
+
38812
38902
  // src/toolbarFit.ts
38813
- import { useEffect as useEffect100, useLayoutEffect as useLayoutEffect3, useState as useState115 } from "react";
38903
+ import { useEffect as useEffect102, useLayoutEffect as useLayoutEffect3, useState as useState116 } from "react";
38814
38904
  import { flushSync } from "react-dom";
38815
38905
  function widthAtFold(piece, fold) {
38816
38906
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
@@ -38902,9 +38992,9 @@ function createFitMemory() {
38902
38992
  }
38903
38993
  };
38904
38994
  }
38905
- var useIsoLayoutEffect = typeof window === "undefined" ? useEffect100 : useLayoutEffect3;
38995
+ var useIsoLayoutEffect = typeof window === "undefined" ? useEffect102 : useLayoutEffect3;
38906
38996
  function useToolbarFit(row) {
38907
- const [fold, setFold] = useState115(0);
38997
+ const [fold, setFold] = useState116(0);
38908
38998
  useIsoLayoutEffect(() => {
38909
38999
  if (!row) return;
38910
39000
  const memory = createFitMemory();
@@ -38980,8 +39070,8 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
38980
39070
  return start && end ? "both" : start ? "start" : end ? "end" : "none";
38981
39071
  }
38982
39072
  function useSlotScroll(slot) {
38983
- const [ends, setEnds] = useState115("none");
38984
- useEffect100(() => {
39073
+ const [ends, setEnds] = useState116("none");
39074
+ useEffect102(() => {
38985
39075
  if (!slot) return;
38986
39076
  let pending = 0;
38987
39077
  const read = () => {
@@ -39023,7 +39113,7 @@ function useSlotScroll(slot) {
39023
39113
  // src/TablePage.tsx
39024
39114
  import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
39025
39115
  import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
39026
- import { Fragment as Fragment56, jsx as jsx127, jsxs as jsxs120 } from "react/jsx-runtime";
39116
+ import { Fragment as Fragment56, jsx as jsx128, jsxs as jsxs121 } from "react/jsx-runtime";
39027
39117
  var RAIL_TITLE = {
39028
39118
  settings: "Table settings",
39029
39119
  inbox: "Inbox",
@@ -39040,10 +39130,10 @@ var RAIL_TITLE = {
39040
39130
  export: "Export"
39041
39131
  };
39042
39132
  function LookGlyph() {
39043
- return /* @__PURE__ */ jsxs120("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39044
- /* @__PURE__ */ jsx127("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
39045
- /* @__PURE__ */ jsx127("circle", { cx: "16", cy: "7", r: "2" }),
39046
- /* @__PURE__ */ jsx127("circle", { cx: "8", cy: "17", r: "2" })
39133
+ return /* @__PURE__ */ jsxs121("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39134
+ /* @__PURE__ */ jsx128("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
39135
+ /* @__PURE__ */ jsx128("circle", { cx: "16", cy: "7", r: "2" }),
39136
+ /* @__PURE__ */ jsx128("circle", { cx: "8", cy: "17", r: "2" })
39047
39137
  ] });
39048
39138
  }
39049
39139
  function RailFrame({
@@ -39055,7 +39145,7 @@ function RailFrame({
39055
39145
  children
39056
39146
  }) {
39057
39147
  if (phone) {
39058
- return /* @__PURE__ */ jsx127(
39148
+ return /* @__PURE__ */ jsx128(
39059
39149
  BottomSheet,
39060
39150
  {
39061
39151
  open: true,
@@ -39065,18 +39155,18 @@ function RailFrame({
39065
39155
  title,
39066
39156
  size: "full",
39067
39157
  surface: "solid",
39068
- children: /* @__PURE__ */ jsx127("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
39158
+ children: /* @__PURE__ */ jsx128("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
39069
39159
  }
39070
39160
  );
39071
39161
  }
39072
- return /* @__PURE__ */ jsx127(
39162
+ return /* @__PURE__ */ jsx128(
39073
39163
  "aside",
39074
39164
  {
39075
39165
  "data-rail-column": "",
39076
39166
  "data-rail-over": over ? "" : void 0,
39077
39167
  "data-matrx-page-scroll": "",
39078
39168
  className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
39079
- children: over ? /* @__PURE__ */ jsx127(
39169
+ children: over ? /* @__PURE__ */ jsx128(
39080
39170
  "div",
39081
39171
  {
39082
39172
  className: cn71(
@@ -39129,10 +39219,10 @@ function TableNotHere({
39129
39219
  className
39130
39220
  }) {
39131
39221
  const client = useRecordsClient90();
39132
- const [archived, setArchived] = useState116({ phase: "asking" });
39133
- const [restoring, setRestoring] = useState116(false);
39134
- const [refusal3, setRefusal] = useState116(null);
39135
- useEffect101(() => {
39222
+ const [archived, setArchived] = useState117({ phase: "asking" });
39223
+ const [restoring, setRestoring] = useState117(false);
39224
+ const [refusal3, setRefusal] = useState117(null);
39225
+ useEffect103(() => {
39136
39226
  let alive = true;
39137
39227
  void client.tableArchived({ table_id: tableId }).then((answered) => {
39138
39228
  if (!alive) return;
@@ -39142,16 +39232,16 @@ function TableNotHere({
39142
39232
  alive = false;
39143
39233
  };
39144
39234
  }, [client, tableId]);
39145
- if (archived.phase === "asking") return /* @__PURE__ */ jsx127(Skeleton43, { className: "h-40 w-full" });
39235
+ if (archived.phase === "asking") return /* @__PURE__ */ jsx128(Skeleton43, { className: "h-40 w-full" });
39146
39236
  const row = archived.phase === "answered" ? archived.row : null;
39147
39237
  if (row) {
39148
- return /* @__PURE__ */ jsxs120("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39149
- /* @__PURE__ */ jsx127("p", { className: "text-sm font-medium", children: "This table is archived" }),
39150
- /* @__PURE__ */ jsx127("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
39151
- /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: archivedByLine2(row) }),
39152
- refusal3 ? /* @__PURE__ */ jsx127(RefusalNotice, { error: refusal3 }) : null,
39153
- /* @__PURE__ */ jsxs120("div", { className: "flex gap-2", children: [
39154
- /* @__PURE__ */ jsx127(
39238
+ return /* @__PURE__ */ jsxs121("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39239
+ /* @__PURE__ */ jsx128("p", { className: "text-sm font-medium", children: "This table is archived" }),
39240
+ /* @__PURE__ */ jsx128("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
39241
+ /* @__PURE__ */ jsx128("p", { className: "text-xs text-muted-foreground", children: archivedByLine2(row) }),
39242
+ refusal3 ? /* @__PURE__ */ jsx128(RefusalNotice, { error: refusal3 }) : null,
39243
+ /* @__PURE__ */ jsxs121("div", { className: "flex gap-2", children: [
39244
+ /* @__PURE__ */ jsx128(
39155
39245
  Button97,
39156
39246
  {
39157
39247
  size: "sm",
@@ -39170,14 +39260,14 @@ function TableNotHere({
39170
39260
  children: restoring ? "Bringing it back\u2026" : "Bring it back"
39171
39261
  }
39172
39262
  ),
39173
- onLeave ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39263
+ onLeave ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39174
39264
  ] })
39175
39265
  ] });
39176
39266
  }
39177
- return /* @__PURE__ */ jsxs120("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39178
- /* @__PURE__ */ jsx127("p", { className: "text-sm font-medium", children: "This table is not here" }),
39179
- /* @__PURE__ */ jsx127("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
39180
- onLeave ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39267
+ return /* @__PURE__ */ jsxs121("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39268
+ /* @__PURE__ */ jsx128("p", { className: "text-sm font-medium", children: "This table is not here" }),
39269
+ /* @__PURE__ */ jsx128("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
39270
+ onLeave ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39181
39271
  ] });
39182
39272
  }
39183
39273
  var TABLE_NOT_REACHABLE = (
@@ -39354,14 +39444,14 @@ function TablePage({
39354
39444
  }
39355
39445
  );
39356
39446
  const seededViews = seededOpening && (seedViews ?? [defaultView(tableId)]).every((spec) => seedIsSatisfied(spec, seededOpening.views)) ? seededOpening.views : void 0;
39357
- const [view, setView] = useState116(() => {
39447
+ const [view, setView] = useState117(() => {
39358
39448
  if (!seededViews || seededViews.length === 0) return null;
39359
39449
  const asked2 = savedViewFromParam(activeView);
39360
39450
  return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
39361
39451
  });
39362
- const [looks, setLooks] = useState116(() => seededViews ? seededOpening?.looks : void 0);
39363
- const looksSeededFor = useRef49(seededViews && seededOpening ? tableId : null);
39364
- useEffect101(() => {
39452
+ const [looks, setLooks] = useState117(() => seededViews ? seededOpening?.looks : void 0);
39453
+ const looksSeededFor = useRef51(seededViews && seededOpening ? tableId : null);
39454
+ useEffect103(() => {
39365
39455
  if (looksSeededFor.current === tableId) {
39366
39456
  looksSeededFor.current = null;
39367
39457
  return;
@@ -39378,7 +39468,7 @@ function TablePage({
39378
39468
  }, [client, tableId]);
39379
39469
  const look = view && looks ? looks[view.id] : void 0;
39380
39470
  const shown4 = view ? applyLook(view, look) : null;
39381
- const [viewsEpoch, setViewsEpoch] = useState116(0);
39471
+ const [viewsEpoch, setViewsEpoch] = useState117(0);
39382
39472
  const opening = openingRail(activeRecordId, activeRail);
39383
39473
  const recordsUi = useRecordsUi();
39384
39474
  const savedFromLink = savedViewFromParam(activeView);
@@ -39386,32 +39476,32 @@ function TablePage({
39386
39476
  const formFromLink = formFromParam(activeView);
39387
39477
  const openedByPackage = openingView(savedFromLink || questionsFromLink || formFromLink ? null : activeView, activeDashboardId);
39388
39478
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
39389
- const [views, setViews] = useState116(() => seededViews);
39390
- const [pickedViewId, setPickedViewId] = useState116(savedFromLink);
39391
- const viewSeen = useRef49(null);
39392
- const [viewLinkMissed, setViewLinkMissed] = useState116(false);
39479
+ const [views, setViews] = useState117(() => seededViews);
39480
+ const [pickedViewId, setPickedViewId] = useState117(savedFromLink);
39481
+ const viewSeen = useRef51(null);
39482
+ const [viewLinkMissed, setViewLinkMissed] = useState117(false);
39393
39483
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
39394
39484
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
39395
39485
  const shareFromLink = railFromParam(activeRail) === "share";
39396
39486
  const canShare = useCanShare();
39397
39487
  const itemFor = (which) => railFromParam(activeRail) === which ? activeItemId ?? null : null;
39398
- const [asking, setAsking] = useState116(null);
39399
- const [layoutFromLink, setLayoutFromLink] = useState116(opened.layout);
39400
- const [surface, setSurface] = useState116({
39488
+ const [asking, setAsking] = useState117(null);
39489
+ const [layoutFromLink, setLayoutFromLink] = useState117(opened.layout);
39490
+ const [surface, setSurface] = useState117({
39401
39491
  main: opened.main,
39402
39492
  rail: opening.rail
39403
39493
  });
39404
39494
  const { main, rail } = surface;
39405
- const [questionDraft, setQuestionDraft] = useState116(null);
39495
+ const [questionDraft, setQuestionDraft] = useState117(null);
39406
39496
  const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
39407
- const [importEpoch, setImportEpoch] = useState116(0);
39408
- const [openRecord, setOpenRecord] = useState116(opening.record);
39497
+ const [importEpoch, setImportEpoch] = useState117(0);
39498
+ const [openRecord, setOpenRecord] = useState117(opening.record);
39409
39499
  const phone = useIsMobile2();
39410
- const [shareAsked, setShareAsked] = useState116(0);
39500
+ const [shareAsked, setShareAsked] = useState117(0);
39411
39501
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
39412
- const [archiveAsked, setArchiveAsked] = useState116(0);
39502
+ const [archiveAsked, setArchiveAsked] = useState117(0);
39413
39503
  const pageArchive = useTableArchive2(tableId);
39414
- const archiveRunning = useRef49(false);
39504
+ const archiveRunning = useRef51(false);
39415
39505
  const archiveFromMenu = useCallback60(async () => {
39416
39506
  if (archiveRunning.current) return;
39417
39507
  archiveRunning.current = true;
@@ -39441,15 +39531,15 @@ function TablePage({
39441
39531
  archiveRunning.current = false;
39442
39532
  }
39443
39533
  }, [pageArchive, client, tableId, table.data, recordsUi.notify]);
39444
- const [moveAsked, setMoveAsked] = useState116(0);
39534
+ const [moveAsked, setMoveAsked] = useState117(0);
39445
39535
  const canCleanTable = useTableCanBeCleaned(tableId);
39446
- const [duplicateOpen, setDuplicateOpen] = useState116(false);
39447
- const [referenceOpen, setReferenceOpen] = useState116(false);
39448
- const [subscribeOpen, setSubscribeOpen] = useState116(false);
39449
- const [breakDownOpen, setBreakDownOpen] = useState116(false);
39536
+ const [duplicateOpen, setDuplicateOpen] = useState117(false);
39537
+ const [referenceOpen, setReferenceOpen] = useState117(false);
39538
+ const [subscribeOpen, setSubscribeOpen] = useState117(false);
39539
+ const [breakDownOpen, setBreakDownOpen] = useState117(false);
39450
39540
  const canGetReference = useCanGetReference();
39451
- const [toolbarSlot, setToolbarSlot] = useState116(null);
39452
- const [toolbarRow, setToolbarRow] = useState116(null);
39541
+ const [toolbarSlot, setToolbarSlot] = useState117(null);
39542
+ const [toolbarRow, setToolbarRow] = useState117(null);
39453
39543
  const toolbarFold2 = useToolbarFit(toolbarRow);
39454
39544
  const slotClipped = useSlotScroll(toolbarSlot);
39455
39545
  const embedded = pagePresentation2 === "embedded";
@@ -39474,7 +39564,7 @@ function TablePage({
39474
39564
  const skeletonFace = skeletonLayoutFor(
39475
39565
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
39476
39566
  );
39477
- useEffect101(() => {
39567
+ useEffect103(() => {
39478
39568
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
39479
39569
  rememberLayout(tableId, shownLayout);
39480
39570
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -39492,9 +39582,9 @@ function TablePage({
39492
39582
  lookDiffers: view ? lookDiffers(view, look) : false
39493
39583
  };
39494
39584
  const shownSignature = JSON.stringify(shownReport);
39495
- const reportRef = useRef49(onShownViewChange);
39585
+ const reportRef = useRef51(onShownViewChange);
39496
39586
  reportRef.current = onShownViewChange;
39497
- useEffect101(() => {
39587
+ useEffect103(() => {
39498
39588
  reportRef.current?.(JSON.parse(shownSignature));
39499
39589
  }, [shownSignature]);
39500
39590
  const pickLayout = (next) => {
@@ -39503,9 +39593,9 @@ function TablePage({
39503
39593
  onViewChanged?.(addressForView(view, next));
39504
39594
  void patchView({ layout: next });
39505
39595
  };
39506
- const reportedRecords = useRef49(/* @__PURE__ */ new Set());
39507
- const lastActiveRecord = useRef49(activeRecordId ?? null);
39508
- useEffect101(() => {
39596
+ const reportedRecords = useRef51(/* @__PURE__ */ new Set());
39597
+ const lastActiveRecord = useRef51(activeRecordId ?? null);
39598
+ useEffect103(() => {
39509
39599
  const before = lastActiveRecord.current;
39510
39600
  lastActiveRecord.current = activeRecordId ?? null;
39511
39601
  if (!activeRecordId) {
@@ -39516,32 +39606,32 @@ function TablePage({
39516
39606
  setOpenRecord(activeRecordId);
39517
39607
  setSurface((now) => ({ ...now, rail: "record" }));
39518
39608
  }, [activeRecordId]);
39519
- const [shownIds, setShownIdsRaw] = useState116([]);
39609
+ const [shownIds, setShownIdsRaw] = useState117([]);
39520
39610
  const setShownIds = useCallback60(
39521
39611
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
39522
39612
  []
39523
39613
  );
39524
- const [recordExpanded, setRecordExpanded] = useState116(false);
39525
- const [recordFull, setRecordFull] = useState116(false);
39526
- useEffect101(() => {
39614
+ const [recordExpanded, setRecordExpanded] = useState117(false);
39615
+ const [recordFull, setRecordFull] = useState117(false);
39616
+ useEffect103(() => {
39527
39617
  if (rail !== "record") setRecordFull(false);
39528
39618
  }, [rail]);
39529
39619
  const shownRecord = rail === "record" ? openRecord : null;
39530
- const reportedRecord = useRef49(activeRecordId ?? null);
39531
- useEffect101(() => {
39620
+ const reportedRecord = useRef51(activeRecordId ?? null);
39621
+ useEffect103(() => {
39532
39622
  if (shownRecord === reportedRecord.current) return;
39533
39623
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
39534
39624
  reportedRecord.current = shownRecord;
39535
39625
  if (shownRecord) reportedRecords.current.add(shownRecord);
39536
39626
  onRecordChange?.(shownRecord, how);
39537
39627
  }, [shownRecord, onRecordChange]);
39538
- useEffect101(() => {
39628
+ useEffect103(() => {
39539
39629
  if (activeRecordId) return;
39540
39630
  const named = railFromParam(activeRail);
39541
39631
  if (named === null || named === "share") return;
39542
39632
  setSurface((now) => ({ ...now, rail: named }));
39543
39633
  }, [activeRail, activeRecordId]);
39544
- useEffect101(() => {
39634
+ useEffect103(() => {
39545
39635
  if (formFromParam(activeView)) {
39546
39636
  setSurface((now) => ({ ...now, main: "form" }));
39547
39637
  return;
@@ -39552,7 +39642,7 @@ function TablePage({
39552
39642
  setLayoutFromLink(isLayout ? named : null);
39553
39643
  setSurface((now) => ({ ...now, main: isLayout ? "records" : named }));
39554
39644
  }, [activeView]);
39555
- const [viewSaveRefused, setViewSaveRefused] = useState116(null);
39645
+ const [viewSaveRefused, setViewSaveRefused] = useState117(null);
39556
39646
  const viewLocked = view?.presentation?.locked === true;
39557
39647
  const unlockView = useCallback60(async () => {
39558
39648
  const current = view;
@@ -39586,19 +39676,19 @@ function TablePage({
39586
39676
  },
39587
39677
  [client, tableId, view, looks, viewLocked, sayLocked]
39588
39678
  );
39589
- const arrival = useRef49(viewAddress ?? null);
39590
- const [gridQuery, setGridQuery] = useState116(null);
39591
- const [addressResetEpoch, setAddressResetEpoch] = useState116(0);
39679
+ const arrival = useRef51(viewAddress ?? null);
39680
+ const [gridQuery, setGridQuery] = useState117(null);
39681
+ const [addressResetEpoch, setAddressResetEpoch] = useState117(0);
39592
39682
  const reportGrid = useCallback60((q) => {
39593
39683
  const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
39594
39684
  setGridQuery((held) => sameViewAddress(held, next) ? held : next);
39595
39685
  }, []);
39596
- const addressPort = useMemo70(
39686
+ const addressPort = useMemo71(
39597
39687
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
39598
39688
  [reportGrid, addressResetEpoch]
39599
39689
  );
39600
- const hiddenApplied = useRef49(false);
39601
- useEffect101(() => {
39690
+ const hiddenApplied = useRef51(false);
39691
+ useEffect103(() => {
39602
39692
  const hidden = arrival.current?.hidden;
39603
39693
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
39604
39694
  hiddenApplied.current = true;
@@ -39618,10 +39708,10 @@ function TablePage({
39618
39708
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
39619
39709
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
39620
39710
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
39621
- const addressReportRef = useRef49(onViewAddressChange);
39711
+ const addressReportRef = useRef51(onViewAddressChange);
39622
39712
  addressReportRef.current = onViewAddressChange;
39623
- const addressSent = useRef49(null);
39624
- useEffect101(() => {
39713
+ const addressSent = useRef51(null);
39714
+ useEffect103(() => {
39625
39715
  if (!addressReady) return;
39626
39716
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
39627
39717
  addressSent.current = addressSignature;
@@ -39633,9 +39723,9 @@ function TablePage({
39633
39723
  }, [addressReady, addressSignature]);
39634
39724
  const queryShowing = !isViewAddressEmpty({ ...gridQuery ?? {}, hidden: [] });
39635
39725
  const lookShowing = Boolean(view && looks && (lookDiffers(view, looks[view.id]) || queryShowing));
39636
- const [lookRefused, setLookRefused] = useState116(null);
39637
- const [namingLook, setNamingLook] = useState116(false);
39638
- const [lookName, setLookName] = useState116("");
39726
+ const [lookRefused, setLookRefused] = useState117(null);
39727
+ const [namingLook, setNamingLook] = useState117(false);
39728
+ const [lookName, setLookName] = useState117("");
39639
39729
  const resetLook = async () => {
39640
39730
  const current = view;
39641
39731
  setAddressResetEpoch((n) => n + 1);
@@ -39700,7 +39790,7 @@ function TablePage({
39700
39790
  setPickedViewId(written.data);
39701
39791
  setViewsEpoch((n) => n + 1);
39702
39792
  };
39703
- const [designateRefused, setDesignateRefused] = useState116(null);
39793
+ const [designateRefused, setDesignateRefused] = useState117(null);
39704
39794
  const opensAs = view?.isDefault ? view.layout : null;
39705
39795
  const canDesignate = Boolean(
39706
39796
  rights.organise && view && layoutShowing && layoutShowing !== opensAs && storeKeepsLayout(layoutShowing)
@@ -39725,7 +39815,7 @@ function TablePage({
39725
39815
  };
39726
39816
  const footer = footerOf(shown4?.presentation);
39727
39817
  const setFooter = (next) => void patchView({ presentation: { ...shown4?.presentation ?? {}, footer: next } });
39728
- const layoutRadio = /* @__PURE__ */ jsxs120(
39818
+ const layoutRadio = /* @__PURE__ */ jsxs121(
39729
39819
  DropdownMenuRadioGroup3,
39730
39820
  {
39731
39821
  value: layoutShowing ?? (main === "form" ? FORM_LAYOUT : ""),
@@ -39737,14 +39827,14 @@ function TablePage({
39737
39827
  if (VIEW_LAYOUTS.includes(value)) pickLayout(value);
39738
39828
  },
39739
39829
  children: [
39740
- VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option)),
39741
- /* @__PURE__ */ jsx127(DropdownMenuRadioItem3, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
39830
+ VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option)),
39831
+ /* @__PURE__ */ jsx128(DropdownMenuRadioItem3, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
39742
39832
  ]
39743
39833
  }
39744
39834
  );
39745
- const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
39746
- /* @__PURE__ */ jsx127("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx127(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) }),
39747
- /* @__PURE__ */ jsx127("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(
39835
+ const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
39836
+ /* @__PURE__ */ jsx128("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx128(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) }),
39837
+ /* @__PURE__ */ jsx128("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(
39748
39838
  Button97,
39749
39839
  {
39750
39840
  size: "sm",
@@ -39756,7 +39846,7 @@ function TablePage({
39756
39846
  },
39757
39847
  option
39758
39848
  )) }),
39759
- rights.share && canShare ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
39849
+ rights.share && canShare ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
39760
39850
  ] }) : void 0;
39761
39851
  const go = (pressed) => {
39762
39852
  if (!surfaceChosen(surface, pressed)) press(pressed);
@@ -39943,14 +40033,14 @@ function TablePage({
39943
40033
  }
39944
40034
  });
39945
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;
39946
- const actionsRef = useRef49(actions);
40036
+ const actionsRef = useRef51(actions);
39947
40037
  actionsRef.current = actions;
39948
- const onActionsRef = useRef49(onActions);
40038
+ const onActionsRef = useRef51(onActions);
39949
40039
  onActionsRef.current = onActions;
39950
- useEffect101(() => {
40040
+ useEffect103(() => {
39951
40041
  onActionsRef.current?.(actionsRef.current);
39952
40042
  });
39953
- useEffect101(() => {
40043
+ useEffect103(() => {
39954
40044
  const onKey = (event) => {
39955
40045
  const asked2 = objectActionForKey(actionsRef.current, event);
39956
40046
  if (!asked2) return;
@@ -39962,9 +40052,9 @@ function TablePage({
39962
40052
  return () => window.removeEventListener("keydown", onKey);
39963
40053
  }, [recordsUi]);
39964
40054
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
39965
- const pageActions = /* @__PURE__ */ jsxs120(Fragment56, { children: [
39966
- publicReadOnly ? /* @__PURE__ */ jsx127(Badge18, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
39967
- !phone && rights.read && table.data ? /* @__PURE__ */ jsx127(
40055
+ const pageActions = /* @__PURE__ */ jsxs121(Fragment56, { children: [
40056
+ publicReadOnly ? /* @__PURE__ */ jsx128(Badge18, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
40057
+ !phone && rights.read && table.data ? /* @__PURE__ */ jsx128(
39968
40058
  TableAsk,
39969
40059
  {
39970
40060
  tableId,
@@ -39976,7 +40066,7 @@ function TablePage({
39976
40066
  },
39977
40067
  "ask"
39978
40068
  ) : null,
39979
- organizationId ? /* @__PURE__ */ jsx127("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx127(
40069
+ organizationId ? /* @__PURE__ */ jsx128("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx128(
39980
40070
  ShareControl,
39981
40071
  {
39982
40072
  kind: "table",
@@ -39990,28 +40080,28 @@ function TablePage({
39990
40080
  },
39991
40081
  `share-${shareAsked}`
39992
40082
  ) }, "share") : null,
39993
- phone ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
39994
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
39995
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
39996
- /* @__PURE__ */ jsx127(DropdownMenuContent9, { align: "end", className: "w-56", children: layoutRadio })
40083
+ phone ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
40084
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40085
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
40086
+ /* @__PURE__ */ jsx128(DropdownMenuContent9, { align: "end", className: "w-56", children: layoutRadio })
39997
40087
  ] }, "phone-layout") : null,
39998
40088
  phoneTableActions(actions)
39999
- ] }) : /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40000
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs120("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
40001
- /* @__PURE__ */ jsx127("circle", { cx: "5", cy: "12", r: "1.75" }),
40002
- /* @__PURE__ */ jsx127("circle", { cx: "12", cy: "12", r: "1.75" }),
40003
- /* @__PURE__ */ jsx127("circle", { cx: "19", cy: "12", r: "1.75" })
40089
+ ] }) : /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40090
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs121("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
40091
+ /* @__PURE__ */ jsx128("circle", { cx: "5", cy: "12", r: "1.75" }),
40092
+ /* @__PURE__ */ jsx128("circle", { cx: "12", cy: "12", r: "1.75" }),
40093
+ /* @__PURE__ */ jsx128("circle", { cx: "19", cy: "12", r: "1.75" })
40004
40094
  ] }) }) }),
40005
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
40006
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
40007
- /* @__PURE__ */ jsx127(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40095
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
40096
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
40097
+ /* @__PURE__ */ jsx128(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40008
40098
  layoutRadio,
40009
- /* @__PURE__ */ jsx127(DropdownMenuSeparator4, {})
40099
+ /* @__PURE__ */ jsx128(DropdownMenuSeparator4, {})
40010
40100
  ] }) : null,
40011
- /* @__PURE__ */ jsx127(ObjectActionMenuItems, { actions })
40101
+ /* @__PURE__ */ jsx128(ObjectActionMenuItems, { actions })
40012
40102
  ] })
40013
40103
  ] }, "menu"),
40014
- moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ jsx127(
40104
+ moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ jsx128(
40015
40105
  WhereItLives,
40016
40106
  {
40017
40107
  tableId,
@@ -40024,7 +40114,7 @@ function TablePage({
40024
40114
  },
40025
40115
  "move"
40026
40116
  ) : null,
40027
- breakDownOpen ? /* @__PURE__ */ jsx127(
40117
+ breakDownOpen ? /* @__PURE__ */ jsx128(
40028
40118
  BreakDownDialog,
40029
40119
  {
40030
40120
  tableId,
@@ -40035,7 +40125,7 @@ function TablePage({
40035
40125
  },
40036
40126
  "break-down"
40037
40127
  ) : null,
40038
- subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ jsx127(
40128
+ subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ jsx128(
40039
40129
  CalendarSubscribeDialog,
40040
40130
  {
40041
40131
  port: recordsUi.calendarFeed,
@@ -40048,8 +40138,8 @@ function TablePage({
40048
40138
  },
40049
40139
  "subscribe"
40050
40140
  ) : null,
40051
- referenceOpen && table.data ? /* @__PURE__ */ jsx127(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
40052
- duplicateOpen && table.data ? /* @__PURE__ */ jsx127(
40141
+ referenceOpen && table.data ? /* @__PURE__ */ jsx128(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
40142
+ duplicateOpen && table.data ? /* @__PURE__ */ jsx128(
40053
40143
  TableDuplicateDialog,
40054
40144
  {
40055
40145
  tableId,
@@ -40061,40 +40151,40 @@ function TablePage({
40061
40151
  },
40062
40152
  "duplicate"
40063
40153
  ) : null,
40064
- rights.structure && table.data ? /* @__PURE__ */ jsx127(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
40154
+ rights.structure && table.data ? /* @__PURE__ */ jsx128(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
40065
40155
  ] });
40066
40156
  const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
40067
- if (table.error) return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40157
+ if (table.error) return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40068
40158
  headerNode,
40069
- /* @__PURE__ */ jsx127(RefusalNotice, { error: table.error })
40159
+ /* @__PURE__ */ jsx128(RefusalNotice, { error: table.error })
40070
40160
  ] });
40071
40161
  if (table.loading && !table.data) {
40072
- return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40162
+ return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40073
40163
  headerNode,
40074
- /* @__PURE__ */ jsx127(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
40164
+ /* @__PURE__ */ jsx128(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
40075
40165
  ] });
40076
40166
  }
40077
40167
  if (!table.data) {
40078
- return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40168
+ return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40079
40169
  headerNode,
40080
- /* @__PURE__ */ jsx127(TableNotHere, { tableId, onLeave, leaveLabel, className })
40170
+ /* @__PURE__ */ jsx128(TableNotHere, { tableId, onLeave, leaveLabel, className })
40081
40171
  ] });
40082
40172
  }
40083
40173
  const lookSavable = Boolean(
40084
40174
  rights.write && view && Object.keys(viewPatchDocument(saveToViewPlan(view, look ?? {}).patch)).length > 0
40085
40175
  );
40086
- return /* @__PURE__ */ jsxs120(ViewAddressContext.Provider, { value: addressPort, children: [
40087
- /* @__PURE__ */ jsxs120("div", { className: cn71("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
40176
+ return /* @__PURE__ */ jsxs121(ViewAddressContext.Provider, { value: addressPort, children: [
40177
+ /* @__PURE__ */ jsxs121("div", { className: cn71("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
40088
40178
  headerNode,
40089
- /* @__PURE__ */ jsx127("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
40179
+ /* @__PURE__ */ jsx128("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
40090
40180
  /* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
40091
- /* @__PURE__ */ jsxs120(Fragment56, { children: [
40092
- /* @__PURE__ */ jsx127("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
40093
- structure.hidden ? /* @__PURE__ */ jsx127(StructureLocked, {}) : /* @__PURE__ */ jsx127(RecordsSkeleton, { layout: skeletonFace, embedded })
40181
+ /* @__PURE__ */ jsxs121(Fragment56, { children: [
40182
+ /* @__PURE__ */ jsx128("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
40183
+ structure.hidden ? /* @__PURE__ */ jsx128(StructureLocked, {}) : /* @__PURE__ */ jsx128(RecordsSkeleton, { layout: skeletonFace, embedded })
40094
40184
  ] })
40095
- ) : /* @__PURE__ */ jsxs120(Fragment56, { children: [
40096
- /* @__PURE__ */ jsx127(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
40097
- /* @__PURE__ */ jsxs120(
40185
+ ) : /* @__PURE__ */ jsxs121(Fragment56, { children: [
40186
+ /* @__PURE__ */ jsx128(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
40187
+ /* @__PURE__ */ jsxs121(
40098
40188
  "div",
40099
40189
  {
40100
40190
  ref: setToolbarRow,
@@ -40102,7 +40192,7 @@ function TablePage({
40102
40192
  "data-table-toolbar": "",
40103
40193
  "data-table-toolbar-fold": toolbarFold2,
40104
40194
  children: [
40105
- /* @__PURE__ */ jsx127(
40195
+ /* @__PURE__ */ jsx128(
40106
40196
  ViewBar,
40107
40197
  {
40108
40198
  tableId,
@@ -40129,9 +40219,9 @@ function TablePage({
40129
40219
  },
40130
40220
  ...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
40131
40221
  seed: seedViews ?? [defaultView(tableId)],
40132
- settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs120("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
40133
- /* @__PURE__ */ jsx127("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
40134
- ["sticky", "inline"].map((option) => /* @__PURE__ */ jsxs120(
40222
+ settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs121("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
40223
+ /* @__PURE__ */ jsx128("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
40224
+ ["sticky", "inline"].map((option) => /* @__PURE__ */ jsxs121(
40135
40225
  "button",
40136
40226
  {
40137
40227
  type: "button",
@@ -40144,7 +40234,7 @@ function TablePage({
40144
40234
  ),
40145
40235
  onClick: () => setFooter(option),
40146
40236
  children: [
40147
- /* @__PURE__ */ jsx127(
40237
+ /* @__PURE__ */ jsx128(
40148
40238
  "span",
40149
40239
  {
40150
40240
  "aria-hidden": "true",
@@ -40160,8 +40250,8 @@ function TablePage({
40160
40250
  },
40161
40251
  viewsEpoch
40162
40252
  ),
40163
- chooserInline ? /* @__PURE__ */ jsxs120("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
40164
- VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(
40253
+ chooserInline ? /* @__PURE__ */ jsxs121("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
40254
+ VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(
40165
40255
  Button97,
40166
40256
  {
40167
40257
  size: "sm",
@@ -40172,7 +40262,7 @@ function TablePage({
40172
40262
  },
40173
40263
  option
40174
40264
  )),
40175
- /* @__PURE__ */ jsx127(
40265
+ /* @__PURE__ */ jsx128(
40176
40266
  Button97,
40177
40267
  {
40178
40268
  size: "sm",
@@ -40188,20 +40278,20 @@ function TablePage({
40188
40278
  /* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
40189
40279
  with the record panel open): the chooser folds to ONE button naming the layout that is
40190
40280
  showing — it never leaves the row. */
40191
- /* @__PURE__ */ jsx127("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40192
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs120(Button97, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
40281
+ /* @__PURE__ */ jsx128("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40282
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs121(Button97, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
40193
40283
  layoutShowingLabel ?? "Layout",
40194
- /* @__PURE__ */ jsx127("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx127("path", { d: "m6 9 6 6 6-6" }) })
40284
+ /* @__PURE__ */ jsx128("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx128("path", { d: "m6 9 6 6 6-6" }) })
40195
40285
  ] }) }),
40196
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
40197
- /* @__PURE__ */ jsx127(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40286
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
40287
+ /* @__PURE__ */ jsx128(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40198
40288
  layoutRadio
40199
40289
  ] })
40200
40290
  ] }) })
40201
40291
  ) : null,
40202
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx127(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
40203
- lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs120("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
40204
- /* @__PURE__ */ jsx127(
40292
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx128(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
40293
+ lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs121("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
40294
+ /* @__PURE__ */ jsx128(
40205
40295
  Button97,
40206
40296
  {
40207
40297
  size: "sm",
@@ -40211,36 +40301,36 @@ function TablePage({
40211
40301
  "aria-label": "Reset view",
40212
40302
  onClick: () => void resetLook(),
40213
40303
  "data-view-look-reset-button": "",
40214
- children: /* @__PURE__ */ jsxs120("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
40215
- /* @__PURE__ */ jsx127("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
40216
- /* @__PURE__ */ jsx127("path", { d: "M3 3v5h5" })
40304
+ children: /* @__PURE__ */ jsxs121("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
40305
+ /* @__PURE__ */ jsx128("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
40306
+ /* @__PURE__ */ jsx128("path", { d: "M3 3v5h5" })
40217
40307
  ] })
40218
40308
  }
40219
40309
  ),
40220
- /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40221
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs120(Button97, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
40222
- /* @__PURE__ */ jsx127(LookGlyph, {}),
40223
- /* @__PURE__ */ jsx127("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
40310
+ /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40311
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs121(Button97, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
40312
+ /* @__PURE__ */ jsx128(LookGlyph, {}),
40313
+ /* @__PURE__ */ jsx128("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
40224
40314
  ] }) }),
40225
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
40226
- lookSavable ? /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40227
- rights.write ? /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40228
- /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40315
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
40316
+ lookSavable ? /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40317
+ rights.write ? /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40318
+ /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40229
40319
  ] })
40230
40320
  ] })
40231
40321
  ] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
40232
40322
  /* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
40233
40323
  shrank on a narrow row, the look arriving on a sort pushed every control after it.
40234
40324
  A row too narrow for it scrolls sideways, as the row already does. */
40235
- /* @__PURE__ */ jsxs120("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
40236
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ jsx127(LookGlyph, {}) }),
40237
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
40325
+ /* @__PURE__ */ jsxs121("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
40326
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ jsx128(LookGlyph, {}) }),
40327
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
40238
40328
  ] })
40239
- ) : lookShowing && main === "records" ? /* @__PURE__ */ jsxs120("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
40240
- /* @__PURE__ */ jsx127("span", { className: "sr-only", children: LOOK_WORDS.yours }),
40241
- /* @__PURE__ */ jsx127("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
40242
- lookSavable ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40243
- rights.write ? namingLook ? /* @__PURE__ */ jsxs120(
40329
+ ) : lookShowing && main === "records" ? /* @__PURE__ */ jsxs121("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
40330
+ /* @__PURE__ */ jsx128("span", { className: "sr-only", children: LOOK_WORDS.yours }),
40331
+ /* @__PURE__ */ jsx128("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
40332
+ lookSavable ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40333
+ rights.write ? namingLook ? /* @__PURE__ */ jsxs121(
40244
40334
  "form",
40245
40335
  {
40246
40336
  className: "flex items-center gap-1",
@@ -40249,7 +40339,7 @@ function TablePage({
40249
40339
  void saveLookAsNewView(lookName);
40250
40340
  },
40251
40341
  children: [
40252
- /* @__PURE__ */ jsx127(
40342
+ /* @__PURE__ */ jsx128(
40253
40343
  Input11,
40254
40344
  {
40255
40345
  autoFocus: true,
@@ -40260,13 +40350,13 @@ function TablePage({
40260
40350
  placeholder: "View name"
40261
40351
  }
40262
40352
  ),
40263
- /* @__PURE__ */ jsx127(Button97, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
40353
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
40264
40354
  ]
40265
40355
  }
40266
- ) : /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40267
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40356
+ ) : /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40357
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40268
40358
  ] }) : null,
40269
- /* @__PURE__ */ jsx127(
40359
+ /* @__PURE__ */ jsx128(
40270
40360
  "div",
40271
40361
  {
40272
40362
  ref: setToolbarSlot,
@@ -40288,8 +40378,9 @@ function TablePage({
40288
40378
  "data-clipped": slotClipped
40289
40379
  }
40290
40380
  ),
40291
- rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ jsx127(Button97, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
40292
- openedFromMenu ? /* @__PURE__ */ jsx127(
40381
+ /* @__PURE__ */ jsx128(TablePresence, { tableId }),
40382
+ rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ jsx128(Button97, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
40383
+ openedFromMenu ? /* @__PURE__ */ jsx128(
40293
40384
  Button97,
40294
40385
  {
40295
40386
  size: "sm",
@@ -40302,18 +40393,18 @@ function TablePage({
40302
40393
  children: openedFromMenu.label
40303
40394
  }
40304
40395
  ) : null,
40305
- header ? null : /* @__PURE__ */ jsx127("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
40396
+ header ? null : /* @__PURE__ */ jsx128("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
40306
40397
  ]
40307
40398
  }
40308
40399
  ),
40309
- designateRefused ? /* @__PURE__ */ jsx127(RefusalNotice, { error: designateRefused }) : null,
40310
- viewSaveRefused ? /* @__PURE__ */ jsx127(
40400
+ designateRefused ? /* @__PURE__ */ jsx128(RefusalNotice, { error: designateRefused }) : null,
40401
+ viewSaveRefused ? /* @__PURE__ */ jsx128(
40311
40402
  RefusalNotice,
40312
40403
  {
40313
40404
  error: viewSaveRefused.error,
40314
- actions: /* @__PURE__ */ jsxs120("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
40315
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
40316
- /* @__PURE__ */ jsx127(
40405
+ actions: /* @__PURE__ */ jsxs121("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
40406
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
40407
+ /* @__PURE__ */ jsx128(
40317
40408
  Button97,
40318
40409
  {
40319
40410
  size: "sm",
@@ -40334,8 +40425,8 @@ function TablePage({
40334
40425
  ] })
40335
40426
  }
40336
40427
  ) : null,
40337
- lookRefused ? /* @__PURE__ */ jsx127(RefusalNotice, { error: lookRefused }) : null,
40338
- main === "dashboards" ? /* @__PURE__ */ jsx127(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx127("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx127(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx127(
40428
+ lookRefused ? /* @__PURE__ */ jsx128(RefusalNotice, { error: lookRefused }) : null,
40429
+ main === "dashboards" ? /* @__PURE__ */ jsx128(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx128("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx128(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx128(
40339
40430
  QuestionPanel,
40340
40431
  {
40341
40432
  tableId,
@@ -40347,7 +40438,7 @@ function TablePage({
40347
40438
  page returns to the records rather than leaving the person looking
40348
40439
  at a list the record is no longer in — and opens it, because the
40349
40440
  thing they just rescued is the thing they came for. */
40350
- /* @__PURE__ */ jsx127(
40441
+ /* @__PURE__ */ jsx128(
40351
40442
  ArchivedView,
40352
40443
  {
40353
40444
  tableId,
@@ -40359,7 +40450,7 @@ function TablePage({
40359
40450
  }
40360
40451
  }
40361
40452
  )
40362
- ) : /* @__PURE__ */ jsx127(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ jsx127(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ jsx127(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ jsxs120(
40453
+ ) : /* @__PURE__ */ jsx128(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ jsx128(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ jsx128(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ jsxs121(
40363
40454
  "div",
40364
40455
  {
40365
40456
  className: cn71(
@@ -40370,10 +40461,10 @@ function TablePage({
40370
40461
  ),
40371
40462
  "data-table-records": "",
40372
40463
  children: [
40373
- railUnknown ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
40374
- shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
40375
- opened.unknown ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
40376
- viewLinkMissed ? /* @__PURE__ */ jsx127(
40464
+ railUnknown ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
40465
+ shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
40466
+ opened.unknown ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
40467
+ viewLinkMissed ? /* @__PURE__ */ jsx128(
40377
40468
  "p",
40378
40469
  {
40379
40470
  "data-records-view-link-missed": "",
@@ -40381,7 +40472,7 @@ function TablePage({
40381
40472
  children: unknownSavedViewLine(view?.name ?? null)
40382
40473
  }
40383
40474
  ) : null,
40384
- cameFrom ? /* @__PURE__ */ jsx127(
40475
+ cameFrom ? /* @__PURE__ */ jsx128(
40385
40476
  "p",
40386
40477
  {
40387
40478
  "data-testid": "came-from-a-number",
@@ -40391,7 +40482,7 @@ function TablePage({
40391
40482
  ) : null,
40392
40483
  faceUnknown ? (
40393
40484
  /* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
40394
- /* @__PURE__ */ jsx127(
40485
+ /* @__PURE__ */ jsx128(
40395
40486
  RecordsSkeleton,
40396
40487
  {
40397
40488
  layout: skeletonFace,
@@ -40399,7 +40490,7 @@ function TablePage({
40399
40490
  ...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
40400
40491
  }
40401
40492
  )
40402
- ) : /* @__PURE__ */ jsx127(
40493
+ ) : /* @__PURE__ */ jsx128(
40403
40494
  ViewSwitcher,
40404
40495
  {
40405
40496
  chooser: false,
@@ -40448,13 +40539,13 @@ function TablePage({
40448
40539
  }
40449
40540
  }
40450
40541
  ),
40451
- view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
40542
+ view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ jsx128("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
40452
40543
  ]
40453
40544
  }
40454
40545
  ) }) }) })
40455
40546
  ] }) }),
40456
- rail === "none" ? null : /* @__PURE__ */ jsxs120(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
40457
- rail === "settings" ? /* @__PURE__ */ jsx127(
40547
+ rail === "none" ? null : /* @__PURE__ */ jsxs121(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
40548
+ rail === "settings" ? /* @__PURE__ */ jsx128(
40458
40549
  TableSettings,
40459
40550
  {
40460
40551
  tableId,
@@ -40471,7 +40562,7 @@ function TablePage({
40471
40562
  } : void 0
40472
40563
  }
40473
40564
  ) : null,
40474
- rail === "inbox" ? /* @__PURE__ */ jsx127(
40565
+ rail === "inbox" ? /* @__PURE__ */ jsx128(
40475
40566
  ActionInbox,
40476
40567
  {
40477
40568
  tableId,
@@ -40481,9 +40572,9 @@ function TablePage({
40481
40572
  }
40482
40573
  }
40483
40574
  ) : null,
40484
- rail === "forms" ? /* @__PURE__ */ jsx127(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
40485
- rail === "bookings" ? /* @__PURE__ */ jsx127(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
40486
- rail === "checklists" ? /* @__PURE__ */ jsx127(
40575
+ rail === "forms" ? /* @__PURE__ */ jsx128(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
40576
+ rail === "bookings" ? /* @__PURE__ */ jsx128(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
40577
+ rail === "checklists" ? /* @__PURE__ */ jsx128(
40487
40578
  ChecklistsPanel,
40488
40579
  {
40489
40580
  tableId,
@@ -40493,12 +40584,12 @@ function TablePage({
40493
40584
  }
40494
40585
  }
40495
40586
  ) : null,
40496
- rail === "notifications" ? /* @__PURE__ */ jsx127(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
40497
- rail === "portals" ? /* @__PURE__ */ jsx127(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
40498
- rail === "export" ? /* @__PURE__ */ jsx127(ExportMenu, { tableId, view: viewReading }) : null,
40499
- rail === "import" ? /* @__PURE__ */ jsx127(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
40500
- rail === "field" ? /* @__PURE__ */ jsx127(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
40501
- rail === "new-record" ? /* @__PURE__ */ jsx127(
40587
+ rail === "notifications" ? /* @__PURE__ */ jsx128(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
40588
+ rail === "portals" ? /* @__PURE__ */ jsx128(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
40589
+ rail === "export" ? /* @__PURE__ */ jsx128(ExportMenu, { tableId, view: viewReading }) : null,
40590
+ rail === "import" ? /* @__PURE__ */ jsx128(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
40591
+ rail === "field" ? /* @__PURE__ */ jsx128(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
40592
+ rail === "new-record" ? /* @__PURE__ */ jsx128(
40502
40593
  RecordForm,
40503
40594
  {
40504
40595
  tableId,
@@ -40509,7 +40600,7 @@ function TablePage({
40509
40600
  onCancel: () => setRail("none")
40510
40601
  }
40511
40602
  ) : null,
40512
- rail === "who-changed" && asking ? /* @__PURE__ */ jsx127(
40603
+ rail === "who-changed" && asking ? /* @__PURE__ */ jsx128(
40513
40604
  FieldHistoryPanel,
40514
40605
  {
40515
40606
  tableId,
@@ -40522,7 +40613,7 @@ function TablePage({
40522
40613
  }
40523
40614
  }
40524
40615
  ) : null,
40525
- rail === "record" && openRecord ? /* @__PURE__ */ jsx127(
40616
+ rail === "record" && openRecord ? /* @__PURE__ */ jsx128(
40526
40617
  RecordPanel,
40527
40618
  {
40528
40619
  tableId,
@@ -40542,15 +40633,15 @@ function TablePage({
40542
40633
  ) : null
40543
40634
  ] })
40544
40635
  ] }),
40545
- embedded ? null : /* @__PURE__ */ jsx127(GridShortcutsHelp, {})
40636
+ embedded ? null : /* @__PURE__ */ jsx128(GridShortcutsHelp, {})
40546
40637
  ] });
40547
40638
  }
40548
40639
  var PUBLIC_READ_ONLY = "Public \xB7 read only";
40549
40640
  function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40550
40641
  const readOnly = rights.known && rights.read && !rights.write;
40551
40642
  const marked = table?.published_to_web;
40552
- const [isPublic, setIsPublic] = useState116(false);
40553
- useEffect101(() => {
40643
+ const [isPublic, setIsPublic] = useState117(false);
40644
+ useEffect103(() => {
40554
40645
  if (!readOnly || !table) {
40555
40646
  setIsPublic(false);
40556
40647
  return;
@@ -40576,10 +40667,10 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40576
40667
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
40577
40668
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
40578
40669
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
40579
- import { useEffect as useEffect102, useMemo as useMemo71, useRef as useRef50, useState as useState117 } from "react";
40670
+ import { useEffect as useEffect104, useMemo as useMemo72, useRef as useRef52, useState as useState118 } from "react";
40580
40671
  import { Button as Button98, ErrorBox as ErrorBox5, Input as Input12, cn as cn72 } from "@ai-matrx/design-system";
40581
40672
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient91, useSeededAnswerAt } from "@ai-matrx/records/react";
40582
- import { Fragment as Fragment57, jsx as jsx128, jsxs as jsxs121 } from "react/jsx-runtime";
40673
+ import { Fragment as Fragment57, jsx as jsx129, jsxs as jsxs122 } from "react/jsx-runtime";
40583
40674
  var entityTitleColumn = entityNameColumn;
40584
40675
  function shown3(v) {
40585
40676
  if (v === null || v === void 0 || v === "") return "";
@@ -40589,15 +40680,15 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40589
40680
  const choiceColumns = entityChoiceColumns(entity.columns);
40590
40681
  const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
40591
40682
  const title = entityTitleColumn(entity.columns);
40592
- const extra = useMemo71(
40683
+ const extra = useMemo72(
40593
40684
  () => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
40594
40685
  [cardFields, entity.columns, title, column]
40595
40686
  );
40596
- const [refused, setRefused] = useState117(null);
40597
- const [over, setOver] = useState117(null);
40598
- if (entity.error) return /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
40687
+ const [refused, setRefused] = useState118(null);
40688
+ const [over, setOver] = useState118(null);
40689
+ if (entity.error) return /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
40599
40690
  if (!entity.loading && !column) {
40600
- return /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
40691
+ return /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
40601
40692
  }
40602
40693
  if (!column) return null;
40603
40694
  const words2 = column.choices ?? [];
@@ -40615,10 +40706,10 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40615
40706
  const says = await entity.update(id, column, to);
40616
40707
  if (says) setRefused({ to, says });
40617
40708
  };
40618
- return /* @__PURE__ */ jsx128("div", { className: cn72("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
40709
+ return /* @__PURE__ */ jsx129("div", { className: cn72("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
40619
40710
  const cards = rowsOf(lane.key);
40620
40711
  if (lane.key === "" && cards.length === 0) return null;
40621
- return /* @__PURE__ */ jsxs121(
40712
+ return /* @__PURE__ */ jsxs122(
40622
40713
  "section",
40623
40714
  {
40624
40715
  "aria-label": lane.label,
@@ -40630,12 +40721,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40630
40721
  onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
40631
40722
  onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
40632
40723
  children: [
40633
- /* @__PURE__ */ jsxs121("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
40634
- /* @__PURE__ */ jsx128("span", { className: "truncate font-medium", children: lane.label }),
40635
- /* @__PURE__ */ jsx128("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
40724
+ /* @__PURE__ */ jsxs122("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
40725
+ /* @__PURE__ */ jsx129("span", { className: "truncate font-medium", children: lane.label }),
40726
+ /* @__PURE__ */ jsx129("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
40636
40727
  ] }),
40637
- refused && refused.to === lane.key ? /* @__PURE__ */ jsx128(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
40638
- cards.map((row) => /* @__PURE__ */ jsxs121(
40728
+ refused && refused.to === lane.key ? /* @__PURE__ */ jsx129(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
40729
+ cards.map((row) => /* @__PURE__ */ jsxs122(
40639
40730
  "article",
40640
40731
  {
40641
40732
  draggable: writable,
@@ -40646,8 +40737,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40646
40737
  className: cn72("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
40647
40738
  "data-records-entity-card": row._id,
40648
40739
  children: [
40649
- onOpenRecord ? /* @__PURE__ */ jsx128("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }) : /* @__PURE__ */ jsx128("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }),
40650
- extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ jsx128("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
40740
+ onOpenRecord ? /* @__PURE__ */ jsx129("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }) : /* @__PURE__ */ jsx129("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }),
40741
+ extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ jsx129("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
40651
40742
  ]
40652
40743
  },
40653
40744
  row._id
@@ -40682,9 +40773,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40682
40773
  const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
40683
40774
  const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
40684
40775
  const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
40685
- const [block, setBlock] = useState117(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
40686
- const seededFor = useRef50(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40687
- useEffect102(() => {
40776
+ const [block, setBlock] = useState118(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
40777
+ const seededFor = useRef52(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40778
+ useEffect104(() => {
40688
40779
  const held = seededFor.current;
40689
40780
  if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
40690
40781
  seededFor.current = null;
@@ -40698,9 +40789,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40698
40789
  };
40699
40790
  }, [client, ask2, kind2, title]);
40700
40791
  if (!block) {
40701
- return /* @__PURE__ */ jsx128(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
40792
+ return /* @__PURE__ */ jsx129(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
40702
40793
  }
40703
- return /* @__PURE__ */ jsx128(
40794
+ return /* @__PURE__ */ jsx129(
40704
40795
  ChartBlock,
40705
40796
  {
40706
40797
  block,
@@ -40713,7 +40804,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40713
40804
  );
40714
40805
  }
40715
40806
  function EntityTablePage(props) {
40716
- return /* @__PURE__ */ jsx128(EntityDataScope, { children: /* @__PURE__ */ jsx128(EntityTablePageBody, { ...props }) });
40807
+ return /* @__PURE__ */ jsx129(EntityDataScope, { children: /* @__PURE__ */ jsx129(EntityTablePageBody, { ...props }) });
40717
40808
  }
40718
40809
  function EntityTablePageBody({
40719
40810
  source,
@@ -40729,20 +40820,20 @@ function EntityTablePageBody({
40729
40820
  actions,
40730
40821
  className
40731
40822
  }) {
40732
- const [typed2, setTyped] = useState117("");
40823
+ const [typed2, setTyped] = useState118("");
40733
40824
  const term = searchOverride ?? typed2;
40734
40825
  const entity = useEntityTable(source.token, { pageSize, search: term });
40735
- const [layout, setLayout] = useState117(opened);
40736
- useEffect102(() => setLayout(opened), [opened]);
40826
+ const [layout, setLayout] = useState118(opened);
40827
+ useEffect104(() => setLayout(opened), [opened]);
40737
40828
  const choose = (next) => {
40738
40829
  setLayout(next);
40739
40830
  onLayoutChange?.(next);
40740
40831
  };
40741
40832
  const boardable = entityChoiceColumns(entity.columns).length > 0;
40742
40833
  const nameColumn = entityNameColumn(entity.columns);
40743
- const [naming, setNaming] = useState117(null);
40744
- const [adding, setAdding] = useState117(false);
40745
- const [addRefused, setAddRefused] = useState117(null);
40834
+ const [naming, setNaming] = useState118(null);
40835
+ const [adding, setAdding] = useState118(false);
40836
+ const [addRefused, setAddRefused] = useState118(null);
40746
40837
  const add = async () => {
40747
40838
  const name = (naming ?? "").trim();
40748
40839
  if (!name || !nameColumn || adding) return;
@@ -40754,7 +40845,7 @@ function EntityTablePageBody({
40754
40845
  setNaming(null);
40755
40846
  onOpenRecord?.(made.id);
40756
40847
  };
40757
- const [question, setQuestion] = useState117(() => questionFromGrouping(void 0));
40848
+ const [question, setQuestion] = useState118(() => questionFromGrouping(void 0));
40758
40849
  const { config: drill } = useDrill({
40759
40850
  source,
40760
40851
  question,
@@ -40763,20 +40854,20 @@ function EntityTablePageBody({
40763
40854
  rowNoun: (entity.label ?? "record").toLowerCase(),
40764
40855
  enabled: layout === "grid"
40765
40856
  });
40766
- return /* @__PURE__ */ jsxs121("div", { className: cn72("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
40767
- presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs121("div", { className: "flex min-w-0 items-center gap-2", children: [
40768
- presentation === "page" ? /* @__PURE__ */ jsx128("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
40769
- presentation === "page" ? /* @__PURE__ */ jsx128("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
40770
- /* @__PURE__ */ jsxs121("span", { className: "ml-auto flex items-center gap-1", children: [
40771
- boardable ? /* @__PURE__ */ jsxs121(Fragment57, { children: [
40772
- /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
40773
- /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
40857
+ return /* @__PURE__ */ jsxs122("div", { className: cn72("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
40858
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs122("div", { className: "flex min-w-0 items-center gap-2", children: [
40859
+ presentation === "page" ? /* @__PURE__ */ jsx129("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
40860
+ presentation === "page" ? /* @__PURE__ */ jsx129("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
40861
+ /* @__PURE__ */ jsxs122("span", { className: "ml-auto flex items-center gap-1", children: [
40862
+ boardable ? /* @__PURE__ */ jsxs122(Fragment57, { children: [
40863
+ /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
40864
+ /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
40774
40865
  ] }) : null,
40775
- entity.creatable && naming === null ? /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: "ghost", onClick: () => {
40866
+ entity.creatable && naming === null ? /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: "ghost", onClick: () => {
40776
40867
  setAddRefused(null);
40777
40868
  setNaming("");
40778
40869
  }, children: "New page" }) : null,
40779
- entity.creatable && naming !== null ? /* @__PURE__ */ jsx128(
40870
+ entity.creatable && naming !== null ? /* @__PURE__ */ jsx129(
40780
40871
  Input12,
40781
40872
  {
40782
40873
  autoFocus: true,
@@ -40806,9 +40897,9 @@ function EntityTablePageBody({
40806
40897
  actions
40807
40898
  ] })
40808
40899
  ] }) : null,
40809
- addRefused ? /* @__PURE__ */ jsx128(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
40810
- entity.error ? /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx128(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs121(Fragment57, { children: [
40811
- presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx128("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx128(TooltipProvider, { children: /* @__PURE__ */ jsx128(
40900
+ addRefused ? /* @__PURE__ */ jsx129(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
40901
+ entity.error ? /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx129(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs122(Fragment57, { children: [
40902
+ presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx129("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx129(TooltipProvider, { children: /* @__PURE__ */ jsx129(
40812
40903
  TapTargetSearchGroup2,
40813
40904
  {
40814
40905
  surface: "solid",
@@ -40820,8 +40911,8 @@ function EntityTablePageBody({
40820
40911
  }
40821
40912
  }
40822
40913
  ) }) }) : null,
40823
- /* @__PURE__ */ jsx128(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
40824
- entity.hasMore ? /* @__PURE__ */ jsx128(
40914
+ /* @__PURE__ */ jsx129(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
40915
+ entity.hasMore ? /* @__PURE__ */ jsx129(
40825
40916
  MatrxTableCardShowMore3,
40826
40917
  {
40827
40918
  shown: entity.rows.length,
@@ -40835,12 +40926,12 @@ function EntityTablePageBody({
40835
40926
  }
40836
40927
 
40837
40928
  // src/TablePageSource.tsx
40838
- import { jsx as jsx129 } from "react/jsx-runtime";
40929
+ import { jsx as jsx130 } from "react/jsx-runtime";
40839
40930
  function TablePage2(props) {
40840
- if (props.source === void 0) return /* @__PURE__ */ jsx129(TablePage, { ...props });
40931
+ if (props.source === void 0) return /* @__PURE__ */ jsx130(TablePage, { ...props });
40841
40932
  const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
40842
- if (source.kind === "table") return /* @__PURE__ */ jsx129(TablePage, { ...rest, tableId: source.id });
40843
- return /* @__PURE__ */ jsx129(
40933
+ if (source.kind === "table") return /* @__PURE__ */ jsx130(TablePage, { ...rest, tableId: source.id });
40934
+ return /* @__PURE__ */ jsx130(
40844
40935
  EntityTablePage,
40845
40936
  {
40846
40937
  source,
@@ -40859,14 +40950,14 @@ function TablePage2(props) {
40859
40950
  }
40860
40951
 
40861
40952
  // src/CalendarLinks.tsx
40862
- import { useCallback as useCallback61, useEffect as useEffect103, useState as useState118 } from "react";
40953
+ import { useCallback as useCallback61, useEffect as useEffect105, useState as useState119 } from "react";
40863
40954
  import { Button as Button99 } from "@ai-matrx/design-system";
40864
- import { jsx as jsx130, jsxs as jsxs122 } from "react/jsx-runtime";
40955
+ import { jsx as jsx131, jsxs as jsxs123 } from "react/jsx-runtime";
40865
40956
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
40866
40957
  function CalendarLinks({ port }) {
40867
- const [rows, setRows] = useState118(null);
40868
- const [error, setError] = useState118(null);
40869
- const [fresh, setFresh] = useState118(null);
40958
+ const [rows, setRows] = useState119(null);
40959
+ const [error, setError] = useState119(null);
40960
+ const [fresh, setFresh] = useState119(null);
40870
40961
  const load = useCallback61(async () => {
40871
40962
  try {
40872
40963
  setRows(await port.list());
@@ -40875,7 +40966,7 @@ function CalendarLinks({ port }) {
40875
40966
  setError(asRefusal3(e, "The links could not be read"));
40876
40967
  }
40877
40968
  }, [port]);
40878
- useEffect103(() => {
40969
+ useEffect105(() => {
40879
40970
  void load();
40880
40971
  }, [load]);
40881
40972
  const act = async (run) => {
@@ -40886,15 +40977,15 @@ function CalendarLinks({ port }) {
40886
40977
  setError(asRefusal3(e, "That didn\u2019t work"));
40887
40978
  }
40888
40979
  };
40889
- if (rows === null && !error) return /* @__PURE__ */ jsx130("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
40890
- return /* @__PURE__ */ jsxs122("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
40891
- error ? /* @__PURE__ */ jsx130(RefusalNotice, { error }) : null,
40892
- rows && rows.length === 0 ? /* @__PURE__ */ jsx130("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
40893
- rows?.map((row) => /* @__PURE__ */ jsxs122("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
40894
- /* @__PURE__ */ jsxs122("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
40895
- /* @__PURE__ */ jsxs122("div", { className: "min-w-0", children: [
40896
- /* @__PURE__ */ jsx130("div", { className: "truncate text-sm font-medium", children: row.title }),
40897
- /* @__PURE__ */ jsxs122("div", { className: "text-xs text-muted-foreground", children: [
40980
+ if (rows === null && !error) return /* @__PURE__ */ jsx131("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
40981
+ return /* @__PURE__ */ jsxs123("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
40982
+ error ? /* @__PURE__ */ jsx131(RefusalNotice, { error }) : null,
40983
+ rows && rows.length === 0 ? /* @__PURE__ */ jsx131("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
40984
+ rows?.map((row) => /* @__PURE__ */ jsxs123("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
40985
+ /* @__PURE__ */ jsxs123("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
40986
+ /* @__PURE__ */ jsxs123("div", { className: "min-w-0", children: [
40987
+ /* @__PURE__ */ jsx131("div", { className: "truncate text-sm font-medium", children: row.title }),
40988
+ /* @__PURE__ */ jsxs123("div", { className: "text-xs text-muted-foreground", children: [
40898
40989
  "Made ",
40899
40990
  day(row.created_at),
40900
40991
  " \xB7 ",
@@ -40903,8 +40994,8 @@ function CalendarLinks({ port }) {
40903
40994
  row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
40904
40995
  ] })
40905
40996
  ] }),
40906
- /* @__PURE__ */ jsxs122("div", { className: "flex shrink-0 gap-2", children: [
40907
- /* @__PURE__ */ jsx130(
40997
+ /* @__PURE__ */ jsxs123("div", { className: "flex shrink-0 gap-2", children: [
40998
+ /* @__PURE__ */ jsx131(
40908
40999
  Button99,
40909
41000
  {
40910
41001
  size: "sm",
@@ -40918,7 +41009,7 @@ function CalendarLinks({ port }) {
40918
41009
  children: "Rotate"
40919
41010
  }
40920
41011
  ),
40921
- /* @__PURE__ */ jsx130(
41012
+ /* @__PURE__ */ jsx131(
40922
41013
  Button99,
40923
41014
  {
40924
41015
  size: "sm",
@@ -40934,30 +41025,30 @@ function CalendarLinks({ port }) {
40934
41025
  )
40935
41026
  ] })
40936
41027
  ] }),
40937
- fresh?.id === row.id ? /* @__PURE__ */ jsx130(CalendarLinkOnce, { url: fresh.url }) : null
41028
+ fresh?.id === row.id ? /* @__PURE__ */ jsx131(CalendarLinkOnce, { url: fresh.url }) : null
40938
41029
  ] }, row.id))
40939
41030
  ] });
40940
41031
  }
40941
41032
 
40942
41033
  // src/TemplatePreview.tsx
40943
- import { useEffect as useEffect104, useMemo as useMemo72, useState as useState119 } from "react";
41034
+ import { useEffect as useEffect106, useMemo as useMemo73, useState as useState120 } from "react";
40944
41035
  import { templatePreview } from "@ai-matrx/records/memory";
40945
41036
  import { useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
40946
41037
  import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
40947
- import { jsx as jsx131, jsxs as jsxs123 } from "react/jsx-runtime";
41038
+ import { jsx as jsx132, jsxs as jsxs124 } from "react/jsx-runtime";
40948
41039
  function useTemplatePreview(spec, today) {
40949
- return useMemo72(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
41040
+ return useMemo73(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
40950
41041
  }
40951
41042
  function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
40952
41043
  const preview = useTemplatePreview(spec, today);
40953
- const bound = useMemo72(() => ({ ...host, sayLevelNeeded: false }), [host]);
41044
+ const bound = useMemo73(() => ({ ...host, sayLevelNeeded: false }), [host]);
40954
41045
  const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
40955
- const [active, setActive] = useState119(first?.id ?? null);
41046
+ const [active, setActive] = useState120(first?.id ?? null);
40956
41047
  const table = preview.tables.find((t) => t.id === active) ?? first;
40957
41048
  if (!table) return null;
40958
- return /* @__PURE__ */ jsxs123("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
40959
- preview.tables.length > 1 || aside ? /* @__PURE__ */ jsxs123("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
40960
- preview.tables.map((t) => /* @__PURE__ */ jsxs123(
41049
+ return /* @__PURE__ */ jsxs124("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
41050
+ preview.tables.length > 1 || aside ? /* @__PURE__ */ jsxs124("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
41051
+ preview.tables.map((t) => /* @__PURE__ */ jsxs124(
40961
41052
  "button",
40962
41053
  {
40963
41054
  type: "button",
@@ -40971,28 +41062,28 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
40971
41062
  ].join(" "),
40972
41063
  children: [
40973
41064
  t.name,
40974
- /* @__PURE__ */ jsx131("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
41065
+ /* @__PURE__ */ jsx132("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
40975
41066
  ]
40976
41067
  },
40977
41068
  t.id
40978
41069
  )),
40979
- aside ? /* @__PURE__ */ jsx131("div", { className: "ml-auto", children: aside }) : null
41070
+ aside ? /* @__PURE__ */ jsx132("div", { className: "ml-auto", children: aside }) : null
40980
41071
  ] }) : null,
40981
- /* @__PURE__ */ jsxs123(RecordsMount, { config: preview.config, host: bound, children: [
40982
- /* @__PURE__ */ jsx131("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsx131(TablePage, { tableId: table.id }, table.id) }),
40983
- /* @__PURE__ */ jsx131(PreviewForms, { preview, booking }),
40984
- preview.dashboards.length ? /* @__PURE__ */ jsxs123("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
40985
- /* @__PURE__ */ jsx131("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
40986
- preview.dashboards.map((d) => /* @__PURE__ */ jsx131("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ jsx131(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
41072
+ /* @__PURE__ */ jsxs124(RecordsMount, { config: preview.config, host: bound, children: [
41073
+ /* @__PURE__ */ jsx132("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsx132(TablePage, { tableId: table.id }, table.id) }),
41074
+ /* @__PURE__ */ jsx132(PreviewForms, { preview, booking }),
41075
+ preview.dashboards.length ? /* @__PURE__ */ jsxs124("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
41076
+ /* @__PURE__ */ jsx132("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
41077
+ preview.dashboards.map((d) => /* @__PURE__ */ jsx132("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ jsx132(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
40987
41078
  ] }) : null
40988
41079
  ] })
40989
41080
  ] });
40990
41081
  }
40991
41082
  function PreviewForms({ preview, booking }) {
40992
41083
  const client = useRecordsClient92();
40993
- const [forms, setForms] = useState119(null);
40994
- const [pages, setPages] = useState119([]);
40995
- useEffect104(() => {
41084
+ const [forms, setForms] = useState120(null);
41085
+ const [pages, setPages] = useState120([]);
41086
+ useEffect106(() => {
40996
41087
  let gone = false;
40997
41088
  void client.forms().then((answered) => {
40998
41089
  if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
@@ -41011,21 +41102,21 @@ function PreviewForms({ preview, booking }) {
41011
41102
  };
41012
41103
  }, [client, preview, booking]);
41013
41104
  if (!forms?.length && !pages.length) return null;
41014
- return /* @__PURE__ */ jsxs123("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
41015
- /* @__PURE__ */ jsx131("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
41016
- /* @__PURE__ */ jsx131("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ jsxs123("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
41017
- /* @__PURE__ */ jsx131("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
41018
- /* @__PURE__ */ jsx131(FormRunner, { form: f, preview: true })
41105
+ return /* @__PURE__ */ jsxs124("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
41106
+ /* @__PURE__ */ jsx132("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
41107
+ /* @__PURE__ */ jsx132("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ jsxs124("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
41108
+ /* @__PURE__ */ jsx132("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
41109
+ /* @__PURE__ */ jsx132(FormRunner, { form: f, preview: true })
41019
41110
  ] }, f.id)) }),
41020
- booking ? pages.map((p) => /* @__PURE__ */ jsxs123("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
41021
- /* @__PURE__ */ jsx131("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
41111
+ booking ? pages.map((p) => /* @__PURE__ */ jsxs124("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
41112
+ /* @__PURE__ */ jsx132("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
41022
41113
  booking(p.page)
41023
41114
  ] }, p.id)) : null
41024
41115
  ] });
41025
41116
  }
41026
41117
 
41027
41118
  // src/SectionCard.tsx
41028
- import { useEffect as useEffect105, useRef as useRef51, useState as useState120 } from "react";
41119
+ import { useEffect as useEffect107, useRef as useRef53, useState as useState121 } from "react";
41029
41120
  import { atLeast } from "@ai-matrx/records/field-kinds";
41030
41121
  import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useTable as useTable37 } from "@ai-matrx/records/react";
41031
41122
  import {
@@ -41048,7 +41139,7 @@ import {
41048
41139
  } from "@ai-matrx/design-system";
41049
41140
  import { PlusIcon, StickyNoteIcon } from "@ai-matrx/design-system/icons";
41050
41141
  import { readColorPair } from "@ai-matrx/design-system/field-formats";
41051
- import { jsx as jsx132, jsxs as jsxs124 } from "react/jsx-runtime";
41142
+ import { jsx as jsx133, jsxs as jsxs125 } from "react/jsx-runtime";
41052
41143
  var NAME_KEYS2 = ["name", "title", "token", "label"];
41053
41144
  var GROUP_KEYS = ["group", "set", "section", "category"];
41054
41145
  var NOTE_KEYS = ["usage_note", "note", "notes", "usage"];
@@ -41092,12 +41183,12 @@ function columnsOf(values) {
41092
41183
  }
41093
41184
  var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
41094
41185
  function useDraft(stored, save) {
41095
- const [draft, setDraft] = useState120(null);
41096
- const latest = useRef51({ draft, save, stored });
41097
- useEffect105(() => {
41186
+ const [draft, setDraft] = useState121(null);
41187
+ const latest = useRef53({ draft, save, stored });
41188
+ useEffect107(() => {
41098
41189
  latest.current = { draft, save, stored };
41099
41190
  });
41100
- useEffect105(() => {
41191
+ useEffect107(() => {
41101
41192
  if (!draft || draft.phase !== "typing") return;
41102
41193
  const timer = setTimeout(() => {
41103
41194
  const sending = draft.value;
@@ -41109,7 +41200,7 @@ function useDraft(stored, save) {
41109
41200
  }, SAVE_AFTER_MS);
41110
41201
  return () => clearTimeout(timer);
41111
41202
  }, [draft]);
41112
- useEffect105(
41203
+ useEffect107(
41113
41204
  () => () => {
41114
41205
  const held = latest.current;
41115
41206
  if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
@@ -41121,9 +41212,9 @@ function useDraft(stored, save) {
41121
41212
  }
41122
41213
  function ChecksLine({ checks, onFix }) {
41123
41214
  if (checks.length === 0) return null;
41124
- return /* @__PURE__ */ jsx132("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ jsxs124("span", { className: "flex flex-col items-start gap-1", children: [
41125
- /* @__PURE__ */ jsx132("span", { className: "text-xs text-warning-ink", children: check.message }),
41126
- check.fix && onFix ? /* @__PURE__ */ jsx132(Button100, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
41215
+ return /* @__PURE__ */ jsx133("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ jsxs125("span", { className: "flex flex-col items-start gap-1", children: [
41216
+ /* @__PURE__ */ jsx133("span", { className: "text-xs text-warning-ink", children: check.message }),
41217
+ check.fix && onFix ? /* @__PURE__ */ jsx133(Button100, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
41127
41218
  ] }, i)) });
41128
41219
  }
41129
41220
  function ValueCell({
@@ -41140,16 +41231,16 @@ function ValueCell({
41140
41231
  const fix = onFix ? (check) => onFix({ check, row, field }) : void 0;
41141
41232
  const id = `section-${row.id}-${field.key}`;
41142
41233
  const withheld = row.hidden?.[field.key] ?? null;
41143
- if (withheld) return /* @__PURE__ */ jsx132(RecordValue, { field, value: null, withheld });
41234
+ if (withheld) return /* @__PURE__ */ jsx133(RecordValue, { field, value: null, withheld });
41144
41235
  if (format?.id === "color_pair") {
41145
41236
  const pair = readColorPair(value) ?? null;
41146
41237
  const contrast = pair ? colorPairContrast(pair, format) : {};
41147
- return /* @__PURE__ */ jsx132("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
41238
+ return /* @__PURE__ */ jsx133("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
41148
41239
  const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
41149
41240
  const ratio = contrast[part];
41150
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0 px-3", children: [
41151
- /* @__PURE__ */ jsxs124("div", { className: "flex min-w-0 items-center gap-2", children: [
41152
- editable ? /* @__PURE__ */ jsx132(
41241
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0 px-3", children: [
41242
+ /* @__PURE__ */ jsxs125("div", { className: "flex min-w-0 items-center gap-2", children: [
41243
+ editable ? /* @__PURE__ */ jsx133(
41153
41244
  ColorWell,
41154
41245
  {
41155
41246
  id: `${id}-${part}`,
@@ -41163,10 +41254,10 @@ function ValueCell({
41163
41254
  change(updated.light ? JSON.stringify(updated) : null);
41164
41255
  }
41165
41256
  }
41166
- ) : /* @__PURE__ */ jsx132("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
41167
- ratio !== void 0 ? /* @__PURE__ */ jsx132(ContrastMark, { ratio }) : null
41257
+ ) : /* @__PURE__ */ jsx133("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
41258
+ ratio !== void 0 ? /* @__PURE__ */ jsx133(ContrastMark, { ratio }) : null
41168
41259
  ] }),
41169
- /* @__PURE__ */ jsx132(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
41260
+ /* @__PURE__ */ jsx133(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
41170
41261
  ] }, part);
41171
41262
  }) });
41172
41263
  }
@@ -41174,21 +41265,21 @@ function ValueCell({
41174
41265
  const pictureFirst = format?.id === "type_style" || format?.id === "shadow";
41175
41266
  if (look && pictureFirst) {
41176
41267
  const { Editor, Preview: Preview2 } = look;
41177
- const view = /* @__PURE__ */ jsx132(RecordValue, { field, value, withheld: null });
41178
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41179
- editable && Editor ? /* @__PURE__ */ jsxs124(Popover12, { children: [
41180
- /* @__PURE__ */ jsx132(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx132("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ jsx132("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
41181
- /* @__PURE__ */ jsxs124(PopoverContent12, { align: "start", className: "w-80", children: [
41182
- Preview2 ? /* @__PURE__ */ jsx132("div", { className: "mb-3", children: /* @__PURE__ */ jsx132(Preview2, { value, format }) }) : null,
41183
- Editor ? /* @__PURE__ */ jsx132(Editor, { value, format, onChange: change, id, label: fieldName(field) }) : null
41268
+ const view = /* @__PURE__ */ jsx133(RecordValue, { field, value, withheld: null });
41269
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41270
+ editable && Editor ? /* @__PURE__ */ jsxs125(Popover12, { children: [
41271
+ /* @__PURE__ */ jsx133(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx133("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ jsx133("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
41272
+ /* @__PURE__ */ jsxs125(PopoverContent12, { align: "start", className: "w-80", children: [
41273
+ Preview2 ? /* @__PURE__ */ jsx133("div", { className: "mb-3", children: /* @__PURE__ */ jsx133(Preview2, { value, format }) }) : null,
41274
+ Editor ? /* @__PURE__ */ jsx133(Editor, { value, format, onChange: change, id, label: fieldName(field) }) : null
41184
41275
  ] })
41185
41276
  ] }) : view,
41186
- /* @__PURE__ */ jsx132(ChecksLine, { checks, onFix: fix })
41277
+ /* @__PURE__ */ jsx133(ChecksLine, { checks, onFix: fix })
41187
41278
  ] });
41188
41279
  }
41189
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41190
- editable ? /* @__PURE__ */ jsx132(FieldControl, { field, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ jsx132(RecordValue, { field, value, withheld: null }),
41191
- /* @__PURE__ */ jsx132(ChecksLine, { checks, onFix: fix })
41280
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41281
+ editable ? /* @__PURE__ */ jsx133(FieldControl, { field, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ jsx133(RecordValue, { field, value, withheld: null }),
41282
+ /* @__PURE__ */ jsx133(ChecksLine, { checks, onFix: fix })
41192
41283
  ] });
41193
41284
  }
41194
41285
  function NoteButton({ row, noteField, editable, save }) {
@@ -41196,8 +41287,8 @@ function NoteButton({ row, noteField, editable, save }) {
41196
41287
  const [value, change] = useDraft(stored, (next) => save(noteField, next));
41197
41288
  const text = typeof value === "string" ? value : "";
41198
41289
  const has = text.trim() !== "";
41199
- return /* @__PURE__ */ jsxs124(Popover12, { children: [
41200
- /* @__PURE__ */ jsx132(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx132(
41290
+ return /* @__PURE__ */ jsxs125(Popover12, { children: [
41291
+ /* @__PURE__ */ jsx133(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx133(
41201
41292
  "button",
41202
41293
  {
41203
41294
  type: "button",
@@ -41207,10 +41298,10 @@ function NoteButton({ row, noteField, editable, save }) {
41207
41298
  "inline-flex h-7 w-7 items-center justify-center rounded-md hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
41208
41299
  has ? "text-foreground" : "text-muted-foreground"
41209
41300
  ),
41210
- children: /* @__PURE__ */ jsx132(StickyNoteIcon, { className: "h-4 w-4" })
41301
+ children: /* @__PURE__ */ jsx133(StickyNoteIcon, { className: "h-4 w-4" })
41211
41302
  }
41212
41303
  ) }),
41213
- /* @__PURE__ */ jsx132(PopoverContent12, { align: "end", className: "w-72", children: /* @__PURE__ */ jsx132(
41304
+ /* @__PURE__ */ jsx133(PopoverContent12, { align: "end", className: "w-72", children: /* @__PURE__ */ jsx133(
41214
41305
  BasicTextarea8,
41215
41306
  {
41216
41307
  "aria-label": fieldName(noteField),
@@ -41244,13 +41335,13 @@ function AddDialog({
41244
41335
  }
41245
41336
  return out;
41246
41337
  };
41247
- const [data, setData] = useState120(starters);
41248
- const [name, setName] = useState120("");
41249
- const [group, setGroup] = useState120(startGroup);
41250
- const [newGroup, setNewGroup] = useState120("");
41251
- const [note, setNote] = useState120("");
41252
- const [busy, setBusy] = useState120(false);
41253
- const [seenOpen, setSeenOpen] = useState120(open);
41338
+ const [data, setData] = useState121(starters);
41339
+ const [name, setName] = useState121("");
41340
+ const [group, setGroup] = useState121(startGroup);
41341
+ const [newGroup, setNewGroup] = useState121("");
41342
+ const [note, setNote] = useState121("");
41343
+ const [busy, setBusy] = useState121(false);
41344
+ const [seenOpen, setSeenOpen] = useState121(open);
41254
41345
  if (seenOpen !== open) {
41255
41346
  setSeenOpen(open);
41256
41347
  if (open) {
@@ -41268,12 +41359,12 @@ function AddDialog({
41268
41359
  const ready = !busy && name.trim() !== "" && (!groupField || group !== "__new" || newGroup.trim() !== "");
41269
41360
  const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
41270
41361
  const labelCls = "pt-2 text-sm text-muted-foreground";
41271
- return /* @__PURE__ */ jsx132(Dialog21, { open, onOpenChange, children: /* @__PURE__ */ jsxs124(DialogContent21, { className: "max-w-md", children: [
41272
- /* @__PURE__ */ jsx132(DialogHeader21, { children: /* @__PURE__ */ jsxs124(DialogTitle21, { children: [
41362
+ return /* @__PURE__ */ jsx133(Dialog21, { open, onOpenChange, children: /* @__PURE__ */ jsxs125(DialogContent21, { className: "max-w-md", children: [
41363
+ /* @__PURE__ */ jsx133(DialogHeader21, { children: /* @__PURE__ */ jsxs125(DialogTitle21, { children: [
41273
41364
  "New ",
41274
41365
  noun
41275
41366
  ] }) }),
41276
- /* @__PURE__ */ jsxs124(
41367
+ /* @__PURE__ */ jsxs125(
41277
41368
  "form",
41278
41369
  {
41279
41370
  className: "flex flex-col gap-3",
@@ -41289,40 +41380,40 @@ function AddDialog({
41289
41380
  if (ok) onOpenChange(false);
41290
41381
  },
41291
41382
  children: [
41292
- preview ? /* @__PURE__ */ jsx132("div", { children: preview }) : null,
41293
- groupField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41294
- /* @__PURE__ */ jsx132("span", { className: labelCls, children: fieldName(groupField) }),
41295
- /* @__PURE__ */ jsxs124("div", { className: "flex flex-col gap-2", children: [
41296
- /* @__PURE__ */ jsxs124(Select20, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
41297
- /* @__PURE__ */ jsx132(SelectTrigger13, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ jsx132(SelectValue13, {}) }),
41298
- /* @__PURE__ */ jsxs124(SelectContent13, { children: [
41299
- /* @__PURE__ */ jsx132(SelectItem13, { value: "__none", children: "None" }),
41300
- groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ jsx132(SelectItem13, { value: g, children: g }, g)),
41301
- /* @__PURE__ */ jsxs124(SelectItem13, { value: "__new", children: [
41383
+ preview ? /* @__PURE__ */ jsx133("div", { children: preview }) : null,
41384
+ groupField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41385
+ /* @__PURE__ */ jsx133("span", { className: labelCls, children: fieldName(groupField) }),
41386
+ /* @__PURE__ */ jsxs125("div", { className: "flex flex-col gap-2", children: [
41387
+ /* @__PURE__ */ jsxs125(Select20, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
41388
+ /* @__PURE__ */ jsx133(SelectTrigger13, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ jsx133(SelectValue13, {}) }),
41389
+ /* @__PURE__ */ jsxs125(SelectContent13, { children: [
41390
+ /* @__PURE__ */ jsx133(SelectItem13, { value: "__none", children: "None" }),
41391
+ groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ jsx133(SelectItem13, { value: g, children: g }, g)),
41392
+ /* @__PURE__ */ jsxs125(SelectItem13, { value: "__new", children: [
41302
41393
  "New ",
41303
41394
  fieldName(groupField).toLowerCase(),
41304
41395
  "\u2026"
41305
41396
  ] })
41306
41397
  ] })
41307
41398
  ] }),
41308
- group === "__new" ? /* @__PURE__ */ jsx132(BasicInput24, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
41399
+ group === "__new" ? /* @__PURE__ */ jsx133(BasicInput24, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
41309
41400
  ] })
41310
41401
  ] }) : null,
41311
- nameField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41312
- /* @__PURE__ */ jsx132("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
41313
- /* @__PURE__ */ jsx132(BasicInput24, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
41402
+ nameField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41403
+ /* @__PURE__ */ jsx133("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
41404
+ /* @__PURE__ */ jsx133(BasicInput24, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
41314
41405
  ] }) : null,
41315
- values.map((field) => /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41316
- /* @__PURE__ */ jsx132("label", { htmlFor: `section-add-${field.key}`, className: labelCls, children: fieldName(field) }),
41317
- /* @__PURE__ */ jsx132(FieldControl, { field, value: data[field.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field.key]: v })), id: `section-add-${field.key}`, asForm: true })
41406
+ values.map((field) => /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41407
+ /* @__PURE__ */ jsx133("label", { htmlFor: `section-add-${field.key}`, className: labelCls, children: fieldName(field) }),
41408
+ /* @__PURE__ */ jsx133(FieldControl, { field, value: data[field.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field.key]: v })), id: `section-add-${field.key}`, asForm: true })
41318
41409
  ] }, field.key)),
41319
- noteField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41320
- /* @__PURE__ */ jsx132("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
41321
- /* @__PURE__ */ jsx132(BasicTextarea8, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
41410
+ noteField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41411
+ /* @__PURE__ */ jsx133("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
41412
+ /* @__PURE__ */ jsx133(BasicTextarea8, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
41322
41413
  ] }) : null,
41323
- /* @__PURE__ */ jsxs124("div", { className: "flex justify-end gap-2 pt-1", children: [
41324
- /* @__PURE__ */ jsx132(Button100, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
41325
- /* @__PURE__ */ jsx132(Button100, { type: "submit", disabled: !ready, children: "Add" })
41414
+ /* @__PURE__ */ jsxs125("div", { className: "flex justify-end gap-2 pt-1", children: [
41415
+ /* @__PURE__ */ jsx133(Button100, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
41416
+ /* @__PURE__ */ jsx133(Button100, { type: "submit", disabled: !ready, children: "Add" })
41326
41417
  ] })
41327
41418
  ]
41328
41419
  }
@@ -41335,8 +41426,8 @@ function SectionCard(props) {
41335
41426
  const fieldsRead = useFields35(tableId);
41336
41427
  const page = useRecordPage4(tableId, { pageSize: 200 });
41337
41428
  const mutation = useRecordMutation3();
41338
- const [adding, setAdding] = useState120(null);
41339
- const [failed, setFailed] = useState120(null);
41429
+ const [adding, setAdding] = useState121(null);
41430
+ const [failed, setFailed] = useState121(null);
41340
41431
  const fields = fieldsRead.data ?? [];
41341
41432
  const cols = sectionColumns(fields, table.data?.title_field, props);
41342
41433
  const nameField = fields.find((f) => f.key === cols.name);
@@ -41357,65 +41448,65 @@ function SectionCard(props) {
41357
41448
  const total = page.data?.total ?? null;
41358
41449
  const refused = table.error ?? fieldsRead.error ?? page.error;
41359
41450
  const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 2.5rem` };
41360
- return /* @__PURE__ */ jsxs124("section", { "data-records-section-card": "", className: cn73("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
41361
- /* @__PURE__ */ jsxs124("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
41362
- /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41363
- /* @__PURE__ */ jsx132("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
41364
- props.description ? /* @__PURE__ */ jsx132("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
41451
+ return /* @__PURE__ */ jsxs125("section", { "data-records-section-card": "", className: cn73("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
41452
+ /* @__PURE__ */ jsxs125("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
41453
+ /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41454
+ /* @__PURE__ */ jsx133("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
41455
+ props.description ? /* @__PURE__ */ jsx133("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
41365
41456
  ] }),
41366
- mayWrite && nameField ? /* @__PURE__ */ jsxs124(Button100, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
41367
- /* @__PURE__ */ jsx132(PlusIcon, { className: "h-3.5 w-3.5" }),
41457
+ mayWrite && nameField ? /* @__PURE__ */ jsxs125(Button100, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
41458
+ /* @__PURE__ */ jsx133(PlusIcon, { className: "h-3.5 w-3.5" }),
41368
41459
  "Add"
41369
41460
  ] }) : null
41370
41461
  ] }),
41371
- refused ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx132("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ jsx132("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ jsxs124("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
41372
- cols.group ? /* @__PURE__ */ jsxs124("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
41373
- /* @__PURE__ */ jsx132("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
41374
- mayWrite ? /* @__PURE__ */ jsx132(
41462
+ refused ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ jsx133("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx133("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ jsx133("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ jsxs125("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
41463
+ cols.group ? /* @__PURE__ */ jsxs125("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
41464
+ /* @__PURE__ */ jsx133("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
41465
+ mayWrite ? /* @__PURE__ */ jsx133(
41375
41466
  "button",
41376
41467
  {
41377
41468
  type: "button",
41378
41469
  "aria-label": `Add to ${group.key || "no group"}`,
41379
41470
  className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
41380
41471
  onClick: () => setAdding(group.key),
41381
- children: /* @__PURE__ */ jsx132(PlusIcon, { className: "h-4 w-4" })
41472
+ children: /* @__PURE__ */ jsx133(PlusIcon, { className: "h-4 w-4" })
41382
41473
  }
41383
41474
  ) : null
41384
41475
  ] }) : null,
41385
- /* @__PURE__ */ jsxs124("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
41386
- /* @__PURE__ */ jsxs124("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
41387
- /* @__PURE__ */ jsx132("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
41388
- columns.map((c) => /* @__PURE__ */ jsx132("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
41389
- /* @__PURE__ */ jsx132("span", {})
41476
+ /* @__PURE__ */ jsxs125("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
41477
+ /* @__PURE__ */ jsxs125("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
41478
+ /* @__PURE__ */ jsx133("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
41479
+ columns.map((c) => /* @__PURE__ */ jsx133("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
41480
+ /* @__PURE__ */ jsx133("span", {})
41390
41481
  ] }),
41391
41482
  group.rows.map((row) => {
41392
41483
  const editable = mayWrite && atLeast(row.level, "edit_content");
41393
41484
  const rowSave = save(row);
41394
- return /* @__PURE__ */ jsxs124("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
41395
- /* @__PURE__ */ jsx132("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
41396
- cells.map((c) => /* @__PURE__ */ jsx132(
41485
+ return /* @__PURE__ */ jsxs125("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
41486
+ /* @__PURE__ */ jsx133("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
41487
+ cells.map((c) => /* @__PURE__ */ jsx133(
41397
41488
  "div",
41398
41489
  {
41399
41490
  role: "cell",
41400
41491
  style: c.part ? { gridColumn: "span 2" } : void 0,
41401
41492
  className: cn73("min-w-0 py-2.5", c.part ? "" : "px-3"),
41402
- children: /* @__PURE__ */ jsx132(ValueCell, { row, column: c, editable, save: rowSave, onFix })
41493
+ children: /* @__PURE__ */ jsx133(ValueCell, { row, column: c, editable, save: rowSave, onFix })
41403
41494
  },
41404
41495
  c.field.key
41405
41496
  )),
41406
- /* @__PURE__ */ jsx132("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ jsx132(NoteButton, { row, noteField, editable, save: rowSave }) : null })
41497
+ /* @__PURE__ */ jsx133("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ jsx133(NoteButton, { row, noteField, editable, save: rowSave }) : null })
41407
41498
  ] }, row.id);
41408
41499
  })
41409
41500
  ] })
41410
41501
  ] }, group.key || "__ungrouped")) }),
41411
- total !== null && total > rows.length ? /* @__PURE__ */ jsxs124("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
41502
+ total !== null && total > rows.length ? /* @__PURE__ */ jsxs125("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
41412
41503
  "Showing ",
41413
41504
  rows.length,
41414
41505
  " of ",
41415
41506
  total
41416
41507
  ] }) : null,
41417
- failed ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
41418
- /* @__PURE__ */ jsx132(
41508
+ failed ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
41509
+ /* @__PURE__ */ jsx133(
41419
41510
  AddDialog,
41420
41511
  {
41421
41512
  open: adding !== null,
@@ -41732,6 +41823,7 @@ export {
41732
41823
  TablePage2 as TablePage,
41733
41824
  TablePageSkeleton,
41734
41825
  TablePicker,
41826
+ TablePresence,
41735
41827
  TableReferenceDialog,
41736
41828
  TableRenameDialog,
41737
41829
  TableRestoreRefused,
@@ -41973,6 +42065,7 @@ export {
41973
42065
  placedSentence,
41974
42066
  platformOwned,
41975
42067
  pointsAtRecords,
42068
+ presenceOutlineCss,
41976
42069
  presentationDocument,
41977
42070
  presentationIsEmpty,
41978
42071
  previewLine,
@@ -42089,6 +42182,7 @@ export {
42089
42182
  useRowColorBy,
42090
42183
  useRowRights,
42091
42184
  useStructureHidden,
42185
+ useTablePresence,
42092
42186
  useTableRights,
42093
42187
  useTableToolbarSlot,
42094
42188
  useTablesAnywhere,