@nivaro/react 0.3.46 → 0.3.47

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.
Files changed (57) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +248 -16
  4. package/dist/index.js +679 -659
  5. package/dist/shared/components/CollectionBrowserView.js +813 -826
  6. package/dist/shared/components/ErrorNotice.js +169 -0
  7. package/dist/shared/components/ErrorSurface.js +23 -17
  8. package/dist/shared/components/ListLoadError.js +8 -29
  9. package/dist/shared/components/LoadErrorNote.js +38 -21
  10. package/dist/shared/components/QueryErrorState.js +8 -11
  11. package/dist/shared/components/ReportView.js +1320 -1291
  12. package/dist/shared/components/chat/ChannelArchive.js +60 -60
  13. package/dist/shared/components/chat/ChannelExtras.js +74 -74
  14. package/dist/shared/components/chat/ChatPanel.js +368 -367
  15. package/dist/shared/components/command-center/PeekPanel.js +33 -32
  16. package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
  17. package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
  18. package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
  19. package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
  20. package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
  21. package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
  22. package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
  23. package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
  24. package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
  25. package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
  26. package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
  27. package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
  28. package/dist/shared/components/import/ImportFromFileButton.js +61 -60
  29. package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
  30. package/dist/shared/components/imports/NewImportDialog.js +29 -28
  31. package/dist/shared/components/imports/RunDetailSheet.js +63 -63
  32. package/dist/shared/components/item-edit/FieldRow.js +329 -329
  33. package/dist/shared/components/item-edit/InlineTableField.js +898 -898
  34. package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
  35. package/dist/shared/components/item-edit/PlanGrid.js +220 -221
  36. package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
  37. package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
  38. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
  39. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
  40. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
  41. package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
  42. package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
  43. package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
  44. package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
  45. package/dist/shared/components/panels/SlaClock.js +35 -36
  46. package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
  47. package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
  48. package/dist/shared/components/profile/AgentsPanel.js +73 -72
  49. package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
  50. package/dist/shared/components/support/SupportRequestDialog.js +85 -81
  51. package/dist/shared/components/support/SupportView.js +94 -87
  52. package/dist/shared/lib/autofill-poll.js +21 -18
  53. package/dist/shared/lib/error-actions.js +85 -0
  54. package/dist/shared/lib/error-message.js +223 -82
  55. package/dist/shared/lib/error-toast.js +71 -13
  56. package/dist/shared/lib/safe-error.js +136 -38
  57. package/package.json +1 -1
@@ -1,39 +1,39 @@
1
1
  import { jsx as s, jsxs as _, Fragment as xn } from "react/jsx-runtime";
2
- import { useQueryClient as jo, useQuery as Fe, useQueries as Zt } from "@tanstack/react-query";
3
- import { Loader2 as vn, ListChecks as Ya, SquarePen as Ga, Rows3 as Xa, PanelBottomOpen as Ca, Zap as Za, Clock as Ni, History as Lr, AlertTriangle as Yn, ChevronRight as To, GripVertical as xo, FileUp as vo, X as wo, GripHorizontal as el, Lock as tl } from "lucide-react";
4
- import { useState as U, useMemo as T, useEffect as $e, useRef as xe, useCallback as Mt, Fragment as Si } from "react";
5
- import { createPortal as nl } from "react-dom";
6
- import { ChangeReasonDialog as rl, changeReasonChallenge as $i } from "./ChangeReasonDialog.js";
2
+ import { useQueryClient as To, useQuery as Fe, useQueries as Zt } from "@tanstack/react-query";
3
+ import { Loader2 as vn, ListChecks as Ga, SquarePen as Xa, Rows3 as Ca, PanelBottomOpen as Za, Zap as el, Clock as Si, History as Mr, AlertTriangle as Yn, ChevronRight as Lo, GripVertical as vo, FileUp as wo, X as _o, GripHorizontal as tl, Lock as nl } from "lucide-react";
4
+ import { useState as U, useMemo as T, useEffect as $e, useRef as xe, useCallback as Mt, Fragment as $i } from "react";
5
+ import { createPortal as rl } from "react-dom";
6
+ import { ChangeReasonDialog as il, changeReasonChallenge as qi } from "./ChangeReasonDialog.js";
7
7
  import { toast as Se } from "sonner";
8
- import { useNivaroClient as Pr, useDrilldown as il, useParentDraft as sl, useReimportHandler as ol, useItemEditAuth as al, fieldDrilldownConfig as _o } from "../../context.js";
9
- import { get as re, patch as yt, post as Ke, del as Lo } from "../../lib/commands.js";
10
- import { useAfterIdle as ll } from "../../lib/defer.js";
11
- import { evaluateNumeric as pt, evaluateBoolean as dl } from "../../lib/expression.js";
8
+ import { useNivaroClient as Dr, useDrilldown as sl, useParentDraft as ol, useReimportHandler as al, useItemEditAuth as ll, fieldDrilldownConfig as ko } from "../../context.js";
9
+ import { get as re, patch as yt, post as Ke, del as Mo } from "../../lib/commands.js";
10
+ import { useAfterIdle as dl } from "../../lib/defer.js";
11
+ import { evaluateNumeric as pt, evaluateBoolean as cl } from "../../lib/expression.js";
12
12
  import { numericIntlOptions as bt } from "../../lib/format-value.js";
13
- import { useOptionalRealtime as cl } from "../../lib/realtime.js";
14
- import { useRecordReader as ul } from "../../lib/record-loader.js";
15
- import { restoreSkippedNote as fl } from "../../lib/restore-skipped.js";
16
- import { userErrorMessage as ml } from "../../lib/safe-error.js";
17
- import { titleCase as qe, cn as ve, formatRelative as ko, toLocalDateString as pl } from "../../lib/utils.js";
18
- import { formulaInputsChanged as gl } from "../../lib/write-formula.js";
19
- import { ImportFromFileButton as hl } from "../import/ImportFromFileButton.js";
13
+ import { useOptionalRealtime as ul } from "../../lib/realtime.js";
14
+ import { useRecordReader as fl } from "../../lib/record-loader.js";
15
+ import { restoreSkippedNote as ml } from "../../lib/restore-skipped.js";
16
+ import { userErrorMessage as Gn } from "../../lib/safe-error.js";
17
+ import { titleCase as qe, cn as ve, formatRelative as No, toLocalDateString as pl } from "../../lib/utils.js";
18
+ import { formulaInputsChanged as hl } from "../../lib/write-formula.js";
19
+ import { ImportFromFileButton as gl } from "../import/ImportFromFileButton.js";
20
20
  import { Sheet as bl, SheetContent as yl, SheetHeader as xl, SheetTitle as vl } from "../ui/sheet.js";
21
21
  import { useAddendumO2M as wl, useAddendumView as _l } from "./AddendumFieldContext.js";
22
- import { resolveCompareEndpoint as kl, useCompareSeries as Nl, compareColumnClosed as Kt, fmtMoney as qi, CompareProposalBanner as Sl, CompareStripChips as $l, GridStatChip as ql, CompareCell as Ei, compareRowFor as Oi, compareColumnSum as El, ReconcileAction as Ol } from "./CompareSeries.js";
22
+ import { resolveCompareEndpoint as kl, useCompareSeries as Nl, compareColumnClosed as Kt, fmtMoney as Ei, CompareProposalBanner as Sl, CompareStripChips as $l, GridStatChip as ql, CompareCell as Oi, compareRowFor as Ii, compareColumnSum as El, ReconcileAction as Ol } from "./CompareSeries.js";
23
23
  import { FieldRenderer as yn } from "./FieldRenderer.js";
24
24
  import { GridBulkEditDialog as Il } from "./GridBulkEditDialog.js";
25
- import { SENTINEL_FIELDS as Mi, applyDisplayTemplate as Bn, parseJson as No, EMPTY_NESTED_OPS as Mr, SYSTEM_FIELDS as So } from "./helpers.js";
26
- import { NUMBER_FIELD_TYPES as Al, checkNumberEntry as jl, changedRowFields as $o, lineRuleErrors as Tl } from "./line-qty.js";
27
- import { NestedRelationEditor as Ii } from "./NestedRelationEditor.js";
25
+ import { SENTINEL_FIELDS as Ki, applyDisplayTemplate as Bn, parseJson as So, EMPTY_NESTED_OPS as Kr, SYSTEM_FIELDS as $o } from "./helpers.js";
26
+ import { NUMBER_FIELD_TYPES as Al, checkNumberEntry as jl, changedRowFields as qo, lineRuleErrors as Tl } from "./line-qty.js";
27
+ import { NestedRelationEditor as Ai } from "./NestedRelationEditor.js";
28
28
  import { useO2MStaging as Ll, useLiveRows as Ml, useStagedRelations as Kl } from "./O2MStagingContext.js";
29
- import { RelationCombobox as Ai } from "./RelationCombobox.js";
29
+ import { RelationCombobox as ji } from "./RelationCombobox.js";
30
30
  import { useRowCommentCounts as Rl, RowCommentButton as Pl } from "./RowComments.js";
31
- import { RowHistorySheet as qo, parseImportStamp as Dl } from "./RowHistorySheet.js";
32
- import { useRowMatches as Wl, RowMatchDot as Eo, rowFromCandidate as Ul, RowMatchPanel as Jl } from "./RowMatchPanel.js";
31
+ import { RowHistorySheet as Eo, parseImportStamp as Dl } from "./RowHistorySheet.js";
32
+ import { useRowMatches as Wl, RowMatchDot as Oo, rowFromCandidate as Ul, RowMatchPanel as Jl } from "./RowMatchPanel.js";
33
33
  import { RowWatchButton as zl } from "./RowWatchButton.js";
34
34
  import { RuleProvenanceChip as Ql } from "./RuleProvenancePopover.js";
