@nivaro/react 0.3.15 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2344 -2309
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  12. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  13. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  14. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  15. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  16. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  17. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  18. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  19. package/dist/shared/components/item-edit/column-length.js +12 -0
  20. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  21. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  22. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  23. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  24. package/dist/shared/components/profile/DelegationCard.js +178 -121
  25. package/dist/shared/components/profile/PersonActivity.js +152 -139
  26. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  27. package/dist/shared/components/queue/transition-note.js +90 -0
  28. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  29. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  30. package/dist/shared/lib/autofill-runs.js +33 -26
  31. package/dist/shared/lib/draft-store.js +40 -24
  32. package/dist/shared/lib/live-queries.js +10 -9
  33. package/dist/shared/lib/restore-skipped.js +10 -0
  34. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import { jsx as s, jsxs as _, Fragment as xn } from "react/jsx-runtime";
2
2
  import { useQueryClient as jo, useQuery as Fe, useQueries as Ct } from "@tanstack/react-query";
3
3
  import { Loader2 as vn, ListChecks as Ya, SquarePen as Ga, Rows3 as Xa, PanelBottomOpen as Za, Zap as Ca, Clock as Ni, History as Lr, AlertTriangle as Yn, ChevronRight as To, GripVertical as xo, FileUp as vo, X as wo, GripHorizontal as el, Lock as tl } from "lucide-react";
4
- import { useState as U, useMemo as T, useEffect as Se, useRef as xe, useCallback as Mt, Fragment as Si } from "react";
4
+ import { useState as U, useMemo as T, useEffect as $e, useRef as xe, useCallback as Mt, Fragment as Si } from "react";
5
5
  import { createPortal as nl } from "react-dom";
6
6
  import { ChangeReasonDialog as rl, changeReasonChallenge as $i } from "./ChangeReasonDialog.js";
7
- import { toast as qe } from "sonner";
7
+ import { toast as Se } from "sonner";
8
8
  import { useNivaroClient as Pr, useDrilldown as il, useParentDraft as sl, useReimportHandler as ol, useItemEditAuth as al, fieldDrilldownConfig as _o } from "../../context.js";
9
9
  import { get as re, patch as yt, post as Ke, del as Lo } from "../../lib/commands.js";
10
10
  import { useAfterIdle as ll } from "../../lib/defer.js";
@@ -12,25 +12,26 @@ import { evaluateNumeric as pt, evaluateBoolean as dl } from "../../lib/expressi
12
12
  import { numericIntlOptions as bt } from "../../lib/format-value.js";
13
13
  import { useOptionalRealtime as cl } from "../../lib/realtime.js";
14
14
  import { useRecordReader as ul } from "../../lib/record-loader.js";
15
- import { userErrorMessage as fl } from "../../lib/safe-error.js";
16
- import { titleCase as $e, cn as ve, formatRelative as ko, toLocalDateString as ml } from "../../lib/utils.js";
17
- import { formulaInputsChanged as pl } from "../../lib/write-formula.js";
18
- import { ImportFromFileButton as gl } from "../import/ImportFromFileButton.js";
19
- import { Sheet as hl, SheetContent as bl, SheetHeader as yl, SheetTitle as xl } from "../ui/sheet.js";
20
- import { useAddendumO2M as vl, useAddendumView as wl } from "./AddendumFieldContext.js";
21
- import { resolveCompareEndpoint as _l, useCompareSeries as kl, compareColumnClosed as Kt, fmtMoney as qi, CompareProposalBanner as Nl, CompareStripChips as Sl, GridStatChip as $l, CompareCell as Ei, compareRowFor as Oi, compareColumnSum as ql, ReconcileAction as El } from "./CompareSeries.js";
15
+ import { restoreSkippedNote as fl } from "../../lib/restore-skipped.js";
16
+ import { userErrorMessage as ml } from "../../lib/safe-error.js";
17
+ import { titleCase as qe, cn as ve, formatRelative as ko, toLocalDateString as pl } from "../../lib/utils.js";
18
+ import { formulaInputsChanged as gl } from "../../lib/write-formula.js";
19
+ import { ImportFromFileButton as hl } from "../import/ImportFromFileButton.js";
20
+ import { Sheet as bl, SheetContent as yl, SheetHeader as xl, SheetTitle as vl } from "../ui/sheet.js";
21
+ import { useAddendumO2M as wl, useAddendumView as _l } from "./AddendumFieldContext.js";
22
+ import { resolveCompareEndpoint as kl, useCompareSeries as Nl, compareColumnClosed as Kt, fmtMoney as qi, CompareProposalBanner as Sl, CompareStripChips as $l, GridStatChip as ql, CompareCell as Ei, compareRowFor as Oi, compareColumnSum as El, ReconcileAction as Ol } from "./CompareSeries.js";
22
23
  import { FieldRenderer as yn } from "./FieldRenderer.js";
23
- import { GridBulkEditDialog as Ol } from "./GridBulkEditDialog.js";
24
+ import { GridBulkEditDialog as Il } from "./GridBulkEditDialog.js";
24
25
  import { SENTINEL_FIELDS as Ii, applyDisplayTemplate as Bn, parseJson as No, EMPTY_NESTED_OPS as Mr, SYSTEM_FIELDS as So } from "./helpers.js";
25
- import { NUMBER_FIELD_TYPES as Il, checkNumberEntry as Al, changedRowFields as $o, lineRuleErrors as jl } from "./line-qty.js";
26
+ import { NUMBER_FIELD_TYPES as Al, checkNumberEntry as jl, changedRowFields as $o, lineRuleErrors as Tl } from "./line-qty.js";
26
27
  import { NestedRelationEditor as Ai } from "./NestedRelationEditor.js";
27
- import { useO2MStaging as Tl, useLiveRows as Ll, useStagedRelations as Ml } from "./O2MStagingContext.js";
28
+ import { useO2MStaging as Ll, useLiveRows as Ml, useStagedRelations as Kl } from "./O2MStagingContext.js";
28
29
  import { RelationCombobox as ji } from "./RelationCombobox.js";
29
- import { useRowCommentCounts as Kl, RowCommentButton as Rl } from "./RowComments.js";
30
- import { RowHistorySheet as qo, parseImportStamp as Pl } from "./RowHistorySheet.js";
31
- import { useRowMatches as Dl, RowMatchDot as Eo, rowFromCandidate as Wl, RowMatchPanel as Ul } from "./RowMatchPanel.js";
32
- import { RowWatchButton as Jl } from "./RowWatchButton.js";
33
- import { RuleProvenanceChip as zl } from "./RuleProvenancePopover.js";
30
+ import { useRowCommentCounts as Rl, RowCommentButton as Pl } from "./RowComments.js";
31
+ import { RowHistorySheet as qo, parseImportStamp as Dl } from "./RowHistorySheet.js";
32
+ import { useRowMatches as Wl, RowMatchDot as Eo, rowFromCandidate as Ul, RowMatchPanel as Jl } from "./RowMatchPanel.js";
33
+ import { RowWatchButton as zl } from "./RowWatchButton.js";
34
+ import { RuleProvenanceChip as Ql } from "./RuleProvenancePopover.js";
34
35
  import { resolveOptionFilterTokens as Mo } from "../../lib/option-filter-tokens.js";
