@nivaro/react 0.3.140 → 0.3.141

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.
@@ -1,7 +1,7 @@
1
- import { jsx as l, jsxs as N, Fragment as _n } from "react/jsx-runtime";
2
- import { useQueryClient as da, useQuery as Ye, useQueries as xn } from "@tanstack/react-query";
3
- import { Loader2 as kn, ListChecks as Bd, SquarePen as zd, Rows3 as Jd, PanelBottomOpen as Qd, Zap as Vd, Clock as Ao, History as vi, AlertTriangle as Mr, ChevronRight as ca, GripVertical as Ul, FileUp as Bl, Lock as zl, GripHorizontal as Hd, X as Fd } from "lucide-react";
4
- import { useState as z, useMemo as M, useEffect as ne, useRef as C, useId as Jl, useContext as Gd, useDeferredValue as Cd, useCallback as Wt, Fragment as Ro } from "react";
1
+ import { jsx as l, jsxs as N, Fragment as xn } from "react/jsx-runtime";
2
+ import { useQueryClient as da, useQuery as Ye, useQueries as vn } from "@tanstack/react-query";
3
+ import { Loader2 as _n, ListChecks as Bd, SquarePen as zd, Rows3 as Jd, PanelBottomOpen as Qd, Zap as Vd, Clock as Ao, History as vi, AlertTriangle as Mr, ChevronRight as ca, GripVertical as Ul, FileUp as Bl, Lock as zl, GripHorizontal as Hd, X as Fd } from "lucide-react";
4
+ import { useState as z, useMemo as M, useEffect as ne, useRef as C, useId as Jl, useContext as Gd, useDeferredValue as Cd, useCallback as Dt, Fragment as Ro } from "react";
5
5
  import { createPortal as Yd } from "react-dom";
6
6
  import { changeReasonChallenge as jo, ChangeReasonDialog as Xd } from "./ChangeReasonDialog.js";
7
7
  import { toast as ye } from "sonner";
@@ -27,7 +27,7 @@ import { ImportFromFileButton as yc } from "../import/ImportFromFileButton.js";
27
27
  import { OWN_RECORD_WRITES_EVENT as Yl } from "../panels/RecordIntegrityBanner.js";
28
28
  import { Sheet as wc, SheetContent as vc, SheetHeader as xc, SheetTitle as _c } from "../ui/sheet.js";
29
29
  import { useAddendumO2M as kc, useAddendumView as Nc } from "./AddendumFieldContext.js";
30
- import { resolveCompareEndpoint as Sc, useCompareSeries as $c, compareColumnClosed as Zt, fmtMoney as To, CompareProposalBanner as Ec, CompareStripChips as qc, GridStatChip as Ic, CompareCell as Mo, compareRowFor as Ko, compareColumnSum as Oc, ReconcileAction as Lc } from "./CompareSeries.js";
30
+ import { resolveCompareEndpoint as Sc, useCompareSeries as $c, compareColumnClosed as Xt, fmtMoney as To, CompareProposalBanner as Ec, CompareStripChips as qc, GridStatChip as Ic, CompareCell as Mo, compareRowFor as Ko, compareColumnSum as Oc, ReconcileAction as Lc } from "./CompareSeries.js";
31
31
  import { FieldRenderer as Bn } from "./FieldRenderer.js";
32
32
  import { primaryControl as Ac, nameFieldControl as Rc } from "./field-a11y.js";
33
33
  import { GridBulkEditDialog as jc } from "./GridBulkEditDialog.js";
@@ -205,7 +205,7 @@ function Pu(s) {
205
205
  }
206
206
  return null;
207
207
  }