35
- import { resolveOptionFilterTokens as Mo } from "../../lib/option-filter-tokens.js";
36
- function Oo(a, f) {
35
+ import { resolveOptionFilterTokens as Ko } from "../../lib/option-filter-tokens.js";
36
+ function Io(a, f) {
37
37
  const v = a[f.field], E = v == null || v === "", z = f.op ?? "eq";
38
38
  if (z === "null") return E;
39
39
  if (z === "nnull") return !E;
@@ -44,12 +44,12 @@ function Oo(a, f) {
44
44
  const ne = String(f.value ?? "");
45
45
  return z === "neq" ? W !== ne : W === ne;
46
46
  }
47
- function ji(a, f) {
47
+ function Ti(a, f) {
48
48
  var E, z;
49
49
  if (!(f != null && f.length)) return [];
50
50
  const v = [];
51
51
  for (const W of f)
52
- !((E = W == null ? void 0 : W.when) != null && E.field) || !((z = W == null ? void 0 : W.expect) != null && z.field) || Oo(a, W.when) && (Oo(a, W.expect) || v.push(W.label || `${W.when.field} vs ${W.expect.field}`));
52
+ !((E = W == null ? void 0 : W.when) != null && E.field) || !((z = W == null ? void 0 : W.expect) != null && z.field) || Io(a, W.when) && (Io(a, W.expect) || v.push(W.label || `${W.when.field} vs ${W.expect.field}`));
53
53
  return v;
54
54
  }
55
55
  const Fl = {
@@ -74,7 +74,7 @@ function Vl({ children: a }) {
74
74
  children: [
75
75
  /* @__PURE__ */ s(Yn, { className: "h-3 w-3 shrink-0 text-amber-500" }),
76
76
  /* @__PURE__ */ s("span", { className: "min-w-0 truncate", children: a }),
77
- f && nl(
77
+ f && rl(
78
78
  /* @__PURE__ */ s(
79
79
  "div",
80
80
  {
@@ -110,7 +110,7 @@ function Bl(a) {
110
110
  }
111
111
  return v;
112
112
  }
113
- const Ki = /* @__PURE__ */ new Set([
113
+ const Ri = /* @__PURE__ */ new Set([
114
114
  "alias",
115
115
  "o2m",
116
116
  "m2m",
@@ -119,7 +119,7 @@ const Ki = /* @__PURE__ */ new Set([
119
119
  "group",
120
120
  "divider"
121
121
  ]), Hn = "__all__";
122
- function Ko(a, f, v, E) {
122
+ function Ro(a, f, v, E) {
123
123
  if (f <= 0) return [];
124
124
  let z;
125
125
  for (v === "front" ? z = Array.from({ length: f }, (J, A) => f - A) : v === "back" ? z = Array.from({ length: f }, (J, A) => A + 1) : v === "shape" && E && E.some((J) => J > 0) ? z = E.slice(0, f).map((J) => Math.max(0, J)) : z = Array.from({ length: f }, () => 1); z.length < f; ) z.push(0);
@@ -134,7 +134,7 @@ function Ko(a, f, v, E) {
134
134
  }
135
135
  return ne;
136
136
  }
137
- const Ti = 1e3;
137
+ const Li = 1e3;
138
138
  function Hl(a) {
139
139
  let f = 0;
140
140
  for (let v = 0; v < a.length; v++) f = f * 31 + a.charCodeAt(v) | 0;
@@ -151,19 +151,19 @@ function Yl(a) {
151
151
  function Rt(a, f) {
152
152
  return pt(a, f);
153
153
  }
154
- function Li(a, f) {
154
+ function Mi(a, f) {
155
155
  return f.map((v) => {
156
156
  const E = a[`__m2m_${v}`];
157
157
  return String(E !== void 0 ? E ?? "" : a[v] ?? "");
158
158
  }).join("\0");
159
159
  }
160
- function Ri(a, f, v, E) {
160
+ function Pi(a, f, v, E) {
161
161
  return typeof a != "string" ? a : a === "$parent.id" ? v : a.startsWith("$parent.") ? E == null ? void 0 : E[a.slice(8)] : a.startsWith("$row.") ? f[a.slice(5)] : a;
162
162
  }
163
- function Rr(a, f, v, E) {
163
+ function Pr(a, f, v, E) {
164
164
  const z = {};
165
165
  for (const [ne, oe] of Object.entries(a.filters ?? {})) {
166
- const J = Ri(oe, f, v, E);
166
+ const J = Pi(oe, f, v, E);
167
167
  if (J == null || J === "") return null;
168
168
  if (ne.startsWith("_")) {
169
169
  z[ne] = J;
@@ -180,12 +180,12 @@ function Rr(a, f, v, E) {
180
180
  }
181
181
  const W = {};
182
182
  for (const [ne, oe] of Object.entries(a.defaults ?? {})) {
183
- const J = Ri(oe, f, v, E);
183
+ const J = Pi(oe, f, v, E);
184
184
  J != null && J !== "" && (W[ne] = J);
185
185
  }
186
186
  return { query: z, seed: W };
187
187
  }
188
- function Kr(a, f) {
188
+ function Rr(a, f) {
189
189
  return f.split(".").reduce(
190
190
  (v, E) => v && typeof v == "object" ? v[E] : void 0,
191
191
  a
@@ -210,7 +210,7 @@ function Xl({
210
210
  pendingEdits: L,
211
211
  pendingDeletes: Z
212
212
  }) {
213
- const pe = Pr(), [G, Ee] = U(!1), [ze, ie] = U(null), [Oe, ge] = U({}), [X, de] = U(null), he = T(
213
+ const pe = Dr(), [G, Ee] = U(!1), [ze, ie] = U(null), [Oe, he] = U({}), [X, de] = U(null), ge = T(
214
214
  () => (a.columns ?? []).map(
215
215
  (Q) => typeof Q == "string" ? {
216
216
  path: Q,
@@ -222,7 +222,7 @@ function Xl({
222
222
  ),
223
223
  [a.columns]
224
224
  ), He = T(
225
- () => Mo(a.filter, ne, E),
225
+ () => Ko(a.filter, ne, E),
226
226
  [a.filter, ne, E]
227
227
  ), nt = T(() => {
228
228
  const Q = /* @__PURE__ */ new Set(["id"]);
@@ -230,12 +230,12 @@ function Xl({
230
230
  const D = (P) => {
231
231
  /^__\w+__$/.test(P) || Q.add(P);
232
232
  };
233
- for (const P of he) {
233
+ for (const P of ge) {
234
234
  P.path && D(P.path);
235
235
  for (const j of (P.formula ?? "").matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) D(j[1]);
236
236
  }
237
237
  return [...Q].join(",");
238
- }, [he, a.group_by]), { data: Qe = [], isFetching: Pt } = Fe({
238
+ }, [ge, a.group_by]), { data: Qe = [], isFetching: Pt } = Fe({
239
239
  queryKey: [
240
240
  "allocate-options",
241
241
  a.collection,
@@ -278,7 +278,7 @@ function Xl({
278
278
  if (j !== null && !Number.isFinite(j)) return;
279
279
  if (j !== null && P) {
280
280
  const fe = be(P);
281
- fe !== null && j > fe && (j = Math.max(0, Math.round(fe * 100) / 100), ge((S) => ({ ...S, [Q]: String(j) })));
281
+ fe !== null && j > fe && (j = Math.max(0, Math.round(fe * 100) / 100), he((S) => ({ ...S, [Q]: String(j) })));
282
282
  }
283
283
  if (te && A) {
284
284
  const { savedRow: fe, pendingIdx: S, deleted: we } = Te(Q), le = (fe == null ? void 0 : fe.id) != null ? String(fe.id) : null;
@@ -295,7 +295,7 @@ function Xl({
295
295
  const se = ae.get(Q);
296
296
  ie(Q);
297
297
  try {
298
- j === null || j === 0 ? (se == null ? void 0 : se.id) != null && await pe.request(Lo(`/items/${f}/${se.id}`)) : (se == null ? void 0 : se.id) != null ? Number(se[a.value_field]) !== j && await pe.request(
298
+ j === null || j === 0 ? (se == null ? void 0 : se.id) != null && await pe.request(Mo(`/items/${f}/${se.id}`)) : (se == null ? void 0 : se.id) != null ? Number(se[a.value_field]) !== j && await pe.request(
299
299
  yt(`/items/${f}/${se.id}`, { [a.value_field]: j })
300
300
  ) : await pe.request(
301
301
  Ke(`/items/${f}`, {
@@ -311,7 +311,7 @@ function Xl({
311
311
  }
312
312
  }
313
313
  function Ze(Q, D, P) {
314
- return pt(Q, (j) => j in P ? P[j] : Kr(D, j));
314
+ return pt(Q, (j) => j in P ? P[j] : Rr(D, j));
315
315
  }
316
316
  function Pe(Q) {
317
317
  const D = ae.get(Q), P = Number((D == null ? void 0 : D[a.value_field]) ?? 0) || 0, j = Oe[Q], se = te ? Te(Q).amount : P;
@@ -342,7 +342,7 @@ function Xl({
342
342
  /* @__PURE__ */ s("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
343
343
  Pt ? /* @__PURE__ */ s("div", { className: "py-10 text-center", children: /* @__PURE__ */ s(vn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : Qe.length === 0 ? /* @__PURE__ */ s("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ s("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ _("table", { className: "w-full text-left text-[12px]", children: [
344
344
  /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ _("tr", { className: "border-b border-slate-200 bg-slate-50", children: [
345
- he.map((Q, D) => /* @__PURE__ */ s(
345
+ ge.map((Q, D) => /* @__PURE__ */ s(
346
346
  "th",
347
347
  {
348
348
  className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500",
@@ -353,7 +353,7 @@ function Xl({
353
353
  /* @__PURE__ */ s("th", { className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500", children: a.value_label ?? "Allocate" })
354
354
  ] }) }),
355
355
  /* @__PURE__ */ s("tbody", { className: "divide-y divide-slate-100", children: (() => {
356
- const Q = (we) => a.group_by ? String(Kr(we, a.group_by) ?? "—") : "";
356
+ const Q = (we) => a.group_by ? String(Rr(we, a.group_by) ?? "—") : "";
357
357
  let D = Qe, P = [];
358
358
  a.group_by && (P = [...new Set(Qe.map(Q))], D = P.flatMap(
359
359
  (we) => Qe.filter((le) => Q(le) === we)
@@ -371,20 +371,20 @@ function Xl({
371
371
  S = V;
372
372
  const me = Qe.filter((tt) => Q(tt) === V), O = me.filter(
373
373
  (tt) => Te(String(tt.id)).amount > 0
374
- ).length, N = he.map(
374
+ ).length, N = ge.map(
375
375
  (tt) => !!tt.formula || tt.format === "currency"
376
- ), Wt = N.indexOf(!0), qt = Wt === -1 ? he.length : Math.max(1, Wt), Gn = (tt) => {
377
- const Ye = he[tt];
378
- let Cn = 0;
376
+ ), Wt = N.indexOf(!0), qt = Wt === -1 ? ge.length : Math.max(1, Wt), Xn = (tt) => {
377
+ const Ye = ge[tt];
378
+ let Zn = 0;
379
379
  for (const _e of me) {
380
- const _n = Ye.formula ? Ze(Ye.formula, _e, Pe(String(_e.id))) : Number(Kr(_e, Ye.path ?? ""));
381
- _n !== null && Number.isFinite(_n) && (Cn += _n);
380
+ const _n = Ye.formula ? Ze(Ye.formula, _e, Pe(String(_e.id))) : Number(Rr(_e, Ye.path ?? ""));
381
+ _n !== null && Number.isFinite(_n) && (Zn += _n);
382
382
  }
383
- return Cn.toLocaleString("en-US", {
383
+ return Zn.toLocaleString("en-US", {
384
384
  style: "currency",
385
385
  currency: "USD"
386
386
  });
387
- }, Xn = me.reduce(
387
+ }, Cn = me.reduce(
388
388
  (tt, Ye) => tt + Pe(String(Ye.id)).__input__,
389
389
  0
390
390
  );
@@ -402,7 +402,7 @@ function Xl({
402
402
  className: "flex w-full items-center gap-1.5 text-left",
403
403
  children: [
404
404
  /* @__PURE__ */ s(
405
- To,
405
+ Lo,
406
406
  {
407
407
  className: ve(
408
408
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
@@ -423,15 +423,15 @@ function Xl({
423
423
  ]
424
424
  }
425
425
  ) }),
426
- he.slice(qt).map((tt, Ye) => /* @__PURE__ */ s(
426
+ ge.slice(qt).map((tt, Ye) => /* @__PURE__ */ s(
427
427
  "td",
428
428
  {
429
429
  className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-slate-600",
430
- children: N[qt + Ye] ? Gn(qt + Ye) : ""
430
+ children: N[qt + Ye] ? Xn(qt + Ye) : ""
431
431
  },
432
432
  Ye
433
433
  )),
434
- /* @__PURE__ */ s("td", { className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-[#0891b2]", children: Xn > 0 ? Xn.toLocaleString("en-US", {
434
+ /* @__PURE__ */ s("td", { className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-[#0891b2]", children: Cn > 0 ? Cn.toLocaleString("en-US", {
435
435
  style: "currency",
436
436
  currency: "USD"
437
437
  }) : "" })
@@ -445,8 +445,8 @@ function Xl({
445
445
  const k = Te(le), wn = k.amount > 0 ? k.savedRow ?? {} : void 0, Dt = Oe[le] ?? (k.amount > 0 ? String(k.amount) : "");
446
446
  fe.push(
447
447
  /* @__PURE__ */ _("tr", { className: ve(wn && "bg-nvr-cyan/5"), children: [
448
- he.map((me, O) => {
449
- const N = me.formula ? et(me.formula, we) : Gl(Kr(we, me.path ?? ""), me.format);
448
+ ge.map((me, O) => {
449
+ const N = me.formula ? et(me.formula, we) : Gl(Rr(we, me.path ?? ""), me.format);
450
450
  return /* @__PURE__ */ s(
451
451
  "td",
452
452
  {
@@ -471,7 +471,7 @@ function Xl({
471
471
  min: 0,
472
472
  value: Dt,
473
473
  title: me !== null ? `Max ${me.toLocaleString("en-US", { style: "currency", currency: "USD" })}` : void 0,
474
- onChange: (N) => ge((Wt) => ({ ...Wt, [le]: N.target.value })),
474
+ onChange: (N) => he((Wt) => ({ ...Wt, [le]: N.target.value })),
475
475
  onBlur: () => {
476
476
  Oe[le] !== void 0 && xt(le, Oe[le], we);
477
477
  },
@@ -505,7 +505,7 @@ function Cl({
505
505
  computedWriteFields: E,
506
506
  applyRow: z
507
507
  }) {
508
- const W = Pr(), [ne, oe] = U(!1), [J, A] = U(!1), te = async () => {
508
+ const W = Dr(), [ne, oe] = U(!1), [J, A] = U(!1), te = async () => {
509
509
  A(!1);
510
510
  const je = Object.keys(a.set).filter((L) => E.has(L));
511
511
  if (je.length > 0) {
@@ -540,33 +540,33 @@ function Cl({
540
540
  })
541
541
  ).then((X) => X.data ?? []), Ee = a.aggregate.op ?? "sum", ze = /* @__PURE__ */ new Map();
542
542
  for (const X of G) {
543
- const de = String(X[Z.many_field] ?? ""), he = Number(X[a.aggregate.field]);
544
- !de || Number.isNaN(he) || ze.set(de, [...ze.get(de) ?? [], he]);
543
+ const de = String(X[Z.many_field] ?? ""), ge = Number(X[a.aggregate.field]);
544
+ !de || Number.isNaN(ge) || ze.set(de, [...ze.get(de) ?? [], ge]);
545
545
  }
546
546
  const ie = (X) => {
547
547
  const de = ze.get(String(X)) ?? [];
548
- return Ee === "count" ? de.length : de.length === 0 ? 0 : Ee === "min" ? Math.min(...de) : Ee === "max" ? Math.max(...de) : de.reduce((he, He) => he + He, 0);
548
+ return Ee === "count" ? de.length : de.length === 0 ? 0 : Ee === "min" ? Math.min(...de) : Ee === "max" ? Math.max(...de) : de.reduce((ge, He) => ge + He, 0);
549
549
  };
550
- let Oe = 0, ge = 0;
550
+ let Oe = 0, he = 0;
551
551
  for (const X of f) {
552
552
  const de = { ...X, __agg__: ie(X.id) };
553
- if (a.guard && !dl(a.guard, de)) {
554
- ge++;
553
+ if (a.guard && !cl(a.guard, de)) {
554
+ he++;
555
555
  continue;
556
556
  }
557
- const he = {};
557
+ const ge = {};
558
558
  for (const [He, nt] of Object.entries(a.set)) {
559
559
  const Qe = Rt(nt, de);
560
- Qe != null && Number.isFinite(Qe) && (he[He] = Math.round(Qe * 100) / 100);
560
+ Qe != null && Number.isFinite(Qe) && (ge[He] = Math.round(Qe * 100) / 100);
561
561
  }
562
- if (Object.keys(he).length === 0) {
563
- ge++;
562
+ if (Object.keys(ge).length === 0) {
563
+ he++;
564
564
  continue;
565
565
  }
566
- await z(X, he), Oe++;
566
+ await z(X, ge), Oe++;
567
567
  }
568
568
  Se.success(
569
- `${a.label}: ${Oe} row${Oe === 1 ? "" : "s"} updated` + (ge > 0 ? `, ${ge} unchanged` : "")
569
+ `${a.label}: ${Oe} row${Oe === 1 ? "" : "s"} updated` + (he > 0 ? `, ${he} unchanged` : "")
570
570
  );
571
571
  } catch {
572
572
  Se.error(`${a.label} failed`);
@@ -617,19 +617,19 @@ function Zl({
617
617
  relatedCollection: W,
618
618
  manyField: ne
619
619
  }) {
620
- const oe = Pr(), J = jo(), [A, te] = U(!1), [je, L] = U(null), Z = async () => {
620
+ const oe = Dr(), J = To(), [A, te] = U(!1), [je, L] = U(null), Z = async () => {
621
621
  if (A) return;
622
622
  te(!0), L(null);
623
623
  const pe = a.fk_field, G = a.alloc_qty_field, Ee = a.candidates.min_capacity ?? 1, ze = [
624
624
  ...a.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
625
625
  ].map((de) => de[1]), ie = {};
626
- let Oe = 0, ge = 0;
626
+ let Oe = 0, he = 0;
627
627
  const X = [];
628
628
  try {
629
- for (let he = 0; he < v.length; he++) {
630
- const He = v[he], nt = Number(He[a.row_qty_field]);
629
+ for (let ge = 0; ge < v.length; ge++) {
630
+ const He = v[ge], nt = Number(He[a.row_qty_field]);
631
631
  if (!Number.isFinite(nt) || nt <= 0) continue;
632
- const Qe = Rr(f, He, E, z);
632
+ const Qe = Pr(f, He, E, z);
633
633
  if (!Qe) continue;
634
634
  const Pt = await oe.request(
635
635
  re(`/items/${f.collection}`, {
@@ -640,7 +640,7 @@ function Zl({
640
640
  ).then((D) => D.data ?? []), ae = Pt.reduce((D, P) => D + (Number(P[G]) || 0), 0);
641
641
  let Te = nt - ae;
642
642
  if (Te <= 0) continue;
643
- const xt = Rr(
643
+ const xt = Pr(
644
644
  {
645
645
  collection: a.candidates.collection,
646
646
  filters: a.candidates.filters,
@@ -660,7 +660,7 @@ function Zl({
660
660
  })
661
661
  ).then((D) => D.data ?? []);
662
662
  if (Ze.length === 0) {
663
- X.push(he + 1);
663
+ X.push(ge + 1);
664
664
  continue;
665
665
  }
666
666
  const Pe = Ze.map((D) => String(D.id)), et = await oe.request(
@@ -688,14 +688,14 @@ function Zl({
688
688
  Ke(`/items/${f.collection}`, { ...Qe.seed, [pe]: D.id, [G]: fe })
689
689
  ), ie[P] = (ie[P] ?? 0) + fe, Te -= fe, Oe += fe;
690
690
  }
691
- Te < Q && ge++, Te > 0 && X.push(he + 1);
691
+ Te < Q && he++, Te > 0 && X.push(ge + 1);
692
692
  }
693
693
  const de = [];
694
694
  de.push(
695
- Oe > 0 ? `Allocated ${Oe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${ge} row${ge === 1 ? "" : "s"}` : "Nothing to allocate"
695
+ Oe > 0 ? `Allocated ${Oe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${he} row${he === 1 ? "" : "s"}` : "Nothing to allocate"
696
696
  ), X.length > 0 && de.push(`short on row${X.length === 1 ? "" : "s"} ${X.join(", ")}`), L(de.join(" — ")), J.invalidateQueries({ queryKey: ["o2m-rows", W, ne, E] }), J.invalidateQueries({ queryKey: ["match-agg"] });
697
697
  } catch (de) {
698
- L(`Auto-allocate failed: ${ml(de, "unknown error")}`);
698
+ L(`Auto-allocate failed: ${Gn(de, "unknown error")}`);
699
699
  } finally {
700
700
  te(!1);
701
701
  }
@@ -716,7 +716,7 @@ function Zl({
716
716
  }
717
717
  function ed(a) {
718
718
  return a.filter(
719
- (f) => f.group_key === "__apply_values__" && !Ki.has(f.type ?? "") && !Mi.has(f.field) && !f.readonly && !(f.computed_type === "write" && f.computed_formula) && f.interface !== "formula-column" && f.interface !== "match-agg-column" && f.interface !== "relation-path"
719
+ (f) => f.group_key === "__apply_values__" && !Ri.has(f.type ?? "") && !Ki.has(f.field) && !f.readonly && !(f.computed_type === "write" && f.computed_formula) && f.interface !== "formula-column" && f.interface !== "match-agg-column" && f.interface !== "relation-path"
720
720
  );
721
721
  }
722
722
  function Pd({
@@ -740,10 +740,10 @@ function Pd({
740
740
  uniqueBy: ze,
741
741
  sortField: ie,
742
742
  sortDir: Oe = "asc",
743
- sectionGroupBy: ge,
743
+ sectionGroupBy: he,
744
744
  freezeFirstColumn: X = !1,
745
745
  rowFilter: de,
746
- rowDefaults: he,
746
+ rowDefaults: ge,
747
747
  allocateDrawer: He,
748
748
  autoAllocate: nt,
749
749
  rowBulkActions: Qe,
@@ -762,11 +762,11 @@ function Pd({
762
762
  emptyLabel: se,
763
763
  editorMode: fe
764
764
  }) {
765
- var bo, yo;
766
- const S = Pr(), we = ul(), le = il(), V = jo(), k = Ll(), wn = Ml(), Dt = Kl(), me = wl()[P ?? ""] ?? [], O = v === "new", N = sl(), Wt = ol(), qt = cl(), Gn = `nvr_grid_editor_${a}_${P ?? f}`, [Xn, tt] = U(() => {
765
+ var yo, xo;
766
+ const S = Dr(), we = fl(), le = sl(), V = To(), k = Ll(), wn = Ml(), Dt = Kl(), me = wl()[P ?? ""] ?? [], O = v === "new", N = ol(), Wt = al(), qt = ul(), Xn = `nvr_grid_editor_${a}_${P ?? f}`, [Cn, tt] = U(() => {
767
767
  if (typeof localStorage > "u") return null;
768
768
  try {
769
- const e = localStorage.getItem(Gn);
769
+ const e = localStorage.getItem(Xn);
770
770
  return e === "split" || e === "drawer" ? e : null;
771
771
  } catch {
772
772
  return null;
@@ -776,7 +776,7 @@ function Pd({
776
776
  queryFn: () => S.request(re(`/field-config/${E}`)).then((e) => e.data ?? []),
777
777
  enabled: fe === void 0 && !!E && !!P,
778
778
  staleTime: 5 * 6e4
779
- }), Cn = T(() => {
779
+ }), Zn = T(() => {
780
780
  if (fe) return fe;
781
781
  const e = Ye == null ? void 0 : Ye.find((t) => t.field === P), n = e != null && e.options ? typeof e.options == "string" ? (() => {
782
782
  try {
@@ -786,16 +786,16 @@ function Pd({
786
786
  }
787
787
  })() : e.options : {};
788
788
  return (n == null ? void 0 : n.editor_mode) === "split" ? "split" : "drawer";
789
- }, [fe, Ye, P]), _e = !j && (Xn ?? Cn) === "split", _n = (e) => {
789
+ }, [fe, Ye, P]), _e = !j && (Cn ?? Zn) === "split", _n = (e) => {
790
790
  tt(e);
791
791
  try {
792
- localStorage.setItem(Gn, e);
792
+ localStorage.setItem(Xn, e);
793
793
  } catch {
794
794
  }
795
- }, Dr = `nvr_grid_split_h_${a}`, [Zn, Pi] = U(() => {
795
+ }, Wr = `nvr_grid_split_h_${a}`, [er, Di] = U(() => {
796
796
  if (typeof localStorage > "u") return 320;
797
797
  try {
798
- const e = Number(localStorage.getItem(Dr));
798
+ const e = Number(localStorage.getItem(Wr));
799
799
  return Number.isFinite(e) && e >= 160 ? Math.min(e, 900) : 320;
800
800
  } catch {
801
801
  return 320;
@@ -803,15 +803,15 @@ function Pd({
803
803
  });
804
804
  $e(() => {
805
805
  try {
806
- localStorage.setItem(Dr, String(Zn));
806
+ localStorage.setItem(Wr, String(er));
807
807
  } catch {
808
808
  }
809
- }, [Zn, Dr]);
810
- const er = xe(null), tr = xe(null), Di = xe(async () => {
811
- }), Wr = xe(
809
+ }, [er, Wr]);
810
+ const tr = xe(null), nr = xe(null), Wi = xe(async () => {
811
+ }), Ur = xe(
812
812
  async () => {
813
813
  }
814
- ), nr = xe(null), Wi = xe(!1);
814
+ ), rr = xe(null), Ui = xe(!1);
815
815
  $e(() => {
816
816
  if (j || typeof window > "u") return;
817
817
  const e = (n) => {
@@ -819,36 +819,36 @@ function Pd({
819
819
  if (!t || typeof t.target != "string" || !t.target || E && t.collection !== E) return;
820
820
  const r = P ?? f;
821
821
  if (!(t.grid !== r && t.grid !== a)) {
822
- if (t.handled = !0, !Wi.current) {
823
- nr.current = { target: t.target, value: t.value ?? null };
822
+ if (t.handled = !0, !Ui.current) {
823
+ rr.current = { target: t.target, value: t.value ?? null };
824
824
  return;
825
825
  }
826
- Wr.current(t.target, t.value ?? null);
826
+ Ur.current(t.target, t.value ?? null);
827
827
  }
828
828
  };
829
829
  return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
830
830
  }, [j, E, P, f, a]), $e(() => {
831
- const e = tr.current;
831
+ const e = nr.current;
832
832
  if (!e || !_e) return;
833
833
  const n = (t) => {
834
834
  if (!Ge.current || t.key !== "ArrowDown" && t.key !== "ArrowUp") return;
835
835
  const r = t.target;
836
836
  if (!r) return;
837
837
  const i = r.tagName;
838
- i === "INPUT" || i === "SELECT" || i === "TEXTAREA" || r.isContentEditable || r.closest('[role="listbox"],[role="combobox"],[data-nvr-combobox-panel],[role="dialog"]') || (t.preventDefault(), Di.current(t.key === "ArrowDown" ? 1 : -1));
838
+ i === "INPUT" || i === "SELECT" || i === "TEXTAREA" || r.isContentEditable || r.closest('[role="listbox"],[role="combobox"],[data-nvr-combobox-panel],[role="dialog"]') || (t.preventDefault(), Wi.current(t.key === "ArrowDown" ? 1 : -1));
839
839
  };
840
840
  return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
841
841
  }, [_e]);
842
- const [en, Po] = U(!1), [Ut, rr] = U(/* @__PURE__ */ new Set()), [Do, Ui] = U(!1), Ji = (e) => rr((n) => {
842
+ const [en, Do] = U(!1), [Ut, ir] = U(/* @__PURE__ */ new Set()), [Wo, Ji] = U(!1), zi = (e) => ir((n) => {
843
843
  const t = new Set(n);
844
844
  return t.has(e) ? t.delete(e) : t.add(e), t;
845
- }), zi = Q ? Q.line_field ?? "line_number" : null, { data: ir } = Fe({
845
+ }), Qi = Q ? Q.line_field ?? "line_number" : null, { data: sr } = Fe({
846
846
  queryKey: ["erp-submissions", E ?? "", String(v)],
847
847
  queryFn: () => S.request(re(`/erp-submissions/${E}/${encodeURIComponent(String(v))}`)).then((e) => e.data ?? []),
848
848
  enabled: !!Q && !!E && !O && !!v,
849
849
  staleTime: 15e3
850
- }), Wo = T(() => {
851
- const e = /* @__PURE__ */ new Map(), n = ir == null ? void 0 : ir[0];
850
+ }), Uo = T(() => {
851
+ const e = /* @__PURE__ */ new Map(), n = sr == null ? void 0 : sr[0];
852
852
  if (!n || n.status !== "failed") return e;
853
853
  const t = n.response, r = t && typeof t == "object" && Array.isArray(t.orderDetailResponse) ? t.orderDetailResponse : [];
854
854
  for (const i of r)
@@ -859,7 +859,7 @@ function Pd({
859
859
  const u = String((o == null ? void 0 : o.lineNumber) ?? "");
860
860
  if (!u || e.has(u)) continue;
861
861
  const d = Bl(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
862
- (g) => new RegExp(`^Line(?:Number)?\\s*${u}\\s*:`, "i").test(g.trim())
862
+ (h) => new RegExp(`^Line(?:Number)?\\s*${u}\\s*:`, "i").test(h.trim())
863
863
  ) ?? d[0];
864
864
  m && e.set(u, m.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
865
865
  }
@@ -869,26 +869,26 @@ function Pd({
869
869
  o && !e.has(o[1]) && e.set(o[1], o[2] || i.trim());
870
870
  }
871
871
  return e;
872
- }, [ir]), Qi = xe(!1), [Fi, Ur] = U(O && !!D);
872
+ }, [sr]), Fi = xe(!1), [Vi, Jr] = U(O && !!D);
873
873
  $e(() => {
874
- if (!Qi.current) {
874
+ if (!Fi.current) {
875
875
  if (!O || !D || !k) {
876
- Ur(!1);
876
+ Jr(!1);
877
877
  return;
878
878
  }
879
- Qi.current = !0, S.request(
879
+ Fi.current = !0, S.request(
880
880
  re(`/items/${a}`, {
881
881
  filter: JSON.stringify({ [f]: { _eq: D } }),
882
- limit: Ti
882
+ limit: Li
883
883
  })
884
884
  ).then((e) => {
885
885
  for (const n of e.data ?? [])
886
886
  k.queueRow(a, f, { __prefilled: !0, ...n });
887
- Ur(!1);
888
- }).catch(() => Ur(!1));
887
+ Jr(!1);
888
+ }).catch(() => Jr(!1));
889
889
  }
890
890
  }, []);
891
- const [Uo, Vi] = U(!1), Jo = T(
891
+ const [Jo, Bi] = U(!1), zo = T(
892
892
  () => /* @__PURE__ */ new Set([
893
893
  "id",
894
894
  f,
@@ -901,35 +901,35 @@ function Pd({
901
901
  "creator"
902
902
  ]),
903
903
  [f]
904
- ), zo = async (e) => {
904
+ ), Qo = async (e) => {
905
905
  if (k)
906
906
  try {
907
907
  const t = (await S.request(
908
908
  re(`/items/${a}`, {
909
909
  filter: JSON.stringify({ [f]: { _eq: e } }),
910
- limit: Ti
910
+ limit: Li
911
911
  })
912
912
  )).data ?? [];
913
913
  for (const r of t) {
914
914
  const i = {};
915
915
  for (const [o, c] of Object.entries(r))
916
- !Jo.has(o) && c != null && typeof c != "object" && (i[o] = c);
916
+ !zo.has(o) && c != null && typeof c != "object" && (i[o] = c);
917
917
  k.queueRow(a, f, sn(i));
918
918
  }
919
919
  Se.success(
920
920
  t.length > 0 ? `${t.length} line(s) copied in — they save with this record` : "That record has no lines on this table"
921
- ), Vi(!1);
921
+ ), Bi(!1);
922
922
  } catch {
923
923
  Se.error("Could not copy lines");
924
924
  }
925
- }, dt = E && !O ? `?parent_collection=${encodeURIComponent(E)}&parent_id=${encodeURIComponent(v)}` : "", [Ie, kn] = U(null), [Qo, Jr] = U(null), [Bi, sr] = U(!1), [Fo, Hi] = U(!1), { data: Vo = [], isLoading: Bo } = Fe({
925
+ }, dt = E && !O ? `?parent_collection=${encodeURIComponent(E)}&parent_id=${encodeURIComponent(v)}` : "", [Ie, kn] = U(null), [Fo, zr] = U(null), [Hi, or] = U(!1), [Vo, Yi] = U(!1), { data: Bo = [], isLoading: Ho } = Fe({
926
926
  queryKey: ["o2m-row-revisions", a, Ie == null ? void 0 : Ie.id],
927
927
  queryFn: () => S.request(
928
928
  re("/revisions", { collection: a, item: String(Ie == null ? void 0 : Ie.id) })
929
929
  ).then((e) => e.data ?? []),
930
930
  enabled: !!(Ie != null && Ie.id),
931
931
  staleTime: 15e3
932
- }), { data: Jt, isLoading: Ho } = Fe({
932
+ }), { data: Jt, isLoading: Yo } = Fe({
933
933
  queryKey: ["o2m-field-snapshots", a, f, v],
934
934
  queryFn: () => S.request(
935
935
  re("/revisions/o2m-snapshots", {
@@ -938,9 +938,9 @@ function Pd({
938
938
  parent_id: v
939
939
  })
940
940
  ),
941
- enabled: Bi && !O,
941
+ enabled: Hi && !O,
942
942
  staleTime: 15e3
943
- }), Yo = T(
943
+ }), Go = T(
944
944
  () => ((Jt == null ? void 0 : Jt.data) ?? []).map((e) => ({
945
945
  id: e.revision_id,
946
946
  delta: e.delta ?? null,
@@ -955,8 +955,8 @@ function Pd({
955
955
  })),
956
956
  [Jt]
957
957
  );
958
- async function Go(e) {
959
- Hi(!0);
958
+ async function Xo(e) {
959
+ Yi(!0);
960
960
  try {
961
961
  const n = await S.request(
962
962
  Ke("/revisions/o2m-restore", {
@@ -965,13 +965,13 @@ function Pd({
965
965
  parent_id: v,
966
966
  target_timestamp: e
967
967
  })
968
- ), t = fl(n);
968
+ ), t = ml(n);
969
969
  t && Se.warning(t, { duration: 1e4 }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), V.invalidateQueries({
970
970
  queryKey: ["o2m-field-snapshots", a, f, v]
971
- }), sr(!1);
971
+ }), or(!1);
972
972
  } catch {
973
973
  } finally {
974
- Hi(!1);
974
+ Yi(!1);
975
975
  }
976
976
  }
977
977
  j && (te = !1);
@@ -980,19 +980,19 @@ function Pd({
980
980
  (L ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
981
981
  ),
982
982
  [L]
983
- ), [p, De] = U(null), Ge = xe(null), Yi = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${a}:${e}:${n}` : void 0, vt = xe(null), or = (e, n) => {
983
+ ), [p, De] = U(null), Ge = xe(null), Gi = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${a}:${e}:${n}` : void 0, vt = xe(null), ar = (e, n) => {
984
984
  !e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
985
- }, Xo = (e) => {
985
+ }, Co = (e) => {
986
986
  var t, r, i;
987
987
  const n = ((i = (r = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : r.call(t, "[data-grid-cell]")) == null ? void 0 : i.getAttribute("data-grid-cell")) ?? null;
988
- n !== vt.current && (vt.current && or(vt.current, "end"), vt.current = n, n && or(n, "start"));
989
- }, Co = (e) => {
988
+ n !== vt.current && (vt.current && ar(vt.current, "end"), vt.current = n, n && ar(n, "start"));
989
+ }, Zo = (e) => {
990
990
  var t, r;
991
- (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (vt.current && or(vt.current, "end"), vt.current = null);
991
+ (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (vt.current && ar(vt.current, "end"), vt.current = null);
992
992
  };
993
993
  $e(
994
994
  () => () => {
995
- vt.current && or(vt.current, "end");
995
+ vt.current && ar(vt.current, "end");
996
996
  },
997
997
  []
998
998
  );
@@ -1016,7 +1016,7 @@ function Pd({
1016
1016
  },
1017
1017
  []
1018
1018
  );
1019
- const zr = xe(0), ct = xe({
1019
+ const Qr = xe(0), ct = xe({
1020
1020
  rowId: null,
1021
1021
  seqs: /* @__PURE__ */ new Map()
1022
1022
  });
@@ -1040,10 +1040,10 @@ function Pd({
1040
1040
  };
1041
1041
  return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1042
1042
  }, [p, j]);
1043
- const [gt, Sn] = U(!1), [Gi, zt] = U(null), [$n, ar] = U(null), [Xi, Ci] = U(!1);
1044
- async function Zo() {
1043
+ const [ht, Sn] = U(!1), [Xi, zt] = U(null), [$n, lr] = U(null), [Ci, Zi] = U(!1);
1044
+ async function ea() {
1045
1045
  if (!$n) return;
1046
- Ci(!0);
1046
+ Zi(!0);
1047
1047
  const e = [];
1048
1048
  let n = "";
1049
1049
  for (const r of $n.groups) {
@@ -1052,37 +1052,37 @@ function Pd({
1052
1052
  try {
1053
1053
  await S.request(Ke(`/items/${r.collection}`, { ...o, [r.fkField]: r.rowId }));
1054
1054
  } catch (c) {
1055
- i.push(o), n || (n = Ao(c));
1055
+ i.push(o), n || (n = jo(c));
1056
1056
  }
1057
1057
  i.length && e.push({ ...r, members: i });
1058
1058
  }
1059
- Ci(!1), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
1059
+ Zi(!1), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
1060
1060
  const t = e.reduce((r, i) => r + i.members.length, 0);
1061
- ar(
1061
+ lr(
1062
1062
  t > 0 ? {
1063
1063
  text: `${t} ${e.map((r) => r.label).join(", ")} row${t === 1 ? "" : "s"} still did not save — ${n}`,
1064
1064
  groups: e
1065
1065
  } : null
1066
1066
  );
1067
1067
  }
1068
- const [lr, qn] = U(null), Le = _l(), [Qr, ea] = U(() => {
1068
+ const [dr, qn] = U(null), Le = _l(), [Fr, ta] = U(() => {
1069
1069
  var e;
1070
1070
  return pe === Hn ? Hn : pe && (Z != null && Z.some((n) => n.name === pe)) ? pe : (e = Z == null ? void 0 : Z[0]) == null ? void 0 : e.name;
1071
1071
  });
1072
- function Zi(e) {
1073
- ea(e);
1072
+ function es(e) {
1073
+ ta(e);
1074
1074
  }
1075
- const ut = xe(null), En = xe(!1), dr = (e) => {
1075
+ const ut = xe(null), En = xe(!1), cr = (e) => {
1076
1076
  const n = e;
1077
1077
  return !n || !(n instanceof HTMLElement) ? !1 : n.isConnected ? !!(n.closest("[data-o2m-editing]") || n.closest("[data-radix-popper-content-wrapper]") || n.closest("[data-nvr-combobox-panel]") || n.closest('[role="dialog"]') || n.closest("[data-omx-overlay]")) : !0;
1078
- }, { data: Fr } = Fe({
1078
+ }, { data: Vr } = Fe({
1079
1079
  queryKey: ["auto-table-layout", a],
1080
1080
  queryFn: () => S.request(
1081
1081
  re("/collection-layouts", { collection: a })
1082
1082
  ).then((e) => (e.data ?? []).find((n) => n.layout_type === "table") ?? null),
1083
1083
  enabled: !z,
1084
1084
  staleTime: 5 * 6e4
1085
- }), Qt = z ?? (Fr == null ? void 0 : Fr.id) ?? null, { data: ke = [], isLoading: es } = Fe({
1085
+ }), Qt = z ?? (Vr == null ? void 0 : Vr.id) ?? null, { data: ke = [], isLoading: ts } = Fe({
1086
1086
  queryKey: ["field-config", a, Qt],
1087
1087
  queryFn: () => S.request(
1088
1088
  re(
@@ -1098,14 +1098,14 @@ function Pd({
1098
1098
  return (n == null ? void 0 : n.relations) ?? [];
1099
1099
  }),
1100
1100
  staleTime: 10 * 6e4
1101
- }), { data: Vr } = Fe({
1101
+ }), { data: Br } = Fe({
1102
1102
  queryKey: ["layout-meta", Qt],
1103
1103
  queryFn: () => S.request(
1104
1104
  re(`/collection-layouts/${Qt}`)
1105
1105
  ).then((e) => e.data ?? {}),
1106
1106
  enabled: !!Qt,
1107
1107
  staleTime: 5 * 6e4
1108
- }), C = (Vr == null ? void 0 : Vr.row_order_field) ?? null, cr = T(() => {
1108
+ }), C = (Br == null ? void 0 : Br.row_order_field) ?? null, ur = T(() => {
1109
1109
  if (!de || Object.keys(de).length === 0) return null;
1110
1110
  const e = {};
1111
1111
  for (const [n, t] of Object.entries(de))
@@ -1113,35 +1113,35 @@ function Pd({
1113
1113
  return e;
1114
1114
  }, [de]), Ft = T(
1115
1115
  () => Object.fromEntries(
1116
- Object.entries(he ?? {}).filter(
1116
+ Object.entries(ge ?? {}).filter(
1117
1117
  ([, e]) => e === null || ["string", "number", "boolean"].includes(typeof e)
1118
1118
  )
1119
1119
  ),
1120
- [he]
1120
+ [ge]
1121
1121
  ), {
1122
1122
  data: Xe = [],
1123
1123
  isLoading: nn,
1124
- dataUpdatedAt: ur
1124
+ dataUpdatedAt: fr
1125
1125
  } = Fe({
1126
1126
  queryKey: [
1127
1127
  "o2m-rows",
1128
1128
  a,
1129
1129
  f,
1130
1130
  v,
1131
- cr ? JSON.stringify(cr) : ""
1131
+ ur ? JSON.stringify(ur) : ""
1132
1132
  ],
1133
1133
  queryFn: () => S.request(
1134
1134
  re(`/items/${a}`, {
1135
1135
  filter: JSON.stringify(
1136
- cr ? { _and: [{ [f]: { _eq: v } }, cr] } : { [f]: { _eq: v } }
1136
+ ur ? { _and: [{ [f]: { _eq: v } }, ur] } : { [f]: { _eq: v } }
1137
1137
  ),
1138
1138
  limit: 200
1139
1139
  })
1140
1140
  ).then((e) => e.data ?? []),
1141
1141
  enabled: !O,
1142
1142
  staleTime: 3e4
1143
- }), ta = ll(2e3), { data: rn } = Fe({
1144
- queryKey: ["o2m-cell-provenance", a, f, v, ur],
1143
+ }), na = dl(2e3), { data: rn } = Fe({
1144
+ queryKey: ["o2m-cell-provenance", a, f, v, fr],
1145
1145
  queryFn: () => S.request(
1146
1146
  re("/revisions/o2m-cell-provenance", {
1147
1147
  collection: a,
@@ -1149,16 +1149,16 @@ function Pd({
1149
1149
  parent_id: v
1150
1150
  })
1151
1151
  ).then((e) => ({ data: e.data ?? {}, created: e.created ?? {} })),
1152
- enabled: ta && !!W && !O && Xe.length > 0,
1152
+ enabled: na && !!W && !O && Xe.length > 0,
1153
1153
  staleTime: 6e4,
1154
1154
  placeholderData: (e) => e
1155
- }), na = !!(Te != null && Te.enabled) && typeof (Te == null ? void 0 : Te.field) == "string", { data: rt } = Fe({
1155
+ }), ra = !!(Te != null && Te.enabled) && typeof (Te == null ? void 0 : Te.field) == "string", { data: rt } = Fe({
1156
1156
  queryKey: [
1157
1157
  "line-aging",
1158
1158
  E ?? "",
1159
1159
  P ?? f,
1160
1160
  v,
1161
- ur
1161
+ fr
1162
1162
  ],
1163
1163
  queryFn: () => S.request(
1164
1164
  re("/sla/line-aging", {
@@ -1167,18 +1167,18 @@ function Pd({
1167
1167
  parent_id: v
1168
1168
  })
1169
1169
  ).then((e) => e.data ?? null),
1170
- enabled: na && !O && !!E,
1170
+ enabled: ra && !O && !!E,
1171
1171
  staleTime: 6e4,
1172
1172
  placeholderData: (e) => e
1173
- }), ts = T(
1173
+ }), ns = T(
1174
1174
  () => new Set(rt != null && rt.overdue ? rt.overdue_ids : []),
1175
1175
  [rt]
1176
- ), ns = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, Br = (rn == null ? void 0 : rn.data) ?? {}, ra = (rn == null ? void 0 : rn.created) ?? {}, fr = (e) => {
1177
- const n = ra[e];
1176
+ ), rs = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, Hr = (rn == null ? void 0 : rn.data) ?? {}, ia = (rn == null ? void 0 : rn.created) ?? {}, mr = (e) => {
1177
+ const n = ia[e];
1178
1178
  if (!n) return null;
1179
1179
  const t = Dl(n.comment);
1180
- return t ? `From ${t.template} · ${ko(n.at)} by ${n.who}` : null;
1181
- }, On = je ?? [], rs = Zt({
1180
+ return t ? `From ${t.template} · ${No(n.at)} by ${n.who}` : null;
1181
+ }, On = je ?? [], is = Zt({
1182
1182
  queries: On.map((e) => ({
1183
1183
  queryKey: [
1184
1184
  "resolve-cascade",
@@ -1202,7 +1202,7 @@ function Pd({
1202
1202
  const e = {};
1203
1203
  return !N || !On.length || On.forEach((n, t) => {
1204
1204
  var o;
1205
- const r = (o = rs[t]) == null ? void 0 : o.data;
1205
+ const r = (o = is[t]) == null ? void 0 : o.data;
1206
1206
  if (!r || r.type === "none") return;
1207
1207
  const i = N.draft[n.parent_field];
1208
1208
  i == null || i === "" || (r.type === "direct_fk" ? e[n.child_field] = { [r.filter_column]: { _eq: i } } : r.type === "m2m_junction" && (e[n.child_field] = {
@@ -1214,20 +1214,20 @@ function Pd({
1214
1214
  }
1215
1215
  }));
1216
1216
  }), e;
1217
- }, [On, rs, N]), K = J === "pending", M = k ? k.getPendingRows(a, f) : [], H = K && k ? k.getPendingEdits(a, f) : /* @__PURE__ */ new Map(), [mr, pr] = U({});
1217
+ }, [On, is, N]), K = J === "pending", M = k ? k.getPendingRows(a, f) : [], H = K && k ? k.getPendingEdits(a, f) : /* @__PURE__ */ new Map(), [pr, hr] = U({});
1218
1218
  $e(() => {
1219
- Ge.current || pr({});
1220
- }, [ur]);
1221
- const Je = K && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(), Hr = T(
1219
+ Ge.current || hr({});
1220
+ }, [fr]);
1221
+ const Je = K && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(), Yr = T(
1222
1222
  () => new Map(
1223
1223
  ke.filter((e) => e.computed_type === "write" && !!e.computed_formula).map((e) => [e.field, String(e.computed_formula)])
1224
1224
  ),
1225
1225
  [ke]
1226
- ), is = T(
1226
+ ), ss = T(
1227
1227
  () => ke.filter((e) => e.interface === "relation-path" && e.field.includes(".")).map((e) => e.field),
1228
1228
  [ke]
1229
- ), ss = T(() => ke.filter((e) => e.interface === "match-agg-column"), [ke]), Yr = T(
1230
- () => ss.map((e) => {
1229
+ ), os = T(() => ke.filter((e) => e.interface === "match-agg-column"), [ke]), Gr = T(
1230
+ () => os.map((e) => {
1231
1231
  const n = e.options ? typeof e.options == "string" ? (() => {
1232
1232
  try {
1233
1233
  return JSON.parse(e.options);
@@ -1241,7 +1241,7 @@ function Pd({
1241
1241
  i.push([c, u.slice(5)]);
1242
1242
  continue;
1243
1243
  }
1244
- const d = Ri(u, {}, v, N == null ? void 0 : N.draft);
1244
+ const d = Pi(u, {}, v, N == null ? void 0 : N.draft);
1245
1245
  if (d == null || d === "") {
1246
1246
  o = !0;
1247
1247
  continue;
@@ -1253,9 +1253,9 @@ function Pd({
1253
1253
  const l = typeof d == "object" && !Array.isArray(d) ? d : { _eq: d };
1254
1254
  if (c.includes(".")) {
1255
1255
  const m = c.split(".");
1256
- let g = l;
1257
- for (let b = m.length - 1; b >= 1; b--) g = { [m[b]]: g };
1258
- r[m[0]] = g;
1256
+ let h = l;
1257
+ for (let b = m.length - 1; b >= 1; b--) h = { [m[b]]: h };
1258
+ r[m[0]] = h;
1259
1259
  } else
1260
1260
  r[c] = l;
1261
1261
  }
@@ -1271,9 +1271,9 @@ function Pd({
1271
1271
  format: n.format ?? null
1272
1272
  };
1273
1273
  }),
1274
- [ss, v, N == null ? void 0 : N.draft]
1275
- ), os = Zt({
1276
- queries: Yr.map((e) => ({
1274
+ [os, v, N == null ? void 0 : N.draft]
1275
+ ), as = Zt({
1276
+ queries: Gr.map((e) => ({
1277
1277
  queryKey: [
1278
1278
  "match-agg",
1279
1279
  e.collection,
@@ -1295,18 +1295,18 @@ function Pd({
1295
1295
  enabled: !e.unresolved && !!e.collection && !O,
1296
1296
  staleTime: 3e4
1297
1297
  }))
1298
- }), ia = T(() => {
1298
+ }), sa = T(() => {
1299
1299
  const e = /* @__PURE__ */ new Map();
1300
- return Yr.forEach((n, t) => {
1300
+ return Gr.forEach((n, t) => {
1301
1301
  var r;
1302
1302
  e.set(n.field, {
1303
1303
  cfg: n,
1304
- rows: ((r = os[t]) == null ? void 0 : r.data) ?? []
1304
+ rows: ((r = as[t]) == null ? void 0 : r.data) ?? []
1305
1305
  });
1306
1306
  }), e;
1307
- }, [Yr, os]), as = T(() => ke.filter((e) => e.interface === "formula-column"), [ke]), ls = T(() => {
1307
+ }, [Gr, as]), ls = T(() => ke.filter((e) => e.interface === "formula-column"), [ke]), ds = T(() => {
1308
1308
  const e = /* @__PURE__ */ new Set();
1309
- for (const n of as) {
1309
+ for (const n of ls) {
1310
1310
  const t = n.options ? typeof n.options == "string" ? (() => {
1311
1311
  try {
1312
1312
  return JSON.parse(n.options);
@@ -1318,11 +1318,11 @@ function Pd({
1318
1318
  i[1].includes(".") && e.add(i[1]);
1319
1319
  }
1320
1320
  return [...e];
1321
- }, [as]), Gr = T(() => {
1322
- const e = new Set(is);
1323
- for (const n of ls) e.add(n);
1324
- return ge != null && ge.includes(".") && e.add(ge), [...e];
1325
- }, [is, ls, ge]), sa = M.map((e) => String(e.id ?? "")).join(","), Xr = T(() => {
1321
+ }, [ls]), Xr = T(() => {
1322
+ const e = new Set(ss);
1323
+ for (const n of ds) e.add(n);
1324
+ return he != null && he.includes(".") && e.add(he), [...e];
1325
+ }, [ss, ds, he]), oa = M.map((e) => String(e.id ?? "")).join(","), Cr = T(() => {
1326
1326
  const e = /* @__PURE__ */ new Set(), n = (t) => {
1327
1327
  const r = t == null ? "" : String(t);
1328
1328
  r && !r.startsWith("pending:") && r !== "new" && e.add(r);
@@ -1334,22 +1334,22 @@ function Pd({
1334
1334
  for (const r of (t == null ? void 0 : t.rows) ?? []) n(r.id);
1335
1335
  }
1336
1336
  return [...e];
1337
- }, [Xe, sa, Le, me]), { data: Ae } = Fe({
1337
+ }, [Xe, oa, Le, me]), { data: Ae } = Fe({
1338
1338
  queryKey: [
1339
1339
  "o2m-resolve-paths",
1340
1340
  a,
1341
1341
  f,
1342
1342
  v,
1343
- Gr.join(","),
1344
- Xr.join(",")
1343
+ Xr.join(","),
1344
+ Cr.join(",")
1345
1345
  ],
1346
1346
  queryFn: () => S.request(
1347
1347
  re(`/items/${a}/resolve-paths`, {
1348
- ids: Xr.join(","),
1349
- paths: Gr.join(",")
1348
+ ids: Cr.join(","),
1349
+ paths: Xr.join(",")
1350
1350
  })
1351
1351
  ).then((e) => e.data ?? { rows: {}, targets: {} }),
1352
- enabled: Gr.length > 0 && Xr.length > 0,
1352
+ enabled: Xr.length > 0 && Cr.length > 0,
1353
1353
  staleTime: 3e4
1354
1354
  }), ft = T(() => {
1355
1355
  if (!Ae) return;
@@ -1372,8 +1372,8 @@ function Pd({
1372
1372
  const r = K ? H.get(String(n.id)) : void 0, i = K ? H.get(String(t.id)) : void 0, o = (r == null ? void 0 : r[ie]) ?? n[ie], c = (i == null ? void 0 : i[ie]) ?? t[ie];
1373
1373
  let u = 0;
1374
1374
  return o == null && c == null ? u = 0 : o == null ? u = 1 : c == null ? u = -1 : typeof o == "number" && typeof c == "number" ? u = o - c : u = String(o).localeCompare(String(c), void 0, { sensitivity: "base" }), Oe === "desc" ? -u : u;
1375
- })), ge && ft) {
1376
- const n = (t) => String(t[ge] ?? "").trim();
1375
+ })), he && ft) {
1376
+ const n = (t) => String(t[he] ?? "").trim();
1377
1377
  e = [...e].sort((t, r) => {
1378
1378
  const i = n(t), o = n(r);
1379
1379
  return i === o ? 0 : i ? o ? i.localeCompare(o, void 0, { sensitivity: "base" }) : -1 : 1;
@@ -1388,8 +1388,8 @@ function Pd({
1388
1388
  H,
1389
1389
  ie,
1390
1390
  Oe,
1391
- ge
1392
- ]), ds = !!ge && !!ft, gr = ge ? `nvr_grid_sections:${a}:${P ?? f}` : null, [cs, oa] = U(() => {
1391
+ he
1392
+ ]), cs = !!he && !!ft, gr = he ? `nvr_grid_sections:${a}:${P ?? f}` : null, [us, aa] = U(() => {
1393
1393
  if (!gr || typeof localStorage > "u") return /* @__PURE__ */ new Set();
1394
1394
  try {
1395
1395
  const e = localStorage.getItem(gr), n = e ? JSON.parse(e) : null;
@@ -1397,7 +1397,7 @@ function Pd({
1397
1397
  } catch {
1398
1398
  return /* @__PURE__ */ new Set();
1399
1399
  }
1400
- }), In = (e) => String(e[ge ?? ""] ?? "").trim() || "Uncategorized", aa = (e) => oa((n) => {
1400
+ }), In = (e) => String(e[he ?? ""] ?? "").trim() || "Uncategorized", la = (e) => aa((n) => {
1401
1401
  const t = new Set(n);
1402
1402
  if (t.has(e) ? t.delete(e) : t.add(e), gr)
1403
1403
  try {
@@ -1405,10 +1405,10 @@ function Pd({
1405
1405
  } catch {
1406
1406
  }
1407
1407
  return t;
1408
- }), la = (e) => {
1408
+ }), da = (e) => {
1409
1409
  const n = [];
1410
1410
  for (const t of Re) {
1411
- const r = No(t.options) ?? {}, i = r.aggregate;
1411
+ const r = So(t.options) ?? {}, i = r.aggregate;
1412
1412
  if (!i || t.interface === "formula-column" || t.interface === "match-agg-column") continue;
1413
1413
  const o = e.map((d) => {
1414
1414
  const l = String(d.id), m = H.has(l) ? { ...d, ...H.get(l) } : d;
@@ -1426,31 +1426,31 @@ function Pd({
1426
1426
  n.push({ label: t.label || qe(t.field), text: u });
1427
1427
  }
1428
1428
  return n;
1429
- }, us = T(
1429
+ }, fs = T(
1430
1430
  () => ke.filter(
1431
1431
  (e) => e.computed_type === "write" && typeof e.computed_formula == "string" && e.computed_formula.trim()
1432
1432
  ),
1433
1433
  [ke]
1434
1434
  );
1435
1435
  function ce(e, n) {
1436
- if (!us.length) return e;
1437
- const t = n === void 0 ? fs(e.id) : n, r = { ...e };
1438
- for (const i of us) {
1436
+ if (!fs.length) return e;
1437
+ const t = n === void 0 ? ms(e.id) : n, r = { ...e };
1438
+ for (const i of fs) {
1439
1439
  const o = i.computed_formula;
1440
- if (t && !gl(o, r, t)) continue;
1440
+ if (t && !hl(o, r, t)) continue;
1441
1441
  const c = Rt(o, r);
1442
1442
  c !== null && (r[i.field] = c);
1443
1443
  }
1444
1444
  return r;
1445
1445
  }
1446
- function fs(e) {
1446
+ function ms(e) {
1447
1447
  if (e == null || e === "") return;
1448
1448
  const n = String(e);
1449
1449
  if (!(n.startsWith("pending:") || n === "new"))
1450
1450
  return $.find((t) => String(t.id) === n);
1451
1451
  }
1452
- const da = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), An = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
1453
- function Cr(e) {
1452
+ const ca = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), An = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
1453
+ function Zr(e) {
1454
1454
  const n = We.find(
1455
1455
  (r) => r.one_collection === a && (r.one_field === e.field || r.junction_field != null && r.many_collection === e.field)
1456
1456
  );
@@ -1465,7 +1465,7 @@ function Pd({
1465
1465
  junctionOtherField: t.many_field
1466
1466
  };
1467
1467
  }
1468
- const Zr = JSON.stringify([...H.entries()]) + "|" + [...Je].sort().join(",") + "|" + JSON.stringify(M), sn = (e, n = []) => {
1468
+ const ei = JSON.stringify([...H.entries()]) + "|" + [...Je].sort().join(",") + "|" + JSON.stringify(M), sn = (e, n = []) => {
1469
1469
  var o;
1470
1470
  if (!C) return e;
1471
1471
  const t = new Set(n);
@@ -1490,7 +1490,7 @@ function Pd({
1490
1490
  const r = sn(t, n);
1491
1491
  return C && n.push(Number(r[C])), r;
1492
1492
  });
1493
- }, ei = T(() => {
1493
+ }, ti = T(() => {
1494
1494
  const e = [
1495
1495
  ...($ ?? []).filter((n) => !Je.has(String(n.id))).map((n) => {
1496
1496
  const t = String(n.id), r = H.has(t) ? { ...n, ...H.get(t) } : n;
@@ -1503,16 +1503,16 @@ function Pd({
1503
1503
  r >= 0 && r < e.length && (e[r] = n);
1504
1504
  }
1505
1505
  return e;
1506
- }, [$, Zr, p]), jn = T(() => {
1507
- if (Le === "original") return ei;
1506
+ }, [$, ei, p]), jn = T(() => {
1507
+ if (Le === "original") return ti;
1508
1508
  const e = me.find((n) => n.addendumId === Le);
1509
1509
  return e ? e.rows.map(
1510
1510
  (n) => ce(
1511
1511
  { ...n },
1512
1512
  e.baseRows ? n : void 0
1513
1513
  )
1514
- ) : ei;
1515
- }, [Le, me, ei]), ms = Xe.length >= Ti, wt = N == null ? void 0 : N.draft, Vt = Mt(
1514
+ ) : ti;
1515
+ }, [Le, me, ti]), ps = Xe.length >= Li, wt = N == null ? void 0 : N.draft, Vt = Mt(
1516
1516
  (e) => {
1517
1517
  if (e.startsWith("$parent."))
1518
1518
  return (wt == null ? void 0 : wt[e.slice(8)]) ?? 0;
@@ -1523,19 +1523,19 @@ function Pd({
1523
1523
  return e === "$count" ? jn.length : wt == null ? void 0 : wt[e];
1524
1524
  },
1525
1525
  [wt, jn]
1526
- ), ti = T(() => Ze != null && Ze.length ? Ze.map((e) => ({ ...e, result: pt(e.value, Vt) })) : null, [Ze, Vt]), hr = T(
1526
+ ), ni = T(() => Ze != null && Ze.length ? Ze.map((e) => ({ ...e, result: pt(e.value, Vt) })) : null, [Ze, Vt]), br = T(
1527
1527
  () => Pe != null && Pe.endpoint ? kl(Pe.endpoint, wt) : null,
1528
1528
  [Pe == null ? void 0 : Pe.endpoint, wt]
1529
- ), ni = Nl({
1529
+ ), ri = Nl({
1530
1530
  client: S,
1531
- endpoint: hr,
1531
+ endpoint: br,
1532
1532
  enabled: !!Pe && !O
1533
- }), q = Pe && !O ? ni.data ?? null : null, ps = !!Pe && !O && !!hr && ni.isLoading, gs = !!Pe && !O && ni.isError, br = Mt(
1533
+ }), q = Pe && !O ? ri.data ?? null : null, hs = !!Pe && !O && !!br && ri.isLoading, gs = !!Pe && !O && ri.isError, yr = Mt(
1534
1534
  (e) => e.label || qe(e.field),
1535
1535
  []
1536
- ), { isAdmin: ri } = al(), ii = Mt(
1537
- (e, n) => !!(q != null && q.closed_locked) && !ri && q.columns.includes(e) && Kt(q, n[q.key_field], e),
1538
- [q, ri]
1536
+ ), { isAdmin: ii } = ll(), si = Mt(
1537
+ (e, n) => !!(q != null && q.closed_locked) && !ii && q.columns.includes(e) && Kt(q, n[q.key_field], e),
1538
+ [q, ii]
1539
1539
  ), an = Mt(
1540
1540
  async (e, n, t) => {
1541
1541
  if (e.startsWith("pending:")) {
@@ -1560,26 +1560,26 @@ function Pd({
1560
1560
  yt(`/items/${a}/${e}`, { ...n, _change_reason: t })
1561
1561
  ), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
1562
1562
  } catch (r) {
1563
- Se.error(`Could not save: ${(r == null ? void 0 : r.message) ?? "unknown error"}`);
1563
+ Se.error(`Could not save: ${Gn(r, "unknown error")}`);
1564
1564
  }
1565
1565
  },
1566
1566
  // eslint-disable-next-line react-hooks/exhaustive-deps
1567
1567
  [M, k, K, a, f, S, V, v]
1568
- ), Tn = hr ? `nvr_compare_dismiss:${hr}` : null, [hs, ca] = U(() => {
1568
+ ), Tn = br ? `nvr_compare_dismiss:${br}` : null, [bs, ua] = U(() => {
1569
1569
  try {
1570
1570
  return !Tn || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(Tn) ?? "[]"));
1571
1571
  } catch {
1572
1572
  return /* @__PURE__ */ new Set();
1573
1573
  }
1574
- }), bs = T(
1574
+ }), ys = T(
1575
1575
  // `add` proposals need the plan grid's per-period arithmetic; the flat grid only fills.
1576
1576
  () => ((q == null ? void 0 : q.proposals) ?? []).filter(
1577
- (e) => e.mode !== "add" && !hs.has(e.id)
1577
+ (e) => e.mode !== "add" && !bs.has(e.id)
1578
1578
  ),
1579
- [q == null ? void 0 : q.proposals, hs]
1580
- ), si = Mt(
1579
+ [q == null ? void 0 : q.proposals, bs]
1580
+ ), oi = Mt(
1581
1581
  (e, n = !0) => {
1582
- ca((t) => {
1582
+ ua((t) => {
1583
1583
  const r = new Set(t);
1584
1584
  r.add(e.id);
1585
1585
  try {
@@ -1590,7 +1590,7 @@ function Pd({
1590
1590
  });
1591
1591
  },
1592
1592
  [Tn]
1593
- ), ua = Mt(
1593
+ ), fa = Mt(
1594
1594
  (e) => {
1595
1595
  if (!q) return;
1596
1596
  const n = q.key_field, t = e.change_reason ?? e.label, r = (c) => c == null || c === "" || Number(c) === 0;
@@ -1598,9 +1598,9 @@ function Pd({
1598
1598
  const o = (k == null ? void 0 : k.getPendingEdits(a, f)) ?? /* @__PURE__ */ new Map();
1599
1599
  for (const c of e.rows) {
1600
1600
  if (c.category != null) continue;
1601
- const u = $.find((g) => String(g[n]) === String(c.key)), d = M.findIndex((g) => String(g[n]) === String(c.key)), l = u ? { ...u, ...o.get(String(u.id)) ?? {} } : d >= 0 ? M[d] : null, m = {};
1602
- for (const [g, b] of Object.entries(c.values))
1603
- Kt(q, c.key, g) || l && !r(l[g]) || (m[g] = b);
1601
+ const u = $.find((h) => String(h[n]) === String(c.key)), d = M.findIndex((h) => String(h[n]) === String(c.key)), l = u ? { ...u, ...o.get(String(u.id)) ?? {} } : d >= 0 ? M[d] : null, m = {};
1602
+ for (const [h, b] of Object.entries(c.values))
1603
+ Kt(q, c.key, h) || l && !r(l[h]) || (m[h] = b);
1604
1604
  Object.keys(m).length !== 0 && (i++, u ? an(String(u.id), m, t) : d >= 0 ? an(`pending:${d}`, m, t) : k && k.queueRow(
1605
1605
  a,
1606
1606
  f,
@@ -1609,7 +1609,7 @@ function Pd({
1609
1609
  }
1610
1610
  Se.success(
1611
1611
  i ? `${e.label}: staged on ${i} ${i === 1 ? "row" : "rows"} — save to keep it` : "Nothing to apply — every suggested cell is already filled or closed"
1612
- ), si(e, !1);
1612
+ ), oi(e, !1);
1613
1613
  },
1614
1614
  // eslint-disable-next-line react-hooks/exhaustive-deps
1615
1615
  [
@@ -1620,12 +1620,12 @@ function Pd({
1620
1620
  a,
1621
1621
  f,
1622
1622
  an,
1623
- si
1623
+ oi
1624
1624
  ]
1625
- ), fa = Mt(
1625
+ ), ma = Mt(
1626
1626
  (e) => {
1627
- var h;
1628
- if (!((h = be == null ? void 0 : be.fields) != null && h.length)) return;
1627
+ var g;
1628
+ if (!((g = be == null ? void 0 : be.fields) != null && g.length)) return;
1629
1629
  const n = pt(be.remaining, Vt), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
1630
1630
  if (t <= 0) return;
1631
1631
  const r = be.only_empty !== !1, i = (w) => w == null || w === "" || Number(w) === 0, o = (k == null ? void 0 : k.getPendingEdits(a, f)) ?? /* @__PURE__ */ new Map(), c = (k == null ? void 0 : k.getPendingDeletes(a, f)) ?? /* @__PURE__ */ new Set(), u = q == null ? void 0 : q.key_field, d = [];
@@ -1642,7 +1642,7 @@ function Pd({
1642
1642
  Se.message("Nothing to spread into — every target is filled or closed");
1643
1643
  return;
1644
1644
  }
1645
- const g = Ko(
1645
+ const h = Ro(
1646
1646
  t,
1647
1647
  l.length,
1648
1648
  e === "shape" ? "even" : e,
@@ -1650,7 +1650,7 @@ function Pd({
1650
1650
  ), b = /* @__PURE__ */ new Map();
1651
1651
  l.forEach((w, y) => {
1652
1652
  const x = b.get(w.id) ?? {};
1653
- x[w.field] = g[y], b.set(w.id, x);
1653
+ x[w.field] = h[y], b.set(w.id, x);
1654
1654
  });
1655
1655
  for (const [w, y] of b)
1656
1656
  an(
@@ -1659,7 +1659,7 @@ function Pd({
1659
1659
  `${be.label ?? "Spread remaining"} across ${b.size} rows`
1660
1660
  );
1661
1661
  Se.success(
1662
- `Spread ${qi(t)} over ${l.length} cells on ${b.size} ${b.size === 1 ? "row" : "rows"}`
1662
+ `Spread ${Ei(t)} over ${l.length} cells on ${b.size} ${b.size === 1 ? "row" : "rows"}`
1663
1663
  );
1664
1664
  },
1665
1665
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1677,16 +1677,16 @@ function Pd({
1677
1677
  ), Bt = wn == null ? void 0 : wn.report;
1678
1678
  $e(() => {
1679
1679
  if (Bt) {
1680
- if (ms || nn) {
1680
+ if (ps || nn) {
1681
1681
  Bt(a, f, null);
1682
1682
  return;
1683
1683
  }
1684
1684
  Bt(a, f, jn);
1685
1685
  }
1686
- }, [Bt, a, f, jn, ms, nn]);
1687
- const ys = xe(() => {
1686
+ }, [Bt, a, f, jn, ps, nn]);
1687
+ const xs = xe(() => {
1688
1688
  });
1689
- ys.current = () => Bt == null ? void 0 : Bt(a, f, null), $e(() => () => ys.current(), []);
1689
+ xs.current = () => Bt == null ? void 0 : Bt(a, f, null), $e(() => () => xs.current(), []);
1690
1690
  const Ln = T(() => {
1691
1691
  const e = /* @__PURE__ */ new Map();
1692
1692
  for (const n of ke) {
@@ -1704,7 +1704,7 @@ function Pd({
1704
1704
  i.length && e.set(n.field, i);
1705
1705
  }
1706
1706
  return e;
1707
- }, [ke]), xs = T(() => {
1707
+ }, [ke]), vs = T(() => {
1708
1708
  var n;
1709
1709
  const e = [];
1710
1710
  for (const t of je ?? []) {
@@ -1718,10 +1718,10 @@ function Pd({
1718
1718
  );
1719
1719
  }
1720
1720
  return e;
1721
- }, [je]), ma = T(() => {
1721
+ }, [je]), pa = T(() => {
1722
1722
  var n, t;
1723
1723
  const e = /* @__PURE__ */ new Map();
1724
- for (const r of [...Ln.values(), xs])
1724
+ for (const r of [...Ln.values(), vs])
1725
1725
  for (const i of r) {
1726
1726
  const o = (n = N == null ? void 0 : N.draft) == null ? void 0 : n[i.parent_field];
1727
1727
  if (o == null || o === "" || typeof o == "object") continue;
@@ -1733,43 +1733,43 @@ function Pd({
1733
1733
  }), (t = e.get(c)) == null || t.fields.add(i.source_field);
1734
1734
  }
1735
1735
  return [...e.entries()];
1736
- }, [Ln, xs, N == null ? void 0 : N.draft]), vs = Zt({
1737
- queries: ma.map(([e, n]) => ({
1736
+ }, [Ln, vs, N == null ? void 0 : N.draft]), ws = Zt({
1737
+ queries: pa.map(([e, n]) => ({
1738
1738
  queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
1739
1739
  queryFn: () => we(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
1740
1740
  staleTime: 6e4
1741
1741
  }))
1742
- }), yr = T(() => {
1742
+ }), xr = T(() => {
1743
1743
  const e = /* @__PURE__ */ new Map();
1744
- for (const n of vs) n.data && e.set(n.data[0], n.data[1]);
1744
+ for (const n of ws) n.data && e.set(n.data[0], n.data[1]);
1745
1745
  return e;
1746
- }, [vs]), ws = (e, n) => {
1746
+ }, [ws]), _s = (e, n) => {
1747
1747
  var t, r, i;
1748
1748
  for (const o of e) {
1749
1749
  if ((t = o.when) != null && t.field) {
1750
- const l = o.when.field.startsWith("$parent.") ? (r = N == null ? void 0 : N.draft) == null ? void 0 : r[o.when.field.slice(8)] : n[o.when.field], m = o.when.op ?? "eq", g = o.when.value, b = l == null ? "" : String(l);
1751
- if (!(m === "nnull" ? b !== "" : m === "null" ? b === "" : m === "neq" ? b !== String(g ?? "") : m === "in" ? (Array.isArray(g) ? g.map(String) : String(g ?? "").split(",").map((w) => w.trim())).includes(b) : b === String(g ?? ""))) continue;
1750
+ const l = o.when.field.startsWith("$parent.") ? (r = N == null ? void 0 : N.draft) == null ? void 0 : r[o.when.field.slice(8)] : n[o.when.field], m = o.when.op ?? "eq", h = o.when.value, b = l == null ? "" : String(l);
1751
+ if (!(m === "nnull" ? b !== "" : m === "null" ? b === "" : m === "neq" ? b !== String(h ?? "") : m === "in" ? (Array.isArray(h) ? h.map(String) : String(h ?? "").split(",").map((w) => w.trim())).includes(b) : b === String(h ?? ""))) continue;
1752
1752
  }
1753
1753
  const c = (i = N == null ? void 0 : N.draft) == null ? void 0 : i[o.parent_field];
1754
1754
  if (c == null || c === "") continue;
1755
- const u = yr.get(`${o.parent_collection}|${String(c)}`), d = u == null ? void 0 : u[o.source_field];
1755
+ const u = xr.get(`${o.parent_collection}|${String(c)}`), d = u == null ? void 0 : u[o.source_field];
1756
1756
  if (!(d == null || d === ""))
1757
1757
  return { id: d, tag: o.tag ?? "Default" };
1758
1758
  }
1759
1759
  return null;
1760
1760
  }, Mn = (e, n) => {
1761
1761
  const t = Ln.get(e);
1762
- return t ? ws(t, n) : null;
1762
+ return t ? _s(t, n) : null;
1763
1763
  }, Ne = ke.filter(
1764
- (e) => !e.hidden && (!Ki.has(e.type) || An(e.interface)) && e.field !== f && e.field !== "id" && (!Qt || e.layout_assigned === !0) && !Mi.has(e.field) && !da.has(e.group_key ?? "")
1765
- ), _t = Z && Z.length >= 2 && Qr !== Hn ? Z.find((e) => e.name === Qr) : void 0, pa = new Set(
1764
+ (e) => !e.hidden && (!Ri.has(e.type) || An(e.interface)) && e.field !== f && e.field !== "id" && (!Qt || e.layout_assigned === !0) && !Ki.has(e.field) && !ca.has(e.group_key ?? "")
1765
+ ), _t = Z && Z.length >= 2 && Fr !== Hn ? Z.find((e) => e.name === Fr) : void 0, ha = new Set(
1766
1766
  (G ?? []).map((e) => typeof e == "string" ? e : e.field)
1767
- ), _s = _t ? new Set(
1767
+ ), ks = _t ? new Set(
1768
1768
  _t.columns.filter((e) => {
1769
1769
  const n = e.indexOf(".");
1770
- return n < 0 ? !0 : !pa.has(e.slice(0, n));
1770
+ return n < 0 ? !0 : !ha.has(e.slice(0, n));
1771
1771
  })
1772
- ) : null, ks = _s ? Ne.filter((e) => _s.has(e.field)) : [], ln = T(() => {
1772
+ ) : null, Ns = ks ? Ne.filter((e) => ks.has(e.field)) : [], ln = T(() => {
1773
1773
  if (!_t) return [];
1774
1774
  const e = [];
1775
1775
  for (const n of _t.columns) {
@@ -1803,13 +1803,13 @@ function Pd({
1803
1803
  )
1804
1804
  ],
1805
1805
  [kt]
1806
- ), Ns = Zt({
1806
+ ), Ss = Zt({
1807
1807
  queries: dn.map((e) => ({
1808
1808
  queryKey: ["field-config", e, null],
1809
1809
  queryFn: () => S.request(re(`/field-config/${e}`)).then((n) => n.data ?? []),
1810
1810
  staleTime: 6e4
1811
1811
  }))
1812
- }), Ss = Zt({
1812
+ }), $s = Zt({
1813
1813
  queries: dn.map((e) => ({
1814
1814
  queryKey: ["collection-meta", e],
1815
1815
  queryFn: () => S.request(re(`/collections/${e}`)).then((n) => {
@@ -1818,24 +1818,24 @@ function Pd({
1818
1818
  }),
1819
1819
  staleTime: 10 * 6e4
1820
1820
  }))
1821
- }), $s = T(() => {
1821
+ }), qs = T(() => {
1822
1822
  const e = /* @__PURE__ */ new Map();
1823
1823
  return dn.forEach((n, t) => {
1824
1824
  var r;
1825
- e.set(n, ((r = Ns[t]) == null ? void 0 : r.data) ?? []);
1825
+ e.set(n, ((r = Ss[t]) == null ? void 0 : r.data) ?? []);
1826
1826
  }), e;
1827
- }, [dn, Ns]), qs = T(() => {
1827
+ }, [dn, Ss]), Es = T(() => {
1828
1828
  const e = /* @__PURE__ */ new Map();
1829
1829
  return dn.forEach((n, t) => {
1830
1830
  var r;
1831
- e.set(n, ((r = Ss[t]) == null ? void 0 : r.data) ?? []);
1831
+ e.set(n, ((r = $s[t]) == null ? void 0 : r.data) ?? []);
1832
1832
  }), e;
1833
- }, [dn, Ss]), xr = T(() => {
1833
+ }, [dn, $s]), vr = T(() => {
1834
1834
  const e = /* @__PURE__ */ new Map();
1835
1835
  for (const n of Ht) {
1836
1836
  const t = kt.get(n);
1837
1837
  if (!t) continue;
1838
- const r = qs.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
1838
+ const r = Es.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
1839
1839
  for (const o of ln) {
1840
1840
  if (o.relationField !== n) continue;
1841
1841
  const c = r.find(
@@ -1846,10 +1846,10 @@ function Pd({
1846
1846
  e.set(n, i);
1847
1847
  }
1848
1848
  return e;
1849
- }, [Ht, kt, qs, ln]), vr = T(() => $.map((e) => String(e.id)), [$]), Kn = T(
1849
+ }, [Ht, kt, Es, ln]), wr = T(() => $.map((e) => String(e.id)), [$]), Kn = T(
1850
1850
  () => `nvr-gf-${Math.abs(Hl(`${a}:${P ?? f}`)) % 1e5}`,
1851
1851
  [a, P, f]
1852
- ), Es = T(() => {
1852
+ ), Os = T(() => {
1853
1853
  if (!X) return null;
1854
1854
  const e = [];
1855
1855
  te && (C || O || K) && e.push(24), A && e.push(32), (O || K) && e.push(80), e.push(220);
@@ -1871,9 +1871,9 @@ function Pd({
1871
1871
  O,
1872
1872
  K,
1873
1873
  A
1874
- ]), [cn, ga] = U(150), Os = xe(null);
1874
+ ]), [cn, ga] = U(150), Is = xe(null);
1875
1875
  $e(() => {
1876
- const e = Os.current;
1876
+ const e = Is.current;
1877
1877
  if (!e || $.length <= cn) return;
1878
1878
  const n = new IntersectionObserver(
1879
1879
  (t) => {
@@ -1883,11 +1883,11 @@ function Pd({
1883
1883
  );
1884
1884
  return n.observe(e), () => n.disconnect();
1885
1885
  }, [$.length, cn]);
1886
- const ha = vr.join(","), ba = Rl(
1886
+ const ba = wr.join(","), ya = Rl(
1887
1887
  a,
1888
- vr,
1888
+ wr,
1889
1889
  !!ne && !O
1890
- ), Is = Zt({
1890
+ ), As = Zt({
1891
1891
  queries: Ht.map((e) => {
1892
1892
  const n = kt.get(e);
1893
1893
  return {
@@ -1898,33 +1898,33 @@ function Pd({
1898
1898
  v,
1899
1899
  "summary-members",
1900
1900
  e,
1901
- ha
1901
+ ba
1902
1902
  ],
1903
1903
  queryFn: () => n ? S.request(
1904
1904
  re(`/items/${n.grandCollection}`, {
1905
- filter: JSON.stringify({ [n.fkField]: { _in: vr } }),
1905
+ filter: JSON.stringify({ [n.fkField]: { _in: wr } }),
1906
1906
  limit: 1e3
1907
1907
  })
1908
1908
  ).then((t) => t.data ?? []) : Promise.resolve([]),
1909
- enabled: !!n && vr.length > 0,
1909
+ enabled: !!n && wr.length > 0,
1910
1910
  staleTime: 3e4
1911
1911
  };
1912
1912
  })
1913
- }), wr = T(() => {
1913
+ }), _r = T(() => {
1914
1914
  const e = /* @__PURE__ */ new Map();
1915
1915
  return Ht.forEach((n, t) => {
1916
1916
  var o;
1917
1917
  const r = kt.get(n), i = /* @__PURE__ */ new Map();
1918
1918
  if (r)
1919
- for (const c of ((o = Is[t]) == null ? void 0 : o.data) ?? []) {
1919
+ for (const c of ((o = As[t]) == null ? void 0 : o.data) ?? []) {
1920
1920
  const u = String(c[r.fkField]);
1921
1921
  i.has(u) || i.set(u, []), i.get(u).push(c);
1922
1922
  }
1923
1923
  e.set(n, i);
1924
1924
  }), e;
1925
- }, [Ht, kt, Is]), As = Dt == null ? void 0 : Dt.report;
1925
+ }, [Ht, kt, As]), js = Dt == null ? void 0 : Dt.report;
1926
1926
  $e(() => {
1927
- if (!As || !G || G.length === 0) return;
1927
+ if (!js || !G || G.length === 0) return;
1928
1928
  const e = `${a}.${f}`, n = (r, i) => {
1929
1929
  const o = {};
1930
1930
  for (const [c, u] of Object.entries(r))
@@ -1941,35 +1941,35 @@ function Pd({
1941
1941
  const l = d[`__o2m_${i}`];
1942
1942
  if (!Array.isArray(l)) continue;
1943
1943
  const m = n(ce(d), c);
1944
- for (const g of l) u.created.push({ ...g, ...m });
1944
+ for (const h of l) u.created.push({ ...h, ...m });
1945
1945
  }
1946
1946
  for (const [d, l] of H) {
1947
1947
  const m = l[`__nested_ops_${i}`];
1948
1948
  if (!m) continue;
1949
- const g = $.find((h) => String(h.id) === d), b = n(
1950
- ce({ ...g ?? {}, ...l }),
1949
+ const h = $.find((g) => String(g.id) === d), b = n(
1950
+ ce({ ...h ?? {}, ...l }),
1951
1951
  c
1952
1952
  );
1953
- for (const h of m.created ?? []) u.created.push({ ...h, [c]: d, ...b });
1954
- for (const h of m.updated ?? []) u.updated.push({ id: h.id, values: h.changes });
1955
- for (const h of m.deleted ?? []) u.deleted.push(h);
1953
+ for (const g of m.created ?? []) u.created.push({ ...g, [c]: d, ...b });
1954
+ for (const g of m.updated ?? []) u.updated.push({ id: g.id, values: g.changes });
1955
+ for (const g of m.deleted ?? []) u.deleted.push(g);
1956
1956
  }
1957
1957
  if (Je.size > 0) {
1958
- const d = wr.get(i);
1958
+ const d = _r.get(i);
1959
1959
  for (const l of Je)
1960
1960
  for (const m of (d == null ? void 0 : d.get(String(l))) ?? [])
1961
1961
  m.id != null && u.deleted.push(m.id);
1962
1962
  }
1963
1963
  (u.created.length || u.updated.length || u.deleted.length) && (t[o.many_collection] = u);
1964
1964
  }
1965
- As(e, Object.keys(t).length > 0 ? t : null);
1965
+ js(e, Object.keys(t).length > 0 ? t : null);
1966
1966
  });
1967
- const oi = T(() => {
1967
+ const ai = T(() => {
1968
1968
  const e = /* @__PURE__ */ new Map(), n = (t, r) => {
1969
1969
  r == null || r === "" || (e.has(t) || e.set(t, []), e.get(t).push(String(r)));
1970
1970
  };
1971
- for (const [t, r] of wr) {
1972
- const i = xr.get(t);
1971
+ for (const [t, r] of _r) {
1972
+ const i = vr.get(t);
1973
1973
  if (!(!i || i.size === 0)) {
1974
1974
  for (const o of r.values())
1975
1975
  for (const c of o)
@@ -1989,7 +1989,7 @@ function Pd({
1989
1989
  for (const [d, l] of i)
1990
1990
  l.one_collection && n(l.one_collection, u[d]);
1991
1991
  }
1992
- for (const [o, c] of Object.entries(mr))
1992
+ for (const [o, c] of Object.entries(pr))
1993
1993
  if (o.endsWith(`|${t}`))
1994
1994
  for (const u of c)
1995
1995
  for (const [d, l] of i)
@@ -1998,16 +1998,16 @@ function Pd({
1998
1998
  }
1999
1999
  for (const [t, r] of e) e.set(t, [...new Set(r)].sort());
2000
2000
  return e;
2001
- }, [wr, xr, M, H, mr]), { data: js = {} } = Fe({
2001
+ }, [_r, vr, M, H, pr]), { data: Ts = {} } = Fe({
2002
2002
  queryKey: [
2003
2003
  "summary-m2o-display",
2004
2004
  a,
2005
- ...Array.from(oi.entries()).flat(2)
2005
+ ...Array.from(ai.entries()).flat(2)
2006
2006
  ],
2007
2007
  queryFn: async () => {
2008
2008
  const e = {};
2009
2009
  return await Promise.all(
2010
- [...oi.entries()].map(async ([n, t]) => {
2010
+ [...ai.entries()].map(async ([n, t]) => {
2011
2011
  var o;
2012
2012
  const [r, i] = await Promise.all([
2013
2013
  S.request(
@@ -2029,18 +2029,18 @@ function Pd({
2029
2029
  })
2030
2030
  ), e;
2031
2031
  },
2032
- enabled: oi.size > 0,
2032
+ enabled: ai.size > 0,
2033
2033
  staleTime: 6e4
2034
- }), { data: ai } = Fe({
2034
+ }), { data: li } = Fe({
2035
2035
  queryKey: ["collection-display-meta", a],
2036
2036
  queryFn: () => S.request(
2037
2037
  re(`/collections/${a}`)
2038
2038
  ).then((e) => e.data),
2039
2039
  enabled: !!a,
2040
2040
  staleTime: 10 * 6e4
2041
- }), Ts = T(
2041
+ }), Ls = T(
2042
2042
  () => ln.map(({ relationField: e, memberField: n }) => {
2043
- const t = kt.get(e), i = (t ? $s.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2043
+ const t = kt.get(e), i = (t ? qs.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2044
2044
  return {
2045
2045
  field: `${e}.${n}`,
2046
2046
  type: "presentation",
@@ -2060,25 +2060,25 @@ function Pd({
2060
2060
  dependency_config: null
2061
2061
  };
2062
2062
  }),
2063
- [ln, kt, $s]
2063
+ [ln, kt, qs]
2064
2064
  );
2065
2065
  function st(e) {
2066
2066
  return e.type === "presentation" && e.field.includes(".");
2067
2067
  }
2068
- function Ls(e, n, t) {
2068
+ function Ms(e, n, t) {
2069
2069
  var l, m;
2070
2070
  if (t) {
2071
- const g = n[`__o2m_${e}`];
2072
- return Array.isArray(g) ? g : [];
2071
+ const h = n[`__o2m_${e}`];
2072
+ return Array.isArray(h) ? h : [];
2073
2073
  }
2074
- const r = String(n.id), i = mr[`${r}|${e}`];
2074
+ const r = String(n.id), i = pr[`${r}|${e}`];
2075
2075
  if (i) return i;
2076
- const o = ((l = wr.get(e)) == null ? void 0 : l.get(r)) ?? [], c = (m = H.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
2076
+ const o = ((l = _r.get(e)) == null ? void 0 : l.get(r)) ?? [], c = (m = H.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
2077
2077
  if (!c) return o;
2078
- const u = new Set((c.deleted ?? []).map(String)), d = new Map((c.updated ?? []).map((g) => [String(g.id), g.changes]));
2078
+ const u = new Set((c.deleted ?? []).map(String)), d = new Map((c.updated ?? []).map((h) => [String(h.id), h.changes]));
2079
2079
  return [
2080
- ...o.filter((g) => !u.has(String(g.id))).map(
2081
- (g) => d.has(String(g.id)) ? { ...g, ...d.get(String(g.id)) } : g
2080
+ ...o.filter((h) => !u.has(String(h.id))).map(
2081
+ (h) => d.has(String(h.id)) ? { ...h, ...d.get(String(h.id)) } : h
2082
2082
  ),
2083
2083
  ...c.created ?? []
2084
2084
  ];
@@ -2087,29 +2087,29 @@ function Pd({
2087
2087
  var l;
2088
2088
  const r = e.field.indexOf(".");
2089
2089
  if (r < 0) return "—";
2090
- const i = e.field.slice(0, r), o = e.field.slice(r + 1), c = Ls(i, n, t);
2090
+ const i = e.field.slice(0, r), o = e.field.slice(r + 1), c = Ms(i, n, t);
2091
2091
  if (c.length === 0) return "—";
2092
- const u = (l = xr.get(i)) == null ? void 0 : l.get(o), d = c.map((m) => {
2092
+ const u = (l = vr.get(i)) == null ? void 0 : l.get(o), d = c.map((m) => {
2093
2093
  var b;
2094
- const g = m[o];
2095
- return g == null || g === "" ? null : u != null && u.one_collection ? ((b = js[u.one_collection]) == null ? void 0 : b[String(g)]) ?? String(g) : String(g);
2094
+ const h = m[o];
2095
+ return h == null || h === "" ? null : u != null && u.one_collection ? ((b = Ts[u.one_collection]) == null ? void 0 : b[String(h)]) ?? String(h) : String(h);
2096
2096
  }).filter((m) => !!m);
2097
2097
  return d.length > 0 ? d.join(", ") : "—";
2098
2098
  }
2099
- function _r(e, n) {
2099
+ function kr(e, n) {
2100
2100
  var l;
2101
2101
  const t = e.field.indexOf(".");
2102
2102
  if (t < 0) return "—";
2103
- const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = Ls(r, n, !1);
2103
+ const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = Ms(r, n, !1);
2104
2104
  if (o.length === 0) return "—";
2105
- const c = (l = xr.get(r)) == null ? void 0 : l.get(i);
2105
+ const c = (l = vr.get(r)) == null ? void 0 : l.get(i);
2106
2106
  if (!(c != null && c.one_collection) || !le) return Rn(e, n, !1);
2107
2107
  const u = c.one_collection, d = o.map((m) => {
2108
2108
  var b;
2109
- const g = m[i];
2110
- return g == null || g === "" ? null : { id: String(g), label: ((b = js[u]) == null ? void 0 : b[String(g)]) ?? String(g) };
2109
+ const h = m[i];
2110
+ return h == null || h === "" ? null : { id: String(h), label: ((b = Ts[u]) == null ? void 0 : b[String(h)]) ?? String(h) };
2111
2111
  }).filter((m) => !!m);
2112
- return d.length === 0 ? "—" : /* @__PURE__ */ s("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((m, g) => /* @__PURE__ */ s(
2112
+ return d.length === 0 ? "—" : /* @__PURE__ */ s("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((m, h) => /* @__PURE__ */ s(
2113
2113
  "button",
2114
2114
  {
2115
2115
  type: "button",
@@ -2119,10 +2119,10 @@ function Pd({
2119
2119
  className: "truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
2120
2120
  children: m.label
2121
2121
  },
2122
- `${m.id}:${g}`
2122
+ `${m.id}:${h}`
2123
2123
  )) });
2124
2124
  }
2125
- const Re = _t && (ks.length > 0 || Ts.length > 0) ? [...ks, ...Ts] : Ne, un = xe(null), [ya, li] = U(0), Ms = xe(/* @__PURE__ */ new Map()), Et = xe(0), Ks = 1e4, ot = (e) => Ms.current.set(String(e), Date.now()), Pn = Ne.map((e) => e.field).filter((e) => !e.includes(".")).join(","), Nt = Mt(
2125
+ const Re = _t && (Ns.length > 0 || Ls.length > 0) ? [...Ns, ...Ls] : Ne, un = xe(null), [xa, di] = U(0), Ks = xe(/* @__PURE__ */ new Map()), Et = xe(0), Rs = 1e4, ot = (e) => Ks.current.set(String(e), Date.now()), Pn = Ne.map((e) => e.field).filter((e) => !e.includes(".")).join(","), Nt = Mt(
2126
2126
  (e) => {
2127
2127
  const n = {};
2128
2128
  for (const t of Pn ? Pn.split(",") : []) {
@@ -2132,29 +2132,29 @@ function Pd({
2132
2132
  return n;
2133
2133
  },
2134
2134
  [Pn]
2135
- ), xa = (e, n) => {
2135
+ ), va = (e, n) => {
2136
2136
  for (const t of Object.keys(n)) if (String(e[t] ?? "") !== String(n[t] ?? "")) return !1;
2137
2137
  return !0;
2138
- }, kr = (e, n) => {
2139
- const t = Ms.current.get(e);
2140
- return !!t && n - t < Ks;
2138
+ }, Nr = (e, n) => {
2139
+ const t = Ks.current.get(e);
2140
+ return !!t && n - t < Rs;
2141
2141
  };
2142
2142
  $e(() => {
2143
2143
  if (O || nn || !Pn) return;
2144
2144
  if (!un.current) {
2145
- un.current = new Map(Xe.map((i) => [String(i.id), Nt(i)])), li((i) => i + 1);
2145
+ un.current = new Map(Xe.map((i) => [String(i.id), Nt(i)])), di((i) => i + 1);
2146
2146
  return;
2147
2147
  }
2148
2148
  const e = un.current, n = Date.now(), t = /* @__PURE__ */ new Set();
2149
2149
  let r = !1;
2150
2150
  for (const i of Xe) {
2151
2151
  const o = String(i.id);
2152
- t.add(o), (kr(o, n) || !e.has(o) && n - Et.current < Ks) && (e.set(o, Nt(i)), r = !0);
2152
+ t.add(o), (Nr(o, n) || !e.has(o) && n - Et.current < Rs) && (e.set(o, Nt(i)), r = !0);
2153
2153
  }
2154
2154
  for (const i of [...e.keys()])
2155
- !t.has(i) && kr(i, n) && (e.delete(i), r = !0);
2156
- r && li((i) => i + 1);
2157
- }, [ur, O, nn, Pn]);
2155
+ !t.has(i) && Nr(i, n) && (e.delete(i), r = !0);
2156
+ r && di((i) => i + 1);
2157
+ }, [fr, O, nn, Pn]);
2158
2158
  const Ot = T(() => {
2159
2159
  const e = un.current;
2160
2160
  if (!e || O) return null;
@@ -2167,36 +2167,36 @@ function Pd({
2167
2167
  t.add(u);
2168
2168
  continue;
2169
2169
  }
2170
- H.has(u) || kr(u, n) || xa(Nt(c), d) || r.add(u);
2170
+ H.has(u) || Nr(u, n) || va(Nt(c), d) || r.add(u);
2171
2171
  }
2172
2172
  for (const c of e.keys()) o.has(c) || i.push(c);
2173
2173
  return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
2174
- }, [Xe, ya, Zr, O, Nt]), va = () => {
2175
- un.current = new Map(Xe.map((e) => [String(e.id), Nt(e)])), li((e) => e + 1);
2176
- }, fn = xe(null), [Nr, Rs] = U({}), Dn = T(() => {
2174
+ }, [Xe, xa, ei, O, Nt]), wa = () => {
2175
+ un.current = new Map(Xe.map((e) => [String(e.id), Nt(e)])), di((e) => e + 1);
2176
+ }, fn = xe(null), [Sr, Ps] = U({}), Dn = T(() => {
2177
2177
  const e = fn.current, n = p == null ? void 0 : p.rowId;
2178
2178
  if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
2179
2179
  const t = Xe.find((o) => String(o.id) === n);
2180
- if (!t || kr(n, Date.now())) return [];
2180
+ if (!t || Nr(n, Date.now())) return [];
2181
2181
  const r = Nt(t), i = [];
2182
2182
  for (const o of Object.keys(r)) {
2183
- if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(Nr[o] ?? "\0") === String(r[o] ?? "") || String((p == null ? void 0 : p.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2183
+ if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(Sr[o] ?? "\0") === String(r[o] ?? "") || String((p == null ? void 0 : p.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2184
2184
  const c = ke.find((u) => u.field === o);
2185
2185
  (c == null ? void 0 : c.computed_type) === "write" && c.computed_formula || i.push({ field: o, label: (c == null ? void 0 : c.label) || qe(o), theirs: r[o], was: e.snap[o] });
2186
2186
  }
2187
2187
  return i;
2188
- }, [Xe, p == null ? void 0 : p.rowId, p == null ? void 0 : p.draft, Nr, Nt, ke]), Ps = (e) => {
2188
+ }, [Xe, p == null ? void 0 : p.rowId, p == null ? void 0 : p.draft, Sr, Nt, ke]), Ds = (e) => {
2189
2189
  if (!e || Dn.length === 0 || (p == null ? void 0 : p.rowId) !== e) return null;
2190
2190
  const n = (i) => i == null || i === "" ? "∅" : String(i).slice(0, 40), t = (i) => {
2191
- const o = { ...Nr }, c = {};
2191
+ const o = { ...Sr }, c = {};
2192
2192
  for (const u of Dn)
2193
2193
  i && u.field !== i || (c[u.field] = u.theirs, o[u.field] = u.theirs, fn.current && (fn.current.snap[u.field] = u.theirs));
2194
- yi(c), Rs(o);
2194
+ xi(c), Ps(o);
2195
2195
  }, r = () => {
2196
- const i = { ...Nr };
2196
+ const i = { ...Sr };
2197
2197
  for (const o of Dn)
2198
2198
  i[o.field] = o.theirs, fn.current && (fn.current.snap[o.field] = o.theirs);
2199
- Rs(i);
2199
+ Ps(i);
2200
2200
  };
2201
2201
  return /* @__PURE__ */ _(
2202
2202
  "div",
@@ -2249,19 +2249,19 @@ function Pd({
2249
2249
  ]
2250
2250
  }
2251
2251
  );
2252
- }, Ds = T(() => {
2252
+ }, Ws = T(() => {
2253
2253
  if (!Ot) return [];
2254
2254
  const e = /* @__PURE__ */ new Set();
2255
2255
  for (const n of Ot.changed) {
2256
- const t = Object.values(Br[n] ?? {});
2256
+ const t = Object.values(Hr[n] ?? {});
2257
2257
  if (t.length === 0) continue;
2258
2258
  const r = t.reduce((i, o) => String(o.at) > String(i.at) ? o : i);
2259
2259
  r.who && e.add(r.who);
2260
2260
  }
2261
2261
  return [...e];
2262
- }, [Ot, Br]), [Ce, Yt] = U(null), di = xe(/* @__PURE__ */ new Set()), Ws = (e, n) => JSON.stringify([e, n]), [mn, wa] = U(() => /* @__PURE__ */ new Map()), Us = xe(""), ci = xe(() => {
2263
- }), _a = (e) => {
2264
- const n = tr.current;
2262
+ }, [Ot, Hr]), [Ce, Yt] = U(null), ci = xe(/* @__PURE__ */ new Set()), Us = (e, n) => JSON.stringify([e, n]), [mn, _a] = U(() => /* @__PURE__ */ new Map()), Js = xe(""), ui = xe(() => {
2263
+ }), ka = (e) => {
2264
+ const n = nr.current;
2265
2265
  if (!n) return null;
2266
2266
  const t = `${a}:${e}`;
2267
2267
  for (const r of n.querySelectorAll("[data-o2m-row]")) {
@@ -2270,10 +2270,10 @@ function Pd({
2270
2270
  return i != null && i.trim() ? i : null;
2271
2271
  }
2272
2272
  return null;
2273
- }, Js = !es && (O || !nn);
2273
+ }, zs = !ts && (O || !nn);
2274
2274
  $e(() => {
2275
- const e = tr.current;
2276
- if (!e || !Js || typeof MutationObserver > "u") return;
2275
+ const e = nr.current;
2276
+ if (!e || !zs || typeof MutationObserver > "u") return;
2277
2277
  const n = `${a}:`, t = () => {
2278
2278
  const i = /* @__PURE__ */ new Map();
2279
2279
  for (const c of e.querySelectorAll("[data-o2m-row][data-remote-editor]")) {
@@ -2284,9 +2284,9 @@ function Pd({
2284
2284
  }
2285
2285
  const o = [...i.entries()].map(([c, u]) => `${c}\0${u}`).sort().join(`
2286
2286
  `);
2287
- o !== Us.current && (Us.current = o, wa(i));
2287
+ o !== Js.current && (Js.current = o, _a(i));
2288
2288
  };
2289
- ci.current = t, t();
2289
+ ui.current = t, t();
2290
2290
  const r = new MutationObserver(t);
2291
2291
  return r.observe(e, {
2292
2292
  attributes: !0,
@@ -2294,11 +2294,11 @@ function Pd({
2294
2294
  subtree: !0,
2295
2295
  childList: !0
2296
2296
  }), () => {
2297
- r.disconnect(), ci.current = () => {
2297
+ r.disconnect(), ui.current = () => {
2298
2298
  };
2299
2299
  };
2300
- }, [Js, a]), $e(() => {
2301
- const e = di.current;
2300
+ }, [zs, a]), $e(() => {
2301
+ const e = ci.current;
2302
2302
  for (const n of [...e]) {
2303
2303
  const [t, r] = JSON.parse(n);
2304
2304
  mn.get(t) !== r && e.delete(n);
@@ -2311,7 +2311,7 @@ function Pd({
2311
2311
  };
2312
2312
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2313
2313
  }, [Ce]);
2314
- const ui = T(() => {
2314
+ const fi = T(() => {
2315
2315
  if (mn.size === 0) return [];
2316
2316
  const e = [];
2317
2317
  return $.forEach((n, t) => {
@@ -2333,22 +2333,22 @@ function Pd({
2333
2333
  n(), e && clearTimeout(e);
2334
2334
  };
2335
2335
  }, [qt, a, f, v, O, V]);
2336
- const zs = xe(null);
2336
+ const Qs = xe(null);
2337
2337
  $e(() => {
2338
2338
  const e = {
2339
2339
  edits: new Set(H.keys()),
2340
2340
  deletes: new Set(Je),
2341
2341
  pending: M.length
2342
- }, n = zs.current;
2343
- if (zs.current = e, !!n) {
2342
+ }, n = Qs.current;
2343
+ if (Qs.current = e, !!n) {
2344
2344
  for (const t of n.edits) e.edits.has(t) || ot(t);
2345
2345
  for (const t of n.deletes) e.deletes.has(t) || ot(t);
2346
2346
  e.pending < n.pending && (Et.current = Date.now());
2347
2347
  }
2348
- }, [Zr]);
2349
- const fi = T(() => ed(ke), [ke]), Qs = T(
2348
+ }, [ei]);
2349
+ const mi = T(() => ed(ke), [ke]), Fs = T(
2350
2350
  () => ke.filter(
2351
- (e) => e.group_key === "__create_with_defaults__" && !Ki.has(e.type ?? "") && !Mi.has(e.field)
2351
+ (e) => e.group_key === "__create_with_defaults__" && !Ri.has(e.type ?? "") && !Ki.has(e.field)
2352
2352
  ),
2353
2353
  [ke]
2354
2354
  ), Ve = T(() => {
@@ -2360,7 +2360,7 @@ function Pd({
2360
2360
  t != null && t.one_collection && e.set(n.field, t);
2361
2361
  }
2362
2362
  return e;
2363
- }, [Ne, We, a]), mi = T(() => {
2363
+ }, [Ne, We, a]), pi = T(() => {
2364
2364
  var n;
2365
2365
  const e = {};
2366
2366
  for (const t of Ne) {
@@ -2372,7 +2372,7 @@ function Pd({
2372
2372
  }
2373
2373
  })() : null, i = r == null ? void 0 : r.option_filter;
2374
2374
  if (!i || typeof i != "object") continue;
2375
- const o = Mo(
2375
+ const o = Ko(
2376
2376
  i,
2377
2377
  N == null ? void 0 : N.draft,
2378
2378
  ((n = N == null ? void 0 : N.draft) == null ? void 0 : n.id) != null ? String(N.draft.id) : ""
@@ -2380,15 +2380,15 @@ function Pd({
2380
2380
  o && (e[t.field] = o);
2381
2381
  }
2382
2382
  return e;
2383
- }, [Ne, N == null ? void 0 : N.draft]), pi = T(() => {
2383
+ }, [Ne, N == null ? void 0 : N.draft]), hi = T(() => {
2384
2384
  const e = [], n = /* @__PURE__ */ new Set([
2385
2385
  ...Object.keys(it),
2386
- ...Object.keys(mi)
2386
+ ...Object.keys(pi)
2387
2387
  ]);
2388
2388
  for (const t of n) {
2389
2389
  const r = Ve.get(t);
2390
2390
  if (!(r != null && r.one_collection)) continue;
2391
- const i = [it[t], mi[t]].filter(
2391
+ const i = [it[t], pi[t]].filter(
2392
2392
  (u) => !!u
2393
2393
  ), o = i.length === 1 ? i[0] : { _and: i }, c = [
2394
2394
  ...new Set(
@@ -2398,8 +2398,8 @@ function Pd({
2398
2398
  c.length && e.push({ field: t, target: r.one_collection, filter: o, ids: c });
2399
2399
  }
2400
2400
  return e;
2401
- }, [it, mi, Ve, $, M]), Fs = Zt({
2402
- queries: pi.map((e) => ({
2401
+ }, [it, pi, Ve, $, M]), Vs = Zt({
2402
+ queries: hi.map((e) => ({
2403
2403
  queryKey: [
2404
2404
  "cascade-stale-sweep",
2405
2405
  a,
@@ -2418,9 +2418,9 @@ function Pd({
2418
2418
  }))
2419
2419
  }), gi = T(() => {
2420
2420
  const e = /* @__PURE__ */ new Map();
2421
- return pi.forEach((n, t) => {
2421
+ return hi.forEach((n, t) => {
2422
2422
  var c;
2423
- const r = (c = Fs[t]) == null ? void 0 : c.data;
2423
+ const r = (c = Vs[t]) == null ? void 0 : c.data;
2424
2424
  if (!r) return;
2425
2425
  const i = /* @__PURE__ */ new Set();
2426
2426
  if (Ln.has(n.field))
@@ -2432,17 +2432,17 @@ function Pd({
2432
2432
  o.length && e.set(n.field, new Set(o));
2433
2433
  }), e;
2434
2434
  }, [
2435
- pi,
2436
- Fs,
2435
+ hi,
2436
+ Vs,
2437
2437
  Ln,
2438
- yr,
2438
+ xr,
2439
2439
  N == null ? void 0 : N.draft,
2440
2440
  $,
2441
2441
  M
2442
- ]), Sr = xe(/* @__PURE__ */ new Set()), hi = xe(!1);
2442
+ ]), $r = xe(/* @__PURE__ */ new Set()), bi = xe(!1);
2443
2443
  $e(() => {
2444
2444
  var t;
2445
- if (j || !S || hi.current) return;
2445
+ if (j || !S || bi.current) return;
2446
2446
  const e = N == null ? void 0 : N.dirtyFields;
2447
2447
  if (!e || e.size === 0) return;
2448
2448
  const n = [];
@@ -2452,27 +2452,27 @@ function Pd({
2452
2452
  const o = gi.get(r.child_field), c = it[r.child_field], u = Ve.get(r.child_field);
2453
2453
  if (!(o != null && o.size) || !c || !(u != null && u.one_collection)) continue;
2454
2454
  const d = JSON.stringify(c), l = [...o].filter(
2455
- (b) => !Sr.current.has(`${r.child_field}|${b}|${d}`)
2455
+ (b) => !$r.current.has(`${r.child_field}|${b}|${d}`)
2456
2456
  );
2457
2457
  if (!l.length) continue;
2458
2458
  const m = {};
2459
- let g = !0;
2460
- for (const [b, h] of Object.entries(i.replace)) {
2461
- const w = Array.isArray(h) ? ws(h, {}) : null;
2459
+ let h = !0;
2460
+ for (const [b, g] of Object.entries(i.replace)) {
2461
+ const w = Array.isArray(g) ? _s(g, {}) : null;
2462
2462
  if (!w) {
2463
- g = !1;
2463
+ h = !1;
2464
2464
  break;
2465
2465
  }
2466
2466
  m[b] = w.id;
2467
2467
  }
2468
- if (!g) {
2468
+ if (!h) {
2469
2469
  const b = Object.values(i.replace).flat().every((w) => {
2470
2470
  var x;
2471
2471
  const y = (x = N == null ? void 0 : N.draft) == null ? void 0 : x[w.parent_field];
2472
- return y == null || y === "" || yr.has(`${w.parent_collection}|${String(y)}`);
2473
- }), h = `hint|${r.child_field}|${d}`;
2474
- if (b && !Sr.current.has(h)) {
2475
- Sr.current.add(h);
2472
+ return y == null || y === "" || xr.has(`${w.parent_collection}|${String(y)}`);
2473
+ }), g = `hint|${r.child_field}|${d}`;
2474
+ if (b && !$r.current.has(g)) {
2475
+ $r.current.add(g);
2476
2476
  const w = ((t = N == null ? void 0 : N.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? qe(r.parent_field);
2477
2477
  Se.message(
2478
2478
  `${i.label ?? "Value"} on ${l.length} ${l.length === 1 ? "line is" : "lines are"} not available for this ${w} — no default ${(i.label ?? "value").toLowerCase()} is set on it (or its type), so nothing was switched`
@@ -2482,28 +2482,28 @@ function Pd({
2482
2482
  }
2483
2483
  n.push({ rule: r, cfg: i, target: u.one_collection, filter: c, filterKey: d, ids: l, replaceValues: m });
2484
2484
  }
2485
- n.length && (hi.current = !0, (async () => {
2486
- var d, l, m, g, b;
2485
+ n.length && (bi.current = !0, (async () => {
2486
+ var d, l, m, h, b;
2487
2487
  let r = 0, i = 0, o = 0;
2488
- for (const h of n) {
2489
- for (const Y of h.ids)
2490
- Sr.current.add(`${h.rule.child_field}|${Y}|${h.filterKey}`);
2491
- const w = h.rule.child_field, y = (h.cfg.keep ?? []).filter((Y) => typeof Y == "string" && Y), x = await S.request(
2492
- re(`/items/${h.target}`, {
2493
- filter: JSON.stringify({ id: { _in: h.ids } }),
2488
+ for (const g of n) {
2489
+ for (const Y of g.ids)
2490
+ $r.current.add(`${g.rule.child_field}|${Y}|${g.filterKey}`);
2491
+ const w = g.rule.child_field, y = (g.cfg.keep ?? []).filter((Y) => typeof Y == "string" && Y), x = await S.request(
2492
+ re(`/items/${g.target}`, {
2493
+ filter: JSON.stringify({ id: { _in: g.ids } }),
2494
2494
  fields: ["id", ...y].join(","),
2495
- limit: h.ids.length
2495
+ limit: g.ids.length
2496
2496
  })
2497
2497
  ).then((Y) => Y.data ?? []).catch(() => []), R = /* @__PURE__ */ new Map();
2498
2498
  for (const Y of x) {
2499
2499
  const ye = [
2500
- h.filter,
2501
- ...Object.entries(h.replaceValues).map(([ee, Be]) => ({ [ee]: { _eq: Be } })),
2500
+ g.filter,
2501
+ ...Object.entries(g.replaceValues).map(([ee, Be]) => ({ [ee]: { _eq: Be } })),
2502
2502
  ...y.map(
2503
2503
  (ee) => Y[ee] == null || Y[ee] === "" ? { [ee]: { _null: !0 } } : { [ee]: { _eq: Y[ee] } }
2504
2504
  )
2505
2505
  ], ue = await S.request(
2506
- re(`/items/${h.target}`, {
2506
+ re(`/items/${g.target}`, {
2507
2507
  filter: JSON.stringify({ _and: ye }),
2508
2508
  fields: "id",
2509
2509
  limit: 1,
@@ -2532,8 +2532,8 @@ function Pd({
2532
2532
  parent_context: I,
2533
2533
  row_rules: L
2534
2534
  })
2535
- ).catch(() => null), Be = bi(w, Y, ee == null ? void 0 : ee.expected);
2536
- for (const Tr of Be) ye[Tr] = null;
2535
+ ).catch(() => null), Be = yi(w, Y, ee == null ? void 0 : ee.expected);
2536
+ for (const Lr of Be) ye[Lr] = null;
2537
2537
  const $t = await S.request(
2538
2538
  Ke("/field-rules/evaluate", {
2539
2539
  collection: a,
@@ -2544,7 +2544,7 @@ function Pd({
2544
2544
  })
2545
2545
  ).catch(() => null);
2546
2546
  $t != null && $t.updates && (ue = { ...ue, ...$t.updates });
2547
- for (const Tr of Be) Tr in ue || (ue[Tr] = null);
2547
+ for (const Lr of Be) Lr in ue || (ue[Lr] = null);
2548
2548
  }
2549
2549
  return ue;
2550
2550
  }, F = M.map((Y, ye) => ({ r: Y, i: ye })).filter(({ r: Y }) => Y[w] != null && R.has(String(Y[w])));
@@ -2575,16 +2575,16 @@ function Pd({
2575
2575
  queryKey: ["o2m-rows", a, f, v]
2576
2576
  });
2577
2577
  }
2578
- const c = ((l = n[0]) == null ? void 0 : l.cfg.label) ?? "Value", u = ((g = N == null ? void 0 : N.fieldLabels) == null ? void 0 : g[((m = n[0]) == null ? void 0 : m.rule.parent_field) ?? ""]) ?? qe(((b = n[0]) == null ? void 0 : b.rule.parent_field) ?? "parent");
2578
+ const c = ((l = n[0]) == null ? void 0 : l.cfg.label) ?? "Value", u = ((h = N == null ? void 0 : N.fieldLabels) == null ? void 0 : h[((m = n[0]) == null ? void 0 : m.rule.parent_field) ?? ""]) ?? qe(((b = n[0]) == null ? void 0 : b.rule.parent_field) ?? "parent");
2579
2579
  r && Se.message(
2580
2580
  `${c} switched to the default on ${r} ${r === 1 ? "line" : "lines"} — the previous one is not available for this ${u}${(K || O) && k ? " (saved with the record)" : ""}`
2581
2581
  ), (i || o) && Se.warning(
2582
2582
  `${i + o} ${i + o === 1 ? "line" : "lines"} could not be switched — no matching default option${o ? " / save failed" : ""}`
2583
2583
  );
2584
2584
  })().finally(() => {
2585
- hi.current = !1;
2585
+ bi.current = !1;
2586
2586
  }));
2587
- }, [gi, it, N == null ? void 0 : N.dirtyFields, yr]);
2587
+ }, [gi, it, N == null ? void 0 : N.dirtyFields, xr]);
2588
2588
  const Wn = T(() => {
2589
2589
  const e = /* @__PURE__ */ new Map(), n = [...$, ...M], t = [...H.values()], r = me.flatMap((i) => i.rows);
2590
2590
  for (const [i, o] of Ve) {
@@ -2593,12 +2593,12 @@ function Pd({
2593
2593
  l.length && e.set(o.one_collection, l);
2594
2594
  }
2595
2595
  return e;
2596
- }, [$, M, H, Ve, me]), ka = T(() => {
2596
+ }, [$, M, H, Ve, me]), Na = T(() => {
2597
2597
  const e = /* @__PURE__ */ new Map();
2598
2598
  for (const n of Ne) {
2599
2599
  const t = Ve.get(n.field);
2600
2600
  if (t != null && t.one_collection && n.interface === "relation-grouped") {
2601
- const r = No(n.options);
2601
+ const r = So(n.options);
2602
2602
  r != null && r.group_field && (r != null && r.option_field) && e.set(t.one_collection, {
2603
2603
  groupField: r.group_field,
2604
2604
  optionField: r.option_field
@@ -2606,11 +2606,11 @@ function Pd({
2606
2606
  }
2607
2607
  }
2608
2608
  return e;
2609
- }, [Ne, Ve]), Na = T(
2609
+ }, [Ne, Ve]), Sa = T(
2610
2610
  () => ["m2o-display", a, ...Array.from(Wn.entries()).flat(2)],
2611
2611
  [a, Wn]
2612
- ), { data: pn = {}, isFetching: Sa } = Fe({
2613
- queryKey: Na,
2612
+ ), { data: pn = {}, isFetching: $a } = Fe({
2613
+ queryKey: Sa,
2614
2614
  queryFn: async () => {
2615
2615
  const e = {}, n = await Promise.all(
2616
2616
  [...Wn.keys()].map(
@@ -2625,7 +2625,7 @@ function Pd({
2625
2625
  );
2626
2626
  return await Promise.all(
2627
2627
  n.map(async ({ collection: t, meta: r }) => {
2628
- const i = Wn.get(t), o = ka.get(t);
2628
+ const i = Wn.get(t), o = Na.get(t);
2629
2629
  let c;
2630
2630
  if (o)
2631
2631
  c = `id,${o.groupField}.*,${o.optionField}.*`;
@@ -2645,8 +2645,8 @@ function Pd({
2645
2645
  e[t] = {};
2646
2646
  for (const d of u)
2647
2647
  if (o) {
2648
- const l = d[o.groupField], m = d[o.optionField], g = l ? Bn(null, l) : null, b = m ? Bn(null, m) : null;
2649
- e[t][String(d.id)] = [g, b].filter(Boolean).join(" — ") || String(d.id);
2648
+ const l = d[o.groupField], m = d[o.optionField], h = l ? Bn(null, l) : null, b = m ? Bn(null, m) : null;
2649
+ e[t][String(d.id)] = [h, b].filter(Boolean).join(" — ") || String(d.id);
2650
2650
  } else {
2651
2651
  const l = (r == null ? void 0 : r.display_template) ?? void 0;
2652
2652
  e[t][String(d.id)] = Bn(l, d);
@@ -2656,14 +2656,14 @@ function Pd({
2656
2656
  },
2657
2657
  enabled: Wn.size > 0,
2658
2658
  staleTime: 6e4
2659
- }), $a = T(
2659
+ }), qa = T(
2660
2660
  () => ae != null && ae.unmatched_banner ? M.map((e) => ce({ ...e })) : void 0,
2661
2661
  // eslint-disable-next-line react-hooks/exhaustive-deps
2662
2662
  [ae == null ? void 0 : ae.unmatched_banner, M]
2663
2663
  ), It = Wl({
2664
2664
  config: ae,
2665
2665
  rows: $,
2666
- stagedRows: $a,
2666
+ stagedRows: qa,
2667
2667
  relatedCollection: a,
2668
2668
  childRelations: We,
2669
2669
  parentDraft: N == null ? void 0 : N.draft,
@@ -2671,9 +2671,9 @@ function Pd({
2671
2671
  m2oDisplays: pn,
2672
2672
  client: S
2673
2673
  });
2674
- async function Vs(e) {
2674
+ async function Bs(e) {
2675
2675
  if (!S || !(L != null && L.length) || O && M.length === 0) return;
2676
- io(e ? "preview" : "apply");
2676
+ so(e ? "preview" : "apply");
2677
2677
  const n = K && !!k, t = M.map((i, o) => ({ ...i, id: `pending:${o}` })), r = {};
2678
2678
  if (k)
2679
2679
  for (const [i, o] of k.getPendingEdits(a, f))
@@ -2687,7 +2687,7 @@ function Pd({
2687
2687
  parent_context: At(),
2688
2688
  parent_collection: E,
2689
2689
  row_rules: L,
2690
- mode: vi,
2690
+ mode: wi,
2691
2691
  dry_run: e || n || t.length > 0,
2692
2692
  all_changes: n || t.length > 0,
2693
2693
  rows: t,
@@ -2695,7 +2695,7 @@ function Pd({
2695
2695
  })
2696
2696
  )).data;
2697
2697
  if (e) {
2698
- hn({
2698
+ gn({
2699
2699
  rows: o.rows,
2700
2700
  fields: o.fields,
2701
2701
  changes: o.changes,
@@ -2713,13 +2713,13 @@ function Pd({
2713
2713
  for (const l of u)
2714
2714
  Je.has(String(l.id)) || k.queueEdit(a, f, String(l.id), l.patch);
2715
2715
  const d = c.length + u.length;
2716
- Se.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), hn(null), Er(!1);
2716
+ Se.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), gn(null), Or(!1);
2717
2717
  return;
2718
2718
  }
2719
2719
  if (c.length > 0 && u.length === 0) {
2720
2720
  Se.success(
2721
2721
  `Rules applied to ${c.length} pending ${c.length === 1 ? "line" : "lines"}`
2722
- ), hn(null), Er(!1);
2722
+ ), gn(null), Or(!1);
2723
2723
  return;
2724
2724
  }
2725
2725
  if (c.length > 0) {
@@ -2731,7 +2731,7 @@ function Pd({
2731
2731
  parent_context: At(),
2732
2732
  parent_collection: E,
2733
2733
  row_rules: L,
2734
- mode: vi,
2734
+ mode: wi,
2735
2735
  dry_run: !1,
2736
2736
  saved_overrides: r
2737
2737
  })
@@ -2743,11 +2743,11 @@ function Pd({
2743
2743
  queryKey: ["o2m-field-snapshots", a, f, v]
2744
2744
  }), o.failed.length ? Se.error(
2745
2745
  `Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"} — ${o.failed.length} failed: ${o.failed.slice(0, 3).map((d) => `#${d.id} ${d.error}`).join("; ")}`
2746
- ) : Se.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), hn(null), Er(!1);
2746
+ ) : Se.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), gn(null), Or(!1);
2747
2747
  } catch (i) {
2748
- Se.error(`Re-run rules failed: ${(i == null ? void 0 : i.message) ?? "unknown error"}`);
2748
+ Se.error(`Re-run rules failed: ${Gn(i, "unknown error")}`);
2749
2749
  } finally {
2750
- io(null);
2750
+ so(null);
2751
2751
  }
2752
2752
  }
2753
2753
  function At() {
@@ -2765,7 +2765,7 @@ function Pd({
2765
2765
  }
2766
2766
  return e;
2767
2767
  }
2768
- function $r(e, n) {
2768
+ function qr(e, n) {
2769
2769
  !S || !L || L.length === 0 || S.request(
2770
2770
  Ke("/field-rules/evaluate", {
2771
2771
  collection: a,
@@ -2791,26 +2791,26 @@ function Pd({
2791
2791
  De((t) => t && t.rowId === e ? { ...t, locksPending: !1 } : t);
2792
2792
  });
2793
2793
  }
2794
- function qr(e) {
2794
+ function Er(e) {
2795
2795
  if (j) return;
2796
2796
  const n = String(e.id);
2797
2797
  if ((p == null ? void 0 : p.rowId) === n) return;
2798
- ci.current();
2799
- const t = _a(n);
2800
- if (t && !di.current.has(Ws(n, t))) {
2798
+ ui.current();
2799
+ const t = ka(n);
2800
+ if (t && !ci.current.has(Us(n, t))) {
2801
2801
  Yt({ rowKey: n, editor: t });
2802
2802
  return;
2803
2803
  }
2804
2804
  Ce && Yt(null);
2805
2805
  const r = ce({ ...e });
2806
- fn.current = { rowId: n, snap: Nt(e) }, De({ rowId: n, draft: r, locksPending: Nn.size > 0 }), $r(n, r);
2806
+ fn.current = { rowId: n, snap: Nt(e) }, De({ rowId: n, draft: r, locksPending: Nn.size > 0 }), qr(n, r);
2807
2807
  }
2808
2808
  $e(() => {
2809
2809
  const e = (n) => {
2810
2810
  const t = n.detail;
2811
2811
  if (!t || t.collection !== a || t.field !== f || !t.rowId) return;
2812
2812
  const r = $.find((i) => String(i.id) === String(t.rowId));
2813
- r && (qr(r), window.setTimeout(() => {
2813
+ r && (Er(r), window.setTimeout(() => {
2814
2814
  const i = document.querySelector(
2815
2815
  `[data-o2m-row="${a}:${String(t.rowId)}"]`
2816
2816
  );
@@ -2819,25 +2819,25 @@ function Pd({
2819
2819
  };
2820
2820
  return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
2821
2821
  }, [a, f, $]);
2822
- function Bs(e, n) {
2822
+ function Hs(e, n) {
2823
2823
  if (j) return;
2824
2824
  const t = `pending:${n}`;
2825
2825
  if ((p == null ? void 0 : p.rowId) === t) return;
2826
2826
  Ce && Yt(null);
2827
2827
  const r = ce({ ...e });
2828
- De({ rowId: t, draft: r, locksPending: Nn.size > 0 }), $r(t, r);
2828
+ De({ rowId: t, draft: r, locksPending: Nn.size > 0 }), qr(t, r);
2829
2829
  }
2830
- function Hs(e) {
2831
- var d, l, m, g;
2830
+ function Ys(e) {
2831
+ var d, l, m, h;
2832
2832
  const n = (l = (d = Ge.current) == null ? void 0 : d.lockReasons) == null ? void 0 : l[e];
2833
2833
  if (!n) return "Set automatically for this row";
2834
2834
  if (n.reason) return `Locked — ${n.reason}`;
2835
- const t = n.field ? ke.find((b) => b.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? qe(n.field) : "a rule"), i = n.field ? (m = Ge.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? Ve.get(n.field) : void 0, c = i == null || i === "" ? null : o != null && o.one_collection ? ((g = pn[o.one_collection]) == null ? void 0 : g[String(i)]) ?? String(i) : String(i);
2835
+ const t = n.field ? ke.find((b) => b.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? qe(n.field) : "a rule"), i = n.field ? (m = Ge.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? Ve.get(n.field) : void 0, c = i == null || i === "" ? null : o != null && o.one_collection ? ((h = pn[o.one_collection]) == null ? void 0 : h[String(i)]) ?? String(i) : String(i);
2836
2836
  if (c) return `Locked — ${r} is ${c}`;
2837
2837
  const u = n.op === "neq" ? "is not" : n.op === "null" ? "is empty" : n.op === "nnull" ? "is set" : n.op === "in" ? "is one of" : n.op === "contains" ? "contains" : "is";
2838
2838
  return `Locked — ${r} ${u}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
2839
2839
  }
2840
- function qa(e) {
2840
+ function Ea(e) {
2841
2841
  const n = p == null ? void 0 : p.expected;
2842
2842
  if (!n || !(e in n)) return null;
2843
2843
  const t = p == null ? void 0 : p.draft[e];
@@ -2845,12 +2845,12 @@ function Pd({
2845
2845
  const i = n[e];
2846
2846
  return i == null || i === "" ? null : String(t) === String(i) ? "auto" : "overridden";
2847
2847
  }
2848
- function Ea(e) {
2848
+ function Oa(e) {
2849
2849
  const n = Ge.current;
2850
2850
  if (!n || !S || !L || L.length === 0) return;
2851
2851
  const t = n.rowId;
2852
2852
  ct.current.rowId !== t && (ct.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
2853
- const r = ++zr.current;
2853
+ const r = ++Qr.current;
2854
2854
  ct.current.seqs.set(e, r), S.request(
2855
2855
  Ke("/field-rules/evaluate", {
2856
2856
  collection: a,
@@ -2862,11 +2862,11 @@ function Pd({
2862
2862
  row_rules: L
2863
2863
  })
2864
2864
  ).then(
2865
- (i) => Ys(t, r, { ...i, updates: { [e]: null, ...i.updates } })
2865
+ (i) => Gs(t, r, { ...i, updates: { [e]: null, ...i.updates } })
2866
2866
  ).catch(() => {
2867
2867
  });
2868
2868
  }
2869
- function bi(e, n, t) {
2869
+ function yi(e, n, t) {
2870
2870
  if (!t || !(L != null && L.length)) return [];
2871
2871
  const r = /* @__PURE__ */ new Set();
2872
2872
  for (const i of L) {
@@ -2881,7 +2881,7 @@ function Pd({
2881
2881
  return o == null || o === "" || c == null || c === "" ? !1 : String(o) === String(c);
2882
2882
  });
2883
2883
  }
2884
- function Ys(e, n, t, r = []) {
2884
+ function Gs(e, n, t, r = []) {
2885
2885
  var u;
2886
2886
  if (((u = Ge.current) == null ? void 0 : u.rowId) !== e || ct.current.rowId !== e) return;
2887
2887
  const i = ct.current.seqs, o = {};
@@ -2900,45 +2900,45 @@ function Pd({
2900
2900
  provenance: t.provenance ?? d.provenance
2901
2901
  });
2902
2902
  }
2903
- function Gs(e, n) {
2903
+ function Xs(e, n) {
2904
2904
  if (j) return;
2905
2905
  const t = { ...e };
2906
2906
  if (n.rowDeleted || !n.itemId) {
2907
2907
  delete t.id;
2908
- for (const r of Object.keys(t)) So.has(r) && delete t[r];
2908
+ for (const r of Object.keys(t)) $o.has(r) && delete t[r];
2909
2909
  delete t[f], De({
2910
2910
  rowId: "new",
2911
2911
  draft: sn(t),
2912
2912
  locksPending: Nn.size > 0
2913
- }), $r("new", t);
2913
+ }), qr("new", t);
2914
2914
  } else
2915
2915
  De({ rowId: String(n.itemId), draft: t });
2916
- kn(null), Jr(null), sr(!1);
2916
+ kn(null), zr(null), or(!1);
2917
2917
  }
2918
- function Oa() {
2919
- j || (De({ rowId: "new", draft: { ...Ft }, locksPending: Nn.size > 0 }), $r("new", { ...Ft }));
2918
+ function Ia() {
2919
+ j || (De({ rowId: "new", draft: { ...Ft }, locksPending: Nn.size > 0 }), qr("new", { ...Ft }));
2920
2920
  }
2921
2921
  function Un() {
2922
2922
  var n;
2923
2923
  const e = (n = Ge.current) == null ? void 0 : n.rowId;
2924
- De(null), zt(null), pr((t) => {
2924
+ De(null), zt(null), hr((t) => {
2925
2925
  const r = {};
2926
2926
  for (const [i, o] of Object.entries(t))
2927
2927
  e && i.startsWith(`${e}|`) || i.startsWith("__new__|") || (r[i] = o);
2928
2928
  return r;
2929
2929
  });
2930
2930
  }
2931
- function yi(e) {
2931
+ function xi(e) {
2932
2932
  const n = Ge.current, t = (n == null ? void 0 : n.rowId) ?? null;
2933
2933
  ct.current.rowId !== t && (ct.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
2934
- for (const i of Object.keys(e)) ct.current.seqs.set(i, ++zr.current);
2934
+ for (const i of Object.keys(e)) ct.current.seqs.set(i, ++Qr.current);
2935
2935
  const r = ce({ ...(n == null ? void 0 : n.draft) ?? {}, ...e });
2936
2936
  De((i) => i && { ...i, draft: r });
2937
2937
  }
2938
2938
  function mt(e, n) {
2939
2939
  const t = Ge.current, r = (t == null ? void 0 : t.rowId) ?? null;
2940
2940
  ct.current.rowId !== r && (ct.current = { rowId: r, seqs: /* @__PURE__ */ new Map() });
2941
- const i = ++zr.current;
2941
+ const i = ++Qr.current;
2942
2942
  ct.current.seqs.set(e, i);
2943
2943
  const o = ce(t ? { ...t.draft, [e]: n } : { [e]: n }), c = n != null && n !== "";
2944
2944
  if (De(
@@ -2951,7 +2951,7 @@ function Pd({
2951
2951
  };
2952
2952
  }
2953
2953
  ), L && L.length > 0 && S) {
2954
- const u = At(), d = bi(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), l = { ...o };
2954
+ const u = At(), d = yi(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), l = { ...o };
2955
2955
  for (const m of d) l[m] = null;
2956
2956
  S.request(
2957
2957
  Ke("/field-rules/evaluate", {
@@ -2962,7 +2962,7 @@ function Pd({
2962
2962
  parent_context: u,
2963
2963
  row_rules: L
2964
2964
  })
2965
- ).then((m) => Ys(r ?? "", i, m, d)).catch(() => {
2965
+ ).then((m) => Gs(r ?? "", i, m, d)).catch(() => {
2966
2966
  });
2967
2967
  }
2968
2968
  }
@@ -2974,12 +2974,12 @@ function Pd({
2974
2974
  ((l = Ge.current) == null ? void 0 : l.rowId) === e && De(null);
2975
2975
  };
2976
2976
  if (ze != null && ze.length) {
2977
- const l = p.rowId.startsWith("pending:"), m = l ? parseInt(p.rowId.split(":")[1], 10) : null, g = p.rowId === "new" || l ? null : p.rowId, b = Li(p.draft, ze);
2977
+ const l = p.rowId.startsWith("pending:"), m = l ? parseInt(p.rowId.split(":")[1], 10) : null, h = p.rowId === "new" || l ? null : p.rowId, b = Mi(p.draft, ze);
2978
2978
  if ($.some((w) => {
2979
- if (String(w.id) === g || Je.has(String(w.id))) return !1;
2979
+ if (String(w.id) === h || Je.has(String(w.id))) return !1;
2980
2980
  const y = H.has(String(w.id)) ? { ...w, ...H.get(String(w.id)) } : w;
2981
- return Li(y, ze) === b;
2982
- }) || M.some((w, y) => y !== m && Li(w, ze) === b))
2981
+ return Mi(y, ze) === b;
2982
+ }) || M.some((w, y) => y !== m && Mi(w, ze) === b))
2983
2983
  return zt(`A row with the same ${ze.join(" + ")} already exists.`), !1;
2984
2984
  }
2985
2985
  const t = (l) => l == null || l === "", r = Ne.filter(
@@ -2992,9 +2992,9 @@ function Pd({
2992
2992
  return zt(
2993
2993
  `Required: ${r.map((l) => l.label || qe(l.field)).join(", ")}`
2994
2994
  ), De((l) => l && { ...l, missing: r.map((m) => m.field) }), !1;
2995
- const i = fs(p.rowId), o = Ne.flatMap((l) => {
2996
- var g;
2997
- if (Vn(l) || (g = p.locks) != null && g.includes(l.field)) return [];
2995
+ const i = ms(p.rowId), o = Ne.flatMap((l) => {
2996
+ var h;
2997
+ if (Vn(l) || (h = p.locks) != null && h.includes(l.field)) return [];
2998
2998
  if (!Al.has(l.type ?? "")) return [];
2999
2999
  if (i && String(i[l.field] ?? "") === String(p.draft[l.field] ?? ""))
3000
3000
  return [];
@@ -3006,7 +3006,7 @@ function Pd({
3006
3006
  });
3007
3007
  if (o.length > 0)
3008
3008
  return zt(o.map((l) => l.message).join(" · ")), De((l) => l && { ...l, missing: o.map((m) => m.field) }), !1;
3009
- const c = i ? $o(p.draft, i, new Set(Object.keys(p.draft))) : p.draft, u = Tl(
3009
+ const c = i ? qo(p.draft, i, new Set(Object.keys(p.draft))) : p.draft, u = Tl(
3010
3010
  ke.map((l) => ({
3011
3011
  field: l.field,
3012
3012
  label: l.label || qe(l.field),
@@ -3021,18 +3021,18 @@ function Pd({
3021
3021
  if (et != null && et.field && et.cap) {
3022
3022
  const l = pt(et.cap, Vt);
3023
3023
  if (l != null) {
3024
- const m = et.field, g = ce({ ...p.draft }), b = p.rowId.startsWith("pending:") ? Number(p.rowId.slice(8)) : -1, h = ($ ?? []).some((I) => String(I.id) === p.rowId), w = ($ ?? []).filter((I) => !Je.has(String(I.id)) && String(I.id) !== p.rowId).reduce((I, B) => {
3024
+ const m = et.field, h = ce({ ...p.draft }), b = p.rowId.startsWith("pending:") ? Number(p.rowId.slice(8)) : -1, g = ($ ?? []).some((I) => String(I.id) === p.rowId), w = ($ ?? []).filter((I) => !Je.has(String(I.id)) && String(I.id) !== p.rowId).reduce((I, B) => {
3025
3025
  const F = String(B.id), Me = H.has(F) ? { ...B, ...H.get(F) } : B;
3026
3026
  return I + (Number(ce(Me)[m]) || 0);
3027
3027
  }, 0) + M.reduce(
3028
3028
  (I, B, F) => F === b ? I : I + (Number(ce(B)[m]) || 0),
3029
3029
  0
3030
- ), y = h ? (() => {
3030
+ ), y = g ? (() => {
3031
3031
  const I = ($ ?? []).find((F) => String(F.id) === p.rowId), B = H.has(p.rowId) ? { ...I, ...H.get(p.rowId) } : I;
3032
3032
  return Number(ce(B)[m]) || 0;
3033
3033
  })() : b >= 0 && Number(
3034
3034
  ce(M[b])[m]
3035
- ) || 0, x = w + y, R = w + (Number(g[m]) || 0);
3035
+ ) || 0, x = w + y, R = w + (Number(h[m]) || 0);
3036
3036
  if (R > l + 5e-3 && R > x + 5e-3) {
3037
3037
  const I = (B) => et.format === "currency" ? B.toLocaleString("en-US", { style: "currency", currency: "USD" }) : B.toLocaleString("en-US", { maximumFractionDigits: 2 });
3038
3038
  return zt(
@@ -3045,23 +3045,23 @@ function Pd({
3045
3045
  try {
3046
3046
  if (p.rowId.startsWith("pending:")) {
3047
3047
  const l = parseInt(p.rowId.split(":")[1], 10), m = M[l];
3048
- return k == null || k.updateRow(a, f, l, p.draft), m != null && m.__prefilled && (m == null ? void 0 : m.id) != null && Aa((g) => /* @__PURE__ */ new Set([...g, m.id])), n(), Sn(!1), !0;
3048
+ return k == null || k.updateRow(a, f, l, p.draft), m != null && m.__prefilled && (m == null ? void 0 : m.id) != null && ja((h) => /* @__PURE__ */ new Set([...h, m.id])), n(), Sn(!1), !0;
3049
3049
  }
3050
3050
  if (p.rowId === "new") {
3051
3051
  if ((O || K) && k)
3052
3052
  return k.queueRow(a, f, sn({ ...p.draft })), n(), !0;
3053
- const l = Object.entries(p.draft).filter(([y]) => y.startsWith("__m2m_")), m = Object.entries(p.draft).filter(([y]) => y.startsWith("__o2m_")), g = Object.fromEntries(
3053
+ const l = Object.entries(p.draft).filter(([y]) => y.startsWith("__m2m_")), m = Object.entries(p.draft).filter(([y]) => y.startsWith("__o2m_")), h = Object.fromEntries(
3054
3054
  Object.entries(p.draft).filter(
3055
3055
  ([y]) => !y.startsWith("__m2m_") && !y.startsWith("__o2m_")
3056
3056
  )
3057
- ), b = { ...sn(g), [f]: v };
3058
- let h = null;
3057
+ ), b = { ...sn(h), [f]: v };
3058
+ let g = null;
3059
3059
  try {
3060
- h = await S.request(
3060
+ g = await S.request(
3061
3061
  Ke(`/items/${a}${dt}`, b)
3062
3062
  );
3063
3063
  } catch (y) {
3064
- const x = $i(y);
3064
+ const x = qi(y);
3065
3065
  if (x)
3066
3066
  return qn({
3067
3067
  challenge: x,
@@ -3080,11 +3080,11 @@ function Pd({
3080
3080
  }), Sn(!1), !1;
3081
3081
  throw y;
3082
3082
  }
3083
- const w = (d = h == null ? void 0 : h.data) == null ? void 0 : d.id;
3083
+ const w = (d = g == null ? void 0 : g.data) == null ? void 0 : d.id;
3084
3084
  if (Et.current = Date.now(), w != null && ot(String(w)), w != null && l.length && await Promise.all(
3085
3085
  l.map(([y, x]) => {
3086
3086
  if (x == null) return Promise.resolve();
3087
- const R = y.slice(6), I = Cr({
3087
+ const R = y.slice(6), I = Zr({
3088
3088
  field: R,
3089
3089
  interface: "select-multiple-m2m"
3090
3090
  });
@@ -3119,7 +3119,7 @@ function Pd({
3119
3119
  })
3120
3120
  );
3121
3121
  } catch ($t) {
3122
- ee.push(Be), x || (x = Ao($t));
3122
+ ee.push(Be), x || (x = jo($t));
3123
3123
  }
3124
3124
  ee.length && y.push({
3125
3125
  label: qe(Y),
@@ -3130,30 +3130,30 @@ function Pd({
3130
3130
  });
3131
3131
  }
3132
3132
  const B = y.reduce((F, Me) => F + Me.members.length, 0);
3133
- I > 0 ? ar({
3133
+ I > 0 ? lr({
3134
3134
  text: `The line saved, but ${I} of ${R} nested row${R === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
3135
3135
  groups: []
3136
- }) : B > 0 && ar({
3136
+ }) : B > 0 && lr({
3137
3137
  text: `${B} of ${R} ${y.map((F) => F.label).join(", ")} row${R === 1 ? "" : "s"} did not save — ${x}`,
3138
3138
  groups: y
3139
3139
  });
3140
3140
  }
3141
3141
  V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3142
3142
  } else {
3143
- const l = (L ?? []).filter((h) => h.target_type !== "lock").map((h) => h.target_field).filter((h) => typeof h == "string" && h.length > 0 && h !== "id"), m = /* @__PURE__ */ new Set([
3144
- ...Ne.map((h) => h.field).filter((h) => !h.startsWith("__m2m_")),
3143
+ const l = (L ?? []).filter((g) => g.target_type !== "lock").map((g) => g.target_field).filter((g) => typeof g == "string" && g.length > 0 && g !== "id"), m = /* @__PURE__ */ new Set([
3144
+ ...Ne.map((g) => g.field).filter((g) => !g.startsWith("__m2m_")),
3145
3145
  ...l,
3146
3146
  // A reason an editor action prefilled (carry-forward) rides the row:
3147
3147
  // the server stores it on the activity row, never in a column.
3148
3148
  "_change_reason"
3149
- ]), g = $.find((h) => String(h.id) === p.rowId), b = $o(p.draft, g, m);
3149
+ ]), h = $.find((g) => String(g.id) === p.rowId), b = qo(p.draft, h, m);
3150
3150
  if (K && k) {
3151
- const h = Object.entries(p.draft).filter(
3151
+ const g = Object.entries(p.draft).filter(
3152
3152
  ([y]) => y.startsWith("__nested_ops_")
3153
3153
  ), w = b;
3154
- return Object.keys(w).length === 0 && h.length === 0 ? (n(), !0) : (k.queueEdit(a, f, p.rowId, {
3154
+ return Object.keys(w).length === 0 && g.length === 0 ? (n(), !0) : (k.queueEdit(a, f, p.rowId, {
3155
3155
  ...w,
3156
- ...Object.fromEntries(h)
3156
+ ...Object.fromEntries(g)
3157
3157
  }), n(), !0);
3158
3158
  }
3159
3159
  if (Object.keys(b).length === 0)
@@ -3162,8 +3162,8 @@ function Pd({
3162
3162
  await S.request(
3163
3163
  yt(`/items/${a}/${p.rowId}${dt}`, b)
3164
3164
  );
3165
- } catch (h) {
3166
- const w = $i(h);
3165
+ } catch (g) {
3166
+ const w = qi(g);
3167
3167
  if (w) {
3168
3168
  const y = `/items/${a}/${p.rowId}${dt}`;
3169
3169
  return qn({
@@ -3175,7 +3175,7 @@ function Pd({
3175
3175
  }
3176
3176
  }), Sn(!1), !1;
3177
3177
  }
3178
- throw h;
3178
+ throw g;
3179
3179
  }
3180
3180
  ot(e), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3181
3181
  }
@@ -3186,15 +3186,15 @@ function Pd({
3186
3186
  Sn(!1);
3187
3187
  }
3188
3188
  }
3189
- const [Ia, Aa] = U(/* @__PURE__ */ new Set()), [ht, Xs] = U(null), [Tt, Cs] = U(null), [ja, Zs] = U(!1), [Gt, Ta] = U(1), [Xt, gn] = U(!1), [eo, La] = U(!1), [xi, Ma] = U({}), [to, no] = U(!1), [ro, Er] = U(!1), [vi, Ka] = U("empty-only"), [Or, io] = U(null), [Lt, hn] = U(null), [Ct, so] = U({}), [oo, ao] = U(!1);
3190
- function Ra(e, n) {
3191
- Ma((t) => ({ ...t, [e]: n }));
3189
+ const [Aa, ja] = U(/* @__PURE__ */ new Set()), [gt, Cs] = U(null), [Tt, Zs] = U(null), [Ta, eo] = U(!1), [Gt, La] = U(1), [Xt, hn] = U(!1), [to, Ma] = U(!1), [vi, Ka] = U({}), [no, ro] = U(!1), [io, Or] = U(!1), [wi, Ra] = U("empty-only"), [Ir, so] = U(null), [Lt, gn] = U(null), [Ct, oo] = U({}), [ao, lo] = U(!1);
3190
+ function Pa(e, n) {
3191
+ Ka((t) => ({ ...t, [e]: n }));
3192
3192
  }
3193
- async function Pa() {
3193
+ async function Da() {
3194
3194
  if (Object.keys(Ct).some(
3195
3195
  (n) => Ct[n] !== null && Ct[n] !== void 0
3196
3196
  )) {
3197
- ao(!0);
3197
+ lo(!0);
3198
3198
  try {
3199
3199
  if ($.length)
3200
3200
  if (K && k)
@@ -3212,23 +3212,23 @@ function Pd({
3212
3212
  }
3213
3213
  M.length && k && M.forEach(
3214
3214
  (n, t) => k.updateRow(a, f, t, { ...n, ...Ct })
3215
- ), no(!1), so({});
3215
+ ), ro(!1), oo({});
3216
3216
  } catch {
3217
3217
  } finally {
3218
- ao(!1);
3218
+ lo(!1);
3219
3219
  }
3220
3220
  }
3221
3221
  }
3222
- async function Da(e) {
3222
+ async function Wa(e) {
3223
3223
  const n = Math.max(1, Math.min(24, Gt)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
3224
3224
  const c = new Date(t.getFullYear(), t.getMonth() + 1 + o, 1), u = `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-01`;
3225
- return { ...Ft, ...xi, [e]: u };
3225
+ return { ...Ft, ...vi, [e]: u };
3226
3226
  });
3227
3227
  if ((O || K) && k) {
3228
3228
  for (const i of on(r)) k.queueRow(a, f, i);
3229
3229
  return;
3230
3230
  }
3231
- gn(!0);
3231
+ hn(!0);
3232
3232
  try {
3233
3233
  for (const i of on(r))
3234
3234
  await S.request(
@@ -3237,10 +3237,10 @@ function Pd({
3237
3237
  Et.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3238
3238
  } catch {
3239
3239
  } finally {
3240
- gn(!1);
3240
+ hn(!1);
3241
3241
  }
3242
3242
  }
3243
- async function Wa() {
3243
+ async function Ua() {
3244
3244
  const e = ae == null ? void 0 : ae.unmatched_banner;
3245
3245
  if (!e || It.unmatchedCandidates.length === 0) return;
3246
3246
  const n = It.unmatchedCandidates.map((t) => ({
@@ -3251,7 +3251,7 @@ function Pd({
3251
3251
  for (const t of on(n)) k.queueRow(a, f, t);
3252
3252
  return;
3253
3253
  }
3254
- gn(!0);
3254
+ hn(!0);
3255
3255
  try {
3256
3256
  for (const t of on(n))
3257
3257
  await S.request(
@@ -3259,19 +3259,19 @@ function Pd({
3259
3259
  );
3260
3260
  Et.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3261
3261
  } catch (t) {
3262
- Se.error(`Could not add rows: ${(t == null ? void 0 : t.message) ?? "unknown error"}`);
3262
+ Se.error(`Could not add rows: ${Gn(t, "unknown error")}`);
3263
3263
  } finally {
3264
- gn(!1);
3264
+ hn(!1);
3265
3265
  }
3266
3266
  }
3267
- async function lo(e) {
3268
- const n = Math.max(1, Math.min(100, Gt)), t = e ? { ...Ft, ...xi } : { ...Ft };
3267
+ async function co(e) {
3268
+ const n = Math.max(1, Math.min(100, Gt)), t = e ? { ...Ft, ...vi } : { ...Ft };
3269
3269
  if ((O || K) && k) {
3270
3270
  const r = on(Array.from({ length: n }, () => ({ ...t })));
3271
3271
  for (const i of r) k.queueRow(a, f, i);
3272
3272
  return;
3273
3273
  }
3274
- gn(!0);
3274
+ hn(!0);
3275
3275
  try {
3276
3276
  for (const r of on(Array.from({ length: n }, () => ({ ...t }))))
3277
3277
  await S.request(
@@ -3280,24 +3280,24 @@ function Pd({
3280
3280
  Et.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3281
3281
  } catch {
3282
3282
  } finally {
3283
- gn(!1);
3283
+ hn(!1);
3284
3284
  }
3285
3285
  }
3286
- function co(e) {
3287
- Xs(e);
3286
+ function uo(e) {
3287
+ Cs(e);
3288
3288
  }
3289
- function uo(e, n) {
3290
- e.preventDefault(), Cs(n);
3289
+ function fo(e, n) {
3290
+ e.preventDefault(), Zs(n);
3291
3291
  }
3292
3292
  function bn() {
3293
- Xs(null), Cs(null);
3293
+ Cs(null), Zs(null);
3294
3294
  }
3295
- async function Ua(e) {
3296
- if (e.preventDefault(), ht === null || Tt === null || ht === Tt) {
3295
+ async function Ja(e) {
3296
+ if (e.preventDefault(), gt === null || Tt === null || gt === Tt) {
3297
3297
  bn();
3298
3298
  return;
3299
3299
  }
3300
- const n = [...$], [t] = n.splice(ht, 1);
3300
+ const n = [...$], [t] = n.splice(gt, 1);
3301
3301
  n.splice(Tt, 0, t);
3302
3302
  const r = n.map((i, o) => ({ row: i, newOrder: o })).filter(({ row: i, newOrder: o }) => {
3303
3303
  const c = K ? H.get(String(i.id)) : void 0, u = (c == null ? void 0 : c[C]) ?? i[C];
@@ -3311,7 +3311,7 @@ function Pd({
3311
3311
  ), bn();
3312
3312
  return;
3313
3313
  }
3314
- Zs(!0);
3314
+ eo(!0);
3315
3315
  try {
3316
3316
  await Promise.all(
3317
3317
  r.map(
@@ -3322,10 +3322,10 @@ function Pd({
3322
3322
  ), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3323
3323
  } catch {
3324
3324
  } finally {
3325
- Zs(!1), bn();
3325
+ eo(!1), bn();
3326
3326
  }
3327
3327
  }
3328
- async function wi(e, n) {
3328
+ async function _i(e, n) {
3329
3329
  n.stopPropagation();
3330
3330
  const t = e.id;
3331
3331
  if (K && k) {
@@ -3333,7 +3333,7 @@ function Pd({
3333
3333
  return;
3334
3334
  }
3335
3335
  try {
3336
- await S.request(Lo(`/items/${a}/${t}${dt}`)), ot(String(t)), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), (p == null ? void 0 : p.rowId) === String(t) && De(null), W && V.invalidateQueries({
3336
+ await S.request(Mo(`/items/${a}/${t}${dt}`)), ot(String(t)), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), (p == null ? void 0 : p.rowId) === String(t) && De(null), W && V.invalidateQueries({
3337
3337
  queryKey: ["o2m-field-snapshots", a, f, v]
3338
3338
  });
3339
3339
  } catch {
@@ -3351,42 +3351,42 @@ function Pd({
3351
3351
  if (e.interface === "formula-column") {
3352
3352
  const m = typeof i.column_formula == "string" ? i.column_formula : "";
3353
3353
  if (!m || !t && !r) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
3354
- const g = r ?? $.find((x) => String(x.id) === t) ?? {}, b = (x) => typeof x == "string" && /^-?\d+(\.\d+)?$/.test(x.trim()) ? Number(x) : x, h = pt(
3354
+ const h = r ?? $.find((x) => String(x.id) === t) ?? {}, b = (x) => typeof x == "string" && /^-?\d+(\.\d+)?$/.test(x.trim()) ? Number(x) : x, g = pt(
3355
3355
  m,
3356
3356
  (x) => {
3357
3357
  var R, I;
3358
3358
  return b(
3359
- x.includes(".") ? t ? (I = (R = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : R[x]) == null ? void 0 : I.value : void 0 : g[x]
3359
+ x.includes(".") ? t ? (I = (R = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : R[x]) == null ? void 0 : I.value : void 0 : h[x]
3360
3360
  );
3361
3361
  }
3362
3362
  );
3363
- if (h === null) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
3364
- const w = h.toLocaleString(
3363
+ if (g === null) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
3364
+ const w = g.toLocaleString(
3365
3365
  "en-US",
3366
3366
  bt(i, i.format)
3367
3367
  ), y = m.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (x, R) => {
3368
3368
  var B, F;
3369
- const I = R.includes(".") ? t ? (F = (B = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : B[R]) == null ? void 0 : F.value : void 0 : g[R];
3369
+ const I = R.includes(".") ? t ? (F = (B = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : B[R]) == null ? void 0 : F.value : void 0 : h[R];
3370
3370
  return I == null || I === "" ? "0" : String(I);
3371
3371
  });
3372
3372
  return /* @__PURE__ */ s("span", { className: "tabular-nums", "data-tip": `${m} = ${y} = ${w}`, children: w });
3373
3373
  }
3374
3374
  if (e.interface === "match-agg-column") {
3375
- const m = ia.get(e.field);
3375
+ const m = sa.get(e.field);
3376
3376
  if (!m || !t) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
3377
- const g = $.find((x) => String(x.id) === t) ?? {}, b = (x, R) => R.split(".").reduce(
3377
+ const h = $.find((x) => String(x.id) === t) ?? {}, b = (x, R) => R.split(".").reduce(
3378
3378
  (I, B) => I && typeof I == "object" ? I[B] : void 0,
3379
3379
  x
3380
- ), h = m.rows.filter(
3380
+ ), g = m.rows.filter(
3381
3381
  (x) => m.cfg.rowKeys.every(([R, I]) => {
3382
- const B = b(x, R), F = g[I];
3382
+ const B = b(x, R), F = h[I];
3383
3383
  return B == null || F === null || F === void 0 ? !1 : String(B) === String(F);
3384
3384
  })
3385
3385
  );
3386
- let w = m.cfg.aggregate === "count" ? h.length : h.reduce((x, R) => x + (Number(R[m.cfg.valueField]) || 0), 0);
3386
+ let w = m.cfg.aggregate === "count" ? g.length : g.reduce((x, R) => x + (Number(R[m.cfg.valueField]) || 0), 0);
3387
3387
  if (m.cfg.formula) {
3388
3388
  const x = pt(m.cfg.formula, {
3389
- ...g,
3389
+ ...h,
3390
3390
  __agg__: w
3391
3391
  });
3392
3392
  if (x === null) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
@@ -3416,16 +3416,16 @@ function Pd({
3416
3416
  }
3417
3417
  if (n == null) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
3418
3418
  if (e.interface === "relation-path" && le && t) {
3419
- const m = _o(e), g = (u = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : u[e.field], b = Ae == null ? void 0 : Ae.targets[e.field];
3420
- if (m && g && b && g.ids.length > 0)
3419
+ const m = ko(e), h = (u = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : u[e.field], b = Ae == null ? void 0 : Ae.targets[e.field];
3420
+ if (m && h && b && h.ids.length > 0)
3421
3421
  return /* @__PURE__ */ s(
3422
3422
  "button",
3423
3423
  {
3424
3424
  type: "button",
3425
- onClick: (h) => {
3426
- h.stopPropagation(), le.open({
3425
+ onClick: (g) => {
3426
+ g.stopPropagation(), le.open({
3427
3427
  collection: b,
3428
- itemId: g.ids[0],
3428
+ itemId: h.ids[0],
3429
3429
  layoutId: m.layout_id,
3430
3430
  width: m.width,
3431
3431
  title: String(n)
@@ -3439,11 +3439,11 @@ function Pd({
3439
3439
  const o = Ve.get(e.field);
3440
3440
  if (o != null && o.one_collection) {
3441
3441
  const m = (d = pn[o.one_collection]) == null ? void 0 : d[String(n)];
3442
- if (!m && Sa)
3442
+ if (!m && $a)
3443
3443
  return /* @__PURE__ */ s(vn, { className: "h-3 w-3 animate-spin text-slate-300" });
3444
- const g = le ? _o(e) : null, b = n != null && ((l = gi.get(e.field)) == null ? void 0 : l.has(String(n))) === !0;
3445
- let h;
3446
- return g && le ? h = /* @__PURE__ */ s(
3444
+ const h = le ? ko(e) : null, b = n != null && ((l = gi.get(e.field)) == null ? void 0 : l.has(String(n))) === !0;
3445
+ let g;
3446
+ return h && le ? g = /* @__PURE__ */ s(
3447
3447
  "button",
3448
3448
  {
3449
3449
  type: "button",
@@ -3451,15 +3451,15 @@ function Pd({
3451
3451
  w.stopPropagation(), le.open({
3452
3452
  collection: o.one_collection,
3453
3453
  itemId: String(n),
3454
- layoutId: g.layout_id,
3455
- width: g.width,
3454
+ layoutId: h.layout_id,
3455
+ width: h.width,
3456
3456
  title: m ?? String(n)
3457
3457
  });
3458
3458
  },
3459
3459
  className: "block max-w-full truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
3460
3460
  children: m ?? String(n)
3461
3461
  }
3462
- ) : h = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(Vl, { children: h }) : h;
3462
+ ) : g = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(Vl, { children: g }) : g;
3463
3463
  }
3464
3464
  if (e.type === "boolean")
3465
3465
  return /* @__PURE__ */ s("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
@@ -3487,21 +3487,21 @@ function Pd({
3487
3487
  const m = Number(n);
3488
3488
  if (!Number.isNaN(m))
3489
3489
  try {
3490
- const g = e.options ? typeof e.options == "string" ? JSON.parse(e.options) : e.options : {}, b = g.format;
3490
+ const h = e.options ? typeof e.options == "string" ? JSON.parse(e.options) : e.options : {}, b = h.format;
3491
3491
  if (b === "int")
3492
3492
  return /* @__PURE__ */ s("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(m) });
3493
3493
  if (b === "decimal") {
3494
- const h = typeof g.precision == "number" ? g.precision : 2;
3494
+ const g = typeof h.precision == "number" ? h.precision : 2;
3495
3495
  return /* @__PURE__ */ s("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
3496
- minimumFractionDigits: h,
3497
- maximumFractionDigits: h
3496
+ minimumFractionDigits: g,
3497
+ maximumFractionDigits: g
3498
3498
  }).format(m) });
3499
3499
  }
3500
3500
  if (b === "currency") {
3501
- const h = g.currency || "USD";
3501
+ const g = h.currency || "USD";
3502
3502
  return /* @__PURE__ */ s("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
3503
3503
  ...bt(i, "currency"),
3504
- currency: h
3504
+ currency: g
3505
3505
  }).format(m) });
3506
3506
  }
3507
3507
  } catch {
@@ -3509,9 +3509,9 @@ function Pd({
3509
3509
  }
3510
3510
  return /* @__PURE__ */ s("span", { className: "block truncate", children: String(n) });
3511
3511
  }
3512
- if (es || !O && nn)
3512
+ if (ts || !O && nn)
3513
3513
  return /* @__PURE__ */ s("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ s(vn, { className: "h-4 w-4 animate-spin inline" }) });
3514
- const Ir = (p == null ? void 0 : p.rowId) === "new", at = en && Le === "original" && !j, St = (at ? 1 : 0) + (te && (C || O || K) ? 1 : 0) + (A ? 1 : 0) + (O || K ? 1 : 0) + Re.length + 1, Jn = at ? "select" : te && (C || K) ? "reorder" : A ? "num" : K ? "status" : "data", zn = (e) => {
3514
+ const Ar = (p == null ? void 0 : p.rowId) === "new", at = en && Le === "original" && !j, St = (at ? 1 : 0) + (te && (C || O || K) ? 1 : 0) + (A ? 1 : 0) + (O || K ? 1 : 0) + Re.length + 1, Jn = at ? "select" : te && (C || K) ? "reorder" : A ? "num" : K ? "status" : "data", zn = (e) => {
3515
3515
  if (!Ot) return null;
3516
3516
  const n = Ot.added.has(e) ? "bg-emerald-500" : Ot.changed.has(e) ? "bg-amber-500" : null;
3517
3517
  return n ? /* @__PURE__ */ s(
@@ -3526,9 +3526,9 @@ function Pd({
3526
3526
  return Le !== "original" || (O || $.slice(0, cn).forEach((n, t) => {
3527
3527
  const r = String(n.id);
3528
3528
  if (!Je.has(r)) {
3529
- if (ds) {
3529
+ if (cs) {
3530
3530
  const i = In(n);
3531
- if (i !== null && cs.has(i)) return;
3531
+ if (i !== null && us.has(i)) return;
3532
3532
  }
3533
3533
  e.push({
3534
3534
  key: r,
@@ -3540,7 +3540,7 @@ function Pd({
3540
3540
  }), M.forEach((n, t) => {
3541
3541
  e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
3542
3542
  })), e;
3543
- }, _i = at ? Qn().map((e) => e.key) : [], Ja = _i.length > 0 && _i.every((e) => Ut.has(e)), za = at ? Qn().filter((e) => Ut.has(e.key)) : [], Qa = () => {
3543
+ }, ki = at ? Qn().map((e) => e.key) : [], za = ki.length > 0 && ki.every((e) => Ut.has(e)), Qa = at ? Qn().filter((e) => Ut.has(e.key)) : [], Fa = () => {
3544
3544
  var t;
3545
3545
  const e = Ge.current;
3546
3546
  if (!e) return !1;
@@ -3548,42 +3548,42 @@ function Pd({
3548
3548
  const n = ((t = Qn().find((r) => r.key === e.rowId)) == null ? void 0 : t.row) ?? {};
3549
3549
  for (const [r, i] of Object.entries(e.draft)) {
3550
3550
  if (r.startsWith("__")) {
3551
- if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(Mr))
3551
+ if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(Kr))
3552
3552
  return !0;
3553
3553
  continue;
3554
3554
  }
3555
- if (!Hr.has(r) && Ne.some((o) => o.field === r) && String(i ?? "") !== String(n[r] ?? ""))
3555
+ if (!Yr.has(r) && Ne.some((o) => o.field === r) && String(i ?? "") !== String(n[r] ?? ""))
3556
3556
  return !0;
3557
3557
  }
3558
3558
  return !1;
3559
- }, Fa = async (e) => {
3559
+ }, Va = async (e) => {
3560
3560
  const n = Ge.current;
3561
3561
  if (!n || n.rowId === "new") return;
3562
3562
  const t = Qn(), r = t.findIndex((c) => c.key === n.rowId);
3563
3563
  if (r < 0) return;
3564
3564
  const i = r + e;
3565
3565
  if (i < 0 || i >= t.length) return;
3566
- if (Qa()) {
3566
+ if (Fa()) {
3567
3567
  if (!await jt()) return;
3568
3568
  } else
3569
3569
  Un();
3570
3570
  const o = t[i];
3571
- o.kind === "pending" ? Bs(o.row, o.idx) : qr(o.row), window.setTimeout(() => {
3571
+ o.kind === "pending" ? Hs(o.row, o.idx) : Er(o.row), window.setTimeout(() => {
3572
3572
  const c = document.querySelector(
3573
3573
  `[data-o2m-row="${a}:${o.key}"]`
3574
3574
  );
3575
3575
  c && (c.focus({ preventScroll: !0 }), c.scrollIntoView({ block: "nearest" }));
3576
3576
  }, 0);
3577
3577
  };
3578
- Di.current = Fa;
3579
- async function Va(e) {
3580
- await fo(
3578
+ Wi.current = Va;
3579
+ async function Ba(e) {
3580
+ await mo(
3581
3581
  e,
3582
3582
  Qn().filter((n) => Ut.has(n.key)),
3583
3583
  { clearSelection: !0, noun: "row" }
3584
3584
  );
3585
3585
  }
3586
- const Ba = () => {
3586
+ const Ha = () => {
3587
3587
  const e = [];
3588
3588
  return Le !== "original" || (O || $.forEach((n, t) => {
3589
3589
  const r = String(n.id);
@@ -3597,21 +3597,21 @@ function Pd({
3597
3597
  e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
3598
3598
  })), e;
3599
3599
  };
3600
- async function fo(e, n, t) {
3600
+ async function mo(e, n, t) {
3601
3601
  const r = Object.keys(e);
3602
3602
  if (r.length === 0 || n.length === 0) return;
3603
- const i = (L ?? []).filter((g) => g.target_type !== "lock").map((g) => g.target_field).filter((g) => typeof g == "string" && g.length > 0 && g !== "id"), o = /* @__PURE__ */ new Set([
3604
- ...Ne.map((g) => g.field).filter((g) => !g.includes(".") && !g.startsWith("__")),
3603
+ const i = (L ?? []).filter((h) => h.target_type !== "lock").map((h) => h.target_field).filter((h) => typeof h == "string" && h.length > 0 && h !== "id"), o = /* @__PURE__ */ new Set([
3604
+ ...Ne.map((h) => h.field).filter((h) => !h.includes(".") && !h.startsWith("__")),
3605
3605
  ...i
3606
3606
  ]), c = [];
3607
- for (const g of n) {
3608
- let b = ce({ ...g.row, ...e }), h = [], w;
3607
+ for (const h of n) {
3608
+ let b = ce({ ...h.row, ...e }), g = [], w;
3609
3609
  if (L != null && L.length) {
3610
3610
  try {
3611
3611
  const x = await S.request(
3612
3612
  Ke("/field-rules/evaluate", {
3613
3613
  collection: a,
3614
- data: g.row,
3614
+ data: h.row,
3615
3615
  locks_only: !0,
3616
3616
  probe: !0,
3617
3617
  parent_context: At(),
@@ -3619,12 +3619,12 @@ function Pd({
3619
3619
  row_rules: L
3620
3620
  })
3621
3621
  );
3622
- h = x.locks ?? [], w = x.expected;
3622
+ g = x.locks ?? [], w = x.expected;
3623
3623
  } catch {
3624
3624
  }
3625
3625
  for (const x of r) {
3626
- if (h.includes(x)) continue;
3627
- const R = bi(x, { ...g.row }, w), I = { ...b };
3626
+ if (g.includes(x)) continue;
3627
+ const R = yi(x, { ...h.row }, w), I = { ...b };
3628
3628
  for (const B of R) I[B] = null;
3629
3629
  try {
3630
3630
  const B = await S.request(
@@ -3641,38 +3641,38 @@ function Pd({
3641
3641
  for (const [Me, Y] of Object.entries(B.updates ?? {}))
3642
3642
  Me in e || (F[Me] = Y);
3643
3643
  for (const Me of R) !(Me in F) && !(Me in e) && (F[Me] = null);
3644
- b = ce({ ...b, ...F }), h = B.locks ?? h, w = B.expected ?? w;
3644
+ b = ce({ ...b, ...F }), g = B.locks ?? g, w = B.expected ?? w;
3645
3645
  } catch {
3646
3646
  }
3647
3647
  }
3648
3648
  }
3649
3649
  const y = {};
3650
- for (const x of r) h.includes(x) || (y[x] = e[x] ?? null);
3650
+ for (const x of r) g.includes(x) || (y[x] = e[x] ?? null);
3651
3651
  for (const [x, R] of Object.entries(b))
3652
- x in y || x === "id" || x === f || Hr.has(x) || !o.has(x) || String(R ?? "") !== String(g.row[x] ?? "") && (y[x] = R);
3653
- c.push({ t: g, changes: y });
3652
+ x in y || x === "id" || x === f || Yr.has(x) || !o.has(x) || String(R ?? "") !== String(h.row[x] ?? "") && (y[x] = R);
3653
+ c.push({ t: h, changes: y });
3654
3654
  }
3655
- const u = (g, b) => {
3656
- t.clearSelection && rr(/* @__PURE__ */ new Set());
3657
- const h = g === 1 ? t.noun : `${t.noun}s`;
3655
+ const u = (h, b) => {
3656
+ t.clearSelection && ir(/* @__PURE__ */ new Set());
3657
+ const g = h === 1 ? t.noun : `${t.noun}s`;
3658
3658
  b.length ? Se.error(
3659
- `Applied to ${g} ${h} — ${b.length} failed: ${b.slice(0, 3).join("; ")}`
3660
- ) : Se.success(`Applied to ${g} ${h}`);
3659
+ `Applied to ${h} ${g} — ${b.length} failed: ${b.slice(0, 3).join("; ")}`
3660
+ ) : Se.success(`Applied to ${h} ${g}`);
3661
3661
  };
3662
3662
  if ((O || K) && k) {
3663
- let g = 0;
3664
- for (const { t: b, changes: h } of c)
3665
- Object.keys(h).length !== 0 && (b.kind === "pending" ? k.updateRow(a, f, b.idx, {
3663
+ let h = 0;
3664
+ for (const { t: b, changes: g } of c)
3665
+ Object.keys(g).length !== 0 && (b.kind === "pending" ? k.updateRow(a, f, b.idx, {
3666
3666
  ...M[b.idx] ?? b.row,
3667
- ...h
3668
- }) : k.queueEdit(a, f, b.key, h), g++);
3669
- u(g, []);
3667
+ ...g
3668
+ }) : k.queueEdit(a, f, b.key, g), h++);
3669
+ u(h, []);
3670
3670
  return;
3671
3671
  }
3672
3672
  let d = 0;
3673
- const l = [], m = async (g, b) => {
3674
- for (let h = g; h < c.length; h++) {
3675
- const { t: w, changes: y } = c[h];
3673
+ const l = [], m = async (h, b) => {
3674
+ for (let g = h; g < c.length; g++) {
3675
+ const { t: w, changes: y } = c[g];
3676
3676
  if (Object.keys(y).length !== 0) {
3677
3677
  if (w.kind === "pending") {
3678
3678
  k == null || k.updateRow(a, f, w.idx, {
@@ -3689,12 +3689,12 @@ function Pd({
3689
3689
  )
3690
3690
  ), ot(w.key), d++;
3691
3691
  } catch (x) {
3692
- const R = b ? null : $i(x);
3692
+ const R = b ? null : qi(x);
3693
3693
  if (R) {
3694
- qn({ challenge: R, retry: (I) => m(h, I) }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3694
+ qn({ challenge: R, retry: (I) => m(g, I) }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3695
3695
  return;
3696
3696
  }
3697
- l.push(`#${w.key} ${(x == null ? void 0 : x.message) ?? "failed"}`);
3697
+ l.push(`#${w.key} ${Gn(x, "failed")}`);
3698
3698
  }
3699
3699
  }
3700
3700
  }
@@ -3702,15 +3702,15 @@ function Pd({
3702
3702
  };
3703
3703
  await m(0);
3704
3704
  }
3705
- if (Wr.current = (e, n) => fo({ [e]: n }, Ba(), {
3705
+ if (Ur.current = (e, n) => mo({ [e]: n }, Ha(), {
3706
3706
  clearSelection: !1,
3707
3707
  noun: "line"
3708
- }), Wi.current = !0, nr.current) {
3709
- const e = nr.current;
3710
- nr.current = null, window.setTimeout(() => void Wr.current(e.target, e.value), 0);
3708
+ }), Ui.current = !0, rr.current) {
3709
+ const e = rr.current;
3710
+ rr.current = null, window.setTimeout(() => void Ur.current(e.target, e.value), 0);
3711
3711
  }
3712
- const lt = _e ? "split" : Re.filter((e) => !st(e)).length >= 6 ? "panel" : "inline", Ar = (e) => {
3713
- const n = ai == null ? void 0 : ai.display_template;
3712
+ const lt = _e ? "split" : Re.filter((e) => !st(e)).length >= 6 ? "panel" : "inline", jr = (e) => {
3713
+ const n = li == null ? void 0 : li.display_template;
3714
3714
  if (n) {
3715
3715
  const t = Bn(n, e).trim();
3716
3716
  if (t && t !== "-" && t !== String(e.id ?? ""))
@@ -3736,13 +3736,13 @@ function Pd({
3736
3736
  }
3737
3737
  let c = null;
3738
3738
  for (const u of (o == null ? void 0 : o.sources) ?? []) {
3739
- const d = (G ?? []).map((h) => typeof h == "string" ? h : h.field), l = d.find((h) => h === u.related_collection) ?? (d.length === 1 ? d[0] : void 0), m = l ? e[`__o2m_${l}`] : void 0, g = (l ? mr[`${t}|${l}`] : void 0) ?? m;
3740
- if (!g) continue;
3739
+ const d = (G ?? []).map((g) => typeof g == "string" ? g : g.field), l = d.find((g) => g === u.related_collection) ?? (d.length === 1 ? d[0] : void 0), m = l ? e[`__o2m_${l}`] : void 0, h = (l ? pr[`${t}|${l}`] : void 0) ?? m;
3740
+ if (!h) continue;
3741
3741
  const b = u.aggregate ?? "sum";
3742
- if (b === "count") c = (c ?? 0) + g.length;
3742
+ if (b === "count") c = (c ?? 0) + h.length;
3743
3743
  else {
3744
- const h = g.map((w) => Number(w[u.value_field ?? ""] ?? 0)).filter(Number.isFinite);
3745
- b === "sum" ? c = (c ?? 0) + h.reduce((w, y) => w + y, 0) : b === "avg" ? c = (c ?? 0) + (h.length ? h.reduce((w, y) => w + y, 0) / h.length : 0) : b === "min" ? c = (c ?? 0) + (h.length ? Math.min(...h) : 0) : b === "max" && (c = (c ?? 0) + (h.length ? Math.max(...h) : 0));
3744
+ const g = h.map((w) => Number(w[u.value_field ?? ""] ?? 0)).filter(Number.isFinite);
3745
+ b === "sum" ? c = (c ?? 0) + g.reduce((w, y) => w + y, 0) : b === "avg" ? c = (c ?? 0) + (g.length ? g.reduce((w, y) => w + y, 0) / g.length : 0) : b === "min" ? c = (c ?? 0) + (g.length ? Math.min(...g) : 0) : b === "max" && (c = (c ?? 0) + (g.length ? Math.max(...g) : 0));
3746
3746
  }
3747
3747
  }
3748
3748
  c != null && (r[i.field] = c);
@@ -3753,17 +3753,17 @@ function Pd({
3753
3753
  o != null && (r[i.field] = o);
3754
3754
  }
3755
3755
  return r;
3756
- }, jr = (e, n) => !G || G.length === 0 ? null : /* @__PURE__ */ s("div", { className: "mt-3 space-y-2 border-t border-slate-100 pt-3 dark:border-border", children: G.map((t) => {
3757
- const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, c = o ? Rr(o, n, v, N == null ? void 0 : N.draft) : null;
3756
+ }, Tr = (e, n) => !G || G.length === 0 ? null : /* @__PURE__ */ s("div", { className: "mt-3 space-y-2 border-t border-slate-100 pt-3 dark:border-border", children: G.map((t) => {
3757
+ const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, c = o ? Pr(o, n, v, N == null ? void 0 : N.draft) : null;
3758
3758
  return /* @__PURE__ */ s(
3759
- Ii,
3759
+ Ai,
3760
3760
  {
3761
3761
  parentCollection: a,
3762
3762
  relationField: r,
3763
3763
  parentRowId: e ?? null,
3764
3764
  parentDraft: n,
3765
3765
  hint: i,
3766
- onRowsChange: (u) => pr((d) => ({
3766
+ onRowsChange: (u) => hr((d) => ({
3767
3767
  ...d,
3768
3768
  [`${e ?? "__new__"}|${r}`]: u
3769
3769
  })),
@@ -3776,12 +3776,12 @@ function Pd({
3776
3776
  // rows with the line's queued edit, like the FK mode.
3777
3777
  ...e && K ? {
3778
3778
  deferred: !0,
3779
- stagedOps: n[`__nested_ops_${r}`] ?? Mr,
3779
+ stagedOps: n[`__nested_ops_${r}`] ?? Kr,
3780
3780
  onStagedOpsChange: (u) => mt(`__nested_ops_${r}`, u)
3781
3781
  } : {}
3782
3782
  } : e ? K ? {
3783
3783
  deferred: !0,
3784
- stagedOps: n[`__nested_ops_${r}`] ?? Mr,
3784
+ stagedOps: n[`__nested_ops_${r}`] ?? Kr,
3785
3785
  onStagedOpsChange: (u) => mt(`__nested_ops_${r}`, u)
3786
3786
  } : {} : {
3787
3787
  // UNSAVED row: members stage under __o2m_<field> in the
@@ -3796,7 +3796,7 @@ function Pd({
3796
3796
  },
3797
3797
  r
3798
3798
  );
3799
- }) }), Vn = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || st(e), mo = (e) => {
3799
+ }) }), Vn = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || st(e), po = (e) => {
3800
3800
  var n;
3801
3801
  return /* @__PURE__ */ _(
3802
3802
  "div",
@@ -3829,10 +3829,10 @@ function Pd({
3829
3829
  "button",
3830
3830
  {
3831
3831
  type: "button",
3832
- disabled: gt,
3832
+ disabled: ht,
3833
3833
  onClick: jt,
3834
3834
  className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
3835
- children: gt ? "Saving…" : e.saveLabel
3835
+ children: ht ? "Saving…" : e.saveLabel
3836
3836
  }
3837
3837
  )
3838
3838
  ] })
@@ -3854,8 +3854,8 @@ function Pd({
3854
3854
  })() : i.options : {}, d = typeof u.column_formula == "string" ? u.column_formula : "", l = i.interface === "formula-column" && d ? pt(
3855
3855
  d,
3856
3856
  (m) => {
3857
- var g, b;
3858
- return m.includes(".") ? (b = (g = Ae == null ? void 0 : Ae.rows[e.rowId ?? ""]) == null ? void 0 : g[m]) == null ? void 0 : b.value : r[m];
3857
+ var h, b;
3858
+ return m.includes(".") ? (b = (h = Ae == null ? void 0 : Ae.rows[e.rowId ?? ""]) == null ? void 0 : h[m]) == null ? void 0 : b.value : r[m];
3859
3859
  }
3860
3860
  ) : null;
3861
3861
  return /* @__PURE__ */ _("div", { className: "flex min-w-0 flex-col justify-start", children: [
@@ -3868,7 +3868,7 @@ function Pd({
3868
3868
  }) });
3869
3869
  })();
3870
3870
  })(),
3871
- Ps(e.rowId),
3871
+ Ds(e.rowId),
3872
3872
  /* @__PURE__ */ s(
3873
3873
  "div",
3874
3874
  {
@@ -3886,7 +3886,7 @@ function Pd({
3886
3886
  return /* @__PURE__ */ _(
3887
3887
  "div",
3888
3888
  {
3889
- "data-grid-cell": Yi(e.rowId, t.field),
3889
+ "data-grid-cell": Gi(e.rowId, t.field),
3890
3890
  className: ve(
3891
3891
  "flex min-w-0 flex-col gap-1",
3892
3892
  c && "rounded-md [&_input]:border-red-400 [&_input]:ring-1 [&_input]:ring-red-300 [&_button]:border-red-400 [&_button]:ring-1 [&_button]:ring-red-300 dark:[&_input]:border-red-600 dark:[&_input]:ring-red-800 dark:[&_button]:border-red-600 dark:[&_button]:ring-red-800"
@@ -3904,12 +3904,12 @@ function Pd({
3904
3904
  c && /* @__PURE__ */ s("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
3905
3905
  (() => {
3906
3906
  var w, y;
3907
- const m = qa(t.field);
3907
+ const m = Ea(t.field);
3908
3908
  if (!m) return null;
3909
- const g = Ve.get(t.field), b = (x) => {
3909
+ const h = Ve.get(t.field), b = (x) => {
3910
3910
  var R;
3911
- return (g != null && g.one_collection ? (R = pn[g.one_collection]) == null ? void 0 : R[String(x)] : void 0) ?? String(x);
3912
- }, h = (x) => {
3911
+ return (h != null && h.one_collection ? (R = pn[h.one_collection]) == null ? void 0 : R[String(x)] : void 0) ?? String(x);
3912
+ }, g = (x) => {
3913
3913
  var R;
3914
3914
  return ((R = Ne.find((I) => I.field === x)) == null ? void 0 : R.label) ?? x.replace(/_/g, " ");
3915
3915
  };
@@ -3919,8 +3919,8 @@ function Pd({
3919
3919
  kind: m,
3920
3920
  provenance: (w = p == null ? void 0 : p.provenance) == null ? void 0 : w[t.field],
3921
3921
  labelOf: b,
3922
- fieldLabel: h,
3923
- onReset: m === "overridden" && !j && !((y = p == null ? void 0 : p.locks) != null && y.includes(t.field)) ? () => Ea(t.field) : void 0
3922
+ fieldLabel: g,
3923
+ onReset: m === "overridden" && !j && !((y = p == null ? void 0 : p.locks) != null && y.includes(t.field)) ? () => Oa(t.field) : void 0
3924
3924
  }
3925
3925
  );
3926
3926
  })()
@@ -3930,12 +3930,12 @@ function Pd({
3930
3930
  r ? /* @__PURE__ */ s("div", { className: "text-[12px] italic text-slate-500", children: Ue(
3931
3931
  t,
3932
3932
  Rt(t.computed_formula, e.draft) ?? e.draft[t.field]
3933
- ) }) : o || t.readonly || (d = p == null ? void 0 : p.locks) != null && d.includes(t.field) || ii(t.field, e.draft) ? /* @__PURE__ */ s(
3933
+ ) }) : o || t.readonly || (d = p == null ? void 0 : p.locks) != null && d.includes(t.field) || si(t.field, e.draft) ? /* @__PURE__ */ s(
3934
3934
  "div",
3935
3935
  {
3936
3936
  className: "text-[12px] text-slate-500",
3937
- "data-compare-locked": ii(t.field, e.draft) ? t.field : void 0,
3938
- "data-tip": (l = p == null ? void 0 : p.locks) != null && l.includes(t.field) ? Hs(t.field) : ii(t.field, e.draft) ? (q == null ? void 0 : q.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
3937
+ "data-compare-locked": si(t.field, e.draft) ? t.field : void 0,
3938
+ "data-tip": (l = p == null ? void 0 : p.locks) != null && l.includes(t.field) ? Ys(t.field) : si(t.field, e.draft) ? (q == null ? void 0 : q.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
3939
3939
  children: Ue(t, e.draft[t.field], e.rowId)
3940
3940
  }
3941
3941
  ) : p != null && p.locksPending && Nn.has(t.field) ? (
@@ -3964,7 +3964,7 @@ function Pd({
3964
3964
  }
3965
3965
  ),
3966
3966
  q && q.columns.includes(t.field) && (() => {
3967
- const m = Oi(q, e.draft), g = m == null ? void 0 : m.values[t.field], b = Kt(
3967
+ const m = Ii(q, e.draft), h = m == null ? void 0 : m.values[t.field], b = Kt(
3968
3968
  q,
3969
3969
  e.draft[q.key_field],
3970
3970
  t.field
@@ -3976,14 +3976,14 @@ function Pd({
3976
3976
  className: "mt-1 flex items-center gap-1 text-[11px] text-slate-500 dark:text-muted-foreground",
3977
3977
  children: [
3978
3978
  /* @__PURE__ */ s("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children: q.label }),
3979
- /* @__PURE__ */ s("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: g == null ? "—" : qi(g) }),
3979
+ /* @__PURE__ */ s("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: h == null ? "—" : Ei(h) }),
3980
3980
  b && /* @__PURE__ */ _(
3981
3981
  "span",
3982
3982
  {
3983
3983
  className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
3984
- "data-tip": q.closed_locked && ri ? `${q.closed_rule ?? ""} A change here needs a reason.`.trim() : q.closed_rule,
3984
+ "data-tip": q.closed_locked && ii ? `${q.closed_rule ?? ""} A change here needs a reason.`.trim() : q.closed_rule,
3985
3985
  children: [
3986
- /* @__PURE__ */ s(tl, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
3986
+ /* @__PURE__ */ s(nl, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
3987
3987
  " closed"
3988
3988
  ]
3989
3989
  }
@@ -3994,11 +3994,11 @@ function Pd({
3994
3994
  data: q,
3995
3995
  rowKey: e.draft[q.key_field],
3996
3996
  column: t.field,
3997
- columnLabel: br(t),
3997
+ columnLabel: yr(t),
3998
3998
  plannedRow: e.draft,
3999
- actual: g ?? 0,
3999
+ actual: h ?? 0,
4000
4000
  variant: "button",
4001
- onApply: (h, w) => yi({ ...h, _change_reason: w })
4001
+ onApply: (g, w) => xi({ ...g, _change_reason: w })
4002
4002
  }
4003
4003
  )
4004
4004
  ]
@@ -4018,7 +4018,7 @@ function Pd({
4018
4018
  config: be,
4019
4019
  draft: e.draft,
4020
4020
  remaining: pt(be.remaining, Vt),
4021
- onApply: yi,
4021
+ onApply: xi,
4022
4022
  closedFields: q ? new Set(
4023
4023
  be.fields.filter(
4024
4024
  (t) => Kt(q, e.draft[q.key_field], t)
@@ -4045,11 +4045,11 @@ function Pd({
4045
4045
  ]
4046
4046
  }
4047
4047
  );
4048
- }, ki = (e) => /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: mo(e) }), po = (e, n) => {
4048
+ }, Ni = (e) => /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: po(e) }), ho = (e, n) => {
4049
4049
  const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
4050
- di.current.add(Ws(e.rowKey, e.editor)), Yt(null);
4050
+ ci.current.add(Us(e.rowKey, e.editor)), Yt(null);
4051
4051
  const i = $.find((o) => String(o.id) === e.rowKey);
4052
- i && qr(H.has(e.rowKey) ? { ...i, ...H.get(e.rowKey) } : i);
4052
+ i && Er(H.has(e.rowKey) ? { ...i, ...H.get(e.rowKey) } : i);
4053
4053
  };
4054
4054
  return /* @__PURE__ */ _(
4055
4055
  "div",
@@ -4087,12 +4087,12 @@ function Pd({
4087
4087
  ]
4088
4088
  }
4089
4089
  );
4090
- }, go = Qr === Hn, Ha = go ? null : (_t == null ? void 0 : _t.name) ?? ((bo = Z == null ? void 0 : Z[0]) == null ? void 0 : bo.name), ho = Z && Z.length >= 2 && /* @__PURE__ */ _("div", { className: "flex items-center gap-1 text-[11px]", children: [
4090
+ }, go = Fr === Hn, Ya = go ? null : (_t == null ? void 0 : _t.name) ?? ((yo = Z == null ? void 0 : Z[0]) == null ? void 0 : yo.name), bo = Z && Z.length >= 2 && /* @__PURE__ */ _("div", { className: "flex items-center gap-1 text-[11px]", children: [
4091
4091
  /* @__PURE__ */ s(
4092
4092
  "button",
4093
4093
  {
4094
4094
  type: "button",
4095
- onClick: () => Zi(Hn),
4095
+ onClick: () => es(Hn),
4096
4096
  className: ve(
4097
4097
  "h-6 px-2.5 rounded border transition-colors",
4098
4098
  go ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
@@ -4104,10 +4104,10 @@ function Pd({
4104
4104
  "button",
4105
4105
  {
4106
4106
  type: "button",
4107
- onClick: () => Zi(e.name),
4107
+ onClick: () => es(e.name),
4108
4108
  className: ve(
4109
4109
  "h-6 px-2.5 rounded border transition-colors",
4110
- Ha === e.name ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4110
+ Ya === e.name ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4111
4111
  ),
4112
4112
  children: e.name
4113
4113
  },
@@ -4123,16 +4123,16 @@ function Pd({
4123
4123
  {
4124
4124
  className: "space-y-1.5",
4125
4125
  "data-o2m-collection": a,
4126
- onFocusCapture: Xo,
4127
- onBlurCapture: Co,
4126
+ onFocusCapture: Co,
4127
+ onBlurCapture: Zo,
4128
4128
  children: [
4129
4129
  /* @__PURE__ */ s(
4130
- rl,
4130
+ il,
4131
4131
  {
4132
- challenge: (lr == null ? void 0 : lr.challenge) ?? null,
4132
+ challenge: (dr == null ? void 0 : dr.challenge) ?? null,
4133
4133
  onCancel: () => qn(null),
4134
4134
  onSubmit: (e) => {
4135
- const n = lr;
4135
+ const n = dr;
4136
4136
  qn(null), n == null || n.retry(e);
4137
4137
  }
4138
4138
  }
@@ -4146,7 +4146,7 @@ function Pd({
4146
4146
  min: 1,
4147
4147
  max: 100,
4148
4148
  value: Gt,
4149
- onChange: (e) => Ta(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
4149
+ onChange: (e) => La(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
4150
4150
  className: "w-14 h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-700 text-center focus:outline-none focus:ring-1 focus:ring-nvr-cyan"
4151
4151
  }
4152
4152
  ),
@@ -4155,7 +4155,7 @@ function Pd({
4155
4155
  {
4156
4156
  type: "button",
4157
4157
  disabled: Xt,
4158
- onClick: () => lo(!1),
4158
+ onClick: () => co(!1),
4159
4159
  className: "h-6 px-2.5 rounded border border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 disabled:opacity-40 transition-colors",
4160
4160
  children: [
4161
4161
  "blank ",
@@ -4172,7 +4172,7 @@ function Pd({
4172
4172
  {
4173
4173
  type: "button",
4174
4174
  disabled: Xt,
4175
- onClick: () => Da(e[0].field),
4175
+ onClick: () => Wa(e[0].field),
4176
4176
  "data-tip": `Generate ${Gt} rows with ${e[0].field} advancing one month per row (starting next month)`,
4177
4177
  className: "h-6 px-2.5 rounded border border-dashed border-slate-300 text-slate-500 hover:border-nvr-cyan/60 hover:text-slate-700 disabled:opacity-40 transition-colors",
4178
4178
  children: [
@@ -4228,7 +4228,7 @@ function Pd({
4228
4228
  config: e,
4229
4229
  rows: [...$, ...M.map((n, t) => ({ ...n, __pendingIndex: t }))],
4230
4230
  relatedCollection: a,
4231
- computedWriteFields: Hr,
4231
+ computedWriteFields: Yr,
4232
4232
  applyRow: async (n, t) => {
4233
4233
  const r = n.__pendingIndex;
4234
4234
  if (typeof r == "number" && k) {
@@ -4248,7 +4248,7 @@ function Pd({
4248
4248
  e.label
4249
4249
  )),
4250
4250
  Pt && !O && !j && Wt && E && /* @__PURE__ */ s(
4251
- hl,
4251
+ gl,
4252
4252
  {
4253
4253
  collection: E,
4254
4254
  templateFilter: (e) => {
@@ -4268,55 +4268,55 @@ function Pd({
4268
4268
  "button",
4269
4269
  {
4270
4270
  type: "button",
4271
- onClick: () => Vi((e) => !e),
4271
+ onClick: () => Bi((e) => !e),
4272
4272
  title: "Copy this table’s lines from another record",
4273
4273
  className: "h-6 rounded border border-slate-200 px-2.5 text-slate-600 transition-colors hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300",
4274
4274
  children: "Copy from…"
4275
4275
  }
4276
4276
  ),
4277
- Uo && /* @__PURE__ */ s("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ s(
4278
- Ai,
4277
+ Jo && /* @__PURE__ */ s("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ s(
4278
+ ji,
4279
4279
  {
4280
4280
  collection: E,
4281
4281
  value: null,
4282
4282
  onChange: (e) => {
4283
- e != null && zo(String(e));
4283
+ e != null && Qo(String(e));
4284
4284
  },
4285
4285
  placeholder: "Pick the record to copy from…"
4286
4286
  }
4287
4287
  ) })
4288
4288
  ] }),
4289
- Qs.length > 0 && /* @__PURE__ */ s(
4289
+ Fs.length > 0 && /* @__PURE__ */ s(
4290
4290
  "button",
4291
4291
  {
4292
4292
  type: "button",
4293
- onClick: () => La((e) => !e),
4293
+ onClick: () => Ma((e) => !e),
4294
4294
  className: ve(
4295
4295
  "h-6 px-2.5 rounded border transition-colors",
4296
- eo ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4296
+ to ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4297
4297
  ),
4298
4298
  children: "with defaults…"
4299
4299
  }
4300
4300
  ),
4301
- fi.length > 0 && /* @__PURE__ */ s(
4301
+ mi.length > 0 && /* @__PURE__ */ s(
4302
4302
  "button",
4303
4303
  {
4304
4304
  type: "button",
4305
- onClick: () => no((e) => !e),
4305
+ onClick: () => ro((e) => !e),
4306
4306
  className: ve(
4307
4307
  "h-6 px-2.5 rounded border transition-colors",
4308
- to ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4308
+ no ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4309
4309
  ),
4310
4310
  children: "apply values…"
4311
4311
  }
4312
4312
  ),
4313
- be && ((yo = be.fields) == null ? void 0 : yo.length) > 0 && be.across_rows !== !1 && $.length + M.length > 1 && /* @__PURE__ */ s(
4313
+ be && ((xo = be.fields) == null ? void 0 : xo.length) > 0 && be.across_rows !== !1 && $.length + M.length > 1 && /* @__PURE__ */ s(
4314
4314
  nd,
4315
4315
  {
4316
4316
  config: be,
4317
4317
  remaining: pt(be.remaining, Vt),
4318
4318
  rowNoun: q ? qe(q.key_field).toLowerCase() : "row",
4319
- onApply: fa
4319
+ onApply: ma
4320
4320
  }
4321
4321
  ),
4322
4322
  !!(L != null && L.length) && $.length + M.length > 0 && /* @__PURE__ */ s(
@@ -4324,11 +4324,11 @@ function Pd({
4324
4324
  {
4325
4325
  type: "button",
4326
4326
  onClick: () => {
4327
- Er((e) => !e), hn(null);
4327
+ Or((e) => !e), gn(null);
4328
4328
  },
4329
4329
  className: ve(
4330
4330
  "h-6 px-2.5 rounded border transition-colors",
4331
- ro ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4331
+ io ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4332
4332
  ),
4333
4333
  "data-tip": "Re-run this grid's auto-fill rules over every line, saved or not yet saved",
4334
4334
  children: "re-run rules…"
@@ -4342,14 +4342,14 @@ function Pd({
4342
4342
  "aria-pressed": en,
4343
4343
  "data-tip": en ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
4344
4344
  onClick: () => {
4345
- Po((e) => !e), rr(/* @__PURE__ */ new Set());
4345
+ Do((e) => !e), ir(/* @__PURE__ */ new Set());
4346
4346
  },
4347
4347
  className: ve(
4348
4348
  "inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
4349
4349
  en ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
4350
4350
  ),
4351
4351
  children: [
4352
- /* @__PURE__ */ s(Ya, { className: "h-3 w-3", "aria-hidden": "true" }),
4352
+ /* @__PURE__ */ s(Ga, { className: "h-3 w-3", "aria-hidden": "true" }),
4353
4353
  en ? "Selecting" : "Select rows"
4354
4354
  ]
4355
4355
  }
@@ -4358,11 +4358,11 @@ function Pd({
4358
4358
  "button",
4359
4359
  {
4360
4360
  type: "button",
4361
- onClick: () => Ui(!0),
4361
+ onClick: () => Ji(!0),
4362
4362
  "data-tip": "Set the same values on every selected line",
4363
4363
  className: "inline-flex h-6 items-center gap-1 rounded border border-amber-400 bg-amber-50 px-2 font-medium text-amber-700 transition-colors hover:border-amber-500 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300",
4364
4364
  children: [
4365
- /* @__PURE__ */ s(Ga, { className: "h-3 w-3", "aria-hidden": "true" }),
4365
+ /* @__PURE__ */ s(Xa, { className: "h-3 w-3", "aria-hidden": "true" }),
4366
4366
  "Edit ",
4367
4367
  Ut.size,
4368
4368
  " selected…"
@@ -4381,7 +4381,7 @@ function Pd({
4381
4381
  "inline-flex h-6 w-6 items-center justify-center rounded border transition-colors",
4382
4382
  _e ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
4383
4383
  ),
4384
- children: _e ? /* @__PURE__ */ s(Xa, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ s(Ca, { className: "h-3 w-3", "aria-hidden": "true" })
4384
+ children: _e ? /* @__PURE__ */ s(Ca, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ s(Za, { className: "h-3 w-3", "aria-hidden": "true" })
4385
4385
  }
4386
4386
  ),
4387
4387
  Xt && /* @__PURE__ */ s(vn, { className: "h-3 w-3 animate-spin text-slate-400" }),
@@ -4394,7 +4394,7 @@ function Pd({
4394
4394
  "data-grid-save-mode": "live",
4395
4395
  "data-tip": "Every change to a line here is saved the moment you make it — no Save needed",
4396
4396
  children: [
4397
- /* @__PURE__ */ s(Za, { className: "h-3 w-3", "aria-hidden": "true" }),
4397
+ /* @__PURE__ */ s(el, { className: "h-3 w-3", "aria-hidden": "true" }),
4398
4398
  "Saves as you go"
4399
4399
  ]
4400
4400
  }
@@ -4411,39 +4411,39 @@ function Pd({
4411
4411
  "data-grid-waiting": n,
4412
4412
  "data-tip": O ? "Lines are kept with this new record and saved when you create it" : "Changes to lines here wait for the record’s Save — Cancel discards them",
4413
4413
  children: [
4414
- /* @__PURE__ */ s(Ni, { className: "h-3 w-3", "aria-hidden": "true" }),
4414
+ /* @__PURE__ */ s(Si, { className: "h-3 w-3", "aria-hidden": "true" }),
4415
4415
  n > 0 ? `${n} line change${n === 1 ? "" : "s"} wait for Save` : "Saved with the record"
4416
4416
  ]
4417
4417
  }
4418
4418
  );
4419
4419
  })(),
4420
- ho,
4420
+ bo,
4421
4421
  W && !O && /* @__PURE__ */ s(
4422
4422
  "button",
4423
4423
  {
4424
4424
  type: "button",
4425
4425
  "data-tip": "Lines timeline — every line added, changed or removed on this record",
4426
- onClick: () => sr(!0),
4426
+ onClick: () => or(!0),
4427
4427
  className: "ml-auto rounded p-1 text-slate-300 hover:text-nvr-cyan",
4428
- children: /* @__PURE__ */ s(Lr, { className: "h-3.5 w-3.5" })
4428
+ children: /* @__PURE__ */ s(Mr, { className: "h-3.5 w-3.5" })
4429
4429
  }
4430
4430
  )
4431
4431
  ] }),
4432
- to && fi.length > 0 && /* @__PURE__ */ _("div", { className: "rounded-lg border border-amber-200 bg-amber-50/60 p-3 space-y-2 dark:border-amber-500/30 dark:bg-amber-400/10", children: [
4432
+ no && mi.length > 0 && /* @__PURE__ */ _("div", { className: "rounded-lg border border-amber-200 bg-amber-50/60 p-3 space-y-2 dark:border-amber-500/30 dark:bg-amber-400/10", children: [
4433
4433
  /* @__PURE__ */ _("p", { className: "text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
4434
4434
  "Apply values to all ",
4435
4435
  $.length + M.length,
4436
4436
  " rows"
4437
4437
  ] }),
4438
4438
  /* @__PURE__ */ _("div", { className: "flex flex-wrap gap-2 items-end", children: [
4439
- fi.map((e) => /* @__PURE__ */ _("div", { className: "min-w-[160px]", children: [
4439
+ mi.map((e) => /* @__PURE__ */ _("div", { className: "min-w-[160px]", children: [
4440
4440
  /* @__PURE__ */ s("p", { className: "text-[10px] text-slate-500 mb-0.5 dark:text-slate-400", children: e.label ?? qe(e.field) }),
4441
4441
  /* @__PURE__ */ s(
4442
4442
  yn,
4443
4443
  {
4444
4444
  field: e,
4445
4445
  value: Ct[e.field] ?? null,
4446
- onChange: (n) => so((t) => ({ ...t, [e.field]: n })),
4446
+ onChange: (n) => oo((t) => ({ ...t, [e.field]: n })),
4447
4447
  relations: We,
4448
4448
  collection: a,
4449
4449
  itemId: "new"
@@ -4454,15 +4454,15 @@ function Pd({
4454
4454
  "button",
4455
4455
  {
4456
4456
  type: "button",
4457
- disabled: oo || !($.length + M.length),
4458
- onClick: Pa,
4457
+ disabled: ao || !($.length + M.length),
4458
+ onClick: Da,
4459
4459
  className: "h-9 rounded px-3 bg-amber-500 text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
4460
- children: oo ? "Applying…" : `Apply to all ${$.length + M.length} rows`
4460
+ children: ao ? "Applying…" : `Apply to all ${$.length + M.length} rows`
4461
4461
  }
4462
4462
  )
4463
4463
  ] })
4464
4464
  ] }),
4465
- ro && !!(L != null && L.length) && /* @__PURE__ */ _("div", { className: "rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/5 p-3 space-y-2 dark:bg-nvr-cyan/5", children: [
4465
+ io && !!(L != null && L.length) && /* @__PURE__ */ _("div", { className: "rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/5 p-3 space-y-2 dark:bg-nvr-cyan/5", children: [
4466
4466
  /* @__PURE__ */ _("p", { className: "text-[11px] font-medium text-slate-700 dark:text-slate-200", children: [
4467
4467
  "Re-run rules on ",
4468
4468
  $.length + M.length,
@@ -4505,9 +4505,9 @@ function Pd({
4505
4505
  {
4506
4506
  type: "radio",
4507
4507
  name: `rerun-mode-${f}`,
4508
- checked: vi === e,
4508
+ checked: wi === e,
4509
4509
  onChange: () => {
4510
- Ka(e), hn(null);
4510
+ Ra(e), gn(null);
4511
4511
  },
4512
4512
  className: "accent-nvr-cyan"
4513
4513
  }
@@ -4521,20 +4521,20 @@ function Pd({
4521
4521
  "button",
4522
4522
  {
4523
4523
  type: "button",
4524
- disabled: Or !== null,
4525
- onClick: () => void Vs(!0),
4524
+ disabled: Ir !== null,
4525
+ onClick: () => void Bs(!0),
4526
4526
  className: "h-7 rounded border border-slate-300 bg-white px-2.5 text-[11px] font-medium text-slate-700 hover:border-slate-400 disabled:opacity-50 dark:bg-card dark:text-slate-200",
4527
- children: Or === "preview" ? "Previewing…" : "Preview"
4527
+ children: Ir === "preview" ? "Previewing…" : "Preview"
4528
4528
  }
4529
4529
  ),
4530
4530
  Lt && Lt.changes.length > 0 && /* @__PURE__ */ s(
4531
4531
  "button",
4532
4532
  {
4533
4533
  type: "button",
4534
- disabled: Or !== null,
4535
- onClick: () => void Vs(!1),
4534
+ disabled: Ir !== null,
4535
+ onClick: () => void Bs(!1),
4536
4536
  className: "h-7 rounded bg-nvr-cyan px-3 text-[11px] font-medium text-white hover:brightness-110 disabled:opacity-50",
4537
- children: Or === "apply" ? K && k ? "Staging…" : "Applying…" : `${K && k ? "Stage for" : "Apply to"} ${Lt.changes.length} ${Lt.changes.length === 1 ? "line" : "lines"}`
4537
+ children: Ir === "apply" ? K && k ? "Staging…" : "Applying…" : `${K && k ? "Stage for" : "Apply to"} ${Lt.changes.length} ${Lt.changes.length === 1 ? "line" : "lines"}`
4538
4538
  }
4539
4539
  )
4540
4540
  ] }),
@@ -4554,10 +4554,10 @@ function Pd({
4554
4554
  ] }) })
4555
4555
  ] }),
4556
4556
  (ae == null ? void 0 : ae.unmatched_banner) && !j && It.unmatchedCandidates.length > 0 && (() => {
4557
- var c, u, d, l, m, g, b, h;
4558
- const e = It.unmatchedCandidates.length, n = ((c = ae.unmatched_banner) == null ? void 0 : c.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((u = ae.candidates) == null ? void 0 : u.primary) ?? ((m = (l = (d = ae.candidates) == null ? void 0 : d.keys) == null ? void 0 : l[0]) == null ? void 0 : m.row), i = (h = (b = (g = ae.candidates) == null ? void 0 : g.keys) == null ? void 0 : b.find(
4557
+ var c, u, d, l, m, h, b, g;
4558
+ const e = It.unmatchedCandidates.length, n = ((c = ae.unmatched_banner) == null ? void 0 : c.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((u = ae.candidates) == null ? void 0 : u.primary) ?? ((m = (l = (d = ae.candidates) == null ? void 0 : d.keys) == null ? void 0 : l[0]) == null ? void 0 : m.row), i = (g = (b = (h = ae.candidates) == null ? void 0 : h.keys) == null ? void 0 : b.find(
4559
4559
  (w) => w.row === r
4560
- )) == null ? void 0 : h.candidate, o = i ? It.unmatchedCandidates.map((w) => String(w[i] ?? "")).filter(Boolean).slice(0, 8) : [];
4560
+ )) == null ? void 0 : g.candidate, o = i ? It.unmatchedCandidates.map((w) => String(w[i] ?? "")).filter(Boolean).slice(0, 8) : [];
4561
4561
  return /* @__PURE__ */ _("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-amber-200 bg-amber-50/60 px-3 py-2 text-[11px] text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200", children: [
4562
4562
  /* @__PURE__ */ s(Yn, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
4563
4563
  /* @__PURE__ */ _("span", { children: [
@@ -4583,7 +4583,7 @@ function Pd({
4583
4583
  {
4584
4584
  type: "button",
4585
4585
  disabled: Xt,
4586
- onClick: () => void Wa(),
4586
+ onClick: () => void Ua(),
4587
4587
  className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 disabled:opacity-50 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
4588
4588
  "data-tip": O || K ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
4589
4589
  children: Xt ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
@@ -4591,12 +4591,12 @@ function Pd({
4591
4591
  )
4592
4592
  ] });
4593
4593
  })(),
4594
- (Ot || ui.length > 0) && !O && Le === "original" && (() => {
4594
+ (Ot || fi.length > 0) && !O && Le === "original" && (() => {
4595
4595
  const e = Ot, n = (e == null ? void 0 : e.total) ?? 0, t = [];
4596
4596
  e != null && e.added.size && t.push(`${e.added.size} added`), e != null && e.changed.size && t.push(`${e.changed.size} changed`), e != null && e.removed.length && t.push(`${e.removed.length} removed`);
4597
4597
  const r = ((e == null ? void 0 : e.removed) ?? []).slice(0, 5).map((i) => {
4598
4598
  var o;
4599
- return Ar(((o = un.current) == null ? void 0 : o.get(i)) ?? { id: i });
4599
+ return jr(((o = un.current) == null ? void 0 : o.get(i)) ?? { id: i });
4600
4600
  });
4601
4601
  return /* @__PURE__ */ _(
4602
4602
  "div",
@@ -4613,7 +4613,7 @@ function Pd({
4613
4613
  ] }),
4614
4614
  /* @__PURE__ */ _("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
4615
4615
  t.join(" · "),
4616
- Ds.length > 0 && ` · changed by ${Ds.join(", ")}`
4616
+ Ws.length > 0 && ` · changed by ${Ws.join(", ")}`
4617
4617
  ] }),
4618
4618
  r.length > 0 && /* @__PURE__ */ _("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
4619
4619
  "removed: ",
@@ -4624,41 +4624,41 @@ function Pd({
4624
4624
  "button",
4625
4625
  {
4626
4626
  type: "button",
4627
- onClick: va,
4627
+ onClick: wa,
4628
4628
  className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
4629
4629
  "data-tip": "Take the current rows as the new baseline",
4630
4630
  children: "Dismiss"
4631
4631
  }
4632
4632
  )
4633
4633
  ] }),
4634
- ui.length > 0 && /* @__PURE__ */ s(
4634
+ fi.length > 0 && /* @__PURE__ */ s(
4635
4635
  "span",
4636
4636
  {
4637
4637
  "data-remote-editors": "",
4638
4638
  className: e ? "basis-full text-amber-700/80 dark:text-amber-300/80" : "font-medium",
4639
- children: ui.join(" · ")
4639
+ children: fi.join(" · ")
4640
4640
  }
4641
4641
  )
4642
4642
  ]
4643
4643
  }
4644
4644
  );
4645
4645
  })(),
4646
- Fi && /* @__PURE__ */ _("div", { className: "rounded-lg border border-slate-200 p-3 space-y-1.5", children: [
4646
+ Vi && /* @__PURE__ */ _("div", { className: "rounded-lg border border-slate-200 p-3 space-y-1.5", children: [
4647
4647
  /* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
4648
4648
  /* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
4649
4649
  /* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
4650
4650
  ] }),
4651
- !j && bs.length > 0 && /* @__PURE__ */ s(
4651
+ !j && ys.length > 0 && /* @__PURE__ */ s(
4652
4652
  Sl,
4653
4653
  {
4654
- proposals: bs,
4655
- onApply: ua,
4656
- onDismiss: (e) => si(e, !0)
4654
+ proposals: ys,
4655
+ onApply: fa,
4656
+ onDismiss: (e) => oi(e, !0)
4657
4657
  }
4658
4658
  ),
4659
- (ti && ti.length > 0 || Pe && !O && (q || ps || gs)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
4660
- /* @__PURE__ */ s($l, { data: q, loading: ps, error: gs }),
4661
- (ti ?? []).map((e) => /* @__PURE__ */ s(
4659
+ (ni && ni.length > 0 || Pe && !O && (q || hs || gs)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
4660
+ /* @__PURE__ */ s($l, { data: q, loading: hs, error: gs }),
4661
+ (ni ?? []).map((e) => /* @__PURE__ */ s(
4662
4662
  ql,
4663
4663
  {
4664
4664
  label: e.label,
@@ -4669,18 +4669,18 @@ function Pd({
4669
4669
  e.label
4670
4670
  ))
4671
4671
  ] }),
4672
- j && ho,
4672
+ j && bo,
4673
4673
  /* @__PURE__ */ _(
4674
4674
  "div",
4675
4675
  {
4676
- ref: tr,
4677
- className: Fi ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${X ? " overflow-x-auto" : ""}`,
4676
+ ref: nr,
4677
+ className: Vi ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${X ? " overflow-x-auto" : ""}`,
4678
4678
  children: [
4679
- ja && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ _("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
4679
+ Ta && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ _("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
4680
4680
  /* @__PURE__ */ s(vn, { className: "h-3.5 w-3.5 animate-spin" }),
4681
4681
  "Saving order…"
4682
4682
  ] }) }),
4683
- Es && /* @__PURE__ */ s("style", { children: Es }),
4683
+ Os && /* @__PURE__ */ s("style", { children: Os }),
4684
4684
  /* @__PURE__ */ _(
4685
4685
  "table",
4686
4686
  {
@@ -4693,8 +4693,8 @@ function Pd({
4693
4693
  type: "checkbox",
4694
4694
  "aria-label": "Select all rows",
4695
4695
  className: "accent-nvr-cyan",
4696
- checked: Ja,
4697
- onChange: (e) => rr(e.target.checked ? new Set(_i) : /* @__PURE__ */ new Set())
4696
+ checked: za,
4697
+ onChange: (e) => ir(e.target.checked ? new Set(ki) : /* @__PURE__ */ new Set())
4698
4698
  }
4699
4699
  ) }),
4700
4700
  te && (C || O || K) && /* @__PURE__ */ s("th", { className: "w-6" }),
@@ -4711,12 +4711,12 @@ function Pd({
4711
4711
  /* @__PURE__ */ s("th", { className: "w-20" })
4712
4712
  ] }) }),
4713
4713
  /* @__PURE__ */ _("tbody", { children: [
4714
- eo && /* @__PURE__ */ _("tr", { className: "border-b border-nvr-cyan/20 bg-nvr-cyan/5", children: [
4714
+ to && /* @__PURE__ */ _("tr", { className: "border-b border-nvr-cyan/20 bg-nvr-cyan/5", children: [
4715
4715
  at && /* @__PURE__ */ s("td", { className: "w-7" }),
4716
4716
  te && (C || O || K) && /* @__PURE__ */ s("td", { className: "w-6" }),
4717
4717
  A && /* @__PURE__ */ s("td", { className: "w-8" }),
4718
4718
  (O || K) && /* @__PURE__ */ s("td", { className: "px-3 py-0.5 align-middle w-20", children: /* @__PURE__ */ s("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Defaults" }) }),
4719
- Qs.map((e) => /* @__PURE__ */ s(
4719
+ Fs.map((e) => /* @__PURE__ */ s(
4720
4720
  "td",
4721
4721
  {
4722
4722
  className: "px-2 py-0.5 align-middle text-[11px] [&_button]:h-7 [&_button]:min-h-0 [&_button]:text-[11px] [&_input]:h-7 [&_input]:text-[11px] [&_textarea]:min-h-[28px] [&_label]:hidden",
@@ -4724,8 +4724,8 @@ function Pd({
4724
4724
  yn,
4725
4725
  {
4726
4726
  field: e,
4727
- value: xi[e.field] ?? null,
4728
- onChange: (n) => Ra(e.field, n),
4727
+ value: vi[e.field] ?? null,
4728
+ onChange: (n) => Pa(e.field, n),
4729
4729
  relations: We,
4730
4730
  collection: a,
4731
4731
  itemId: "new"
@@ -4739,24 +4739,24 @@ function Pd({
4739
4739
  {
4740
4740
  type: "button",
4741
4741
  disabled: Xt,
4742
- onClick: () => lo(!0),
4742
+ onClick: () => co(!0),
4743
4743
  className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
4744
4744
  children: Xt ? "…" : `Add ${Gt}`
4745
4745
  }
4746
4746
  ) })
4747
4747
  ] }),
4748
4748
  !O && Le === "original" && $.slice(0, cn).map((e, n) => {
4749
- const t = String(e.id), r = ds ? In(e) : null, i = r !== null && (n === 0 || In($[n - 1]) !== r), o = r !== null && cs.has(r), c = i && r !== null ? /* @__PURE__ */ s("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 py-1", children: /* @__PURE__ */ _(
4749
+ const t = String(e.id), r = cs ? In(e) : null, i = r !== null && (n === 0 || In($[n - 1]) !== r), o = r !== null && us.has(r), c = i && r !== null ? /* @__PURE__ */ s("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 py-1", children: /* @__PURE__ */ _(
4750
4750
  "button",
4751
4751
  {
4752
4752
  type: "button",
4753
4753
  onClick: (y) => {
4754
- y.stopPropagation(), aa(r);
4754
+ y.stopPropagation(), la(r);
4755
4755
  },
4756
4756
  className: "flex w-full items-center gap-1.5 text-left",
4757
4757
  children: [
4758
4758
  /* @__PURE__ */ s(
4759
- To,
4759
+ Lo,
4760
4760
  {
4761
4761
  className: ve(
4762
4762
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
@@ -4767,7 +4767,7 @@ function Pd({
4767
4767
  /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: r }),
4768
4768
  /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: $.reduce((y, x) => y + (In(x) === r ? 1 : 0), 0) }),
4769
4769
  (() => {
4770
- const y = la(
4770
+ const y = da(
4771
4771
  $.filter(
4772
4772
  (x) => In(x) === r && !Je.has(String(x.id))
4773
4773
  )
@@ -4788,9 +4788,9 @@ function Pd({
4788
4788
  ]
4789
4789
  }
4790
4790
  ) }) }) : null;
4791
- if (o) return /* @__PURE__ */ s(Si, { children: c }, t);
4792
- const u = (p == null ? void 0 : p.rowId) === t, d = u && !_e, l = ht === n, m = Tt === n && ht !== n, g = H.has(t), b = Je.has(t), h = g ? { ...e, ...H.get(t) } : e, w = zi && !b ? Wo.get(String(h[zi] ?? "")) ?? null : null;
4793
- return /* @__PURE__ */ _(Si, { children: [
4791
+ if (o) return /* @__PURE__ */ s($i, { children: c }, t);
4792
+ const u = (p == null ? void 0 : p.rowId) === t, d = u && !_e, l = gt === n, m = Tt === n && gt !== n, h = H.has(t), b = Je.has(t), g = h ? { ...e, ...H.get(t) } : e, w = Qi && !b ? Uo.get(String(g[Qi] ?? "")) ?? null : null;
4793
+ return /* @__PURE__ */ _($i, { children: [
4794
4794
  c,
4795
4795
  /* @__PURE__ */ _(
4796
4796
  "tr",
@@ -4799,14 +4799,14 @@ function Pd({
4799
4799
  "data-o2m-editing": u ? "" : void 0,
4800
4800
  tabIndex: _e ? -1 : void 0,
4801
4801
  draggable: te && !!C && !u && !b,
4802
- onDragStart: () => co(n),
4803
- onDragOver: (y) => uo(y, n),
4804
- onDrop: Ua,
4802
+ onDragStart: () => uo(n),
4803
+ onDragOver: (y) => fo(y, n),
4804
+ onDrop: Ja,
4805
4805
  onDragEnd: bn,
4806
- onClick: () => !u && !b && qr(h),
4806
+ onClick: () => !u && !b && Er(g),
4807
4807
  onBlur: (y) => {
4808
- !u || gt || b || y.currentTarget.contains(y.relatedTarget) || dr(y.relatedTarget) || (ut.current = setTimeout(() => {
4809
- En.current || dr(document.activeElement) || jt();
4808
+ !u || ht || b || y.currentTarget.contains(y.relatedTarget) || cr(y.relatedTarget) || (ut.current = setTimeout(() => {
4809
+ En.current || cr(document.activeElement) || jt();
4810
4810
  }, 150));
4811
4811
  },
4812
4812
  onFocus: () => {
@@ -4838,7 +4838,7 @@ function Pd({
4838
4838
  className: "accent-nvr-cyan",
4839
4839
  checked: Ut.has(t),
4840
4840
  disabled: b,
4841
- onChange: () => Ji(t)
4841
+ onChange: () => zi(t)
4842
4842
  }
4843
4843
  )
4844
4844
  ]
@@ -4851,7 +4851,7 @@ function Pd({
4851
4851
  onClick: (y) => y.stopPropagation(),
4852
4852
  children: [
4853
4853
  Jn === "reorder" && zn(t),
4854
- C && /* @__PURE__ */ s(xo, { className: "h-3 w-3 text-slate-300 cursor-grab" })
4854
+ C && /* @__PURE__ */ s(vo, { className: "h-3 w-3 text-slate-300 cursor-grab" })
4855
4855
  ]
4856
4856
  }
4857
4857
  ),
@@ -4860,30 +4860,30 @@ function Pd({
4860
4860
  /* @__PURE__ */ _("span", { className: "inline-flex items-center gap-1", children: [
4861
4861
  n + 1,
4862
4862
  ae && /* @__PURE__ */ s(
4863
- Eo,
4863
+ Oo,
4864
4864
  {
4865
4865
  result: It.byRow.get(t),
4866
4866
  title: ae.title
4867
4867
  }
4868
4868
  ),
4869
- fr(t) && /* @__PURE__ */ s(
4870
- vo,
4869
+ mr(t) && /* @__PURE__ */ s(
4870
+ wo,
4871
4871
  {
4872
4872
  className: "h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
4873
4873
  "aria-label": "Imported line",
4874
- "data-tip": fr(t) ?? void 0
4874
+ "data-tip": mr(t) ?? void 0
4875
4875
  }
4876
4876
  ),
4877
- ts.has(t) && /* @__PURE__ */ s(
4878
- Ni,
4877
+ ns.has(t) && /* @__PURE__ */ s(
4878
+ Si,
4879
4879
  {
4880
4880
  className: "h-2.5 w-2.5 text-amber-500",
4881
4881
  "aria-label": "Line overdue",
4882
- "data-tip": ns
4882
+ "data-tip": rs
4883
4883
  }
4884
4884
  ),
4885
4885
  (() => {
4886
- const y = ji(h, xt);
4886
+ const y = Ti(g, xt);
4887
4887
  return y.length ? /* @__PURE__ */ s(
4888
4888
  Yn,
4889
4889
  {
@@ -4898,30 +4898,30 @@ function Pd({
4898
4898
  K && /* @__PURE__ */ _("td", { className: "relative px-3 py-1 align-middle w-20", children: [
4899
4899
  Jn === "status" && zn(t),
4900
4900
  !A && ae && /* @__PURE__ */ s(
4901
- Eo,
4901
+ Oo,
4902
4902
  {
4903
4903
  result: It.byRow.get(t),
4904
4904
  title: ae.title
4905
4905
  }
4906
4906
  ),
4907
- !A && fr(t) && /* @__PURE__ */ s(
4908
- vo,
4907
+ !A && mr(t) && /* @__PURE__ */ s(
4908
+ wo,
4909
4909
  {
4910
4910
  className: "mr-1 inline h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
4911
4911
  "aria-label": "Imported line",
4912
- "data-tip": fr(t) ?? void 0
4912
+ "data-tip": mr(t) ?? void 0
4913
4913
  }
4914
4914
  ),
4915
- !A && ts.has(t) && /* @__PURE__ */ s(
4916
- Ni,
4915
+ !A && ns.has(t) && /* @__PURE__ */ s(
4916
+ Si,
4917
4917
  {
4918
4918
  className: "mr-1 inline h-2.5 w-2.5 text-amber-500",
4919
4919
  "aria-label": "Line overdue",
4920
- "data-tip": ns
4920
+ "data-tip": rs
4921
4921
  }
4922
4922
  ),
4923
4923
  !A && (() => {
4924
- const y = ji(h, xt);
4924
+ const y = Ti(g, xt);
4925
4925
  return y.length ? /* @__PURE__ */ s(
4926
4926
  Yn,
4927
4927
  {
@@ -4931,26 +4931,26 @@ function Pd({
4931
4931
  }
4932
4932
  ) : null;
4933
4933
  })(),
4934
- b ? /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: "Delete" }) : g ? /* @__PURE__ */ s("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null
4934
+ b ? /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: "Delete" }) : h ? /* @__PURE__ */ s("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null
4935
4935
  ] })
4936
4936
  ] }),
4937
- u && !b && lt === "panel" ? ki({
4938
- identity: `${A ? `Line ${n + 1} · ` : ""}${Ar(h)}`,
4939
- draft: (p == null ? void 0 : p.draft) ?? h,
4937
+ u && !b && lt === "panel" ? Ni({
4938
+ identity: `${A ? `Line ${n + 1} · ` : ""}${jr(g)}`,
4939
+ draft: (p == null ? void 0 : p.draft) ?? g,
4940
4940
  rowId: t,
4941
4941
  saveLabel: "Save",
4942
- onDelete: (y) => wi(e, y),
4943
- drawer: jr(t, (p == null ? void 0 : p.draft) ?? h)
4942
+ onDelete: (y) => _i(e, y),
4943
+ drawer: Tr(t, (p == null ? void 0 : p.draft) ?? g)
4944
4944
  }) : (() => {
4945
- const y = Fn(h, { rowKey: t });
4945
+ const y = Fn(g, { rowKey: t });
4946
4946
  return Re.map((x, R) => {
4947
4947
  var Y, ye, ue;
4948
4948
  if (st(x))
4949
- return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: _r(x, h) }) }, x.field);
4949
+ return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: kr(x, g) }) }, x.field);
4950
4950
  const I = x.computed_type === "write" && !!x.computed_formula, B = I ? Rt(
4951
4951
  x.computed_formula,
4952
- u ? (p == null ? void 0 : p.draft) ?? h : h
4953
- ) ?? h[x.field] : null, F = W && !u && !b ? (Y = Br[t]) == null ? void 0 : Y[x.field] : void 0, Me = F ? `${x.label || qe(x.field)} · changed ${ko(F.at)} by ${F.who}${F.reason ? `
4952
+ u ? (p == null ? void 0 : p.draft) ?? g : g
4953
+ ) ?? g[x.field] : null, F = W && !u && !b ? (Y = Hr[t]) == null ? void 0 : Y[x.field] : void 0, Me = F ? `${x.label || qe(x.field)} · changed ${No(F.at)} by ${F.who}${F.reason ? `
4954
4954
  Reason: “${F.reason}”` : ""}` : void 0;
4955
4955
  return /* @__PURE__ */ _(
4956
4956
  "td",
@@ -4960,13 +4960,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
4960
4960
  (F || R === 0 && Jn === "data") && "relative",
4961
4961
  q && Kt(
4962
4962
  q,
4963
- h[q.key_field],
4963
+ g[q.key_field],
4964
4964
  x.field
4965
4965
  ) && "bg-slate-50/80 dark:bg-white/[0.035]"
4966
4966
  ),
4967
4967
  "data-compare-closed": q && Kt(
4968
4968
  q,
4969
- h[q.key_field],
4969
+ g[q.key_field],
4970
4970
  x.field
4971
4971
  ) ? "" : void 0,
4972
4972
  "data-tip": Me,
@@ -4989,10 +4989,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
4989
4989
  type: "button",
4990
4990
  "aria-label": `History of ${x.label || qe(x.field)}`,
4991
4991
  onClick: (ee) => {
4992
- ee.stopPropagation(), Jr(F.revision_id), kn(e);
4992
+ ee.stopPropagation(), zr(F.revision_id), kn(e);
4993
4993
  },
4994
4994
  className: "absolute right-0.5 top-0.5 rounded p-px text-slate-300 opacity-0 transition-opacity duration-150 hover:text-nvr-cyan focus-visible:opacity-100 group-hover/row:opacity-100 dark:text-slate-500",
4995
- children: /* @__PURE__ */ s(Lr, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
4995
+ children: /* @__PURE__ */ s(Mr, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
4996
4996
  }
4997
4997
  ),
4998
4998
  I ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(x, B) }) : d && !b || An(x.interface) ? (
@@ -5002,8 +5002,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
5002
5002
  "div",
5003
5003
  {
5004
5004
  onClick: (ee) => ee.stopPropagation(),
5005
- "data-tip": d && ((ye = p == null ? void 0 : p.locks) != null && ye.includes(x.field)) ? Hs(x.field) : void 0,
5006
- "data-grid-cell": d ? Yi(t, x.field) : void 0,
5005
+ "data-tip": d && ((ye = p == null ? void 0 : p.locks) != null && ye.includes(x.field)) ? Ys(x.field) : void 0,
5006
+ "data-grid-cell": d ? Gi(t, x.field) : void 0,
5007
5007
  children: /* @__PURE__ */ s(
5008
5008
  yn,
5009
5009
  {
@@ -5030,23 +5030,23 @@ Reason: “${F.reason}”` : ""}` : void 0;
5030
5030
  y
5031
5031
  ) }) : x.computed_type === "rollup" ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(
5032
5032
  x,
5033
- y[x.field] ?? h[x.field],
5033
+ y[x.field] ?? g[x.field],
5034
5034
  e.id != null ? String(e.id) : void 0
5035
5035
  ) }) : /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(
5036
5036
  x,
5037
- h[x.field],
5037
+ g[x.field],
5038
5038
  e.id != null ? String(e.id) : void 0
5039
5039
  ) }),
5040
5040
  q && /* @__PURE__ */ s(
5041
- Ei,
5041
+ Oi,
5042
5042
  {
5043
5043
  data: q,
5044
- row: Oi(q, h),
5045
- rowKey: h[q.key_field],
5044
+ row: Ii(q, g),
5045
+ rowKey: g[q.key_field],
5046
5046
  column: x.field,
5047
- planned: d && !b ? p == null ? void 0 : p.draft[x.field] : h[x.field],
5048
- columnLabel: br(x),
5049
- plannedRow: h,
5047
+ planned: d && !b ? p == null ? void 0 : p.draft[x.field] : g[x.field],
5048
+ columnLabel: yr(x),
5049
+ plannedRow: g,
5050
5050
  onAdjust: !j && !b && e.id != null ? (ee, Be) => void an(String(e.id), ee, Be) : void 0
5051
5051
  }
5052
5052
  )
@@ -5066,10 +5066,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
5066
5066
  "button",
5067
5067
  {
5068
5068
  type: "button",
5069
- disabled: gt,
5069
+ disabled: ht,
5070
5070
  onClick: jt,
5071
5071
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5072
- children: gt ? "…" : "Save"
5072
+ children: ht ? "…" : "Save"
5073
5073
  }
5074
5074
  ),
5075
5075
  /* @__PURE__ */ s(
@@ -5095,13 +5095,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
5095
5095
  children: "Undo"
5096
5096
  }
5097
5097
  ) : /* @__PURE__ */ _(xn, { children: [
5098
- g && /* @__PURE__ */ s(
5098
+ h && /* @__PURE__ */ s(
5099
5099
  "button",
5100
5100
  {
5101
5101
  type: "button",
5102
5102
  title: "Undo edit",
5103
5103
  onClick: (y) => {
5104
- y.stopPropagation(), k == null || k.cancelPendingEdit(a, f, t), pr((x) => {
5104
+ y.stopPropagation(), k == null || k.cancelPendingEdit(a, f, t), hr((x) => {
5105
5105
  const R = {};
5106
5106
  for (const [I, B] of Object.entries(x))
5107
5107
  I.startsWith(`${t}|`) || (R[I] = B);
@@ -5117,7 +5117,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5117
5117
  {
5118
5118
  collection: a,
5119
5119
  rowId: String(t),
5120
- count: ba[String(t)] ?? 0
5120
+ count: ya[String(t)] ?? 0
5121
5121
  }
5122
5122
  ),
5123
5123
  W && /* @__PURE__ */ s(
@@ -5129,7 +5129,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5129
5129
  y.stopPropagation(), kn(e);
5130
5130
  },
5131
5131
  className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
5132
- children: /* @__PURE__ */ s(Lr, { className: "h-3 w-3" })
5132
+ children: /* @__PURE__ */ s(Mr, { className: "h-3 w-3" })
5133
5133
  }
5134
5134
  ),
5135
5135
  t != null && !String(t).startsWith("pending") && /* @__PURE__ */ s(
@@ -5144,17 +5144,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
5144
5144
  "button",
5145
5145
  {
5146
5146
  type: "button",
5147
- onClick: (y) => wi(e, y),
5147
+ onClick: (y) => _i(e, y),
5148
5148
  className: "rounded p-0.5 text-slate-300 hover:text-red-500",
5149
- children: /* @__PURE__ */ s(wo, { className: "h-3 w-3" })
5149
+ children: /* @__PURE__ */ s(_o, { className: "h-3 w-3" })
5150
5150
  }
5151
5151
  )
5152
5152
  ] }) }) })
5153
5153
  ]
5154
5154
  }
5155
5155
  ),
5156
- !_e && (Ce == null ? void 0 : Ce.rowKey) === t && /* @__PURE__ */ s("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: po(Ce, "row") }) }),
5157
- u && lt === "inline" && Dn.length > 0 && /* @__PURE__ */ s("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 pt-2", children: Ps(t) }) }),
5156
+ !_e && (Ce == null ? void 0 : Ce.rowKey) === t && /* @__PURE__ */ s("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: ho(Ce, "row") }) }),
5157
+ u && lt === "inline" && Dn.length > 0 && /* @__PURE__ */ s("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 pt-2", children: Ds(t) }) }),
5158
5158
  w && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ _(
5159
5159
  "td",
5160
5160
  {
@@ -5172,19 +5172,19 @@ Reason: “${F.reason}”` : ""}` : void 0;
5172
5172
  "data-o2m-editing": !0,
5173
5173
  className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
5174
5174
  children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: G.map((y) => {
5175
- const x = typeof y == "string" ? y : y.field, R = typeof y == "string" ? void 0 : y.hint, I = typeof y == "string" ? void 0 : y.match, B = (p == null ? void 0 : p.draft) ?? h, F = I ? Rr(
5175
+ const x = typeof y == "string" ? y : y.field, R = typeof y == "string" ? void 0 : y.hint, I = typeof y == "string" ? void 0 : y.match, B = (p == null ? void 0 : p.draft) ?? g, F = I ? Pr(
5176
5176
  I,
5177
5177
  B,
5178
5178
  v,
5179
5179
  N == null ? void 0 : N.draft
5180
5180
  ) : null;
5181
5181
  return /* @__PURE__ */ s(
5182
- Ii,
5182
+ Ai,
5183
5183
  {
5184
5184
  parentCollection: a,
5185
5185
  relationField: x,
5186
5186
  parentRowId: t,
5187
- parentDraft: (p == null ? void 0 : p.draft) ?? h,
5187
+ parentDraft: (p == null ? void 0 : p.draft) ?? g,
5188
5188
  hint: R,
5189
5189
  outerGridInvalidateKey: [
5190
5190
  "o2m-rows",
@@ -5198,7 +5198,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5198
5198
  matchSeed: (F == null ? void 0 : F.seed) ?? {}
5199
5199
  } : K ? {
5200
5200
  deferred: !0,
5201
- stagedOps: (p == null ? void 0 : p.draft[`__nested_ops_${x}`]) ?? Mr,
5201
+ stagedOps: (p == null ? void 0 : p.draft[`__nested_ops_${x}`]) ?? Kr,
5202
5202
  onStagedOpsChange: (Me) => mt(`__nested_ops_${x}`, Me)
5203
5203
  } : {}
5204
5204
  },
@@ -5209,7 +5209,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5209
5209
  )
5210
5210
  ] }, t);
5211
5211
  }),
5212
- Ir && _e && /* @__PURE__ */ s(
5212
+ Ar && _e && /* @__PURE__ */ s(
5213
5213
  "tr",
5214
5214
  {
5215
5215
  "data-o2m-editing": !0,
@@ -5227,7 +5227,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5227
5227
  )
5228
5228
  }
5229
5229
  ),
5230
- Ir && !_e && /* @__PURE__ */ _(
5230
+ Ar && !_e && /* @__PURE__ */ _(
5231
5231
  "tr",
5232
5232
  {
5233
5233
  "data-o2m-editing": !0,
@@ -5239,21 +5239,21 @@ Reason: “${F.reason}”` : ""}` : void 0;
5239
5239
  A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: $.length + M.length + 1 }),
5240
5240
  (O || K) && /* @__PURE__ */ s("td", { className: "px-3 py-1.5" })
5241
5241
  ] }),
5242
- lt === "panel" ? ki({
5242
+ lt === "panel" ? Ni({
5243
5243
  identity: `${A ? `Line ${$.length + M.length + 1} · ` : ""}New line`,
5244
5244
  draft: p.draft,
5245
5245
  rowId: void 0,
5246
5246
  saveLabel: "Save",
5247
- drawer: jr(void 0, p.draft)
5247
+ drawer: Tr(void 0, p.draft)
5248
5248
  }) : Re.map((e) => {
5249
5249
  if (st(e))
5250
5250
  return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Rn(e, p.draft, !0) }) }, e.field);
5251
- const n = e.computed_type === "write" && !!e.computed_formula, t = An(e.interface), r = `__m2m_${e.field}`, i = t ? Cr(e) : null;
5251
+ const n = e.computed_type === "write" && !!e.computed_formula, t = An(e.interface), r = `__m2m_${e.field}`, i = t ? Zr(e) : null;
5252
5252
  return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: n ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(
5253
5253
  e,
5254
5254
  Rt(e.computed_formula, p.draft) ?? null
5255
5255
  ) }) : t && i ? /* @__PURE__ */ s("div", { onClick: (o) => o.stopPropagation(), children: /* @__PURE__ */ s(
5256
- Ai,
5256
+ ji,
5257
5257
  {
5258
5258
  collection: i.targetCollection,
5259
5259
  value: p.draft[r] ?? null,
@@ -5279,10 +5279,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
5279
5279
  "button",
5280
5280
  {
5281
5281
  type: "button",
5282
- disabled: gt,
5282
+ disabled: ht,
5283
5283
  onClick: jt,
5284
5284
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5285
- children: gt ? "…" : "Add"
5285
+ children: ht ? "…" : "Add"
5286
5286
  }
5287
5287
  ),
5288
5288
  /* @__PURE__ */ s(
@@ -5298,7 +5298,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5298
5298
  ]
5299
5299
  }
5300
5300
  ),
5301
- $.length === 0 && M.length === 0 && !Ir && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-14 text-center text-slate-400", children: se ? `No ${se.toLowerCase()} yet` : O ? "No pending rows" : "No rows yet" }) }),
5301
+ $.length === 0 && M.length === 0 && !Ar && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-14 text-center text-slate-400", children: se ? `No ${se.toLowerCase()} yet` : O ? "No pending rows" : "No rows yet" }) }),
5302
5302
  !O && Le !== "original" && (() => {
5303
5303
  const e = me.find((u) => u.addendumId === Le), n = (te && (C || K) ? 1 : 0) + (A ? 1 : 0) + (K ? 1 : 0) + Re.length + 1;
5304
5304
  if (!e)
@@ -5313,7 +5313,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5313
5313
  te && (C || K) && /* @__PURE__ */ s("td", { className: "w-6" }),
5314
5314
  A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: d + 1 }),
5315
5315
  K && /* @__PURE__ */ s("td", { className: "w-20" }),
5316
- Re.map((l) => /* @__PURE__ */ s("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: st(l) ? _r(l, u) : Ue(
5316
+ Re.map((l) => /* @__PURE__ */ s("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: st(l) ? kr(l, u) : Ue(
5317
5317
  l,
5318
5318
  u[l.field],
5319
5319
  u.id != null ? String(u.id) : void 0
@@ -5351,7 +5351,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5351
5351
  "td",
5352
5352
  {
5353
5353
  className: "px-2 py-1.5 text-[11px] text-red-700/70 line-through dark:text-red-300/70",
5354
- children: st(m) ? _r(m, l) : Ue(
5354
+ children: st(m) ? kr(m, l) : Ue(
5355
5355
  m,
5356
5356
  l[m.field],
5357
5357
  l.id != null ? String(l.id) : void 0
@@ -5373,14 +5373,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
5373
5373
  },
5374
5374
  // A settled snapshot row IS what was stored — never re-derive it.
5375
5375
  e.baseRows ? u : void 0
5376
- ), m = l.id != null ? t.find((y) => String(y.id) === String(l.id)) : void 0, g = m ? ce(
5376
+ ), m = l.id != null ? t.find((y) => String(y.id) === String(l.id)) : void 0, h = m ? ce(
5377
5377
  { ...m },
5378
5378
  m
5379
- ) : void 0, b = !g, h = new Set(
5380
- b ? Ne.map((y) => y.field) : Ne.filter((y) => !e.baseRows || y.field in g).filter(
5381
- (y) => String(l[y.field] ?? "") !== String(g[y.field] ?? "")
5379
+ ) : void 0, b = !h, g = new Set(
5380
+ b ? Ne.map((y) => y.field) : Ne.filter((y) => !e.baseRows || y.field in h).filter(
5381
+ (y) => String(l[y.field] ?? "") !== String(h[y.field] ?? "")
5382
5382
  ).map((y) => y.field)
5383
- ), w = b || h.size > 0;
5383
+ ), w = b || g.size > 0;
5384
5384
  return /* @__PURE__ */ _(
5385
5385
  "tr",
5386
5386
  {
@@ -5398,8 +5398,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
5398
5398
  Re.map((y) => /* @__PURE__ */ s(
5399
5399
  "td",
5400
5400
  {
5401
- className: `px-2 py-1.5 text-[11px] ${h.has(y.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`,
5402
- children: st(y) ? _r(y, l) : Ue(
5401
+ className: `px-2 py-1.5 text-[11px] ${g.has(y.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`,
5402
+ children: st(y) ? kr(y, l) : Ue(
5403
5403
  y,
5404
5404
  l[y.field],
5405
5405
  l.id != null ? String(l.id) : void 0
@@ -5414,7 +5414,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5414
5414
  );
5415
5415
  }), ...o];
5416
5416
  })(),
5417
- !O && Le === "original" && $.length > cn && /* @__PURE__ */ s("tr", { ref: Os, children: /* @__PURE__ */ _("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
5417
+ !O && Le === "original" && $.length > cn && /* @__PURE__ */ s("tr", { ref: Is, children: /* @__PURE__ */ _("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
5418
5418
  "Showing ",
5419
5419
  cn,
5420
5420
  " of ",
@@ -5463,14 +5463,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
5463
5463
  children: [
5464
5464
  q.columns.includes(r.field) && /* @__PURE__ */ s("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
5465
5465
  /* @__PURE__ */ s(
5466
- Ei,
5466
+ Oi,
5467
5467
  {
5468
5468
  data: q,
5469
5469
  row: t,
5470
5470
  rowKey: t.key,
5471
5471
  column: r.field,
5472
5472
  planned: 0,
5473
- columnLabel: br(r)
5473
+ columnLabel: yr(r)
5474
5474
  }
5475
5475
  )
5476
5476
  ]
@@ -5485,8 +5485,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
5485
5485
  ));
5486
5486
  })(),
5487
5487
  M.length > 0 && M.map((e, n) => {
5488
- const t = `pending:${n}`, r = (p == null ? void 0 : p.rowId) === t, i = r && !_e, o = ht === n, c = Tt === n && ht !== n, u = !!e.__prefilled;
5489
- return /* @__PURE__ */ _(Si, { children: [
5488
+ const t = `pending:${n}`, r = (p == null ? void 0 : p.rowId) === t, i = r && !_e, o = gt === n, c = Tt === n && gt !== n, u = !!e.__prefilled;
5489
+ return /* @__PURE__ */ _($i, { children: [
5490
5490
  /* @__PURE__ */ _(
5491
5491
  "tr",
5492
5492
  {
@@ -5494,16 +5494,16 @@ Reason: “${F.reason}”` : ""}` : void 0;
5494
5494
  "data-o2m-row": `${a}:${t}`,
5495
5495
  tabIndex: _e ? -1 : void 0,
5496
5496
  draggable: te && !r,
5497
- onDragStart: () => co(n),
5498
- onDragOver: (d) => uo(d, n),
5497
+ onDragStart: () => uo(n),
5498
+ onDragOver: (d) => fo(d, n),
5499
5499
  onDrop: (d) => {
5500
- d.preventDefault(), ht !== null && Tt !== null && ht !== Tt && (k == null || k.reorderRows(a, f, ht, Tt)), bn();
5500
+ d.preventDefault(), gt !== null && Tt !== null && gt !== Tt && (k == null || k.reorderRows(a, f, gt, Tt)), bn();
5501
5501
  },
5502
5502
  onDragEnd: bn,
5503
- onClick: () => !r && Bs(e, n),
5503
+ onClick: () => !r && Hs(e, n),
5504
5504
  onBlur: (d) => {
5505
- !r || gt || d.currentTarget.contains(d.relatedTarget) || dr(d.relatedTarget) || (ut.current = setTimeout(() => {
5506
- En.current || dr(document.activeElement) || jt();
5505
+ !r || ht || d.currentTarget.contains(d.relatedTarget) || cr(d.relatedTarget) || (ut.current = setTimeout(() => {
5506
+ En.current || cr(document.activeElement) || jt();
5507
5507
  }, 150));
5508
5508
  },
5509
5509
  onFocus: () => {
@@ -5530,7 +5530,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5530
5530
  "aria-label": `Select line ${$.length + n + 1}`,
5531
5531
  className: "accent-nvr-cyan",
5532
5532
  checked: Ut.has(t),
5533
- onChange: () => Ji(t)
5533
+ onChange: () => zi(t)
5534
5534
  }
5535
5535
  )
5536
5536
  }
@@ -5540,13 +5540,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
5540
5540
  {
5541
5541
  className: "w-6 px-1 align-middle",
5542
5542
  onClick: (d) => d.stopPropagation(),
5543
- children: /* @__PURE__ */ s(xo, { className: "h-3 w-3 text-slate-300 cursor-grab" })
5543
+ children: /* @__PURE__ */ s(vo, { className: "h-3 w-3 text-slate-300 cursor-grab" })
5544
5544
  }
5545
5545
  ),
5546
5546
  A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: /* @__PURE__ */ _("span", { className: "inline-flex items-center gap-1", children: [
5547
5547
  $.length + n + 1,
5548
5548
  (() => {
5549
- const d = ji(
5549
+ const d = Ti(
5550
5550
  r ? (p == null ? void 0 : p.draft) ?? e : e,
5551
5551
  xt
5552
5552
  );
@@ -5562,11 +5562,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
5562
5562
  ] }) }),
5563
5563
  /* @__PURE__ */ _("td", { className: "px-3 py-1 align-middle w-16", children: [
5564
5564
  !r && !u && /* @__PURE__ */ s("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
5565
- !r && u && e.id != null && Ia.has(e.id) && /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
5565
+ !r && u && e.id != null && Aa.has(e.id) && /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
5566
5566
  ] })
5567
5567
  ] }),
5568
- r && lt === "panel" ? ki({
5569
- identity: `${A ? `Line ${$.length + n + 1} · ` : ""}${Ar(r ? p.draft : e)}`,
5568
+ r && lt === "panel" ? Ni({
5569
+ identity: `${A ? `Line ${$.length + n + 1} · ` : ""}${jr(r ? p.draft : e)}`,
5570
5570
  draft: (p == null ? void 0 : p.draft) ?? e,
5571
5571
  rowId: t,
5572
5572
  saveLabel: "Save",
@@ -5575,7 +5575,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5575
5575
  },
5576
5576
  // Grandchild rows for an unsaved row stage against the
5577
5577
  // draft, so there is no row id to pass yet.
5578
- drawer: jr(void 0, (p == null ? void 0 : p.draft) ?? e)
5578
+ drawer: Tr(void 0, (p == null ? void 0 : p.draft) ?? e)
5579
5579
  }) : (() => {
5580
5580
  const d = Fn(
5581
5581
  r ? p.draft : e,
@@ -5589,7 +5589,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5589
5589
  r ? p.draft : e,
5590
5590
  !0
5591
5591
  ) }) }, l.field);
5592
- const m = l.computed_type === "write" && !!l.computed_formula, g = An(l.interface), b = `__m2m_${l.field}`, h = g && i ? Cr(l) : null, w = l.interface === "relation-path" && e.id != null ? (R = ft == null ? void 0 : ft[String(e.id)]) == null ? void 0 : R[l.field] : void 0, y = m ? Rt(
5592
+ const m = l.computed_type === "write" && !!l.computed_formula, h = An(l.interface), b = `__m2m_${l.field}`, g = h && i ? Zr(l) : null, w = l.interface === "relation-path" && e.id != null ? (R = ft == null ? void 0 : ft[String(e.id)]) == null ? void 0 : R[l.field] : void 0, y = m ? Rt(
5593
5593
  l.computed_formula,
5594
5594
  r ? p.draft : e
5595
5595
  ) ?? e[l.field] : r ? p.draft[l.field] ?? w : e[l.field] ?? w, x = Array.isArray(e.__rule_set) ? e.__rule_set.includes(l.field) : !1;
@@ -5602,15 +5602,15 @@ Reason: “${F.reason}”` : ""}` : void 0;
5602
5602
  ),
5603
5603
  "data-tip": x && !r ? `${l.label || qe(l.field)} · set by an auto-fill rule, not the file` : void 0,
5604
5604
  children: [
5605
- m ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(l, y) }) : g && i && h ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
5606
- Ai,
5605
+ m ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(l, y) }) : h && i && g ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
5606
+ ji,
5607
5607
  {
5608
- collection: h.targetCollection,
5608
+ collection: g.targetCollection,
5609
5609
  value: p.draft[b] ?? null,
5610
5610
  onChange: (I) => mt(b, I),
5611
5611
  extraFilter: it[l.field]
5612
5612
  }
5613
- ) }) : g ? /* @__PURE__ */ s("span", { className: "text-slate-300 text-[11px]", children: "—" }) : i ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
5613
+ ) }) : h ? /* @__PURE__ */ s("span", { className: "text-slate-300 text-[11px]", children: "—" }) : i ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
5614
5614
  yn,
5615
5615
  {
5616
5616
  field: { ...l, sort: l.sort ?? 0 },
@@ -5628,17 +5628,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
5628
5628
  String(e.id)
5629
5629
  ) }) : /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(l, y, String(e.id)) }),
5630
5630
  q && /* @__PURE__ */ s(
5631
- Ei,
5631
+ Oi,
5632
5632
  {
5633
5633
  data: q,
5634
- row: Oi(
5634
+ row: Ii(
5635
5635
  q,
5636
5636
  r ? p.draft : e
5637
5637
  ),
5638
5638
  rowKey: (r ? p.draft : e)[q.key_field],
5639
5639
  column: l.field,
5640
5640
  planned: r ? p.draft[l.field] : e[l.field],
5641
- columnLabel: br(l)
5641
+ columnLabel: yr(l)
5642
5642
  }
5643
5643
  )
5644
5644
  ]
@@ -5657,10 +5657,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
5657
5657
  "button",
5658
5658
  {
5659
5659
  type: "button",
5660
- disabled: gt,
5660
+ disabled: ht,
5661
5661
  onClick: jt,
5662
5662
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5663
- children: gt ? "…" : "Save"
5663
+ children: ht ? "…" : "Save"
5664
5664
  }
5665
5665
  ),
5666
5666
  /* @__PURE__ */ s(
@@ -5684,7 +5684,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5684
5684
  d.stopPropagation(), kn(e);
5685
5685
  },
5686
5686
  className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
5687
- children: /* @__PURE__ */ s(Lr, { className: "h-3 w-3" })
5687
+ children: /* @__PURE__ */ s(Mr, { className: "h-3 w-3" })
5688
5688
  }
5689
5689
  ),
5690
5690
  /* @__PURE__ */ s(
@@ -5695,7 +5695,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5695
5695
  d.stopPropagation(), k == null || k.removeRow(a, f, n);
5696
5696
  },
5697
5697
  className: "rounded p-0.5 text-slate-400 hover:text-red-500",
5698
- children: /* @__PURE__ */ s(wo, { className: "h-3 w-3" })
5698
+ children: /* @__PURE__ */ s(_o, { className: "h-3 w-3" })
5699
5699
  }
5700
5700
  )
5701
5701
  ] }) })
@@ -5710,13 +5710,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
5710
5710
  children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: G.map((d) => {
5711
5711
  const l = typeof d == "string" ? d : d.field, m = typeof d == "string" ? void 0 : d.hint;
5712
5712
  return /* @__PURE__ */ s(
5713
- Ii,
5713
+ Ai,
5714
5714
  {
5715
5715
  parentCollection: a,
5716
5716
  relationField: l,
5717
5717
  parentRowId: null,
5718
5718
  stagedMembers: p.draft[`__o2m_${l}`] ?? [],
5719
- onStagedChange: (g) => mt(`__o2m_${l}`, g),
5719
+ onStagedChange: (h) => mt(`__o2m_${l}`, h),
5720
5720
  parentDraft: p.draft,
5721
5721
  hint: m
5722
5722
  },
@@ -5771,7 +5771,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5771
5771
  className: "mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1 text-[11px] font-normal leading-4 text-slate-500 dark:text-slate-400",
5772
5772
  children: [
5773
5773
  /* @__PURE__ */ s("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children: q == null ? void 0 : q.label }),
5774
- /* @__PURE__ */ s("span", { className: "tabular-nums", children: qi(o) })
5774
+ /* @__PURE__ */ s("span", { className: "tabular-nums", children: Ei(o) })
5775
5775
  ]
5776
5776
  }
5777
5777
  ) : null;
@@ -5779,20 +5779,20 @@ Reason: “${F.reason}”` : ""}` : void 0;
5779
5779
  return /* @__PURE__ */ s("td", { className: "px-2 py-1.5 align-top", children: c }, t.field);
5780
5780
  const u = t.interface === "formula-column" && typeof r.column_formula == "string" ? r.column_formula : null, d = n.map((b) => {
5781
5781
  if (u) {
5782
- const h = pt(
5782
+ const g = pt(
5783
5783
  u,
5784
5784
  (w) => {
5785
5785
  var y, x;
5786
5786
  return w.includes(".") ? (x = (y = Ae == null ? void 0 : Ae.rows[String(b.id)]) == null ? void 0 : y[w]) == null ? void 0 : x.value : b[w];
5787
5787
  }
5788
5788
  );
5789
- return h ?? NaN;
5789
+ return g ?? NaN;
5790
5790
  }
5791
5791
  return Number(b[t.field]);
5792
5792
  }).filter((b) => !Number.isNaN(b));
5793
5793
  let l = null;
5794
- i === "count" ? l = n.length : d.length > 0 && (i === "sum" ? l = d.reduce((b, h) => b + h, 0) : i === "avg" ? l = d.reduce((b, h) => b + h, 0) / d.length : i === "min" ? l = Math.min(...d) : i === "max" && (l = Math.max(...d)));
5795
- const m = r.format, g = l === null ? "—" : (() => {
5794
+ i === "count" ? l = n.length : d.length > 0 && (i === "sum" ? l = d.reduce((b, g) => b + g, 0) : i === "avg" ? l = d.reduce((b, g) => b + g, 0) / d.length : i === "min" ? l = Math.min(...d) : i === "max" && (l = Math.max(...d)));
5795
+ const m = r.format, h = l === null ? "—" : (() => {
5796
5796
  try {
5797
5797
  if (m === "currency")
5798
5798
  return new Intl.NumberFormat(void 0, {
@@ -5816,7 +5816,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5816
5816
  return /* @__PURE__ */ _("td", { className: "px-2 py-1.5 align-top", children: [
5817
5817
  /* @__PURE__ */ _("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-1 leading-4", children: [
5818
5818
  /* @__PURE__ */ s("span", { className: "font-mono text-[10px] text-slate-500 dark:text-slate-400", children: i.toUpperCase() }),
5819
- /* @__PURE__ */ s("span", { className: "tabular-nums", children: g })
5819
+ /* @__PURE__ */ s("span", { className: "tabular-nums", children: h })
5820
5820
  ] }),
5821
5821
  c
5822
5822
  ] }, t.field);
@@ -5827,7 +5827,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5827
5827
  ]
5828
5828
  }
5829
5829
  ),
5830
- Gi && /* @__PURE__ */ s("div", { className: "border-t border-red-100 bg-red-50 px-3 py-1.5 text-[11px] text-red-600 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: Gi }),
5830
+ Xi && /* @__PURE__ */ s("div", { className: "border-t border-red-100 bg-red-50 px-3 py-1.5 text-[11px] text-red-600 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: Xi }),
5831
5831
  $n && /* @__PURE__ */ _(
5832
5832
  "div",
5833
5833
  {
@@ -5840,17 +5840,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
5840
5840
  {
5841
5841
  type: "button",
5842
5842
  "data-grid-nested-retry": "",
5843
- disabled: Xi,
5844
- onClick: () => void Zo(),
5843
+ disabled: Ci,
5844
+ onClick: () => void ea(),
5845
5845
  className: "font-semibold underline-offset-2 hover:underline disabled:opacity-50",
5846
- children: Xi ? "Retrying…" : "Retry"
5846
+ children: Ci ? "Retrying…" : "Retry"
5847
5847
  }
5848
5848
  ),
5849
5849
  /* @__PURE__ */ s(
5850
5850
  "button",
5851
5851
  {
5852
5852
  type: "button",
5853
- onClick: () => ar(null),
5853
+ onClick: () => lr(null),
5854
5854
  className: "text-red-500/80 hover:text-red-700 dark:text-red-300/80 dark:hover:text-red-200",
5855
5855
  children: "Dismiss"
5856
5856
  }
@@ -5858,11 +5858,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
5858
5858
  ]
5859
5859
  }
5860
5860
  ),
5861
- Le === "original" && !Ir && !j && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ s(
5861
+ Le === "original" && !Ar && !j && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ s(
5862
5862
  "button",
5863
5863
  {
5864
5864
  type: "button",
5865
- onClick: Oa,
5865
+ onClick: Ia,
5866
5866
  className: "text-[11px] font-medium text-nvr-cyan hover:underline",
5867
5867
  children: "+ Add row"
5868
5868
  }
@@ -5870,16 +5870,16 @@ Reason: “${F.reason}”` : ""}` : void 0;
5870
5870
  ]
5871
5871
  }
5872
5872
  ),
5873
- _e && Ce && Le === "original" && /* @__PURE__ */ s("div", { "data-grid-split-editor-lock": "", children: po(Ce, "docked") }),
5873
+ _e && Ce && Le === "original" && /* @__PURE__ */ s("div", { "data-grid-split-editor-lock": "", children: ho(Ce, "docked") }),
5874
5874
  _e && p && Le === "original" && (() => {
5875
- const e = p.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? $.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? $[r] : void 0, o = e === "new" ? $.length + M.length + 1 : n ? $.length + t + 1 : r + 1, c = A ? `Line ${o} · ` : "", u = e === "new" ? `${c}New line` : `${c}${Ar(p.draft)}`;
5875
+ const e = p.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? $.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? $[r] : void 0, o = e === "new" ? $.length + M.length + 1 : n ? $.length + t + 1 : r + 1, c = A ? `Line ${o} · ` : "", u = e === "new" ? `${c}New line` : `${c}${jr(p.draft)}`;
5876
5876
  return /* @__PURE__ */ _(
5877
5877
  "div",
5878
5878
  {
5879
5879
  "data-o2m-editing": "",
5880
5880
  "data-grid-split-editor": "",
5881
5881
  className: "flex flex-col rounded-lg border border-nvr-cyan/40 bg-white shadow-[0_6px_24px_-8px_rgba(15,23,42,0.35)] ring-1 ring-nvr-cyan/15 dark:border-nvr-cyan/30 dark:bg-card",
5882
- style: { height: Zn },
5882
+ style: { height: er },
5883
5883
  children: [
5884
5884
  /* @__PURE__ */ s(
5885
5885
  "button",
@@ -5889,37 +5889,37 @@ Reason: “${F.reason}”` : ""}` : void 0;
5889
5889
  "data-tip": "Drag to resize · ↑/↓ nudge",
5890
5890
  className: "flex h-3 w-full shrink-0 cursor-row-resize touch-none select-none items-center justify-center rounded-t-lg border-b border-nvr-cyan/20 text-slate-300 hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-nvr-cyan dark:text-slate-500",
5891
5891
  onPointerDown: (d) => {
5892
- er.current = { startY: d.clientY, startH: Zn }, d.currentTarget.setPointerCapture(d.pointerId);
5892
+ tr.current = { startY: d.clientY, startH: er }, d.currentTarget.setPointerCapture(d.pointerId);
5893
5893
  },
5894
5894
  onPointerMove: (d) => {
5895
- const l = er.current;
5896
- l && Pi(Math.max(160, Math.min(900, l.startH + (d.clientY - l.startY))));
5895
+ const l = tr.current;
5896
+ l && Di(Math.max(160, Math.min(900, l.startH + (d.clientY - l.startY))));
5897
5897
  },
5898
5898
  onPointerUp: () => {
5899
- er.current = null;
5899
+ tr.current = null;
5900
5900
  },
5901
5901
  onPointerCancel: () => {
5902
- er.current = null;
5902
+ tr.current = null;
5903
5903
  },
5904
5904
  onKeyDown: (d) => {
5905
- (d.key === "ArrowUp" || d.key === "ArrowDown") && (d.preventDefault(), Pi(
5905
+ (d.key === "ArrowUp" || d.key === "ArrowDown") && (d.preventDefault(), Di(
5906
5906
  (l) => Math.max(160, Math.min(900, l + (d.key === "ArrowDown" ? 24 : -24)))
5907
5907
  ));
5908
5908
  },
5909
- children: /* @__PURE__ */ s(el, { className: "h-3 w-3", "aria-hidden": "true" })
5909
+ children: /* @__PURE__ */ s(tl, { className: "h-3 w-3", "aria-hidden": "true" })
5910
5910
  }
5911
5911
  ),
5912
- /* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto", children: mo({
5912
+ /* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto", children: po({
5913
5913
  identity: u,
5914
5914
  draft: p.draft,
5915
5915
  rowId: e === "new" ? void 0 : e,
5916
5916
  saveLabel: e === "new" ? "Add" : "Save",
5917
5917
  bare: !0,
5918
- onDelete: i ? (d) => wi(i, d) : n ? (d) => {
5918
+ onDelete: i ? (d) => _i(i, d) : n ? (d) => {
5919
5919
  d.stopPropagation(), k == null || k.removeRow(a, f, t);
5920
5920
  } : void 0,
5921
5921
  // Grandchild rows of an unsaved row stage against the draft.
5922
- drawer: jr(i ? e : void 0, p.draft)
5922
+ drawer: Tr(i ? e : void 0, p.draft)
5923
5923
  }) })
5924
5924
  ]
5925
5925
  }
@@ -5928,27 +5928,27 @@ Reason: “${F.reason}”` : ""}` : void 0;
5928
5928
  /* @__PURE__ */ s(
5929
5929
  Il,
5930
5930
  {
5931
- open: Do,
5932
- onOpenChange: Ui,
5931
+ open: Wo,
5932
+ onOpenChange: Ji,
5933
5933
  columns: Ne.filter(
5934
- (e) => !Vn(e) && !e.field.includes(".") && !An(e.interface) && !So.has(e.field)
5934
+ (e) => !Vn(e) && !e.field.includes(".") && !An(e.interface) && !$o.has(e.field)
5935
5935
  ),
5936
- rows: za.map((e) => e.row),
5936
+ rows: Qa.map((e) => e.row),
5937
5937
  relations: We,
5938
5938
  collection: a,
5939
5939
  cascadeFilters: it,
5940
- onApply: Va
5940
+ onApply: Ba
5941
5941
  }
5942
5942
  ),
5943
5943
  /* @__PURE__ */ s(
5944
- qo,
5944
+ Eo,
5945
5945
  {
5946
5946
  mode: "timeline",
5947
- open: Bi,
5948
- onOpenChange: sr,
5947
+ open: Hi,
5948
+ onOpenChange: or,
5949
5949
  rowTitle: `${$.length} ${$.length === 1 ? "line" : "lines"} on this record`,
5950
- revisions: Yo,
5951
- loading: Ho,
5950
+ revisions: Go,
5951
+ loading: Yo,
5952
5952
  truncated: !!(Jt != null && Jt.truncated),
5953
5953
  fields: ke,
5954
5954
  displayCols: Ne,
@@ -5965,17 +5965,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
5965
5965
  ), o = i ? String(n[i.field]) : null;
5966
5966
  return { title: r, subtitle: o && o.length > 48 ? `${o.slice(0, 48)}…` : o };
5967
5967
  },
5968
- onRestore: (e, n) => Gs(e, n),
5969
- onRestoreAllTo: Go,
5970
- restoringAll: Fo
5968
+ onRestore: (e, n) => Xs(e, n),
5969
+ onRestoreAllTo: Xo,
5970
+ restoringAll: Vo
5971
5971
  }
5972
5972
  ),
5973
5973
  /* @__PURE__ */ s(
5974
- qo,
5974
+ Eo,
5975
5975
  {
5976
5976
  open: !!Ie,
5977
5977
  onOpenChange: (e) => {
5978
- e || (kn(null), Jr(null));
5978
+ e || (kn(null), zr(null));
5979
5979
  },
5980
5980
  rowTitle: (() => {
5981
5981
  const e = C ? Ie == null ? void 0 : Ie[C] : Ie == null ? void 0 : Ie.line_number;
@@ -5988,8 +5988,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
5988
5988
  );
5989
5989
  return e ? String(Ie[e.field]) : null;
5990
5990
  })(),
5991
- revisions: Vo,
5992
- loading: Bo,
5991
+ revisions: Bo,
5992
+ loading: Ho,
5993
5993
  fields: ke,
5994
5994
  displayCols: Ne,
5995
5995
  parentField: f,
@@ -5999,8 +5999,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
5999
5999
  m2oDisplays: pn,
6000
6000
  client: S,
6001
6001
  allowRestore: !!oe && !j,
6002
- focusRevisionId: Qo,
6003
- onRestore: (e, n) => Gs(e, { ...n, itemId: n.itemId ?? String(Ie.id) })
6002
+ focusRevisionId: Fo,
6003
+ onRestore: (e, n) => Xs(e, { ...n, itemId: n.itemId ?? String(Ie.id) })
6004
6004
  }
6005
6005
  )
6006
6006
  ]
@@ -6008,13 +6008,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
6008
6008
  )
6009
6009
  );
6010
6010
  }
6011
- const Io = {
6011
+ const Ao = {
6012
6012
  even: "Evenly",
6013
6013
  front: "Front-loaded",
6014
6014
  back: "Back-loaded",
6015
6015
  shape: "Like previous"
6016
6016
  };
6017
- function Ro(a) {
6017
+ function Po(a) {
6018
6018
  return a.presets.length < 2 ? null : /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-0.5", "data-o2m-spread-presets": !0, children: a.presets.map((f) => /* @__PURE__ */ s(
6019
6019
  "button",
6020
6020
  {
@@ -6026,7 +6026,7 @@ function Ro(a) {
6026
6026
  "rounded-full border px-2 py-px text-[10.5px]",
6027
6027
  a.value === f ? "border-nvr-cyan bg-nvr-cyan/10 font-semibold text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400"
6028
6028
  ),
6029
- children: f === "shape" ? a.shapeLabel ?? Io.shape : Io[f]
6029
+ children: f === "shape" ? a.shapeLabel ?? Ao.shape : Ao[f]
6030
6030
  },
6031
6031
  f
6032
6032
  )) });
@@ -6051,10 +6051,10 @@ function td({
6051
6051
  type: "button",
6052
6052
  onClick: () => {
6053
6053
  if (Ee) return;
6054
- const ie = W ? A.map((X) => W.values[X] ?? 0) : void 0, Oe = Ko(pe, A.length, Z, ie), ge = {};
6054
+ const ie = W ? A.map((X) => W.values[X] ?? 0) : void 0, Oe = Ro(pe, A.length, Z, ie), he = {};
6055
6055
  A.forEach((X, de) => {
6056
- ge[X] = Oe[de];
6057
- }), E(ge);
6056
+ he[X] = Oe[de];
6057
+ }), E(he);
6058
6058
  },
6059
6059
  disabled: !!Ee,
6060
6060
  title: Ee ?? `${G(pe)} across ${A.length} ${A.length === 1 ? "field" : "fields"}`,
@@ -6066,7 +6066,7 @@ function td({
6066
6066
  }
6067
6067
  ),
6068
6068
  !Ee && /* @__PURE__ */ s(
6069
- Ro,
6069
+ Po,
6070
6070
  {
6071
6071
  presets: te,
6072
6072
  value: Z,
@@ -6130,7 +6130,7 @@ function nd(a) {
6130
6130
  " first."
6131
6131
  ] }),
6132
6132
  /* @__PURE__ */ s("div", { className: "mt-2", children: /* @__PURE__ */ s(
6133
- Ro,
6133
+ Po,
6134
6134
  {
6135
6135
  presets: oe,
6136
6136
  value: oe.includes(E) ? E : oe[0],
@@ -6165,7 +6165,7 @@ function nd(a) {
6165
6165
  )
6166
6166
  ] });
6167
6167
  }
6168
- function Ao(a) {
6168
+ function jo(a) {
6169
6169
  var v, E;
6170
6170
  const f = a;
6171
6171
  return ((v = f == null ? void 0 : f.response) == null ? void 0 : v.error) ?? ((E = f == null ? void 0 : f.response) == null ? void 0 : E.message) ?? (f == null ? void 0 : f.message) ?? "the server refused it";
@@ -6174,6 +6174,6 @@ export {
6174
6174
  Pd as InlineTableField,
6175
6175
  ed as applyValueColumns,
6176
6176
  Rt as evalClientFormula,
6177
- ji as failingLints,
6178
- Ko as spreadAmounts
6177
+ Ti as failingLints,
6178
+ Ro as spreadAmounts
6179
6179
  };