35
36
  function Oo(a, f) {
36
37
  const v = a[f.field], E = v == null || v === "", z = f.op ?? "eq";
@@ -51,14 +52,14 @@ function Ti(a, f) {
51
52
  !((E = W == null ? void 0 : W.when) != null && E.field) || !((z = W == null ? void 0 : W.expect) != null && z.field) || Oo(a, W.when) && (Oo(a, W.expect) || v.push(W.label || `${W.when.field} vs ${W.expect.field}`));
52
53
  return v;
53
54
  }
54
- const Ql = {
55
+ const Fl = {
55
56
  lt: "<",
56
57
  gt: ">",
57
58
  quot: '"',
58
59
  amp: "&",
59
60
  "#39": "'"
60
61
  };
61
- function Fl({ children: a }) {
62
+ function Vl({ children: a }) {
62
63
  const [f, v] = U(null);
63
64
  return /* @__PURE__ */ _(
64
65
  "span",
@@ -88,11 +89,11 @@ function Fl({ children: a }) {
88
89
  }
89
90
  );
90
91
  }
91
- function Vl(a) {
92
+ function Bl(a) {
92
93
  if (typeof a != "string" || !a.trim()) return [];
93
94
  const f = a.replace(
94
95
  /&(lt|gt|quot|amp|#39);/g,
95
- (W, ne) => Ql[ne] ?? ""
96
+ (W, ne) => Fl[ne] ?? ""
96
97
  ), v = [], E = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
97
98
  let z = E.exec(f);
98
99
  for (; z; ) {
@@ -134,12 +135,12 @@ function Ko(a, f, v, E) {
134
135
  return ne;
135
136
  }
136
137
  const Mi = 1e3;
137
- function Bl(a) {
138
+ function Hl(a) {
138
139
  let f = 0;
139
140
  for (let v = 0; v < a.length; v++) f = f * 31 + a.charCodeAt(v) | 0;
140
141
  return f;
141
142
  }
142
- function Hl(a) {
143
+ function Yl(a) {
143
144
  if (a.line_number != null && a.line_number !== "") return `line ${a.line_number}`;
144
145
  for (const f of ["year", "name", "title", "label", "number"]) {
145
146
  const v = a[f];
@@ -190,10 +191,10 @@ function Kr(a, f) {
190
191
  a
191
192
  );
192
193
  }
193
- function Yl(a, f, v) {
194
+ function Gl(a, f, v) {
194
195
  return f === "presence" ? a != null && String(a).trim() !== "" ? "Yes" : "No" : a == null || a === "" ? "—" : f === "currency" && Number.isFinite(Number(a)) ? Number(a).toLocaleString("en-US", bt(v, "currency")) : String(a);
195
196
  }
196
- function Gl({
197
+ function Xl({
197
198
  config: a,
198
199
  relatedCollection: f,
199
200
  manyField: v,
@@ -335,8 +336,8 @@ function Gl({
335
336
  children: "Allocate…"
336
337
  }
337
338
  ),
338
- /* @__PURE__ */ s(hl, { open: G, onOpenChange: Ee, children: /* @__PURE__ */ _(bl, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
339
- /* @__PURE__ */ s(yl, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ s(xl, { className: "text-[14px]", children: a.title ?? "Allocate" }) }),
339
+ /* @__PURE__ */ s(bl, { open: G, onOpenChange: Ee, children: /* @__PURE__ */ _(yl, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
340
+ /* @__PURE__ */ s(xl, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ s(vl, { className: "text-[14px]", children: a.title ?? "Allocate" }) }),
340
341
  /* @__PURE__ */ _("div", { className: "p-4", children: [
341
342
  /* @__PURE__ */ s("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
342
343
  Pt ? /* @__PURE__ */ s("div", { className: "py-10 text-center", children: /* @__PURE__ */ s(vn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : Qe.length === 0 ? /* @__PURE__ */ s("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ s("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ _("table", { className: "w-full text-left text-[12px]", children: [
@@ -345,7 +346,7 @@ function Gl({
345
346
  "th",
346
347
  {
347
348
  className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500",
348
- children: Q.label ?? $e((Q.path ?? "").split(".").pop() ?? "")
349
+ children: Q.label ?? qe((Q.path ?? "").split(".").pop() ?? "")
349
350
  },
350
351
  D
351
352
  )),
@@ -445,7 +446,7 @@ function Gl({
445
446
  fe.push(
446
447
  /* @__PURE__ */ _("tr", { className: ve(wn && "bg-nvr-cyan/5"), children: [
447
448
  he.map((me, O) => {
448
- const N = me.formula ? et(me.formula, we) : Yl(Kr(we, me.path ?? ""), me.format);
449
+ const N = me.formula ? et(me.formula, we) : Gl(Kr(we, me.path ?? ""), me.format);
449
450
  return /* @__PURE__ */ s(
450
451
  "td",
451
452
  {
@@ -497,7 +498,7 @@ function Gl({
497
498
  ] }) })
498
499
  ] });
499
500
  }
500
- function Xl({
501
+ function Zl({
501
502
  config: a,
502
503
  rows: f,
503
504
  relatedCollection: v,
@@ -509,7 +510,7 @@ function Xl({
509
510
  const je = Object.keys(a.set).filter((L) => E.has(L));
510
511
  if (je.length > 0) {
511
512
  const L = je[0];
512
- qe.error(
513
+ Se.error(
513
514
  `${a.label}: "${L}" is calculated from ${E.get(L)} and cannot be set directly — target those fields instead`,
514
515
  { duration: 12e3 }
515
516
  );
@@ -521,14 +522,14 @@ function Xl({
521
522
  (X) => X.one_collection === v && X.one_field === a.relation
522
523
  );
523
524
  if (!(C != null && C.many_collection) || !(C != null && C.many_field)) {
524
- qe.error(
525
+ Se.error(
525
526
  `${a.label}: "${a.relation}" is not a relation on ${v}`
526
527
  );
527
528
  return;
528
529
  }
529
530
  const pe = f.map((X) => X.id).filter((X) => X != null);
530
531
  if (pe.length === 0) {
531
- qe.message(`${a.label}: no saved rows to update`);
532
+ Se.message(`${a.label}: no saved rows to update`);
532
533
  return;
533
534
  }
534
535
  const G = await W.request(
@@ -564,11 +565,11 @@ function Xl({
564
565
  }
565
566
  await z(X, he), Oe++;
566
567
  }
567
- qe.success(
568
+ Se.success(
568
569
  `${a.label}: ${Oe} row${Oe === 1 ? "" : "s"} updated` + (ge > 0 ? `, ${ge} unchanged` : "")
569
570
  );
570
571
  } catch {
571
- qe.error(`${a.label} failed`);
572
+ Se.error(`${a.label} failed`);
572
573
  } finally {
573
574
  oe(!1);
574
575
  }
@@ -607,7 +608,7 @@ function Xl({
607
608
  }
608
609
  );
609
610
  }
610
- function Zl({
611
+ function Cl({
611
612
  config: a,
612
613
  matchCfg: f,
613
614
  rows: v,
@@ -694,7 +695,7 @@ function Zl({
694
695
  Oe > 0 ? `Allocated ${Oe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${ge} row${ge === 1 ? "" : "s"}` : "Nothing to allocate"
695
696
  ), X.length > 0 && de.push(`short on row${X.length === 1 ? "" : "s"} ${X.join(", ")}`), L(de.join(" — ")), J.invalidateQueries({ queryKey: ["o2m-rows", W, ne, E] }), J.invalidateQueries({ queryKey: ["match-agg"] });
696
697
  } catch (de) {
697
- L(`Auto-allocate failed: ${fl(de, "unknown error")}`);
698
+ L(`Auto-allocate failed: ${ml(de, "unknown error")}`);
698
699
  } finally {
699
700
  te(!1);
700
701
  }
@@ -713,7 +714,7 @@ function Zl({
713
714
  je && /* @__PURE__ */ s("span", { className: "text-[11px] text-slate-500", children: je })
714
715
  ] });
715
716
  }
716
- function Md({
717
+ function Rd({
717
718
  relatedCollection: a,
718
719
  manyField: f,
719
720
  parentId: v,
@@ -757,7 +758,7 @@ function Md({
757
758
  editorMode: fe
758
759
  }) {
759
760
  var bo, yo;
760
- const S = Pr(), we = ul(), le = il(), V = jo(), k = Tl(), wn = Ll(), Dt = Ml(), me = vl()[P ?? ""] ?? [], O = v === "new", N = sl(), Wt = ol(), qt = cl(), Gn = `nvr_grid_editor_${a}_${P ?? f}`, [Xn, tt] = U(() => {
761
+ const S = Pr(), we = ul(), le = il(), V = jo(), k = Ll(), wn = Ml(), Dt = Kl(), me = wl()[P ?? ""] ?? [], O = v === "new", N = sl(), Wt = ol(), qt = cl(), Gn = `nvr_grid_editor_${a}_${P ?? f}`, [Xn, tt] = U(() => {
761
762
  if (typeof localStorage > "u") return null;
762
763
  try {
763
764
  const e = localStorage.getItem(Gn);
@@ -795,7 +796,7 @@ function Md({
795
796
  return 320;
796
797
  }
797
798
  });
798
- Se(() => {
799
+ $e(() => {
799
800
  try {
800
801
  localStorage.setItem(Dr, String(Cn));
801
802
  } catch {
@@ -806,7 +807,7 @@ function Md({
806
807
  async () => {
807
808
  }
808
809
  ), nr = xe(null), Wi = xe(!1);
809
- Se(() => {
810
+ $e(() => {
810
811
  if (j || typeof window > "u") return;
811
812
  const e = (n) => {
812
813
  const t = n.detail;
@@ -821,7 +822,7 @@ function Md({
821
822
  }
822
823
  };
823
824
  return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
824
- }, [j, E, P, f, a]), Se(() => {
825
+ }, [j, E, P, f, a]), $e(() => {
825
826
  const e = tr.current;
826
827
  if (!e || !_e) return;
827
828
  const n = (t) => {
@@ -852,7 +853,7 @@ function Md({
852
853
  if (!["ERROR", "FAILED"].includes(c)) continue;
853
854
  const u = String((o == null ? void 0 : o.lineNumber) ?? "");
854
855
  if (!u || e.has(u)) continue;
855
- const d = Vl(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
856
+ const d = Bl(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
856
857
  (g) => new RegExp(`^Line(?:Number)?\\s*${u}\\s*:`, "i").test(g.trim())
857
858
  ) ?? d[0];
858
859
  m && e.set(u, m.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
@@ -864,7 +865,7 @@ function Md({
864
865
  }
865
866
  return e;
866
867
  }, [ir]), Qi = xe(!1), [Fi, Ur] = U(O && !!D);
867
- Se(() => {
868
+ $e(() => {
868
869
  if (!Qi.current) {
869
870
  if (!O || !D || !k) {
870
871
  Ur(!1);
@@ -910,11 +911,11 @@ function Md({
910
911
  !Jo.has(o) && c != null && typeof c != "object" && (i[o] = c);
911
912
  k.queueRow(a, f, sn(i));
912
913
  }
913
- qe.success(
914
+ Se.success(
914
915
  t.length > 0 ? `${t.length} line(s) copied in — they save with this record` : "That record has no lines on this table"
915
916
  ), Vi(!1);
916
917
  } catch {
917
- qe.error("Could not copy lines");
918
+ Se.error("Could not copy lines");
918
919
  }
919
920
  }, dt = E && !O ? `?parent_collection=${encodeURIComponent(E)}&parent_id=${encodeURIComponent(v)}` : "", [Ie, kn] = U(null), [Qo, Jr] = U(null), [Bi, sr] = U(!1), [Fo, Hi] = U(!1), { data: Vo = [], isLoading: Bo } = Fe({
920
921
  queryKey: ["o2m-row-revisions", a, Ie == null ? void 0 : Ie.id],
@@ -952,14 +953,15 @@ function Md({
952
953
  async function Go(e) {
953
954
  Hi(!0);
954
955
  try {
955
- await S.request(
956
+ const n = await S.request(
956
957
  Ke("/revisions/o2m-restore", {
957
958
  collection: a,
958
959
  many_field: f,
959
960
  parent_id: v,
960
961
  target_timestamp: e
961
962
  })
962
- ), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), V.invalidateQueries({
963
+ ), t = fl(n);
964
+ t && Se.warning(t, { duration: 1e4 }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), V.invalidateQueries({
963
965
  queryKey: ["o2m-field-snapshots", a, f, v]
964
966
  }), sr(!1);
965
967
  } catch {
@@ -983,14 +985,14 @@ function Md({
983
985
  var t, r;
984
986
  (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (vt.current && or(vt.current, "end"), vt.current = null);
985
987
  };
986
- Se(
988
+ $e(
987
989
  () => () => {
988
990
  vt.current && or(vt.current, "end");
989
991
  },
990
992
  []
991
993
  );
992
994
  const tn = xe(null);
993
- Se(() => {
995
+ $e(() => {
994
996
  const e = p == null ? void 0 : p.rowId, n = e && e !== "new" && !e.startsWith("pending:") ? `${a}:${e}` : null;
995
997
  n !== tn.current && (typeof window > "u" || (tn.current && window.dispatchEvent(
996
998
  new CustomEvent("nvr:row-editing", {
@@ -999,7 +1001,7 @@ function Md({
999
1001
  ), n && window.dispatchEvent(
1000
1002
  new CustomEvent("nvr:row-editing", { detail: { row: n, state: "start" } })
1001
1003
  ), tn.current = n));
1002
- }, [p == null ? void 0 : p.rowId, a]), Se(
1004
+ }, [p == null ? void 0 : p.rowId, a]), $e(
1003
1005
  () => () => {
1004
1006
  tn.current && typeof window < "u" && window.dispatchEvent(
1005
1007
  new CustomEvent("nvr:row-editing", {
@@ -1013,9 +1015,9 @@ function Md({
1013
1015
  rowId: null,
1014
1016
  seqs: /* @__PURE__ */ new Map()
1015
1017
  });
1016
- Se(() => {
1018
+ $e(() => {
1017
1019
  Ge.current = p;
1018
- }, [p]), Se(() => {
1020
+ }, [p]), $e(() => {
1019
1021
  if (!p || j) return;
1020
1022
  const e = (n) => {
1021
1023
  const t = n.target;
@@ -1058,7 +1060,7 @@ function Md({
1058
1060
  } : null
1059
1061
  );
1060
1062
  }
1061
- const [lr, qn] = U(null), Le = wl(), [Qr, ea] = U(() => {
1063
+ const [lr, qn] = U(null), Le = _l(), [Qr, ea] = U(() => {
1062
1064
  var e;
1063
1065
  return pe === Hn ? Hn : pe && (C != null && C.some((n) => n.name === pe)) ? pe : (e = C == null ? void 0 : C[0]) == null ? void 0 : e.name;
1064
1066
  });
@@ -1169,7 +1171,7 @@ function Md({
1169
1171
  ), ns = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, Br = (rn == null ? void 0 : rn.data) ?? {}, ra = (rn == null ? void 0 : rn.created) ?? {}, fr = (e) => {
1170
1172
  const n = ra[e];
1171
1173
  if (!n) return null;
1172
- const t = Pl(n.comment);
1174
+ const t = Dl(n.comment);
1173
1175
  return t ? `From ${t.template} · ${ko(n.at)} by ${n.who}` : null;
1174
1176
  }, On = je ?? [], rs = Ct({
1175
1177
  queries: On.map((e) => ({
@@ -1208,7 +1210,7 @@ function Md({
1208
1210
  }));
1209
1211
  }), e;
1210
1212
  }, [On, rs, N]), K = J === "pending", M = k ? k.getPendingRows(a, f) : [], H = K && k ? k.getPendingEdits(a, f) : /* @__PURE__ */ new Map(), [mr, pr] = U({});
1211
- Se(() => {
1213
+ $e(() => {
1212
1214
  Ge.current || pr({});
1213
1215
  }, [ur]);
1214
1216
  const Je = K && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(), Hr = T(
@@ -1416,7 +1418,7 @@ function Md({
1416
1418
  "en-US",
1417
1419
  bt(r, r.format)
1418
1420
  );
1419
- n.push({ label: t.label || $e(t.field), text: u });
1421
+ n.push({ label: t.label || qe(t.field), text: u });
1420
1422
  }
1421
1423
  return n;
1422
1424
  }, us = T(
@@ -1430,7 +1432,7 @@ function Md({
1430
1432
  const t = n === void 0 ? fs(e.id) : n, r = { ...e };
1431
1433
  for (const i of us) {
1432
1434
  const o = i.computed_formula;
1433
- if (t && !pl(o, r, t)) continue;
1435
+ if (t && !gl(o, r, t)) continue;
1434
1436
  const c = Rt(o, r);
1435
1437
  c !== null && (r[i.field] = c);
1436
1438
  }
@@ -1517,14 +1519,14 @@ function Md({
1517
1519
  },
1518
1520
  [wt, jn]
1519
1521
  ), ti = T(() => Ce != null && Ce.length ? Ce.map((e) => ({ ...e, result: pt(e.value, Vt) })) : null, [Ce, Vt]), hr = T(
1520
- () => Pe != null && Pe.endpoint ? _l(Pe.endpoint, wt) : null,
1522
+ () => Pe != null && Pe.endpoint ? kl(Pe.endpoint, wt) : null,
1521
1523
  [Pe == null ? void 0 : Pe.endpoint, wt]
1522
- ), ni = kl({
1524
+ ), ni = Nl({
1523
1525
  client: S,
1524
1526
  endpoint: hr,
1525
1527
  enabled: !!Pe && !O
1526
1528
  }), q = Pe && !O ? ni.data ?? null : null, ps = !!Pe && !O && !!hr && ni.isLoading, gs = !!Pe && !O && ni.isError, br = Mt(
1527
- (e) => e.label || $e(e.field),
1529
+ (e) => e.label || qe(e.field),
1528
1530
  []
1529
1531
  ), { isAdmin: ri } = al(), ii = Mt(
1530
1532
  (e, n) => !!(q != null && q.closed_locked) && !ri && q.columns.includes(e) && Kt(q, n[q.key_field], e),
@@ -1553,7 +1555,7 @@ function Md({
1553
1555
  yt(`/items/${a}/${e}`, { ...n, _change_reason: t })
1554
1556
  ), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
1555
1557
  } catch (r) {
1556
- qe.error(`Could not save: ${(r == null ? void 0 : r.message) ?? "unknown error"}`);
1558
+ Se.error(`Could not save: ${(r == null ? void 0 : r.message) ?? "unknown error"}`);
1557
1559
  }
1558
1560
  },
1559
1561
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1600,7 +1602,7 @@ function Md({
1600
1602
  sn(ce({ [n]: c.key, ...m, _change_reason: t }))
1601
1603
  ));
1602
1604
  }
1603
- qe.success(
1605
+ Se.success(
1604
1606
  i ? `${e.label}: staged on ${i} ${i === 1 ? "row" : "rows"} — save to keep it` : "Nothing to apply — every suggested cell is already filled or closed"
1605
1607
  ), si(e, !1);
1606
1608
  },
@@ -1632,7 +1634,7 @@ function Md({
1632
1634
  for (const y of be.fields)
1633
1635
  r && !i(w.row[y]) || q && Kt(q, w.row[q.key_field], y) || (l.push({ id: w.id, field: y }), m.push(0));
1634
1636
  if (l.length === 0) {
1635
- qe.message("Nothing to spread into — every target is filled or closed");
1637
+ Se.message("Nothing to spread into — every target is filled or closed");
1636
1638
  return;
1637
1639
  }
1638
1640
  const g = Ko(
@@ -1651,7 +1653,7 @@ function Md({
1651
1653
  y,
1652
1654
  `${be.label ?? "Spread remaining"} across ${b.size} rows`
1653
1655
  );
1654
- qe.success(
1656
+ Se.success(
1655
1657
  `Spread ${qi(t)} over ${l.length} cells on ${b.size} ${b.size === 1 ? "row" : "rows"}`
1656
1658
  );
1657
1659
  },
@@ -1668,7 +1670,7 @@ function Md({
1668
1670
  an
1669
1671
  ]
1670
1672
  ), Bt = wn == null ? void 0 : wn.report;
1671
- Se(() => {
1673
+ $e(() => {
1672
1674
  if (Bt) {
1673
1675
  if (ms || nn) {
1674
1676
  Bt(a, f, null);
@@ -1679,7 +1681,7 @@ function Md({
1679
1681
  }, [Bt, a, f, jn, ms, nn]);
1680
1682
  const ys = xe(() => {
1681
1683
  });
1682
- ys.current = () => Bt == null ? void 0 : Bt(a, f, null), Se(() => () => ys.current(), []);
1684
+ ys.current = () => Bt == null ? void 0 : Bt(a, f, null), $e(() => () => ys.current(), []);
1683
1685
  const Ln = T(() => {
1684
1686
  const e = /* @__PURE__ */ new Map();
1685
1687
  for (const n of ke) {
@@ -1840,7 +1842,7 @@ function Md({
1840
1842
  }
1841
1843
  return e;
1842
1844
  }, [Ht, kt, qs, ln]), vr = T(() => $.map((e) => String(e.id)), [$]), Kn = T(
1843
- () => `nvr-gf-${Math.abs(Bl(`${a}:${P ?? f}`)) % 1e5}`,
1845
+ () => `nvr-gf-${Math.abs(Hl(`${a}:${P ?? f}`)) % 1e5}`,
1844
1846
  [a, P, f]
1845
1847
  ), Es = T(() => {
1846
1848
  if (!X) return null;
@@ -1865,7 +1867,7 @@ function Md({
1865
1867
  K,
1866
1868
  A
1867
1869
  ]), [cn, ga] = U(150), Os = xe(null);
1868
- Se(() => {
1870
+ $e(() => {
1869
1871
  const e = Os.current;
1870
1872
  if (!e || $.length <= cn) return;
1871
1873
  const n = new IntersectionObserver(
@@ -1876,7 +1878,7 @@ function Md({
1876
1878
  );
1877
1879
  return n.observe(e), () => n.disconnect();
1878
1880
  }, [$.length, cn]);
1879
- const ha = vr.join(","), ba = Kl(
1881
+ const ha = vr.join(","), ba = Rl(
1880
1882
  a,
1881
1883
  vr,
1882
1884
  !!ne && !O
@@ -1916,7 +1918,7 @@ function Md({
1916
1918
  e.set(n, i);
1917
1919
  }), e;
1918
1920
  }, [Ht, kt, Is]), As = Dt == null ? void 0 : Dt.report;
1919
- Se(() => {
1921
+ $e(() => {
1920
1922
  if (!As || !G || G.length === 0) return;
1921
1923
  const e = `${a}.${f}`, n = (r, i) => {
1922
1924
  const o = {};
@@ -2038,7 +2040,7 @@ function Md({
2038
2040
  field: `${e}.${n}`,
2039
2041
  type: "presentation",
2040
2042
  interface: null,
2041
- label: (i == null ? void 0 : i.label) ?? $e(n),
2043
+ label: (i == null ? void 0 : i.label) ?? qe(n),
2042
2044
  required: !1,
2043
2045
  hidden: !1,
2044
2046
  readonly: !0,
@@ -2132,7 +2134,7 @@ function Md({
2132
2134
  const t = Ms.current.get(e);
2133
2135
  return !!t && n - t < Ks;
2134
2136
  };
2135
- Se(() => {
2137
+ $e(() => {
2136
2138
  if (O || nn || !Pn) return;
2137
2139
  if (!un.current) {
2138
2140
  un.current = new Map(Xe.map((i) => [String(i.id), Nt(i)])), li((i) => i + 1);
@@ -2175,7 +2177,7 @@ function Md({
2175
2177
  for (const o of Object.keys(r)) {
2176
2178
  if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(Nr[o] ?? "\0") === String(r[o] ?? "") || String((p == null ? void 0 : p.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2177
2179
  const c = ke.find((u) => u.field === o);
2178
- (c == null ? void 0 : c.computed_type) === "write" && c.computed_formula || i.push({ field: o, label: (c == null ? void 0 : c.label) || $e(o), theirs: r[o], was: e.snap[o] });
2180
+ (c == null ? void 0 : c.computed_type) === "write" && c.computed_formula || i.push({ field: o, label: (c == null ? void 0 : c.label) || qe(o), theirs: r[o], was: e.snap[o] });
2179
2181
  }
2180
2182
  return i;
2181
2183
  }, [Xe, p == null ? void 0 : p.rowId, p == null ? void 0 : p.draft, Nr, Nt, ke]), Ps = (e) => {
@@ -2264,7 +2266,7 @@ function Md({
2264
2266
  }
2265
2267
  return null;
2266
2268
  }, Js = !es && (O || !nn);
2267
- Se(() => {
2269
+ $e(() => {
2268
2270
  const e = tr.current;
2269
2271
  if (!e || !Js || typeof MutationObserver > "u") return;
2270
2272
  const n = `${a}:`, t = () => {
@@ -2290,14 +2292,14 @@ function Md({
2290
2292
  r.disconnect(), ci.current = () => {
2291
2293
  };
2292
2294
  };
2293
- }, [Js, a]), Se(() => {
2295
+ }, [Js, a]), $e(() => {
2294
2296
  const e = di.current;
2295
2297
  for (const n of [...e]) {
2296
2298
  const [t, r] = JSON.parse(n);
2297
2299
  mn.get(t) !== r && e.delete(n);
2298
2300
  }
2299
2301
  Ze && mn.get(Ze.rowKey) !== Ze.editor && Yt(null);
2300
- }, [mn, Ze]), Se(() => {
2302
+ }, [mn, Ze]), $e(() => {
2301
2303
  if (!Ze || typeof window > "u") return;
2302
2304
  const e = (n) => {
2303
2305
  n.key === "Escape" && Yt(null);
@@ -2314,7 +2316,7 @@ function Md({
2314
2316
  e.push(`${r} is editing line ${String(o ? i : t + 1)}`);
2315
2317
  }), e;
2316
2318
  }, [mn, $]);
2317
- Se(() => {
2319
+ $e(() => {
2318
2320
  if (!qt || O) return;
2319
2321
  let e = null;
2320
2322
  const n = qt.subscribeCollections([a], () => {
@@ -2327,7 +2329,7 @@ function Md({
2327
2329
  };
2328
2330
  }, [qt, a, f, v, O, V]);
2329
2331
  const zs = xe(null);
2330
- Se(() => {
2332
+ $e(() => {
2331
2333
  const e = {
2332
2334
  edits: new Set(H.keys()),
2333
2335
  deletes: new Set(Je),
@@ -2438,7 +2440,7 @@ function Md({
2438
2440
  $,
2439
2441
  M
2440
2442
  ]), Sr = xe(/* @__PURE__ */ new Set()), hi = xe(!1);
2441
- Se(() => {
2443
+ $e(() => {
2442
2444
  var t;
2443
2445
  if (j || !S || hi.current) return;
2444
2446
  const e = N == null ? void 0 : N.dirtyFields;
@@ -2471,8 +2473,8 @@ function Md({
2471
2473
  }), h = `hint|${r.child_field}|${d}`;
2472
2474
  if (b && !Sr.current.has(h)) {
2473
2475
  Sr.current.add(h);
2474
- const w = ((t = N == null ? void 0 : N.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? $e(r.parent_field);
2475
- qe.message(
2476
+ const w = ((t = N == null ? void 0 : N.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? qe(r.parent_field);
2477
+ Se.message(
2476
2478
  `${i.label ?? "Value"} on ${l.length} ${l.length === 1 ? "line is" : "lines are"} not available for this ${w} — no default ${(i.label ?? "value").toLowerCase()} is set on it (or its type), so nothing was switched`
2477
2479
  );
2478
2480
  }
@@ -2573,10 +2575,10 @@ function Md({
2573
2575
  queryKey: ["o2m-rows", a, f, v]
2574
2576
  });
2575
2577
  }
2576
- const c = ((l = n[0]) == null ? void 0 : l.cfg.label) ?? "Value", u = ((g = N == null ? void 0 : N.fieldLabels) == null ? void 0 : g[((m = n[0]) == null ? void 0 : m.rule.parent_field) ?? ""]) ?? $e(((b = n[0]) == null ? void 0 : b.rule.parent_field) ?? "parent");
2577
- r && qe.message(
2578
+ const c = ((l = n[0]) == null ? void 0 : l.cfg.label) ?? "Value", u = ((g = N == null ? void 0 : N.fieldLabels) == null ? void 0 : g[((m = n[0]) == null ? void 0 : m.rule.parent_field) ?? ""]) ?? qe(((b = n[0]) == null ? void 0 : b.rule.parent_field) ?? "parent");
2579
+ r && Se.message(
2578
2580
  `${c} switched to the default on ${r} ${r === 1 ? "line" : "lines"} — the previous one is not available for this ${u}${(K || O) && k ? " (saved with the record)" : ""}`
2579
- ), (i || o) && qe.warning(
2581
+ ), (i || o) && Se.warning(
2580
2582
  `${i + o} ${i + o === 1 ? "line" : "lines"} could not be switched — no matching default option${o ? " / save failed" : ""}`
2581
2583
  );
2582
2584
  })().finally(() => {
@@ -2658,7 +2660,7 @@ function Md({
2658
2660
  () => ae != null && ae.unmatched_banner ? M.map((e) => ce({ ...e })) : void 0,
2659
2661
  // eslint-disable-next-line react-hooks/exhaustive-deps
2660
2662
  [ae == null ? void 0 : ae.unmatched_banner, M]
2661
- ), It = Dl({
2663
+ ), It = Wl({
2662
2664
  config: ae,
2663
2665
  rows: $,
2664
2666
  stagedRows: $a,
@@ -2711,11 +2713,11 @@ function Md({
2711
2713
  for (const l of u)
2712
2714
  Je.has(String(l.id)) || k.queueEdit(a, f, String(l.id), l.patch);
2713
2715
  const d = c.length + u.length;
2714
- qe.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), hn(null), Er(!1);
2716
+ Se.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), hn(null), Er(!1);
2715
2717
  return;
2716
2718
  }
2717
2719
  if (c.length > 0 && u.length === 0) {
2718
- qe.success(
2720
+ Se.success(
2719
2721
  `Rules applied to ${c.length} pending ${c.length === 1 ? "line" : "lines"}`
2720
2722
  ), hn(null), Er(!1);
2721
2723
  return;
@@ -2739,11 +2741,11 @@ function Md({
2739
2741
  for (const d of u) ot(String(d.id));
2740
2742
  V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), V.invalidateQueries({
2741
2743
  queryKey: ["o2m-field-snapshots", a, f, v]
2742
- }), o.failed.length ? qe.error(
2744
+ }), o.failed.length ? Se.error(
2743
2745
  `Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"} — ${o.failed.length} failed: ${o.failed.slice(0, 3).map((d) => `#${d.id} ${d.error}`).join("; ")}`
2744
- ) : qe.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), hn(null), Er(!1);
2746
+ ) : Se.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), hn(null), Er(!1);
2745
2747
  } catch (i) {
2746
- qe.error(`Re-run rules failed: ${(i == null ? void 0 : i.message) ?? "unknown error"}`);
2748
+ Se.error(`Re-run rules failed: ${(i == null ? void 0 : i.message) ?? "unknown error"}`);
2747
2749
  } finally {
2748
2750
  io(null);
2749
2751
  }
@@ -2803,7 +2805,7 @@ function Md({
2803
2805
  const r = ce({ ...e });
2804
2806
  fn.current = { rowId: n, snap: Nt(e) }, De({ rowId: n, draft: r, locksPending: Nn.size > 0 }), $r(n, r);
2805
2807
  }
2806
- Se(() => {
2808
+ $e(() => {
2807
2809
  const e = (n) => {
2808
2810
  const t = n.detail;
2809
2811
  if (!t || t.collection !== a || t.field !== f || !t.rowId) return;
@@ -2830,7 +2832,7 @@ function Md({
2830
2832
  const n = (l = (d = Ge.current) == null ? void 0 : d.lockReasons) == null ? void 0 : l[e];
2831
2833
  if (!n) return "Set automatically for this row";
2832
2834
  if (n.reason) return `Locked — ${n.reason}`;
2833
- const t = n.field ? ke.find((b) => b.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? $e(n.field) : "a rule"), i = n.field ? (m = Ge.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? Ve.get(n.field) : void 0, c = i == null || i === "" ? null : o != null && o.one_collection ? ((g = pn[o.one_collection]) == null ? void 0 : g[String(i)]) ?? String(i) : String(i);
2835
+ const t = n.field ? ke.find((b) => b.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? qe(n.field) : "a rule"), i = n.field ? (m = Ge.current) == null ? void 0 : m.draft[n.field] : void 0, o = n.field ? Ve.get(n.field) : void 0, c = i == null || i === "" ? null : o != null && o.one_collection ? ((g = pn[o.one_collection]) == null ? void 0 : g[String(i)]) ?? String(i) : String(i);
2834
2836
  if (c) return `Locked — ${r} is ${c}`;
2835
2837
  const u = n.op === "neq" ? "is not" : n.op === "null" ? "is empty" : n.op === "nnull" ? "is set" : n.op === "in" ? "is one of" : n.op === "contains" ? "contains" : "is";
2836
2838
  return `Locked — ${r} ${u}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
@@ -2988,26 +2990,26 @@ function Md({
2988
2990
  );
2989
2991
  if (r.length > 0)
2990
2992
  return zt(
2991
- `Required: ${r.map((l) => l.label || $e(l.field)).join(", ")}`
2993
+ `Required: ${r.map((l) => l.label || qe(l.field)).join(", ")}`
2992
2994
  ), De((l) => l && { ...l, missing: r.map((m) => m.field) }), !1;
2993
2995
  const i = fs(p.rowId), o = Ne.flatMap((l) => {
2994
2996
  var g;
2995
2997
  if (Vn(l) || (g = p.locks) != null && g.includes(l.field)) return [];
2996
- if (!Il.has(l.type ?? "")) return [];
2998
+ if (!Al.has(l.type ?? "")) return [];
2997
2999
  if (i && String(i[l.field] ?? "") === String(p.draft[l.field] ?? ""))
2998
3000
  return [];
2999
- const m = Al(p.draft[l.field], {
3001
+ const m = jl(p.draft[l.field], {
3000
3002
  type: l.type,
3001
- label: l.label || $e(l.field)
3003
+ label: l.label || qe(l.field)
3002
3004
  });
3003
3005
  return m.ok ? [] : [{ field: l.field, message: m.message }];
3004
3006
  });
3005
3007
  if (o.length > 0)
3006
3008
  return zt(o.map((l) => l.message).join(" · ")), De((l) => l && { ...l, missing: o.map((m) => m.field) }), !1;
3007
- const c = i ? $o(p.draft, i, new Set(Object.keys(p.draft))) : p.draft, u = jl(
3009
+ const c = i ? $o(p.draft, i, new Set(Object.keys(p.draft))) : p.draft, u = Tl(
3008
3010
  ke.map((l) => ({
3009
3011
  field: l.field,
3010
- label: l.label || $e(l.field),
3012
+ label: l.label || qe(l.field),
3011
3013
  type: l.type,
3012
3014
  validation_rules: l.validation_rules
3013
3015
  })),
@@ -3120,7 +3122,7 @@ function Md({
3120
3122
  ee.push(Be), x || (x = Ao($t));
3121
3123
  }
3122
3124
  ee.length && y.push({
3123
- label: $e(Y),
3125
+ label: qe(Y),
3124
3126
  collection: ue.many_collection,
3125
3127
  fkField: ue.many_field,
3126
3128
  rowId: w,
@@ -3243,7 +3245,7 @@ function Md({
3243
3245
  if (!e || It.unmatchedCandidates.length === 0) return;
3244
3246
  const n = It.unmatchedCandidates.map((t) => ({
3245
3247
  ...Ft,
3246
- ...Wl(e, t)
3248
+ ...Ul(e, t)
3247
3249
  }));
3248
3250
  if ((O || K) && k) {
3249
3251
  for (const t of on(n)) k.queueRow(a, f, t);
@@ -3257,7 +3259,7 @@ function Md({
3257
3259
  );
3258
3260
  Et.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
3259
3261
  } catch (t) {
3260
- qe.error(`Could not add rows: ${(t == null ? void 0 : t.message) ?? "unknown error"}`);
3262
+ Se.error(`Could not add rows: ${(t == null ? void 0 : t.message) ?? "unknown error"}`);
3261
3263
  } finally {
3262
3264
  gn(!1);
3263
3265
  }
@@ -3457,13 +3459,13 @@ function Md({
3457
3459
  className: "block max-w-full truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
3458
3460
  children: m ?? String(n)
3459
3461
  }
3460
- ) : h = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(Fl, { children: h }) : h;
3462
+ ) : h = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(Vl, { children: h }) : h;
3461
3463
  }
3462
3464
  if (e.type === "boolean")
3463
3465
  return /* @__PURE__ */ s("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
3464
3466
  if (e.type === "datetime" || e.type === "date")
3465
3467
  try {
3466
- return /* @__PURE__ */ s("span", { className: "block truncate", children: ml(n) });
3468
+ return /* @__PURE__ */ s("span", { className: "block truncate", children: pl(n) });
3467
3469
  } catch {
3468
3470
  }
3469
3471
  if ([
@@ -3653,9 +3655,9 @@ function Md({
3653
3655
  const u = (g, b) => {
3654
3656
  t.clearSelection && rr(/* @__PURE__ */ new Set());
3655
3657
  const h = g === 1 ? t.noun : `${t.noun}s`;
3656
- b.length ? qe.error(
3658
+ b.length ? Se.error(
3657
3659
  `Applied to ${g} ${h} — ${b.length} failed: ${b.slice(0, 3).join("; ")}`
3658
- ) : qe.success(`Applied to ${g} ${h}`);
3660
+ ) : Se.success(`Applied to ${g} ${h}`);
3659
3661
  };
3660
3662
  if ((O || K) && k) {
3661
3663
  let g = 0;
@@ -3843,7 +3845,7 @@ function Md({
3843
3845
  return t.length > 0 && (() => {
3844
3846
  const r = Fn(e.draft, { rowKey: e.rowId ?? "__new__" });
3845
3847
  return /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-stretch gap-x-6 gap-y-2 rounded-md bg-slate-50/80 px-3 py-2 dark:bg-muted/40", children: t.map((i) => {
3846
- const o = i.label || $e(i.field), c = i.computed_type === "write" && !!i.computed_formula, u = i.options ? typeof i.options == "string" ? (() => {
3848
+ const o = i.label || qe(i.field), c = i.computed_type === "write" && !!i.computed_formula, u = i.options ? typeof i.options == "string" ? (() => {
3847
3849
  try {
3848
3850
  return JSON.parse(i.options);
3849
3851
  } catch {
@@ -3874,7 +3876,7 @@ function Md({
3874
3876
  style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
3875
3877
  children: Re.filter((t) => !Vn(t)).map((t) => {
3876
3878
  var u, d, l;
3877
- const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || $e(t.field), o = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
3879
+ const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || qe(t.field), o = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
3878
3880
  if (st(t))
3879
3881
  return /* @__PURE__ */ _("div", { className: "flex min-w-0 flex-col gap-1", children: [
3880
3882
  /* @__PURE__ */ s("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: i }),
@@ -3912,7 +3914,7 @@ function Md({
3912
3914
  return ((R = Ne.find((I) => I.field === x)) == null ? void 0 : R.label) ?? x.replace(/_/g, " ");
3913
3915
  };
3914
3916
  return /* @__PURE__ */ s(
3915
- zl,
3917
+ Ql,
3916
3918
  {
3917
3919
  kind: m,
3918
3920
  provenance: (w = p == null ? void 0 : p.provenance) == null ? void 0 : w[t.field],
@@ -3987,7 +3989,7 @@ function Md({
3987
3989
  }
3988
3990
  ),
3989
3991
  b && !j && /* @__PURE__ */ s(
3990
- El,
3992
+ Ol,
3991
3993
  {
3992
3994
  data: q,
3993
3995
  rowKey: e.draft[q.key_field],
@@ -4011,7 +4013,7 @@ function Md({
4011
4013
  }
4012
4014
  ),
4013
4015
  be && ((n = be.fields) == null ? void 0 : n.length) > 0 && !j && /* @__PURE__ */ s(
4014
- Cl,
4016
+ ed,
4015
4017
  {
4016
4018
  config: be,
4017
4019
  draft: e.draft,
@@ -4038,7 +4040,7 @@ function Md({
4038
4040
  })()
4039
4041
  }
4040
4042
  ),
4041
- ae && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ s(Ul, { config: ae, result: It.byRow.get(e.rowId) }),
4043
+ ae && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ s(Jl, { config: ae, result: It.byRow.get(e.rowId) }),
4042
4044
  e.drawer
4043
4045
  ]
4044
4046
  }
@@ -4181,7 +4183,7 @@ function Md({
4181
4183
  );
4182
4184
  })(),
4183
4185
  He && (!O || k) && /* @__PURE__ */ s(
4184
- Gl,
4186
+ Xl,
4185
4187
  {
4186
4188
  config: He,
4187
4189
  relatedCollection: a,
@@ -4208,7 +4210,7 @@ function Md({
4208
4210
  (n) => typeof n == "object" && n.field === nt.relation && !!n.match
4209
4211
  );
4210
4212
  return e != null && e.match ? /* @__PURE__ */ s(
4211
- Zl,
4213
+ Cl,
4212
4214
  {
4213
4215
  config: nt,
4214
4216
  matchCfg: e.match,
@@ -4221,7 +4223,7 @@ function Md({
4221
4223
  ) : null;
4222
4224
  })(),
4223
4225
  (Qe ?? []).map((e) => /* @__PURE__ */ s(
4224
- Xl,
4226
+ Zl,
4225
4227
  {
4226
4228
  config: e,
4227
4229
  rows: [...$, ...M.map((n, t) => ({ ...n, __pendingIndex: t }))],
@@ -4246,7 +4248,7 @@ function Md({
4246
4248
  e.label
4247
4249
  )),
4248
4250
  Pt && !O && !j && Wt && E && /* @__PURE__ */ s(
4249
- gl,
4251
+ hl,
4250
4252
  {
4251
4253
  collection: E,
4252
4254
  templateFilter: (e) => {
@@ -4309,11 +4311,11 @@ function Md({
4309
4311
  }
4310
4312
  ),
4311
4313
  be && ((yo = be.fields) == null ? void 0 : yo.length) > 0 && be.across_rows !== !1 && $.length + M.length > 1 && /* @__PURE__ */ s(
4312
- ed,
4314
+ td,
4313
4315
  {
4314
4316
  config: be,
4315
4317
  remaining: pt(be.remaining, Vt),
4316
- rowNoun: q ? $e(q.key_field).toLowerCase() : "row",
4318
+ rowNoun: q ? qe(q.key_field).toLowerCase() : "row",
4317
4319
  onApply: fa
4318
4320
  }
4319
4321
  ),
@@ -4435,7 +4437,7 @@ function Md({
4435
4437
  ] }),
4436
4438
  /* @__PURE__ */ _("div", { className: "flex flex-wrap gap-2 items-end", children: [
4437
4439
  fi.map((e) => /* @__PURE__ */ _("div", { className: "min-w-[160px]", children: [
4438
- /* @__PURE__ */ s("p", { className: "text-[10px] text-slate-500 mb-0.5 dark:text-slate-400", children: e.label ?? $e(e.field) }),
4440
+ /* @__PURE__ */ s("p", { className: "text-[10px] text-slate-500 mb-0.5 dark:text-slate-400", children: e.label ?? qe(e.field) }),
4439
4441
  /* @__PURE__ */ s(
4440
4442
  yn,
4441
4443
  {
@@ -4540,7 +4542,7 @@ function Md({
4540
4542
  Object.entries(Lt.fields).map(([e, n]) => {
4541
4543
  const t = ke.find((r) => r.field === e);
4542
4544
  return /* @__PURE__ */ _("li", { children: [
4543
- /* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: (t == null ? void 0 : t.label) || $e(e) }),
4545
+ /* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: (t == null ? void 0 : t.label) || qe(e) }),
4544
4546
  " ",
4545
4547
  "on ",
4546
4548
  n,
@@ -4647,7 +4649,7 @@ function Md({
4647
4649
  /* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
4648
4650
  ] }),
4649
4651
  !j && bs.length > 0 && /* @__PURE__ */ s(
4650
- Nl,
4652
+ Sl,
4651
4653
  {
4652
4654
  proposals: bs,
4653
4655
  onApply: ua,
@@ -4655,9 +4657,9 @@ function Md({
4655
4657
  }
4656
4658
  ),
4657
4659
  (ti && ti.length > 0 || Pe && !O && (q || ps || gs)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
4658
- /* @__PURE__ */ s(Sl, { data: q, loading: ps, error: gs }),
4660
+ /* @__PURE__ */ s($l, { data: q, loading: ps, error: gs }),
4659
4661
  (ti ?? []).map((e) => /* @__PURE__ */ s(
4660
- $l,
4662
+ ql,
4661
4663
  {
4662
4664
  label: e.label,
4663
4665
  value: e.result,
@@ -4702,7 +4704,7 @@ function Md({
4702
4704
  "th",
4703
4705
  {
4704
4706
  className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]",
4705
- children: e.label ?? $e(e.field)
4707
+ children: e.label ?? qe(e.field)
4706
4708
  },
4707
4709
  e.field
4708
4710
  )),
@@ -4948,7 +4950,7 @@ function Md({
4948
4950
  const I = x.computed_type === "write" && !!x.computed_formula, B = I ? Rt(
4949
4951
  x.computed_formula,
4950
4952
  u ? (p == null ? void 0 : p.draft) ?? h : h
4951
- ) ?? h[x.field] : null, F = W && !u && !b ? (Y = Br[t]) == null ? void 0 : Y[x.field] : void 0, Me = F ? `${x.label || $e(x.field)} · changed ${ko(F.at)} by ${F.who}${F.reason ? `
4953
+ ) ?? h[x.field] : null, F = W && !u && !b ? (Y = Br[t]) == null ? void 0 : Y[x.field] : void 0, Me = F ? `${x.label || qe(x.field)} · changed ${ko(F.at)} by ${F.who}${F.reason ? `
4952
4954
  Reason: “${F.reason}”` : ""}` : void 0;
4953
4955
  return /* @__PURE__ */ _(
4954
4956
  "td",
@@ -4985,7 +4987,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
4985
4987
  "button",
4986
4988
  {
4987
4989
  type: "button",
4988
- "aria-label": `History of ${x.label || $e(x.field)}`,
4990
+ "aria-label": `History of ${x.label || qe(x.field)}`,
4989
4991
  onClick: (ee) => {
4990
4992
  ee.stopPropagation(), Jr(F.revision_id), kn(e);
4991
4993
  },
@@ -5111,7 +5113,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5111
5113
  }
5112
5114
  ),
5113
5115
  ne && t != null && /* @__PURE__ */ s(
5114
- Rl,
5116
+ Pl,
5115
5117
  {
5116
5118
  collection: a,
5117
5119
  rowId: String(t),
@@ -5131,11 +5133,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
5131
5133
  }
5132
5134
  ),
5133
5135
  t != null && !String(t).startsWith("pending") && /* @__PURE__ */ s(
5134
- Jl,
5136
+ zl,
5135
5137
  {
5136
5138
  collection: a,
5137
5139
  rowId: String(t),
5138
- rowLabel: Hl(e)
5140
+ rowLabel: Yl(e)
5139
5141
  }
5140
5142
  ),
5141
5143
  !j && /* @__PURE__ */ s(
@@ -5447,7 +5449,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5447
5449
  "data-tip": `${q.label} recorded for ${String(t.key)} with no ${se ? se.toLowerCase() : "row"} to compare against — add a row for ${String(t.key)} to plan against it`,
5448
5450
  children: [
5449
5451
  "No plan for this ",
5450
- $e(q.key_field).toLowerCase()
5452
+ qe(q.key_field).toLowerCase()
5451
5453
  ]
5452
5454
  }
5453
5455
  )
@@ -5598,7 +5600,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5598
5600
  "px-2 py-1 align-top",
5599
5601
  x && !r && "[&>div]:underline [&>div]:decoration-dotted [&>div]:decoration-amber-400 [&>div]:underline-offset-2"
5600
5602
  ),
5601
- "data-tip": x && !r ? `${l.label || $e(l.field)} · set by an auto-fill rule, not the file` : void 0,
5603
+ "data-tip": x && !r ? `${l.label || qe(l.field)} · set by an auto-fill rule, not the file` : void 0,
5602
5604
  children: [
5603
5605
  m ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(l, y) }) : g && i && h ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
5604
5606
  ji,
@@ -5762,7 +5764,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5762
5764
  } catch {
5763
5765
  return {};
5764
5766
  }
5765
- })() : t.options : {}, i = r.aggregate, o = ql(q, t.field), c = o != null ? /* @__PURE__ */ _(
5767
+ })() : t.options : {}, i = r.aggregate, o = El(q, t.field), c = o != null ? /* @__PURE__ */ _(
5766
5768
  "div",
5767
5769
  {
5768
5770
  "data-compare-footer": t.field,
@@ -5924,7 +5926,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
5924
5926
  );
5925
5927
  })(),
5926
5928
  /* @__PURE__ */ s(
5927
- Ol,
5929
+ Il,
5928
5930
  {
5929
5931
  open: Do,
5930
5932
  onOpenChange: Ui,
@@ -6029,7 +6031,7 @@ function Ro(a) {
6029
6031
  f
6030
6032
  )) });
6031
6033
  }
6032
- function Cl({
6034
+ function ed({
6033
6035
  config: a,
6034
6036
  draft: f,
6035
6037
  remaining: v,
@@ -6089,7 +6091,7 @@ function Cl({
6089
6091
  Ee && /* @__PURE__ */ s("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: Ee })
6090
6092
  ] });
6091
6093
  }
6092
- function ed(a) {
6094
+ function td(a) {
6093
6095
  const [f, v] = U(!1), [E, z] = U("even"), W = a.remaining == null || !Number.isFinite(a.remaining) ? 0 : Math.round(a.remaining * 100) / 100, ne = (J) => a.config.format === "number" ? J.toLocaleString(void 0, { maximumFractionDigits: 2 }) : J.toLocaleString(void 0, { style: "currency", currency: "USD" });
6094
6096
  if (W <= 0) return null;
6095
6097
  const oe = (a.config.presets ?? ["even", "front", "back"]).filter(
@@ -6169,7 +6171,7 @@ function Ao(a) {
6169
6171
  return ((v = f == null ? void 0 : f.response) == null ? void 0 : v.error) ?? ((E = f == null ? void 0 : f.response) == null ? void 0 : E.message) ?? (f == null ? void 0 : f.message) ?? "the server refused it";
6170
6172
  }
6171
6173
  export {
6172
- Md as InlineTableField,
6174
+ Rd as InlineTableField,
6173
6175
  Rt as evalClientFormula,
6174
6176
  Ti as failingLints,
6175
6177
  Ko as spreadAmounts