208
- function Ut(s, f) {
208
+ function Wt(s, f) {
209
209
  return ct(s, f);
210
210
  }
211
211
  function Bo(s, f) {
@@ -398,7 +398,7 @@ function Wu({
398
398
  const D = Et.get(String(H.id)), R = Number((D == null ? void 0 : D[s.value_field]) ?? 0) || 0;
399
399
  return Ve(s.value_max, H, { __input__: R, __saved__: R });
400
400
  }
401
- return /* @__PURE__ */ N(_n, { children: [
401
+ return /* @__PURE__ */ N(xn, { children: [
402
402
  /* @__PURE__ */ l(
403
403
  "button",
404
404
  {
@@ -412,7 +412,7 @@ function Wu({
412
412
  /* @__PURE__ */ l(xc, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ l(_c, { className: "text-[14px]", children: s.title ?? "Allocate" }) }),
413
413
  /* @__PURE__ */ N("div", { className: "p-4", children: [
414
414
  /* @__PURE__ */ l("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
415
- ut ? /* @__PURE__ */ l("div", { className: "py-10 text-center", children: /* @__PURE__ */ l(kn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : de.length === 0 ? /* @__PURE__ */ l("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ N("table", { className: "w-full text-left text-[12px]", children: [
415
+ ut ? /* @__PURE__ */ l("div", { className: "py-10 text-center", children: /* @__PURE__ */ l(_n, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : de.length === 0 ? /* @__PURE__ */ l("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ N("table", { className: "w-full text-left text-[12px]", children: [
416
416
  /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ N("tr", { className: "border-b border-slate-200 bg-slate-50", children: [
417
417
  Oe.map((H, D) => /* @__PURE__ */ l(
418
418
  "th",
@@ -445,12 +445,12 @@ function Wu({
445
445
  (Ce) => Pe(String(Ce.id)).amount > 0
446
446
  ).length, it = Oe.map(
447
447
  (Ce) => !!Ce.formula || Ce.format === "currency"
448
- ), zt = it.indexOf(!0), en = zt === -1 ? Oe.length : Math.max(1, zt), Ii = (Ce) => {
448
+ ), Bt = it.indexOf(!0), Zt = Bt === -1 ? Oe.length : Math.max(1, Bt), Ii = (Ce) => {
449
449
  const mt = Oe[Ce];
450
450
  let Ie = 0;
451
451
  for (const Vn of S) {
452
- const tn = mt.formula ? Ve(mt.formula, Vn, ke(String(Vn.id))) : Number(Ni(Vn, mt.path ?? ""));
453
- tn !== null && Number.isFinite(tn) && (Ie += tn);
452
+ const en = mt.formula ? Ve(mt.formula, Vn, ke(String(Vn.id))) : Number(Ni(Vn, mt.path ?? ""));
453
+ en !== null && Number.isFinite(en) && (Ie += en);
454
454
  }
455
455
  return Ie.toLocaleString("en-US", {
456
456
  style: "currency",
@@ -466,7 +466,7 @@ function Wu({
466
466
  {
467
467
  className: "border-b border-slate-200 bg-slate-100/80",
468
468
  children: [
469
- /* @__PURE__ */ l("td", { colSpan: en, className: "px-2 py-1", children: /* @__PURE__ */ N(
469
+ /* @__PURE__ */ l("td", { colSpan: Zt, className: "px-2 py-1", children: /* @__PURE__ */ N(
470
470
  "button",
471
471
  {
472
472
  type: "button",
@@ -495,11 +495,11 @@ function Wu({
495
495
  ]
496
496
  }
497
497
  ) }),
498
- Oe.slice(en).map((Ce, mt) => /* @__PURE__ */ l(
498
+ Oe.slice(Zt).map((Ce, mt) => /* @__PURE__ */ l(
499
499
  "td",
500
500
  {
501
501
  className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-slate-600",
502
- children: it[en + mt] ? Ii(en + mt) : ""
502
+ children: it[Zt + mt] ? Ii(Zt + mt) : ""
503
503
  },
504
504
  mt
505
505
  )),
@@ -514,7 +514,7 @@ function Wu({
514
514
  );
515
515
  }
516
516
  if (s.group_by && !Y.has(v)) continue;
517
- const Bt = Pe(V), Qn = Bt.amount > 0 ? Bt.savedRow ?? {} : void 0, ft = Z[V] ?? (Bt.amount > 0 ? String(Bt.amount) : "");
517
+ const Ut = Pe(V), Qn = Ut.amount > 0 ? Ut.savedRow ?? {} : void 0, ft = Z[V] ?? (Ut.amount > 0 ? String(Ut.amount) : "");
518
518
  q.push(
519
519
  /* @__PURE__ */ N("tr", { className: xe(Qn && "bg-nvr-cyan/5"), children: [
520
520
  Oe.map((S, E) => {
@@ -548,7 +548,7 @@ function Wu({
548
548
  min: 0,
549
549
  value: ft,
550
550
  title: S !== null ? `Max ${S.toLocaleString("en-US", { style: "currency", currency: "USD" })}` : void 0,
551
- onChange: (it) => we((zt) => ({ ...zt, [V]: it.target.value })),
551
+ onChange: (it) => we((Bt) => ({ ...Bt, [V]: it.target.value })),
552
552
  onBlur: () => {
553
553
  Z[V] !== void 0 && Be(V, Z[V], fe);
554
554
  },
@@ -563,7 +563,7 @@ function Wu({
563
563
  }
564
564
  );
565
565
  })(),
566
- Ge === V && /* @__PURE__ */ l(kn, { className: "h-3 w-3 animate-spin text-slate-400" })
566
+ Ge === V && /* @__PURE__ */ l(_n, { className: "h-3 w-3 animate-spin text-slate-400" })
567
567
  ] }) })
568
568
  ] }, V)
569
569
  );
@@ -633,7 +633,7 @@ function Uu({
633
633
  }
634
634
  const Xe = {};
635
635
  for (const [Ke, Oe] of Object.entries(s.set)) {
636
- const et = Ut(Oe, we);
636
+ const et = Wt(Oe, we);
637
637
  et != null && Number.isFinite(et) && (Xe[Ke] = Math.round(et * 100) / 100);
638
638
  }
639
639
  if (Object.keys(Xe).length === 0) {
@@ -754,7 +754,7 @@ function Bu({
754
754
  const H = Pe;
755
755
  for (const D of Ve) {
756
756
  if (Pe <= 0) break;
757
- const R = String(D.id), pe = (Ut(s.candidates.capacity_formula, D) ?? 0) - (qt[R] ?? 0) - (ue[R] ?? 0);
757
+ const R = String(D.id), pe = (Wt(s.candidates.capacity_formula, D) ?? 0) - (qt[R] ?? 0) - (ue[R] ?? 0);
758
758
  if (pe < qe) continue;
759
759
  const q = Math.min(Pe, pe), Ae = ut.find((fe) => String(fe[$e]) === R);
760
760
  if (Ae) {
@@ -846,10 +846,10 @@ function Vf({
846
846
  editorMode: pe
847
847
  }) {
848
848
  var Pl, Dl, Wl;
849
- const q = qi(), Ae = mc(), fe = Zd(), V = da(), v = au(), Bt = du(), Qn = cu(), ft = kc()[D ?? ""] ?? [], S = y === "new", E = ec(), it = tc(), zt = fc(), en = `nvr_grid_editor_${s}_${D ?? f}`, [Ii, Kr] = z(() => {
849
+ const q = qi(), Ae = mc(), fe = Zd(), V = da(), v = au(), Ut = du(), Qn = cu(), ft = kc()[D ?? ""] ?? [], S = y === "new", E = ec(), it = tc(), Bt = fc(), Zt = `nvr_grid_editor_${s}_${D ?? f}`, [Ii, Kr] = z(() => {
850
850
  if (typeof localStorage > "u") return null;
851
851
  try {
852
- const e = localStorage.getItem(en);
852
+ const e = localStorage.getItem(Zt);
853
853
  return e === "split" || e === "drawer" ? e : null;
854
854
  } catch {
855
855
  return null;
@@ -872,13 +872,13 @@ function Vf({
872
872
  }, [pe, Ce, D]), Ie = !R && (Ii ?? mt) === "split", Vn = (e) => {
873
873
  Kr(e);
874
874
  try {
875
- localStorage.setItem(en, e);
875
+ localStorage.setItem(Zt, e);
876
876
  } catch {
877
877
  }
878
- }, tn = `nvr_grid_split_h_${s}`, [Pr, Vo] = z(() => {
878
+ }, en = `nvr_grid_split_h_${s}`, [Pr, Vo] = z(() => {
879
879
  if (typeof localStorage > "u") return 320;
880
880
  try {
881
- const e = Number(localStorage.getItem(tn));
881
+ const e = Number(localStorage.getItem(en));
882
882
  return Number.isFinite(e) && e >= 160 ? Math.min(e, 900) : 320;
883
883
  } catch {
884
884
  return 320;
@@ -886,10 +886,10 @@ function Vf({
886
886
  });
887
887
  ne(() => {
888
888
  try {
889
- localStorage.setItem(tn, String(Pr));
889
+ localStorage.setItem(en, String(Pr));
890
890
  } catch {
891
891
  }
892
- }, [Pr, tn]);
892
+ }, [Pr, en]);
893
893
  const Dr = C(null), Hn = C(null), Ho = C(async () => {
894
894
  }), Oi = C(
895
895
  async () => {
@@ -922,7 +922,7 @@ function Vf({
922
922
  };
923
923
  return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
924
924
  }, [Ie]);
925
- const [nn, Go] = z(!1), [pt, Fn] = z(/* @__PURE__ */ new Set()), [Gn, Co] = z(!1), Yo = (e) => Fn((n) => {
925
+ const [tn, Go] = z(!1), [pt, Fn] = z(/* @__PURE__ */ new Set()), [Gn, Co] = z(!1), Yo = (e) => Fn((n) => {
926
926
  const t = new Set(n);
927
927
  return t.has(e) ? t.delete(e) : t.add(e), t;
928
928
  }), Xo = qt ? qt.line_field ?? "line_number" : null, { data: Ur } = Ye({
@@ -1011,7 +1011,7 @@ function Vf({
1011
1011
  })
1012
1012
  ), p = new Set((d.data ?? []).map((m) => String(m.id)));
1013
1013
  for (const m of e) {
1014
- const h = An(r, m);
1014
+ const h = Ln(r, m);
1015
1015
  (h == null ? void 0 : h.id) != null && p.add(String(h.id));
1016
1016
  }
1017
1017
  n.set(r, p);
@@ -1033,7 +1033,7 @@ function Vf({
1033
1033
  !ya.has(g) && _ != null && typeof _ != "object" && (h[g] = _);
1034
1034
  return h;
1035
1035
  }), i = await wa(r), { rows: o, dropped: a } = ju(r, i);
1036
- un(o).forEach((m, h) => {
1036
+ cn(o).forEach((m, h) => {
1037
1037
  var g;
1038
1038
  (g = a[h]) != null && g.length && ns.current.set(m, new Set(a[h])), v.queueRow(s, f, m);
1039
1039
  });
@@ -1056,7 +1056,7 @@ function Vf({
1056
1056
  ).then((e) => e.data ?? []),
1057
1057
  enabled: !!(Re != null && Re.id),
1058
1058
  staleTime: 15e3
1059
- }), { data: rn, isLoading: Sa } = Ye({
1059
+ }), { data: nn, isLoading: Sa } = Ye({
1060
1060
  queryKey: ["o2m-field-snapshots", s, f, y],
1061
1061
  queryFn: () => q.request(
1062
1062
  ce("/revisions/o2m-snapshots", {
@@ -1068,7 +1068,7 @@ function Vf({
1068
1068
  enabled: rs && !S,
1069
1069
  staleTime: 15e3
1070
1070
  }), $a = M(
1071
- () => ((rn == null ? void 0 : rn.data) ?? []).map((e) => ({
1071
+ () => ((nn == null ? void 0 : nn.data) ?? []).map((e) => ({
1072
1072
  id: e.revision_id,
1073
1073
  delta: e.delta ?? null,
1074
1074
  data: e.data ?? {},
@@ -1080,7 +1080,7 @@ function Vf({
1080
1080
  user_email: e.user_email,
1081
1081
  item_id: String(e.item_id)
1082
1082
  })),
1083
- [rn]
1083
+ [nn]
1084
1084
  );
1085
1085
  async function Ea(e) {
1086
1086
  is(!0);
@@ -1117,21 +1117,21 @@ function Vf({
1117
1117
  (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || zr.blur();
1118
1118
  };
1119
1119
  ne(() => () => zr.flush(), [zr]);
1120
- const Nn = C(null);
1120
+ const kn = C(null);
1121
1121
  ne(() => {
1122
1122
  const e = u == null ? void 0 : u.rowId, n = e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}` : null;
1123
- n !== Nn.current && (typeof window > "u" || (Nn.current && window.dispatchEvent(
1123
+ n !== kn.current && (typeof window > "u" || (kn.current && window.dispatchEvent(
1124
1124
  new CustomEvent("nvr:row-editing", {
1125
- detail: { row: Nn.current, state: "end" }
1125
+ detail: { row: kn.current, state: "end" }
1126
1126
  })
1127
1127
  ), n && window.dispatchEvent(
1128
1128
  new CustomEvent("nvr:row-editing", { detail: { row: n, state: "start" } })
1129
- ), Nn.current = n));
1129
+ ), kn.current = n));
1130
1130
  }, [u == null ? void 0 : u.rowId, s]), ne(
1131
1131
  () => () => {
1132
- Nn.current && typeof window < "u" && window.dispatchEvent(
1132
+ kn.current && typeof window < "u" && window.dispatchEvent(
1133
1133
  new CustomEvent("nvr:row-editing", {
1134
- detail: { row: Nn.current, state: "end" }
1134
+ detail: { row: kn.current, state: "end" }
1135
1135
  })
1136
1136
  );
1137
1137
  },
@@ -1144,19 +1144,19 @@ function Vf({
1144
1144
  ne(() => {
1145
1145
  He.current = u, u || (Zn.current = null);
1146
1146
  }, [u]);
1147
- const Zn = C(null), on = C(null), ss = C(async () => ({
1147
+ const Zn = C(null), rn = C(null), ss = C(async () => ({
1148
1148
  ok: !0,
1149
1149
  committed: !1
1150
1150
  }));
1151
1151
  ss.current = async () => {
1152
1152
  const e = He.current;
1153
1153
  if (!e) {
1154
- const r = on.current;
1154
+ const r = rn.current;
1155
1155
  return r ? { ok: await r, committed: !0 } : { ok: !0, committed: !1 };
1156
1156
  }
1157
- if (Zn.current !== e.rowId && !on.current)
1157
+ if (Zn.current !== e.rowId && !rn.current)
1158
1158
  return { ok: !0, committed: !1 };
1159
- const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + L.length + 1}` : ki(L, e.rowId, X), t = await Dt();
1159
+ const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + L.length + 1}` : ki(L, e.rowId, X), t = await Pt();
1160
1160
  return { ok: t, committed: t, label: n };
1161
1161
  };
1162
1162
  const tt = v == null ? void 0 : v.noteLineDraft, ls = !!u && Zn.current === (u.rowId ?? null);
@@ -1191,12 +1191,12 @@ function Vf({
1191
1191
  nr.current = !0;
1192
1192
  return;
1193
1193
  }
1194
- nr.current = !1, yt.current && (clearTimeout(yt.current), yt.current = null), Dt();
1194
+ nr.current = !1, yt.current && (clearTimeout(yt.current), yt.current = null), Pt();
1195
1195
  }
1196
1196
  };
1197
1197
  return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1198
1198
  }, [u, R]);
1199
- const [It, Sn] = z(!1), [cs, Ot] = z(null), [er, Qr] = z(null), [us, fs] = z(!1);
1199
+ const [It, Nn] = z(!1), [cs, Ot] = z(null), [er, Qr] = z(null), [us, fs] = z(!1);
1200
1200
  async function Oa() {
1201
1201
  if (!er) return;
1202
1202
  fs(!0);
@@ -1238,12 +1238,12 @@ function Vf({
1238
1238
  ).then((e) => (e.data ?? []).find((n) => n.layout_type === "table") ?? null),
1239
1239
  enabled: !B,
1240
1240
  staleTime: 5 * 6e4
1241
- }), sn = B ?? (Ti == null ? void 0 : Ti.id) ?? null, { data: oe = [], isLoading: ps } = Ye({
1242
- queryKey: Rr.fieldConfig(s, sn),
1241
+ }), on = B ?? (Ti == null ? void 0 : Ti.id) ?? null, { data: oe = [], isLoading: ps } = Ye({
1242
+ queryKey: Rr.fieldConfig(s, on),
1243
1243
  queryFn: () => q.request(
1244
1244
  ce(
1245
1245
  `/field-config/${s}`,
1246
- sn ? { layout_id: String(sn) } : void 0
1246
+ on ? { layout_id: String(on) } : void 0
1247
1247
  )
1248
1248
  ).then((e) => e.data ?? []),
1249
1249
  staleTime: 6e4
@@ -1255,19 +1255,19 @@ function Vf({
1255
1255
  queryFn: () => Fl(q, s),
1256
1256
  staleTime: 10 * 6e4
1257
1257
  }), We = Array.isArray(hs) ? hs : [], { data: Mi } = Ye({
1258
- queryKey: ["layout-meta", sn],
1258
+ queryKey: ["layout-meta", on],
1259
1259
  queryFn: () => q.request(
1260
- ce(`/collection-layouts/${sn}`)
1260
+ ce(`/collection-layouts/${on}`)
1261
1261
  ).then((e) => e.data ?? {}),
1262
- enabled: !!sn,
1262
+ enabled: !!on,
1263
1263
  staleTime: 5 * 6e4
1264
- }), X = (Mi == null ? void 0 : Mi.row_order_field) ?? null, ln = M(() => {
1264
+ }), X = (Mi == null ? void 0 : Mi.row_order_field) ?? null, sn = M(() => {
1265
1265
  if (!we || Object.keys(we).length === 0) return null;
1266
1266
  const e = {};
1267
1267
  for (const [n, t] of Object.entries(we))
1268
1268
  e[n] = t !== null && typeof t == "object" ? t : { _eq: t };
1269
1269
  return e;
1270
- }, [we]), an = M(
1270
+ }, [we]), ln = M(
1271
1271
  () => Object.fromEntries(
1272
1272
  Object.entries(Xe ?? {}).filter(
1273
1273
  ([, e]) => e === null || ["string", "number", "boolean"].includes(typeof e)
@@ -1276,20 +1276,20 @@ function Vf({
1276
1276
  [Xe]
1277
1277
  ), {
1278
1278
  data: Ne = [],
1279
- isLoading: dn,
1280
- dataUpdatedAt: Jt
1279
+ isLoading: an,
1280
+ dataUpdatedAt: zt
1281
1281
  } = Ye({
1282
1282
  queryKey: [
1283
1283
  "o2m-rows",
1284
1284
  s,
1285
1285
  f,
1286
1286
  y,
1287
- ln ? JSON.stringify(ln) : ""
1287
+ sn ? JSON.stringify(sn) : ""
1288
1288
  ],
1289
1289
  queryFn: () => q.request(
1290
1290
  ce(`/items/${s}`, {
1291
1291
  filter: JSON.stringify(
1292
- ln ? { _and: [{ [f]: { _eq: y } }, ln] } : { [f]: { _eq: y } }
1292
+ sn ? { _and: [{ [f]: { _eq: y } }, sn] } : { [f]: { _eq: y } }
1293
1293
  ),
1294
1294
  limit: Po
1295
1295
  })
@@ -1323,19 +1323,19 @@ function Vf({
1323
1323
  });
1324
1324
  } else t.release && e.release();
1325
1325
  }, [u == null ? void 0 : u.rowId, rr.enabled]);
1326
- const $n = (e) => {
1326
+ const Sn = (e) => {
1327
1327
  if (S) return {};
1328
1328
  const n = ot.settled(e);
1329
1329
  return typeof n == "number" && n > 0 ? { __base_revision: n } : {};
1330
- }, [Fr, Pi] = z(null), En = C(async () => !1), Di = C([]), ir = () => {
1330
+ }, [Fr, Pi] = z(null), $n = C(async () => !1), Di = C([]), ir = () => {
1331
1331
  const e = Di.current;
1332
1332
  Di.current = [], e.length !== 0 && Pi((n) => {
1333
1333
  const t = new Map((n ?? []).map((r) => [r.rowId, r]));
1334
1334
  for (const r of e) t.set(r.rowId, r);
1335
1335
  return [...t.values()];
1336
1336
  });
1337
- }, Ra = nc(2e3), { data: qn } = Ye({
1338
- queryKey: ["o2m-cell-provenance", s, f, y, Jt],
1337
+ }, Ra = nc(2e3), { data: En } = Ye({
1338
+ queryKey: ["o2m-cell-provenance", s, f, y, zt],
1339
1339
  queryFn: () => q.request(
1340
1340
  ce("/revisions/o2m-cell-provenance", {
1341
1341
  collection: s,
@@ -1352,7 +1352,7 @@ function Vf({
1352
1352
  O ?? "",
1353
1353
  D ?? f,
1354
1354
  y,
1355
- Jt
1355
+ zt
1356
1356
  ],
1357
1357
  queryFn: () => q.request(
1358
1358
  ce("/sla/line-aging", {
@@ -1367,13 +1367,13 @@ function Vf({
1367
1367
  }), bs = M(
1368
1368
  () => new Set(st != null && st.overdue ? st.overdue_ids : []),
1369
1369
  [st]
1370
- ), ys = st != null && st.overdue ? `${st.label} still missing · ${st.days} ${st.days === 1 ? "day" : "days"} on the clock (limit ${st.threshold_days})` : void 0, Wi = (qn == null ? void 0 : qn.data) ?? {}, Ta = (qn == null ? void 0 : qn.created) ?? {}, Gr = (e) => {
1370
+ ), ys = st != null && st.overdue ? `${st.label} still missing · ${st.days} ${st.days === 1 ? "day" : "days"} on the clock (limit ${st.threshold_days})` : void 0, Wi = (En == null ? void 0 : En.data) ?? {}, Ta = (En == null ? void 0 : En.created) ?? {}, Gr = (e) => {
1371
1371
  const n = Ta[e];
1372
1372
  if (!n) return null;
1373
1373
  const t = bu(n.comment);
1374
1374
  return t ? `From ${t.template} · ${Cl(n.at)} by ${n.who}` : null;
1375
- }, Qt = Te ?? [], ws = xn({
1376
- queries: Qt.map((e) => ({
1375
+ }, Jt = Te ?? [], ws = vn({
1376
+ queries: Jt.map((e) => ({
1377
1377
  queryKey: [
1378
1378
  "resolve-cascade",
1379
1379
  E == null ? void 0 : E.collection,
@@ -1394,7 +1394,7 @@ function Vf({
1394
1394
  }))
1395
1395
  }), Fe = M(() => {
1396
1396
  const e = {};
1397
- return !E || !Qt.length || Qt.forEach((n, t) => {
1397
+ return !E || !Jt.length || Jt.forEach((n, t) => {
1398
1398
  var o;
1399
1399
  const r = (o = ws[t]) == null ? void 0 : o.data;
1400
1400
  if (!r || r.type === "none") return;
@@ -1408,36 +1408,36 @@ function Vf({
1408
1408
  }
1409
1409
  }));
1410
1410
  }), e;
1411
- }, [Qt, ws, E]), Cr = M(() => {
1411
+ }, [Jt, ws, E]), Cr = M(() => {
1412
1412
  var n, t;
1413
1413
  const e = {};
1414
- for (const r of Qt) {
1414
+ for (const r of Jt) {
1415
1415
  if (!Fe[r.child_field]) continue;
1416
1416
  const i = ((n = E == null ? void 0 : E.fieldLabels) == null ? void 0 : n[r.parent_field]) ?? me(r.parent_field), o = e[t = r.child_field] ?? (e[t] = { labels: [], keys: [] });
1417
1417
  o.labels.push(i), o.keys.push(r.parent_field);
1418
1418
  }
1419
1419
  return e;
1420
- }, [Qt, Fe, E == null ? void 0 : E.fieldLabels]), W = Q === "pending", K = v ? v.getPendingRows(s, f) : [], F = W && v ? v.getPendingEdits(s, f) : /* @__PURE__ */ new Map(), [Yr, Xr] = z({});
1420
+ }, [Jt, Fe, E == null ? void 0 : E.fieldLabels]), W = Q === "pending", K = v ? v.getPendingRows(s, f) : [], F = W && v ? v.getPendingEdits(s, f) : /* @__PURE__ */ new Map(), [Yr, Xr] = z({});
1421
1421
  ne(() => {
1422
1422
  He.current || Xr({});
1423
- }, [Jt]);
1424
- const Le = W && v ? v.getPendingDeletes(s, f) : /* @__PURE__ */ new Set(), [or, vs] = z(""), Ui = C(null), sr = Cd(or), Ma = Tc(or.trim(), 300), Bi = M(() => Mc(sr), [sr]), cn = !S && Ne.length >= Po, xs = M(
1425
- () => ln ? { _and: [{ [f]: { _eq: y } }, ln] } : { [f]: { _eq: y } },
1426
- [ln, f, y]
1423
+ }, [zt]);
1424
+ const Le = W && v ? v.getPendingDeletes(s, f) : /* @__PURE__ */ new Set(), [or, vs] = z(""), Ui = C(null), sr = Cd(or), Ma = Tc(or.trim(), 300), Bi = M(() => Mc(sr), [sr]), dn = !S && Ne.length >= Po, xs = M(
1425
+ () => sn ? { _and: [{ [f]: { _eq: y } }, sn] } : { [f]: { _eq: y } },
1426
+ [sn, f, y]
1427
1427
  ), lt = Kc({
1428
1428
  client: q,
1429
1429
  collection: s,
1430
1430
  filter: xs,
1431
1431
  query: Ma,
1432
- enabled: cn,
1433
- version: Jt
1432
+ enabled: dn,
1433
+ version: zt
1434
1434
  }), Ka = Pc({
1435
1435
  client: q,
1436
1436
  collection: s,
1437
1437
  filter: xs,
1438
- enabled: cn,
1439
- version: Jt
1440
- }), Pa = C(/* @__PURE__ */ new Map()), Da = [...F.keys()].sort().join(","), zi = (u == null ? void 0 : u.rowId) ?? null, Wa = (lt.rows ?? []).map((e) => String(e.id)).join(","), Vt = M(() => {
1438
+ enabled: dn,
1439
+ version: zt
1440
+ }), Pa = C(/* @__PURE__ */ new Map()), Da = [...F.keys()].sort().join(","), zi = (u == null ? void 0 : u.rowId) ?? null, Wa = (lt.rows ?? []).map((e) => String(e.id)).join(","), Qt = M(() => {
1441
1441
  const e = Pa.current;
1442
1442
  for (const n of [...e.keys()])
1443
1443
  n !== zi && !F.has(n) && e.delete(n);
@@ -1446,16 +1446,16 @@ function Vf({
1446
1446
  (t === zi || F.has(t)) && e.set(t, n);
1447
1447
  }
1448
1448
  return Dc(Ne, lt.rows, [...e.values()]);
1449
- }, [Ne, Wa, zi, Da]), In = M(
1450
- () => new Set(Vt.map((e) => String(e.id))),
1451
- [Vt]
1452
- ), Ht = M(
1453
- () => Vt.length ? [...Ne, ...Vt] : Ne,
1454
- [Ne, Vt]
1449
+ }, [Ne, Wa, zi, Da]), qn = M(
1450
+ () => new Set(Qt.map((e) => String(e.id))),
1451
+ [Qt]
1452
+ ), Vt = M(
1453
+ () => Qt.length ? [...Ne, ...Qt] : Ne,
1454
+ [Ne, Qt]
1455
1455
  );
1456
1456
  ne(() => {
1457
- !S && !R && Vt.length && ot.noteRows(Vt);
1458
- }, [Vt, ot, S, R]);
1457
+ !S && !R && Qt.length && ot.noteRows(Qt);
1458
+ }, [Qt, ot, S, R]);
1459
1459
  const Ji = C(/* @__PURE__ */ new Set()), _s = C(null);
1460
1460
  ne(() => {
1461
1461
  Ji.current = /* @__PURE__ */ new Set();
@@ -1514,7 +1514,7 @@ function Vf({
1514
1514
  };
1515
1515
  }),
1516
1516
  [Ns, y, E == null ? void 0 : E.draft]
1517
- ), Ss = xn({
1517
+ ), Ss = vn({
1518
1518
  queries: Vi.map((e) => ({
1519
1519
  queryKey: [
1520
1520
  "match-agg",
@@ -1569,14 +1569,14 @@ function Vf({
1569
1569
  const r = t == null ? "" : String(t);
1570
1570
  r && !r.startsWith("pending:") && r !== "new" && e.add(r);
1571
1571
  };
1572
- for (const t of Ht) n(t.id);
1572
+ for (const t of Vt) n(t.id);
1573
1573
  for (const t of K) n(t.id);
1574
1574
  if (ve !== "original") {
1575
1575
  const t = ft.find((r) => r.addendumId === ve);
1576
1576
  for (const r of (t == null ? void 0 : t.rows) ?? []) n(r.id);
1577
1577
  }
1578
1578
  return [...e];
1579
- }, [Ht, Ba, ve, ft]), { data: Ee } = Ye({
1579
+ }, [Vt, Ba, ve, ft]), { data: Ee } = Ye({
1580
1580
  queryKey: [
1581
1581
  "o2m-resolve-paths",
1582
1582
  s,
@@ -1602,7 +1602,7 @@ function Vf({
1602
1602
  }
1603
1603
  return e;
1604
1604
  }, [Ee]), L = M(() => {
1605
- let e = wt ? Ht.map((n) => ({ ...n, ...wt[String(n.id)] ?? {} })) : Ht;
1605
+ let e = wt ? Vt.map((n) => ({ ...n, ...wt[String(n.id)] ?? {} })) : Vt;
1606
1606
  if (X) {
1607
1607
  const n = (t) => {
1608
1608
  const r = W ? F.get(String(t.id)) : void 0, i = (r == null ? void 0 : r[X]) ?? t[X];
@@ -1623,7 +1623,7 @@ function Vf({
1623
1623
  }
1624
1624
  return e;
1625
1625
  }, [
1626
- Ht,
1626
+ Vt,
1627
1627
  wt,
1628
1628
  X,
1629
1629
  W,
@@ -1680,7 +1680,7 @@ function Vf({
1680
1680
  for (const i of Gi) {
1681
1681
  const o = i.computed_formula;
1682
1682
  if (t && !bc(o, r, t)) continue;
1683
- const a = Ut(o, r);
1683
+ const a = Wt(o, r);
1684
1684
  a !== null && (r[i.field] = a);
1685
1685
  }
1686
1686
  return r;
@@ -1726,7 +1726,7 @@ function Vf({
1726
1726
  let i = 1;
1727
1727
  for (const a of t) a >= i && (i = a + 1);
1728
1728
  return { ...e, [X]: i };
1729
- }, un = (e) => {
1729
+ }, cn = (e) => {
1730
1730
  const n = [];
1731
1731
  return e.map((t) => {
1732
1732
  const r = dr(t, n);
@@ -1734,7 +1734,7 @@ function Vf({
1734
1734
  });
1735
1735
  }, Xi = M(() => {
1736
1736
  const e = [
1737
- ...(L ?? []).filter((n) => !Le.has(String(n.id)) && !In.has(String(n.id))).map((n) => {
1737
+ ...(L ?? []).filter((n) => !Le.has(String(n.id)) && !qn.has(String(n.id))).map((n) => {
1738
1738
  const t = String(n.id), r = F.has(t) ? { ...n, ...F.get(t) } : n;
1739
1739
  return he(r);
1740
1740
  }),
@@ -1745,7 +1745,7 @@ function Vf({
1745
1745
  r >= 0 && r < e.length && (e[r] = n);
1746
1746
  }
1747
1747
  return e;
1748
- }, [L, Yi, u, In]), cr = M(() => {
1748
+ }, [L, Yi, u, qn]), cr = M(() => {
1749
1749
  if (ve === "original") return Xi;
1750
1750
  const e = ft.find((n) => n.addendumId === ve);
1751
1751
  return e ? e.rows.map(
@@ -1754,7 +1754,7 @@ function Vf({
1754
1754
  e.baseRows ? n : void 0
1755
1755
  )
1756
1756
  ) : Xi;
1757
- }, [ve, ft, Xi]), Ls = Ne.length >= Po, Rt = E == null ? void 0 : E.draft, fn = Wt(
1757
+ }, [ve, ft, Xi]), Ls = Ne.length >= Po, Rt = E == null ? void 0 : E.draft, un = Dt(
1758
1758
  (e) => {
1759
1759
  if (e.startsWith("$parent."))
1760
1760
  return (Rt == null ? void 0 : Rt[e.slice(8)]) ?? 0;
@@ -1765,26 +1765,26 @@ function Vf({
1765
1765
  return e === "$count" ? cr.length : Rt == null ? void 0 : Rt[e];
1766
1766
  },
1767
1767
  [Rt, cr]
1768
- ), Zi = M(() => Pe != null && Pe.length ? Pe.map((e) => ({ ...e, result: ct(e.value, fn) })) : null, [Pe, fn]), ei = M(
1768
+ ), Zi = M(() => Pe != null && Pe.length ? Pe.map((e) => ({ ...e, result: ct(e.value, un) })) : null, [Pe, un]), ei = M(
1769
1769
  () => Be != null && Be.endpoint ? Sc(Be.endpoint, Rt) : null,
1770
1770
  [Be == null ? void 0 : Be.endpoint, Rt]
1771
1771
  ), eo = $c({
1772
1772
  client: q,
1773
1773
  endpoint: ei,
1774
1774
  enabled: !!Be && !S
1775
- }), j = Be && !S ? eo.data ?? null : null, As = !!Be && !S && !!ei && eo.isLoading, Rs = !!Be && !S && eo.isError, ur = Wt(
1775
+ }), j = Be && !S ? eo.data ?? null : null, As = !!Be && !S && !!ei && eo.isLoading, Rs = !!Be && !S && eo.isError, ur = Dt(
1776
1776
  (e) => e.label || me(e.field),
1777
1777
  []
1778
- ), { isAdmin: On } = Ql(), ti = Wt(
1778
+ ), { isAdmin: In } = Ql(), ti = Dt(
1779
1779
  (e) => {
1780
1780
  var n;
1781
- return !On && ((n = xi(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
1781
+ return !In && ((n = xi(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
1782
1782
  },
1783
- [On]
1784
- ), to = Wt(
1785
- (e, n) => !!(j != null && j.closed_locked) && !On && j.columns.includes(e) && Zt(j, n[j.key_field], e),
1786
- [j, On]
1787
- ), Ln = Wt(
1783
+ [In]
1784
+ ), to = Dt(
1785
+ (e, n) => !!(j != null && j.closed_locked) && !In && j.columns.includes(e) && Xt(j, n[j.key_field], e),
1786
+ [j, In]
1787
+ ), On = Dt(
1788
1788
  async (e, n, t) => {
1789
1789
  if (e.startsWith("pending:")) {
1790
1790
  const r = Number(e.slice(8)), i = K[r];
@@ -1800,7 +1800,7 @@ function Vf({
1800
1800
  v.queueEdit(s, f, e, {
1801
1801
  ...n,
1802
1802
  _change_reason: t,
1803
- ...$n(e)
1803
+ ...Sn(e)
1804
1804
  });
1805
1805
  return;
1806
1806
  }
@@ -1827,7 +1827,7 @@ function Vf({
1827
1827
  (e) => e.mode !== "add" && !js.has(e.id)
1828
1828
  ),
1829
1829
  [j == null ? void 0 : j.proposals, js]
1830
- ), no = Wt(
1830
+ ), no = Dt(
1831
1831
  (e, n = !0) => {
1832
1832
  Ha((t) => {
1833
1833
  const r = new Set(t);
@@ -1840,7 +1840,7 @@ function Vf({
1840
1840
  });
1841
1841
  },
1842
1842
  [fr]
1843
- ), Fa = Wt(
1843
+ ), Fa = Dt(
1844
1844
  (e) => {
1845
1845
  if (!j) return;
1846
1846
  const n = j.key_field, t = e.change_reason ?? e.label, r = (a) => a == null || a === "" || Number(a) === 0;
@@ -1850,8 +1850,8 @@ function Vf({
1850
1850
  if (a.category != null) continue;
1851
1851
  const c = L.find((h) => String(h[n]) === String(a.key)), d = K.findIndex((h) => String(h[n]) === String(a.key)), p = c ? { ...c, ...o.get(String(c.id)) ?? {} } : d >= 0 ? K[d] : null, m = {};
1852
1852
  for (const [h, g] of Object.entries(a.values))
1853
- Zt(j, a.key, h) || p && !r(p[h]) || (m[h] = g);
1854
- Object.keys(m).length !== 0 && (i++, c ? Ln(String(c.id), m, t) : d >= 0 ? Ln(`pending:${d}`, m, t) : v && v.queueRow(
1853
+ Xt(j, a.key, h) || p && !r(p[h]) || (m[h] = g);
1854
+ Object.keys(m).length !== 0 && (i++, c ? On(String(c.id), m, t) : d >= 0 ? On(`pending:${d}`, m, t) : v && v.queueRow(
1855
1855
  s,
1856
1856
  f,
1857
1857
  dr(he({ [n]: a.key, ...m, _change_reason: t }))
@@ -1869,14 +1869,14 @@ function Vf({
1869
1869
  v,
1870
1870
  s,
1871
1871
  f,
1872
- Ln,
1872
+ On,
1873
1873
  no
1874
1874
  ]
1875
- ), Ga = Wt(
1875
+ ), Ga = Dt(
1876
1876
  (e) => {
1877
1877
  var _;
1878
1878
  if (!((_ = ke == null ? void 0 : ke.fields) != null && _.length)) return;
1879
- const n = ct(ke.remaining, fn), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
1879
+ const n = ct(ke.remaining, un), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
1880
1880
  if (t <= 0) return;
1881
1881
  const r = ke.only_empty !== !1, i = (k) => k == null || k === "" || Number(k) === 0, o = (v == null ? void 0 : v.getPendingEdits(s, f)) ?? /* @__PURE__ */ new Map(), a = (v == null ? void 0 : v.getPendingDeletes(s, f)) ?? /* @__PURE__ */ new Set(), c = j == null ? void 0 : j.key_field, d = [];
1882
1882
  for (const k of L) {
@@ -1887,7 +1887,7 @@ function Vf({
1887
1887
  const p = [], m = [];
1888
1888
  for (const k of d)
1889
1889
  for (const x of ke.fields)
1890
- r && !i(k.row[x]) || j && Zt(j, k.row[j.key_field], x) || (p.push({ id: k.id, field: x }), m.push(0));
1890
+ r && !i(k.row[x]) || j && Xt(j, k.row[j.key_field], x) || (p.push({ id: k.id, field: x }), m.push(0));
1891
1891
  if (p.length === 0) {
1892
1892
  ye.message("Nothing to spread into — every target is filled or closed");
1893
1893
  return;
@@ -1903,7 +1903,7 @@ function Vf({
1903
1903
  $[k.field] = h[x], g.set(k.id, $);
1904
1904
  });
1905
1905
  for (const [k, x] of g)
1906
- Ln(
1906
+ On(
1907
1907
  k,
1908
1908
  x,
1909
1909
  `${ke.label ?? "Spread remaining"} across ${g.size} rows`
@@ -1915,25 +1915,25 @@ function Vf({
1915
1915
  // eslint-disable-next-line react-hooks/exhaustive-deps
1916
1916
  [
1917
1917
  ke,
1918
- fn,
1918
+ un,
1919
1919
  v,
1920
1920
  s,
1921
1921
  f,
1922
1922
  j,
1923
1923
  L,
1924
1924
  K,
1925
- Ln
1925
+ On
1926
1926
  ]
1927
- ), mn = Bt == null ? void 0 : Bt.report;
1927
+ ), fn = Ut == null ? void 0 : Ut.report;
1928
1928
  ne(() => {
1929
- if (mn) {
1930
- if (Ls || dn) {
1931
- mn(s, f, null);
1929
+ if (fn) {
1930
+ if (Ls || an) {
1931
+ fn(s, f, null);
1932
1932
  return;
1933
1933
  }
1934
- mn(s, f, cr);
1934
+ fn(s, f, cr);
1935
1935
  }
1936
- }, [mn, s, f, cr, Ls, dn]);
1936
+ }, [fn, s, f, cr, Ls, an]);
1937
1937
  const jt = uu(), ni = `${s}.${f}`, Ms = jt == null ? void 0 : jt.lineInputs(ni), mr = jt == null ? void 0 : jt.reportLines;
1938
1938
  ne(() => {
1939
1939
  if (!mr || !Ms) return;
@@ -1944,7 +1944,7 @@ function Vf({
1944
1944
  }, n = [];
1945
1945
  for (const t of L ?? []) {
1946
1946
  const r = String(t.id);
1947
- if (Le.has(r) || In.has(r)) continue;
1947
+ if (Le.has(r) || qn.has(r)) continue;
1948
1948
  const i = { ...t, ...F.get(r) ?? {} };
1949
1949
  n.push({
1950
1950
  key: r,
@@ -1967,7 +1967,7 @@ function Vf({
1967
1967
  return r || !fu(t) ? null : ((o = (i = jt == null ? void 0 : jt.lines[ni]) == null ? void 0 : i.rows[e]) == null ? void 0 : o[n]) ?? null;
1968
1968
  }, Ps = C(() => {
1969
1969
  });
1970
- Ps.current = () => mn == null ? void 0 : mn(s, f, null), ne(() => () => Ps.current(), []);
1970
+ Ps.current = () => fn == null ? void 0 : fn(s, f, null), ne(() => () => Ps.current(), []);
1971
1971
  const hr = M(() => {
1972
1972
  const e = /* @__PURE__ */ new Map();
1973
1973
  for (const n of oe) {
@@ -2014,7 +2014,7 @@ function Vf({
2014
2014
  }), (t = e.get(a)) == null || t.fields.add(i.source_field);
2015
2015
  }
2016
2016
  return [...e.entries()];
2017
- }, [hr, Ds, E == null ? void 0 : E.draft]), Ws = xn({
2017
+ }, [hr, Ds, E == null ? void 0 : E.draft]), Ws = vn({
2018
2018
  queries: Ca.map(([e, n]) => ({
2019
2019
  queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
2020
2020
  queryFn: () => Ae(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
@@ -2038,11 +2038,11 @@ function Vf({
2038
2038
  return { id: d, tag: o.tag ?? "Default" };
2039
2039
  }
2040
2040
  return null;
2041
- }, An = (e, n) => {
2041
+ }, Ln = (e, n) => {
2042
2042
  const t = hr.get(e);
2043
2043
  return t ? ro(t, n) : null;
2044
2044
  }, Se = oe.filter(
2045
- (e) => !e.hidden && (!Jo.has(e.type) || ar(e.interface)) && e.field !== f && e.field !== "id" && (!sn || e.layout_assigned === !0) && !zo.has(e.field) && !Va.has(e.group_key ?? "")
2045
+ (e) => !e.hidden && (!Jo.has(e.type) || ar(e.interface)) && e.field !== f && e.field !== "id" && (!on || e.layout_assigned === !0) && !zo.has(e.field) && !Va.has(e.group_key ?? "")
2046
2046
  ), Tt = le && le.length >= 2 && ji !== Tr ? le.find((e) => e.name === ji) : void 0, Ya = new Set(
2047
2047
  (ie ?? []).map((e) => typeof e == "string" ? e : e.field)
2048
2048
  ), Us = Tt ? new Set(
@@ -2050,7 +2050,7 @@ function Vf({
2050
2050
  const n = e.indexOf(".");
2051
2051
  return n < 0 ? !0 : !Ya.has(e.slice(0, n));
2052
2052
  })
2053
- ) : null, Bs = Us ? Se.filter((e) => Us.has(e.field)) : [], Rn = M(() => {
2053
+ ) : null, Bs = Us ? Se.filter((e) => Us.has(e.field)) : [], An = M(() => {
2054
2054
  if (!Tt) return [];
2055
2055
  const e = [];
2056
2056
  for (const n of Tt.columns) {
@@ -2062,12 +2062,12 @@ function Vf({
2062
2062
  )) && e.push({ relationField: r, memberField: i });
2063
2063
  }
2064
2064
  return e;
2065
- }, [Tt, ie]), pn = M(
2066
- () => [...new Set(Rn.map((e) => e.relationField))],
2067
- [Rn]
2065
+ }, [Tt, ie]), mn = M(
2066
+ () => [...new Set(An.map((e) => e.relationField))],
2067
+ [An]
2068
2068
  ), Mt = M(() => {
2069
2069
  const e = /* @__PURE__ */ new Map();
2070
- for (const n of pn) {
2070
+ for (const n of mn) {
2071
2071
  const t = We.find(
2072
2072
  (r) => r.one_collection === s && r.one_field === n
2073
2073
  );
@@ -2077,44 +2077,44 @@ function Vf({
2077
2077
  );
2078
2078
  }
2079
2079
  return e;
2080
- }, [pn, We, s]), jn = M(
2080
+ }, [mn, We, s]), Rn = M(
2081
2081
  () => [
2082
2082
  ...new Set(
2083
2083
  [...Mt.values()].filter((e) => !!e).map((e) => e.grandCollection)
2084
2084
  )
2085
2085
  ],
2086
2086
  [Mt]
2087
- ), zs = xn({
2088
- queries: jn.map((e) => ({
2087
+ ), zs = vn({
2088
+ queries: Rn.map((e) => ({
2089
2089
  queryKey: Rr.fieldConfig(e, null),
2090
2090
  queryFn: () => q.request(ce(`/field-config/${e}`)).then((n) => n.data ?? []),
2091
2091
  staleTime: 6e4
2092
2092
  }))
2093
- }), Js = xn({
2094
- queries: jn.map((e) => ({
2093
+ }), Js = vn({
2094
+ queries: Rn.map((e) => ({
2095
2095
  queryKey: Rr.collectionRelations(e),
2096
2096
  queryFn: () => Fl(q, e),
2097
2097
  staleTime: 10 * 6e4
2098
2098
  }))
2099
2099
  }), Qs = M(() => {
2100
2100
  const e = /* @__PURE__ */ new Map();
2101
- return jn.forEach((n, t) => {
2101
+ return Rn.forEach((n, t) => {
2102
2102
  var r;
2103
2103
  e.set(n, ((r = zs[t]) == null ? void 0 : r.data) ?? []);
2104
2104
  }), e;
2105
- }, [jn, zs]), Vs = M(() => {
2105
+ }, [Rn, zs]), Vs = M(() => {
2106
2106
  const e = /* @__PURE__ */ new Map();
2107
- return jn.forEach((n, t) => {
2107
+ return Rn.forEach((n, t) => {
2108
2108
  var r;
2109
2109
  e.set(n, ((r = Js[t]) == null ? void 0 : r.data) ?? []);
2110
2110
  }), e;
2111
- }, [jn, Js]), ii = M(() => {
2111
+ }, [Rn, Js]), ii = M(() => {
2112
2112
  const e = /* @__PURE__ */ new Map();
2113
- for (const n of pn) {
2113
+ for (const n of mn) {
2114
2114
  const t = Mt.get(n);
2115
2115
  if (!t) continue;
2116
2116
  const r = Vs.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
2117
- for (const o of Rn) {
2117
+ for (const o of An) {
2118
2118
  if (o.relationField !== n) continue;
2119
2119
  const a = r.find(
2120
2120
  (c) => c.many_collection === t.grandCollection && c.many_field === o.memberField && !c.junction_field
@@ -2124,7 +2124,7 @@ function Vf({
2124
2124
  e.set(n, i);
2125
2125
  }
2126
2126
  return e;
2127
- }, [pn, Mt, Vs, Rn]), oi = M(() => L.map((e) => String(e.id)), [L]), gr = M(
2127
+ }, [mn, Mt, Vs, An]), oi = M(() => L.map((e) => String(e.id)), [L]), gr = M(
2128
2128
  () => `nvr-gf-${Math.abs(Ku(`${s}:${D ?? f}`)) % 1e5}`,
2129
2129
  [s, D, f]
2130
2130
  ), Hs = M(() => {
@@ -2165,8 +2165,8 @@ function Vf({
2165
2165
  s,
2166
2166
  oi,
2167
2167
  !!re && !S
2168
- ), Gs = xn({
2169
- queries: pn.map((e) => {
2168
+ ), Gs = vn({
2169
+ queries: mn.map((e) => {
2170
2170
  const n = Mt.get(e);
2171
2171
  return {
2172
2172
  queryKey: [
@@ -2190,7 +2190,7 @@ function Vf({
2190
2190
  })
2191
2191
  }), li = M(() => {
2192
2192
  const e = /* @__PURE__ */ new Map();
2193
- return pn.forEach((n, t) => {
2193
+ return mn.forEach((n, t) => {
2194
2194
  var o;
2195
2195
  const r = Mt.get(n), i = /* @__PURE__ */ new Map();
2196
2196
  if (r)
@@ -2200,7 +2200,7 @@ function Vf({
2200
2200
  }
2201
2201
  e.set(n, i);
2202
2202
  }), e;
2203
- }, [pn, Mt, Gs]), Cs = Qn == null ? void 0 : Qn.report;
2203
+ }, [mn, Mt, Gs]), Cs = Qn == null ? void 0 : Qn.report;
2204
2204
  ne(() => {
2205
2205
  if (!Cs || !ie || ie.length === 0) return;
2206
2206
  const e = `${s}.${f}`, n = (r, i) => {
@@ -2317,7 +2317,7 @@ function Vf({
2317
2317
  enabled: !!s,
2318
2318
  staleTime: 10 * 6e4
2319
2319
  }), Xs = M(
2320
- () => Rn.map(({ relationField: e, memberField: n }) => {
2320
+ () => An.map(({ relationField: e, memberField: n }) => {
2321
2321
  const t = Mt.get(e), i = (t ? Qs.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2322
2322
  return {
2323
2323
  field: `${e}.${n}`,
@@ -2338,7 +2338,7 @@ function Vf({
2338
2338
  dependency_config: null
2339
2339
  };
2340
2340
  }),
2341
- [Rn, Mt, Qs]
2341
+ [An, Mt, Qs]
2342
2342
  );
2343
2343
  function nt(e) {
2344
2344
  return e.type === "presentation" && e.field.includes(".");
@@ -2400,19 +2400,19 @@ function Vf({
2400
2400
  `${m.id}:${h}`
2401
2401
  )) });
2402
2402
  }
2403
- const je = Tt && (Bs.length > 0 || Xs.length > 0) ? [...Bs, ...Xs] : Se, hn = C(null), [td, so] = z(0), el = C(/* @__PURE__ */ new Map()), Kt = C(0), lo = 1e4, vt = (e) => el.current.set(String(e), Date.now());
2403
+ const je = Tt && (Bs.length > 0 || Xs.length > 0) ? [...Bs, ...Xs] : Se, pn = C(null), [td, so] = z(0), el = C(/* @__PURE__ */ new Map()), Kt = C(0), lo = 1e4, vt = (e) => el.current.set(String(e), Date.now());
2404
2404
  ne(() => {
2405
2405
  const e = new Set(Ne.map((t) => String(t.id))), n = _s.current;
2406
2406
  if (_s.current = e, !(!n || !or.trim()) && !(Date.now() - Kt.current > lo))
2407
2407
  for (const t of e) n.has(t) || Ji.current.add(t);
2408
- }, [Jt]), ne(() => {
2408
+ }, [zt]), ne(() => {
2409
2409
  const e = (n) => {
2410
2410
  var r;
2411
2411
  const t = ((r = n.detail) == null ? void 0 : r.writes) ?? [];
2412
2412
  for (const i of t) i.collection === s && vt(i.id);
2413
2413
  };
2414
2414
  return window.addEventListener(Yl, e), () => window.removeEventListener(Yl, e);
2415
- }, [s]), En.current = async (e, n, t, r) => {
2415
+ }, [s]), $n.current = async (e, n, t, r) => {
2416
2416
  const i = await Cc(q, ot, e, n, t, {
2417
2417
  key: `${s}.${f}`,
2418
2418
  label: ki(L, n, X),
@@ -2421,7 +2421,7 @@ function Vf({
2421
2421
  return i.ok ? (vt(n), !0) : (Di.current.push(i.conflict), !1);
2422
2422
  };
2423
2423
  const ao = async (e, n, t) => {
2424
- const r = await En.current(e, n, t);
2424
+ const r = await $n.current(e, n, t);
2425
2425
  return r || ir(), r;
2426
2426
  }, nd = async (e) => {
2427
2427
  const n = Fr ?? [];
@@ -2434,14 +2434,14 @@ function Vf({
2434
2434
  if (o) {
2435
2435
  r.latest > 0 && ot.set(r.rowId, r.latest);
2436
2436
  try {
2437
- await En.current(r.url, r.rowId, o) && t++;
2437
+ await $n.current(r.url, r.rowId, o) && t++;
2438
2438
  } catch (a) {
2439
2439
  ye.error(`${r.label}: ${zn(a, "could not save")}`);
2440
2440
  }
2441
2441
  }
2442
2442
  }
2443
2443
  ir(), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] }), t === 0 && n.length > 0 && ye.success("Kept the newer values");
2444
- }, yr = Se.map((e) => e.field).filter((e) => !e.includes(".")).join(","), Pt = Wt(
2444
+ }, yr = Se.map((e) => e.field).filter((e) => !e.includes(".")).join(","), jn = Dt(
2445
2445
  (e) => {
2446
2446
  const n = {};
2447
2447
  for (const t of yr ? yr.split(",") : []) {
@@ -2459,23 +2459,23 @@ function Vf({
2459
2459
  return t && n - t < lo ? !0 : uc(s, e);
2460
2460
  };
2461
2461
  ne(() => {
2462
- if (S || dn || !yr) return;
2463
- if (!hn.current) {
2464
- hn.current = new Map(Ne.map((i) => [String(i.id), Pt(i)])), so((i) => i + 1);
2462
+ if (S || an || !yr) return;
2463
+ if (!pn.current) {
2464
+ pn.current = new Map(Ne.map((i) => [String(i.id), { ...i }])), so((i) => i + 1);
2465
2465
  return;
2466
2466
  }
2467
- const e = hn.current, n = Date.now(), t = /* @__PURE__ */ new Set();
2467
+ const e = pn.current, n = Date.now(), t = /* @__PURE__ */ new Set();
2468
2468
  let r = !1;
2469
2469
  for (const i of Ne) {
2470
2470
  const o = String(i.id);
2471
- t.add(o), (wr(o, n) || !e.has(o) && n - Kt.current < lo) && (e.set(o, Pt(i)), r = !0);
2471
+ t.add(o), wr(o, n) ? (e.set(o, { ...i }), r = !0) : !e.has(o) && n - Kt.current < lo && (e.set(o, { ...i }), r = !0);
2472
2472
  }
2473
2473
  for (const i of [...e.keys()])
2474
2474
  !t.has(i) && wr(i, n) && (e.delete(i), r = !0);
2475
2475
  r && so((i) => i + 1);
2476
- }, [Jt, S, dn, yr]);
2476
+ }, [zt, S, an, yr]);
2477
2477
  const xt = M(() => {
2478
- const e = hn.current;
2478
+ const e = pn.current;
2479
2479
  if (!e || S) return null;
2480
2480
  const n = Date.now(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], o = /* @__PURE__ */ new Set();
2481
2481
  for (const a of Ne) {
@@ -2486,25 +2486,25 @@ function Vf({
2486
2486
  t.add(c);
2487
2487
  continue;
2488
2488
  }
2489
- wr(c, n) || rd(Pt(a), d) || r.add(c);
2489
+ wr(c, n) || rd(jn(a), jn(d)) || r.add(c);
2490
2490
  }
2491
2491
  for (const a of e.keys()) o.has(a) || i.push(a);
2492
2492
  return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
2493
- }, [Ne, td, Yi, S, Pt]), id = () => {
2494
- hn.current = new Map(Ne.map((e) => [String(e.id), Pt(e)])), so((e) => e + 1);
2493
+ }, [Ne, td, Yi, S, jn]), id = () => {
2494
+ pn.current = new Map(Ne.map((e) => [String(e.id), { ...e }])), so((e) => e + 1);
2495
2495
  }, Tn = C(null), [di, tl] = z({}), Mn = M(() => {
2496
2496
  const e = Tn.current, n = u == null ? void 0 : u.rowId;
2497
2497
  if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
2498
2498
  const t = Ne.find((o) => String(o.id) === n);
2499
2499
  if (!t || wr(n, Date.now())) return [];
2500
- const r = Pt(t), i = [];
2500
+ const r = jn(t), i = [];
2501
2501
  for (const o of Object.keys(r)) {
2502
2502
  if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(di[o] ?? "\0") === String(r[o] ?? "") || String((u == null ? void 0 : u.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2503
2503
  const a = oe.find((c) => c.field === o);
2504
2504
  (a == null ? void 0 : a.computed_type) === "write" && a.computed_formula || i.push({ field: o, label: (a == null ? void 0 : a.label) || me(o), theirs: r[o], was: e.snap[o] });
2505
2505
  }
2506
2506
  return i;
2507
- }, [Ne, u == null ? void 0 : u.rowId, u == null ? void 0 : u.draft, di, Pt, oe]), [Ft, vr] = z(null), nl = C([]), rl = C(/* @__PURE__ */ new Map()), co = C(null);
2507
+ }, [Ne, u == null ? void 0 : u.rowId, u == null ? void 0 : u.draft, di, jn, oe]), [Ht, vr] = z(null), nl = C([]), rl = C(/* @__PURE__ */ new Map()), co = C(null);
2508
2508
  ne(() => {
2509
2509
  if (typeof document > "u") return;
2510
2510
  const e = `${s}:`, n = (t) => {
@@ -2514,9 +2514,9 @@ function Vf({
2514
2514
  };
2515
2515
  return document.addEventListener("focusin", n), () => document.removeEventListener("focusin", n);
2516
2516
  }, [s]), ne(() => {
2517
- if (S || dn) return;
2518
- const e = Ht.map((d) => String(d.id)), n = new Set(e), t = nl.current, r = rl.current;
2519
- if (nl.current = e, rl.current = new Map(Ht.map((d) => [String(d.id), d])), t.length === 0) return;
2517
+ if (S || an) return;
2518
+ const e = Vt.map((d) => String(d.id)), n = new Set(e), t = nl.current, r = rl.current;
2519
+ if (nl.current = e, rl.current = new Map(Vt.map((d) => [String(d.id), d])), t.length === 0) return;
2520
2520
  const i = He.current, o = i && i.rowId !== "new" && !i.rowId.startsWith("pending:") ? i.rowId : null, a = co.current, c = Date.now();
2521
2521
  for (const d of [o, a]) {
2522
2522
  if (!d || n.has(d) || !t.includes(d) || Le.has(d) || wr(d, c)) continue;
@@ -2552,15 +2552,15 @@ function Vf({
2552
2552
  });
2553
2553
  break;
2554
2554
  }
2555
- }, [Jt, Ht]), ne(() => {
2556
- if (!Ft || Object.keys(Ft.changes).length > 0) return;
2555
+ }, [zt, Vt]), ne(() => {
2556
+ if (!Ht || Object.keys(Ht.changes).length > 0) return;
2557
2557
  const e = setTimeout(() => vr(null), 1e4);
2558
2558
  return () => clearTimeout(e);
2559
- }, [Ft]);
2560
- const { userId: od } = Ql(), sd = () => Ft ? /* @__PURE__ */ l(
2559
+ }, [Ht]);
2560
+ const { userId: od } = Ql(), sd = () => Ht ? /* @__PURE__ */ l(
2561
2561
  pu,
2562
2562
  {
2563
- state: Ft,
2563
+ state: Ht,
2564
2564
  labelOf: (e) => {
2565
2565
  var n;
2566
2566
  return ((n = oe.find((t) => t.field === e)) == null ? void 0 : n.label) || me(e);
@@ -2646,7 +2646,7 @@ function Vf({
2646
2646
  r.who && e.add(r.who);
2647
2647
  }
2648
2648
  return [...e];
2649
- }, [xt, Wi]), [Ze, gn] = z(null), uo = C(/* @__PURE__ */ new Set()), sl = (e, n) => JSON.stringify([e, n]), [Kn, ld] = z(() => /* @__PURE__ */ new Map()), ll = C(""), fo = C(() => {
2649
+ }, [xt, Wi]), [Ze, hn] = z(null), uo = C(/* @__PURE__ */ new Set()), sl = (e, n) => JSON.stringify([e, n]), [Kn, ld] = z(() => /* @__PURE__ */ new Map()), ll = C(""), fo = C(() => {
2650
2650
  }), ad = (e) => {
2651
2651
  const n = Hn.current;
2652
2652
  if (!n) return null;
@@ -2657,7 +2657,7 @@ function Vf({
2657
2657
  return i != null && i.trim() ? i : null;
2658
2658
  }
2659
2659
  return null;
2660
- }, al = !ps && (S || !dn);
2660
+ }, al = !ps && (S || !an);
2661
2661
  ne(() => {
2662
2662
  const e = Hn.current;
2663
2663
  if (!e || !al || typeof MutationObserver > "u") return;
@@ -2690,11 +2690,11 @@ function Vf({
2690
2690
  const [t, r] = JSON.parse(n);
2691
2691
  Kn.get(t) !== r && e.delete(n);
2692
2692
  }
2693
- Ze && Kn.get(Ze.rowKey) !== Ze.editor && gn(null);
2693
+ Ze && Kn.get(Ze.rowKey) !== Ze.editor && hn(null);
2694
2694
  }, [Kn, Ze]), ne(() => {
2695
2695
  if (!Ze || typeof window > "u") return;
2696
2696
  const e = (n) => {
2697
- n.key === "Escape" && gn(null);
2697
+ n.key === "Escape" && hn(null);
2698
2698
  };
2699
2699
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2700
2700
  }, [Ze]);
@@ -2709,9 +2709,9 @@ function Vf({
2709
2709
  }), e;
2710
2710
  }, [Kn, L]);
2711
2711
  ne(() => {
2712
- if (!zt || S) return;
2712
+ if (!Bt || S) return;
2713
2713
  let e = null;
2714
- const n = zt.subscribeCollections([s], () => {
2714
+ const n = Bt.subscribeCollections([s], () => {
2715
2715
  e && clearTimeout(e), e = setTimeout(() => {
2716
2716
  e = null, V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
2717
2717
  }, 1500);
@@ -2719,7 +2719,7 @@ function Vf({
2719
2719
  return () => {
2720
2720
  n(), e && clearTimeout(e);
2721
2721
  };
2722
- }, [zt, s, f, y, S, V]);
2722
+ }, [Bt, s, f, y, S, V]);
2723
2723
  const dl = C(null);
2724
2724
  ne(() => {
2725
2725
  const e = {
@@ -2785,7 +2785,7 @@ function Vf({
2785
2785
  a.length && e.push({ field: t, target: r.one_collection, filter: o, ids: a });
2786
2786
  }
2787
2787
  return e;
2788
- }, [Fe, xr, ze, L, K]), ul = xn({
2788
+ }, [Fe, xr, ze, L, K]), ul = vn({
2789
2789
  queries: ho.map((e) => ({
2790
2790
  queryKey: [
2791
2791
  "cascade-stale-sweep",
@@ -2812,7 +2812,7 @@ function Vf({
2812
2812
  const i = /* @__PURE__ */ new Set();
2813
2813
  if (hr.has(n.field))
2814
2814
  for (const c of [...L, ...K]) {
2815
- const d = An(n.field, c);
2815
+ const d = Ln(n.field, c);
2816
2816
  (d == null ? void 0 : d.id) != null && i.add(String(d.id));
2817
2817
  }
2818
2818
  const o = n.ids.filter((c) => !r.has(c) && !i.has(c));
@@ -2829,7 +2829,7 @@ function Vf({
2829
2829
  ]), ui = C(/* @__PURE__ */ new Set()), go = C(!1);
2830
2830
  function dd(e) {
2831
2831
  const n = [], t = [];
2832
- for (const r of Qt) {
2832
+ for (const r of Jt) {
2833
2833
  const i = r.on_unavailable;
2834
2834
  if (!(i != null && i.replace)) continue;
2835
2835
  const o = ci.get(r.child_field), a = Fe[r.child_field], c = ze.get(r.child_field);
@@ -2899,7 +2899,7 @@ function Vf({
2899
2899
  const e = E == null ? void 0 : E.dirtyFields;
2900
2900
  if (!e || e.size === 0) return;
2901
2901
  const n = [];
2902
- for (const r of Qt) {
2902
+ for (const r of Jt) {
2903
2903
  const i = r.on_unavailable;
2904
2904
  if (!(i != null && i.replace) || !e.has(r.parent_field)) continue;
2905
2905
  const o = ci.get(r.child_field), a = Fe[r.child_field], c = ze.get(r.child_field);
@@ -2945,7 +2945,7 @@ function Vf({
2945
2945
  i += $.unresolved;
2946
2946
  const b = $.map;
2947
2947
  if (b.size === 0) continue;
2948
- const w = Ct(), A = async (T) => {
2948
+ const w = Gt(), A = async (T) => {
2949
2949
  const ee = {
2950
2950
  ...T,
2951
2951
  [x]: b.get(String(T[x]))
@@ -2991,9 +2991,9 @@ function Vf({
2991
2991
  for (const T of G) {
2992
2992
  const ee = String(T.id), ge = await A({ ...T, ...F.get(ee) ?? {} });
2993
2993
  if ((W || S) && v)
2994
- v.queueEdit(s, f, ee, { ...ge, ...$n(ee) });
2994
+ v.queueEdit(s, f, ee, { ...ge, ...Sn(ee) });
2995
2995
  else {
2996
- const te = await En.current(`/items/${s}/${ee}`, ee, ge).then((be) => be ? "ok" : "conflict").catch(() => "failed");
2996
+ const te = await $n.current(`/items/${s}/${ee}`, ee, ge).then((be) => be ? "ok" : "conflict").catch(() => "failed");
2997
2997
  if (te === "conflict") {
2998
2998
  a++;
2999
2999
  continue;
@@ -3046,7 +3046,7 @@ function Vf({
3046
3046
  }, [Se, ze]), ud = M(
3047
3047
  () => ["m2o-display", s, ...Array.from(_r.entries()).flat(2)],
3048
3048
  [s, _r]
3049
- ), { data: bn = {}, isFetching: fd } = Ye({
3049
+ ), { data: gn = {}, isFetching: fd } = Ye({
3050
3050
  queryKey: ud,
3051
3051
  queryFn: async () => {
3052
3052
  const e = {}, n = await Promise.all(
@@ -3100,7 +3100,7 @@ function Vf({
3100
3100
  () => de != null && de.unmatched_banner ? K.map((e) => he({ ...e })) : void 0,
3101
3101
  // eslint-disable-next-line react-hooks/exhaustive-deps
3102
3102
  [de == null ? void 0 : de.unmatched_banner, K]
3103
- ), Gt = yu({
3103
+ ), Ft = yu({
3104
3104
  config: de,
3105
3105
  rows: L,
3106
3106
  stagedRows: md,
@@ -3108,7 +3108,7 @@ function Vf({
3108
3108
  childRelations: We,
3109
3109
  parentDraft: E == null ? void 0 : E.draft,
3110
3110
  m2oRelMap: ze,
3111
- m2oDisplays: bn,
3111
+ m2oDisplays: gn,
3112
3112
  client: q
3113
3113
  });
3114
3114
  async function ml(e) {
@@ -3156,7 +3156,7 @@ function Vf({
3156
3156
  collection: s,
3157
3157
  fk_field: f,
3158
3158
  ...S ? {} : { parent_id: y },
3159
- parent_context: Ct(),
3159
+ parent_context: Gt(),
3160
3160
  parent_collection: O,
3161
3161
  row_rules: U,
3162
3162
  mode: hi,
@@ -3202,7 +3202,7 @@ function Vf({
3202
3202
  collection: s,
3203
3203
  fk_field: f,
3204
3204
  parent_id: y,
3205
- parent_context: Ct(),
3205
+ parent_context: Gt(),
3206
3206
  parent_collection: O,
3207
3207
  row_rules: U,
3208
3208
  mode: hi,
@@ -3225,7 +3225,7 @@ function Vf({
3225
3225
  Nl(null);
3226
3226
  }
3227
3227
  }
3228
- function Ct() {
3228
+ function Gt() {
3229
3229
  const e = {};
3230
3230
  if (E != null && E.draft) {
3231
3231
  if (qe != null && qe.length)
@@ -3247,7 +3247,7 @@ function Vf({
3247
3247
  data: n,
3248
3248
  locks_only: !0,
3249
3249
  probe: !0,
3250
- parent_context: Ct(),
3250
+ parent_context: Gt(),
3251
3251
  parent_collection: O,
3252
3252
  row_rules: U
3253
3253
  })
@@ -3266,17 +3266,17 @@ function Vf({
3266
3266
  De((t) => t && t.rowId === e ? { ...t, locksPending: !1 } : t);
3267
3267
  });
3268
3268
  }
3269
- const Yt = C(/* @__PURE__ */ new Map());
3269
+ const Ct = C(/* @__PURE__ */ new Map());
3270
3270
  function bo(e) {
3271
3271
  if (!(S || e === "new" || e.startsWith("pending:"))) {
3272
3272
  if (W && F.has(e)) {
3273
- Yt.current.delete(e);
3273
+ Ct.current.delete(e);
3274
3274
  return;
3275
3275
  }
3276
- Yt.current.set(e, ot.baseOf(e));
3276
+ Ct.current.set(e, ot.baseOf(e));
3277
3277
  }
3278
3278
  }
3279
- const yo = async (e) => await Yt.current.get(e) ?? null;
3279
+ const yo = async (e) => await Ct.current.get(e) ?? null;
3280
3280
  function mi(e) {
3281
3281
  if (R) return;
3282
3282
  const n = String(e.id);
@@ -3284,12 +3284,12 @@ function Vf({
3284
3284
  fo.current();
3285
3285
  const t = ad(n);
3286
3286
  if (t && !uo.current.has(sl(n, t))) {
3287
- gn({ rowKey: n, editor: t });
3287
+ hn({ rowKey: n, editor: t });
3288
3288
  return;
3289
3289
  }
3290
- Ze && gn(null);
3290
+ Ze && hn(null);
3291
3291
  const r = he({ ...e }), i = Ne.find((o) => String(o.id) === n) ?? e;
3292
- Tn.current = { rowId: n, snap: Pt(i) }, bo(n), De({ rowId: n, draft: r, locksPending: Yn.size > 0 }), fi(n, r);
3292
+ Tn.current = { rowId: n, snap: jn(i) }, bo(n), De({ rowId: n, draft: r, locksPending: Yn.size > 0 }), fi(n, r);
3293
3293
  }
3294
3294
  ne(() => {
3295
3295
  const e = (n) => {
@@ -3309,7 +3309,7 @@ function Vf({
3309
3309
  if (R) return;
3310
3310
  const t = `pending:${n}`;
3311
3311
  if ((u == null ? void 0 : u.rowId) === t) return;
3312
- Ze && gn(null);
3312
+ Ze && hn(null);
3313
3313
  const r = he({ ...e });
3314
3314
  De({ rowId: t, draft: r, locksPending: Yn.size > 0 }), fi(t, r);
3315
3315
  }
@@ -3318,7 +3318,7 @@ function Vf({
3318
3318
  const n = (p = (d = He.current) == null ? void 0 : d.lockReasons) == null ? void 0 : p[e];
3319
3319
  if (!n) return "Set automatically for this row";
3320
3320
  if (n.reason) return `Locked — ${n.reason}`;
3321
- const t = n.field ? oe.find((g) => g.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? me(n.field) : "a rule"), i = n.field ? (m = He.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? ze.get(n.field) : void 0, a = i == null || i === "" ? null : o != null && o.one_collection ? ((h = bn[o.one_collection]) == null ? void 0 : h[String(i)]) ?? String(i) : String(i);
3321
+ const t = n.field ? oe.find((g) => g.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? me(n.field) : "a rule"), i = n.field ? (m = He.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? ze.get(n.field) : void 0, a = i == null || i === "" ? null : o != null && o.one_collection ? ((h = gn[o.one_collection]) == null ? void 0 : h[String(i)]) ?? String(i) : String(i);
3322
3322
  if (a) return `Locked — ${r} is ${a}`;
3323
3323
  const c = 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";
3324
3324
  return `Locked — ${r} ${c}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
@@ -3343,7 +3343,7 @@ function Vf({
3343
3343
  data: n.draft,
3344
3344
  target_fields: [e],
3345
3345
  probe: !0,
3346
- parent_context: Ct(),
3346
+ parent_context: Gt(),
3347
3347
  parent_collection: O,
3348
3348
  row_rules: U
3349
3349
  })
@@ -3422,7 +3422,7 @@ function Vf({
3422
3422
  });
3423
3423
  }
3424
3424
  function gd() {
3425
- R || (De({ rowId: "new", draft: { ...an }, locksPending: Yn.size > 0 }), fi("new", { ...an }));
3425
+ R || (De({ rowId: "new", draft: { ...ln }, locksPending: Yn.size > 0 }), fi("new", { ...ln }));
3426
3426
  }
3427
3427
  function kr() {
3428
3428
  var n;
@@ -3466,7 +3466,7 @@ function Vf({
3466
3466
  };
3467
3467
  }
3468
3468
  ), U && U.length > 0 && q) {
3469
- const b = Ct(), w = wo(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), A = { ...o };
3469
+ const b = Gt(), w = wo(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), A = { ...o };
3470
3470
  for (const I of w) A[I] = null;
3471
3471
  q.request(
3472
3472
  Me("/field-rules/evaluate", {
@@ -3481,12 +3481,12 @@ function Vf({
3481
3481
  });
3482
3482
  }
3483
3483
  }
3484
- function Dt() {
3485
- if (on.current) return on.current;
3484
+ function Pt() {
3485
+ if (rn.current) return rn.current;
3486
3486
  const e = bd().finally(() => {
3487
- on.current === e && (on.current = null);
3487
+ rn.current === e && (rn.current = null);
3488
3488
  });
3489
- return on.current = e, e;
3489
+ return rn.current = e, e;
3490
3490
  }
3491
3491
  async function bd() {
3492
3492
  var m;
@@ -3551,7 +3551,7 @@ function Vf({
3551
3551
  if (d.length > 0)
3552
3552
  return xo(d), !1;
3553
3553
  if (Ve != null && Ve.field && Ve.cap) {
3554
- const h = ct(Ve.cap, fn);
3554
+ const h = ct(Ve.cap, un);
3555
3555
  if (h != null) {
3556
3556
  const g = Ve.field, _ = he({ ...u.draft }), k = u.rowId.startsWith("pending:") ? Number(u.rowId.slice(8)) : -1, x = (L ?? []).some((I) => String(I.id) === u.rowId), $ = (L ?? []).filter((I) => !Le.has(String(I.id)) && String(I.id) !== u.rowId).reduce((I, G) => {
3557
3557
  const T = String(G.id), ee = F.has(T) ? { ...G, ...F.get(T) } : G;
@@ -3575,11 +3575,11 @@ function Vf({
3575
3575
  }
3576
3576
  Ot(null);
3577
3577
  const p = ea(oe, u.draft);
3578
- p && !(i && ea(oe, i)) && ye.warning(`${p} is 0 — this is a $0 line. Remove it if it is not needed.`), Sn(!0);
3578
+ p && !(i && ea(oe, i)) && ye.warning(`${p} is 0 — this is a $0 line. Remove it if it is not needed.`), Nn(!0);
3579
3579
  try {
3580
3580
  if (u.rowId.startsWith("pending:")) {
3581
3581
  const h = parseInt(u.rowId.split(":")[1], 10), g = K[h];
3582
- return v == null || v.updateRow(s, f, h, u.draft), g != null && g.__prefilled && (g == null ? void 0 : g.id) != null && wd((_) => /* @__PURE__ */ new Set([..._, g.id])), n(), Sn(!1), !0;
3582
+ return v == null || v.updateRow(s, f, h, u.draft), g != null && g.__prefilled && (g == null ? void 0 : g.id) != null && wd((_) => /* @__PURE__ */ new Set([..._, g.id])), n(), Nn(!1), !0;
3583
3583
  }
3584
3584
  if (u.rowId === "new") {
3585
3585
  if ((S || W) && v)
@@ -3611,7 +3611,7 @@ function Vf({
3611
3611
  queryKey: ["o2m-rows", s, f, y]
3612
3612
  }), n();
3613
3613
  }
3614
- }), Sn(!1), !1;
3614
+ }), Nn(!1), !1;
3615
3615
  throw b;
3616
3616
  }
3617
3617
  const $ = (m = x == null ? void 0 : x.data) == null ? void 0 : m.id;
@@ -3703,7 +3703,7 @@ function Vf({
3703
3703
  ...ee != null ? { __base_revision: ee } : {}
3704
3704
  });
3705
3705
  }
3706
- return Yt.current.delete(u.rowId), n(), !0;
3706
+ return Ct.current.delete(u.rowId), n(), !0;
3707
3707
  }
3708
3708
  if (Object.keys(w).length === 0 && b.length === 0)
3709
3709
  return n(), !0;
@@ -3712,7 +3712,7 @@ function Vf({
3712
3712
  ...w,
3713
3713
  ...Object.fromEntries(b),
3714
3714
  ...G != null ? { __base_revision: G } : {}
3715
- }), Yt.current.delete(u.rowId), n(), !0;
3715
+ }), Ct.current.delete(u.rowId), n(), !0;
3716
3716
  }
3717
3717
  if (Object.keys(k).length === 0)
3718
3718
  return n(), !0;
@@ -3730,35 +3730,35 @@ function Vf({
3730
3730
  retry: async (G) => {
3731
3731
  await q.request(
3732
3732
  Si(I, $({ ...k, _change_reason: G }))
3733
- ), Yt.current.delete(e), ot.forget(e), vt(e), V.invalidateQueries({
3733
+ ), Ct.current.delete(e), ot.forget(e), vt(e), V.invalidateQueries({
3734
3734
  queryKey: ["o2m-rows", s, f, y]
3735
3735
  }), n();
3736
3736
  }
3737
- }), Sn(!1), !1;
3737
+ }), Nn(!1), !1;
3738
3738
  }
3739
3739
  const A = pc(b);
3740
3740
  if (A)
3741
- return Yt.current.set(e, Promise.resolve(A.latest || null)), A.latest > 0 && ot.set(e, A.latest), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] }), ye.warning(
3741
+ return Ct.current.set(e, Promise.resolve(A.latest || null)), A.latest > 0 && ot.set(e, A.latest), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] }), ye.warning(
3742
3742
  "Someone else changed this line while you edited it — take their values or keep yours, then save again"
3743
- ), Sn(!1), !1;
3743
+ ), Nn(!1), !1;
3744
3744
  throw b;
3745
3745
  }
3746
- Yt.current.delete(e), ot.forget(e), vt(e), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
3746
+ Ct.current.delete(e), ot.forget(e), vt(e), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
3747
3747
  }
3748
3748
  return n(), !0;
3749
3749
  } catch {
3750
3750
  return !1;
3751
3751
  } finally {
3752
- Sn(!1);
3752
+ Nn(!1);
3753
3753
  }
3754
3754
  }
3755
- const [yd, wd] = z(/* @__PURE__ */ new Set()), [Lt, bl] = z(null), [Xt, yl] = z(null), [vd, wl] = z(!1), [yn, xd] = z(1), [wn, Pn] = z(!1), [vl, _d] = z(!1), [ko, kd] = z({}), [xl, _l] = z(!1), [kl, pi] = z(!1), [hi, Nd] = z("empty-only"), [gi, Nl] = z(null), [kt, Dn] = z(null), [vn, Sl] = z({}), [$l, El] = z(!1);
3755
+ const [yd, wd] = z(/* @__PURE__ */ new Set()), [Lt, bl] = z(null), [Yt, yl] = z(null), [vd, wl] = z(!1), [bn, xd] = z(1), [yn, Pn] = z(!1), [vl, _d] = z(!1), [ko, kd] = z({}), [xl, _l] = z(!1), [kl, pi] = z(!1), [hi, Nd] = z("empty-only"), [gi, Nl] = z(null), [kt, Dn] = z(null), [wn, Sl] = z({}), [$l, El] = z(!1);
3756
3756
  function Sd(e, n) {
3757
3757
  kd((t) => ({ ...t, [e]: n }));
3758
3758
  }
3759
3759
  async function $d() {
3760
- if (Object.keys(vn).some(
3761
- (n) => vn[n] !== null && vn[n] !== void 0
3760
+ if (Object.keys(wn).some(
3761
+ (n) => wn[n] !== null && wn[n] !== void 0
3762
3762
  )) {
3763
3763
  El(!0);
3764
3764
  try {
@@ -3766,18 +3766,18 @@ function Vf({
3766
3766
  if (W && v)
3767
3767
  L.filter((n) => !Le.has(String(n.id))).forEach(
3768
3768
  (n) => v.queueEdit(s, f, String(n.id), {
3769
- ...vn,
3770
- ...$n(String(n.id))
3769
+ ...wn,
3770
+ ...Sn(String(n.id))
3771
3771
  })
3772
3772
  );
3773
3773
  else
3774
3774
  try {
3775
3775
  await Promise.all(
3776
3776
  L.map(
3777
- (n) => En.current(
3777
+ (n) => $n.current(
3778
3778
  `/items/${s}/${n.id}${ht}`,
3779
3779
  String(n.id),
3780
- vn
3780
+ wn
3781
3781
  )
3782
3782
  )
3783
3783
  );
@@ -3787,7 +3787,7 @@ function Vf({
3787
3787
  });
3788
3788
  }
3789
3789
  K.length && v && K.forEach(
3790
- (n, t) => v.updateRow(s, f, t, { ...n, ...vn })
3790
+ (n, t) => v.updateRow(s, f, t, { ...n, ...wn })
3791
3791
  ), _l(!1), Sl({});
3792
3792
  } catch {
3793
3793
  } finally {
@@ -3796,17 +3796,17 @@ function Vf({
3796
3796
  }
3797
3797
  }
3798
3798
  async function Ed(e) {
3799
- const n = Math.max(1, Math.min(24, yn)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
3799
+ const n = Math.max(1, Math.min(24, bn)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
3800
3800
  const a = new Date(t.getFullYear(), t.getMonth() + 1 + o, 1), c = `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}-01`;
3801
- return { ...an, ...ko, [e]: c };
3801
+ return { ...ln, ...ko, [e]: c };
3802
3802
  });
3803
3803
  if ((S || W) && v) {
3804
- for (const i of un(r)) v.queueRow(s, f, i);
3804
+ for (const i of cn(r)) v.queueRow(s, f, i);
3805
3805
  return;
3806
3806
  }
3807
3807
  Pn(!0);
3808
3808
  try {
3809
- for (const i of un(r))
3809
+ for (const i of cn(r))
3810
3810
  await q.request(
3811
3811
  Me(`/items/${s}${ht}`, { ...i, [f]: y })
3812
3812
  );
@@ -3818,18 +3818,18 @@ function Vf({
3818
3818
  }
3819
3819
  async function qd() {
3820
3820
  const e = de == null ? void 0 : de.unmatched_banner;
3821
- if (!e || Gt.unmatchedCandidates.length === 0) return;
3822
- const n = Gt.unmatchedCandidates.map((t) => ({
3823
- ...an,
3821
+ if (!e || Ft.unmatchedCandidates.length === 0) return;
3822
+ const n = Ft.unmatchedCandidates.map((t) => ({
3823
+ ...ln,
3824
3824
  ...wu(e, t)
3825
3825
  }));
3826
3826
  if ((S || W) && v) {
3827
- for (const t of un(n)) v.queueRow(s, f, t);
3827
+ for (const t of cn(n)) v.queueRow(s, f, t);
3828
3828
  return;
3829
3829
  }
3830
3830
  Pn(!0);
3831
3831
  try {
3832
- for (const t of un(n))
3832
+ for (const t of cn(n))
3833
3833
  await q.request(
3834
3834
  Me(`/items/${s}${ht}`, { ...t, [f]: y })
3835
3835
  );
@@ -3841,15 +3841,15 @@ function Vf({
3841
3841
  }
3842
3842
  }
3843
3843
  async function ql(e) {
3844
- const n = Math.max(1, Math.min(100, yn)), t = e ? { ...an, ...ko } : { ...an };
3844
+ const n = Math.max(1, Math.min(100, bn)), t = e ? { ...ln, ...ko } : { ...ln };
3845
3845
  if ((S || W) && v) {
3846
- const r = un(Array.from({ length: n }, () => ({ ...t })));
3846
+ const r = cn(Array.from({ length: n }, () => ({ ...t })));
3847
3847
  for (const i of r) v.queueRow(s, f, i);
3848
3848
  return;
3849
3849
  }
3850
3850
  Pn(!0);
3851
3851
  try {
3852
- for (const r of un(Array.from({ length: n }, () => ({ ...t }))))
3852
+ for (const r of cn(Array.from({ length: n }, () => ({ ...t }))))
3853
3853
  await q.request(
3854
3854
  Me(`/items/${s}${ht}`, { ...r, [f]: y })
3855
3855
  );
@@ -3869,12 +3869,12 @@ function Vf({
3869
3869
  bl(null), yl(null);
3870
3870
  }
3871
3871
  async function Id(e) {
3872
- if (e.preventDefault(), Lt === null || Xt === null || Lt === Xt) {
3872
+ if (e.preventDefault(), Lt === null || Yt === null || Lt === Yt) {
3873
3873
  Wn();
3874
3874
  return;
3875
3875
  }
3876
3876
  const n = [...L], [t] = n.splice(Lt, 1);
3877
- n.splice(Xt, 0, t);
3877
+ n.splice(Yt, 0, t);
3878
3878
  const r = n.map((i, o) => ({ row: i, newOrder: o })).filter(({ row: i, newOrder: o }) => {
3879
3879
  const a = W ? F.get(String(i.id)) : void 0, c = (a == null ? void 0 : a[X]) ?? i[X];
3880
3880
  return Number(c ?? -1) !== o;
@@ -4014,9 +4014,9 @@ function Vf({
4014
4014
  }
4015
4015
  const o = ze.get(e.field);
4016
4016
  if (o != null && o.one_collection) {
4017
- const m = (d = bn[o.one_collection]) == null ? void 0 : d[String(n)];
4017
+ const m = (d = gn[o.one_collection]) == null ? void 0 : d[String(n)];
4018
4018
  if (!m && fd)
4019
- return /* @__PURE__ */ l(kn, { className: "h-3 w-3 animate-spin text-slate-300" });
4019
+ return /* @__PURE__ */ l(_n, { className: "h-3 w-3 animate-spin text-slate-300" });
4020
4020
  const h = fe ? Vl(e) : null, g = n != null && ((p = ci.get(e.field)) == null ? void 0 : p.has(String(n))) === !0;
4021
4021
  let _;
4022
4022
  return h && fe ? _ = /* @__PURE__ */ l(
@@ -4089,7 +4089,7 @@ function Vf({
4089
4089
  }
4090
4090
  return /* @__PURE__ */ l("span", { className: "block truncate", children: String(n) });
4091
4091
  }
4092
- const So = C(/* @__PURE__ */ new Map()), Od = Jl(), Ld = (nn && ve === "original" && !R ? 1 : 0) + (se && (X || S || W) ? 1 : 0) + (P ? 1 : 0) + (S || W ? 1 : 0);
4092
+ const So = C(/* @__PURE__ */ new Map()), Od = Jl(), Ld = (tn && ve === "original" && !R ? 1 : 0) + (se && (X || S || W) ? 1 : 0) + (P ? 1 : 0) + (S || W ? 1 : 0);
4093
4093
  Wc(
4094
4094
  Od,
4095
4095
  Hn,
@@ -4097,9 +4097,9 @@ function Vf({
4097
4097
  `tr[data-o2m-row]:not([data-o2m-editing]) > td:nth-child(n+${Ld + 1}):not(:last-child)`
4098
4098
  );
4099
4099
  const Ll = C(null);
4100
- if (Uc(Ll, Ui, ve === "original"), ps || !S && dn)
4101
- return /* @__PURE__ */ l("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ l(kn, { className: "h-4 w-4 animate-spin inline" }) });
4102
- const Nr = (u == null ? void 0 : u.rowId) === "new", rt = nn && ve === "original" && !R, Nt = (rt ? 1 : 0) + (se && (X || S || W) ? 1 : 0) + (P ? 1 : 0) + (S || W ? 1 : 0) + je.length + 1, Sr = rt ? "select" : se && (X || W) ? "reorder" : P ? "num" : W ? "status" : "data", $r = (e) => {
4100
+ if (Uc(Ll, Ui, ve === "original"), ps || !S && an)
4101
+ return /* @__PURE__ */ l("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ l(_n, { className: "h-4 w-4 animate-spin inline" }) });
4102
+ const Nr = (u == null ? void 0 : u.rowId) === "new", rt = tn && ve === "original" && !R, Nt = (rt ? 1 : 0) + (se && (X || S || W) ? 1 : 0) + (P ? 1 : 0) + (S || W ? 1 : 0) + je.length + 1, Sr = rt ? "select" : se && (X || W) ? "reorder" : P ? "num" : W ? "status" : "data", $r = (e) => {
4103
4103
  if (!xt) return null;
4104
4104
  const n = xt.added.has(e) ? "bg-emerald-500" : xt.changed.has(e) ? "bg-amber-500" : null;
4105
4105
  return n ? /* @__PURE__ */ l(
@@ -4131,8 +4131,8 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4131
4131
  continue;
4132
4132
  }
4133
4133
  let i = e[r.field];
4134
- r.computed_type === "write" && r.computed_formula && (i = Ut(r.computed_formula, e) ?? i);
4135
- const o = ze.get(r.field), a = o != null && o.one_collection && i != null ? (t = bn[o.one_collection]) == null ? void 0 : t[String(i)] : void 0;
4134
+ r.computed_type === "write" && r.computed_formula && (i = Wt(r.computed_formula, e) ?? i);
4135
+ const o = ze.get(r.field), a = o != null && o.one_collection && i != null ? (t = gn[o.one_collection]) == null ? void 0 : t[String(i)] : void 0;
4136
4136
  n.push(...Hc(r, i, { m2oLabel: a }));
4137
4137
  }
4138
4138
  return Fc(n.join(`
@@ -4144,7 +4144,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4144
4144
  Un.push({ row: e, ri: n });
4145
4145
  return;
4146
4146
  }
4147
- const t = String(e.id), r = F.has(t) ? { ...e, ...F.get(t) } : e, i = In.has(t) || $o(r);
4147
+ const t = String(e.id), r = F.has(t) ? { ...e, ...F.get(t) } : e, i = qn.has(t) || $o(r);
4148
4148
  i && Al++, (i || (u == null ? void 0 : u.rowId) === t || Ji.current.has(t)) && Un.push({ row: e, ri: n });
4149
4149
  });
4150
4150
  const bi = K.map(
@@ -4152,7 +4152,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4152
4152
  matches: $o(e),
4153
4153
  editing: (u == null ? void 0 : u.rowId) === `pending:${n}`
4154
4154
  }) : "show"
4155
- ), Rd = St ? K.filter((e) => $o(e)).length : 0, jd = bi.filter((e) => e === "dim").length, Eo = Un.slice(0, si), yi = cn ? Ka ?? Ne.length : Ne.length, Rl = ve === "original" && (cn || Ne.length + K.length > zc || or.trim() !== ""), Er = Rl ? /* @__PURE__ */ l(
4155
+ ), Rd = St ? K.filter((e) => $o(e)).length : 0, jd = bi.filter((e) => e === "dim").length, Eo = Un.slice(0, si), yi = dn ? Ka ?? Ne.length : Ne.length, Rl = ve === "original" && (dn || Ne.length + K.length > zc || or.trim() !== ""), Er = Rl ? /* @__PURE__ */ l(
4156
4156
  Jc,
4157
4157
  {
4158
4158
  value: or,
@@ -4161,8 +4161,8 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4161
4161
  searching: St,
4162
4162
  shown: Al + Rd,
4163
4163
  total: yi + K.length,
4164
- loaded: cn ? Ne.length : null,
4165
- loadedOf: cn ? yi : null,
4164
+ loaded: dn ? Ne.length : null,
4165
+ loadedOf: dn ? yi : null,
4166
4166
  loading: lt.loading,
4167
4167
  error: lt.error,
4168
4168
  onRetry: lt.retry,
@@ -4215,7 +4215,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4215
4215
  const i = r + e;
4216
4216
  if (i < 0 || i >= t.length) return;
4217
4217
  if (Md()) {
4218
- if (!await Dt()) return;
4218
+ if (!await Pt()) return;
4219
4219
  } else
4220
4220
  kr();
4221
4221
  const o = t[i];
@@ -4245,7 +4245,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4245
4245
  const e = [];
4246
4246
  return ve !== "original" || (S || L.forEach((n, t) => {
4247
4247
  const r = String(n.id);
4248
- Le.has(r) || In.has(r) || e.push({
4248
+ Le.has(r) || qn.has(r) || e.push({
4249
4249
  key: r,
4250
4250
  kind: "saved",
4251
4251
  row: F.has(r) ? { ...n, ...F.get(r) } : n,
@@ -4273,7 +4273,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4273
4273
  data: g.row,
4274
4274
  locks_only: !0,
4275
4275
  probe: !0,
4276
- parent_context: Ct(),
4276
+ parent_context: Gt(),
4277
4277
  parent_collection: O,
4278
4278
  row_rules: U
4279
4279
  })
@@ -4292,7 +4292,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4292
4292
  data: A,
4293
4293
  changed_field: b,
4294
4294
  probe: !0,
4295
- parent_context: Ct(),
4295
+ parent_context: Gt(),
4296
4296
  parent_collection: O,
4297
4297
  row_rules: U
4298
4298
  })
@@ -4331,7 +4331,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4331
4331
  const x = await ((h = t.baseOf) == null ? void 0 : h.call(t, _.key)) ?? null;
4332
4332
  v.queueEdit(s, f, _.key, {
4333
4333
  ...k,
4334
- ...x != null && x > 0 ? { __base_revision: x } : $n(_.key)
4334
+ ...x != null && x > 0 ? { __base_revision: x } : Sn(_.key)
4335
4335
  });
4336
4336
  }
4337
4337
  g++;
@@ -4353,7 +4353,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4353
4353
  continue;
4354
4354
  }
4355
4355
  try {
4356
- await En.current(
4356
+ await $n.current(
4357
4357
  `/items/${s}/${$.key}${ht}`,
4358
4358
  $.key,
4359
4359
  _ ? { ...b, _change_reason: _ } : b,
@@ -4420,7 +4420,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4420
4420
  }
4421
4421
  for (const i of je)
4422
4422
  if (i.computed_type === "write" && i.computed_formula) {
4423
- const o = Ut(i.computed_formula, r);
4423
+ const o = Wt(i.computed_formula, r);
4424
4424
  o != null && (r[i.field] = o);
4425
4425
  }
4426
4426
  return r;
@@ -4501,7 +4501,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4501
4501
  {
4502
4502
  type: "button",
4503
4503
  disabled: It,
4504
- onClick: Dt,
4504
+ onClick: Pt,
4505
4505
  className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
4506
4506
  children: It ? "Saving…" : e.saveLabel
4507
4507
  }
@@ -4590,7 +4590,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4590
4590
  if (!w) return null;
4591
4591
  const A = ze.get(t.field), I = (ge) => {
4592
4592
  var te;
4593
- return (A != null && A.one_collection ? (te = bn[A.one_collection]) == null ? void 0 : te[String(ge)] : void 0) ?? String(ge);
4593
+ return (A != null && A.one_collection ? (te = gn[A.one_collection]) == null ? void 0 : te[String(ge)] : void 0) ?? String(ge);
4594
4594
  }, G = (ge) => {
4595
4595
  var te;
4596
4596
  return ((te = Se.find((be) => be.field === ge)) == null ? void 0 : te.label) ?? ge.replace(/_/g, " ");
@@ -4612,7 +4612,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4612
4612
  ),
4613
4613
  r ? /* @__PURE__ */ l("div", { className: "text-[12px] italic text-slate-500", children: Je(
4614
4614
  t,
4615
- Ut(t.computed_formula, e.draft) ?? e.draft[t.field]
4615
+ Wt(t.computed_formula, e.draft) ?? e.draft[t.field]
4616
4616
  ) }) : o || t.readonly || ti(t) || ($ = u == null ? void 0 : u.locks) != null && $.includes(t.field) || to(t.field, e.draft) ? /* @__PURE__ */ l(
4617
4617
  "div",
4618
4618
  {
@@ -4644,11 +4644,11 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4644
4644
  itemId: e.rowId ?? "new",
4645
4645
  cascadeFilter: Fe[t.field],
4646
4646
  narrowedBy: Cr[t.field],
4647
- pinnedOption: An(t.field, e.draft)
4647
+ pinnedOption: Ln(t.field, e.draft)
4648
4648
  }
4649
4649
  ),
4650
4650
  j && j.columns.includes(t.field) && (() => {
4651
- const w = Ko(j, e.draft), A = w == null ? void 0 : w.values[t.field], I = Zt(
4651
+ const w = Ko(j, e.draft), A = w == null ? void 0 : w.values[t.field], I = Xt(
4652
4652
  j,
4653
4653
  e.draft[j.key_field],
4654
4654
  t.field
@@ -4665,7 +4665,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4665
4665
  "span",
4666
4666
  {
4667
4667
  className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
4668
- "data-tip": j.closed_locked && On ? `${j.closed_rule ?? ""} A change here needs a reason.`.trim() : j.closed_rule,
4668
+ "data-tip": j.closed_locked && In ? `${j.closed_rule ?? ""} A change here needs a reason.`.trim() : j.closed_rule,
4669
4669
  children: [
4670
4670
  /* @__PURE__ */ l(zl, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
4671
4671
  " closed"
@@ -4711,11 +4711,11 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4711
4711
  {
4712
4712
  config: ke,
4713
4713
  draft: e.draft,
4714
- remaining: ct(ke.remaining, fn),
4714
+ remaining: ct(ke.remaining, un),
4715
4715
  onApply: _o,
4716
4716
  closedFields: j ? new Set(
4717
4717
  ke.fields.filter(
4718
- (t) => Zt(j, e.draft[j.key_field], t)
4718
+ (t) => Xt(j, e.draft[j.key_field], t)
4719
4719
  )
4720
4720
  ) : void 0,
4721
4721
  shapeSource: (() => {
@@ -4734,14 +4734,14 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4734
4734
  })()
4735
4735
  }
4736
4736
  ),
4737
- de && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(vu, { config: de, result: Gt.byRow.get(e.rowId) }),
4737
+ de && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(vu, { config: de, result: Ft.byRow.get(e.rowId) }),
4738
4738
  e.drawer
4739
4739
  ]
4740
4740
  }
4741
4741
  );
4742
4742
  }, Oo = (e) => /* @__PURE__ */ l("td", { colSpan: Nt, className: "p-0", children: Tl(e) }), Ml = (e, n) => {
4743
4743
  const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
4744
- uo.current.add(sl(e.rowKey, e.editor)), gn(null);
4744
+ uo.current.add(sl(e.rowKey, e.editor)), hn(null);
4745
4745
  const i = L.find((o) => String(o.id) === e.rowKey);
4746
4746
  i && mi(F.has(e.rowKey) ? { ...i, ...F.get(e.rowKey) } : i);
4747
4747
  };
@@ -4773,7 +4773,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4773
4773
  "button",
4774
4774
  {
4775
4775
  type: "button",
4776
- onClick: () => gn(null),
4776
+ onClick: () => hn(null),
4777
4777
  className: "rounded-md border border-amber-300 px-2 py-0.5 text-[11px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
4778
4778
  children: "Leave it"
4779
4779
  }
@@ -4872,7 +4872,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4872
4872
  type: "number",
4873
4873
  min: 1,
4874
4874
  max: 100,
4875
- value: yn,
4875
+ value: bn,
4876
4876
  onChange: (e) => xd(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
4877
4877
  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"
4878
4878
  }
@@ -4881,12 +4881,12 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4881
4881
  "button",
4882
4882
  {
4883
4883
  type: "button",
4884
- disabled: wn,
4884
+ disabled: yn,
4885
4885
  onClick: () => ql(!1),
4886
4886
  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",
4887
4887
  children: [
4888
4888
  "blank ",
4889
- yn === 1 ? "row" : "rows"
4889
+ bn === 1 ? "row" : "rows"
4890
4890
  ]
4891
4891
  }
4892
4892
  ),
@@ -4898,13 +4898,13 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4898
4898
  "button",
4899
4899
  {
4900
4900
  type: "button",
4901
- disabled: wn,
4901
+ disabled: yn,
4902
4902
  onClick: () => Ed(e[0].field),
4903
- "data-tip": `Generate ${yn} rows with ${e[0].field} advancing one month per row (starting next month)`,
4903
+ "data-tip": `Generate ${bn} rows with ${e[0].field} advancing one month per row (starting next month)`,
4904
4904
  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",
4905
4905
  children: [
4906
4906
  "monthly ",
4907
- yn === 1 ? "row" : "rows"
4907
+ bn === 1 ? "row" : "rows"
4908
4908
  ]
4909
4909
  }
4910
4910
  );
@@ -4917,7 +4917,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4917
4917
  manyField: f,
4918
4918
  parentId: y,
4919
4919
  rows: S ? [] : L,
4920
- rowDefaults: an,
4920
+ rowDefaults: ln,
4921
4921
  parentDraft: E == null ? void 0 : E.draft,
4922
4922
  invalidate: () => V.invalidateQueries({
4923
4923
  queryKey: ["o2m-rows", s, f, y]
@@ -4931,7 +4931,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4931
4931
  pendingEdits: F,
4932
4932
  pendingDeletes: Le,
4933
4933
  writeRow: (e, n) => ao(`/items/${s}/${e}`, e, n),
4934
- stagedBase: $n
4934
+ stagedBase: Sn
4935
4935
  }
4936
4936
  ),
4937
4937
  Oe && !S && !R && (() => {
@@ -4968,7 +4968,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
4968
4968
  if (W && v) {
4969
4969
  v.queueEdit(s, f, i, {
4970
4970
  ...t,
4971
- ...$n(i)
4971
+ ...Sn(i)
4972
4972
  });
4973
4973
  return;
4974
4974
  }
@@ -5046,7 +5046,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5046
5046
  Qu,
5047
5047
  {
5048
5048
  config: ke,
5049
- remaining: ct(ke.remaining, fn),
5049
+ remaining: ct(ke.remaining, un),
5050
5050
  rowNoun: j ? me(j.key_field).toLowerCase() : "row",
5051
5051
  onApply: Ga
5052
5052
  }
@@ -5066,7 +5066,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5066
5066
  children: "re-run rules…"
5067
5067
  }
5068
5068
  ),
5069
- !R && ve === "original" && L.length + K.length > 0 && qu(Jn).filter((e) => !e.admin_only || On).map((e) => {
5069
+ !R && ve === "original" && L.length + K.length > 0 && qu(Jn).filter((e) => !e.admin_only || In).map((e) => {
5070
5070
  const n = Ir.length > 0 ? Ir : jl(), t = oe.find((a) => a.field === e.field), r = e.label ?? (t ? ur(t) : me(e.field)), i = new Set(n.map((a) => String(a.row[e.field] ?? ""))), o = i.size === 1 && [...i][0] || null;
5071
5071
  return /* @__PURE__ */ l(
5072
5072
  Iu,
@@ -5087,19 +5087,19 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5087
5087
  "button",
5088
5088
  {
5089
5089
  type: "button",
5090
- "aria-label": nn ? "Hide row selection" : "Select rows",
5091
- "aria-pressed": nn,
5092
- "data-tip": nn ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
5090
+ "aria-label": tn ? "Hide row selection" : "Select rows",
5091
+ "aria-pressed": tn,
5092
+ "data-tip": tn ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
5093
5093
  onClick: () => {
5094
5094
  Go((e) => !e), Fn(/* @__PURE__ */ new Set());
5095
5095
  },
5096
5096
  className: xe(
5097
5097
  "inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
5098
- nn ? "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"
5098
+ tn ? "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"
5099
5099
  ),
5100
5100
  children: [
5101
5101
  /* @__PURE__ */ l(Bd, { className: "h-3 w-3", "aria-hidden": "true" }),
5102
- nn ? "Selecting" : "Select rows"
5102
+ tn ? "Selecting" : "Select rows"
5103
5103
  ]
5104
5104
  }
5105
5105
  ),
@@ -5151,7 +5151,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5151
5151
  children: Ie ? /* @__PURE__ */ l(Jd, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ l(Qd, { className: "h-3 w-3", "aria-hidden": "true" })
5152
5152
  }
5153
5153
  ),
5154
- wn && /* @__PURE__ */ l(kn, { className: "h-3 w-3 animate-spin text-slate-400" }),
5154
+ yn && /* @__PURE__ */ l(_n, { className: "h-3 w-3 animate-spin text-slate-400" }),
5155
5155
  (() => {
5156
5156
  if (!((S || W) && !!v))
5157
5157
  return /* @__PURE__ */ N(
@@ -5213,7 +5213,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5213
5213
  Bn,
5214
5214
  {
5215
5215
  field: e,
5216
- value: vn[e.field] ?? null,
5216
+ value: wn[e.field] ?? null,
5217
5217
  onChange: (n) => Sl((t) => ({ ...t, [e.field]: n })),
5218
5218
  relations: We,
5219
5219
  collection: s,
@@ -5325,11 +5325,11 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5325
5325
  kt.truncated && /* @__PURE__ */ l("li", { className: "text-amber-700", children: "Preview shows the first 200 lines." })
5326
5326
  ] }) })
5327
5327
  ] }),
5328
- (de == null ? void 0 : de.unmatched_banner) && !R && Gt.unmatchedCandidates.length > 0 && (() => {
5328
+ (de == null ? void 0 : de.unmatched_banner) && !R && Ft.unmatchedCandidates.length > 0 && (() => {
5329
5329
  var a, c, d, p, m, h, g, _;
5330
- const e = Gt.unmatchedCandidates.length, n = ((a = de.unmatched_banner) == null ? void 0 : a.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = de.candidates) == null ? void 0 : c.primary) ?? ((m = (p = (d = de.candidates) == null ? void 0 : d.keys) == null ? void 0 : p[0]) == null ? void 0 : m.row), i = (_ = (g = (h = de.candidates) == null ? void 0 : h.keys) == null ? void 0 : g.find(
5330
+ const e = Ft.unmatchedCandidates.length, n = ((a = de.unmatched_banner) == null ? void 0 : a.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = de.candidates) == null ? void 0 : c.primary) ?? ((m = (p = (d = de.candidates) == null ? void 0 : d.keys) == null ? void 0 : p[0]) == null ? void 0 : m.row), i = (_ = (g = (h = de.candidates) == null ? void 0 : h.keys) == null ? void 0 : g.find(
5331
5331
  (k) => k.row === r
5332
- )) == null ? void 0 : _.candidate, o = i ? Gt.unmatchedCandidates.map((k) => String(k[i] ?? "")).filter(Boolean).slice(0, 8) : [];
5332
+ )) == null ? void 0 : _.candidate, o = i ? Ft.unmatchedCandidates.map((k) => String(k[i] ?? "")).filter(Boolean).slice(0, 8) : [];
5333
5333
  return /* @__PURE__ */ N("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: [
5334
5334
  /* @__PURE__ */ l(Mr, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
5335
5335
  /* @__PURE__ */ N("span", { children: [
@@ -5354,11 +5354,11 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5354
5354
  "button",
5355
5355
  {
5356
5356
  type: "button",
5357
- disabled: wn,
5357
+ disabled: yn,
5358
5358
  onClick: () => void qd(),
5359
5359
  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",
5360
5360
  "data-tip": S || W ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
5361
- children: wn ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
5361
+ children: yn ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
5362
5362
  }
5363
5363
  )
5364
5364
  ] });
@@ -5368,11 +5368,11 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5368
5368
  var a;
5369
5369
  const e = xt, n = (e == null ? void 0 : e.total) ?? 0, t = [];
5370
5370
  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`);
5371
- const r = [...((a = hn.current) == null ? void 0 : a.keys()) ?? []], i = ((e == null ? void 0 : e.removed) ?? []).filter((c) => c !== (Ft == null ? void 0 : Ft.rowId)), o = i.slice(0, 5).map(
5371
+ const r = [...((a = pn.current) == null ? void 0 : a.keys()) ?? []], i = ((e == null ? void 0 : e.removed) ?? []).filter((c) => c !== (Ht == null ? void 0 : Ht.rowId)), o = i.slice(0, 5).map(
5372
5372
  (c) => {
5373
5373
  var d;
5374
5374
  return Eu(
5375
- Or(((d = hn.current) == null ? void 0 : d.get(c)) ?? { id: c }),
5375
+ Or(((d = pn.current) == null ? void 0 : d.get(c)) ?? { id: c }),
5376
5376
  r.indexOf(c) + 1 || null
5377
5377
  );
5378
5378
  }
@@ -5383,7 +5383,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5383
5383
  "data-grid-since-opened": "",
5384
5384
  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-1.5 text-[11px] text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
5385
5385
  children: [
5386
- e && /* @__PURE__ */ N(_n, { children: [
5386
+ e && /* @__PURE__ */ N(xn, { children: [
5387
5387
  /* @__PURE__ */ N("span", { className: "font-medium", children: [
5388
5388
  n,
5389
5389
  " ",
@@ -5463,7 +5463,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5463
5463
  ),
5464
5464
  children: [
5465
5465
  vd && /* @__PURE__ */ l("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__ */ N("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: [
5466
- /* @__PURE__ */ l(kn, { className: "h-3.5 w-3.5 animate-spin" }),
5466
+ /* @__PURE__ */ l(_n, { className: "h-3.5 w-3.5 animate-spin" }),
5467
5467
  "Saving order…"
5468
5468
  ] }) }),
5469
5469
  Hs && /* @__PURE__ */ l("style", { children: Hs }),
@@ -5526,10 +5526,10 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5526
5526
  "button",
5527
5527
  {
5528
5528
  type: "button",
5529
- disabled: wn,
5529
+ disabled: yn,
5530
5530
  onClick: () => ql(!0),
5531
5531
  className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
5532
- children: wn ? "…" : `Add ${yn}`
5532
+ children: yn ? "…" : `Add ${bn}`
5533
5533
  }
5534
5534
  ) })
5535
5535
  ] }),
@@ -5577,7 +5577,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5577
5577
  }
5578
5578
  ) }) }) : null;
5579
5579
  if (a) return /* @__PURE__ */ l(Ro, { children: c }, r);
5580
- const d = (u == null ? void 0 : u.rowId) === r, p = d && !Ie, m = rr.view(r), h = Lt === n, g = Xt === n && Lt !== n, _ = F.has(r), k = Le.has(r), x = _ ? { ...e, ...F.get(r) } : e, $ = Xo && !k ? ga.get(String(x[Xo] ?? "")) ?? null : null;
5580
+ const d = (u == null ? void 0 : u.rowId) === r, p = d && !Ie, m = rr.view(r), h = Lt === n, g = Yt === n && Lt !== n, _ = F.has(r), k = Le.has(r), x = _ ? { ...e, ...F.get(r) } : e, $ = Xo && !k ? ga.get(String(x[Xo] ?? "")) ?? null : null;
5581
5581
  return /* @__PURE__ */ N(Ro, { children: [
5582
5582
  c,
5583
5583
  /* @__PURE__ */ N(
@@ -5597,7 +5597,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5597
5597
  onClick: () => !d && !k && mi(x),
5598
5598
  onBlur: (b) => {
5599
5599
  !d || It || k || b.currentTarget.contains(b.relatedTarget) || Hr(b.relatedTarget) || (yt.current = setTimeout(() => {
5600
- nr.current || Hr(document.activeElement) || Dt();
5600
+ nr.current || Hr(document.activeElement) || Pt();
5601
5601
  }, 150));
5602
5602
  },
5603
5603
  onFocus: () => {
@@ -5612,7 +5612,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5612
5612
  !k && !d ? m.readOnly ? "cursor-not-allowed bg-amber-50/50 text-slate-500 dark:bg-amber-400/[0.05] dark:text-slate-400" : $ ? "bg-red-50/70 hover:bg-red-50 cursor-pointer dark:bg-red-900/15 dark:hover:bg-red-900/25" : n % 2 === 0 ? "bg-white hover:bg-slate-50/80 dark:bg-card dark:hover:bg-muted cursor-pointer" : "bg-slate-50/50 hover:bg-slate-100/60 dark:bg-white/[0.03] dark:hover:bg-muted cursor-pointer" : ""
5613
5613
  ),
5614
5614
  children: [
5615
- !(d && !k && at === "panel") && /* @__PURE__ */ N(_n, { children: [
5615
+ !(d && !k && at === "panel") && /* @__PURE__ */ N(xn, { children: [
5616
5616
  rt && /* @__PURE__ */ N(
5617
5617
  "td",
5618
5618
  {
@@ -5649,7 +5649,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5649
5649
  P && /* @__PURE__ */ N("td", { className: "relative w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: [
5650
5650
  Sr === "num" && $r(r),
5651
5651
  /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1", children: [
5652
- In.has(r) ? (
5652
+ qn.has(r) ? (
5653
5653
  // Found by the search past the rows loaded here: its
5654
5654
  // place in the full list is not known, so no number.
5655
5655
  /* @__PURE__ */ l(
@@ -5664,7 +5664,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5664
5664
  de && /* @__PURE__ */ l(
5665
5665
  ra,
5666
5666
  {
5667
- result: Gt.byRow.get(r),
5667
+ result: Ft.byRow.get(r),
5668
5668
  title: de.title
5669
5669
  }
5670
5670
  ),
@@ -5702,7 +5702,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5702
5702
  !P && de && /* @__PURE__ */ l(
5703
5703
  ra,
5704
5704
  {
5705
- result: Gt.byRow.get(r),
5705
+ result: Ft.byRow.get(r),
5706
5706
  title: de.title
5707
5707
  }
5708
5708
  ),
@@ -5757,7 +5757,7 @@ ${a.toLocaleString("en-US", $t(t, t.format))}`;
5757
5757
  var ge, te, be;
5758
5758
  if (nt(w))
5759
5759
  return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500", children: ai(w, x) }) }, w.field);
5760
- const I = w.computed_type === "write" && !!w.computed_formula, G = I ? Ut(
5760
+ const I = w.computed_type === "write" && !!w.computed_formula, G = I ? Wt(
5761
5761
  w.computed_formula,
5762
5762
  d ? (u == null ? void 0 : u.draft) ?? x : x
5763
5763
  ) ?? x[w.field] : null, T = J && !d && !k ? (ge = Wi[r]) == null ? void 0 : ge[w.field] : void 0, ee = T ? `${w.label || me(w.field)} · changed ${Cl(T.at)} by ${T.who}${T.reason ? `
@@ -5773,13 +5773,13 @@ Reason: “${T.reason}”` : ""}` : void 0;
5773
5773
  x[w.field],
5774
5774
  p
5775
5775
  )) && "relative",
5776
- j && Zt(
5776
+ j && Xt(
5777
5777
  j,
5778
5778
  x[j.key_field],
5779
5779
  w.field
5780
5780
  ) && "bg-slate-50/80 dark:bg-white/[0.035]"
5781
5781
  ),
5782
- "data-compare-closed": j && Zt(
5782
+ "data-compare-closed": j && Xt(
5783
5783
  j,
5784
5784
  x[j.key_field],
5785
5785
  w.field
@@ -5839,7 +5839,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
5839
5839
  itemId: r,
5840
5840
  cascadeFilter: Fe[w.field],
5841
5841
  narrowedBy: Cr[w.field],
5842
- pinnedOption: An(
5842
+ pinnedOption: Ln(
5843
5843
  w.field,
5844
5844
  (u == null ? void 0 : u.draft) ?? {}
5845
5845
  ),
@@ -5872,7 +5872,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
5872
5872
  planned: p && !k ? u == null ? void 0 : u.draft[w.field] : x[w.field],
5873
5873
  columnLabel: ur(w),
5874
5874
  plannedRow: x,
5875
- onAdjust: !R && !k && e.id != null ? (Ue, dt) => void Ln(String(e.id), Ue, dt) : void 0
5875
+ onAdjust: !R && !k && e.id != null ? (Ue, dt) => void On(String(e.id), Ue, dt) : void 0
5876
5876
  }
5877
5877
  )
5878
5878
  ]
@@ -5892,7 +5892,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
5892
5892
  {
5893
5893
  type: "button",
5894
5894
  disabled: It,
5895
- onClick: Dt,
5895
+ onClick: Pt,
5896
5896
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5897
5897
  children: It ? "…" : "Save"
5898
5898
  }
@@ -5919,7 +5919,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
5919
5919
  className: "rounded px-1.5 py-0.5 text-[10px] text-red-500 hover:text-red-700 border border-red-200 hover:border-red-400",
5920
5920
  children: "Undo"
5921
5921
  }
5922
- ) : /* @__PURE__ */ N(_n, { children: [
5922
+ ) : /* @__PURE__ */ N(xn, { children: [
5923
5923
  m.readOnly && /* @__PURE__ */ N(
5924
5924
  "span",
5925
5925
  {
@@ -6068,7 +6068,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6068
6068
  "data-o2m-editing": !0,
6069
6069
  className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5",
6070
6070
  children: [
6071
- at !== "panel" && /* @__PURE__ */ N(_n, { children: [
6071
+ at !== "panel" && /* @__PURE__ */ N(xn, { children: [
6072
6072
  rt && /* @__PURE__ */ l("td", { className: "w-7" }),
6073
6073
  (X || S || W) && /* @__PURE__ */ l("td", { className: "w-6" }),
6074
6074
  P && /* @__PURE__ */ l("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: L.length + K.length + 1 }),
@@ -6086,7 +6086,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6086
6086
  const n = e.computed_type === "write" && !!e.computed_formula, t = ar(e.interface), r = `__m2m_${e.field}`, i = t ? Ci(e) : null;
6087
6087
  return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: n ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Je(
6088
6088
  e,
6089
- Ut(e.computed_formula, u.draft) ?? null
6089
+ Wt(e.computed_formula, u.draft) ?? null
6090
6090
  ) }) : t && i ? /* @__PURE__ */ l("div", { onClick: (o) => o.stopPropagation(), children: /* @__PURE__ */ l(
6091
6091
  Wo,
6092
6092
  {
@@ -6106,7 +6106,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6106
6106
  itemId: "new",
6107
6107
  cascadeFilter: Fe[e.field],
6108
6108
  narrowedBy: Cr[e.field],
6109
- pinnedOption: An(e.field, u.draft)
6109
+ pinnedOption: Ln(e.field, u.draft)
6110
6110
  }
6111
6111
  ) }) }, e.field);
6112
6112
  }),
@@ -6116,7 +6116,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6116
6116
  {
6117
6117
  type: "button",
6118
6118
  disabled: It,
6119
- onClick: Dt,
6119
+ onClick: Pt,
6120
6120
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
6121
6121
  children: It ? "…" : "Add"
6122
6122
  }
@@ -6273,15 +6273,15 @@ Reason: “${T.reason}”` : ""}` : void 0;
6273
6273
  colSpan: Nt,
6274
6274
  className: "px-3 py-8 text-center text-[12px] text-slate-400 dark:text-slate-500",
6275
6275
  children: lt.loading ? /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1.5", children: [
6276
- /* @__PURE__ */ l(kn, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": "true" }),
6276
+ /* @__PURE__ */ l(_n, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": "true" }),
6277
6277
  "Searching all ",
6278
6278
  yi.toLocaleString("en-US"),
6279
6279
  " rows…"
6280
- ] }) : /* @__PURE__ */ N(_n, { children: [
6280
+ ] }) : /* @__PURE__ */ N(xn, { children: [
6281
6281
  "No rows match “",
6282
6282
  sr.trim(),
6283
6283
  "”",
6284
- cn && !lt.error ? ` in all ${yi.toLocaleString("en-US")} rows` : "",
6284
+ dn && !lt.error ? ` in all ${yi.toLocaleString("en-US")} rows` : "",
6285
6285
  ".",
6286
6286
  " ",
6287
6287
  /* @__PURE__ */ l(
@@ -6336,7 +6336,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6336
6336
  {
6337
6337
  className: xe(
6338
6338
  "px-2 py-1 align-top",
6339
- Zt(j, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
6339
+ Xt(j, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
6340
6340
  ),
6341
6341
  children: [
6342
6342
  j.columns.includes(r.field) && /* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
@@ -6365,7 +6365,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6365
6365
  K.length > 0 && K.map((e, n) => {
6366
6366
  const t = `pending:${n}`, r = bi[n] ?? "show";
6367
6367
  if (r === "hide") return null;
6368
- const i = (u == null ? void 0 : u.rowId) === t, o = i && !Ie, a = Lt === n, c = Xt === n && Lt !== n, d = !!e.__prefilled;
6368
+ const i = (u == null ? void 0 : u.rowId) === t, o = i && !Ie, a = Lt === n, c = Yt === n && Lt !== n, d = !!e.__prefilled;
6369
6369
  return /* @__PURE__ */ N(Ro, { children: [
6370
6370
  /* @__PURE__ */ N(
6371
6371
  "tr",
@@ -6379,13 +6379,13 @@ Reason: “${T.reason}”` : ""}` : void 0;
6379
6379
  onDragStart: () => Il(n),
6380
6380
  onDragOver: (p) => Ol(p, n),
6381
6381
  onDrop: (p) => {
6382
- p.preventDefault(), Lt !== null && Xt !== null && Lt !== Xt && (v == null || v.reorderRows(s, f, Lt, Xt)), Wn();
6382
+ p.preventDefault(), Lt !== null && Yt !== null && Lt !== Yt && (v == null || v.reorderRows(s, f, Lt, Yt)), Wn();
6383
6383
  },
6384
6384
  onDragEnd: Wn,
6385
6385
  onClick: () => !i && pl(e, n),
6386
6386
  onBlur: (p) => {
6387
6387
  !i || It || p.currentTarget.contains(p.relatedTarget) || Hr(p.relatedTarget) || (yt.current = setTimeout(() => {
6388
- nr.current || Hr(document.activeElement) || Dt();
6388
+ nr.current || Hr(document.activeElement) || Pt();
6389
6389
  }, 150));
6390
6390
  },
6391
6391
  onFocus: () => {
@@ -6399,7 +6399,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6399
6399
  r === "dim" && "opacity-50 hover:opacity-100"
6400
6400
  ),
6401
6401
  children: [
6402
- !(i && at === "panel") && /* @__PURE__ */ N(_n, { children: [
6402
+ !(i && at === "panel") && /* @__PURE__ */ N(xn, { children: [
6403
6403
  rt && /* @__PURE__ */ l(
6404
6404
  "td",
6405
6405
  {
@@ -6472,7 +6472,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6472
6472
  i ? u.draft : e,
6473
6473
  !0
6474
6474
  ) }) }, m.field);
6475
- const h = m.computed_type === "write" && !!m.computed_formula, g = ar(m.interface), _ = `__m2m_${m.field}`, k = g && o ? Ci(m) : null, x = m.interface === "relation-path" && e.id != null ? (w = wt == null ? void 0 : wt[String(e.id)]) == null ? void 0 : w[m.field] : void 0, $ = h ? Ut(
6475
+ const h = m.computed_type === "write" && !!m.computed_formula, g = ar(m.interface), _ = `__m2m_${m.field}`, k = g && o ? Ci(m) : null, x = m.interface === "relation-path" && e.id != null ? (w = wt == null ? void 0 : wt[String(e.id)]) == null ? void 0 : w[m.field] : void 0, $ = h ? Wt(
6476
6476
  m.computed_formula,
6477
6477
  i ? u.draft : e
6478
6478
  ) ?? e[m.field] : i ? u.draft[m.field] ?? x : e[m.field] ?? x, b = Array.isArray(e.__rule_set) ? e.__rule_set.includes(m.field) : !1;
@@ -6514,7 +6514,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6514
6514
  itemId: "new",
6515
6515
  cascadeFilter: Fe[m.field],
6516
6516
  narrowedBy: Cr[m.field],
6517
- pinnedOption: An(m.field, u.draft)
6517
+ pinnedOption: Ln(m.field, u.draft)
6518
6518
  }
6519
6519
  ) }) : m.interface === "formula-column" ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: Je(m, p[m.field], void 0, p) }) : m.computed_type === "rollup" ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: Je(
6520
6520
  m,
@@ -6560,7 +6560,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6560
6560
  {
6561
6561
  type: "button",
6562
6562
  disabled: It,
6563
- onClick: Dt,
6563
+ onClick: Pt,
6564
6564
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
6565
6565
  children: It ? "…" : "Save"
6566
6566
  }
@@ -6856,14 +6856,14 @@ Reason: “${T.reason}”` : ""}` : void 0;
6856
6856
  rowTitle: `${L.length} ${L.length === 1 ? "line" : "lines"} on this record`,
6857
6857
  revisions: $a,
6858
6858
  loading: Sa,
6859
- truncated: !!(rn != null && rn.truncated),
6859
+ truncated: !!(nn != null && nn.truncated),
6860
6860
  fields: oe,
6861
6861
  displayCols: Se,
6862
6862
  parentField: f,
6863
6863
  m2oRelMap: ze,
6864
6864
  relations: We,
6865
6865
  collection: s,
6866
- m2oDisplays: bn,
6866
+ m2oDisplays: gn,
6867
6867
  client: q,
6868
6868
  allowRestore: !!ae && !R,
6869
6869
  rowLabel: (e, n) => {
@@ -6903,7 +6903,7 @@ Reason: “${T.reason}”` : ""}` : void 0;
6903
6903
  m2oRelMap: ze,
6904
6904
  relations: We,
6905
6905
  collection: s,
6906
- m2oDisplays: bn,
6906
+ m2oDisplays: gn,
6907
6907
  client: q,
6908
6908
  allowRestore: !!ae && !R,
6909
6909
  focusRevisionId: xa,
@@ -7082,7 +7082,7 @@ export {
7082
7082
  Vf as InlineTableField,
7083
7083
  zu as applyValueColumns,
7084
7084
  ju as dropUnavailableValues,
7085
- Ut as evalClientFormula,
7085
+ Wt as evalClientFormula,
7086
7086
  Uo as failingLints,
7087
7087
  pa as spreadAmounts
7088
7088
  };