@ai-matrx/records-ui 0.116.43 → 0.116.45

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
@@ -182,7 +182,7 @@ import {
182
182
  withoutAddition,
183
183
  withoutLeadingBlank,
184
184
  workedOutErrorFor
185
- } from "./chunk-THRMANHB.js";
185
+ } from "./chunk-F4SAKQKQ.js";
186
186
  import {
187
187
  CHART_PLOT_PX,
188
188
  EMBEDDED_ROW_PX,
@@ -293,7 +293,7 @@ import {
293
293
  visibilityLaneFor,
294
294
  whyNotAskable,
295
295
  writeOnTheWinningVersion_exports
296
- } from "./chunk-OKAAPN6O.js";
296
+ } from "./chunk-XKI6S5KF.js";
297
297
  import {
298
298
  ACTION_CHECKING_ACCESS_REASON,
299
299
  ACTION_NOT_HERE_REASON,
@@ -384,7 +384,9 @@ import {
384
384
  recordVersions_exports,
385
385
  refusalForAPerson,
386
386
  refusalLineForAPerson,
387
+ refusalSaid,
387
388
  refusalSentence,
389
+ refusalTimedOut,
388
390
  refusals_exports,
389
391
  rowName,
390
392
  rowNameIn,
@@ -400,7 +402,7 @@ import {
400
402
  useRowRights,
401
403
  useTableRights,
402
404
  withoutInternalCodes
403
- } from "./chunk-KEILC5XG.js";
405
+ } from "./chunk-NKZBAIU4.js";
404
406
  import {
405
407
  FEWEST_KEY_VALUE_PAIRS,
406
408
  FEWEST_LIST_ITEMS,
@@ -3607,7 +3609,7 @@ function DocTemplate({ tableId, seed, pageSettings, activeTemplateId, onActiveTe
3607
3609
  setActiveId(saved.data);
3608
3610
  await load();
3609
3611
  }
3610
- if (fields.error) return /* @__PURE__ */ jsx10(RefusalNotice, { error: fields.error, className });
3612
+ if (fields.error) return /* @__PURE__ */ jsx10(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
3611
3613
  if (error) {
3612
3614
  return /* @__PURE__ */ jsx10(
3613
3615
  RefusalNotice,
@@ -7683,7 +7685,7 @@ function CustomRecordForm({
7683
7685
  () => fields.data ? predictWriteRefusals({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
7684
7686
  [fields.data, document2, recordType]
7685
7687
  );
7686
- if (fields.error) return /* @__PURE__ */ jsx24(RefusalNotice, { error: fields.error, className });
7688
+ if (fields.error) return /* @__PURE__ */ jsx24(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
7687
7689
  if (existing.error) return /* @__PURE__ */ jsx24(RefusalNotice, { error: existing.error, className });
7688
7690
  const storeSaid = said.error && said.error !== answered ? said.error : null;
7689
7691
  const fieldProblems = predicted.filter((p) => p.field_key);
@@ -9826,7 +9828,7 @@ function AddLinkedDialog({
9826
9828
  "Add to ",
9827
9829
  column.source_table_name
9828
9830
  ] }) }),
9829
- fields.error ? /* @__PURE__ */ jsx28(RefusalNotice, { error: fields.error }) : initial ? /* @__PURE__ */ jsx28(
9831
+ fields.error ? /* @__PURE__ */ jsx28(RefusalNotice, { error: fields.error, onRetry: fields.reload }) : initial ? /* @__PURE__ */ jsx28(
9830
9832
  RecordForm,
9831
9833
  {
9832
9834
  tableId: column.source_table_id,
@@ -14175,8 +14177,8 @@ function GridBody({
14175
14177
  if (!embedded) rememberRowCount(`${tableId}:page:last`, rows.length);
14176
14178
  }
14177
14179
  }, [rowsAnswered, rowMemoryKey, rows.length, embedded, tableId]);
14178
- if (table.error) return /* @__PURE__ */ jsx44(RefusalNotice, { error: table.error, className });
14179
- if (fields.error) return /* @__PURE__ */ jsx44(RefusalNotice, { error: fields.error, className });
14180
+ if (table.error) return /* @__PURE__ */ jsx44(RefusalNotice, { error: table.error, onRetry: table.reload, className });
14181
+ if (fields.error) return /* @__PURE__ */ jsx44(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
14180
14182
  const nothingToShowYet = table.loading && !table.data || // No columns on a table whose level may hide them: not yet known which (one read, Confidential only).
14181
14183
  !structure.settled && (fields.data ?? []).length === 0 || fields.loading && !fields.data || !rights.known || rowRightsWaiting || records.loading && rows.length === 0 || // The page read has neither answered nor refused: nothing has been said yet, so nothing is empty.
14182
14184
  !records.data && !records.error || countedButNotReturned || manual && hand.loading && rows.length === 0;
@@ -14217,7 +14219,7 @@ function GridBody({
14217
14219
  } : {},
14218
14220
  children: [
14219
14221
  toolbarActions ? /* @__PURE__ */ jsx44("div", { className: "flex items-center gap-2", "data-records-grid-actions": "", children: /* @__PURE__ */ jsx44("div", { className: "ml-auto flex items-center gap-1", children: toolbarActions }) }) : null,
14220
- records.error ? /* @__PURE__ */ jsx44(RefusalNotice, { error: inColumnWords(records.error, fields.data ?? []) }) : null,
14222
+ records.error ? /* @__PURE__ */ jsx44(RefusalNotice, { error: inColumnWords(records.error, fields.data ?? []), onRetry: records.reload }) : null,
14221
14223
  manual && hand.error ? /* @__PURE__ */ jsx44(RefusalNotice, { error: hand.error }) : null,
14222
14224
  archived ? /* @__PURE__ */ jsxs39(
14223
14225
  "p",
@@ -15419,7 +15421,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
15419
15421
  if (fields.data) rememberRowCount(peekMemoryKey, shownFieldCount);
15420
15422
  }, [fields.data, peekMemoryKey, shownFieldCount]);
15421
15423
  if (record.error) return /* @__PURE__ */ jsx51(RefusalNotice, { error: record.error, className });
15422
- if (fields.error) return /* @__PURE__ */ jsx51(RefusalNotice, { error: fields.error, className });
15424
+ if (fields.error) return /* @__PURE__ */ jsx51(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
15423
15425
  const document2 = record.data?.document;
15424
15426
  if (document2 && isLockedStub({ document: document2, level: null })) {
15425
15427
  const filed = document2["submitted_at"];
@@ -16774,7 +16776,7 @@ function ChecklistRunner({
16774
16776
  () => runs?.find((r) => r.run_id === activeId) ?? null,
16775
16777
  [runs, activeId]
16776
16778
  );
16777
- if (table.error) return /* @__PURE__ */ jsx57(RefusalNotice, { error: table.error, className });
16779
+ if (table.error) return /* @__PURE__ */ jsx57(RefusalNotice, { error: table.error, onRetry: table.reload, className });
16778
16780
  if (quietWhenEmpty && !runId) {
16779
16781
  const startable = mayStart && rights.write && (templates?.length ?? 0) > 0;
16780
16782
  if (runs === null || runs.length === 0 && !startable && !error && !said) return null;
@@ -18078,7 +18080,7 @@ function ConnectedRecordsTableCard({
18078
18080
  // src/ExportMenu.tsx
18079
18081
  import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
18080
18082
  import { downloadFile } from "@ai-matrx/kit/download";
18081
- import { useEffect as useEffect48, useState as useState56 } from "react";
18083
+ import { useEffect as useEffect48, useRef as useRef28, useState as useState56 } from "react";
18082
18084
  import { useFields as useFields17, useRecords as useRecords4, useRecordsClient as useRecordsClient48, useTable as useTable18 } from "@ai-matrx/records/react";
18083
18085
  import { exportCsv, exportMarkdown, exportXlsx, wholeValueOf as wholeValueOf4, withWholeValues } from "@ai-matrx/records/core";
18084
18086
 
@@ -18205,6 +18207,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
18205
18207
  }, [client, tableId, fields.data, viewKey]);
18206
18208
  const viewHeld = viewRead && viewRead.key === viewKey ? viewRead : null;
18207
18209
  const [failure, setFailure] = useState56(null);
18210
+ const lastPressed = useRef28(null);
18208
18211
  const labels = useRecordLabels(fields.data ?? void 0);
18209
18212
  const records = rows ?? (view ? viewHeld && "rows" in viewHeld ? viewHeld.rows : [] : page.data?.rows ?? []);
18210
18213
  const columns = view && fields.data ? viewColumns(fields.data, view.presentation) : fields.data ?? [];
@@ -18225,104 +18228,114 @@ function ExportMenu({ tableId, rows, label, className, view }) {
18225
18228
  { id: "copy-json", label: "Copy JSON", word: "JSON", suffix: "", copy: true, write: exportJson },
18226
18229
  { id: "copy-full-schema", label: "Copy full schema", word: "full schema", suffix: "", copy: true, write: (c, r) => exportFullSchema({ name: tableName2, settings }, c, r) }
18227
18230
  ];
18228
- return /* @__PURE__ */ jsxs56("div", { className: cn24("flex items-center gap-1", className), children: [
18229
- /* @__PURE__ */ jsx62(
18230
- Button48,
18231
- {
18232
- size: "sm",
18233
- variant: "outline",
18234
- onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", exportCsv(columns, rows2))).catch(
18235
- (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
18231
+ return /* @__PURE__ */ jsxs56(
18232
+ "div",
18233
+ {
18234
+ className: cn24("flex items-center gap-1", className),
18235
+ onClickCapture: (event) => {
18236
+ const pressed = event.target.closest("button");
18237
+ if (pressed && !pressed.hasAttribute("data-refusal-retry")) lastPressed.current = pressed;
18238
+ },
18239
+ children: [
18240
+ /* @__PURE__ */ jsx62(
18241
+ Button48,
18242
+ {
18243
+ size: "sm",
18244
+ variant: "outline",
18245
+ onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", exportCsv(columns, rows2))).catch(
18246
+ (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
18247
+ ),
18248
+ children: "CSV"
18249
+ }
18236
18250
  ),
18237
- children: "CSV"
18238
- }
18239
- ),
18240
- /* @__PURE__ */ jsx62(
18241
- Button48,
18242
- {
18243
- size: "sm",
18244
- variant: "outline",
18245
- onClick: () => {
18246
- const failed = (thrown) => setFailure(
18247
- (0, refusals_exports.refusalFromThrown)(
18248
- thrown,
18249
- "The spreadsheet could not be written.",
18250
- "The CSV beside this button carries the same rows."
18251
- )
18252
- );
18253
- setFailure(null);
18254
- try {
18255
- exported().then((rows2) => exportXlsx(columns, rows2, name)).then(
18256
- (bytes) => download(
18257
- `${name}.xlsx`,
18258
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
18259
- bytes
18260
- )
18261
- ).catch(failed);
18262
- } catch (thrown) {
18263
- failed(thrown);
18251
+ /* @__PURE__ */ jsx62(
18252
+ Button48,
18253
+ {
18254
+ size: "sm",
18255
+ variant: "outline",
18256
+ onClick: () => {
18257
+ const failed = (thrown) => setFailure(
18258
+ (0, refusals_exports.refusalFromThrown)(
18259
+ thrown,
18260
+ "The spreadsheet could not be written.",
18261
+ "The CSV beside this button carries the same rows."
18262
+ )
18263
+ );
18264
+ setFailure(null);
18265
+ try {
18266
+ exported().then((rows2) => exportXlsx(columns, rows2, name)).then(
18267
+ (bytes) => download(
18268
+ `${name}.xlsx`,
18269
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
18270
+ bytes
18271
+ )
18272
+ ).catch(failed);
18273
+ } catch (thrown) {
18274
+ failed(thrown);
18275
+ }
18276
+ },
18277
+ children: "XLSX"
18264
18278
  }
18265
- },
18266
- children: "XLSX"
18267
- }
18268
- ),
18269
- /* @__PURE__ */ jsx62(
18270
- Button48,
18271
- {
18272
- size: "sm",
18273
- variant: "outline",
18274
- onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", exportMarkdown(columns, rows2))).catch(
18275
- (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
18276
18279
  ),
18277
- children: "Markdown"
18278
- }
18279
- ),
18280
- /* @__PURE__ */ jsx62(
18281
- Button48,
18282
- {
18283
- size: "sm",
18284
- variant: "outline",
18285
- onClick: () => void exported().then(async (rows2) => {
18286
- if (await copyText4(exportMarkdown(columns, rows2))) host.notify?.success("Markdown copied");
18287
- else host.notify?.error("Couldn\u2019t copy the Markdown");
18288
- }).catch(
18289
- (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
18280
+ /* @__PURE__ */ jsx62(
18281
+ Button48,
18282
+ {
18283
+ size: "sm",
18284
+ variant: "outline",
18285
+ onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", exportMarkdown(columns, rows2))).catch(
18286
+ (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
18287
+ ),
18288
+ children: "Markdown"
18289
+ }
18290
18290
  ),
18291
- children: "Copy Markdown"
18292
- }
18293
- ),
18294
- JSON_FILES.map((kind2) => /* @__PURE__ */ jsx62(
18295
- Button48,
18296
- {
18297
- size: "sm",
18298
- variant: "outline",
18299
- "data-records-export": kind2.id,
18300
- onClick: () => void exported().then(async (rows2) => {
18301
- const text = kind2.write(columns, rows2);
18302
- if (kind2.copy) {
18303
- if (await copyText4(text)) host.notify?.success(`${kind2.word} copied`);
18304
- else host.notify?.error(`Couldn\u2019t copy the ${kind2.word}`);
18305
- } else download(`${name}${kind2.suffix}`, "application/json;charset=utf-8", text);
18306
- }).catch(
18307
- (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, `The ${kind2.word} could not be written.`, "The CSV beside this button carries the same rows."))
18291
+ /* @__PURE__ */ jsx62(
18292
+ Button48,
18293
+ {
18294
+ size: "sm",
18295
+ variant: "outline",
18296
+ onClick: () => void exported().then(async (rows2) => {
18297
+ if (await copyText4(exportMarkdown(columns, rows2))) host.notify?.success("Markdown copied");
18298
+ else host.notify?.error("Couldn\u2019t copy the Markdown");
18299
+ }).catch(
18300
+ (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
18301
+ ),
18302
+ children: "Copy Markdown"
18303
+ }
18308
18304
  ),
18309
- children: kind2.label
18310
- },
18311
- kind2.id
18312
- )),
18313
- /* @__PURE__ */ jsx62(
18314
- AlchemyMenu2,
18315
- {
18316
- label: name,
18317
- sourceId: `records:${tableId}`,
18318
- size: "xs",
18319
- json: () => records.map((r) => r.document),
18320
- human: () => exportCsv(columns, toRows(columns, records, labels))
18321
- }
18322
- ),
18323
- viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ jsx62("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
18324
- failure ? /* @__PURE__ */ jsx62(RefusalLine, { error: failure }) : null
18325
- ] });
18305
+ JSON_FILES.map((kind2) => /* @__PURE__ */ jsx62(
18306
+ Button48,
18307
+ {
18308
+ size: "sm",
18309
+ variant: "outline",
18310
+ "data-records-export": kind2.id,
18311
+ onClick: () => void exported().then(async (rows2) => {
18312
+ const text = kind2.write(columns, rows2);
18313
+ if (kind2.copy) {
18314
+ if (await copyText4(text)) host.notify?.success(`${kind2.word} copied`);
18315
+ else host.notify?.error(`Couldn\u2019t copy the ${kind2.word}`);
18316
+ } else download(`${name}${kind2.suffix}`, "application/json;charset=utf-8", text);
18317
+ }).catch(
18318
+ (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, `The ${kind2.word} could not be written.`, "The CSV beside this button carries the same rows."))
18319
+ ),
18320
+ children: kind2.label
18321
+ },
18322
+ kind2.id
18323
+ )),
18324
+ /* @__PURE__ */ jsx62(
18325
+ AlchemyMenu2,
18326
+ {
18327
+ label: name,
18328
+ sourceId: `records:${tableId}`,
18329
+ size: "xs",
18330
+ json: () => records.map((r) => r.document),
18331
+ human: () => exportCsv(columns, toRows(columns, records, labels))
18332
+ }
18333
+ ),
18334
+ viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ jsx62("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
18335
+ failure ? /* @__PURE__ */ jsx62(RefusalLine, { error: failure, onRetry: () => lastPressed.current?.click() }) : null
18336
+ ]
18337
+ }
18338
+ );
18326
18339
  }
18327
18340
 
18328
18341
  // src/ImportNotice.tsx
@@ -18717,7 +18730,7 @@ function Clause({
18717
18730
  }
18718
18731
 
18719
18732
  // src/TableRename.tsx
18720
- import { useCallback as useCallback31, useEffect as useEffect51, useRef as useRef28, useState as useState59 } from "react";
18733
+ import { useCallback as useCallback31, useEffect as useEffect51, useRef as useRef29, useState as useState59 } from "react";
18721
18734
  import { tableShapeChanged as tableShapeChanged5, useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
18722
18735
  import {
18723
18736
  Button as Button51,
@@ -18739,7 +18752,7 @@ function tableNameProblem(typed2) {
18739
18752
  }
18740
18753
  function useRenameFromMenu() {
18741
18754
  const [open, setOpen] = useState59(false);
18742
- const asked2 = useRef28(false);
18755
+ const asked2 = useRef29(false);
18743
18756
  const ask2 = useCallback31(() => {
18744
18757
  asked2.current = true;
18745
18758
  window.setTimeout(() => setOpen(true), 0);
@@ -18765,8 +18778,8 @@ function TableRenameDialog({
18765
18778
  const [typed2, setTyped] = useState59(name);
18766
18779
  const [busy, setBusy] = useState59(false);
18767
18780
  const [refused, setRefused] = useState59(null);
18768
- const box = useRef28(null);
18769
- const openedAt = useRef28(null);
18781
+ const box = useRef29(null);
18782
+ const openedAt = useRef29(null);
18770
18783
  useEffect51(() => {
18771
18784
  if (!open) return;
18772
18785
  openedAt.current = (0, recordVersions_exports.readTableVersionNow)(client, tableId);
@@ -18858,7 +18871,7 @@ function TableRenameDialog({
18858
18871
  }
18859
18872
 
18860
18873
  // src/TableSettings.tsx
18861
- import { useEffect as useEffect55, useMemo as useMemo37, useRef as useRef29, useState as useState64 } from "react";
18874
+ import { useEffect as useEffect55, useMemo as useMemo37, useRef as useRef30, useState as useState64 } from "react";
18862
18875
  import { levelHasShownTo as levelHasShownTo2 } from "@ai-matrx/records";
18863
18876
 
18864
18877
  // src/ArchiveDeliberately.tsx
@@ -19347,9 +19360,9 @@ function TableSettings(props) {
19347
19360
  const client = useRecordsClient55();
19348
19361
  const table = useTable20(props.tableId);
19349
19362
  const fields = useFields19(props.tableId);
19350
- const now = useRef29({ table: table.data ?? null, fields: fields.data ?? [] });
19363
+ const now = useRef30({ table: table.data ?? null, fields: fields.data ?? [] });
19351
19364
  now.current = { table: table.data ?? null, fields: fields.data ?? [] };
19352
- const slots2 = useRef29({ details: { current: null }, rowActions: { current: null } }).current;
19365
+ const slots2 = useRef30({ details: { current: null }, rowActions: { current: null } }).current;
19353
19366
  const agent = useMemo37(
19354
19367
  () => buildTableSettingsAgent(props.tableId, () => now.current, client, slots2),
19355
19368
  [props.tableId, client, slots2]
@@ -19382,8 +19395,8 @@ function TableSettingsPanel({
19382
19395
  live = false;
19383
19396
  };
19384
19397
  }, [tableId]);
19385
- const askToArchiveRef = useRef29(null);
19386
- const archiveAskedSeen = useRef29(0);
19398
+ const askToArchiveRef = useRef30(null);
19399
+ const archiveAskedSeen = useRef30(0);
19387
19400
  const panelReady = Boolean(table.data && fields.data && rights.structure);
19388
19401
  useEffect55(() => {
19389
19402
  const ask2 = askToArchiveRef.current;
@@ -19396,8 +19409,8 @@ function TableSettingsPanel({
19396
19409
  const [deliberate, setDeliberate] = useState64(null);
19397
19410
  const [askingToRemove, setAskingToRemove] = useState64(null);
19398
19411
  const [enriching, setEnriching] = useState64(null);
19399
- if (table.error) return /* @__PURE__ */ jsx70(RefusalNotice, { error: table.error, className });
19400
- if (fields.error) return /* @__PURE__ */ jsx70(RefusalNotice, { error: fields.error, className });
19412
+ if (table.error) return /* @__PURE__ */ jsx70(RefusalNotice, { error: table.error, onRetry: table.reload, className });
19413
+ if (fields.error) return /* @__PURE__ */ jsx70(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
19401
19414
  if (!rights.structure) {
19402
19415
  if (tableIsLocked(table.data)) {
19403
19416
  return /* @__PURE__ */ jsxs64("div", { className: cn29("flex flex-col items-start gap-2 text-xs text-muted-foreground", className), "data-table-locked": "", children: [
@@ -19588,7 +19601,7 @@ function TableSettingsPanel({
19588
19601
  /* @__PURE__ */ jsx70(Button55, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
19589
19602
  ] }) })
19590
19603
  ] }) : /* @__PURE__ */ jsx70("div", { children: /* @__PURE__ */ jsx70(Button55, { size: "sm", variant: "outline", onClick: () => void askToArchive(), children: "Archive this table" }) }),
19591
- archive.error ? /* @__PURE__ */ jsx70(RefusalNotice, { error: archive.error }) : null
19604
+ archive.error ? /* @__PURE__ */ jsx70(RefusalNotice, { error: archive.error, onRetry: () => void startArchive() }) : null
19592
19605
  ] })
19593
19606
  ] });
19594
19607
  }
@@ -19788,7 +19801,7 @@ import {
19788
19801
  import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
19789
19802
 
19790
19803
  // src/recordMoves.tsx
19791
- import { useCallback as useCallback33, useEffect as useEffect57, useMemo as useMemo39, useRef as useRef30, useState as useState66 } from "react";
19804
+ import { useCallback as useCallback33, useEffect as useEffect57, useMemo as useMemo39, useRef as useRef31, useState as useState66 } from "react";
19792
19805
  import { useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
19793
19806
  import { Button as Button56 } from "@ai-matrx/design-system";
19794
19807
  import { Fragment as Fragment29, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
@@ -19914,7 +19927,7 @@ function useRecordMoves({
19914
19927
  [client, undo, onMoved, preset]
19915
19928
  );
19916
19929
  const offering = Boolean(undo.notice);
19917
- const undoRef = useRef30(undo);
19930
+ const undoRef = useRef31(undo);
19918
19931
  undoRef.current = undo;
19919
19932
  useEffect57(() => {
19920
19933
  if (!offering || typeof document === "undefined") return;
@@ -19982,7 +19995,7 @@ function MoveRefusedBadge({ refused }) {
19982
19995
  }
19983
19996
 
19984
19997
  // src/Pipeline.tsx
19985
- import { useCallback as useCallback34, useEffect as useEffect58, useMemo as useMemo40, useRef as useRef31, useState as useState67 } from "react";
19998
+ import { useCallback as useCallback34, useEffect as useEffect58, useMemo as useMemo40, useRef as useRef32, useState as useState67 } from "react";
19986
19999
  import {
19987
20000
  mayDrag,
19988
20001
  useFields as useFields20,
@@ -20095,9 +20108,9 @@ function PipelineBoard({
20095
20108
  const [waiting, setWaiting] = useState67(/* @__PURE__ */ new Map());
20096
20109
  const [dragging, setDragging] = useState67(null);
20097
20110
  const [over, setOver] = useState67(null);
20098
- const alive = useRef31(true);
20111
+ const alive = useRef32(true);
20099
20112
  const [selected, setSelected] = useState67(/* @__PURE__ */ new Set());
20100
- const anchor = useRef31(null);
20113
+ const anchor = useRef32(null);
20101
20114
  const [batch, setBatch] = useState67(/* @__PURE__ */ new Map());
20102
20115
  const [batchSaid, setBatchSaid] = useState67(null);
20103
20116
  const [batchError, setBatchError] = useState67(null);
@@ -20131,7 +20144,7 @@ function PipelineBoard({
20131
20144
  void reload();
20132
20145
  }, [reload]);
20133
20146
  const versions = (0, recordVersions_exports.useRecordVersions)(client, rows, (r) => mayDrag(r.level));
20134
- const versionsRef = useRef31(versions);
20147
+ const versionsRef = useRef32(versions);
20135
20148
  versionsRef.current = versions;
20136
20149
  const drawnVersion = (id) => versionsRef.current.seen(id);
20137
20150
  const stageKey = definition?.stage_field ?? null;
@@ -20282,7 +20295,7 @@ function PipelineBoard({
20282
20295
  onMoved?.();
20283
20296
  void reload();
20284
20297
  };
20285
- if (fields.error) return /* @__PURE__ */ jsx73(RefusalNotice, { error: fields.error });
20298
+ if (fields.error) return /* @__PURE__ */ jsx73(RefusalNotice, { error: fields.error, onRetry: fields.reload });
20286
20299
  if (error) return /* @__PURE__ */ jsx73(RefusalNotice, { error });
20287
20300
  if (loading || fields.loading && !fields.data) return /* @__PURE__ */ jsx73(Skeleton16, { className: "h-40 w-full" });
20288
20301
  if (!definition?.is_pipeline) {
@@ -20794,7 +20807,7 @@ function structuredWordsFor(field, value) {
20794
20807
  }
20795
20808
 
20796
20809
  // src/CalendarView.tsx
20797
- import { useEffect as useEffect60, useLayoutEffect as useLayoutEffect3, useMemo as useMemo43, useRef as useRef32, useState as useState69 } from "react";
20810
+ import { useEffect as useEffect60, useLayoutEffect as useLayoutEffect3, useMemo as useMemo43, useRef as useRef33, useState as useState69 } from "react";
20798
20811
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
20799
20812
  import { Button as Button58, Select as Select5, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3, cn as cn31 } from "@ai-matrx/design-system";
20800
20813
  import { CHOICE_CHIP_CLASS } from "@ai-matrx/design-system/data-table";
@@ -21180,8 +21193,8 @@ function CalendarView({
21180
21193
  }, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
21181
21194
  const titleOf = (row) => cardWords(row, titleField, labels).text;
21182
21195
  const rowById = (id) => rows.find((r) => r.id === id);
21183
- const frame = useRef32(null);
21184
- const grid = useRef32(null);
21196
+ const frame = useRef33(null);
21197
+ const grid = useRef33(null);
21185
21198
  const gridWidth = useGridWidth(grid, mode);
21186
21199
  const cellColumns = mode === "month" ? 7 : mode === "week" ? 7 : 1;
21187
21200
  const cellReserve = mode === "month" ? 0 : 44;
@@ -21234,7 +21247,7 @@ function CalendarView({
21234
21247
  const made = await moves.create({ tableId, data, label: `New record on ${where}` });
21235
21248
  if (made) onOpenRecord?.(made);
21236
21249
  };
21237
- const grabOffset = useRef32(0);
21250
+ const grabOffset = useRef33(0);
21238
21251
  const [resizing, setResizing] = useState69(null);
21239
21252
  const [ghost, setGhost] = useState69(null);
21240
21253
  useEffect60(() => {
@@ -21813,7 +21826,7 @@ function WeekHours({
21813
21826
  render,
21814
21827
  overlay
21815
21828
  }) {
21816
- const frame = useRef32(null);
21829
+ const frame = useRef33(null);
21817
21830
  useEffect60(() => {
21818
21831
  if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
21819
21832
  }, []);
@@ -21861,7 +21874,7 @@ function weekHeading(first) {
21861
21874
  }
21862
21875
 
21863
21876
  // src/TimelineView.tsx
21864
- import { useEffect as useEffect61, useMemo as useMemo44, useRef as useRef33, useState as useState70 } from "react";
21877
+ import { useEffect as useEffect61, useMemo as useMemo44, useRef as useRef34, useState as useState70 } from "react";
21865
21878
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
21866
21879
  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 Button59, Select as Select6, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4, cn as cn32 } from "@ai-matrx/design-system";
21867
21880
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
@@ -22452,11 +22465,11 @@ function TimelineView({
22452
22465
  const width = days * px;
22453
22466
  const scale = useMemo44(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
22454
22467
  const xOf = (day2) => daysBetween(from, day2) * px;
22455
- const scroller = useRef33(null);
22468
+ const scroller = useRef34(null);
22456
22469
  const grouped = Boolean(groupField) && !ganttOn;
22457
22470
  const hasLabel = grouped || ganttOn;
22458
22471
  const [scrollX, setScrollX] = useState70(0);
22459
- const frame = useRef33(null);
22472
+ const frame = useRef34(null);
22460
22473
  const onScroll = () => {
22461
22474
  if (frame.current !== null) return;
22462
22475
  frame.current = requestAnimationFrame(() => {
@@ -23666,7 +23679,7 @@ import { fieldKindFor, measureKey as measureKey5 } from "@ai-matrx/records";
23666
23679
  import { Select as Select8, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
23667
23680
 
23668
23681
  // src/ChartBlock.tsx
23669
- import { useMemo as useMemo47, useRef as useRef35 } from "react";
23682
+ import { useMemo as useMemo47, useRef as useRef36 } from "react";
23670
23683
  import {
23671
23684
  Area,
23672
23685
  AreaChart,
@@ -24077,14 +24090,14 @@ import {
24077
24090
  useEffect as useEffect66,
24078
24091
  useId as useId2,
24079
24092
  useLayoutEffect as useLayoutEffect4,
24080
- useRef as useRef34,
24093
+ useRef as useRef35,
24081
24094
  useState as useState75
24082
24095
  } from "react";
24083
24096
  import { cn as cn35 } from "@ai-matrx/design-system";
24084
24097
  import { jsx as jsx82, jsxs as jsxs75 } from "react/jsx-runtime";
24085
24098
  var useBeforePaint = typeof document === "undefined" ? useEffect66 : useLayoutEffect4;
24086
24099
  function useMeasuredWidth(fallback = 480) {
24087
- const ref = useRef34(null);
24100
+ const ref = useRef35(null);
24088
24101
  const [width, setWidth] = useState75(fallback);
24089
24102
  useBeforePaint(() => {
24090
24103
  const node = ref.current;
@@ -24671,7 +24684,7 @@ function Drawing({
24671
24684
  const pretty2 = usePrettyWith(prettyPlain);
24672
24685
  const compactTick = useCompactWith(compactTickPlain);
24673
24686
  const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
24674
- const scatterNames = useRef35({ keys: [], boxes: [] });
24687
+ const scatterNames = useRef36({ keys: [], boxes: [] });
24675
24688
  const compared = series.length > 1;
24676
24689
  const drawOrder = compared ? [series[1], series[0]] : series;
24677
24690
  const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ jsx83(
@@ -25342,7 +25355,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
25342
25355
  }
25343
25356
 
25344
25357
  // src/MapLayout.tsx
25345
- import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef36, useState as useState78 } from "react";
25358
+ import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef37, useState as useState78 } from "react";
25346
25359
  import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
25347
25360
  import { Button as Button61, Select as Select10, SelectContent as SelectContent8, SelectItem as SelectItem8, SelectTrigger as SelectTrigger8, SelectValue as SelectValue8, cn as cn38 } from "@ai-matrx/design-system";
25348
25361
 
@@ -25471,9 +25484,9 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
25471
25484
  const saved = !coordinateMode ? coordinateColumns(fields) : null;
25472
25485
  const [found, setFound] = useState78(() => /* @__PURE__ */ new Map());
25473
25486
  const [lookup, setLookup] = useState78({ running: false, notFound: /* @__PURE__ */ new Set(), couldNot: false });
25474
- const tried = useRef36(/* @__PURE__ */ new Set());
25475
- const passing = useRef36(false);
25476
- const mounted = useRef36(true);
25487
+ const tried = useRef37(/* @__PURE__ */ new Set());
25488
+ const passing = useRef37(false);
25489
+ const mounted = useRef37(true);
25477
25490
  useEffect69(() => {
25478
25491
  mounted.current = true;
25479
25492
  return () => {
@@ -25602,7 +25615,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
25602
25615
  }
25603
25616
 
25604
25617
  // src/OrgChartLayout.tsx
25605
- import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as useRef37, useState as useState79 } from "react";
25618
+ import { useCallback as useCallback35, useEffect as useEffect70, useMemo as useMemo51, useRef as useRef38, useState as useState79 } from "react";
25606
25619
  import { Button as Button62, Select as Select11, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9, cn as cn39 } from "@ai-matrx/design-system";
25607
25620
 
25608
25621
  // src/orgTree.ts
@@ -25757,9 +25770,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
25757
25770
  const forest = useMemo51(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
25758
25771
  const [collapsed, setCollapsed] = useState79(() => /* @__PURE__ */ new Set());
25759
25772
  const layout = useMemo51(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
25760
- const box = useRef37(null);
25773
+ const box = useRef38(null);
25761
25774
  const [view2, setView2] = useState79({ scale: 1, x: 16, y: 16 });
25762
- const fitted = useRef37("");
25775
+ const fitted = useRef38("");
25763
25776
  const fit = useCallback35(() => {
25764
25777
  const el = box.current;
25765
25778
  if (!el || !layout) return;
@@ -25772,9 +25785,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
25772
25785
  fit();
25773
25786
  }
25774
25787
  }, [shape, layout, fit]);
25775
- const pointers = useRef37(/* @__PURE__ */ new Map());
25776
- const gesture = useRef37(null);
25777
- const suppress = useRef37(false);
25788
+ const pointers = useRef38(/* @__PURE__ */ new Map());
25789
+ const gesture = useRef38(null);
25790
+ const suppress = useRef38(false);
25778
25791
  const onDown = (e) => {
25779
25792
  pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
25780
25793
  const pts = [...pointers.current.values()];
@@ -26301,8 +26314,8 @@ function Board({
26301
26314
  tableId: view.subject,
26302
26315
  needed: viewQuestionAsked && !records.loading && records.rows.length === 0
26303
26316
  });
26304
- if (fields.error) return /* @__PURE__ */ jsx88(RefusalNotice, { error: fields.error });
26305
- if (records.error) return /* @__PURE__ */ jsx88(RefusalNotice, { error: records.error });
26317
+ if (fields.error) return /* @__PURE__ */ jsx88(RefusalNotice, { error: fields.error, onRetry: fields.reload });
26318
+ if (records.error) return /* @__PURE__ */ jsx88(RefusalNotice, { error: records.error, onRetry: records.reload });
26306
26319
  if (fields.loading && !fields.data || records.loading && records.rows.length === 0) return /* @__PURE__ */ jsx88(RecordsSkeleton, { layout: view.layout });
26307
26320
  const all = fields.data ?? [];
26308
26321
  const byKey = (key) => all.find((f) => f.key === key);
@@ -27516,7 +27529,7 @@ function ArchivedPortals({
27516
27529
  import { ArchivedDisclosure as ArchivedDisclosure2, ARCHIVED_NEVER_DESTROYED } from "@ai-matrx/design-system";
27517
27530
 
27518
27531
  // src/ViewBar.tsx
27519
- import { useCallback as useCallback38, useEffect as useEffect74, useRef as useRef38, useState as useState83 } from "react";
27532
+ import { useCallback as useCallback38, useEffect as useEffect74, useRef as useRef39, useState as useState83 } from "react";
27520
27533
  import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react";
27521
27534
  import { Badge as Badge11, Button as Button66, Input as Input6, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, Skeleton as Skeleton20, cn as cn42 } from "@ai-matrx/design-system";
27522
27535
  import { Button as ControlButton2, Switch as Switch4, Tile } from "@ai-matrx/design-system/controls";
@@ -27629,8 +27642,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
27629
27642
  if (!initialViews || initialViews.length === 0) return activeViewId ?? null;
27630
27643
  return (initialViews.find((v) => v.id === activeViewId) ?? defaultViewOf(initialViews) ?? initialViews[0]).id;
27631
27644
  });
27632
- const readOnMount = useRef38(initialViews === void 0);
27633
- const pendingPick = useRef38(null);
27645
+ const readOnMount = useRef39(initialViews === void 0);
27646
+ const pendingPick = useRef39(null);
27634
27647
  const [naming, setNaming] = useState83(false);
27635
27648
  const [draftName, setDraftName] = useState83("");
27636
27649
  const [open, setOpen] = useState83(false);
@@ -27650,7 +27663,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
27650
27663
  });
27651
27664
  const [renamingSection, setRenamingSection] = useState83(null);
27652
27665
  const [dragging, setDragging] = useState83(false);
27653
- const justDragged = useRef38(false);
27666
+ const justDragged = useRef39(false);
27654
27667
  const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
27655
27668
  async function dropped(event) {
27656
27669
  setDragging(false);
@@ -28113,7 +28126,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
28113
28126
  }
28114
28127
 
28115
28128
  // src/ProposalRow.tsx
28116
- import { useEffect as useEffect75, useRef as useRef39, useState as useState84 } from "react";
28129
+ import { useEffect as useEffect75, useRef as useRef40, useState as useState84 } from "react";
28117
28130
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
28118
28131
  import { Badge as Badge12, Button as Button67, cn as cn43 } from "@ai-matrx/design-system";
28119
28132
  import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
@@ -28131,7 +28144,7 @@ function ProposalRow({
28131
28144
  const [settled, setSettled] = useState84(outcome ?? null);
28132
28145
  const [busy, setBusy] = useState84(false);
28133
28146
  const [confirming, setConfirming] = useState84(false);
28134
- const drawnVersion = useRef39(null);
28147
+ const drawnVersion = useRef40(null);
28135
28148
  const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
28136
28149
  useEffect75(() => {
28137
28150
  if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = (0, recordVersions_exports.readVersionNow)(client, change.record);
@@ -28221,7 +28234,7 @@ function ProposalRow({
28221
28234
  }
28222
28235
 
28223
28236
  // src/ActionInbox.tsx
28224
- import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as useRef40, useState as useState85 } from "react";
28237
+ import { useCallback as useCallback39, useEffect as useEffect76, useMemo as useMemo53, useRef as useRef41, useState as useState85 } from "react";
28225
28238
  import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
28226
28239
  import { Badge as Badge13, Button as Button68, Checkbox as Checkbox6, Skeleton as Skeleton21, cn as cn44 } from "@ai-matrx/design-system";
28227
28240
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
@@ -28324,9 +28337,9 @@ function ActionInbox({
28324
28337
  const [outcome, setOutcome] = useState85({});
28325
28338
  const [busy, setBusy] = useState85(null);
28326
28339
  const [cursor, setCursor] = useState85(0);
28327
- const listRef = useRef40(null);
28340
+ const listRef = useRef41(null);
28328
28341
  const [selected, setSelected] = useState85(/* @__PURE__ */ new Set());
28329
- const anchor = useRef40(null);
28342
+ const anchor = useRef41(null);
28330
28343
  const [deciding, setDeciding] = useState85(false);
28331
28344
  const [batchSaid, setBatchSaid] = useState85(null);
28332
28345
  const [view, setView] = useState85("inbox");
@@ -28390,9 +28403,9 @@ function ActionInbox({
28390
28403
  [client, load]
28391
28404
  );
28392
28405
  const [held, setHeld] = useState85({});
28393
- const holds2 = useRef40(/* @__PURE__ */ new Map());
28394
- const lastHold = useRef40(null);
28395
- const holdSeq = useRef40(0);
28406
+ const holds2 = useRef41(/* @__PURE__ */ new Map());
28407
+ const lastHold = useRef41(null);
28408
+ const holdSeq = useRef41(0);
28396
28409
  const [, tick] = useState85(0);
28397
28410
  useEffect76(() => {
28398
28411
  if (Object.keys(held).length === 0) return;
@@ -28450,7 +28463,7 @@ function ActionInbox({
28450
28463
  flush();
28451
28464
  };
28452
28465
  }, []);
28453
- const resumed = useRef40(false);
28466
+ const resumed = useRef41(false);
28454
28467
  useEffect76(() => {
28455
28468
  if (resumed.current || items === null || view !== "inbox") return;
28456
28469
  resumed.current = true;
@@ -29201,7 +29214,7 @@ function FormResultsPanel({ form, className }) {
29201
29214
  }
29202
29215
 
29203
29216
  // src/PortalBuilder.tsx
29204
- import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as useRef41, useState as useState87 } from "react";
29217
+ import { useCallback as useCallback40, useEffect as useEffect78, useMemo as useMemo55, useRef as useRef42, useState as useState87 } from "react";
29205
29218
  import { useRecordsClient as useRecordsClient68, useTables } from "@ai-matrx/records/react";
29206
29219
  import { BasicInput as BasicInput11, Button as Button70, Checkbox as Checkbox7, Label as Label10, Separator as Separator9, Skeleton as Skeleton23, cn as cn46 } from "@ai-matrx/design-system";
29207
29220
  import { Select as Select13 } from "@ai-matrx/design-system/controls";
@@ -29307,7 +29320,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
29307
29320
  if (on) void loadFields(t.id);
29308
29321
  }
29309
29322
  const [linking, setLinking] = useState87(null);
29310
- const linkingNow = useRef41(null);
29323
+ const linkingNow = useRef42(null);
29311
29324
  async function addLinkBack(id) {
29312
29325
  const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
29313
29326
  if (!clientTableId || !clients) return;
@@ -29334,7 +29347,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
29334
29347
  linkingNow.current = null;
29335
29348
  setLinking(null);
29336
29349
  }
29337
- const autoLinked = useRef41(/* @__PURE__ */ new Set());
29350
+ const autoLinked = useRef42(/* @__PURE__ */ new Set());
29338
29351
  useEffect78(() => {
29339
29352
  if (linking !== null || !clientTableId) return;
29340
29353
  for (const e of Object.values(exposures)) {
@@ -31525,7 +31538,7 @@ import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
31525
31538
  import { dropKeptDraft, keepDraft, readKeptDraft } from "@ai-matrx/kit/drafts";
31526
31539
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
31527
31540
  import { Select as Select15 } from "@ai-matrx/design-system/controls";
31528
- import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as useRef43, useState as useState95 } from "react";
31541
+ import { useCallback as useCallback46, useEffect as useEffect85, useMemo as useMemo60, useRef as useRef44, useState as useState95 } from "react";
31529
31542
  import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
31530
31543
  import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
31531
31544
  import { CSS as CSS3 } from "@dnd-kit/utilities";
@@ -31798,7 +31811,7 @@ function EmbedSnippets({ url, label }) {
31798
31811
  }
31799
31812
 
31800
31813
  // src/FormRunner.tsx
31801
- import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as useRef42, useState as useState94 } from "react";
31814
+ import { useCallback as useCallback45, useEffect as useEffect84, useMemo as useMemo59, useRef as useRef43, useState as useState94 } from "react";
31802
31815
  import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
31803
31816
  import { Button as Button77, Label as Label14, Progress, Skeleton as Skeleton28, cn as cn54, formThemeClasses } from "@ai-matrx/design-system";
31804
31817
  import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
@@ -31873,7 +31886,7 @@ function ConnectedFormRunner(props) {
31873
31886
  },
31874
31887
  [client, form.subject, form.questions, form.endings]
31875
31888
  );
31876
- if (fields.error) return /* @__PURE__ */ jsx104(RefusalNotice, { error: fields.error, className });
31889
+ if (fields.error) return /* @__PURE__ */ jsx104(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
31877
31890
  if (fields.loading && !fields.data) return /* @__PURE__ */ jsx104(Skeleton28, { className: cn54("h-40 w-full", className) });
31878
31891
  return /* @__PURE__ */ jsx104(
31879
31892
  FormStage,
@@ -31916,11 +31929,11 @@ function FormStage({
31916
31929
  const routes = formRoutes(form);
31917
31930
  const [routeKnown, setRouteKnown] = useState94(() => !routes || !whichAsked);
31918
31931
  const [stopped, setStopped] = useState94(null);
31919
- const answersRef = useRef42(answers);
31932
+ const answersRef = useRef43(answers);
31920
31933
  answersRef.current = answers;
31921
31934
  const choose = autoAdvance ?? form.autoAdvance ?? true;
31922
- const decoy = useRef42("");
31923
- const stage = useRef42(null);
31935
+ const decoy = useRef43("");
31936
+ const stage = useRef43(null);
31924
31937
  const questions = useMemo59(() => {
31925
31938
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
31926
31939
  return (form.questions ?? []).map((q) => {
@@ -31983,13 +31996,13 @@ function FormStage({
31983
31996
  };
31984
31997
  }, [whichAsked, questions, answers]);
31985
31998
  const live = questions.filter((q) => !hidden[q.key]);
31986
- const told = useRef42(answers);
31999
+ const told = useRef43(answers);
31987
32000
  useEffect84(() => {
31988
32001
  if (told.current === answers) return;
31989
32002
  told.current = answers;
31990
32003
  onAnswersChange?.(answers);
31991
32004
  }, [answers, onAnswersChange]);
31992
- const resumeAt = useRef42(
32005
+ const resumeAt = useRef43(
31993
32006
  resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
31994
32007
  const v = initialAnswers[q.key];
31995
32008
  return v === void 0 || v === null || v === "";
@@ -32103,9 +32116,9 @@ function FormStage({
32103
32116
  if (stillMissing) refuse(stillMissing, refusalFor2(stillMissing));
32104
32117
  else void submit();
32105
32118
  }
32106
- const routing = useRef42(false);
32119
+ const routing = useRef43(false);
32107
32120
  const [routingNow, setRoutingNow] = useState94(false);
32108
- const typedAhead = useRef42("");
32121
+ const typedAhead = useRef43("");
32109
32122
  useEffect84(() => {
32110
32123
  if (!routingNow) return;
32111
32124
  const hold = (event) => {
@@ -32139,7 +32152,7 @@ function FormStage({
32139
32152
  useEffect84(() => {
32140
32153
  if (!routingNow) pourTypedAhead();
32141
32154
  }, [routingNow, at, pourTypedAhead]);
32142
- const advanceRef = useRef42(advance);
32155
+ const advanceRef = useRef43(advance);
32143
32156
  advanceRef.current = advance;
32144
32157
  const chosen = useCallback45(() => {
32145
32158
  if (!oneAtATime || !choose) return;
@@ -32168,7 +32181,7 @@ function FormStage({
32168
32181
  input?.focus();
32169
32182
  pourTypedAhead();
32170
32183
  }, [index, done, started]);
32171
- const startTold = useRef42(false);
32184
+ const startTold = useRef43(false);
32172
32185
  useEffect84(() => {
32173
32186
  if (startTold.current || !onStart) return;
32174
32187
  if (Object.values(answers).some((v) => v !== void 0 && v !== null && v !== "")) {
@@ -32176,7 +32189,7 @@ function FormStage({
32176
32189
  onStart();
32177
32190
  }
32178
32191
  }, [answers, onStart]);
32179
- const shownTold = useRef42(/* @__PURE__ */ new Set());
32192
+ const shownTold = useRef43(/* @__PURE__ */ new Set());
32180
32193
  useEffect84(() => {
32181
32194
  if (!onQuestionShown || !started || done) return;
32182
32195
  for (const q of oneAtATime ? current ? [current] : [] : live) {
@@ -32544,7 +32557,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
32544
32557
  const [restoredAt, setRestoredAt] = useState95(null);
32545
32558
  const [showResults, setShowResults] = useState95(false);
32546
32559
  const [adding, setAdding] = useState95(false);
32547
- const keysBeforeAdd = useRef43(null);
32560
+ const keysBeforeAdd = useRef44(null);
32548
32561
  const [makeOnMount, setMakeOnMount] = useState95("waiting");
32549
32562
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
32550
32563
  const load = useCallback46(async () => {
@@ -32610,7 +32623,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
32610
32623
  );
32611
32624
  const stored = useMemo60(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
32612
32625
  const dirty = Boolean(draft && stored && !sameForm(draft, stored));
32613
- const lastSaved = useRef43(null);
32626
+ const lastSaved = useRef44(null);
32614
32627
  useEffect85(() => {
32615
32628
  if (!draft || !stored) return;
32616
32629
  const timer = window.setTimeout(() => {
@@ -32769,7 +32782,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
32769
32782
  (made) => setMakeOnMount(made ? "made" : "not-made")
32770
32783
  );
32771
32784
  }, [createOnMount, makeOnMount, forms, fields.data, create, table.data, table.error]);
32772
- if (fields.error) return /* @__PURE__ */ jsx105(RefusalNotice, { error: fields.error, className });
32785
+ if (fields.error) return /* @__PURE__ */ jsx105(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
32773
32786
  if (error) {
32774
32787
  return /* @__PURE__ */ jsx105(
32775
32788
  RefusalNotice,
@@ -33480,7 +33493,7 @@ function NotifyOnAnswer({
33480
33493
  }
33481
33494
 
33482
33495
  // src/DocRender.tsx
33483
- import { useCallback as useCallback47, useEffect as useEffect86, useRef as useRef44, useState as useState96 } from "react";
33496
+ import { useCallback as useCallback47, useEffect as useEffect86, useRef as useRef45, useState as useState96 } from "react";
33484
33497
  import { useRecordsClient as useRecordsClient75 } from "@ai-matrx/records/react";
33485
33498
  import { Button as Button79, Skeleton as Skeleton30, cn as cn56 } from "@ai-matrx/design-system";
33486
33499
  import { jsx as jsx106, jsxs as jsxs99 } from "react/jsx-runtime";
@@ -33491,7 +33504,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
33491
33504
  const [showing, setShowing] = useState96(null);
33492
33505
  const [error, setError] = useState96(null);
33493
33506
  const [busy, setBusy] = useState96(null);
33494
- const paper = useRef44(null);
33507
+ const paper = useRef45(null);
33495
33508
  const load = useCallback47(async () => {
33496
33509
  const [body, held] = await Promise.all([
33497
33510
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -33646,7 +33659,7 @@ function SignBlock({ tableId, recordId, render, className }) {
33646
33659
  setName("");
33647
33660
  await load();
33648
33661
  }
33649
- if (fields.error) return /* @__PURE__ */ jsx107(RefusalNotice, { error: fields.error, className });
33662
+ if (fields.error) return /* @__PURE__ */ jsx107(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
33650
33663
  if (error) {
33651
33664
  return /* @__PURE__ */ jsx107(
33652
33665
  RefusalNotice,
@@ -35262,7 +35275,7 @@ function TargetControl({
35262
35275
 
35263
35276
  // src/QuestionPanel.tsx
35264
35277
  import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
35265
- import { useEffect as useEffect90, useMemo as useMemo63, useRef as useRef45, useState as useState101 } from "react";
35278
+ import { useEffect as useEffect90, useMemo as useMemo63, useRef as useRef46, useState as useState101 } from "react";
35266
35279
  import { Badge as Badge16, BasicInput as BasicInput20, Button as Button84, Checkbox as Checkbox11, Label as Label16, Skeleton as Skeleton34, cn as cn61 } from "@ai-matrx/design-system";
35267
35280
  import { useFields as useFields29, useRecordsClient as useRecordsClient80 } from "@ai-matrx/records/react";
35268
35281
 
@@ -35351,7 +35364,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
35351
35364
  const [saveError, setSaveError] = useState101(null);
35352
35365
  const [saving, setSaving] = useState101(false);
35353
35366
  const [linkMissed, setLinkMissed] = useState101(false);
35354
- const openedFromLink = useRef45(false);
35367
+ const openedFromLink = useRef46(false);
35355
35368
  useEffect90(() => {
35356
35369
  let live = true;
35357
35370
  void (0, question_exports.questionsOf)(client, tableId).then((answer2) => {
@@ -36233,7 +36246,7 @@ function AgentAnswer({
36233
36246
  }
36234
36247
 
36235
36248
  // src/PageScreen.tsx
36236
- import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as useRef46, useState as useState104 } from "react";
36249
+ import { useCallback as useCallback51, useEffect as useEffect93, useMemo as useMemo65, useRef as useRef47, useState as useState104 } from "react";
36237
36250
  import { useRecordsClient as useRecordsClient83 } from "@ai-matrx/records/react";
36238
36251
  import { BasicInput as BasicInput23, Button as Button87, Skeleton as Skeleton37, cn as cn63 } from "@ai-matrx/design-system";
36239
36252
 
@@ -37369,7 +37382,7 @@ function PageScreen({
37369
37382
  const [run, setRun] = useState104(null);
37370
37383
  const [saveError, setSaveError] = useState104(null);
37371
37384
  const [askingToArchive, setAskingToArchive] = useState104(false);
37372
- const canvas = useRef46(null);
37385
+ const canvas = useRef47(null);
37373
37386
  const [making, setMaking] = useState104("waiting");
37374
37387
  const id = page?.id ?? pageId ?? null;
37375
37388
  const load = useCallback51(
@@ -37570,7 +37583,7 @@ function PageScreen({
37570
37583
  }
37571
37584
 
37572
37585
  // src/InterfaceScreen.tsx
37573
- import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as useRef47, useState as useState105 } from "react";
37586
+ import { useCallback as useCallback52, useEffect as useEffect94, useMemo as useMemo66, useRef as useRef48, useState as useState105 } from "react";
37574
37587
  import { useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
37575
37588
  import { BasicInput as BasicInput24, Button as Button88, Skeleton as Skeleton38, cn as cn64 } from "@ai-matrx/design-system";
37576
37589
  import { Fragment as Fragment52, jsx as jsx116, jsxs as jsxs109 } from "react/jsx-runtime";
@@ -37607,7 +37620,7 @@ function InterfaceScreen({
37607
37620
  const [making, setMaking] = useState105("waiting");
37608
37621
  const [askingToArchive, setAskingToArchive] = useState105(false);
37609
37622
  const [localPage, setLocalPage] = useState105(null);
37610
- const canvas = useRef47(null);
37623
+ const canvas = useRef48(null);
37611
37624
  const load = useCallback52(
37612
37625
  async (want) => {
37613
37626
  const answered = await client.interfaceRead({ interface_id: want });
@@ -37884,7 +37897,7 @@ function InterfaceScreen({
37884
37897
 
37885
37898
  // src/FormsPanel.tsx
37886
37899
  import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
37887
- import { useCallback as useCallback53, useEffect as useEffect95, useRef as useRef48, useState as useState106 } from "react";
37900
+ import { useCallback as useCallback53, useEffect as useEffect95, useRef as useRef49, useState as useState106 } from "react";
37888
37901
  import { useRecordsClient as useRecordsClient85, useTable as useTable33 } from "@ai-matrx/records/react";
37889
37902
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
37890
37903
  import { Badge as Badge17, Button as Button89, Skeleton as Skeleton39, cn as cn65 } from "@ai-matrx/design-system";
@@ -37913,7 +37926,7 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
37913
37926
  useEffect95(() => {
37914
37927
  if (linked && rights.structure) setBuilding(true);
37915
37928
  }, [linked, rights.structure]);
37916
- const openedAsView = useRef48(false);
37929
+ const openedAsView = useRef49(false);
37917
37930
  useEffect95(() => {
37918
37931
  if (!asView || openedAsView.current || forms === null || forms.length === 0 || !rights.structure) return;
37919
37932
  openedAsView.current = true;
@@ -38074,12 +38087,12 @@ function FormsPanel({ tableId, activeFormId, asView = false, className }) {
38074
38087
  }
38075
38088
 
38076
38089
  // src/CaptureSheet.tsx
38077
- import { useCallback as useCallback55, useEffect as useEffect97, useRef as useRef50, useState as useState108 } from "react";
38090
+ import { useCallback as useCallback55, useEffect as useEffect97, useRef as useRef51, useState as useState108 } from "react";
38078
38091
  import { useFields as useFields32, useRecordsClient as useRecordsClient87, useTable as useTable34 } from "@ai-matrx/records/react";
38079
38092
  import { Button as Button91, Input as Input8, Skeleton as Skeleton41, Textarea as Textarea7, cn as cn67 } from "@ai-matrx/design-system";
38080
38093
 
38081
38094
  // src/CaptureRun.tsx
38082
- import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as useRef49, useState as useState107 } from "react";
38095
+ import { useCallback as useCallback54, useEffect as useEffect96, useMemo as useMemo67, useRef as useRef50, useState as useState107 } from "react";
38083
38096
  import {
38084
38097
  coerceTypedAnswer,
38085
38098
  coercionLabel,
@@ -38137,7 +38150,7 @@ function CaptureRun({ sheetId, face: given, className }) {
38137
38150
  const [items, setItems] = useState107([]);
38138
38151
  const [lastSynced, setLastSynced] = useState107(null);
38139
38152
  const [sending, setSending] = useState107(false);
38140
- const queueRef = useRef49(null);
38153
+ const queueRef = useRef50(null);
38141
38154
  useEffect96(() => {
38142
38155
  const q2 = openCaptureQueue({
38143
38156
  onChange: (c, all) => {
@@ -38517,7 +38530,7 @@ function AdHocCaptureSheet({
38517
38530
  const [error, setError] = useState108(null);
38518
38531
  const [uploadError, setUploadError] = useState108(null);
38519
38532
  const [flushing, setFlushing] = useState108(false);
38520
- const queue = useRef50([]);
38533
+ const queue = useRef51([]);
38521
38534
  const keep = useCallback55(
38522
38535
  async (next) => {
38523
38536
  queue.current = next;
@@ -38598,8 +38611,8 @@ function AdHocCaptureSheet({
38598
38611
  await keep([...queue.current, item]);
38599
38612
  await flush();
38600
38613
  }
38601
- if (table.error) return /* @__PURE__ */ jsx119(RefusalNotice, { error: table.error, className });
38602
- if (fields.error) return /* @__PURE__ */ jsx119(RefusalNotice, { error: fields.error, className });
38614
+ if (table.error) return /* @__PURE__ */ jsx119(RefusalNotice, { error: table.error, onRetry: table.reload, className });
38615
+ if (fields.error) return /* @__PURE__ */ jsx119(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
38603
38616
  if (fields.loading || pending === null) return /* @__PURE__ */ jsx119(Skeleton41, { className: cn67("h-64 w-full", className) });
38604
38617
  const keys = resolved();
38605
38618
  return /* @__PURE__ */ jsxs112("section", { className: cn67("mx-auto flex w-full max-w-sm flex-col gap-2", className), children: [
@@ -38967,7 +38980,7 @@ function EmbedFrame({
38967
38980
  setSecret(null);
38968
38981
  setTokenId(null);
38969
38982
  }, [client, tokenId]);
38970
- if (table.error) return /* @__PURE__ */ jsx122(RefusalNotice, { error: table.error, className });
38983
+ if (table.error) return /* @__PURE__ */ jsx122(RefusalNotice, { error: table.error, onRetry: table.reload, className });
38971
38984
  if (table.loading && !table.data) return /* @__PURE__ */ jsx122(Skeleton44, { className: cn70("h-48 w-full", className) });
38972
38985
  if (!rights.admin) {
38973
38986
  return /* @__PURE__ */ jsxs115("p", { className: cn70("rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", className), children: [
@@ -39048,7 +39061,7 @@ function useEmbedHandshake(args) {
39048
39061
 
39049
39062
  // src/TablePage.tsx
39050
39063
  import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
39051
- import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as useRef52, useState as useState120 } from "react";
39064
+ import { useCallback as useCallback60, useEffect as useEffect105, useMemo as useMemo72, useRef as useRef53, useState as useState120 } from "react";
39052
39065
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
39053
39066
  import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient92, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
39054
39067
  import {
@@ -39569,7 +39582,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
39569
39582
  onProgress: (progress) => setPhase({ kind: "copying", progress })
39570
39583
  });
39571
39584
  if (!made.ok) {
39572
- setPhase({ kind: "refused", sentence: refusalSentence(made.error) });
39585
+ setPhase({ kind: "refused", sentence: refusalSaid(made.error), timedOut: refusalTimedOut(made.error) });
39573
39586
  return;
39574
39587
  }
39575
39588
  tableShapeChanged10(made.data.table.id);
@@ -39623,6 +39636,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
39623
39636
  ] }),
39624
39637
  phase.kind === "copying" ? /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", "data-table-duplicate-progress": "", children: phase.progress ? duplicateProgressWords(phase.progress) : "Starting the copy\u2026" }) : null,
39625
39638
  phase.kind === "refused" ? /* @__PURE__ */ jsx127(ErrorBox4, { children: phase.sentence }) : null,
39639
+ phase.kind === "refused" && phase.timedOut ? /* @__PURE__ */ jsx127(Button97, { variant: "outline", size: "sm", className: "self-start", "data-refusal-retry": "", onClick: () => void go(), children: "Try again" }) : null,
39626
39640
  problem && typed2 !== "" ? /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: problem }) : null
39627
39641
  ] }),
39628
39642
  /* @__PURE__ */ jsx127(DialogFooter13, { children: phase.kind === "done" ? /* @__PURE__ */ jsx127(Button97, { onClick: () => openCopy(phase.copy), "data-table-duplicate-open": "", children: "Open the copy" }) : /* @__PURE__ */ jsxs120(Fragment56, { children: [
@@ -39855,7 +39869,7 @@ function phoneTableActions(actions) {
39855
39869
  }
39856
39870
 
39857
39871
  // src/presence.tsx
39858
- import { useEffect as useEffect103, useMemo as useMemo71, useRef as useRef51, useState as useState118, useSyncExternalStore as useSyncExternalStore4 } from "react";
39872
+ import { useEffect as useEffect103, useMemo as useMemo71, useRef as useRef52, useState as useState118, useSyncExternalStore as useSyncExternalStore4 } from "react";
39859
39873
  import { jsx as jsx130, jsxs as jsxs123 } from "react/jsx-runtime";
39860
39874
  var NO_PEOPLE = [];
39861
39875
  var MAX_AVATARS = 4;
@@ -39902,7 +39916,7 @@ function TablePresence({ tableId }) {
39902
39916
  const { session, people: published } = useTablePresence(tableId);
39903
39917
  const roster = useMemberRoster();
39904
39918
  const people = useMemo71(() => namePeople(published, roster), [published, roster]);
39905
- const root = useRef51(null);
39919
+ const root = useRef52(null);
39906
39920
  const css = useMemo71(() => presenceOutlineCss(people), [people]);
39907
39921
  useEffect103(() => {
39908
39922
  if (!session || typeof MutationObserver === "undefined") return;
@@ -40492,7 +40506,7 @@ function TablePage({
40492
40506
  return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
40493
40507
  });
40494
40508
  const [looks, setLooks] = useState120(() => seededViews ? seededOpening?.looks : void 0);
40495
- const looksSeededFor = useRef52(seededViews && seededOpening ? tableId : null);
40509
+ const looksSeededFor = useRef53(seededViews && seededOpening ? tableId : null);
40496
40510
  useEffect105(() => {
40497
40511
  if (looksSeededFor.current === tableId) {
40498
40512
  looksSeededFor.current = null;
@@ -40520,7 +40534,7 @@ function TablePage({
40520
40534
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
40521
40535
  const [views, setViews] = useState120(() => seededViews);
40522
40536
  const [pickedViewId, setPickedViewId] = useState120(savedFromLink);
40523
- const viewSeen = useRef52(null);
40537
+ const viewSeen = useRef53(null);
40524
40538
  const [viewLinkMissed, setViewLinkMissed] = useState120(false);
40525
40539
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
40526
40540
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
@@ -40550,7 +40564,7 @@ function TablePage({
40550
40564
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
40551
40565
  const [archiveAsked, setArchiveAsked] = useState120(0);
40552
40566
  const pageArchive = useTableArchive2(tableId);
40553
- const archiveRunning = useRef52(false);
40567
+ const archiveRunning = useRef53(false);
40554
40568
  const archiveFromMenu = useCallback60(async () => {
40555
40569
  if (archiveRunning.current) return;
40556
40570
  archiveRunning.current = true;
@@ -40631,7 +40645,7 @@ function TablePage({
40631
40645
  lookDiffers: view ? lookDiffers(view, look) : false
40632
40646
  };
40633
40647
  const shownSignature = JSON.stringify(shownReport);
40634
- const reportRef = useRef52(onShownViewChange);
40648
+ const reportRef = useRef53(onShownViewChange);
40635
40649
  reportRef.current = onShownViewChange;
40636
40650
  useEffect105(() => {
40637
40651
  reportRef.current?.(JSON.parse(shownSignature));
@@ -40642,8 +40656,8 @@ function TablePage({
40642
40656
  onViewChanged?.(addressForView(view, next));
40643
40657
  void patchView({ layout: next });
40644
40658
  };
40645
- const reportedRecords = useRef52(/* @__PURE__ */ new Set());
40646
- const lastActiveRecord = useRef52(activeRecordId ?? null);
40659
+ const reportedRecords = useRef53(/* @__PURE__ */ new Set());
40660
+ const lastActiveRecord = useRef53(activeRecordId ?? null);
40647
40661
  useEffect105(() => {
40648
40662
  const before = lastActiveRecord.current;
40649
40663
  lastActiveRecord.current = activeRecordId ?? null;
@@ -40666,7 +40680,7 @@ function TablePage({
40666
40680
  if (rail !== "record") setRecordFull(false);
40667
40681
  }, [rail]);
40668
40682
  const shownRecord = rail === "record" ? openRecord : null;
40669
- const reportedRecord = useRef52(activeRecordId ?? null);
40683
+ const reportedRecord = useRef53(activeRecordId ?? null);
40670
40684
  useEffect105(() => {
40671
40685
  if (shownRecord === reportedRecord.current) return;
40672
40686
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
@@ -40725,7 +40739,7 @@ function TablePage({
40725
40739
  },
40726
40740
  [client, tableId, view, looks, viewLocked, sayLocked]
40727
40741
  );
40728
- const arrival = useRef52(viewAddress ?? null);
40742
+ const arrival = useRef53(viewAddress ?? null);
40729
40743
  const [gridQuery, setGridQuery] = useState120(null);
40730
40744
  const [addressResetEpoch, setAddressResetEpoch] = useState120(0);
40731
40745
  const reportGrid = useCallback60((q) => {
@@ -40736,7 +40750,7 @@ function TablePage({
40736
40750
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
40737
40751
  [reportGrid, addressResetEpoch]
40738
40752
  );
40739
- const hiddenApplied = useRef52(false);
40753
+ const hiddenApplied = useRef53(false);
40740
40754
  useEffect105(() => {
40741
40755
  const hidden = arrival.current?.hidden;
40742
40756
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
@@ -40757,9 +40771,9 @@ function TablePage({
40757
40771
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
40758
40772
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
40759
40773
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
40760
- const addressReportRef = useRef52(onViewAddressChange);
40774
+ const addressReportRef = useRef53(onViewAddressChange);
40761
40775
  addressReportRef.current = onViewAddressChange;
40762
- const addressSent = useRef52(null);
40776
+ const addressSent = useRef53(null);
40763
40777
  useEffect105(() => {
40764
40778
  if (!addressReady) return;
40765
40779
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
@@ -41082,9 +41096,9 @@ function TablePage({
41082
41096
  }
41083
41097
  });
41084
41098
  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;
41085
- const actionsRef = useRef52(actions);
41099
+ const actionsRef = useRef53(actions);
41086
41100
  actionsRef.current = actions;
41087
- const onActionsRef = useRef52(onActions);
41101
+ const onActionsRef = useRef53(onActions);
41088
41102
  onActionsRef.current = onActions;
41089
41103
  useEffect105(() => {
41090
41104
  onActionsRef.current?.(actionsRef.current);
@@ -41205,7 +41219,7 @@ function TablePage({
41205
41219
  const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
41206
41220
  if (table.error) return /* @__PURE__ */ jsxs124(Fragment57, { children: [
41207
41221
  headerNode,
41208
- /* @__PURE__ */ jsx131(RefusalNotice, { error: table.error })
41222
+ /* @__PURE__ */ jsx131(RefusalNotice, { error: table.error, onRetry: table.reload })
41209
41223
  ] });
41210
41224
  if (table.loading && !table.data) {
41211
41225
  return /* @__PURE__ */ jsxs124(Fragment57, { children: [
@@ -41716,7 +41730,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
41716
41730
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
41717
41731
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
41718
41732
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
41719
- import { useEffect as useEffect106, useMemo as useMemo73, useRef as useRef53, useState as useState121 } from "react";
41733
+ import { useEffect as useEffect106, useMemo as useMemo73, useRef as useRef54, useState as useState121 } from "react";
41720
41734
  import { Button as Button100, ErrorBox as ErrorBox5, Input as Input12, cn as cn73 } from "@ai-matrx/design-system";
41721
41735
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient93, useSeededAnswerAt } from "@ai-matrx/records/react";
41722
41736
  import { Fragment as Fragment58, jsx as jsx132, jsxs as jsxs125 } from "react/jsx-runtime";
@@ -41824,7 +41838,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
41824
41838
  const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
41825
41839
  const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
41826
41840
  const [block, setBlock] = useState121(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
41827
- const seededFor = useRef53(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
41841
+ const seededFor = useRef54(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
41828
41842
  useEffect106(() => {
41829
41843
  const held = seededFor.current;
41830
41844
  if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
@@ -42167,7 +42181,7 @@ function PreviewForms({ preview, booking }) {
42167
42181
  }
42168
42182
 
42169
42183
  // src/SectionCard.tsx
42170
- import { useEffect as useEffect109, useRef as useRef54, useState as useState125 } from "react";
42184
+ import { useEffect as useEffect109, useRef as useRef55, useState as useState125 } from "react";
42171
42185
  import { atLeast } from "@ai-matrx/records/field-kinds";
42172
42186
  import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useRecordsClient as useRecordsClient95, useTable as useTable37 } from "@ai-matrx/records/react";
42173
42187
  import {
@@ -42568,7 +42582,7 @@ function columnsOf(values) {
42568
42582
  var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
42569
42583
  function useDraft(stored, save) {
42570
42584
  const [draft, setDraft] = useState125(null);
42571
- const latest = useRef54({ draft, save, stored });
42585
+ const latest = useRef55({ draft, save, stored });
42572
42586
  useEffect109(() => {
42573
42587
  latest.current = { draft, save, stored };
42574
42588
  });
@@ -42975,7 +42989,7 @@ function TableSectionCard(props) {
42975
42989
  const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
42976
42990
  const refused = table.error ?? fieldsRead.error ?? page.error;
42977
42991
  const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
42978
- const sectionRef = useRef54(null);
42992
+ const sectionRef = useRef55(null);
42979
42993
  const narrow = useNarrow2(sectionRef);
42980
42994
  const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
42981
42995
  return /* @__PURE__ */ jsxs129("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: cn75("rounded-2xl border border-border bg-card text-card-foreground", className), children: [