@nivaro/react 0.3.64 → 0.3.66

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 (74) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +62 -8
  4. package/dist/shared/components/CollectionBrowserView.js +3127 -3204
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4842 -4500
  8. package/dist/shared/components/MyWorkView.js +124 -113
  9. package/dist/shared/components/PageRenderer.js +146 -138
  10. package/dist/shared/components/ProfileView.js +483 -472
  11. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  12. package/dist/shared/components/ReportView.js +1100 -1094
  13. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  14. package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
  15. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  16. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  17. package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
  18. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  20. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  21. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  22. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  23. package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
  24. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  25. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  26. package/dist/shared/components/item-edit/GroupSection.js +555 -538
  27. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  28. package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
  29. package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
  30. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  31. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  33. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  34. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  35. package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
  36. package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
  37. package/dist/shared/components/item-edit/UserChip.js +264 -229
  38. package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
  39. package/dist/shared/components/item-edit/collision-format.js +37 -0
  40. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  41. package/dist/shared/components/item-edit/header-path-preview.js +52 -0
  42. package/dist/shared/components/item-edit/line-merge.js +84 -0
  43. package/dist/shared/components/item-edit/line-midair.js +94 -87
  44. package/dist/shared/components/item-edit/move-guard.js +17 -0
  45. package/dist/shared/components/item-edit/picker-search.js +27 -16
  46. package/dist/shared/components/item-edit/rail-width.js +8 -0
  47. package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
  48. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  49. package/dist/shared/components/panels/CommentPanel.js +142 -136
  50. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  51. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  52. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  53. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  54. package/dist/shared/components/panels/SlaClock.js +90 -68
  55. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  56. package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
  57. package/dist/shared/components/queue/worklist-csv.js +75 -0
  58. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  59. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  60. package/dist/shared/lib/bulk-copy.js +17 -0
  61. package/dist/shared/lib/cbv-export.js +122 -0
  62. package/dist/shared/lib/delete-offer.js +13 -0
  63. package/dist/shared/lib/error-hints.js +1 -0
  64. package/dist/shared/lib/leave-guard.js +41 -26
  65. package/dist/shared/lib/list-link.js +72 -56
  66. package/dist/shared/lib/live-queries.js +32 -30
  67. package/dist/shared/lib/moved-notice.js +25 -0
  68. package/dist/shared/lib/notification-target.js +56 -54
  69. package/dist/shared/lib/obligation-banner.js +11 -8
  70. package/dist/shared/lib/obligation-reason-text.js +6 -6
  71. package/dist/shared/lib/quick-filter-cascade.js +29 -19
  72. package/dist/shared/lib/sort-cycle.js +6 -0
  73. package/dist/shared/lib/summary-mode.js +59 -41
  74. package/package.json +1 -1
@@ -1,87 +1,105 @@
1
- import { jsxs as u, jsx as s, Fragment as ve } from "react/jsx-runtime";
2
- import { useQueryClient as In, useQuery as K, useQueries as lr } from "@tanstack/react-query";
3
- import { Search as Rt, Loader2 as ce, PackageCheck as zn, ChevronRight as or, Star as it, AlertTriangle as De, AlertCircle as ar, X as Pt, Plus as Qn, ChevronDown as Bn } from "lucide-react";
4
- import { useState as H, useRef as Ee, useMemo as F, useEffect as Te, Fragment as at } from "react";
5
- import { createPortal as Vn } from "react-dom";
6
- import { useNivaroClient as Lt, useParentDraft as Wn, useReimportHandler as Dn, useItemEditAuth as Ur } from "../../context.js";
7
- import { canOpenCatalogItem as en, openCatalogItem as tn } from "../../lib/catalog-item-open.js";
8
- import { get as R, del as Mn, patch as Hr, post as Yr } from "../../lib/commands.js";
9
- import { evaluateBoolean as Un } from "../../lib/expression.js";
10
- import { useLiveRefetchInterval as Hn } from "../../lib/live-queries.js";
11
- import { tokenize as Yn, matchesSearch as Zn } from "../../lib/search-text.js";
12
- import { submissionLineErrors as Gn, normalizeIdent as Xn } from "../../lib/submission-errors.js";
13
- import { titleCase as M, cn as C, matchesAllTokens as es } from "../../lib/utils.js";
14
- import { ImportFromFileButton as ts } from "../import/ImportFromFileButton.js";
15
- import { SearchHighlight as dr } from "../SearchHighlight.js";
16
- import { useOverflowTip as rs } from "../TipLayer.js";
17
- import { useColumnWidths as Zr, ResetColumnsButton as ir, ColResizeHandle as ns, fitWidth as ss } from "./catalog-columns.js";
18
- import { orderCatalogMatches as as, rowMatchesFields as is } from "./catalog-search.js";
1
+ import { jsxs as u, jsx as a, Fragment as _e } from "react/jsx-runtime";
2
+ import { useQueryClient as Br, useQuery as C, useQueries as un } from "@tanstack/react-query";
3
+ import { Search as Et, Loader2 as ce, PackageCheck as Dr, ChevronRight as mn, Star as dt, AlertTriangle as Be, AlertCircle as dn, X as Lt, Plus as Hr, ChevronDown as Yr } from "lucide-react";
4
+ import { useState as Y, useRef as pe, useMemo as F, useEffect as xe, Fragment as ot } from "react";
5
+ import { createPortal as Zr } from "react-dom";
6
+ import { useNivaroClient as Kt, useParentDraft as Gr, useReimportHandler as Xr, useItemEditAuth as nr } from "../../context.js";
7
+ import { canOpenCatalogItem as or, openCatalogItem as dr } from "../../lib/catalog-item-open.js";
8
+ import { get as R, del as es, patch as rr, post as sr } from "../../lib/commands.js";
9
+ import { evaluateBoolean as ts } from "../../lib/expression.js";
10
+ import { useLiveRefetchInterval as ns } from "../../lib/live-queries.js";
11
+ import { tokenize as rs, matchesSearch as ss } from "../../lib/search-text.js";
12
+ import { registerStagedRowLabel as as } from "../../lib/staged-row-labels.js";
13
+ import { submissionLineErrors as is, normalizeIdent as ls } from "../../lib/submission-errors.js";
14
+ import { titleCase as D, cn as I, matchesAllTokens as os } from "../../lib/utils.js";
15
+ import { ImportFromFileButton as ds } from "../import/ImportFromFileButton.js";
16
+ import { SearchHighlight as fn } from "../SearchHighlight.js";
17
+ import { useOverflowTip as cs } from "../TipLayer.js";
18
+ import { useColumnWidths as ar, ResetColumnsButton as cn, ColResizeHandle as us, fitWidth as ms } from "./catalog-columns.js";
19
+ import { orderCatalogMatches as fs, rowMatchesFields as hs } from "./catalog-search.js";
19
20
  import { applyDisplayTemplate as ze } from "./helpers.js";
20
- import { evalClientFormula as Le } from "./InlineTableField.js";
21
- import { isIntegerFieldType as Ot, checkNumberEntry as cr, mergePendingQtyRow as ls, decimalPlacesProblem as os, lineRuleErrors as ds, MAX_LINE_MONEY as cs } from "./line-qty.js";
22
- import { resolveM2MRelatedCollection as us } from "./M2MCombobox.js";
23
- import { useO2MStaging as ms } from "./O2MStagingContext.js";
24
- import { RelationCombobox as fs, RelatedItemLabel as hs } from "./RelationCombobox.js";
25
- const rn = (d, h) => {
26
- let y = d;
27
- for (const N of h.split(".")) {
28
- if (y == null || typeof y != "object") return;
29
- y = y[N];
21
+ import { evalClientFormula as Pe } from "./InlineTableField.js";
22
+ import { isIntegerFieldType as Pt, checkNumberEntry as hn, mergePendingQtyRow as bs, decimalPlacesProblem as ps, lineRuleErrors as xs, MAX_LINE_MONEY as ys } from "./line-qty.js";
23
+ import { resolveM2MRelatedCollection as gs } from "./M2MCombobox.js";
24
+ import { useO2MStaging as ks } from "./O2MStagingContext.js";
25
+ import { RelationCombobox as ws, RelatedItemLabel as Ns } from "./RelationCombobox.js";
26
+ const cr = (i, m) => {
27
+ let b = i;
28
+ for (const x of m.split(".")) {
29
+ if (b == null || typeof b != "object") return;
30
+ b = b[x];
30
31
  }
31
- return y;
32
+ return b;
32
33
  };
33
- async function Et(d, h, y) {
34
- const N = [];
35
- for (let a = 1; a <= 50; a++) {
36
- const b = await d.request(R(h, { ...y, limit: 1e3, page: a })).then((k) => k.data ?? []);
37
- if (N.push(...b), b.length < 1e3) break;
34
+ async function At(i, m, b) {
35
+ const x = [];
36
+ for (let _ = 1; _ <= 50; _++) {
37
+ const s = await i.request(R(m, { ...b, limit: 1e3, page: _ })).then((w) => w.data ?? []);
38
+ if (x.push(...s), s.length < 1e3) break;
38
39
  }
39
- return N;
40
+ return x;
40
41
  }
41
- function Me(d, h) {
42
- const y = {};
43
- let N = !1;
44
- const a = (b) => {
45
- if (typeof b == "string" && b.startsWith("$parent.")) {
46
- const k = h == null ? void 0 : h[b.slice(8)];
47
- return k == null || k === "" ? (N = !0, b) : k;
42
+ function vs(i, m, b, x) {
43
+ const _ = {}, s = { ...x ?? {} };
44
+ for (const w of m) {
45
+ const k = i[w], j = k == null || k === "", v = !j && (x == null ? void 0 : x[w]) !== void 0 && x[w] === String(k);
46
+ if (!j && !v) continue;
47
+ const O = b(w);
48
+ O == null || O === "" || !j && String(O) === String(k) || (_[w] = O, s[w] = String(O));
49
+ }
50
+ return Object.keys(_).length > 0 ? { updates: _, auto: s } : null;
51
+ }
52
+ function bn(i, m = /* @__PURE__ */ new Set()) {
53
+ if (typeof i == "string" && i.startsWith("$parent.")) m.add(i.slice(8));
54
+ else if (Array.isArray(i)) for (const b of i) bn(b, m);
55
+ else if (i && typeof i == "object")
56
+ for (const b of Object.values(i)) bn(b, m);
57
+ return m;
58
+ }
59
+ function De(i, m) {
60
+ const b = {};
61
+ let x = !1;
62
+ const _ = (s) => {
63
+ if (typeof s == "string" && s.startsWith("$parent.")) {
64
+ const w = m == null ? void 0 : m[s.slice(8)];
65
+ return w == null || w === "" ? (x = !0, s) : w;
48
66
  }
49
- return Array.isArray(b) ? b.map(a) : b && typeof b == "object" ? Object.fromEntries(Object.entries(b).map(([k, j]) => [k, a(j)])) : b;
67
+ return Array.isArray(s) ? s.map(_) : s && typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([w, k]) => [w, _(k)])) : s;
50
68
  };
51
- for (const [b, k] of Object.entries(d ?? {}))
52
- if (typeof k == "string" && k.startsWith("$parent.")) {
53
- const j = h == null ? void 0 : h[k.slice(8)];
54
- if (j == null || j === "") {
55
- N = !0;
69
+ for (const [s, w] of Object.entries(i ?? {}))
70
+ if (typeof w == "string" && w.startsWith("$parent.")) {
71
+ const k = m == null ? void 0 : m[w.slice(8)];
72
+ if (k == null || k === "") {
73
+ x = !0;
56
74
  continue;
57
75
  }
58
- y[b] = { _eq: j };
59
- } else k && typeof k == "object" ? y[b] = a(k) : y[b] = { _eq: k };
60
- return N ? null : y;
76
+ b[s] = { _eq: k };
77
+ } else w && typeof w == "object" ? b[s] = _(w) : b[s] = { _eq: w };
78
+ return x ? null : b;
61
79
  }
62
- function Gr(d, h) {
63
- if (!d) return !0;
64
- for (const [y, N] of Object.entries(d)) {
65
- const a = h == null ? void 0 : h[y], b = a == null ? null : String(a), k = N && typeof N == "object" ? N : { _eq: N };
66
- for (const [j, w] of Object.entries(k))
67
- switch (j) {
80
+ function ir(i, m) {
81
+ if (!i) return !0;
82
+ for (const [b, x] of Object.entries(i)) {
83
+ const _ = m == null ? void 0 : m[b], s = _ == null ? null : String(_), w = x && typeof x == "object" ? x : { _eq: x };
84
+ for (const [k, j] of Object.entries(w))
85
+ switch (k) {
68
86
  case "_eq":
69
- if (b !== String(w)) return !1;
87
+ if (s !== String(j)) return !1;
70
88
  break;
71
89
  case "_neq":
72
- if (b === String(w)) return !1;
90
+ if (s === String(j)) return !1;
73
91
  break;
74
92
  case "_in":
75
- if (!Array.isArray(w) || !w.map(String).includes(b ?? "")) return !1;
93
+ if (!Array.isArray(j) || !j.map(String).includes(s ?? "")) return !1;
76
94
  break;
77
95
  case "_nin":
78
- if (Array.isArray(w) && w.map(String).includes(b ?? "")) return !1;
96
+ if (Array.isArray(j) && j.map(String).includes(s ?? "")) return !1;
79
97
  break;
80
98
  case "_null":
81
- if (b !== null) return !1;
99
+ if (s !== null) return !1;
82
100
  break;
83
101
  case "_nnull":
84
- if (b === null) return !1;
102
+ if (s === null) return !1;
85
103
  break;
86
104
  default:
87
105
  return !1;
@@ -89,78 +107,80 @@ function Gr(d, h) {
89
107
  }
90
108
  return !0;
91
109
  }
92
- const bs = 2e3;
93
- function ps(d, h) {
94
- const y = Number(d);
95
- if (Ot(h) && d.trim() !== "" && !Number.isNaN(y) && !Number.isInteger(y))
110
+ const Ss = 2e3;
111
+ function _s(i, m) {
112
+ if (/e/i.test(i.trim())) return "Type the quantity in full digits";
113
+ const b = Number(i);
114
+ if (Pt(m) && i.trim() !== "" && !Number.isNaN(b) && !Number.isInteger(b))
96
115
  return "Whole numbers only";
97
- const N = cr(d, { type: h, min: 0, label: "Quantity" });
98
- return N.ok ? null : N.message;
116
+ const x = hn(i, { type: m, min: 0, label: "Quantity" });
117
+ return x.ok ? null : x.message;
99
118
  }
100
- function xs(d, h, y) {
101
- const N = d.reduce((a, b) => {
102
- const k = b[h], j = k != null && k !== "" ? k : y != null && y[h] ? Le(y[h], b) : null, w = Number(j);
103
- return a + (j != null && Number.isFinite(w) ? w : 0);
119
+ function qs(i, m, b) {
120
+ const x = i.reduce((_, s) => {
121
+ const w = s[m], k = w != null && w !== "" ? w : b != null && b[m] ? Pe(b[m], s) : null, j = Number(k);
122
+ return _ + (k != null && Number.isFinite(j) ? j : 0);
104
123
  }, 0);
105
- return Math.round(N * 1e6) / 1e6;
124
+ return Math.round(x * 1e6) / 1e6;
106
125
  }
107
- function ys(d, h) {
108
- const y = h.trim();
109
- return y ? `${d} — ${y} not used` : d;
126
+ function $s(i, m) {
127
+ const b = m.trim();
128
+ return b ? `${i} — ${b} not used` : i;
110
129
  }
111
- function gs(d) {
112
- const h = { ...d.probe };
113
- for (const [y, N] of Object.entries(d.compute)) {
114
- const a = Le(N, h);
115
- if (a === null) continue;
116
- h[y] = a;
117
- const b = d.ruleError(y, a, h);
118
- if (b) return b;
119
- if (Math.abs(a) > cs)
120
- return `${d.labelOf(y)} would be ${a.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
130
+ function js(i) {
131
+ const m = { ...i.probe };
132
+ for (const [b, x] of Object.entries(i.compute)) {
133
+ const _ = Pe(x, m);
134
+ if (_ === null) continue;
135
+ m[b] = _;
136
+ const s = i.ruleError(b, _, m);
137
+ if (s) return s;
138
+ if (Math.abs(_) > ys)
139
+ return `${i.labelOf(b)} would be ${_.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
121
140
  }
122
141
  return null;
123
142
  }
124
- function ks(d) {
125
- const h = Object.entries(d.copyFields ?? {}).filter(([, y]) => y === d.field).map(([y]) => y);
126
- for (const y of h)
127
- for (const N of d.related ?? []) {
128
- if (N.copy_to !== y) continue;
129
- const a = d.lookup(N.key);
130
- if (a != null && a !== "") return a;
143
+ function Fs(i) {
144
+ const m = Object.entries(i.copyFields ?? {}).filter(([, b]) => b === i.field).map(([b]) => b);
145
+ for (const b of m)
146
+ for (const x of i.related ?? []) {
147
+ if (x.copy_to !== b) continue;
148
+ const _ = i.lookup(x.key);
149
+ if (_ != null && _ !== "") return _;
131
150
  }
132
- return d.catalogValue;
151
+ return i.catalogValue;
133
152
  }
134
- function ws(d, h) {
135
- return d.map((y) => [y.id, ...h.map((N) => y[N])].map((N) => String(N ?? "")).join("")).join("");
153
+ function Os(i, m) {
154
+ return i.map((b) => [b.id, ...m.map((x) => b[x])].map((x) => String(x ?? "")).join("")).join("");
136
155
  }
137
- function Ns(d) {
138
- const h = Object.keys(d).filter((N) => d[N].kind === "error");
139
- if (h.length === 0) return d;
140
- const y = { ...d };
141
- for (const N of h) delete y[N];
142
- return y;
156
+ function Ts(i) {
157
+ const m = Object.keys(i).filter((x) => i[x].kind === "error");
158
+ if (m.length === 0) return i;
159
+ const b = { ...i };
160
+ for (const x of m) delete b[x];
161
+ return b;
143
162
  }
144
- function vs(d, h, y) {
145
- const N = Number(d[h]);
146
- if (!Number.isFinite(N) || N <= 0) return !1;
147
- const a = y.find((k) => k in d);
148
- if (!a) return !1;
149
- const b = d[a];
150
- return b == null || b === "" || Number(b) === 0;
163
+ function Rs(i, m, b) {
164
+ const x = Number(i[m]);
165
+ if (!Number.isFinite(x) || x <= 0) return !1;
166
+ const _ = b.find((w) => w in i);
167
+ if (!_) return !1;
168
+ const s = i[_];
169
+ return s == null || s === "" || Number(s) === 0;
151
170
  }
152
- function Gs({
153
- relatedCollection: d,
154
- manyField: h,
155
- parentId: y,
156
- parentCollection: N,
157
- config: a,
158
- readOnly: b = !1
171
+ function da({
172
+ relatedCollection: i,
173
+ manyField: m,
174
+ parentId: b,
175
+ parentCollection: x,
176
+ field: _,
177
+ config: s,
178
+ readOnly: w = !1
159
179
  }) {
160
- var Cr, Jr, Ir, zr, Qr, Br, Vr, Wr;
161
- const k = Lt(), j = In(), w = ms(), P = Wn(), ee = Dn(), Y = a.editable_fields ?? [], _e = a.catalog_locked_fields ?? [], { isAdmin: Z } = Ur(), z = y === "new", ne = N && !z ? `?parent_collection=${encodeURIComponent(N)}&parent_id=${encodeURIComponent(y)}` : "", G = a.qty_field ?? "quantity", [se, xe] = H(/* @__PURE__ */ new Set()), Oe = Ee(!1), [U, Ae] = H(""), [ye, ue] = H({}), [ie, ae] = H(/* @__PURE__ */ new Set()), [Q, X] = H({}), [Se, me] = H({}), { data: Ke = [], isPending: q } = K({
162
- queryKey: ["collection-relations", d],
163
- queryFn: () => k.request(R(`/collections/${d}`)).then((e) => {
180
+ var Mn, Bn, Dn, Hn, Yn, Zn, Gn, Xn;
181
+ const k = Kt(), j = Br(), v = ks(), O = Gr(), ye = Xr(), Z = s.editable_fields ?? [], G = s.catalog_locked_fields ?? [], { isAdmin: Ae } = nr(), P = b === "new", qe = x && !P ? `?parent_collection=${encodeURIComponent(x)}&parent_id=${encodeURIComponent(b)}` : "", J = s.qty_field ?? "quantity", [fe, $e] = Y(/* @__PURE__ */ new Set()), je = pe(!1), [X, ge] = Y(""), [ke, le] = Y({}), [ie, V] = Y(/* @__PURE__ */ new Set()), [oe, de] = Y({}), [he, Ee] = Y({}), { data: $ = [], isPending: W } = C({
182
+ queryKey: ["collection-relations", i],
183
+ queryFn: () => k.request(R(`/collections/${i}`)).then((e) => {
164
184
  var t;
165
185
  return ((t = e.data) == null ? void 0 : t.relations) ?? [];
166
186
  }),
@@ -168,128 +188,128 @@ function Gs({
168
188
  }), g = F(
169
189
  () => {
170
190
  var e;
171
- return ((e = Ke.find(
172
- (t) => t.many_collection === d && t.many_field === a.item_field && !t.junction_field
191
+ return ((e = $.find(
192
+ (t) => t.many_collection === i && t.many_field === s.item_field && !t.junction_field
173
193
  )) == null ? void 0 : e.one_collection) ?? null;
174
194
  },
175
- [Ke, d, a.item_field]
176
- ), { data: L = [] } = K({
177
- queryKey: ["field-config", d, null],
178
- queryFn: () => k.request(R(`/field-config/${d}`)).then((e) => e.data ?? []),
195
+ [$, i, s.item_field]
196
+ ), { data: te = [] } = C({
197
+ queryKey: ["field-config", i, null],
198
+ queryFn: () => k.request(R(`/field-config/${i}`)).then((e) => e.data ?? []),
179
199
  staleTime: 6e4
180
- }), le = ((Cr = L.find((e) => e.field === G)) == null ? void 0 : Cr.type) ?? null, B = (e, t, r) => {
181
- var n;
182
- return ((n = ds(
183
- L.filter((l) => l.field === e).map((l) => ({
200
+ }), U = ((Mn = te.find((e) => e.field === J)) == null ? void 0 : Mn.type) ?? null, M = (e, t, n) => {
201
+ var r;
202
+ return ((r = xs(
203
+ te.filter((l) => l.field === e).map((l) => ({
184
204
  field: l.field,
185
- label: l.label || M(l.field),
205
+ label: l.label || D(l.field),
186
206
  type: l.type,
187
207
  validation_rules: l.validation_rules
188
208
  })),
189
209
  { [e]: t },
190
- { ...r, [e]: t }
191
- )[0]) == null ? void 0 : n.message) ?? null;
192
- }, { data: $ } = K({
210
+ { ...n, [e]: t }
211
+ )[0]) == null ? void 0 : r.message) ?? null;
212
+ }, { data: T } = C({
193
213
  queryKey: ["col-meta", g],
194
214
  queryFn: () => k.request(R(`/collections/${g}`)).then((e) => e.data),
195
215
  enabled: !!g,
196
216
  staleTime: 3e5
197
- }), J = $ == null ? void 0 : $.display_template, E = F(() => {
198
- const e = a.section_by.split(".")[0];
199
- return (($ == null ? void 0 : $.relations) ?? []).find(
217
+ }), z = T == null ? void 0 : T.display_template, L = F(() => {
218
+ const e = s.section_by.split(".")[0];
219
+ return ((T == null ? void 0 : T.relations) ?? []).find(
200
220
  (t) => t.one_collection === g && t.one_field === e && !!t.junction_field
201
221
  ) ?? null;
202
- }, [$, g, a.section_by]), oe = (E == null ? void 0 : E.many_collection) ?? null, { data: lt = [] } = K({
203
- queryKey: ["collection-relations", oe],
204
- queryFn: () => k.request(R(`/collections/${oe}`)).then((e) => {
222
+ }, [T, g, s.section_by]), Fe = (L == null ? void 0 : L.many_collection) ?? null, { data: He = [] } = C({
223
+ queryKey: ["collection-relations", Fe],
224
+ queryFn: () => k.request(R(`/collections/${Fe}`)).then((e) => {
205
225
  var t;
206
226
  return ((t = e.data) == null ? void 0 : t.relations) ?? [];
207
227
  }),
208
- enabled: !!oe,
228
+ enabled: !!Fe,
209
229
  staleTime: 10 * 6e4
210
- }), V = F(() => {
211
- if (!(E != null && E.many_field) || !oe) return null;
212
- const e = String(E.junction_field), t = lt.find(
213
- (n) => n.many_collection === oe && n.many_field === e
214
- ), r = us(t);
215
- return r ? {
216
- junction: oe,
217
- fkToItem: E.many_field,
230
+ }), d = F(() => {
231
+ if (!(L != null && L.many_field) || !Fe) return null;
232
+ const e = String(L.junction_field), t = He.find(
233
+ (r) => r.many_collection === Fe && r.many_field === e
234
+ ), n = gs(t);
235
+ return n ? {
236
+ junction: Fe,
237
+ fkToItem: L.many_field,
218
238
  fkToSection: e,
219
- target: r,
220
- labelPath: a.section_by.split(".").slice(1).join(".") || "id"
239
+ target: n,
240
+ labelPath: s.section_by.split(".").slice(1).join(".") || "id"
221
241
  } : null;
222
- }, [E, oe, lt, a.section_by]), i = P == null ? void 0 : P.draft, { resolvedFilter: S, resolvedSectionFilter: I, resolvedLinkFilter: W, missingParents: D } = F(() => {
242
+ }, [L, Fe, He, s.section_by]), N = O == null ? void 0 : O.draft, { resolvedFilter: B, resolvedSectionFilter: ne, resolvedLinkFilter: Q, missingParents: ee } = F(() => {
223
243
  const e = [], t = (o) => {
224
244
  if (typeof o == "string" && o.startsWith("$parent.")) {
225
- const p = o.slice(8), c = i == null ? void 0 : i[p];
226
- return c == null || c === "" ? (e.push(p), o) : c;
245
+ const h = o.slice(8), c = N == null ? void 0 : N[h];
246
+ return c == null || c === "" ? (e.push(h), o) : c;
227
247
  }
228
- return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([p, c]) => [p, t(c)])) : o;
229
- }, r = a.filter ? t(a.filter) : void 0, n = a.section_filter ? t(a.section_filter) : void 0, l = a.link_filter ? t(a.link_filter) : void 0;
248
+ return Array.isArray(o) ? o.map(t) : o && typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([h, c]) => [h, t(c)])) : o;
249
+ }, n = s.filter ? t(s.filter) : void 0, r = s.section_filter ? t(s.section_filter) : void 0, l = s.link_filter ? t(s.link_filter) : void 0;
230
250
  return {
231
- resolvedFilter: r,
232
- resolvedSectionFilter: n,
251
+ resolvedFilter: n,
252
+ resolvedSectionFilter: r,
233
253
  resolvedLinkFilter: l,
234
254
  missingParents: [...new Set(e)]
235
255
  };
236
- }, [a.filter, a.section_filter, a.link_filter, i]), fe = F(() => {
237
- if (!E || !I && !W) return S;
256
+ }, [s.filter, s.section_filter, s.link_filter, N]), H = F(() => {
257
+ if (!L || !ne && !Q) return B;
238
258
  const e = {
239
- ...I ?? {},
240
- ...W ? { _link: W } : {}
241
- }, t = { [E.one_field]: { _some: e } };
242
- return S ? { _and: [S, t] } : t;
243
- }, [E, I, W, S]), T = F(() => {
259
+ ...ne ?? {},
260
+ ...Q ? { _link: Q } : {}
261
+ }, t = { [L.one_field]: { _some: e } };
262
+ return B ? { _and: [B, t] } : t;
263
+ }, [L, ne, Q, B]), A = F(() => {
244
264
  const e = /* @__PURE__ */ new Set(["id"]);
245
- $ && !E && e.add(a.section_by);
246
- for (const t of [...(J ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
247
- for (const t of Object.values(a.copy_fields ?? {})) e.add(t);
248
- for (const t of a.columns ?? []) e.add(t.field);
265
+ T && !L && e.add(s.section_by);
266
+ for (const t of [...(z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
267
+ for (const t of Object.values(s.copy_fields ?? {})) e.add(t);
268
+ for (const t of s.columns ?? []) e.add(t.field);
249
269
  return [...e].join(",");
250
- }, [J, $, E, a.section_by, a.copy_fields, a.columns]), be = JSON.stringify(fe ?? null), { data: de = [], isLoading: qe } = K(
270
+ }, [z, T, L, s.section_by, s.copy_fields, s.columns]), Ke = JSON.stringify(H ?? null), { data: re = [], isLoading: pn } = C(
251
271
  {
252
- queryKey: ["catalog-picker", g, T, be],
272
+ queryKey: ["catalog-picker", g, A, Ke],
253
273
  queryFn: () => k.request(
254
274
  R(`/items/${g}`, {
255
- limit: bs,
256
- fields: T,
257
- ...fe ? { filter: JSON.stringify(fe) } : {}
275
+ limit: Ss,
276
+ fields: A,
277
+ ...H ? { filter: JSON.stringify(H) } : {}
258
278
  })
259
279
  ).then((e) => e.data ?? []),
260
280
  // Wait for the catalog meta: a to-many section path both narrows this
261
281
  // read and must stay out of its `fields=`.
262
- enabled: !!g && !!$ && D.length === 0 && (!E || !!V),
282
+ enabled: !!g && !!T && ee.length === 0 && (!L || !!d),
263
283
  staleTime: 6e4
264
284
  }
265
- ), nn = JSON.stringify(I ?? null), { data: ot = [], isLoading: sn } = K({
266
- queryKey: ["catalog-sections", V == null ? void 0 : V.target, V == null ? void 0 : V.labelPath, nn],
285
+ ), ur = JSON.stringify(ne ?? null), { data: ct = [], isLoading: mr } = C({
286
+ queryKey: ["catalog-sections", d == null ? void 0 : d.target, d == null ? void 0 : d.labelPath, ur],
267
287
  queryFn: async () => {
268
- const e = V;
269
- return (await Et(k, `/items/${e.target}`, {
288
+ const e = d;
289
+ return (await At(k, `/items/${e.target}`, {
270
290
  fields: `id,${e.labelPath}`,
271
- ...I ? { filter: JSON.stringify(I) } : {}
272
- })).map((r) => ({
273
- id: String(r.id),
274
- name: String(rn(r, e.labelPath) ?? "").trim()
291
+ ...ne ? { filter: JSON.stringify(ne) } : {}
292
+ })).map((n) => ({
293
+ id: String(n.id),
294
+ name: String(cr(n, e.labelPath) ?? "").trim()
275
295
  }));
276
296
  },
277
- enabled: !!V && D.length === 0,
297
+ enabled: !!d && ee.length === 0,
278
298
  staleTime: 6e4
279
- }), Ue = F(() => ot.map((e) => e.id), [ot]), { data: ur = [], isLoading: an } = K({
299
+ }), Ye = F(() => ct.map((e) => e.id), [ct]), { data: xn = [], isLoading: fr } = C({
280
300
  queryKey: [
281
301
  "catalog-section-links",
282
- V == null ? void 0 : V.junction,
283
- Ue.join(","),
284
- JSON.stringify(W ?? null)
302
+ d == null ? void 0 : d.junction,
303
+ Ye.join(","),
304
+ JSON.stringify(Q ?? null)
285
305
  ],
286
306
  queryFn: async () => {
287
- const e = V, t = [];
288
- for (let r = 0; r < Ue.length; r += 200) {
289
- const n = Ue.slice(r, r + 200), l = await Et(k, `/items/${e.junction}`, {
307
+ const e = d, t = [];
308
+ for (let n = 0; n < Ye.length; n += 200) {
309
+ const r = Ye.slice(n, n + 200), l = await At(k, `/items/${e.junction}`, {
290
310
  fields: `${e.fkToItem},${e.fkToSection}`,
291
311
  filter: JSON.stringify(
292
- W ? { _and: [{ [e.fkToSection]: { _in: n } }, W] } : { [e.fkToSection]: { _in: n } }
312
+ Q ? { _and: [{ [e.fkToSection]: { _in: r } }, Q] } : { [e.fkToSection]: { _in: r } }
293
313
  )
294
314
  });
295
315
  for (const o of l)
@@ -297,433 +317,454 @@ function Gs({
297
317
  }
298
318
  return t;
299
319
  },
300
- enabled: !!V && Ue.length > 0,
320
+ enabled: !!d && Ye.length > 0,
301
321
  staleTime: 6e4
302
- }), mr = F(() => {
303
- const e = new Map(ot.map((r) => [r.id, r.name])), t = /* @__PURE__ */ new Map();
304
- for (const r of ur) {
305
- const n = e.get(r.section);
306
- if (!n) continue;
307
- const l = t.get(r.item) ?? [];
308
- l.includes(n) || l.push(n), t.set(r.item, l);
322
+ }), yn = F(() => {
323
+ const e = new Map(ct.map((n) => [n.id, n.name])), t = /* @__PURE__ */ new Map();
324
+ for (const n of xn) {
325
+ const r = e.get(n.section);
326
+ if (!r) continue;
327
+ const l = t.get(n.item) ?? [];
328
+ l.includes(r) || l.push(r), t.set(n.item, l);
309
329
  }
310
330
  return t;
311
- }, [ot, ur]), dt = !!E && (!V || sn || Ue.length > 0 && an), ct = F(() => {
331
+ }, [ct, xn]), ut = !!L && (!d || mr || Ye.length > 0 && fr), mt = F(() => {
312
332
  const e = /* @__PURE__ */ new Map();
313
- for (const t of de) e.set(String(t.id), t);
333
+ for (const t of re) e.set(String(t.id), t);
314
334
  return e;
315
- }, [de]), { data: ge = [] } = K({
316
- queryKey: ["o2m-rows", d, h, y],
335
+ }, [re]), { data: me = [] } = C({
336
+ queryKey: ["o2m-rows", i, m, b],
317
337
  queryFn: () => k.request(
318
- R(`/items/${d}`, {
319
- filter: JSON.stringify({ [h]: { _eq: y } }),
338
+ R(`/items/${i}`, {
339
+ filter: JSON.stringify({ [m]: { _eq: b } }),
320
340
  limit: 1e3
321
341
  })
322
342
  ).then((e) => e.data ?? []),
323
- enabled: !z,
343
+ enabled: !P,
324
344
  staleTime: 15e3
325
- }), At = F(
326
- () => ws(ge, [
327
- a.item_field,
328
- G,
329
- ...Y,
330
- ...Object.keys(a.compute_fields ?? {})
345
+ }), Ct = F(
346
+ () => Os(me, [
347
+ s.item_field,
348
+ J,
349
+ ...Z,
350
+ ...Object.keys(s.compute_fields ?? {})
331
351
  ]),
332
- [ge, a.item_field, G, Y, a.compute_fields]
333
- ), fr = Ee(null), Kt = Ee(Q);
334
- Kt.current = Q, Te(() => {
335
- const e = fr.current;
336
- if (fr.current = At, e === null || e === At) return;
337
- const t = Object.keys(Kt.current).filter(
338
- (r) => Kt.current[r].kind === "error"
352
+ [me, s.item_field, J, Z, s.compute_fields]
353
+ ), gn = pe(null), Jt = pe(oe);
354
+ Jt.current = oe, xe(() => {
355
+ const e = gn.current;
356
+ if (gn.current = Ct, e === null || e === Ct) return;
357
+ const t = Object.keys(Jt.current).filter(
358
+ (n) => Jt.current[n].kind === "error"
339
359
  );
340
- X((r) => Ns(r)), me((r) => Object.keys(r).length === 0 ? r : {}), t.length > 0 && ue((r) => {
341
- if (!t.some((l) => l in r)) return r;
342
- const n = { ...r };
343
- for (const l of t) delete n[l];
344
- return n;
360
+ de((n) => Ts(n)), Ee((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && le((n) => {
361
+ if (!t.some((l) => l in n)) return n;
362
+ const r = { ...n };
363
+ for (const l of t) delete r[l];
364
+ return r;
345
365
  });
346
- }, [At]);
347
- const He = !z && !!w, Re = w ? w.getPendingRows(d, h) : [], ut = He ? w.getPendingEdits(d, h) : /* @__PURE__ */ new Map(), ln = JSON.stringify([...ut.entries()]), mt = F(
348
- () => ut.size === 0 ? ge : ge.map((e) => {
349
- const t = ut.get(String(e.id));
366
+ }, [Ct]);
367
+ const Ze = !P && !!v, we = v ? v.getPendingRows(i, m) : [], ft = Ze ? v.getPendingEdits(i, m) : /* @__PURE__ */ new Map(), hr = JSON.stringify([...ft.entries()]), ht = F(
368
+ () => ft.size === 0 ? me : me.map((e) => {
369
+ const t = ft.get(String(e.id));
350
370
  return t ? { ...e, ...t } : e;
351
371
  }),
352
- [ge, ln]
353
- ), ft = !z && w ? w.getPendingDeletes(d, h) : /* @__PURE__ */ new Set(), Ye = F(() => {
372
+ [me, hr]
373
+ ), bt = !P && v ? v.getPendingDeletes(i, m) : /* @__PURE__ */ new Set(), Ge = F(() => {
354
374
  const e = /* @__PURE__ */ new Map();
355
- for (const t of mt) {
356
- const r = t[a.item_field];
357
- r != null && e.set(String(r), t);
375
+ for (const t of ht) {
376
+ const n = t[s.item_field];
377
+ n != null && e.set(String(n), t);
358
378
  }
359
379
  return e;
360
- }, [mt, a.item_field]), ht = F(() => {
380
+ }, [ht, s.item_field]), pt = F(() => {
361
381
  const e = /* @__PURE__ */ new Map();
362
- return Re.forEach((t, r) => {
363
- const n = t[a.item_field];
364
- n != null && e.set(String(n), r);
382
+ return we.forEach((t, n) => {
383
+ const r = t[s.item_field];
384
+ r != null && e.set(String(r), n);
365
385
  }), e;
366
- }, [Re, a.item_field]), pe = F(() => {
367
- const e = Re.filter((n) => n[a.item_field] != null).map((n) => ({ key: String(n[a.item_field]), row: n }));
368
- if (z) return e;
369
- const t = mt.filter((n) => n[a.item_field] != null).map((n) => ({ key: String(n[a.item_field]), row: n })), r = new Set(t.map((n) => n.key));
370
- return [...t, ...e.filter((n) => !r.has(n.key))];
371
- }, [z, Re, mt, a.item_field]), bt = F(
372
- () => pe.filter((e) => !ct.has(e.key)).map((e) => e.key),
373
- [pe, ct]
374
- ), { data: hr = [] } = K({
375
- queryKey: ["catalog-picker-labels", g, T, bt.join(",")],
386
+ }, [we, s.item_field]), be = F(() => {
387
+ const e = we.filter((r) => r[s.item_field] != null).map((r) => ({ key: String(r[s.item_field]), row: r }));
388
+ if (P) return e;
389
+ const t = ht.filter((r) => r[s.item_field] != null).map((r) => ({ key: String(r[s.item_field]), row: r })), n = new Set(t.map((r) => r.key));
390
+ return [...t, ...e.filter((r) => !n.has(r.key))];
391
+ }, [P, we, ht, s.item_field]), xt = F(
392
+ () => be.filter((e) => !mt.has(e.key)).map((e) => e.key),
393
+ [be, mt]
394
+ ), { data: It = [] } = C({
395
+ queryKey: ["catalog-picker-labels", g, A, xt.join(",")],
376
396
  queryFn: () => k.request(
377
397
  R(`/items/${g}`, {
378
- filter: JSON.stringify({ id: { _in: bt } }),
379
- fields: T,
380
- limit: bt.length
398
+ filter: JSON.stringify({ id: { _in: xt } }),
399
+ fields: A,
400
+ limit: xt.length
381
401
  })
382
402
  ).then((e) => e.data ?? []),
383
- enabled: !!g && bt.length > 0,
403
+ enabled: !!g && xt.length > 0,
384
404
  staleTime: 6e4
385
- }), { data: $e = [] } = K({
405
+ }), { data: Oe = [] } = C({
386
406
  queryKey: ["pinned-items", g],
387
407
  queryFn: () => k.request(R(`/pinned/${g}`)).then((e) => e.data ?? []),
388
- enabled: !!g && !!a.favorites,
408
+ enabled: !!g && !!s.favorites,
389
409
  staleTime: 6e4
390
- }), Ct = F(() => new Set($e), [$e]), { data: Ze = [] } = K({
391
- queryKey: ["pinned-item-rows", g, T, $e.join(",")],
410
+ }), zt = F(() => new Set(Oe), [Oe]), { data: Xe = [] } = C({
411
+ queryKey: ["pinned-item-rows", g, A, Oe.join(",")],
392
412
  queryFn: () => k.request(
393
413
  R(`/items/${g}`, {
394
- filter: JSON.stringify({ id: { _in: $e } }),
395
- fields: T,
396
- limit: $e.length
414
+ filter: JSON.stringify({ id: { _in: Oe } }),
415
+ fields: A,
416
+ limit: Oe.length
397
417
  })
398
418
  ).then((e) => e.data ?? []),
399
- enabled: !!g && !!a.favorites && $e.length > 0,
419
+ enabled: !!g && !!s.favorites && Oe.length > 0,
400
420
  staleTime: 6e4
401
- }), [pt, br] = H(/* @__PURE__ */ new Set());
402
- async function pr(e) {
403
- if (!(!g || pt.has(e))) {
404
- br((t) => new Set(t).add(e));
421
+ }), [yt, kn] = Y(/* @__PURE__ */ new Set());
422
+ async function wn(e) {
423
+ if (!(!g || yt.has(e))) {
424
+ kn((t) => new Set(t).add(e));
405
425
  try {
406
- await k.request(Yr(`/pinned/${g}/${e}/toggle`)).catch(() => {
426
+ await k.request(sr(`/pinned/${g}/${e}/toggle`)).catch(() => {
407
427
  }), await j.invalidateQueries({ queryKey: ["pinned-items", g] });
408
428
  } finally {
409
- br((t) => {
410
- const r = new Set(t);
411
- return r.delete(e), r;
429
+ kn((t) => {
430
+ const n = new Set(t);
431
+ return n.delete(e), n;
412
432
  });
413
433
  }
414
434
  }
415
435
  }
416
- const [on, xr] = H(!1), yr = Ee(null), Jt = (e) => a.favorites ? /* @__PURE__ */ s(
436
+ const [br, Nn] = Y(!1), vn = pe(null), Qt = (e) => s.favorites ? /* @__PURE__ */ a(
417
437
  "button",
418
438
  {
419
439
  type: "button",
420
- title: Ct.has(e) ? "Remove from favorites" : "Add to favorites",
421
- disabled: pt.has(e),
440
+ title: zt.has(e) ? "Remove from favorites" : "Add to favorites",
441
+ disabled: yt.has(e),
422
442
  onClick: (t) => {
423
- t.stopPropagation(), pr(e);
443
+ t.stopPropagation(), wn(e);
424
444
  },
425
445
  className: "shrink-0 rounded p-0.5 transition-colors",
426
- children: pt.has(e) ? /* @__PURE__ */ s(ce, { className: "h-3.5 w-3.5 animate-spin text-amber-400" }) : /* @__PURE__ */ s(
427
- it,
446
+ children: yt.has(e) ? /* @__PURE__ */ a(ce, { className: "h-3.5 w-3.5 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
447
+ dt,
428
448
  {
429
- className: C(
449
+ className: I(
430
450
  "h-3.5 w-3.5",
431
- Ct.has(e) ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
451
+ zt.has(e) ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
432
452
  )
433
453
  }
434
454
  )
435
455
  }
436
- ) : null, [he, dn] = H("");
437
- Te(() => {
438
- const e = setTimeout(() => dn(U), 300);
456
+ ) : null, [ue, pr] = Y("");
457
+ xe(() => {
458
+ const e = setTimeout(() => pr(X), 300);
439
459
  return () => clearTimeout(e);
440
- }, [U]);
441
- const gr = F(() => {
460
+ }, [X]);
461
+ const Sn = F(() => {
442
462
  var t;
443
- const e = (t = [...(J ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
463
+ const e = (t = [...(z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
444
464
  return e && !e.includes(".") ? e : "id";
445
- }, [J]), { shownSearchFields: Ce, otherSearchFields: kr } = F(() => {
465
+ }, [z]), { shownSearchFields: Ce, otherSearchFields: _n } = F(() => {
446
466
  const e = new Set(
447
- (($ == null ? void 0 : $.relations) ?? []).filter((n) => n.one_collection === g && n.one_field).map((n) => n.one_field)
467
+ ((T == null ? void 0 : T.relations) ?? []).filter((r) => r.one_collection === g && r.one_field).map((r) => r.one_field)
448
468
  ), t = new Set(
449
- (($ == null ? void 0 : $.fields) ?? []).filter((n) => (n.type === "string" || n.type === "text") && !e.has(n.field)).map((n) => n.field)
450
- ), r = /* @__PURE__ */ new Set();
451
- for (const n of (J ?? "").matchAll(/\{\{([\w.]+)\}\}/g)) t.has(n[1]) && r.add(n[1]);
452
- for (const n of a.columns ?? []) t.has(n.field) && r.add(n.field);
469
+ ((T == null ? void 0 : T.fields) ?? []).filter((r) => (r.type === "string" || r.type === "text") && !e.has(r.field)).map((r) => r.field)
470
+ ), n = /* @__PURE__ */ new Set();
471
+ for (const r of (z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)) t.has(r[1]) && n.add(r[1]);
472
+ for (const r of s.columns ?? []) t.has(r.field) && n.add(r.field);
453
473
  return {
454
- shownSearchFields: [...r],
455
- otherSearchFields: [...t].filter((n) => !r.has(n))
474
+ shownSearchFields: [...n],
475
+ otherSearchFields: [...t].filter((r) => !n.has(r))
456
476
  };
457
- }, [$, g, J, a.columns]), Ge = F(() => {
458
- const e = a.related_columns ?? [], t = e.findIndex((r) => r.stock === !0);
459
- return t !== -1 ? t : e.findIndex((r) => r.key === "on_hand" && r.stock !== !1);
460
- }, [a.related_columns]), te = Ge === -1 ? null : (a.related_columns ?? [])[Ge] ?? null, je = te ? Me(te.match, i) : null, Je = F(() => {
461
- for (const e of Object.values((te == null ? void 0 : te.match) ?? {}))
477
+ }, [T, g, z, s.columns]), et = F(() => {
478
+ const e = s.related_columns ?? [], t = e.findIndex((n) => n.stock === !0);
479
+ return t !== -1 ? t : e.findIndex((n) => n.key === "on_hand" && n.stock !== !1);
480
+ }, [s.related_columns]), se = et === -1 ? null : (s.related_columns ?? [])[et] ?? null, Te = se ? De(se.match, N) : null, Je = F(() => {
481
+ for (const e of Object.values((se == null ? void 0 : se.match) ?? {}))
462
482
  if (typeof e == "string" && e.startsWith("$parent.")) return e.slice(8);
463
483
  return null;
464
- }, [te]), wr = Je ? i == null ? void 0 : i[Je] : null, cn = Je ? ((Jr = P == null ? void 0 : P.fieldLabels) == null ? void 0 : Jr[Je]) ?? M(Je) : null, Qe = g ? `nvr:catalog-in-stock:${g}:${d}.${h}` : null, [Nr, vr] = H(!1);
465
- Te(() => {
484
+ }, [se]), qn = Je ? N == null ? void 0 : N[Je] : null, xr = Je ? ((Bn = O == null ? void 0 : O.fieldLabels) == null ? void 0 : Bn[Je]) ?? D(Je) : null, Qe = g ? `nvr:catalog-in-stock:${g}:${i}.${m}` : null, [$n, jn] = Y(!1);
485
+ xe(() => {
466
486
  if (Qe)
467
487
  try {
468
- vr(localStorage.getItem(Qe) === "1");
488
+ jn(localStorage.getItem(Qe) === "1");
469
489
  } catch {
470
490
  }
471
491
  }, [Qe]);
472
- const It = (e) => {
473
- if (vr(e), !!Qe)
492
+ const Vt = (e) => {
493
+ if (jn(e), !!Qe)
474
494
  try {
475
495
  e ? localStorage.setItem(Qe, "1") : localStorage.removeItem(Qe);
476
496
  } catch {
477
497
  }
478
- }, re = !!te && Nr && je !== null, zt = F(() => {
479
- if (!te) return null;
480
- const e = (($ == null ? void 0 : $.relations) ?? []).find(
481
- (t) => t.many_collection === te.collection && t.many_field === te.item_field && t.one_collection === g && !!t.one_field && !t.junction_field
498
+ }, ae = !!se && $n && Te !== null, Wt = F(() => {
499
+ if (!se) return null;
500
+ const e = ((T == null ? void 0 : T.relations) ?? []).find(
501
+ (t) => t.many_collection === se.collection && t.many_field === se.item_field && t.one_collection === g && !!t.one_field && !t.junction_field
482
502
  );
483
503
  return (e == null ? void 0 : e.one_field) ?? null;
484
- }, [te, $, g]), Qt = F(
485
- () => re && zt && te && je ? { [zt]: { _some: { ...je, [te.value_field]: { _gt: 0 } } } } : null,
486
- [re, zt, te, je]
487
- ), Bt = JSON.stringify(Qt), xt = re && !Qt ? 100 : 25, Vt = (e, t) => {
488
- const r = [t, Qt].filter(Boolean);
489
- return r.length === 0 ? e : { ...e, filter: JSON.stringify(r.length === 1 ? r[0] : { _and: r }) };
490
- }, Wt = Ur().userId, yt = a.recent === !1 ? 0 : typeof a.recent == "object" && Number((Ir = a.recent) == null ? void 0 : Ir.days) || 30, Dt = ["user_created", "created_by", "creator"].find(
491
- (e) => L.some((t) => t.field === e)
492
- ), Xe = ["date_created", "created_at"].find(
493
- (e) => L.some((t) => t.field === e)
494
- ), { data: et = [] } = K({
504
+ }, [se, T, g]), Ut = F(
505
+ () => ae && Wt && se && Te ? { [Wt]: { _some: { ...Te, [se.value_field]: { _gt: 0 } } } } : null,
506
+ [ae, Wt, se, Te]
507
+ ), Mt = JSON.stringify(Ut), gt = ae && !Ut ? 100 : 25, Bt = (e, t) => {
508
+ const n = [t, Ut].filter(Boolean);
509
+ return n.length === 0 ? e : { ...e, filter: JSON.stringify(n.length === 1 ? n[0] : { _and: n }) };
510
+ }, Dt = nr().userId, kt = s.recent === !1 ? 0 : typeof s.recent == "object" && Number((Dn = s.recent) == null ? void 0 : Dn.days) || 30, Ht = ["user_created", "created_by", "creator"].find(
511
+ (e) => te.some((t) => t.field === e)
512
+ ), tt = ["date_created", "created_at"].find(
513
+ (e) => te.some((t) => t.field === e)
514
+ ), { data: nt = [] } = C({
495
515
  queryKey: [
496
516
  "catalog-recent-picks",
497
- d,
498
- a.item_field,
499
- Wt,
517
+ i,
518
+ s.item_field,
500
519
  Dt,
501
- Xe,
502
- yt
520
+ Ht,
521
+ tt,
522
+ kt
503
523
  ],
504
524
  queryFn: async () => {
505
- const e = new Date(Date.now() - yt * 864e5).toISOString(), t = { [Dt]: { _eq: Wt } };
506
- Xe && (t[Xe] = { _gte: e });
507
- const r = await k.request(
508
- R(`/items/${d}`, {
509
- fields: a.item_field,
525
+ const e = new Date(Date.now() - kt * 864e5).toISOString(), t = { [Ht]: { _eq: Dt } };
526
+ tt && (t[tt] = { _gte: e });
527
+ const n = await k.request(
528
+ R(`/items/${i}`, {
529
+ fields: s.item_field,
510
530
  filter: JSON.stringify(t),
511
531
  limit: 500,
512
532
  count: "false",
513
- ...Xe ? { sort: `-${Xe}` } : {}
533
+ ...tt ? { sort: `-${tt}` } : {}
514
534
  })
515
- ).then((l) => l.data ?? []).catch(() => []), n = [];
516
- for (const l of r) {
517
- const o = l[a.item_field], p = o != null && typeof o == "object" ? o.id : o;
518
- if (p != null && p !== "" && !n.includes(String(p)) && n.push(String(p)), n.length >= 150) break;
535
+ ).then((l) => l.data ?? []).catch(() => []), r = [];
536
+ for (const l of n) {
537
+ const o = l[s.item_field], h = o != null && typeof o == "object" ? o.id : o;
538
+ if (h != null && h !== "" && !r.includes(String(h)) && r.push(String(h)), r.length >= 150) break;
519
539
  }
520
- return n;
540
+ return r;
521
541
  },
522
- enabled: yt > 0 && !!Wt && !!Dt && !b,
542
+ enabled: kt > 0 && !!Dt && !!Ht && !w,
523
543
  staleTime: 5 * 6e4
524
- }), un = F(() => new Set(et), [et]), Mt = !!g && he.trim().length > 0, { data: Ut = [], isFetching: mn } = K({
544
+ }), yr = F(() => new Set(nt), [nt]), Yt = !!g && ue.trim().length > 0, { data: Zt = [], isFetching: gr } = C({
525
545
  queryKey: [
526
546
  "catalog-shown-search",
527
547
  g,
528
- T,
529
- he,
548
+ A,
549
+ ue,
530
550
  Ce,
531
- Bt,
532
- xt
551
+ Mt,
552
+ gt
533
553
  ],
534
554
  queryFn: () => k.request(
535
555
  R(
536
556
  `/items/${g}`,
537
- Vt({
538
- search: he,
557
+ Bt({
558
+ search: ue,
539
559
  search_fields: Ce.join(","),
540
560
  search_rank: "1",
541
- fields: T,
542
- limit: xt,
543
- sort: gr
561
+ fields: A,
562
+ limit: gt,
563
+ sort: Sn
544
564
  })
545
565
  )
546
566
  ).then((e) => e.data ?? []),
547
- enabled: Mt && Ce.length > 0,
567
+ enabled: Yt && Ce.length > 0,
548
568
  staleTime: 3e4,
549
569
  placeholderData: (e) => e
550
- }), gt = kr.join(","), { data: _r = [], isFetching: fn } = K({
570
+ }), wt = _n.join(","), { data: Fn = [], isFetching: kr } = C({
551
571
  queryKey: [
552
572
  "catalog-full-search",
553
573
  g,
554
- T,
555
- he,
556
- gt,
557
- Bt,
558
- xt
574
+ A,
575
+ ue,
576
+ wt,
577
+ Mt,
578
+ gt
559
579
  ],
560
580
  queryFn: () => k.request(
561
581
  R(
562
582
  `/items/${g}`,
563
- Vt({
564
- search: he,
565
- fields: [T, gt].filter(Boolean).join(","),
566
- limit: xt,
567
- sort: gr
583
+ Bt({
584
+ search: ue,
585
+ fields: [A, wt].filter(Boolean).join(","),
586
+ limit: gt,
587
+ sort: Sn
568
588
  })
569
589
  )
570
590
  ).then((e) => e.data ?? []),
571
- enabled: Mt,
591
+ enabled: Yt,
572
592
  staleTime: 3e4,
573
593
  placeholderData: (e) => e
574
- }), hn = et.join(","), { data: Sr = [] } = K({
594
+ }), wr = nt.join(","), { data: On = [] } = C({
575
595
  queryKey: [
576
596
  "catalog-recent-search",
577
597
  g,
578
- T,
579
- he,
580
- gt,
581
- hn,
582
- Bt
598
+ A,
599
+ ue,
600
+ wt,
601
+ wr,
602
+ Mt
583
603
  ],
584
604
  queryFn: () => k.request(
585
605
  R(
586
606
  `/items/${g}`,
587
- Vt(
607
+ Bt(
588
608
  {
589
- search: he,
590
- fields: [T, gt].filter(Boolean).join(","),
609
+ search: ue,
610
+ fields: [A, wt].filter(Boolean).join(","),
591
611
  limit: 10,
592
612
  count: "false"
593
613
  },
594
- { id: { _in: et } }
614
+ { id: { _in: nt } }
595
615
  )
596
616
  )
597
617
  ).then((e) => e.data ?? []).catch(() => []),
598
- enabled: Mt && et.length > 0,
618
+ enabled: Yt && nt.length > 0,
599
619
  staleTime: 3e4,
600
620
  placeholderData: (e) => e
601
- }), Ht = mn || fn, Be = F(
602
- () => as({
603
- shown: Ut,
604
- other: _r,
605
- recent: Sr,
621
+ }), Gt = gr || kr, Ve = F(
622
+ () => fs({
623
+ shown: Zt,
624
+ other: Fn,
625
+ recent: On,
606
626
  shownFields: Ce,
607
- q: he
627
+ q: ue
608
628
  }),
609
- [Ut, _r, Sr, Ce, he]
610
- ), bn = (e) => {
611
- if (Ce.length === 0 || Ut.some((r) => String(r.id) === String(e.id)) || is(e, Ce, he)) return null;
612
- const t = Yn(he);
613
- for (const r of kr) {
614
- const n = e[r];
615
- if (n == null || typeof n == "object") continue;
616
- const l = String(n);
617
- if (t.some((o) => Zn(l, o)))
618
- return `${M(r)}: ${l.length > 40 ? `${l.slice(0, 40)}…` : l}`;
629
+ [Zt, Fn, On, Ce, ue]
630
+ ), Nr = (e) => {
631
+ if (Ce.length === 0 || Zt.some((n) => String(n.id) === String(e.id)) || hs(e, Ce, ue)) return null;
632
+ const t = rs(ue);
633
+ for (const n of _n) {
634
+ const r = e[n];
635
+ if (r == null || typeof r == "object") continue;
636
+ const l = String(r);
637
+ if (t.some((o) => ss(l, o)))
638
+ return `${D(n)}: ${l.length > 40 ? `${l.slice(0, 40)}…` : l}`;
619
639
  }
620
640
  return null;
621
- }, kt = F(() => {
641
+ }, We = F(() => {
622
642
  const e = /* @__PURE__ */ new Set();
623
- for (const t of de) e.add(String(t.id));
624
- for (const t of pe) e.add(t.key);
625
- for (const t of $e) e.add(t);
626
- for (const t of Be) e.add(String(t.id));
643
+ for (const t of re) e.add(String(t.id));
644
+ for (const t of be) e.add(t.key);
645
+ for (const t of Oe) e.add(t);
646
+ for (const t of Ve) e.add(String(t.id));
627
647
  return [...e];
628
- }, [de, pe, $e, Be]), wt = lr({
629
- queries: (a.related_columns ?? []).map((e) => {
630
- const t = Me(e.match, i);
648
+ }, [re, be, Oe, Ve]), rt = un({
649
+ queries: (s.related_columns ?? []).map((e) => {
650
+ const t = De(e.match, N);
631
651
  return {
632
652
  queryKey: [
633
653
  "catalog-related",
634
654
  e.key,
635
655
  e.collection,
636
656
  JSON.stringify(t),
637
- kt.join(",")
657
+ We.join(",")
638
658
  ],
639
659
  queryFn: async () => {
640
- const r = {}, n = e.aggregate === "sum", l = n ? 150 : 400;
641
- for (let o = 0; o < kt.length; o += l) {
642
- const p = kt.slice(o, o + l);
660
+ const n = {};
661
+ if (e.count_all && e.aggregate === "sum" && x && _) {
662
+ const o = {};
663
+ if (P)
664
+ for (const h of bn(e.match))
665
+ o[h] = (N == null ? void 0 : N[h]) ?? null;
666
+ for (let h = 0; h < We.length; h += 200) {
667
+ const c = We.slice(h, h + 200), f = await k.request(
668
+ R("/catalog-related/count-all", {
669
+ collection: x,
670
+ field: _,
671
+ key: e.key,
672
+ record: P ? "new" : b,
673
+ ...P ? { parent: JSON.stringify(o) } : {},
674
+ ids: c.join(",")
675
+ })
676
+ );
677
+ Object.assign(n, f.data ?? {});
678
+ }
679
+ return n;
680
+ }
681
+ const r = e.aggregate === "sum", l = r ? 150 : 400;
682
+ for (let o = 0; o < We.length; o += l) {
683
+ const h = We.slice(o, o + l);
643
684
  let c = 1;
644
685
  for (; ; ) {
645
- const m = await k.request(
686
+ const f = await k.request(
646
687
  R(`/items/${e.collection}`, {
647
- limit: n ? 1e3 : p.length,
648
- ...n ? { page: c } : {},
688
+ limit: r ? 1e3 : h.length,
689
+ ...r ? { page: c } : {},
649
690
  fields: `${e.item_field},${e.value_field}`,
650
- filter: JSON.stringify({ ...t, [e.item_field]: { _in: p } })
691
+ filter: JSON.stringify({ ...t, [e.item_field]: { _in: h } })
651
692
  })
652
- ).then((f) => f.data ?? []);
653
- for (const f of m) {
654
- const v = f[e.item_field];
655
- if (v != null)
656
- if (n) {
657
- const _ = Number(f[e.value_field]);
658
- r[String(v)] = (Number(r[String(v)]) || 0) + (Number.isNaN(_) ? 0 : _);
693
+ ).then((p) => p.data ?? []);
694
+ for (const p of f) {
695
+ const S = p[e.item_field];
696
+ if (S != null)
697
+ if (r) {
698
+ const q = Number(p[e.value_field]);
699
+ n[String(S)] = (Number(n[String(S)]) || 0) + (Number.isNaN(q) ? 0 : q);
659
700
  } else
660
- r[String(v)] = f[e.value_field];
701
+ n[String(S)] = p[e.value_field];
661
702
  }
662
- if (!n || m.length < 1e3) break;
703
+ if (!r || f.length < 1e3) break;
663
704
  c += 1;
664
705
  }
665
706
  }
666
- return r;
707
+ return n;
667
708
  },
668
- enabled: !!g && t !== null && kt.length > 0,
709
+ enabled: !!g && t !== null && We.length > 0,
669
710
  staleTime: 3e4
670
711
  };
671
712
  })
672
- }), tt = (e, t) => {
673
- var n, l;
674
- const r = (a.related_columns ?? []).findIndex((o) => o.key === e);
675
- if (r !== -1)
676
- return (l = (n = wt[r]) == null ? void 0 : n.data) == null ? void 0 : l[t];
677
- }, rt = Ge === -1 || (zr = wt[Ge]) == null ? void 0 : zr.data, pn = re && !!((Qr = wt[Ge]) != null && Qr.isFetching), qr = (e) => {
678
- if (!re || rt === void 0) return !0;
679
- const t = Number(rt[e]);
713
+ }), st = (e, t) => {
714
+ var r, l;
715
+ const n = (s.related_columns ?? []).findIndex((o) => o.key === e);
716
+ if (n !== -1)
717
+ return (l = (r = rt[n]) == null ? void 0 : r.data) == null ? void 0 : l[t];
718
+ }, at = et === -1 || (Hn = rt[et]) == null ? void 0 : Hn.data, vr = ae && !!((Yn = rt[et]) != null && Yn.isFetching), Tn = (e) => {
719
+ if (!ae || at === void 0) return !0;
720
+ const t = Number(at[e]);
680
721
  return Number.isFinite(t) && t > 0;
681
- }, nt = re ? Be.filter((e) => qr(String(e.id))) : Be, Yt = re ? Ze.filter((e) => qr(String(e.id))) : Ze, Zt = (e) => {
722
+ }, it = ae ? Ve.filter((e) => Tn(String(e.id))) : Ve, Xt = ae ? Xe.filter((e) => Tn(String(e.id))) : Xe, en = (e) => {
682
723
  var c;
683
- const t = a.qty_warning;
724
+ const t = s.qty_warning;
684
725
  if (!t) return null;
685
- const r = Ne(e) ?? 0;
686
- if (r <= 0) return null;
687
- const n = (a.related_columns ?? []).findIndex((m) => m.key === t.column);
688
- if (n === -1) return null;
689
- const l = (c = wt[n]) == null ? void 0 : c.data;
726
+ const n = Se(e) ?? 0;
727
+ if (n <= 0) return null;
728
+ const r = (s.related_columns ?? []).findIndex((f) => f.key === t.column);
729
+ if (r === -1) return null;
730
+ const l = (c = rt[r]) == null ? void 0 : c.data;
690
731
  if (l === void 0) return null;
691
- const o = l[e], p = o == null || o === "" ? 0 : Number(o);
692
- return Number.isNaN(p) ? null : r > p ? { available: p, qty: r } : null;
693
- }, xn = (e) => {
694
- const t = a.row_flags ?? [];
732
+ const o = l[e], h = o == null || o === "" ? 0 : Number(o);
733
+ return Number.isNaN(h) ? null : n > h ? { available: h, qty: n } : null;
734
+ }, Sr = (e) => {
735
+ const t = s.row_flags ?? [];
695
736
  if (t.length === 0) return [];
696
- const r = [];
697
- for (const n of t)
698
- if (!(!(n != null && n.when) || !n.label))
737
+ const n = [];
738
+ for (const r of t)
739
+ if (!(!(r != null && r.when) || !r.label))
699
740
  try {
700
- const l = n.when.replace(/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g, "$1");
701
- Un(l, e) && r.push(n.label);
741
+ const l = r.when.replace(/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g, "$1");
742
+ ts(l, e) && n.push(r.label);
702
743
  } catch {
703
744
  }
704
- return r;
705
- }, Gt = a.qty_warning ? a.qty_warning.label ?? ((Br = (a.related_columns ?? []).find((e) => {
745
+ return n;
746
+ }, tn = s.qty_warning ? s.qty_warning.label ?? ((Zn = (s.related_columns ?? []).find((e) => {
706
747
  var t;
707
- return e.key === ((t = a.qty_warning) == null ? void 0 : t.column);
708
- })) == null ? void 0 : Br.label) ?? M(a.qty_warning.column) : "", yn = !!a.submission_errors, Nt = F(
748
+ return e.key === ((t = s.qty_warning) == null ? void 0 : t.column);
749
+ })) == null ? void 0 : Zn.label) ?? D(s.qty_warning.column) : "", _r = !!s.submission_errors, Nt = F(
709
750
  () => {
710
751
  var e;
711
- return typeof a.submission_errors == "object" && Array.isArray((e = a.submission_errors) == null ? void 0 : e.match_fields) ? a.submission_errors.match_fields.filter((t) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(t)) : [];
752
+ return typeof s.submission_errors == "object" && Array.isArray((e = s.submission_errors) == null ? void 0 : e.match_fields) ? s.submission_errors.match_fields.filter((t) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(t)) : [];
712
753
  },
713
- [a.submission_errors]
714
- ), gn = Hn(6e4), { data: $r } = K({
715
- queryKey: ["erp-submissions", N ?? "", String(y)],
716
- queryFn: () => k.request(R(`/erp-submissions/${N}/${encodeURIComponent(y)}`)).then((e) => e.data ?? []),
717
- enabled: yn && !z && !!N,
754
+ [s.submission_errors]
755
+ ), qr = ns(6e4), { data: Rn } = C({
756
+ queryKey: ["erp-submissions", x ?? "", String(b)],
757
+ queryFn: () => k.request(R(`/erp-submissions/${x}/${encodeURIComponent(b)}`)).then((e) => e.data ?? []),
758
+ enabled: _r && !P && !!x,
718
759
  staleTime: 15e3,
719
- refetchInterval: gn
720
- }), Xt = F(() => {
721
- const e = ($r ?? [])[0];
722
- return !e || e.status !== "failed" ? null : Gn(e.payload, e.last_error);
723
- }, [$r]), kn = pe.map((e) => e.key).join(","), { data: er } = K({
724
- queryKey: ["catalog-suberr-idents", g, Nt.join(","), kn],
760
+ refetchInterval: qr
761
+ }), nn = F(() => {
762
+ const e = (Rn ?? [])[0];
763
+ return !e || e.status !== "failed" ? null : is(e.payload, e.last_error);
764
+ }, [Rn]), $r = be.map((e) => e.key).join(","), { data: rn } = C({
765
+ queryKey: ["catalog-suberr-idents", g, Nt.join(","), $r],
725
766
  queryFn: async () => {
726
- const e = pe.map((r) => r.key);
767
+ const e = be.map((n) => n.key);
727
768
  if (e.length === 0) return {};
728
769
  const t = await k.request(
729
770
  R(`/items/${g}`, {
@@ -731,504 +772,548 @@ function Gs({
731
772
  fields: ["id", ...Nt].join(","),
732
773
  filter: JSON.stringify({ id: { _in: e } })
733
774
  })
734
- ).then((r) => r.data ?? []);
735
- return Object.fromEntries(t.map((r) => [String(r.id), r]));
775
+ ).then((n) => n.data ?? []);
776
+ return Object.fromEntries(t.map((n) => [String(n.id), n]));
736
777
  },
737
- enabled: !!g && !!Xt && Nt.length > 0 && pe.length > 0,
778
+ enabled: !!g && !!nn && Nt.length > 0 && be.length > 0,
738
779
  staleTime: 6e4
739
- }), wn = (e) => {
740
- if (!Xt) return null;
741
- const t = er == null ? void 0 : er[e], r = [
742
- Kr(e),
743
- ...Nt.map((n) => {
744
- const l = (t == null ? void 0 : t[n]) ?? Ie(e)[n];
780
+ }), jr = (e) => {
781
+ if (!nn) return null;
782
+ const t = rn == null ? void 0 : rn[e], n = [
783
+ jt(e),
784
+ ...Nt.map((r) => {
785
+ const l = (t == null ? void 0 : t[r]) ?? Ie(e)[r];
745
786
  return l != null && l !== "" ? String(l) : null;
746
787
  })
747
- ].filter((n) => !!n).map(Xn);
748
- return Xt.reasonFor(r);
749
- }, vt = a.summary_fields ?? [], Nn = ge.map((e) => String(e.id)).join(","), vn = lr({
788
+ ].filter((r) => !!r).map(ls);
789
+ return nn.reasonFor(n);
790
+ }, vt = s.summary_fields ?? [], Fr = me.map((e) => String(e.id)).join(","), Or = un({
750
791
  queries: vt.filter((e) => e.m2m).map((e) => ({
751
- queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, Nn],
792
+ queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, Fr],
752
793
  queryFn: async () => {
753
- const t = ge.map((f) => String(f.id));
794
+ const t = me.map((p) => String(p.id));
754
795
  if (t.length === 0) return {};
755
- const r = e.m2m, n = await k.request(
756
- R(`/items/${r.junction}`, {
796
+ const n = e.m2m, r = await k.request(
797
+ R(`/items/${n.junction}`, {
757
798
  limit: 1e3,
758
- fields: `${r.fk_to_child},${r.related_field}`,
759
- filter: JSON.stringify({ [r.fk_to_child]: { _in: t } })
799
+ fields: `${n.fk_to_child},${n.related_field}`,
800
+ filter: JSON.stringify({ [n.fk_to_child]: { _in: t } })
760
801
  })
761
- ).then((f) => f.data ?? []).catch(() => []), l = [...new Set(n.map((f) => String(f[r.related_field])))], o = r.label_field ?? "name", p = l.length ? await k.request(
762
- R(`/items/${r.related_collection}`, {
802
+ ).then((p) => p.data ?? []).catch(() => []), l = [...new Set(r.map((p) => String(p[n.related_field])))], o = n.label_field ?? "name", h = l.length ? await k.request(
803
+ R(`/items/${n.related_collection}`, {
763
804
  limit: 500,
764
805
  fields: `id,${o}`,
765
806
  filter: JSON.stringify({ id: { _in: l } })
766
807
  })
767
- ).then((f) => f.data ?? []).catch(() => []) : [], c = new Map(p.map((f) => [String(f.id), String(f[o] ?? f.id)])), m = {};
768
- for (const f of n) {
769
- const v = String(f[r.fk_to_child]), _ = c.get(String(f[r.related_field]));
770
- _ && (m[v] = m[v] ? `${m[v]}, ${_}` : _);
808
+ ).then((p) => p.data ?? []).catch(() => []) : [], c = new Map(h.map((p) => [String(p.id), String(p[o] ?? p.id)])), f = {};
809
+ for (const p of r) {
810
+ const S = String(p[n.fk_to_child]), q = c.get(String(p[n.related_field]));
811
+ q && (f[S] = f[S] ? `${f[S]}, ${q}` : q);
771
812
  }
772
- return m;
813
+ return f;
773
814
  },
774
- enabled: !z && ge.length > 0,
815
+ enabled: !P && me.length > 0,
775
816
  staleTime: 15e3
776
817
  }))
777
- }), _n = (e, t) => {
818
+ }), Tr = (e, t) => {
778
819
  var l, o;
779
820
  if (!e.m2m) return t.row[e.field];
780
- const r = vt.filter((p) => p.m2m).findIndex((p) => p.field === e.field);
781
- if (r === -1) return;
782
- const n = t.row.id;
783
- if (n != null)
784
- return (o = (l = vn[r]) == null ? void 0 : l.data) == null ? void 0 : o[String(n)];
785
- }, Sn = !!((Vr = a.fulfilment) != null && Vr.shipped_field) && (a.fulfilment.show_when ? Gr(a.fulfilment.show_when, i) : !0), qn = (e) => {
786
- if (!Sn || !a.fulfilment) return null;
787
- const t = Number(e[a.fulfilment.qty_field ?? G] ?? 0) || 0, r = Number(e[a.fulfilment.shipped_field] ?? 0) || 0, n = t > 0 && r >= t ? {
821
+ const n = vt.filter((h) => h.m2m).findIndex((h) => h.field === e.field);
822
+ if (n === -1) return;
823
+ const r = t.row.id;
824
+ if (r != null)
825
+ return (o = (l = Or[n]) == null ? void 0 : l.data) == null ? void 0 : o[String(r)];
826
+ }, Rr = !!((Gn = s.fulfilment) != null && Gn.shipped_field) && (s.fulfilment.show_when ? ir(s.fulfilment.show_when, N) : !0), Pr = (e) => {
827
+ if (!Rr || !s.fulfilment) return null;
828
+ const t = Number(e[s.fulfilment.qty_field ?? J] ?? 0) || 0, n = Number(e[s.fulfilment.shipped_field] ?? 0) || 0, r = t > 0 && n >= t ? {
788
829
  dot: "bg-emerald-500",
789
830
  text: "text-emerald-700 dark:text-emerald-400",
790
831
  label: "Shipped"
791
- } : r > 0 ? {
832
+ } : n > 0 ? {
792
833
  dot: "bg-amber-500",
793
834
  text: "text-amber-700 dark:text-amber-300",
794
- label: `Partial · ${r}/${t}`
835
+ label: `Partial · ${n}/${t}`
795
836
  } : {
796
837
  dot: "bg-slate-300 dark:bg-slate-600",
797
838
  text: "text-slate-500 dark:text-slate-400",
798
- label: "Requested"
839
+ // The header's ORDER STATUS word for the same order (army 11 a2 F8).
840
+ label: s.fulfilment.pending_label ?? "Order Sent",
841
+ key: "requested"
799
842
  };
800
843
  return /* @__PURE__ */ u(
801
844
  "span",
802
845
  {
803
846
  className: "inline-flex items-center gap-1.5 whitespace-nowrap",
804
- "data-catalog-fulfilment": n.label.split(" ")[0].toLowerCase(),
805
- title: `${a.fulfilment.label ?? "Warehouse"} · ${r} of ${t} shipped`,
847
+ "data-catalog-fulfilment": "key" in r ? r.key : r.label.split(" ")[0].toLowerCase(),
848
+ title: `${s.fulfilment.label ?? "Warehouse"} · ${n} of ${t} shipped`,
806
849
  children: [
807
- /* @__PURE__ */ s("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${n.dot}` }),
808
- /* @__PURE__ */ s("span", { className: `text-[11px] font-medium ${n.text}`, children: n.label })
850
+ /* @__PURE__ */ a("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${r.dot}` }),
851
+ /* @__PURE__ */ a("span", { className: `text-[11px] font-medium ${r.text}`, children: r.label })
809
852
  ]
810
853
  }
811
854
  );
812
- }, jr = a.columns ?? [], Fr = a.related_columns ?? [], _t = jr.filter((e) => !e.summary_only), tr = Fr.filter((e) => !e.summary_only), Tr = jr.filter((e) => !e.sections_only), Or = Fr.filter((e) => !e.sections_only), Rr = _t.length > 0 || tr.length > 0, rr = Ee(null), Pr = (e) => {
855
+ }, Pn = s.columns ?? [], En = s.related_columns ?? [], St = Pn.filter((e) => !e.summary_only), sn = En.filter((e) => !e.summary_only), Ln = Pn.filter((e) => !e.sections_only), An = En.filter((e) => !e.sections_only), Kn = St.length > 0 || sn.length > 0, an = pe(null), Cn = (e) => {
813
856
  let t = e.parentElement;
814
857
  for (; t; ) {
815
- const r = getComputedStyle(t);
816
- if (/(auto|scroll)/.test(r.overflowY) && t.scrollHeight > t.clientHeight + 4) {
817
- e.style.top = `-${Number.parseFloat(r.paddingTop) || 0}px`;
858
+ const n = getComputedStyle(t);
859
+ if (/(auto|scroll)/.test(n.overflowY) && t.scrollHeight > t.clientHeight + 4) {
860
+ e.style.top = `-${Number.parseFloat(n.paddingTop) || 0}px`;
818
861
  return;
819
862
  }
820
863
  t = t.parentElement;
821
864
  }
822
- }, $n = (e) => {
823
- rr.current = e, e && Pr(e);
865
+ }, Er = (e) => {
866
+ an.current = e, e && Cn(e);
824
867
  };
825
- Te(() => {
868
+ xe(() => {
826
869
  let e = 0;
827
870
  const t = () => {
828
871
  e || (e = requestAnimationFrame(() => {
829
- e = 0, rr.current && Pr(rr.current);
872
+ e = 0, an.current && Cn(an.current);
830
873
  }));
831
874
  };
832
875
  return window.addEventListener("scroll", t, !0), () => {
833
876
  e && cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0);
834
877
  };
835
878
  }, []);
836
- const St = (e, t) => {
837
- let r = e;
838
- for (const n of t.split(".")) {
839
- if (r == null || typeof r != "object") return;
840
- r = r[n];
879
+ const _t = (e, t) => {
880
+ let n = e;
881
+ for (const r of t.split(".")) {
882
+ if (n == null || typeof n != "object") return;
883
+ n = n[r];
841
884
  }
842
- return r;
843
- }, ke = (e, t) => {
885
+ return n;
886
+ }, Ne = (e, t) => {
844
887
  if (t === "presence")
845
888
  return e == null || e === "" || Number(e) === 0 ? "No" : "Yes";
846
889
  if (e == null || e === "") return "—";
847
- const r = Number(e);
848
- return t === "currency" ? Number.isNaN(r) ? String(e) : r.toLocaleString(void 0, { style: "currency", currency: "USD" }) : t === "number" ? Number.isNaN(r) ? String(e) : r.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(e);
849
- }, qt = g ? `${g}:${d}.${h}` : null, Pe = Zr(qt && `${qt}:catalog`), we = Zr(qt && `${qt}:summary`), Er = Ee(null), jn = (e, t) => {
850
- const r = ss(Er.current, t);
851
- r != null && e.setWidth(t, r);
852
- }, $t = (e, t, r, n, l) => {
853
- const o = e.box(t, n, l);
854
- return /* @__PURE__ */ u("span", { ...o, className: C("relative", o.className), children: [
855
- /* @__PURE__ */ s("span", { "data-cpf-fit": !0, className: "block truncate", children: r }),
856
- /* @__PURE__ */ s(
857
- ns,
890
+ const n = Number(e);
891
+ return t === "currency" ? Number.isNaN(n) ? String(e) : n.toLocaleString(void 0, { style: "currency", currency: "USD" }) : t === "number" ? Number.isNaN(n) ? String(e) : n.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(e);
892
+ }, qt = g ? `${g}:${i}.${m}` : null, Le = ar(qt && `${qt}:catalog`), ve = ar(qt && `${qt}:summary`), Jn = pe(null), Lr = (e, t) => {
893
+ const n = ms(Jn.current, t);
894
+ n != null && e.setWidth(t, n);
895
+ }, $t = (e, t, n, r, l) => {
896
+ const o = e.box(t, r, l);
897
+ return /* @__PURE__ */ u("span", { ...o, className: I("relative", o.className), children: [
898
+ /* @__PURE__ */ a("span", { "data-cpf-fit": !0, className: "block truncate", children: n }),
899
+ /* @__PURE__ */ a(
900
+ us,
858
901
  {
859
- label: r,
860
- onResize: (p) => e.setWidth(t, p),
861
- onFit: () => jn(e, t)
902
+ label: n,
903
+ onResize: (h) => e.setWidth(t, h),
904
+ onFit: () => Lr(e, t)
862
905
  }
863
906
  )
864
907
  ] }, t);
865
- }, Fn = (Wr = _t.find((e) => !e.format)) == null ? void 0 : Wr.field, Lr = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Fn ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], nr = (e, t, r) => /* @__PURE__ */ u(ve, { children: [
866
- _t.map((n) => {
867
- const [l, o] = Lr(n);
868
- return /* @__PURE__ */ s(
869
- Xr,
908
+ }, Ar = (Xn = St.find((e) => !e.format)) == null ? void 0 : Xn.field, In = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Ar ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], ln = (e, t, n) => /* @__PURE__ */ u(_e, { children: [
909
+ St.map((r) => {
910
+ const [l, o] = In(r);
911
+ return /* @__PURE__ */ a(
912
+ lr,
870
913
  {
871
- text: ke(
872
- ks({
873
- field: n.field,
874
- catalogValue: St(t, n.field),
875
- copyFields: a.copy_fields,
876
- related: a.related_columns,
877
- lookup: (p) => tt(p, e)
914
+ text: Ne(
915
+ Fs({
916
+ field: r.field,
917
+ catalogValue: _t(t, r.field),
918
+ copyFields: s.copy_fields,
919
+ related: s.related_columns,
920
+ lookup: (h) => st(h, e)
878
921
  }),
879
- n.format
922
+ r.format
880
923
  ),
881
- highlight: n.format ? void 0 : r,
882
- ...Pe.box(n.field, l, C("text-slate-500 dark:text-slate-400", o))
924
+ highlight: r.format ? void 0 : n,
925
+ ...Le.box(r.field, l, I("text-slate-500 dark:text-slate-400", o))
883
926
  },
884
- n.field
927
+ r.field
885
928
  );
886
929
  }),
887
- tr.map((n) => /* @__PURE__ */ s(
930
+ sn.map((r) => /* @__PURE__ */ a(
888
931
  "span",
889
932
  {
890
- ...Pe.box(
891
- `rel:${n.key}`,
933
+ ...Le.box(
934
+ `rel:${r.key}`,
892
935
  "w-20 shrink-0",
893
936
  "truncate text-right text-slate-500 dark:text-slate-400"
894
937
  ),
895
- children: ke(tt(n.key, e), n.format)
938
+ children: Ne(st(r.key, e), r.format)
896
939
  },
897
- n.key
940
+ r.key
898
941
  )),
899
- /* @__PURE__ */ s("span", { "aria-hidden": !0, className: "ml-auto" })
900
- ] }), Tn = en(g), Ar = (e, t, r, n, l) => Tn ? /* @__PURE__ */ s(
942
+ /* @__PURE__ */ a("span", { "aria-hidden": !0, className: "ml-auto" })
943
+ ] }), Kr = or(g), zn = (e, t, n, r, l) => Kr ? /* @__PURE__ */ a(
901
944
  "button",
902
945
  {
903
946
  type: "button",
904
- "data-cpf-fit": n || void 0,
905
- onClick: () => g && tn(g, e, i),
947
+ "data-cpf-fit": r || void 0,
948
+ onClick: () => g && dr(g, e, N),
906
949
  title: "View stock & planning detail",
907
- className: C(
908
- r,
950
+ className: I(
951
+ n,
909
952
  "text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600"
910
953
  ),
911
- children: l ? /* @__PURE__ */ s(dr, { text: t, query: l }) : t
954
+ children: l ? /* @__PURE__ */ a(fn, { text: t, query: l }) : t
912
955
  }
913
- ) : /* @__PURE__ */ s("span", { className: r, "data-cpf-fit": n || void 0, children: l ? /* @__PURE__ */ s(dr, { text: t, query: l }) : t }), sr = (e, t, r, n) => {
914
- const l = Pe.box("item", Rr ? "w-36 shrink-0" : "min-w-0 flex-1");
915
- return /* @__PURE__ */ u("span", { ...l, className: C("flex min-w-0 items-center gap-1.5", l.className), children: [
916
- Ar(
956
+ ) : /* @__PURE__ */ a("span", { className: n, "data-cpf-fit": r || void 0, children: l ? /* @__PURE__ */ a(fn, { text: t, query: l }) : t }), on = (e, t, n, r) => {
957
+ const l = Le.box("item", Kn ? "w-36 shrink-0" : "min-w-0 flex-1");
958
+ return /* @__PURE__ */ u("span", { ...l, className: I("flex min-w-0 items-center gap-1.5", l.className), children: [
959
+ zn(
917
960
  e,
918
961
  t,
919
962
  "min-w-0 truncate text-slate-700 dark:text-slate-200",
920
963
  !0,
921
- n
964
+ r
922
965
  ),
923
- r
966
+ n
924
967
  ] });
925
- }, Kr = (e) => {
926
- const t = ct.get(e) ?? hr.find((r) => String(r.id) === e) ?? Ze.find((r) => String(r.id) === e);
927
- return t ? ze(J, t) : `#${e}`;
928
- }, Ie = (e) => ct.get(e) ?? hr.find((t) => String(t.id) === e) ?? Ze.find((t) => String(t.id) === e) ?? { id: e }, Ne = (e) => {
929
- var n;
930
- const t = z ? void 0 : Ye.get(e);
931
- if (t) return ft.has(String(t.id)) ? null : Number(t[G] ?? 0);
932
- const r = ht.get(e);
933
- return r === void 0 ? null : Number(((n = Re[r]) == null ? void 0 : n[G]) ?? 0);
934
- }, On = (e) => {
968
+ }, jt = (e) => {
969
+ const t = mt.get(e) ?? It.find((n) => String(n.id) === e) ?? Xe.find((n) => String(n.id) === e);
970
+ return t ? ze(z, t) : `#${e}`;
971
+ }, Qn = pe(jt);
972
+ Qn.current = jt;
973
+ const Vn = pe(me);
974
+ Vn.current = me, xe(
975
+ () => as(i, (e) => {
976
+ const t = Vn.current.find((o) => String(o.id) === String(e)), n = t == null ? void 0 : t[s.item_field], r = n && typeof n == "object" ? n.id : n;
977
+ if (r == null || r === "") return null;
978
+ const l = Qn.current(String(r));
979
+ return l.startsWith("#") ? null : l;
980
+ }),
981
+ [i, s.item_field]
982
+ );
983
+ const Ie = (e) => mt.get(e) ?? It.find((t) => String(t.id) === e) ?? Xe.find((t) => String(t.id) === e) ?? { id: e }, Se = (e) => {
984
+ var r;
985
+ const t = P ? void 0 : Ge.get(e);
986
+ if (t) return bt.has(String(t.id)) ? null : Number(t[J] ?? 0);
987
+ const n = pt.get(e);
988
+ return n === void 0 ? null : Number(((r = we[n]) == null ? void 0 : r[J]) ?? 0);
989
+ }, Cr = (e) => {
935
990
  let t = e;
936
- for (const r of a.section_by.split(".")) {
991
+ for (const n of s.section_by.split(".")) {
937
992
  if (t == null || typeof t != "object") return "";
938
- t = t[r];
993
+ t = t[n];
939
994
  }
940
995
  return String(t ?? "").trim();
941
- }, jt = F(() => {
942
- if (dt) return [];
943
- U.trim().toLowerCase();
996
+ }, Ft = F(() => {
997
+ if (ut) return [];
998
+ X.trim().toLowerCase();
944
999
  const e = /* @__PURE__ */ new Map();
945
- for (const t of de) {
946
- if (re && rt !== void 0 && !(Number(rt[String(t.id)]) > 0)) continue;
947
- const r = ze(J, t), n = E ? mr.get(String(t.id)) ?? [] : [On(t)];
948
- if (!(E && W && n.length === 0))
949
- for (const l of n.length ? n : [""]) {
1000
+ for (const t of re) {
1001
+ if (ae && at !== void 0 && !(Number(at[String(t.id)]) > 0)) continue;
1002
+ const n = ze(z, t), r = L ? yn.get(String(t.id)) ?? [] : [Cr(t)];
1003
+ if (!(L && Q && r.length === 0))
1004
+ for (const l of r.length ? r : [""]) {
950
1005
  const o = l || "Uncategorized";
951
- e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: r, row: t });
1006
+ e.has(o) || e.set(o, []), e.get(o).push({ id: String(t.id), label: n, row: t });
952
1007
  }
953
1008
  }
954
1009
  return [...e.entries()].sort(
955
- ([t], [r]) => t === "Uncategorized" ? 1 : r === "Uncategorized" ? -1 : t.localeCompare(r)
956
- ).map(([t, r]) => ({
1010
+ ([t], [n]) => t === "Uncategorized" ? 1 : n === "Uncategorized" ? -1 : t.localeCompare(n)
1011
+ ).map(([t, n]) => ({
957
1012
  name: t,
958
- items: r.sort((n, l) => n.label.localeCompare(l.label))
1013
+ items: n.sort((r, l) => r.label.localeCompare(l.label))
959
1014
  }));
960
1015
  }, [
961
- de,
962
- J,
963
- U,
964
- a.section_by,
965
- E,
966
- mr,
967
- dt,
968
- W,
969
1016
  re,
970
- rt
1017
+ z,
1018
+ X,
1019
+ s.section_by,
1020
+ L,
1021
+ yn,
1022
+ ut,
1023
+ Q,
1024
+ ae,
1025
+ at
971
1026
  ]);
972
- if (!Oe.current && jt.length > 0) {
973
- Oe.current = !0;
1027
+ if (!je.current && Ft.length > 0) {
1028
+ je.current = !0;
974
1029
  const e = /* @__PURE__ */ new Set();
975
- for (const t of jt)
976
- t.items.some((n) => (Ne(n.id) ?? 0) > 0) || e.add(t.name);
977
- xe(e);
1030
+ for (const t of Ft)
1031
+ t.items.some((r) => (Se(r.id) ?? 0) > 0) || e.add(t.name);
1032
+ $e(e);
978
1033
  }
979
- async function Rn(e) {
1034
+ async function Jr(e) {
980
1035
  const t = {};
981
- for (const r of a.related_columns ?? []) {
982
- if (!r.copy_to) continue;
983
- let n = tt(r.key, e);
984
- if (n === void 0) {
985
- const l = Me(r.match, i);
1036
+ for (const n of s.related_columns ?? []) {
1037
+ if (!n.copy_to) continue;
1038
+ let r = st(n.key, e);
1039
+ if (r === void 0) {
1040
+ const l = De(n.match, N);
986
1041
  if (l === null) continue;
987
- n = await k.request(
988
- R(`/items/${r.collection}`, {
1042
+ r = await k.request(
1043
+ R(`/items/${n.collection}`, {
989
1044
  limit: 1,
990
- fields: `${r.item_field},${r.value_field}`,
991
- filter: JSON.stringify({ ...l, [r.item_field]: { _eq: e } })
1045
+ fields: `${n.item_field},${n.value_field}`,
1046
+ filter: JSON.stringify({ ...l, [n.item_field]: { _eq: e } })
992
1047
  })
993
1048
  ).then((o) => {
994
- var p, c;
995
- return (c = (p = o.data) == null ? void 0 : p[0]) == null ? void 0 : c[r.value_field];
1049
+ var h, c;
1050
+ return (c = (h = o.data) == null ? void 0 : h[0]) == null ? void 0 : c[n.value_field];
996
1051
  }).catch(() => {
997
1052
  });
998
1053
  }
999
- n != null && (t[r.copy_to] = n);
1054
+ r != null && (t[n.copy_to] = r);
1000
1055
  }
1001
1056
  return t;
1002
1057
  }
1003
- const Pn = (e, t) => {
1004
- var n;
1005
- for (const l of a.related_columns ?? []) {
1058
+ const Wn = (e, t) => {
1059
+ var r;
1060
+ for (const l of s.related_columns ?? []) {
1006
1061
  if (l.copy_to !== t) continue;
1007
- const o = tt(l.key, e);
1062
+ const o = st(l.key, e);
1008
1063
  if (o != null && o !== "") return o;
1009
1064
  }
1010
- const r = (n = a.copy_fields) == null ? void 0 : n[t];
1011
- return r ? Ie(e)[r] : void 0;
1012
- }, En = (e, t) => {
1013
- if (b || !Y.includes(t)) return !1;
1014
- if (Z || !_e.includes(t)) return !0;
1015
- const r = Pn(e, t);
1016
- return r == null || r === "" || !(Number(r) > 0);
1065
+ const n = (r = s.copy_fields) == null ? void 0 : r[t];
1066
+ return n ? Ie(e)[n] : void 0;
1067
+ }, Un = pe(/* @__PURE__ */ new Map()), Ot = F(() => {
1068
+ const e = new Set(Object.keys(s.copy_fields ?? {}));
1069
+ for (const t of s.related_columns ?? []) t.copy_to && e.add(t.copy_to);
1070
+ return [...e];
1071
+ }, [s.copy_fields, s.related_columns]), Ir = JSON.stringify([
1072
+ we.map((e) => [e[s.item_field], ...Ot.map((t) => e[t] ?? null)]),
1073
+ rt.map((e) => e.dataUpdatedAt),
1074
+ re.length,
1075
+ It.length
1076
+ ]);
1077
+ xe(() => {
1078
+ w || !v || Ot.length === 0 || we.forEach((e, t) => {
1079
+ const n = e[s.item_field];
1080
+ if (n == null) return;
1081
+ const r = vs(
1082
+ e,
1083
+ Ot,
1084
+ (o) => Wn(String(n), o),
1085
+ Un.current.get(String(n))
1086
+ );
1087
+ if (!r) return;
1088
+ Un.current.set(String(n), r.auto);
1089
+ const l = { ...e, ...r.updates };
1090
+ for (const [o, h] of Object.entries(s.compute_fields ?? {})) {
1091
+ const c = Pe(h, l);
1092
+ c !== null && (l[o] = c);
1093
+ }
1094
+ v.updateRow(i, m, t, l);
1095
+ });
1096
+ }, [Ir, w, Ot]);
1097
+ const zr = (e, t) => {
1098
+ if (w || !Z.includes(t)) return !1;
1099
+ if (Ae || !G.includes(t)) return !0;
1100
+ const n = Wn(e, t);
1101
+ return n == null || n === "" || !(Number(n) > 0);
1017
1102
  };
1018
- function Ve(e, t, r, n = {}) {
1103
+ function Ue(e, t, n, r = {}) {
1019
1104
  const l = {
1020
- [a.item_field]: r.id ?? e,
1021
- [G]: t
1105
+ [s.item_field]: n.id ?? e,
1106
+ [J]: t
1022
1107
  };
1023
- for (const [o, p] of Object.entries(a.copy_fields ?? {}))
1024
- r[p] !== void 0 && (l[o] = r[p]);
1025
- Object.assign(l, n);
1026
- for (const [o, p] of Object.entries(a.compute_fields ?? {})) {
1027
- const c = Le(p, l);
1108
+ for (const [o, h] of Object.entries(s.copy_fields ?? {}))
1109
+ n[h] !== void 0 && (l[o] = n[h]);
1110
+ Object.assign(l, r);
1111
+ for (const [o, h] of Object.entries(s.compute_fields ?? {})) {
1112
+ const c = Pe(h, l);
1028
1113
  c !== null && (l[o] = c);
1029
1114
  }
1030
1115
  return l;
1031
1116
  }
1032
- function Ln(e, t, r, n) {
1033
- return gs({
1034
- compute: a.compute_fields ?? {},
1035
- probe: { ...Ve(e, t, r), ...n, [G]: t },
1036
- ruleError: B,
1117
+ function Qr(e, t, n, r) {
1118
+ return js({
1119
+ compute: s.compute_fields ?? {},
1120
+ probe: { ...Ue(e, t, n), ...r, [J]: t },
1121
+ ruleError: M,
1037
1122
  labelOf: (l) => {
1038
1123
  var o;
1039
- return ((o = L.find((p) => p.field === l)) == null ? void 0 : o.label) || M(l);
1124
+ return ((o = te.find((h) => h.field === l)) == null ? void 0 : o.label) || D(l);
1040
1125
  }
1041
1126
  });
1042
1127
  }
1043
- async function st(e, t, r, n = {}) {
1044
- const l = cr(t, { type: le, min: 0, label: "Quantity" });
1128
+ async function lt(e, t, n, r = {}) {
1129
+ const l = hn(t, { type: U, min: 0, label: "Quantity" });
1045
1130
  if (!l.ok) {
1046
- X((m) => ({ ...m, [e]: { kind: "error", message: l.message } }));
1131
+ de((f) => ({ ...f, [e]: { kind: "error", message: l.message } }));
1047
1132
  return;
1048
1133
  }
1049
1134
  const o = l.value ?? 0;
1050
- if ((Ne(e) ?? 0) === o) return;
1051
- if (o === 0 && !n.confirmedRemove) {
1052
- X((m) => ({ ...m, [e]: { kind: "remove", row: r } }));
1135
+ if ((Se(e) ?? 0) === o) return;
1136
+ if (o === 0 && !r.confirmedRemove) {
1137
+ de((f) => ({ ...f, [e]: { kind: "remove", row: n } }));
1053
1138
  return;
1054
1139
  }
1055
1140
  if (o > 0) {
1056
- const m = ht.get(e), f = (z ? void 0 : Ye.get(e)) ?? (m !== void 0 ? Re[m] : void 0) ?? {}, v = B(G, o, f) ?? Ln(e, o, r, f);
1057
- if (v) {
1058
- X((_) => ({ ..._, [e]: { kind: "error", message: v } }));
1141
+ const f = pt.get(e), p = (P ? void 0 : Ge.get(e)) ?? (f !== void 0 ? we[f] : void 0) ?? {}, S = M(J, o, p) ?? Qr(e, o, n, p);
1142
+ if (S) {
1143
+ de((q) => ({ ...q, [e]: { kind: "error", message: S } }));
1059
1144
  return;
1060
1145
  }
1061
1146
  }
1062
- const c = o > 0 ? await Rn(e) : {};
1063
- if (He && w) {
1064
- const m = Ye.get(e);
1065
- if ((m == null ? void 0 : m.id) != null) {
1066
- const f = String(m.id);
1147
+ const c = o > 0 ? await Jr(e) : {};
1148
+ if (Ze && v) {
1149
+ const f = Ge.get(e);
1150
+ if ((f == null ? void 0 : f.id) != null) {
1151
+ const p = String(f.id);
1067
1152
  if (o === 0) {
1068
- w.cancelPendingEdit(d, h, f), w.queueDelete(d, h, f);
1153
+ v.cancelPendingEdit(i, m, p), v.queueDelete(i, m, p);
1069
1154
  return;
1070
1155
  }
1071
- ft.has(f) && w.cancelPendingDelete(d, h, f);
1072
- const v = Ve(e, o, r, c);
1073
- for (const x of Y)
1074
- m[x] != null && m[x] !== "" && (v[x] = m[x]);
1075
- for (const [x, A] of Object.entries(a.compute_fields ?? {})) {
1076
- const Fe = Le(A, { ...m, ...v });
1077
- Fe !== null && (v[x] = Fe);
1156
+ bt.has(p) && v.cancelPendingDelete(i, m, p);
1157
+ const S = Ue(e, o, n, c);
1158
+ for (const y of Z)
1159
+ f[y] != null && f[y] !== "" && (S[y] = f[y]);
1160
+ for (const [y, K] of Object.entries(s.compute_fields ?? {})) {
1161
+ const Re = Pe(K, { ...f, ...S });
1162
+ Re !== null && (S[y] = Re);
1078
1163
  }
1079
- const _ = ge.find((x) => String(x.id) === f) ?? {}, O = Object.fromEntries(
1080
- Object.entries(v).filter(([x, A]) => String(A ?? "") !== String(_[x] ?? ""))
1164
+ const q = me.find((y) => String(y.id) === p) ?? {}, E = Object.fromEntries(
1165
+ Object.entries(S).filter(([y, K]) => String(K ?? "") !== String(q[y] ?? ""))
1081
1166
  );
1082
- Object.keys(O).length === 0 ? w.cancelPendingEdit(d, h, f) : (w.cancelPendingEdit(d, h, f), w.queueEdit(d, h, f, O));
1167
+ Object.keys(E).length === 0 ? v.cancelPendingEdit(i, m, p) : (v.cancelPendingEdit(i, m, p), v.queueEdit(i, m, p, E));
1083
1168
  return;
1084
1169
  }
1085
1170
  }
1086
- if (z || He) {
1087
- const m = ht.get(e);
1088
- o === 0 ? m !== void 0 && (w == null || w.removeRow(d, h, m)) : m !== void 0 ? w == null || w.updateRow(
1089
- d,
1090
- h,
1171
+ if (P || Ze) {
1172
+ const f = pt.get(e);
1173
+ o === 0 ? f !== void 0 && (v == null || v.removeRow(i, m, f)) : f !== void 0 ? v == null || v.updateRow(
1174
+ i,
1091
1175
  m,
1092
- ls(
1093
- Re[m],
1094
- Ve(e, o, r, c),
1095
- Y,
1096
- a.compute_fields
1176
+ f,
1177
+ bs(
1178
+ we[f],
1179
+ Ue(e, o, n, c),
1180
+ Z,
1181
+ s.compute_fields
1097
1182
  )
1098
- ) : w == null || w.queueRow(
1099
- d,
1100
- h,
1101
- Ve(e, o, r, c)
1183
+ ) : v == null || v.queueRow(
1184
+ i,
1185
+ m,
1186
+ Ue(e, o, n, c)
1102
1187
  );
1103
1188
  return;
1104
1189
  }
1105
- ae((m) => new Set(m).add(e));
1190
+ V((f) => new Set(f).add(e));
1106
1191
  try {
1107
- const m = Ye.get(e);
1192
+ const f = Ge.get(e);
1108
1193
  if (o === 0)
1109
- (m == null ? void 0 : m.id) != null && await k.request(Mn(`/items/${d}/${m.id}${ne}`));
1110
- else if ((m == null ? void 0 : m.id) != null) {
1111
- const f = Ve(e, o, r, c);
1112
- for (const x of Y)
1113
- m[x] != null && m[x] !== "" && (f[x] = m[x]);
1114
- for (const [x, A] of Object.entries(a.compute_fields ?? {})) {
1115
- const Fe = Le(A, { ...m, ...f });
1116
- Fe !== null && (f[x] = Fe);
1194
+ (f == null ? void 0 : f.id) != null && await k.request(es(`/items/${i}/${f.id}${qe}`));
1195
+ else if ((f == null ? void 0 : f.id) != null) {
1196
+ const p = Ue(e, o, n, c);
1197
+ for (const y of Z)
1198
+ f[y] != null && f[y] !== "" && (p[y] = f[y]);
1199
+ for (const [y, K] of Object.entries(s.compute_fields ?? {})) {
1200
+ const Re = Pe(K, { ...f, ...p });
1201
+ Re !== null && (p[y] = Re);
1117
1202
  }
1118
- const v = { ...m, ...f }, { id: _, ...O } = v;
1119
- await k.request(Hr(`/items/${d}/${m.id}${ne}`, O));
1203
+ const S = { ...f, ...p }, { id: q, ...E } = S;
1204
+ await k.request(rr(`/items/${i}/${f.id}${qe}`, E));
1120
1205
  } else
1121
1206
  await k.request(
1122
- Yr(`/items/${d}${ne}`, {
1123
- [h]: y,
1124
- ...Ve(e, o, r, c)
1207
+ sr(`/items/${i}${qe}`, {
1208
+ [m]: b,
1209
+ ...Ue(e, o, n, c)
1125
1210
  })
1126
1211
  );
1127
- j.invalidateQueries({ queryKey: ["o2m-rows", d, h, y] });
1212
+ j.invalidateQueries({ queryKey: ["o2m-rows", i, m, b] });
1128
1213
  } catch {
1129
1214
  } finally {
1130
- ae((m) => {
1131
- const f = new Set(m);
1132
- return f.delete(e), f;
1215
+ V((f) => {
1216
+ const p = new Set(f);
1217
+ return p.delete(e), p;
1133
1218
  });
1134
1219
  }
1135
1220
  }
1136
- async function An(e, t, r) {
1137
- const n = r.trim() === "" ? null : Number(r);
1138
- if (r.trim() !== "" && Number.isNaN(n)) return;
1139
- const l = (p) => {
1140
- const c = { ...p, [t]: n };
1141
- for (const [m, f] of Object.entries(a.compute_fields ?? {})) {
1142
- const v = Le(f, c);
1143
- v !== null && (c[m] = v);
1221
+ async function Vr(e, t, n) {
1222
+ const r = n.trim() === "" ? null : Number(n);
1223
+ if (n.trim() !== "" && Number.isNaN(r)) return;
1224
+ const l = (h) => {
1225
+ const c = { ...h, [t]: r };
1226
+ for (const [f, p] of Object.entries(s.compute_fields ?? {})) {
1227
+ const S = Pe(p, c);
1228
+ S !== null && (c[f] = S);
1144
1229
  }
1145
1230
  return c;
1146
- }, o = z ? void 0 : Ye.get(e);
1231
+ }, o = P ? void 0 : Ge.get(e);
1147
1232
  if ((o == null ? void 0 : o.id) == null) {
1148
- const p = ht.get(e);
1149
- if (p === void 0) return;
1150
- w == null || w.updateRow(d, h, p, l(Re[p]));
1233
+ const h = pt.get(e);
1234
+ if (h === void 0) return;
1235
+ v == null || v.updateRow(i, m, h, l(we[h]));
1151
1236
  return;
1152
1237
  }
1153
- if (He && w) {
1154
- const p = l(o), c = ge.find((f) => String(f.id) === String(o.id)) ?? {}, m = Object.fromEntries(
1155
- Object.entries(p).filter(
1156
- ([f, v]) => f !== "id" && String(v ?? "") !== String(c[f] ?? "")
1238
+ if (Ze && v) {
1239
+ const h = l(o), c = me.find((p) => String(p.id) === String(o.id)) ?? {}, f = Object.fromEntries(
1240
+ Object.entries(h).filter(
1241
+ ([p, S]) => p !== "id" && String(S ?? "") !== String(c[p] ?? "")
1157
1242
  )
1158
1243
  );
1159
- w.cancelPendingEdit(d, h, String(o.id)), Object.keys(m).length > 0 && w.queueEdit(d, h, String(o.id), m);
1244
+ v.cancelPendingEdit(i, m, String(o.id)), Object.keys(f).length > 0 && v.queueEdit(i, m, String(o.id), f);
1160
1245
  return;
1161
1246
  }
1162
- ae((p) => new Set(p).add(e));
1247
+ V((h) => new Set(h).add(e));
1163
1248
  try {
1164
- const { id: p, ...c } = l(o);
1165
- await k.request(Hr(`/items/${d}/${o.id}${ne}`, c)), j.invalidateQueries({ queryKey: ["o2m-rows", d, h, y] });
1249
+ const { id: h, ...c } = l(o);
1250
+ await k.request(rr(`/items/${i}/${o.id}${qe}`, c)), j.invalidateQueries({ queryKey: ["o2m-rows", i, m, b] });
1166
1251
  } catch {
1167
1252
  } finally {
1168
- ae((p) => {
1169
- const c = new Set(p);
1253
+ V((h) => {
1254
+ const c = new Set(h);
1170
1255
  return c.delete(e), c;
1171
1256
  });
1172
1257
  }
1173
1258
  }
1174
- async function Kn(e) {
1259
+ async function Wr(e) {
1175
1260
  if (e == null || e === "" || !g) return;
1176
- const t = String(e), r = Ie(t);
1177
- let n = r;
1178
- Object.keys(r).length <= 1 && (n = await k.request(
1261
+ const t = String(e), n = Ie(t);
1262
+ let r = n;
1263
+ Object.keys(n).length <= 1 && (r = await k.request(
1179
1264
  R(`/items/${g}`, {
1180
1265
  filter: JSON.stringify({ id: { _eq: e } }),
1181
- fields: T,
1266
+ fields: A,
1182
1267
  limit: 1
1183
1268
  })
1184
1269
  ).then((o) => {
1185
- var p;
1186
- return ((p = o.data) == null ? void 0 : p[0]) ?? { id: e };
1270
+ var h;
1271
+ return ((h = o.data) == null ? void 0 : h[0]) ?? { id: e };
1187
1272
  }).catch(() => ({ id: e })));
1188
- const l = (Ne(t) ?? 0) + 1;
1189
- await st(t, String(l), n);
1273
+ const l = (Se(t) ?? 0) + 1;
1274
+ await lt(t, String(l), r);
1190
1275
  }
1191
- const Cn = pe.length, Ft = Object.keys(a.copy_fields ?? {}), We = Object.keys(a.compute_fields ?? {}), Tt = (e, t) => {
1192
- const r = Ne(e);
1193
- if (b)
1194
- return /* @__PURE__ */ s("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: r && r > 0 ? r : "—" });
1195
- const n = ye[e], l = n !== void 0 ? n : r && r > 0 ? String(r) : "", o = Q[e], p = () => X((m) => {
1196
- if (!(e in m)) return m;
1197
- const f = { ...m };
1198
- return delete f[e], f;
1199
- }), c = /* @__PURE__ */ s(
1276
+ const Ur = be.length, Tt = Object.keys(s.copy_fields ?? {}), Me = Object.keys(s.compute_fields ?? {}), Rt = (e, t) => {
1277
+ const n = Se(e);
1278
+ if (w)
1279
+ return /* @__PURE__ */ a("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: n && n > 0 ? n.toLocaleString("en-US") : "—" });
1280
+ const r = ke[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = oe[e], h = () => de((f) => {
1281
+ if (!(e in f)) return f;
1282
+ const p = { ...f };
1283
+ return delete p[e], p;
1284
+ }), c = /* @__PURE__ */ a(
1200
1285
  "input",
1201
1286
  {
1202
1287
  type: "number",
1203
1288
  min: 0,
1204
- step: Ot(le) ? 1 : "any",
1205
- disabled: b,
1289
+ step: Pt(U) ? 1 : "any",
1290
+ disabled: w,
1206
1291
  value: l,
1207
1292
  placeholder: "0",
1208
1293
  "aria-invalid": (o == null ? void 0 : o.kind) === "error" || void 0,
1209
- onFocus: p,
1210
- onChange: (m) => ue((f) => ({ ...f, [e]: m.target.value })),
1211
- onBlur: (m) => {
1212
- const f = m.target.value, v = ps(f, le);
1213
- if (v) {
1214
- ue((_) => {
1215
- const O = { ..._ };
1216
- return delete O[e], O;
1217
- }), X((_) => ({
1218
- ..._,
1219
- [e]: { kind: "error", message: ys(v, f) }
1294
+ onFocus: h,
1295
+ onChange: (f) => le((p) => ({ ...p, [e]: f.target.value })),
1296
+ onBlur: (f) => {
1297
+ const p = f.target.value, S = _s(p, U);
1298
+ if (S) {
1299
+ le((q) => {
1300
+ const E = { ...q };
1301
+ return delete E[e], E;
1302
+ }), de((q) => ({
1303
+ ...q,
1304
+ [e]: { kind: "error", message: $s(S, p) }
1220
1305
  }));
1221
1306
  return;
1222
1307
  }
1223
- ue((_) => {
1224
- const O = { ..._ };
1225
- return delete O[e], O;
1226
- }), st(e, f, t);
1308
+ le((q) => {
1309
+ const E = { ...q };
1310
+ return delete E[e], E;
1311
+ }), lt(e, p, t);
1227
1312
  },
1228
- onKeyDown: (m) => {
1229
- m.key === "Enter" && m.currentTarget.blur();
1313
+ onKeyDown: (f) => {
1314
+ f.key === "Enter" && f.currentTarget.blur();
1230
1315
  },
1231
- className: C(
1316
+ className: I(
1232
1317
  "h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan disabled:opacity-50 dark:border-border dark:bg-background",
1233
1318
  (o == null ? void 0 : o.kind) === "error" && "border-red-400 dark:border-red-600"
1234
1319
  )
@@ -1243,9 +1328,9 @@ function Gs({
1243
1328
  className: "mt-0.5 flex max-w-[220px] items-start gap-1 text-right text-[11px] leading-snug text-red-600 dark:text-red-400",
1244
1329
  "data-catalog-qty-error": !0,
1245
1330
  children: [
1246
- /* @__PURE__ */ s(ar, { className: "mt-px h-3 w-3 shrink-0" }),
1331
+ /* @__PURE__ */ a(dn, { className: "mt-px h-3 w-3 shrink-0" }),
1247
1332
  o.message,
1248
- r && r > 0 ? ` — still ${r}` : ""
1333
+ n && n > 0 ? ` — still ${n.toLocaleString("en-US")}` : ""
1249
1334
  ]
1250
1335
  }
1251
1336
  ),
@@ -1256,23 +1341,23 @@ function Gs({
1256
1341
  "data-catalog-qty-remove": !0,
1257
1342
  className: "mt-1 flex max-w-[240px] flex-wrap items-center justify-end gap-1.5 text-right text-[11px] leading-snug text-slate-700 dark:text-slate-200",
1258
1343
  children: [
1259
- /* @__PURE__ */ s("span", { children: "Remove this line?" }),
1260
- /* @__PURE__ */ s(
1344
+ /* @__PURE__ */ a("span", { children: "Remove this line?" }),
1345
+ /* @__PURE__ */ a(
1261
1346
  "button",
1262
1347
  {
1263
1348
  type: "button",
1264
- onClick: p,
1349
+ onClick: h,
1265
1350
  className: "h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
1266
1351
  children: "Keep"
1267
1352
  }
1268
1353
  ),
1269
- /* @__PURE__ */ s(
1354
+ /* @__PURE__ */ a(
1270
1355
  "button",
1271
1356
  {
1272
1357
  type: "button",
1273
1358
  onClick: () => {
1274
- const m = o.row;
1275
- p(), st(e, "0", m, { confirmedRemove: !0 });
1359
+ const f = o.row;
1360
+ h(), lt(e, "0", f, { confirmedRemove: !0 });
1276
1361
  },
1277
1362
  className: "h-6 rounded bg-red-600 px-2 text-[11px] font-medium text-white hover:bg-red-700",
1278
1363
  children: "Remove"
@@ -1282,42 +1367,42 @@ function Gs({
1282
1367
  }
1283
1368
  )
1284
1369
  ] });
1285
- }, Jn = (e, t, r) => {
1286
- const n = `${e}:${t}`, l = Se[n], o = () => me((f) => {
1287
- if (!(n in f)) return f;
1288
- const v = { ...f };
1289
- return delete v[n], v;
1290
- }), p = r[t] == null ? "" : String(r[t]), c = L.find((f) => f.field === t), m = !Ot(c == null ? void 0 : c.type);
1370
+ }, Mr = (e, t, n) => {
1371
+ const r = `${e}:${t}`, l = he[r], o = () => Ee((p) => {
1372
+ if (!(r in p)) return p;
1373
+ const S = { ...p };
1374
+ return delete S[r], S;
1375
+ }), h = n[t] == null ? "" : String(n[t]), c = te.find((p) => p.field === t), f = !Pt(c == null ? void 0 : c.type);
1291
1376
  return /* @__PURE__ */ u("span", { className: "inline-flex shrink-0 flex-col items-end", children: [
1292
- /* @__PURE__ */ s(
1377
+ /* @__PURE__ */ a(
1293
1378
  "input",
1294
1379
  {
1295
1380
  type: "number",
1296
1381
  min: 0,
1297
- step: m ? "0.01" : "any",
1298
- defaultValue: p,
1382
+ step: f ? "0.01" : "any",
1383
+ defaultValue: h,
1299
1384
  "aria-invalid": !!l || void 0,
1300
1385
  onFocus: o,
1301
- onBlur: (f) => {
1302
- const v = f.target.value;
1303
- if (v !== p) {
1304
- const _ = c, O = (_ == null ? void 0 : _.label) || M(t), x = cr(v, { type: _ == null ? void 0 : _.type, label: O }), A = x.ok ? (m ? os(v, O) : null) ?? B(t, x.value, r) : x.message;
1305
- if (A) {
1306
- f.target.value = p, me((Fe) => ({ ...Fe, [n]: A }));
1386
+ onBlur: (p) => {
1387
+ const S = p.target.value;
1388
+ if (S !== h) {
1389
+ const q = c, E = (q == null ? void 0 : q.label) || D(t), y = hn(S, { type: q == null ? void 0 : q.type, label: E }), K = y.ok ? (f ? ps(S, E) : null) ?? M(t, y.value, n) : y.message;
1390
+ if (K) {
1391
+ p.target.value = h, Ee((Re) => ({ ...Re, [r]: K }));
1307
1392
  return;
1308
1393
  }
1309
1394
  }
1310
- An(e, t, v);
1395
+ Vr(e, t, S);
1311
1396
  },
1312
- onKeyDown: (f) => {
1313
- f.key === "Enter" && f.currentTarget.blur();
1397
+ onKeyDown: (p) => {
1398
+ p.key === "Enter" && p.currentTarget.blur();
1314
1399
  },
1315
- className: C(
1400
+ className: I(
1316
1401
  "h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background",
1317
1402
  l && "border-red-400 dark:border-red-600"
1318
1403
  )
1319
1404
  },
1320
- `${n}:${p}`
1405
+ `${r}:${h}`
1321
1406
  ),
1322
1407
  l && /* @__PURE__ */ u(
1323
1408
  "span",
@@ -1326,58 +1411,58 @@ function Gs({
1326
1411
  className: "mt-0.5 flex max-w-[220px] items-start gap-1 text-right text-[11px] leading-snug text-red-600 dark:text-red-400",
1327
1412
  "data-catalog-cell-error": !0,
1328
1413
  children: [
1329
- /* @__PURE__ */ s(ar, { className: "mt-px h-3 w-3 shrink-0" }),
1414
+ /* @__PURE__ */ a(dn, { className: "mt-px h-3 w-3 shrink-0" }),
1330
1415
  l,
1331
- p !== "" ? ` — still ${p}` : ""
1416
+ h !== "" ? ` — still ${h}` : ""
1332
1417
  ]
1333
1418
  }
1334
1419
  )
1335
- ] }, n);
1420
+ ] }, r);
1336
1421
  };
1337
- return !g && q ? /* @__PURE__ */ u("div", { className: "space-y-2 py-1", "aria-busy": "true", children: [
1338
- /* @__PURE__ */ s("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1339
- /* @__PURE__ */ s("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1340
- ] }) : g ? /* @__PURE__ */ u("div", { ref: Er, className: "space-y-3", children: [
1341
- !b && /* @__PURE__ */ u(ve, { children: [
1422
+ return !g && W ? /* @__PURE__ */ u("div", { className: "space-y-2 py-1", "aria-busy": "true", children: [
1423
+ /* @__PURE__ */ a("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1424
+ /* @__PURE__ */ a("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1425
+ ] }) : g ? /* @__PURE__ */ u("div", { ref: Jn, className: "space-y-3", children: [
1426
+ !w && /* @__PURE__ */ u(_e, { children: [
1342
1427
  /* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
1343
1428
  /* @__PURE__ */ u("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
1344
- /* @__PURE__ */ s(Rt, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
1345
- /* @__PURE__ */ s(
1429
+ /* @__PURE__ */ a(Et, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
1430
+ /* @__PURE__ */ a(
1346
1431
  "input",
1347
1432
  {
1348
- value: U,
1349
- onChange: (e) => Ae(e.target.value),
1433
+ value: X,
1434
+ onChange: (e) => ge(e.target.value),
1350
1435
  placeholder: "Search catalog…",
1351
1436
  className: "w-full bg-transparent text-[12px] outline-none placeholder:text-slate-400"
1352
1437
  }
1353
1438
  ),
1354
- te && /* @__PURE__ */ u(
1439
+ se && /* @__PURE__ */ u(
1355
1440
  "button",
1356
1441
  {
1357
1442
  type: "button",
1358
- "aria-pressed": re,
1359
- "aria-disabled": je === null ? "true" : void 0,
1443
+ "aria-pressed": ae,
1444
+ "aria-disabled": Te === null ? "true" : void 0,
1360
1445
  onClick: () => {
1361
- je !== null && It(!Nr);
1446
+ Te !== null && Vt(!$n);
1362
1447
  },
1363
- "data-catalog-in-stock": re ? "on" : "off",
1364
- "data-tip": je === null ? `Choose ${cn ?? "where stock is counted"} to show only items in stock there` : re ? "Showing only items with stock on hand — click to show everything" : "Show only items with stock on hand",
1365
- className: C(
1448
+ "data-catalog-in-stock": ae ? "on" : "off",
1449
+ "data-tip": Te === null ? `Choose ${xr ?? "where stock is counted"} to show only items in stock there` : ae ? "Showing only items with stock on hand — click to show everything" : "Show only items with stock on hand",
1450
+ className: I(
1366
1451
  "inline-flex h-6 max-w-[220px] shrink-0 items-center gap-1 rounded border px-1.5 text-[11px] font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan aria-disabled:cursor-not-allowed aria-disabled:opacity-50",
1367
- re ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-[#00728d] dark:border-nvr-cyan/40 dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "border-slate-200 bg-white text-slate-600 hover:bg-muted dark:border-border dark:bg-background dark:text-slate-300"
1452
+ ae ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-[#00728d] dark:border-nvr-cyan/40 dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "border-slate-200 bg-white text-slate-600 hover:bg-muted dark:border-border dark:bg-background dark:text-slate-300"
1368
1453
  ),
1369
1454
  children: [
1370
- pn ? /* @__PURE__ */ s(ce, { className: "h-3 w-3 shrink-0 animate-spin" }) : /* @__PURE__ */ s(zn, { className: "h-3 w-3 shrink-0" }),
1455
+ vr ? /* @__PURE__ */ a(ce, { className: "h-3 w-3 shrink-0 animate-spin" }) : /* @__PURE__ */ a(Dr, { className: "h-3 w-3 shrink-0" }),
1371
1456
  /* @__PURE__ */ u("span", { className: "truncate", children: [
1372
1457
  "In stock",
1373
- je !== null && Je && wr != null && /* @__PURE__ */ u(ve, { children: [
1458
+ Te !== null && Je && qn != null && /* @__PURE__ */ u(_e, { children: [
1374
1459
  " at ",
1375
- /* @__PURE__ */ s(
1376
- Ss,
1460
+ /* @__PURE__ */ a(
1461
+ Es,
1377
1462
  {
1378
- parentCollection: N,
1463
+ parentCollection: x,
1379
1464
  field: Je,
1380
- id: wr
1465
+ id: qn
1381
1466
  }
1382
1467
  )
1383
1468
  ] })
@@ -1385,117 +1470,117 @@ function Gs({
1385
1470
  ]
1386
1471
  }
1387
1472
  ),
1388
- te && je === null && /* @__PURE__ */ s("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
1473
+ se && Te === null && /* @__PURE__ */ a("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
1389
1474
  /* @__PURE__ */ u("span", { className: "shrink-0 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-muted dark:text-slate-400", children: [
1390
- Cn,
1475
+ Ur,
1391
1476
  " picked"
1392
1477
  ] }),
1393
- /* @__PURE__ */ s(ir, { show: Pe.customized, onReset: Pe.reset })
1478
+ /* @__PURE__ */ a(cn, { show: Le.customized, onReset: Le.reset })
1394
1479
  ] }),
1395
- Rr && // Sticky: the catalog list is tall and the page scroller carries it —
1480
+ Kn && // Sticky: the catalog list is tall and the page scroller carries it —
1396
1481
  // without this the labels scroll away and favorites/section rows
1397
1482
  // read as headerless columns. Opaque bg (not the /60 tint) so rows
1398
1483
  // never bleed through while pinned.
1399
1484
  /* @__PURE__ */ u(
1400
1485
  "div",
1401
1486
  {
1402
- ref: $n,
1487
+ ref: Er,
1403
1488
  className: "sticky top-0 z-[5] flex items-center gap-4 border-b border-slate-200 bg-slate-50 px-3 py-1 text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:border-border dark:bg-muted dark:text-slate-400",
1404
1489
  children: [
1405
- a.favorites && /* @__PURE__ */ s("span", { className: "w-[18px] shrink-0" }),
1406
- $t(Pe, "item", "Item", "w-36 shrink-0"),
1407
- _t.map((e) => {
1408
- const [t, r] = Lr(e);
1490
+ s.favorites && /* @__PURE__ */ a("span", { className: "w-[18px] shrink-0" }),
1491
+ $t(Le, "item", "Item", "w-36 shrink-0"),
1492
+ St.map((e) => {
1493
+ const [t, n] = In(e);
1409
1494
  return $t(
1410
- Pe,
1495
+ Le,
1411
1496
  e.field,
1412
- e.label ?? M(e.field.split(".")[0]),
1497
+ e.label ?? D(e.field.split(".")[0]),
1413
1498
  t,
1414
- r
1499
+ n
1415
1500
  );
1416
1501
  }),
1417
- tr.map(
1502
+ sn.map(
1418
1503
  (e) => $t(
1419
- Pe,
1504
+ Le,
1420
1505
  `rel:${e.key}`,
1421
- e.label ?? M(e.key),
1506
+ e.label ?? D(e.key),
1422
1507
  "w-20 shrink-0",
1423
1508
  "text-right"
1424
1509
  )
1425
1510
  ),
1426
- /* @__PURE__ */ s("span", { "aria-hidden": !0, className: "ml-auto" }),
1427
- /* @__PURE__ */ s("span", { "aria-hidden": !0, className: "w-3.5 shrink-0" }),
1428
- /* @__PURE__ */ s("span", { className: "w-20 shrink-0 text-right", children: "Qty" })
1511
+ /* @__PURE__ */ a("span", { "aria-hidden": !0, className: "ml-auto" }),
1512
+ /* @__PURE__ */ a("span", { "aria-hidden": !0, className: "w-3.5 shrink-0" }),
1513
+ /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right", children: "Qty" })
1429
1514
  ]
1430
1515
  }
1431
1516
  ),
1432
- U.trim().length > 0 && nt.length === 0 && Ht && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 border-b border-slate-100 px-3 py-3 text-slate-500 dark:border-border/50 dark:text-slate-400", children: [
1433
- /* @__PURE__ */ s(ce, { className: "h-3.5 w-3.5 animate-spin" }),
1517
+ X.trim().length > 0 && it.length === 0 && Gt && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 border-b border-slate-100 px-3 py-3 text-slate-500 dark:border-border/50 dark:text-slate-400", children: [
1518
+ /* @__PURE__ */ a(ce, { className: "h-3.5 w-3.5 animate-spin" }),
1434
1519
  " Searching the catalog…"
1435
1520
  ] }),
1436
- U.trim().length > 0 && nt.length === 0 && !Ht && /* @__PURE__ */ s("p", { className: "px-3 py-4 text-center text-slate-500 dark:text-slate-400", children: re && Be.length > 0 ? /* @__PURE__ */ u(ve, { children: [
1521
+ X.trim().length > 0 && it.length === 0 && !Gt && /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-500 dark:text-slate-400", children: ae && Ve.length > 0 ? /* @__PURE__ */ u(_e, { children: [
1437
1522
  'Nothing in stock matches "',
1438
- U.trim(),
1523
+ X.trim(),
1439
1524
  '" —',
1440
1525
  " ",
1441
1526
  /* @__PURE__ */ u(
1442
1527
  "button",
1443
1528
  {
1444
1529
  type: "button",
1445
- onClick: () => It(!1),
1530
+ onClick: () => Vt(!1),
1446
1531
  className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
1447
1532
  children: [
1448
1533
  "show ",
1449
- Be.length,
1534
+ Ve.length,
1450
1535
  " out of stock"
1451
1536
  ]
1452
1537
  }
1453
1538
  )
1454
- ] }) : /* @__PURE__ */ u(ve, { children: [
1539
+ ] }) : /* @__PURE__ */ u(_e, { children: [
1455
1540
  'No items match "',
1456
- U.trim(),
1541
+ X.trim(),
1457
1542
  '"'
1458
1543
  ] }) }),
1459
- U.trim().length > 0 && nt.length > 0 && /* @__PURE__ */ u(at, { children: [
1544
+ X.trim().length > 0 && it.length > 0 && /* @__PURE__ */ u(ot, { children: [
1460
1545
  /* @__PURE__ */ u("div", { className: "flex w-full items-center gap-1.5 border-b border-t border-slate-200 bg-sky-50/70 px-2 py-1.5 dark:border-border dark:bg-sky-900/10", children: [
1461
- /* @__PURE__ */ s(Rt, { className: "h-3 w-3 shrink-0 text-sky-500" }),
1462
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
1463
- /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: nt.length }),
1546
+ /* @__PURE__ */ a(Et, { className: "h-3 w-3 shrink-0 text-sky-500" }),
1547
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Search results" }),
1548
+ /* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: it.length }),
1464
1549
  /* @__PURE__ */ u("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
1465
1550
  "across the entire catalog",
1466
- re ? ", in stock only" : "",
1551
+ ae ? ", in stock only" : "",
1467
1552
  " — enter a quantity to add"
1468
1553
  ] }),
1469
- Ht && /* @__PURE__ */ s(ce, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" })
1554
+ Gt && /* @__PURE__ */ a(ce, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" })
1470
1555
  ] }),
1471
- nt.map((e, t) => {
1472
- const r = String(e.id), n = Ne(r);
1556
+ it.map((e, t) => {
1557
+ const n = String(e.id), r = Se(n);
1473
1558
  return /* @__PURE__ */ u(
1474
1559
  "div",
1475
1560
  {
1476
- className: C(
1561
+ className: I(
1477
1562
  "flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
1478
1563
  t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1479
- (n ?? 0) > 0 && "bg-nvr-cyan/5"
1564
+ (r ?? 0) > 0 && "bg-nvr-cyan/5"
1480
1565
  ),
1481
1566
  children: [
1482
- Jt(r),
1483
- sr(
1484
- r,
1485
- ze(J, e),
1567
+ Qt(n),
1568
+ on(
1569
+ n,
1570
+ ze(z, e),
1486
1571
  (() => {
1487
- const l = bn(e), o = un.has(r);
1488
- return !l && !o ? null : /* @__PURE__ */ u(ve, { children: [
1489
- o && /* @__PURE__ */ s(
1572
+ const l = Nr(e), o = yr.has(n);
1573
+ return !l && !o ? null : /* @__PURE__ */ u(_e, { children: [
1574
+ o && /* @__PURE__ */ a(
1490
1575
  "span",
1491
1576
  {
1492
1577
  "data-catalog-recent": !0,
1493
- "data-tip": `You added this in the last ${yt} days`,
1578
+ "data-tip": `You added this in the last ${kt} days`,
1494
1579
  className: "shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-600 dark:bg-muted dark:text-slate-400",
1495
1580
  children: "Recent"
1496
1581
  }
1497
1582
  ),
1498
- l && /* @__PURE__ */ s(
1583
+ l && /* @__PURE__ */ a(
1499
1584
  "span",
1500
1585
  {
1501
1586
  "data-catalog-match-why": !0,
@@ -1507,611 +1592,612 @@ function Gs({
1507
1592
  )
1508
1593
  ] });
1509
1594
  })(),
1510
- he
1595
+ ue
1511
1596
  ),
1512
- nr(r, e, he),
1513
- /* @__PURE__ */ s("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(r) && /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) }),
1514
- Tt(r, e)
1597
+ ln(n, e, ue),
1598
+ /* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(n) && /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) }),
1599
+ Rt(n, e)
1515
1600
  ]
1516
1601
  },
1517
- r
1602
+ n
1518
1603
  );
1519
1604
  })
1520
1605
  ] }),
1521
- D.length > 0 && !U.trim() && /* @__PURE__ */ u("p", { className: "px-3 py-6 text-center text-slate-400", children: [
1606
+ ee.length > 0 && !X.trim() && /* @__PURE__ */ u("p", { className: "px-3 py-6 text-center text-slate-400", children: [
1522
1607
  "Search the full catalog above, or select",
1523
1608
  " ",
1524
- D.map((e) => {
1609
+ ee.map((e) => {
1525
1610
  var t;
1526
- return ((t = P == null ? void 0 : P.fieldLabels) == null ? void 0 : t[e]) ?? M(e);
1611
+ return ((t = O == null ? void 0 : O.fieldLabels) == null ? void 0 : t[e]) ?? D(e);
1527
1612
  }).join(", "),
1528
1613
  " ",
1529
1614
  "to browse by category"
1530
1615
  ] }),
1531
- D.length === 0 && (qe || dt) && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 py-6 text-slate-500 dark:text-slate-400", children: [
1532
- /* @__PURE__ */ s(ce, { className: "h-4 w-4 animate-spin" }),
1616
+ ee.length === 0 && (pn || ut) && /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 py-6 text-slate-500 dark:text-slate-400", children: [
1617
+ /* @__PURE__ */ a(ce, { className: "h-4 w-4 animate-spin" }),
1533
1618
  " Loading catalog…"
1534
1619
  ] }),
1535
- D.length === 0 && !qe && !dt && jt.length === 0 && /* @__PURE__ */ s("p", { className: "px-3 py-6 text-center text-slate-500 dark:text-slate-400", children: re && de.length > 0 ? /* @__PURE__ */ u(ve, { children: [
1620
+ ee.length === 0 && !pn && !ut && Ft.length === 0 && /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-slate-500 dark:text-slate-400", children: ae && re.length > 0 ? /* @__PURE__ */ u(_e, { children: [
1536
1621
  "Nothing in this catalog is in stock here —",
1537
1622
  " ",
1538
1623
  /* @__PURE__ */ u(
1539
1624
  "button",
1540
1625
  {
1541
1626
  type: "button",
1542
- onClick: () => It(!1),
1627
+ onClick: () => Vt(!1),
1543
1628
  className: "font-medium text-[#00728d] underline-offset-2 hover:underline dark:text-nvr-cyan",
1544
1629
  children: [
1545
1630
  "show all ",
1546
- de.length
1631
+ re.length
1547
1632
  ]
1548
1633
  }
1549
1634
  )
1550
1635
  ] }) : "No catalog items" }),
1551
- a.favorites && /* @__PURE__ */ u(at, { children: [
1636
+ s.favorites && /* @__PURE__ */ u(ot, { children: [
1552
1637
  /* @__PURE__ */ u("div", { className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-amber-50/70 px-2 py-1 dark:border-border dark:bg-amber-900/10", children: [
1553
1638
  /* @__PURE__ */ u(
1554
1639
  "button",
1555
1640
  {
1556
1641
  type: "button",
1557
- onClick: () => xe((e) => {
1642
+ onClick: () => $e((e) => {
1558
1643
  const t = new Set(e);
1559
1644
  return t.has("__favorites__") ? t.delete("__favorites__") : t.add("__favorites__"), t;
1560
1645
  }),
1561
1646
  className: "flex min-w-0 flex-1 items-center gap-1.5 py-0.5 text-left",
1562
1647
  children: [
1563
- /* @__PURE__ */ s(
1564
- or,
1648
+ /* @__PURE__ */ a(
1649
+ mn,
1565
1650
  {
1566
- className: C(
1651
+ className: I(
1567
1652
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
1568
- !se.has("__favorites__") && "rotate-90"
1653
+ !fe.has("__favorites__") && "rotate-90"
1569
1654
  )
1570
1655
  }
1571
1656
  ),
1572
- /* @__PURE__ */ s(it, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
1573
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Favorites" }),
1574
- /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: Yt.length })
1657
+ /* @__PURE__ */ a(dt, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
1658
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Favorites" }),
1659
+ /* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: Xt.length })
1575
1660
  ]
1576
1661
  }
1577
1662
  ),
1578
- /* @__PURE__ */ s(
1663
+ /* @__PURE__ */ a(
1579
1664
  "button",
1580
1665
  {
1581
- ref: yr,
1666
+ ref: vn,
1582
1667
  type: "button",
1583
- onClick: () => xr(!0),
1668
+ onClick: () => Nn(!0),
1584
1669
  className: "shrink-0 rounded border border-amber-200 bg-white px-2 py-0.5 text-[10px] font-semibold text-amber-700 transition-colors hover:border-amber-300 hover:bg-amber-50 dark:border-amber-400/30 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-400/10",
1585
1670
  children: "Manage"
1586
1671
  }
1587
1672
  )
1588
1673
  ] }),
1589
- !se.has("__favorites__") && Yt.length === 0 && /* @__PURE__ */ s("p", { className: "border-b border-slate-100 px-3 py-2 text-center text-[11px] text-slate-400 dark:border-border/50", children: Ze.length > 0 ? "None of your favorites are in stock here." : "No favorites yet — Manage lets you search the full catalog and star items." }),
1590
- !se.has("__favorites__") && Yt.map((e, t) => {
1591
- const r = String(e.id), n = Ne(r), l = Zt(r);
1674
+ !fe.has("__favorites__") && Xt.length === 0 && /* @__PURE__ */ a("p", { className: "border-b border-slate-100 px-3 py-2 text-center text-[11px] text-slate-400 dark:border-border/50", children: Xe.length > 0 ? "None of your favorites are in stock here." : "No favorites yet — Manage lets you search the full catalog and star items." }),
1675
+ !fe.has("__favorites__") && Xt.map((e, t) => {
1676
+ const n = String(e.id), r = Se(n), l = en(n);
1592
1677
  return /* @__PURE__ */ u(
1593
1678
  "div",
1594
1679
  {
1595
- className: C(
1680
+ className: I(
1596
1681
  "flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
1597
1682
  t % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1598
- (n ?? 0) > 0 && "bg-nvr-cyan/5",
1683
+ (r ?? 0) > 0 && "bg-nvr-cyan/5",
1599
1684
  l && "bg-amber-50 dark:bg-amber-900/15"
1600
1685
  ),
1601
1686
  children: [
1602
- Jt(r),
1603
- sr(r, ze(J, e)),
1604
- nr(r, e),
1605
- /* @__PURE__ */ s("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(r) ? /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) : l && /* @__PURE__ */ s(
1606
- De,
1687
+ Qt(n),
1688
+ on(n, ze(z, e)),
1689
+ ln(n, e),
1690
+ /* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(n) ? /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) : l && /* @__PURE__ */ a(
1691
+ Be,
1607
1692
  {
1608
1693
  className: "h-3.5 w-3.5 text-amber-500",
1609
- "aria-label": `${Gt} ${l.available} — ${l.qty} requested`
1694
+ "aria-label": `${tn} ${l.available} — ${l.qty} requested`
1610
1695
  }
1611
1696
  ) }),
1612
- Tt(r, e)
1697
+ Rt(n, e)
1613
1698
  ]
1614
1699
  },
1615
- r
1700
+ n
1616
1701
  );
1617
1702
  })
1618
1703
  ] }),
1619
- D.length === 0 && jt.map((e) => {
1620
- const t = se.has(e.name), r = e.items.reduce(
1621
- (n, l) => n + ((Ne(l.id) ?? 0) > 0 ? 1 : 0),
1704
+ ee.length === 0 && Ft.map((e) => {
1705
+ const t = fe.has(e.name), n = e.items.reduce(
1706
+ (r, l) => r + ((Se(l.id) ?? 0) > 0 ? 1 : 0),
1622
1707
  0
1623
1708
  );
1624
- return /* @__PURE__ */ u(at, { children: [
1709
+ return /* @__PURE__ */ u(ot, { children: [
1625
1710
  /* @__PURE__ */ u(
1626
1711
  "button",
1627
1712
  {
1628
1713
  type: "button",
1629
- onClick: () => xe((n) => {
1630
- const l = new Set(n);
1714
+ onClick: () => $e((r) => {
1715
+ const l = new Set(r);
1631
1716
  return l.has(e.name) ? l.delete(e.name) : l.add(e.name), l;
1632
1717
  }),
1633
1718
  className: "flex w-full items-center gap-1.5 border-b border-slate-200 bg-slate-100/80 px-2 py-1.5 text-left dark:border-border dark:bg-muted",
1634
1719
  children: [
1635
- /* @__PURE__ */ s(
1636
- or,
1720
+ /* @__PURE__ */ a(
1721
+ mn,
1637
1722
  {
1638
- className: C(
1723
+ className: I(
1639
1724
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
1640
1725
  !t && "rotate-90"
1641
1726
  )
1642
1727
  }
1643
1728
  ),
1644
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: e.name }),
1645
- /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: e.items.length }),
1646
- r > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
1647
- r,
1729
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: e.name }),
1730
+ /* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: e.items.length }),
1731
+ n > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
1732
+ n,
1648
1733
  " picked"
1649
1734
  ] })
1650
1735
  ]
1651
1736
  }
1652
1737
  ),
1653
- !t && e.items.map((n, l) => {
1654
- const o = Ne(n.id), p = Zt(n.id);
1738
+ !t && e.items.map((r, l) => {
1739
+ const o = Se(r.id), h = en(r.id);
1655
1740
  return /* @__PURE__ */ u(
1656
1741
  "div",
1657
1742
  {
1658
- className: C(
1743
+ className: I(
1659
1744
  "flex items-center gap-4 border-b border-slate-100 px-3 py-1 dark:border-border/50",
1660
1745
  l % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1661
1746
  (o ?? 0) > 0 && "bg-nvr-cyan/5",
1662
- p && "bg-amber-50 dark:bg-amber-900/15"
1747
+ h && "bg-amber-50 dark:bg-amber-900/15"
1663
1748
  ),
1664
1749
  children: [
1665
- Jt(n.id),
1666
- sr(n.id, n.label),
1667
- nr(n.id, n.row),
1668
- /* @__PURE__ */ s("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(n.id) ? /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) : p && /* @__PURE__ */ s(
1669
- De,
1750
+ Qt(r.id),
1751
+ on(r.id, r.label),
1752
+ ln(r.id, r.row),
1753
+ /* @__PURE__ */ a("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: ie.has(r.id) ? /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" }) : h && /* @__PURE__ */ a(
1754
+ Be,
1670
1755
  {
1671
1756
  className: "h-3.5 w-3.5 text-amber-500",
1672
- "aria-label": `${Gt} ${p.available} — ${p.qty} requested`
1757
+ "aria-label": `${tn} ${h.available} — ${h.qty} requested`
1673
1758
  }
1674
1759
  ) }),
1675
- Tt(n.id, n.row)
1760
+ Rt(r.id, r.row)
1676
1761
  ]
1677
1762
  },
1678
- n.id
1763
+ r.id
1679
1764
  );
1680
1765
  })
1681
1766
  ] }, e.name);
1682
1767
  })
1683
1768
  ] }),
1684
- (a.builders ?? []).filter((e) => Gr(e.show_when, i)).map((e) => /* @__PURE__ */ s(
1685
- _s,
1769
+ (s.builders ?? []).filter((e) => ir(e.show_when, N)).map((e) => /* @__PURE__ */ a(
1770
+ Ps,
1686
1771
  {
1687
1772
  builder: e,
1688
- defaultItemField: a.item_field,
1773
+ defaultItemField: s.item_field,
1689
1774
  catalogCol: g,
1690
- catalogFields: T,
1691
- tmpl: J,
1692
- currentQty: Ne,
1693
- addQty: (t, r, n) => st(t, String(r), n),
1694
- qtyStep: Ot(le) ? 1 : "any",
1695
- readOnly: b
1775
+ catalogFields: A,
1776
+ tmpl: z,
1777
+ currentQty: Se,
1778
+ addQty: (t, n, r) => lt(t, String(n), r),
1779
+ qtyStep: Pt(U) ? 1 : "any",
1780
+ readOnly: w
1696
1781
  },
1697
1782
  e.label
1698
1783
  ))
1699
1784
  ] }),
1700
1785
  /* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
1701
1786
  /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2 border-b border-slate-200 bg-slate-50 px-3 py-2 dark:border-border dark:bg-muted", children: [
1702
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Summary" }),
1703
- !b && /* @__PURE__ */ u("div", { className: "flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
1704
- a.upload_template && !z && ee && N && /* @__PURE__ */ s(
1705
- ts,
1787
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Summary" }),
1788
+ !w && /* @__PURE__ */ u("div", { className: "flex items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
1789
+ s.upload_template && !P && ye && x && /* @__PURE__ */ a(
1790
+ ds,
1706
1791
  {
1707
- collection: N,
1792
+ collection: x,
1708
1793
  templateFilter: (e) => {
1709
1794
  var t;
1710
- return e.name === a.upload_template && ((t = e.reimport) == null ? void 0 : t.enabled) === !0;
1795
+ return e.name === s.upload_template && ((t = e.reimport) == null ? void 0 : t.enabled) === !0;
1711
1796
  },
1712
1797
  getLabel: (e) => {
1713
1798
  var t;
1714
1799
  return ((t = e.reimport) == null ? void 0 : t.button_label) ?? e.button_label;
1715
1800
  },
1716
- onParsed: (e, t) => ee(e, t),
1801
+ onParsed: (e, t) => ye(e, t),
1717
1802
  compact: !0
1718
1803
  }
1719
1804
  ),
1720
- /* @__PURE__ */ s("div", { className: "w-64", children: /* @__PURE__ */ s(
1721
- fs,
1805
+ /* @__PURE__ */ a("div", { className: "w-64", children: /* @__PURE__ */ a(
1806
+ ws,
1722
1807
  {
1723
1808
  collection: g,
1724
1809
  value: null,
1725
- onChange: (e) => void Kn(e),
1726
- placeholder: "+ Add any item…"
1810
+ onChange: (e) => void Wr(e),
1811
+ placeholder: "+ Add any item…",
1812
+ displayTemplate: Ks(z, s.columns)
1727
1813
  }
1728
1814
  ) })
1729
1815
  ] })
1730
1816
  ] }),
1731
- pe.length === 0 ? /* @__PURE__ */ s("p", { className: "px-3 py-4 text-center text-slate-400", children: "Nothing picked yet" }) : (() => {
1732
- const e = Tr.filter((c) => !c.format), t = e[0], r = e.slice(1), n = Tr.filter((c) => !!c.format), l = (c, m) => m === "presence" ? c == null || c === "" || Number(c) === 0 ? "No" : "Yes" : c === !0 || c === "true" ? "✓" : c === !1 || c === "false" || c == null || c === "" ? "—" : ke(c, m), o = (c, m) => m ? $t(
1733
- we,
1734
- m,
1817
+ be.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-400", children: "Nothing picked yet" }) : (() => {
1818
+ const e = Ln.filter((c) => !c.format), t = e[0], n = e.slice(1), r = Ln.filter((c) => !!c.format), l = (c, f) => f === "presence" ? c == null || c === "" || Number(c) === 0 ? "No" : "Yes" : c === !0 || c === "true" ? "✓" : c === !1 || c === "false" || c == null || c === "" ? "—" : Ne(c, f), o = (c, f) => f ? $t(
1819
+ ve,
1820
+ f,
1735
1821
  c,
1736
1822
  "w-20 shrink-0",
1737
1823
  "text-right text-[11px] font-medium text-slate-500 dark:text-slate-400"
1738
- ) : /* @__PURE__ */ s("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500 dark:text-slate-400", children: c }), p = (c) => Y.includes(c) && !b ? void 0 : `s:${c}`;
1824
+ ) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[11px] font-medium text-slate-500 dark:text-slate-400", children: c }), h = (c) => Z.includes(c) && !w ? void 0 : `s:${c}`;
1739
1825
  return /* @__PURE__ */ u("div", { children: [
1740
1826
  /* @__PURE__ */ u("div", { className: "flex items-center gap-4 border-b border-slate-200 px-3 py-1.5 dark:border-border", children: [
1741
1827
  /* @__PURE__ */ u("span", { className: "flex flex-1 items-center gap-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
1742
1828
  "Item",
1743
- b && /* @__PURE__ */ s(
1744
- ir,
1829
+ w && /* @__PURE__ */ a(
1830
+ cn,
1745
1831
  {
1746
- show: we.customized,
1747
- onReset: we.reset,
1832
+ show: ve.customized,
1833
+ onReset: ve.reset,
1748
1834
  className: "-my-1"
1749
1835
  }
1750
1836
  )
1751
1837
  ] }),
1752
- Ft.map((c) => /* @__PURE__ */ s(at, { children: o(M(c), p(c)) }, c)),
1753
- o(M(G)),
1754
- We.map((c) => /* @__PURE__ */ s(at, { children: o(M(c), `s:${c}`) }, c)),
1755
- !b && /* @__PURE__ */ s("span", { className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ s(ir, { show: we.customized, onReset: we.reset }) })
1838
+ Tt.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), h(c)) }, c)),
1839
+ o(D(J)),
1840
+ Me.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), `s:${c}`) }, c)),
1841
+ !w && /* @__PURE__ */ a("span", { className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(cn, { show: ve.customized, onReset: ve.reset }) })
1756
1842
  ] }),
1757
- pe.map((c, m) => {
1758
- const f = c.row.id != null ? String(c.row.id) : null, v = f != null && ft.has(f), _ = v ? null : Zt(c.key), O = v ? null : wn(c.key);
1843
+ be.map((c, f) => {
1844
+ const p = c.row.id != null ? String(c.row.id) : null, S = p != null && bt.has(p), q = S ? null : en(c.key), E = S ? null : jr(c.key);
1759
1845
  return /* @__PURE__ */ u(
1760
1846
  "div",
1761
1847
  {
1762
- className: C(
1848
+ className: I(
1763
1849
  "border-b border-slate-100 px-3 py-2 last:border-b-0 dark:border-border/50",
1764
- m % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1765
- _ && "bg-amber-50 dark:bg-amber-900/15",
1766
- O && "bg-red-50/70 dark:bg-red-900/15",
1767
- v && "opacity-60"
1850
+ f % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1851
+ q && "bg-amber-50 dark:bg-amber-900/15",
1852
+ E && "bg-red-50/70 dark:bg-red-900/15",
1853
+ S && "opacity-60"
1768
1854
  ),
1769
1855
  children: [
1770
1856
  /* @__PURE__ */ u(
1771
1857
  "div",
1772
1858
  {
1773
- className: C(
1859
+ className: I(
1774
1860
  "flex items-center gap-4",
1775
- v && "line-through decoration-slate-400"
1861
+ S && "line-through decoration-slate-400"
1776
1862
  ),
1777
1863
  children: [
1778
- Ar(
1864
+ zn(
1779
1865
  c.key,
1780
- Kr(c.key),
1866
+ jt(c.key),
1781
1867
  "shrink-0 font-semibold text-slate-800 dark:text-slate-100"
1782
1868
  ),
1783
- He && !v && (f == null || ut.has(f)) && /* @__PURE__ */ s(
1869
+ Ze && !S && (p == null || ft.has(p)) && /* @__PURE__ */ a(
1784
1870
  "span",
1785
1871
  {
1786
- "data-catalog-staged": f == null ? "new" : "edited",
1872
+ "data-catalog-staged": p == null ? "new" : "edited",
1787
1873
  "data-tip": "Applies when you save the record",
1788
1874
  className: "shrink-0 rounded bg-amber-100 px-1.5 py-px text-[10px] font-semibold text-amber-800 dark:bg-amber-400/15 dark:text-amber-300",
1789
- children: f == null ? "New" : "Edited"
1875
+ children: p == null ? "New" : "Edited"
1790
1876
  }
1791
1877
  ),
1792
- O && /* @__PURE__ */ s(
1878
+ E && /* @__PURE__ */ a(
1793
1879
  "span",
1794
1880
  {
1795
1881
  className: "shrink-0",
1796
1882
  "data-tip": `This line was in the failed submission
1797
- ${O}`,
1883
+ ${E}`,
1798
1884
  "data-submission-error": !0,
1799
- children: /* @__PURE__ */ s(ar, { className: "h-3.5 w-3.5 text-red-500", strokeWidth: 2 })
1885
+ children: /* @__PURE__ */ a(dn, { className: "h-3.5 w-3.5 text-red-500", strokeWidth: 2 })
1800
1886
  }
1801
1887
  ),
1802
- t && /* @__PURE__ */ s(
1803
- Xr,
1888
+ t && /* @__PURE__ */ a(
1889
+ lr,
1804
1890
  {
1805
- text: ke(St(Ie(c.key), t.field), void 0),
1891
+ text: Ne(_t(Ie(c.key), t.field), void 0),
1806
1892
  className: "min-w-0 flex-1 text-slate-600 dark:text-slate-300"
1807
1893
  }
1808
1894
  ),
1809
- !t && /* @__PURE__ */ s("span", { className: "flex-1" }),
1810
- r.map((x) => {
1811
- const A = St(Ie(c.key), x.field);
1812
- return A == null || A === "" ? null : /* @__PURE__ */ s(
1895
+ !t && /* @__PURE__ */ a("span", { className: "flex-1" }),
1896
+ n.map((y) => {
1897
+ const K = _t(Ie(c.key), y.field);
1898
+ return K == null || K === "" ? null : /* @__PURE__ */ a(
1813
1899
  "span",
1814
1900
  {
1815
1901
  className: "shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
1816
- children: String(A)
1902
+ children: String(K)
1817
1903
  },
1818
- x.field
1904
+ y.field
1819
1905
  );
1820
1906
  }),
1821
- Ft.map(
1822
- (x) => {
1823
- var A;
1824
- return En(c.key, x) ? Jn(c.key, x, c.row) : /* @__PURE__ */ s(
1907
+ Tt.map(
1908
+ (y) => {
1909
+ var K;
1910
+ return zr(c.key, y) ? Mr(c.key, y, c.row) : /* @__PURE__ */ a(
1825
1911
  "span",
1826
1912
  {
1827
- "data-catalog-locked": !b && Y.includes(x) ? x : void 0,
1828
- "data-tip": !b && Y.includes(x) ? "Set by the catalog — only an administrator can change it" : void 0,
1829
- ...we.box(
1830
- `s:${x}`,
1913
+ "data-catalog-locked": !w && Z.includes(y) ? y : void 0,
1914
+ "data-tip": !w && Z.includes(y) ? "Set by the catalog — only an administrator can change it" : void 0,
1915
+ ...ve.box(
1916
+ `s:${y}`,
1831
1917
  "w-20 shrink-0",
1832
1918
  "truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
1833
1919
  ),
1834
- children: ke(c.row[x], (A = a.field_formats) == null ? void 0 : A[x])
1920
+ children: Ne(c.row[y], (K = s.field_formats) == null ? void 0 : K[y])
1835
1921
  },
1836
- x
1922
+ y
1837
1923
  );
1838
1924
  }
1839
1925
  ),
1840
1926
  /* @__PURE__ */ u("span", { className: "inline-flex w-20 shrink-0 items-center justify-end gap-1", children: [
1841
- ie.has(c.key) && /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin text-slate-400" }),
1842
- Tt(c.key, Ie(c.key))
1927
+ ie.has(c.key) && /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" }),
1928
+ Rt(c.key, Ie(c.key))
1843
1929
  ] }),
1844
- We.map((x) => {
1845
- var Dr, Mr;
1846
- if (v)
1847
- return /* @__PURE__ */ s(
1930
+ Me.map((y) => {
1931
+ var er, tr;
1932
+ if (S)
1933
+ return /* @__PURE__ */ a(
1848
1934
  "span",
1849
1935
  {
1850
1936
  "data-tip": "Not counted — this line is removed when you save",
1851
- ...we.box(
1852
- `s:${x}`,
1937
+ ...ve.box(
1938
+ `s:${y}`,
1853
1939
  "w-20 shrink-0",
1854
1940
  "text-right tabular-nums text-slate-400 dark:text-slate-500"
1855
1941
  ),
1856
1942
  children: "—"
1857
1943
  },
1858
- x
1944
+ y
1859
1945
  );
1860
- const A = c.row[x], Fe = A != null && A !== "" ? A : Le(((Dr = a.compute_fields) == null ? void 0 : Dr[x]) ?? "", c.row);
1861
- return /* @__PURE__ */ s(
1946
+ const K = c.row[y], Re = K != null && K !== "" ? K : Pe(((er = s.compute_fields) == null ? void 0 : er[y]) ?? "", c.row);
1947
+ return /* @__PURE__ */ a(
1862
1948
  "span",
1863
1949
  {
1864
- ...we.box(
1865
- `s:${x}`,
1950
+ ...ve.box(
1951
+ `s:${y}`,
1866
1952
  "w-20 shrink-0",
1867
1953
  "truncate text-right tabular-nums text-slate-600 dark:text-slate-300"
1868
1954
  ),
1869
- children: ke(Fe, (Mr = a.field_formats) == null ? void 0 : Mr[x])
1955
+ children: Ne(Re, (tr = s.field_formats) == null ? void 0 : tr[y])
1870
1956
  },
1871
- x
1957
+ y
1872
1958
  );
1873
1959
  }),
1874
- !b && v && /* @__PURE__ */ s(
1960
+ !w && S && /* @__PURE__ */ a(
1875
1961
  "button",
1876
1962
  {
1877
1963
  type: "button",
1878
- onClick: () => w == null ? void 0 : w.cancelPendingDelete(d, h, f),
1964
+ onClick: () => v == null ? void 0 : v.cancelPendingDelete(i, m, p),
1879
1965
  className: "shrink-0 rounded px-1.5 py-0.5 text-[11px] font-medium text-nvr-navy underline dark:text-nvr-cyan",
1880
1966
  children: "Undo"
1881
1967
  }
1882
1968
  ),
1883
- !b && !v && /* @__PURE__ */ s(
1969
+ !w && !S && /* @__PURE__ */ a(
1884
1970
  "button",
1885
1971
  {
1886
1972
  type: "button",
1887
1973
  title: "Remove (applies on Save)",
1888
1974
  onClick: () => {
1889
- if (!z && w && f != null) {
1890
- w.queueDelete(d, h, f);
1975
+ if (!P && v && p != null) {
1976
+ v.queueDelete(i, m, p);
1891
1977
  return;
1892
1978
  }
1893
- st(c.key, "0", {}, { confirmedRemove: !0 });
1979
+ lt(c.key, "0", {}, { confirmedRemove: !0 });
1894
1980
  },
1895
1981
  className: "w-6 shrink-0 rounded p-0.5 text-slate-300 transition-colors hover:text-red-500",
1896
- children: /* @__PURE__ */ s(Pt, { className: "mx-auto h-3.5 w-3.5" })
1982
+ children: /* @__PURE__ */ a(Lt, { className: "mx-auto h-3.5 w-3.5" })
1897
1983
  }
1898
1984
  )
1899
1985
  ]
1900
1986
  }
1901
1987
  ),
1902
- (n.length > 0 || Or.length > 0 || vt.length > 0) && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-wrap items-baseline gap-x-4 gap-y-0.5 pl-0.5 text-[11px]", children: [
1903
- n.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1904
- /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? M(x.field.split(".")[0]) }),
1988
+ (r.length > 0 || An.length > 0 || vt.length > 0) && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-wrap items-baseline gap-x-4 gap-y-0.5 pl-0.5 text-[11px]", children: [
1989
+ r.map((y) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1990
+ /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.field.split(".")[0]) }),
1905
1991
  " ",
1906
- /* @__PURE__ */ s("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(St(Ie(c.key), x.field), x.format) })
1907
- ] }, x.field)),
1908
- Or.map((x) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1909
- /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? M(x.key) }),
1992
+ /* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(_t(Ie(c.key), y.field), y.format) })
1993
+ ] }, y.field)),
1994
+ An.map((y) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1995
+ /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.key) }),
1910
1996
  " ",
1911
- /* @__PURE__ */ s("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(tt(x.key, c.key), x.format) })
1912
- ] }, x.key)),
1913
- qn(c.row),
1914
- xn(c.row).map((x) => /* @__PURE__ */ u(
1997
+ /* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(st(y.key, c.key), y.format) })
1998
+ ] }, y.key)),
1999
+ Pr(c.row),
2000
+ Sr(c.row).map((y) => /* @__PURE__ */ u(
1915
2001
  "span",
1916
2002
  {
1917
2003
  className: "inline-flex items-center gap-1 whitespace-nowrap rounded bg-amber-50 px-1.5 py-px text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",
1918
- "data-catalog-row-flag": x,
2004
+ "data-catalog-row-flag": y,
1919
2005
  children: [
1920
- /* @__PURE__ */ s(De, { className: "h-3 w-3" }),
1921
- x
2006
+ /* @__PURE__ */ a(Be, { className: "h-3 w-3" }),
2007
+ y
1922
2008
  ]
1923
2009
  },
1924
- x
2010
+ y
1925
2011
  )),
1926
- vt.map((x) => {
1927
- const A = _n(x, c);
2012
+ vt.map((y) => {
2013
+ const K = Tr(y, c);
1928
2014
  return /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1929
- /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-muted-foreground", children: x.label ?? M(x.field) }),
2015
+ /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.field) }),
1930
2016
  " ",
1931
- /* @__PURE__ */ s("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: l(A, x.format) })
1932
- ] }, x.field);
2017
+ /* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: l(K, y.format) })
2018
+ ] }, y.field);
1933
2019
  })
1934
2020
  ] }),
1935
- _ && /* @__PURE__ */ u("p", { className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400", children: [
1936
- /* @__PURE__ */ s(De, { className: "h-3 w-3 shrink-0" }),
1937
- Gt,
2021
+ q && /* @__PURE__ */ u("p", { className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400", children: [
2022
+ /* @__PURE__ */ a(Be, { className: "h-3 w-3 shrink-0" }),
2023
+ tn,
1938
2024
  " is ",
1939
- ke(_.available, "number"),
2025
+ Ne(q.available, "number"),
1940
2026
  " —",
1941
2027
  " ",
1942
- ke(_.qty, "number"),
2028
+ Ne(q.qty, "number"),
1943
2029
  " requested"
1944
2030
  ] }),
1945
- !v && vs(
2031
+ !S && Rs(
1946
2032
  {
1947
2033
  ...c.row,
1948
2034
  ...Object.fromEntries(
1949
- We.filter((x) => c.row[x] == null || c.row[x] === "").map((x) => {
1950
- var A;
2035
+ Me.filter((y) => c.row[y] == null || c.row[y] === "").map((y) => {
2036
+ var K;
1951
2037
  return [
1952
- x,
1953
- Le(((A = a.compute_fields) == null ? void 0 : A[x]) ?? "", c.row)
2038
+ y,
2039
+ Pe(((K = s.compute_fields) == null ? void 0 : K[y]) ?? "", c.row)
1954
2040
  ];
1955
2041
  })
1956
2042
  )
1957
2043
  },
1958
- G,
1959
- We.length > 0 ? We : Ft
2044
+ J,
2045
+ Me.length > 0 ? Me : Tt
1960
2046
  ) && /* @__PURE__ */ u(
1961
2047
  "p",
1962
2048
  {
1963
2049
  "data-catalog-unpriced": !0,
1964
2050
  className: "mt-1 flex items-center gap-1 pl-0.5 text-[11px] font-medium text-amber-600 dark:text-amber-400",
1965
2051
  children: [
1966
- /* @__PURE__ */ s(De, { className: "h-3 w-3 shrink-0" }),
2052
+ /* @__PURE__ */ a(Be, { className: "h-3 w-3 shrink-0" }),
1967
2053
  "No catalog price: check the price or hand-price it"
1968
2054
  ]
1969
2055
  }
1970
2056
  ),
1971
- v && /* @__PURE__ */ s("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
2057
+ S && /* @__PURE__ */ a("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
1972
2058
  ]
1973
2059
  },
1974
2060
  c.key
1975
2061
  );
1976
2062
  }),
1977
2063
  (() => {
1978
- const c = pe.filter((_) => {
1979
- const O = _.row.id != null ? String(_.row.id) : null;
1980
- return !(O != null && ft.has(O));
1981
- }), m = (_) => xs(
1982
- c.map((O) => O.row),
1983
- _,
1984
- a.compute_fields
1985
- ), f = (_) => {
1986
- var O;
1987
- return ((O = a.field_formats) == null ? void 0 : O[_]) ?? "number";
1988
- }, v = (_) => /* @__PURE__ */ s(
2064
+ const c = be.filter((q) => {
2065
+ const E = q.row.id != null ? String(q.row.id) : null;
2066
+ return !(E != null && bt.has(E));
2067
+ }), f = (q) => qs(
2068
+ c.map((E) => E.row),
2069
+ q,
2070
+ s.compute_fields
2071
+ ), p = (q) => {
2072
+ var E;
2073
+ return ((E = s.field_formats) == null ? void 0 : E[q]) ?? "number";
2074
+ }, S = (q) => /* @__PURE__ */ a(
1989
2075
  "span",
1990
2076
  {
1991
- ...we.box(
1992
- `s:${_}`,
2077
+ ...ve.box(
2078
+ `s:${q}`,
1993
2079
  "w-20 shrink-0",
1994
2080
  "truncate text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100"
1995
2081
  ),
1996
- children: ke(m(_), f(_))
2082
+ children: Ne(f(q), p(q))
1997
2083
  },
1998
- _
2084
+ q
1999
2085
  );
2000
2086
  return /* @__PURE__ */ u("div", { className: "flex items-center gap-4 border-t border-slate-200 bg-slate-50 px-3 py-1.5 dark:border-border dark:bg-muted/40", children: [
2001
- /* @__PURE__ */ s("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: "Total" }),
2002
- Ft.map((_) => {
2003
- const O = p(_);
2004
- return O ? /* @__PURE__ */ s("span", { ...we.box(O, "w-20 shrink-0") }, _) : /* @__PURE__ */ s("span", { className: "w-20 shrink-0" }, _);
2087
+ /* @__PURE__ */ a("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: "Total" }),
2088
+ Tt.map((q) => {
2089
+ const E = h(q);
2090
+ return E ? /* @__PURE__ */ a("span", { ...ve.box(E, "w-20 shrink-0") }, q) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0" }, q);
2005
2091
  }),
2006
- /* @__PURE__ */ s("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: ke(m(G), "number") }),
2007
- We.map(v),
2008
- !b && /* @__PURE__ */ s("span", { className: "w-6 shrink-0" })
2092
+ /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: Ne(f(J), "number") }),
2093
+ Me.map(S),
2094
+ !w && /* @__PURE__ */ a("span", { className: "w-6 shrink-0" })
2009
2095
  ] });
2010
2096
  })()
2011
2097
  ] });
2012
2098
  })()
2013
2099
  ] }),
2014
- on && g && /* @__PURE__ */ s(
2015
- $s,
2100
+ br && g && /* @__PURE__ */ a(
2101
+ As,
2016
2102
  {
2017
2103
  catalogCol: g,
2018
- tmpl: J,
2019
- sectionBy: a.section_by,
2020
- sectionM2M: V,
2021
- pinnedSet: Ct,
2022
- pinnedIds: $e,
2023
- savingIds: pt,
2024
- relatedCols: (a.favorites_manager_columns ?? []).map((e) => (a.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
2025
- parentDraft: i,
2026
- onToggle: (e) => void pr(e),
2027
- onClose: () => xr(!1),
2028
- anchor: yr.current
2104
+ tmpl: z,
2105
+ sectionBy: s.section_by,
2106
+ sectionM2M: d,
2107
+ pinnedSet: zt,
2108
+ pinnedIds: Oe,
2109
+ savingIds: yt,
2110
+ relatedCols: (s.favorites_manager_columns ?? []).map((e) => (s.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
2111
+ parentDraft: N,
2112
+ onToggle: (e) => void wn(e),
2113
+ onClose: () => Nn(!1),
2114
+ anchor: vn.current
2029
2115
  }
2030
2116
  )
2031
2117
  ] }) : /* @__PURE__ */ u("p", { className: "py-1 text-[12px] text-slate-400", children: [
2032
2118
  'Catalog picker: field "',
2033
- a.item_field,
2119
+ s.item_field,
2034
2120
  '" does not resolve to an M2O relation on',
2035
2121
  " ",
2036
- d
2122
+ i
2037
2123
  ] });
2038
2124
  }
2039
- function _s({
2040
- builder: d,
2041
- defaultItemField: h,
2042
- catalogCol: y,
2043
- catalogFields: N,
2044
- tmpl: a,
2045
- currentQty: b,
2046
- addQty: k,
2047
- qtyStep: j,
2048
- readOnly: w
2125
+ function Ps({
2126
+ builder: i,
2127
+ defaultItemField: m,
2128
+ catalogCol: b,
2129
+ catalogFields: x,
2130
+ tmpl: _,
2131
+ currentQty: s,
2132
+ addQty: w,
2133
+ qtyStep: k,
2134
+ readOnly: j
2049
2135
  }) {
2050
- const P = Lt(), ee = d.item_field ?? h, [Y, _e] = H(!1), [Z, z] = H({}), [ne, G] = H("1"), [se, xe] = H(!1), Oe = F(
2136
+ const v = Kt(), O = i.item_field ?? m, [ye, Z] = Y(!1), [G, Ae] = Y({}), [P, qe] = Y("1"), [J, fe] = Y(!1), $e = F(
2051
2137
  () => [
2052
2138
  "id",
2053
- ee,
2054
- ...d.attributes.flatMap((q) => [`${q.field}.id`, `${q.field}.${q.label_field}`])
2139
+ O,
2140
+ ...i.attributes.flatMap(($) => [`${$.field}.id`, `${$.field}.${$.label_field}`])
2055
2141
  ].join(","),
2056
- [ee, d.attributes]
2057
- ), { data: U = [], isLoading: Ae } = K({
2142
+ [O, i.attributes]
2143
+ ), { data: je = [], isLoading: X } = C({
2058
2144
  queryKey: [
2059
2145
  "catalog-builder",
2060
- d.collection,
2061
- Oe,
2062
- JSON.stringify(d.filter ?? null)
2146
+ i.collection,
2147
+ $e,
2148
+ JSON.stringify(i.filter ?? null)
2063
2149
  ],
2064
- queryFn: () => P.request(
2065
- R(`/items/${d.collection}`, {
2150
+ queryFn: () => v.request(
2151
+ R(`/items/${i.collection}`, {
2066
2152
  limit: 2e3,
2067
- fields: Oe,
2068
- ...d.filter ? { filter: JSON.stringify(d.filter) } : {}
2153
+ fields: $e,
2154
+ ...i.filter ? { filter: JSON.stringify(i.filter) } : {}
2069
2155
  })
2070
- ).then((q) => q.data ?? []),
2071
- enabled: Y,
2156
+ ).then(($) => $.data ?? []),
2157
+ enabled: ye,
2072
2158
  staleTime: 6e4
2073
- }), ye = (q, g) => {
2074
- var le;
2075
- const L = q[g];
2076
- if (L == null) return null;
2077
- if (typeof L == "object") {
2078
- const B = L, $ = ((le = d.attributes.find((J) => J.field === g)) == null ? void 0 : le.label_field) ?? "id";
2079
- return { id: String(B.id ?? ""), label: String(B[$] ?? B.id ?? "") };
2159
+ }), ge = ($, W) => {
2160
+ var te;
2161
+ const g = $[W];
2162
+ if (g == null) return null;
2163
+ if (typeof g == "object") {
2164
+ const U = g, M = ((te = i.attributes.find((T) => T.field === W)) == null ? void 0 : te.label_field) ?? "id";
2165
+ return { id: String(U.id ?? ""), label: String(U[M] ?? U.id ?? "") };
2080
2166
  }
2081
- return { id: String(L), label: String(L) };
2082
- }, ue = (q) => U.filter(
2083
- (g) => d.attributes.slice(0, q).every((L) => {
2084
- var B;
2085
- const le = Z[L.field];
2086
- return le ? ((B = ye(g, L.field)) == null ? void 0 : B.id) === le : !0;
2167
+ return { id: String(g), label: String(g) };
2168
+ }, ke = ($) => je.filter(
2169
+ (W) => i.attributes.slice(0, $).every((g) => {
2170
+ var U;
2171
+ const te = G[g.field];
2172
+ return te ? ((U = ge(W, g.field)) == null ? void 0 : U.id) === te : !0;
2087
2173
  })
2088
- ), ie = d.attributes.every((q) => Z[q.field]), ae = ie ? U.find(
2089
- (q) => d.attributes.every((g) => {
2090
- var L;
2091
- return ((L = ye(q, g.field)) == null ? void 0 : L.id) === Z[g.field];
2174
+ ), le = i.attributes.every(($) => G[$.field]), ie = le ? je.find(
2175
+ ($) => i.attributes.every((W) => {
2176
+ var g;
2177
+ return ((g = ge($, W.field)) == null ? void 0 : g.id) === G[W.field];
2092
2178
  })
2093
- ) : void 0, Q = (ae == null ? void 0 : ae[ee]) != null ? String(ae[ee]) : null, { data: X } = K({
2094
- queryKey: ["catalog-builder-item", y, N, Q],
2095
- queryFn: () => P.request(
2096
- R(`/items/${y}`, {
2097
- filter: JSON.stringify({ id: { _eq: Q } }),
2098
- fields: N,
2179
+ ) : void 0, V = (ie == null ? void 0 : ie[O]) != null ? String(ie[O]) : null, { data: oe } = C({
2180
+ queryKey: ["catalog-builder-item", b, x, V],
2181
+ queryFn: () => v.request(
2182
+ R(`/items/${b}`, {
2183
+ filter: JSON.stringify({ id: { _eq: V } }),
2184
+ fields: x,
2099
2185
  limit: 1
2100
2186
  })
2101
- ).then((q) => {
2102
- var g;
2103
- return ((g = q.data) == null ? void 0 : g[0]) ?? null;
2187
+ ).then(($) => {
2188
+ var W;
2189
+ return ((W = $.data) == null ? void 0 : W[0]) ?? null;
2104
2190
  }),
2105
- enabled: !!Q,
2191
+ enabled: !!V,
2106
2192
  staleTime: 6e4
2107
- }), Se = Number(ne), me = !!Q && !!X && !se && ne.trim() !== "" && Number.isFinite(Se) && Se > 0 && (j === "any" || Number.isInteger(Se));
2108
- async function Ke() {
2109
- if (!(!me || !Q || !X)) {
2110
- xe(!0);
2193
+ }), de = Number(P), he = !!V && !!oe && !J && P.trim() !== "" && Number.isFinite(de) && de > 0 && (k === "any" || Number.isInteger(de));
2194
+ async function Ee() {
2195
+ if (!(!he || !V || !oe)) {
2196
+ fe(!0);
2111
2197
  try {
2112
- await k(Q, (b(Q) ?? 0) + Se, X), z({}), G("1");
2198
+ await w(V, (s(V) ?? 0) + de, oe), Ae({}), qe("1");
2113
2199
  } finally {
2114
- xe(!1);
2200
+ fe(!1);
2115
2201
  }
2116
2202
  }
2117
2203
  }
@@ -2120,73 +2206,73 @@ function _s({
2120
2206
  "button",
2121
2207
  {
2122
2208
  type: "button",
2123
- onClick: () => _e((q) => !q),
2209
+ onClick: () => Z(($) => !$),
2124
2210
  className: "flex w-full items-center gap-1.5 rounded-t-lg bg-slate-100/80 px-2 py-1.5 text-left dark:bg-muted",
2125
2211
  children: [
2126
- /* @__PURE__ */ s(
2127
- or,
2212
+ /* @__PURE__ */ a(
2213
+ mn,
2128
2214
  {
2129
- className: C(
2215
+ className: I(
2130
2216
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
2131
- Y && "rotate-90"
2217
+ ye && "rotate-90"
2132
2218
  )
2133
2219
  }
2134
2220
  ),
2135
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: d.label })
2221
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
2136
2222
  ]
2137
2223
  }
2138
2224
  ),
2139
- Y && /* @__PURE__ */ s("div", { className: "space-y-2 border-t border-slate-200 p-3 dark:border-border", children: Ae ? /* @__PURE__ */ u("div", { className: "flex items-center gap-2 py-2 text-slate-400", children: [
2140
- /* @__PURE__ */ s(ce, { className: "h-4 w-4 animate-spin" }),
2225
+ ye && /* @__PURE__ */ a("div", { className: "space-y-2 border-t border-slate-200 p-3 dark:border-border", children: X ? /* @__PURE__ */ u("div", { className: "flex items-center gap-2 py-2 text-slate-400", children: [
2226
+ /* @__PURE__ */ a(ce, { className: "h-4 w-4 animate-spin" }),
2141
2227
  " Loading options…"
2142
2228
  ] }) : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
2143
- d.attributes.map((q, g) => {
2144
- const L = /* @__PURE__ */ new Map();
2145
- for (const B of ue(g)) {
2146
- const $ = ye(B, q.field);
2147
- $ != null && $.id && L.set($.id, $.label);
2229
+ i.attributes.map(($, W) => {
2230
+ const g = /* @__PURE__ */ new Map();
2231
+ for (const U of ke(W)) {
2232
+ const M = ge(U, $.field);
2233
+ M != null && M.id && g.set(M.id, M.label);
2148
2234
  }
2149
- const le = [...L.entries()].sort(
2150
- ([, B], [, $]) => B.localeCompare($, void 0, { numeric: !0 })
2235
+ const te = [...g.entries()].sort(
2236
+ ([, U], [, M]) => U.localeCompare(M, void 0, { numeric: !0 })
2151
2237
  );
2152
- return /* @__PURE__ */ s(
2153
- qs,
2238
+ return /* @__PURE__ */ a(
2239
+ Ls,
2154
2240
  {
2155
- label: M(q.field),
2156
- value: Z[q.field] ?? null,
2157
- valueLabel: Z[q.field] ? L.get(Z[q.field]) ?? Z[q.field] : null,
2158
- options: le,
2159
- disabled: g > 0 && !Z[d.attributes[g - 1].field],
2160
- onChange: (B) => z(($) => {
2161
- const J = {};
2162
- for (let E = 0; E < g; E++) {
2163
- const oe = d.attributes[E].field;
2164
- $[oe] && (J[oe] = $[oe]);
2241
+ label: D($.field),
2242
+ value: G[$.field] ?? null,
2243
+ valueLabel: G[$.field] ? g.get(G[$.field]) ?? G[$.field] : null,
2244
+ options: te,
2245
+ disabled: W > 0 && !G[i.attributes[W - 1].field],
2246
+ onChange: (U) => Ae((M) => {
2247
+ const T = {};
2248
+ for (let z = 0; z < W; z++) {
2249
+ const L = i.attributes[z].field;
2250
+ M[L] && (T[L] = M[L]);
2165
2251
  }
2166
- return B && (J[q.field] = B), J;
2252
+ return U && (T[$.field] = U), T;
2167
2253
  })
2168
2254
  },
2169
- q.field
2255
+ $.field
2170
2256
  );
2171
2257
  }),
2172
- /* @__PURE__ */ s("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: Q && X ? /* @__PURE__ */ u(ve, { children: [
2173
- /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: ze(a, X) }),
2174
- (b(Q) ?? 0) > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
2175
- b(Q),
2258
+ /* @__PURE__ */ a("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: V && oe ? /* @__PURE__ */ u(_e, { children: [
2259
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: ze(_, oe) }),
2260
+ (s(V) ?? 0) > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
2261
+ s(V),
2176
2262
  " in summary"
2177
2263
  ] }),
2178
- !w && /* @__PURE__ */ u(ve, { children: [
2179
- /* @__PURE__ */ s(
2264
+ !j && /* @__PURE__ */ u(_e, { children: [
2265
+ /* @__PURE__ */ a(
2180
2266
  "input",
2181
2267
  {
2182
2268
  type: "number",
2183
2269
  min: 0,
2184
- step: j,
2185
- value: ne,
2270
+ step: k,
2271
+ value: P,
2186
2272
  "aria-label": "Quantity to add",
2187
- onChange: (q) => G(q.target.value),
2188
- onKeyDown: (q) => {
2189
- q.key === "Enter" && (q.preventDefault(), Ke());
2273
+ onChange: ($) => qe($.target.value),
2274
+ onKeyDown: ($) => {
2275
+ $.key === "Enter" && ($.preventDefault(), Ee());
2190
2276
  },
2191
2277
  className: "h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
2192
2278
  }
@@ -2195,315 +2281,315 @@ function _s({
2195
2281
  "button",
2196
2282
  {
2197
2283
  type: "button",
2198
- onClick: () => void Ke(),
2199
- disabled: !me,
2284
+ onClick: () => void Ee(),
2285
+ disabled: !he,
2200
2286
  className: "flex h-7 shrink-0 items-center gap-1 rounded bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:bg-nvr-cyan/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan focus-visible:ring-offset-1 disabled:opacity-50",
2201
2287
  children: [
2202
- se ? /* @__PURE__ */ s(ce, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Qn, { className: "h-3.5 w-3.5" }),
2288
+ J ? /* @__PURE__ */ a(ce, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(Hr, { className: "h-3.5 w-3.5" }),
2203
2289
  "Add"
2204
2290
  ]
2205
2291
  }
2206
2292
  )
2207
2293
  ] })
2208
- ] }) : ie ? /* @__PURE__ */ s("span", { className: "text-slate-400", children: "No matching item for this combination" }) : /* @__PURE__ */ s("span", { className: "text-slate-400", children: "Pick each attribute to resolve an item" }) })
2294
+ ] }) : le ? /* @__PURE__ */ a("span", { className: "text-slate-400", children: "No matching item for this combination" }) : /* @__PURE__ */ a("span", { className: "text-slate-400", children: "Pick each attribute to resolve an item" }) })
2209
2295
  ] }) })
2210
2296
  ] });
2211
2297
  }
2212
- function Ss({
2213
- parentCollection: d,
2214
- field: h,
2215
- id: y
2298
+ function Es({
2299
+ parentCollection: i,
2300
+ field: m,
2301
+ id: b
2216
2302
  }) {
2217
- var j;
2218
- const N = Lt(), { data: a = [] } = K({
2219
- queryKey: ["collection-relations", d],
2220
- queryFn: () => N.request(R(`/collections/${d}`)).then((w) => {
2221
- var P;
2222
- return ((P = w.data) == null ? void 0 : P.relations) ?? [];
2303
+ var k;
2304
+ const x = Kt(), { data: _ = [] } = C({
2305
+ queryKey: ["collection-relations", i],
2306
+ queryFn: () => x.request(R(`/collections/${i}`)).then((j) => {
2307
+ var v;
2308
+ return ((v = j.data) == null ? void 0 : v.relations) ?? [];
2223
2309
  }),
2224
- enabled: !!d,
2310
+ enabled: !!i,
2225
2311
  staleTime: 10 * 6e4
2226
- }), b = ((j = a.find(
2227
- (w) => w.many_collection === d && w.many_field === h && !w.junction_field
2228
- )) == null ? void 0 : j.one_collection) ?? null, { data: k } = K({
2229
- queryKey: ["col-meta", b],
2230
- queryFn: () => N.request(R(`/collections/${b}`)).then((w) => w.data),
2231
- enabled: !!b,
2312
+ }), s = ((k = _.find(
2313
+ (j) => j.many_collection === i && j.many_field === m && !j.junction_field
2314
+ )) == null ? void 0 : k.one_collection) ?? null, { data: w } = C({
2315
+ queryKey: ["col-meta", s],
2316
+ queryFn: () => x.request(R(`/collections/${s}`)).then((j) => j.data),
2317
+ enabled: !!s,
2232
2318
  staleTime: 3e5
2233
2319
  });
2234
- return b ? /* @__PURE__ */ s(hs, { collection: b, id: y, displayTemplate: k == null ? void 0 : k.display_template }) : /* @__PURE__ */ u(ve, { children: [
2320
+ return s ? /* @__PURE__ */ a(Ns, { collection: s, id: b, displayTemplate: w == null ? void 0 : w.display_template }) : /* @__PURE__ */ u(_e, { children: [
2235
2321
  "this ",
2236
- M(h)
2322
+ D(m)
2237
2323
  ] });
2238
2324
  }
2239
- function Xr({
2240
- text: d,
2241
- highlight: h,
2242
- className: y,
2243
- ...N
2325
+ function lr({
2326
+ text: i,
2327
+ highlight: m,
2328
+ className: b,
2329
+ ...x
2244
2330
  }) {
2245
- const a = rs(d);
2246
- return /* @__PURE__ */ s("span", { ref: a, className: C("truncate", y), ...N, children: h ? /* @__PURE__ */ s(dr, { text: d, query: h }) : d });
2331
+ const _ = cs(i);
2332
+ return /* @__PURE__ */ a("span", { ref: _, className: I("truncate", b), ...x, children: m ? /* @__PURE__ */ a(fn, { text: i, query: m }) : i });
2247
2333
  }
2248
- function qs({
2249
- label: d,
2250
- value: h,
2251
- valueLabel: y,
2252
- options: N,
2253
- disabled: a,
2254
- onChange: b
2334
+ function Ls({
2335
+ label: i,
2336
+ value: m,
2337
+ valueLabel: b,
2338
+ options: x,
2339
+ disabled: _,
2340
+ onChange: s
2255
2341
  }) {
2256
- const [k, j] = H(!1), w = Ee(null);
2257
- return Te(() => {
2258
- if (!k) return;
2259
- const P = (ee) => {
2260
- w.current && !w.current.contains(ee.target) && j(!1);
2342
+ const [w, k] = Y(!1), j = pe(null);
2343
+ return xe(() => {
2344
+ if (!w) return;
2345
+ const v = (O) => {
2346
+ j.current && !j.current.contains(O.target) && k(!1);
2261
2347
  };
2262
- return document.addEventListener("mousedown", P), () => document.removeEventListener("mousedown", P);
2263
- }, [k]), /* @__PURE__ */ u("div", { ref: w, className: "relative", children: [
2264
- /* @__PURE__ */ s("p", { className: "mb-1 text-[10px] font-medium text-slate-500 dark:text-slate-400", children: d }),
2348
+ return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
2349
+ }, [w]), /* @__PURE__ */ u("div", { ref: j, className: "relative", children: [
2350
+ /* @__PURE__ */ a("p", { className: "mb-1 text-[10px] font-medium text-slate-500 dark:text-slate-400", children: i }),
2265
2351
  /* @__PURE__ */ u(
2266
2352
  "button",
2267
2353
  {
2268
2354
  type: "button",
2269
- disabled: a,
2270
- onClick: () => j((P) => !P),
2355
+ disabled: _,
2356
+ onClick: () => k((v) => !v),
2271
2357
  className: "flex w-44 items-center justify-between rounded border border-slate-200 bg-white px-2 py-1.5 text-left text-[12px] text-slate-700 hover:border-slate-300 disabled:opacity-50 dark:border-border dark:bg-background dark:text-slate-200",
2272
2358
  children: [
2273
- /* @__PURE__ */ s("span", { className: C("truncate", !y && "text-slate-400"), children: y ?? "Select…" }),
2274
- /* @__PURE__ */ s(Bn, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
2359
+ /* @__PURE__ */ a("span", { className: I("truncate", !b && "text-slate-400"), children: b ?? "Select…" }),
2360
+ /* @__PURE__ */ a(Yr, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
2275
2361
  ]
2276
2362
  }
2277
2363
  ),
2278
- k && /* @__PURE__ */ u("div", { className: "absolute z-50 mt-1 max-h-52 w-44 overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md", children: [
2279
- h && /* @__PURE__ */ u(
2364
+ w && /* @__PURE__ */ u("div", { className: "absolute z-50 mt-1 max-h-52 w-44 overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md", children: [
2365
+ m && /* @__PURE__ */ u(
2280
2366
  "button",
2281
2367
  {
2282
2368
  type: "button",
2283
2369
  onClick: () => {
2284
- b(null), j(!1);
2370
+ s(null), k(!1);
2285
2371
  },
2286
2372
  className: "flex w-full items-center gap-1.5 border-b border-slate-100 px-2 py-1 text-left text-[12px] text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400",
2287
2373
  children: [
2288
- /* @__PURE__ */ s(Pt, { className: "h-3 w-3 text-slate-400" }),
2374
+ /* @__PURE__ */ a(Lt, { className: "h-3 w-3 text-slate-400" }),
2289
2375
  " Clear"
2290
2376
  ]
2291
2377
  }
2292
2378
  ),
2293
- N.map(([P, ee]) => /* @__PURE__ */ s(
2379
+ x.map(([v, O]) => /* @__PURE__ */ a(
2294
2380
  "button",
2295
2381
  {
2296
2382
  type: "button",
2297
2383
  onClick: () => {
2298
- b(P), j(!1);
2384
+ s(v), k(!1);
2299
2385
  },
2300
- className: C(
2386
+ className: I(
2301
2387
  "block w-full truncate px-2 py-1 text-left text-[12px] hover:bg-muted",
2302
- P === h ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
2388
+ v === m ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
2303
2389
  ),
2304
- children: ee
2390
+ children: O
2305
2391
  },
2306
- P
2392
+ v
2307
2393
  ))
2308
2394
  ] })
2309
2395
  ] });
2310
2396
  }
2311
- function $s({
2312
- catalogCol: d,
2313
- tmpl: h,
2314
- sectionBy: y,
2315
- sectionM2M: N,
2316
- pinnedSet: a,
2317
- pinnedIds: b,
2318
- savingIds: k,
2319
- relatedCols: j,
2320
- parentDraft: w,
2321
- onToggle: P,
2322
- onClose: ee,
2323
- anchor: Y
2397
+ function As({
2398
+ catalogCol: i,
2399
+ tmpl: m,
2400
+ sectionBy: b,
2401
+ sectionM2M: x,
2402
+ pinnedSet: _,
2403
+ pinnedIds: s,
2404
+ savingIds: w,
2405
+ relatedCols: k,
2406
+ parentDraft: j,
2407
+ onToggle: v,
2408
+ onClose: O,
2409
+ anchor: ye
2324
2410
  }) {
2325
- const _e = Lt(), [Z, z] = H(""), [ne, G] = H(""), [se, xe] = H(1), Oe = Ee(null);
2326
- Te(() => {
2327
- const i = setTimeout(() => G(Z), 300);
2328
- return () => clearTimeout(i);
2329
- }, [Z]), Te(() => xe(1), [ne]), Te(() => {
2330
- var i;
2331
- (i = Oe.current) == null || i.focus();
2332
- }, []), Te(() => {
2333
- const i = (S) => {
2334
- S.key === "Escape" && (S.stopPropagation(), ee());
2411
+ const Z = Kt(), [G, Ae] = Y(""), [P, qe] = Y(""), [J, fe] = Y(1), $e = pe(null);
2412
+ xe(() => {
2413
+ const d = setTimeout(() => qe(G), 300);
2414
+ return () => clearTimeout(d);
2415
+ }, [G]), xe(() => fe(1), [P]), xe(() => {
2416
+ var d;
2417
+ (d = $e.current) == null || d.focus();
2418
+ }, []), xe(() => {
2419
+ const d = (N) => {
2420
+ N.key === "Escape" && (N.stopPropagation(), O());
2335
2421
  };
2336
- return window.addEventListener("keydown", i, !0), () => window.removeEventListener("keydown", i, !0);
2337
- }, [ee]);
2338
- const U = F(() => {
2339
- var S;
2340
- const i = (S = [...(h ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : S[1];
2341
- return i && !i.includes(".") ? i : "id";
2342
- }, [h]), Ae = !N && y.includes(".") ? `*,${y}` : "*", ye = 50, { data: ue, isFetching: ie } = K({
2343
- queryKey: ["favorites-manager-list", d, ne, U, se],
2344
- queryFn: () => _e.request(
2345
- R(`/items/${d}`, {
2346
- fields: Ae,
2347
- limit: ye,
2348
- page: se,
2349
- sort: U,
2350
- ...ne.trim() ? { search: ne } : {}
2422
+ return window.addEventListener("keydown", d, !0), () => window.removeEventListener("keydown", d, !0);
2423
+ }, [O]);
2424
+ const je = F(() => {
2425
+ var N;
2426
+ const d = (N = [...(m ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : N[1];
2427
+ return d && !d.includes(".") ? d : "id";
2428
+ }, [m]), X = !x && b.includes(".") ? `*,${b}` : "*", ge = 50, { data: ke, isFetching: le } = C({
2429
+ queryKey: ["favorites-manager-list", i, P, je, J],
2430
+ queryFn: () => Z.request(
2431
+ R(`/items/${i}`, {
2432
+ fields: X,
2433
+ limit: ge,
2434
+ page: J,
2435
+ sort: je,
2436
+ ...P.trim() ? { search: P } : {}
2351
2437
  })
2352
2438
  ),
2353
2439
  staleTime: 3e4,
2354
- placeholderData: (i) => i
2355
- }), ae = ((ue == null ? void 0 : ue.data) ?? []).filter((i) => !a.has(String(i.id))), Q = (ue == null ? void 0 : ue.total) ?? ae.length, X = Math.max(1, Math.ceil(Q / ye)), { data: Se = [] } = K({
2356
- queryKey: ["favorites-manager-pinned", d, Ae, b.join(",")],
2357
- queryFn: () => _e.request(
2358
- R(`/items/${d}`, {
2359
- filter: JSON.stringify({ id: { _in: b } }),
2360
- fields: Ae,
2361
- limit: b.length,
2362
- sort: U
2440
+ placeholderData: (d) => d
2441
+ }), ie = ((ke == null ? void 0 : ke.data) ?? []).filter((d) => !_.has(String(d.id))), V = (ke == null ? void 0 : ke.total) ?? ie.length, oe = Math.max(1, Math.ceil(V / ge)), { data: de = [] } = C({
2442
+ queryKey: ["favorites-manager-pinned", i, X, s.join(",")],
2443
+ queryFn: () => Z.request(
2444
+ R(`/items/${i}`, {
2445
+ filter: JSON.stringify({ id: { _in: s } }),
2446
+ fields: X,
2447
+ limit: s.length,
2448
+ sort: je
2363
2449
  })
2364
- ).then((i) => i.data ?? []),
2365
- enabled: b.length > 0,
2450
+ ).then((d) => d.data ?? []),
2451
+ enabled: s.length > 0,
2366
2452
  staleTime: 3e4
2367
- }), me = F(() => {
2368
- const i = /* @__PURE__ */ new Set();
2369
- for (const S of ae) i.add(String(S.id));
2370
- for (const S of b) i.add(S);
2371
- return [...i];
2372
- }, [ae, b]), { data: Ke = /* @__PURE__ */ new Map() } = K({
2373
- queryKey: ["favorites-manager-sections", N == null ? void 0 : N.junction, me.join(",")],
2453
+ }), he = F(() => {
2454
+ const d = /* @__PURE__ */ new Set();
2455
+ for (const N of ie) d.add(String(N.id));
2456
+ for (const N of s) d.add(N);
2457
+ return [...d];
2458
+ }, [ie, s]), { data: Ee = /* @__PURE__ */ new Map() } = C({
2459
+ queryKey: ["favorites-manager-sections", x == null ? void 0 : x.junction, he.join(",")],
2374
2460
  queryFn: async () => {
2375
- const i = N, S = await Et(_e, `/items/${i.junction}`, {
2376
- fields: `${i.fkToItem},${i.fkToSection}`,
2377
- filter: JSON.stringify({ [i.fkToItem]: { _in: me } })
2378
- }), I = [...new Set(S.map((T) => String(T[i.fkToSection])))], W = I.length ? await Et(_e, `/items/${i.target}`, {
2379
- fields: `id,${i.labelPath}`,
2380
- filter: JSON.stringify({ id: { _in: I } })
2381
- }) : [], D = new Map(
2382
- W.map((T) => [String(T.id), String(rn(T, i.labelPath) ?? "")])
2383
- ), fe = /* @__PURE__ */ new Map();
2384
- for (const T of S) {
2385
- const be = D.get(String(T[i.fkToSection]));
2386
- if (!be) continue;
2387
- const de = String(T[i.fkToItem]), qe = fe.get(de) ?? [];
2388
- qe.includes(be) || qe.push(be), fe.set(de, qe);
2461
+ const d = x, N = await At(Z, `/items/${d.junction}`, {
2462
+ fields: `${d.fkToItem},${d.fkToSection}`,
2463
+ filter: JSON.stringify({ [d.fkToItem]: { _in: he } })
2464
+ }), B = [...new Set(N.map((H) => String(H[d.fkToSection])))], ne = B.length ? await At(Z, `/items/${d.target}`, {
2465
+ fields: `id,${d.labelPath}`,
2466
+ filter: JSON.stringify({ id: { _in: B } })
2467
+ }) : [], Q = new Map(
2468
+ ne.map((H) => [String(H.id), String(cr(H, d.labelPath) ?? "")])
2469
+ ), ee = /* @__PURE__ */ new Map();
2470
+ for (const H of N) {
2471
+ const A = Q.get(String(H[d.fkToSection]));
2472
+ if (!A) continue;
2473
+ const Ke = String(H[d.fkToItem]), re = ee.get(Ke) ?? [];
2474
+ re.includes(A) || re.push(A), ee.set(Ke, re);
2389
2475
  }
2390
- return fe;
2476
+ return ee;
2391
2477
  },
2392
- enabled: !!N && me.length > 0,
2478
+ enabled: !!x && he.length > 0,
2393
2479
  staleTime: 6e4
2394
- }), q = (i) => h ? ze(h, i) : String(i.cifa_number ?? i.name ?? `#${i.id}`), g = (i) => {
2395
- const S = i.description ?? i.long_description ?? i.name;
2396
- return typeof S == "string" && S.trim() && S.trim() !== q(i) ? S : "";
2397
- }, L = (i) => {
2398
- if (N) return (Ke.get(String(i.id)) ?? []).join(", ");
2399
- if (!y) return "";
2400
- const S = ze(`{{${y}}}`, i);
2401
- return S === `{{${y}}}` ? "" : S;
2402
- }, le = (i, S) => {
2403
- if (S === "presence")
2404
- return i == null || i === "" || Number(i) === 0 ? "No" : "Yes";
2405
- if (i == null || i === "") return "—";
2406
- const I = Number(i);
2407
- return S === "currency" && Number.isFinite(I) ? I.toLocaleString("en-US", { style: "currency", currency: "USD" }) : S === "number" && Number.isFinite(I) ? I.toLocaleString() : String(i);
2408
- }, B = lr({
2409
- queries: j.map((i) => {
2410
- const S = Me(i.match, w);
2480
+ }), $ = (d) => m ? ze(m, d) : String(d.cifa_number ?? d.name ?? `#${d.id}`), W = (d) => {
2481
+ const N = d.description ?? d.long_description ?? d.name;
2482
+ return typeof N == "string" && N.trim() && N.trim() !== $(d) ? N : "";
2483
+ }, g = (d) => {
2484
+ if (x) return (Ee.get(String(d.id)) ?? []).join(", ");
2485
+ if (!b) return "";
2486
+ const N = ze(`{{${b}}}`, d);
2487
+ return N === `{{${b}}}` ? "" : N;
2488
+ }, te = (d, N) => {
2489
+ if (N === "presence")
2490
+ return d == null || d === "" || Number(d) === 0 ? "No" : "Yes";
2491
+ if (d == null || d === "") return "—";
2492
+ const B = Number(d);
2493
+ return N === "currency" && Number.isFinite(B) ? B.toLocaleString("en-US", { style: "currency", currency: "USD" }) : N === "number" && Number.isFinite(B) ? B.toLocaleString() : String(d);
2494
+ }, U = un({
2495
+ queries: k.map((d) => {
2496
+ const N = De(d.match, j);
2411
2497
  return {
2412
2498
  queryKey: [
2413
2499
  "favorites-manager-related",
2414
- i.key,
2415
- i.collection,
2416
- JSON.stringify(S),
2417
- me.join(",")
2500
+ d.key,
2501
+ d.collection,
2502
+ JSON.stringify(N),
2503
+ he.join(",")
2418
2504
  ],
2419
2505
  queryFn: async () => {
2420
- const I = await _e.request(
2421
- R(`/items/${i.collection}`, {
2422
- filter: JSON.stringify({ [i.item_field]: { _in: me }, ...S ?? {} }),
2423
- fields: `${i.item_field},${i.value_field}`,
2506
+ const B = await Z.request(
2507
+ R(`/items/${d.collection}`, {
2508
+ filter: JSON.stringify({ [d.item_field]: { _in: he }, ...N ?? {} }),
2509
+ fields: `${d.item_field},${d.value_field}`,
2424
2510
  limit: 1e3
2425
2511
  })
2426
- ).then((D) => D.data ?? []), W = /* @__PURE__ */ new Map();
2427
- for (const D of I) {
2428
- const fe = String(D[i.item_field]), T = D[i.value_field], be = W.get(fe);
2429
- be === void 0 ? W.set(fe, T) : Number.isFinite(Number(be)) && Number.isFinite(Number(T)) && W.set(fe, Number(be) + Number(T));
2512
+ ).then((Q) => Q.data ?? []), ne = /* @__PURE__ */ new Map();
2513
+ for (const Q of B) {
2514
+ const ee = String(Q[d.item_field]), H = Q[d.value_field], A = ne.get(ee);
2515
+ A === void 0 ? ne.set(ee, H) : Number.isFinite(Number(A)) && Number.isFinite(Number(H)) && ne.set(ee, Number(A) + Number(H));
2430
2516
  }
2431
- return W;
2517
+ return ne;
2432
2518
  },
2433
- enabled: me.length > 0 && (i.match === void 0 || S !== null),
2519
+ enabled: he.length > 0 && (d.match === void 0 || N !== null),
2434
2520
  staleTime: 3e4
2435
2521
  };
2436
2522
  })
2437
- }), $ = j.filter(
2438
- (i) => i.match !== void 0 && Me(i.match, w) === null
2439
- ), J = (i) => {
2440
- const S = a.has(i);
2441
- return /* @__PURE__ */ s(
2523
+ }), M = k.filter(
2524
+ (d) => d.match !== void 0 && De(d.match, j) === null
2525
+ ), T = (d) => {
2526
+ const N = _.has(d);
2527
+ return /* @__PURE__ */ a(
2442
2528
  "button",
2443
2529
  {
2444
2530
  type: "button",
2445
- title: S ? "Remove from favorites" : "Add to favorites",
2446
- disabled: k.has(i),
2447
- onClick: () => P(i),
2531
+ title: N ? "Remove from favorites" : "Add to favorites",
2532
+ disabled: w.has(d),
2533
+ onClick: () => v(d),
2448
2534
  className: "shrink-0 rounded p-1 transition-colors hover:bg-amber-100/60 dark:hover:bg-amber-400/10",
2449
- children: k.has(i) ? /* @__PURE__ */ s(ce, { className: "h-4 w-4 animate-spin text-amber-400" }) : /* @__PURE__ */ s(
2450
- it,
2535
+ children: w.has(d) ? /* @__PURE__ */ a(ce, { className: "h-4 w-4 animate-spin text-amber-400" }) : /* @__PURE__ */ a(
2536
+ dt,
2451
2537
  {
2452
- className: C(
2538
+ className: I(
2453
2539
  "h-4 w-4",
2454
- S ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
2540
+ N ? "fill-amber-400 text-amber-400" : "text-slate-300 hover:text-amber-400"
2455
2541
  )
2456
2542
  }
2457
2543
  )
2458
2544
  }
2459
2545
  );
2460
- }, E = (i, S) => /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: 4 + j.length, className: C("border-b px-3 py-1.5", S), children: i }) }), oe = (i, S) => {
2461
- const I = String(i.id), W = g(i);
2546
+ }, z = (d, N) => /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 4 + k.length, className: I("border-b px-3 py-1.5", N), children: d }) }), L = (d, N) => {
2547
+ const B = String(d.id), ne = W(d);
2462
2548
  return /* @__PURE__ */ u(
2463
2549
  "tr",
2464
2550
  {
2465
- className: C(
2551
+ className: I(
2466
2552
  "border-b border-slate-100 dark:border-border/50",
2467
- S % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
2553
+ N % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
2468
2554
  ),
2469
2555
  children: [
2470
- /* @__PURE__ */ s("td", { className: "px-2 py-1", children: J(I) }),
2471
- /* @__PURE__ */ s("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: en(d) ? /* @__PURE__ */ s(
2556
+ /* @__PURE__ */ a("td", { className: "px-2 py-1", children: T(B) }),
2557
+ /* @__PURE__ */ a("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: or(i) ? /* @__PURE__ */ a(
2472
2558
  "button",
2473
2559
  {
2474
2560
  type: "button",
2475
- onClick: () => tn(d, I, w),
2561
+ onClick: () => dr(i, B, j),
2476
2562
  title: "View stock & planning detail",
2477
2563
  className: "text-left underline decoration-slate-300 decoration-1 underline-offset-2 hover:text-[#009abe] hover:decoration-[#009abe] dark:decoration-slate-600",
2478
- children: q(i)
2564
+ children: $(d)
2479
2565
  }
2480
- ) : q(i) }),
2481
- /* @__PURE__ */ s("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ s("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip": W || void 0, children: W || "—" }) }),
2482
- /* @__PURE__ */ s("td", { className: "px-2 py-1", children: /* @__PURE__ */ s("p", { className: "truncate text-slate-500 dark:text-slate-400", children: L(i) || "—" }) }),
2483
- j.map((D, fe) => {
2484
- var de, qe;
2485
- const T = D.match !== void 0 && Me(D.match, w) === null, be = T || (qe = (de = B[fe]) == null ? void 0 : de.data) == null ? void 0 : qe.get(I);
2486
- return /* @__PURE__ */ s(
2566
+ ) : $(d) }),
2567
+ /* @__PURE__ */ a("td", { className: "max-w-0 px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-600 dark:text-slate-300", "data-tip": ne || void 0, children: ne || "—" }) }),
2568
+ /* @__PURE__ */ a("td", { className: "px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-500 dark:text-slate-400", children: g(d) || "—" }) }),
2569
+ k.map((Q, ee) => {
2570
+ var Ke, re;
2571
+ const H = Q.match !== void 0 && De(Q.match, j) === null, A = H || (re = (Ke = U[ee]) == null ? void 0 : Ke.data) == null ? void 0 : re.get(B);
2572
+ return /* @__PURE__ */ a(
2487
2573
  "td",
2488
2574
  {
2489
2575
  className: "whitespace-nowrap px-2 py-1 text-right tabular-nums text-slate-600 dark:text-slate-300",
2490
- children: T ? "—" : le(be, D.format)
2576
+ children: H ? "—" : te(A, Q.format)
2491
2577
  },
2492
- D.key
2578
+ Q.key
2493
2579
  );
2494
2580
  })
2495
2581
  ]
2496
2582
  },
2497
- I
2583
+ B
2498
2584
  );
2499
- }, lt = (Y == null ? void 0 : Y.closest('[role="dialog"]')) ?? document.body, V = Z.trim() ? Se.filter((i) => es(`${q(i)} ${g(i)} ${L(i)}`, Z)) : Se;
2500
- return Vn(
2585
+ }, Fe = (ye == null ? void 0 : ye.closest('[role="dialog"]')) ?? document.body, He = G.trim() ? de.filter((d) => os(`${$(d)} ${W(d)} ${g(d)}`, G)) : de;
2586
+ return Zr(
2501
2587
  /* @__PURE__ */ u("div", { className: "fixed inset-0 z-[125]", role: "presentation", children: [
2502
- /* @__PURE__ */ s(
2588
+ /* @__PURE__ */ a(
2503
2589
  "div",
2504
2590
  {
2505
2591
  className: "absolute inset-0 bg-slate-900/30 motion-safe:animate-in motion-safe:fade-in",
2506
- onClick: ee
2592
+ onClick: O
2507
2593
  }
2508
2594
  ),
2509
2595
  /* @__PURE__ */ u(
@@ -2515,140 +2601,140 @@ function $s({
2515
2601
  className: "absolute inset-y-0 right-0 flex flex-col border-l border-slate-200 bg-white shadow-2xl motion-safe:animate-in motion-safe:slide-in-from-right dark:border-border dark:bg-background",
2516
2602
  children: [
2517
2603
  /* @__PURE__ */ u("div", { className: "flex items-start gap-2.5 border-b border-slate-200 px-4 py-3 dark:border-border", children: [
2518
- /* @__PURE__ */ s(it, { className: "mt-0.5 h-4 w-4 shrink-0 fill-amber-400 text-amber-400" }),
2604
+ /* @__PURE__ */ a(dt, { className: "mt-0.5 h-4 w-4 shrink-0 fill-amber-400 text-amber-400" }),
2519
2605
  /* @__PURE__ */ u("div", { className: "min-w-0 flex-1", children: [
2520
- /* @__PURE__ */ s("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "CIFA favorites" }),
2521
- /* @__PURE__ */ s("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-slate-400", children: "Browse the full catalog and star items — favorites appear at the top of every request's item list." })
2606
+ /* @__PURE__ */ a("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "CIFA favorites" }),
2607
+ /* @__PURE__ */ a("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-slate-400", children: "Browse the full catalog and star items — favorites appear at the top of every request's item list." })
2522
2608
  ] }),
2523
- /* @__PURE__ */ s(
2609
+ /* @__PURE__ */ a(
2524
2610
  "button",
2525
2611
  {
2526
2612
  type: "button",
2527
- onClick: ee,
2613
+ onClick: O,
2528
2614
  className: "shrink-0 rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/[0.06]",
2529
2615
  "aria-label": "Close",
2530
- children: /* @__PURE__ */ s(Pt, { className: "h-4 w-4" })
2616
+ children: /* @__PURE__ */ a(Lt, { className: "h-4 w-4" })
2531
2617
  }
2532
2618
  )
2533
2619
  ] }),
2534
2620
  /* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 dark:border-border", children: [
2535
2621
  /* @__PURE__ */ u("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 focus-within:border-nvr-cyan focus-within:bg-white dark:border-border dark:bg-muted/40 dark:focus-within:bg-background", children: [
2536
- /* @__PURE__ */ s(Rt, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
2537
- /* @__PURE__ */ s(
2622
+ /* @__PURE__ */ a(Et, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
2623
+ /* @__PURE__ */ a(
2538
2624
  "input",
2539
2625
  {
2540
- ref: Oe,
2541
- value: Z,
2542
- onChange: (i) => z(i.target.value),
2626
+ ref: $e,
2627
+ value: G,
2628
+ onChange: (d) => Ae(d.target.value),
2543
2629
  placeholder: "Search by number or description…",
2544
2630
  className: "min-w-0 flex-1 bg-transparent text-[12px] text-slate-700 outline-none placeholder:text-slate-400 dark:text-slate-200"
2545
2631
  }
2546
2632
  ),
2547
- Z && /* @__PURE__ */ s(
2633
+ G && /* @__PURE__ */ a(
2548
2634
  "button",
2549
2635
  {
2550
2636
  type: "button",
2551
- onClick: () => z(""),
2637
+ onClick: () => Ae(""),
2552
2638
  className: "shrink-0 text-slate-400 hover:text-slate-600",
2553
2639
  "aria-label": "Clear search",
2554
- children: /* @__PURE__ */ s(Pt, { className: "h-3.5 w-3.5" })
2640
+ children: /* @__PURE__ */ a(Lt, { className: "h-3.5 w-3.5" })
2555
2641
  }
2556
2642
  )
2557
2643
  ] }),
2558
- $.length > 0 && /* @__PURE__ */ u("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
2559
- /* @__PURE__ */ s(De, { className: "h-3 w-3 shrink-0" }),
2560
- $.map((i) => i.label ?? M(i.key)).join(", "),
2644
+ M.length > 0 && /* @__PURE__ */ u("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
2645
+ /* @__PURE__ */ a(Be, { className: "h-3 w-3 shrink-0" }),
2646
+ M.map((d) => d.label ?? D(d.key)).join(", "),
2561
2647
  " fill in once the form's warehouse selection is made."
2562
2648
  ] })
2563
2649
  ] }),
2564
- /* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ u("table", { className: "w-full table-fixed border-collapse text-[11px]", children: [
2650
+ /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ u("table", { className: "w-full table-fixed border-collapse text-[11px]", children: [
2565
2651
  /* @__PURE__ */ u("colgroup", { children: [
2566
- /* @__PURE__ */ s("col", { className: "w-9" }),
2567
- /* @__PURE__ */ s("col", { className: "w-[88px]" }),
2568
- /* @__PURE__ */ s("col", {}),
2569
- /* @__PURE__ */ s("col", { className: "w-[130px]" }),
2570
- j.map((i) => /* @__PURE__ */ s("col", { className: "w-[86px]" }, i.key))
2652
+ /* @__PURE__ */ a("col", { className: "w-9" }),
2653
+ /* @__PURE__ */ a("col", { className: "w-[88px]" }),
2654
+ /* @__PURE__ */ a("col", {}),
2655
+ /* @__PURE__ */ a("col", { className: "w-[130px]" }),
2656
+ k.map((d) => /* @__PURE__ */ a("col", { className: "w-[86px]" }, d.key))
2571
2657
  ] }),
2572
- /* @__PURE__ */ s("thead", { className: "sticky top-0 z-[1]", children: /* @__PURE__ */ u("tr", { className: "bg-slate-100 text-left text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:bg-muted dark:text-slate-400", children: [
2573
- /* @__PURE__ */ s("th", { className: "px-2 py-1.5", "aria-label": "Favorite" }),
2574
- /* @__PURE__ */ s("th", { className: "px-2 py-1.5", children: "CIFA #" }),
2575
- /* @__PURE__ */ s("th", { className: "px-2 py-1.5", children: "Description" }),
2576
- /* @__PURE__ */ s("th", { className: "px-2 py-1.5", children: "Category" }),
2577
- j.map((i) => /* @__PURE__ */ s("th", { className: "px-2 py-1.5 text-right", children: i.label ?? M(i.key) }, i.key))
2658
+ /* @__PURE__ */ a("thead", { className: "sticky top-0 z-[1]", children: /* @__PURE__ */ u("tr", { className: "bg-slate-100 text-left text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:bg-muted dark:text-slate-400", children: [
2659
+ /* @__PURE__ */ a("th", { className: "px-2 py-1.5", "aria-label": "Favorite" }),
2660
+ /* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "CIFA #" }),
2661
+ /* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Description" }),
2662
+ /* @__PURE__ */ a("th", { className: "px-2 py-1.5", children: "Category" }),
2663
+ k.map((d) => /* @__PURE__ */ a("th", { className: "px-2 py-1.5 text-right", children: d.label ?? D(d.key) }, d.key))
2578
2664
  ] }) }),
2579
- /* @__PURE__ */ u("tbody", { className: C(ie && "opacity-50 transition-opacity"), children: [
2580
- E(
2665
+ /* @__PURE__ */ u("tbody", { className: I(le && "opacity-50 transition-opacity"), children: [
2666
+ z(
2581
2667
  /* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
2582
- /* @__PURE__ */ s(it, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
2583
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Your favorites" }),
2584
- /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: b.length })
2668
+ /* @__PURE__ */ a(dt, { className: "h-3 w-3 shrink-0 fill-amber-400 text-amber-400" }),
2669
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Your favorites" }),
2670
+ /* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: s.length })
2585
2671
  ] }),
2586
2672
  "border-slate-200 bg-amber-50/70 dark:border-border dark:bg-amber-900/10"
2587
2673
  ),
2588
- V.length === 0 && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s(
2674
+ He.length === 0 && /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
2589
2675
  "td",
2590
2676
  {
2591
- colSpan: 4 + j.length,
2677
+ colSpan: 4 + k.length,
2592
2678
  className: "border-b border-slate-100 px-4 py-3 text-center text-[11px] text-slate-400 dark:border-border/50",
2593
- children: b.length === 0 ? "No favorites yet — star the items you order most." : "No favorites match your search."
2679
+ children: s.length === 0 ? "No favorites yet — star the items you order most." : "No favorites match your search."
2594
2680
  }
2595
2681
  ) }),
2596
- V.map((i, S) => oe(i, S)),
2597
- E(
2682
+ He.map((d, N) => L(d, N)),
2683
+ z(
2598
2684
  /* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
2599
- /* @__PURE__ */ s(Rt, { className: "h-3 w-3 shrink-0 text-slate-400" }),
2600
- /* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
2601
- /* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: Q.toLocaleString() }),
2602
- ie && /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin text-slate-400" })
2685
+ /* @__PURE__ */ a(Et, { className: "h-3 w-3 shrink-0 text-slate-400" }),
2686
+ /* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "All CIFAs" }),
2687
+ /* @__PURE__ */ a("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: V.toLocaleString() }),
2688
+ le && /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" })
2603
2689
  ] }),
2604
2690
  "border-t border-slate-200 bg-slate-50 dark:border-border dark:bg-muted/40"
2605
2691
  ),
2606
- !ie && ae.length === 0 && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s(
2692
+ !le && ie.length === 0 && /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
2607
2693
  "td",
2608
2694
  {
2609
- colSpan: 4 + j.length,
2695
+ colSpan: 4 + k.length,
2610
2696
  className: "px-4 py-4 text-center text-[11px] text-slate-400",
2611
- children: ne.trim() ? `No CIFAs match "${ne}".` : "No catalog items."
2697
+ children: P.trim() ? `No CIFAs match "${P}".` : "No catalog items."
2612
2698
  }
2613
2699
  ) }),
2614
- ae.map((i, S) => oe(i, S))
2700
+ ie.map((d, N) => L(d, N))
2615
2701
  ] })
2616
2702
  ] }) }),
2617
- X > 1 && /* @__PURE__ */ u("div", { className: "flex shrink-0 items-center justify-between border-t border-slate-200 px-3 py-2 dark:border-border", children: [
2703
+ oe > 1 && /* @__PURE__ */ u("div", { className: "flex shrink-0 items-center justify-between border-t border-slate-200 px-3 py-2 dark:border-border", children: [
2618
2704
  /* @__PURE__ */ u("span", { className: "flex items-center gap-2 text-[10px] tabular-nums text-slate-400", children: [
2619
- (se - 1) * ye + 1,
2705
+ (J - 1) * ge + 1,
2620
2706
  "–",
2621
- Math.min(se * ye, Q),
2707
+ Math.min(J * ge, V),
2622
2708
  " of",
2623
2709
  " ",
2624
- Q.toLocaleString(),
2625
- ie && /* @__PURE__ */ u("span", { className: "flex items-center gap-1 text-slate-500", children: [
2626
- /* @__PURE__ */ s(ce, { className: "h-3 w-3 animate-spin" }),
2710
+ V.toLocaleString(),
2711
+ le && /* @__PURE__ */ u("span", { className: "flex items-center gap-1 text-slate-500", children: [
2712
+ /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin" }),
2627
2713
  " Loading…"
2628
2714
  ] })
2629
2715
  ] }),
2630
2716
  /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
2631
- /* @__PURE__ */ s(
2717
+ /* @__PURE__ */ a(
2632
2718
  "button",
2633
2719
  {
2634
2720
  type: "button",
2635
- disabled: se <= 1 || ie,
2636
- onClick: () => xe((i) => Math.max(1, i - 1)),
2721
+ disabled: J <= 1 || le,
2722
+ onClick: () => fe((d) => Math.max(1, d - 1)),
2637
2723
  className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
2638
2724
  children: "‹ Prev"
2639
2725
  }
2640
2726
  ),
2641
2727
  /* @__PURE__ */ u("span", { className: "px-1 text-[10px] tabular-nums text-slate-400", children: [
2642
- se,
2728
+ J,
2643
2729
  " / ",
2644
- X.toLocaleString()
2730
+ oe.toLocaleString()
2645
2731
  ] }),
2646
- /* @__PURE__ */ s(
2732
+ /* @__PURE__ */ a(
2647
2733
  "button",
2648
2734
  {
2649
2735
  type: "button",
2650
- disabled: se >= X || ie,
2651
- onClick: () => xe((i) => Math.min(X, i + 1)),
2736
+ disabled: J >= oe || le,
2737
+ onClick: () => fe((d) => Math.min(oe, d + 1)),
2652
2738
  className: "rounded border border-slate-200 px-2 py-0.5 text-[11px] text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:bg-white/[0.04]",
2653
2739
  children: "Next ›"
2654
2740
  }
@@ -2659,19 +2745,28 @@ function $s({
2659
2745
  }
2660
2746
  )
2661
2747
  ] }),
2662
- lt
2748
+ Fe
2663
2749
  );
2664
2750
  }
2751
+ function Ks(i, m) {
2752
+ var x;
2753
+ if (!i) return null;
2754
+ const b = (x = (m ?? []).find((_) => !_.format && !_.sections_only)) == null ? void 0 : x.field;
2755
+ return !b || i.includes(`{{${b}}}`) ? i : `${i} · {{${b}}}`;
2756
+ }
2665
2757
  export {
2666
- Gs as CatalogPickerField,
2667
- cs as MAX_LINE_MONEY,
2668
- xs as footerSum,
2669
- ks as gridPriceValue,
2670
- vs as isUnpricedLine,
2671
- Ns as issuesAfterLinesChanged,
2672
- gs as lineComputeError,
2673
- Gr as matchesShowWhen,
2674
- ps as qtyEntryProblem,
2675
- ys as refusedQtyNote,
2676
- ws as savedLinesSignature
2758
+ da as CatalogPickerField,
2759
+ ys as MAX_LINE_MONEY,
2760
+ Ks as catalogOptionTemplate,
2761
+ qs as footerSum,
2762
+ Fs as gridPriceValue,
2763
+ Rs as isUnpricedLine,
2764
+ Ts as issuesAfterLinesChanged,
2765
+ js as lineComputeError,
2766
+ ir as matchesShowWhen,
2767
+ _s as qtyEntryProblem,
2768
+ $s as refusedQtyNote,
2769
+ bn as relatedParentTokens,
2770
+ Os as savedLinesSignature,
2771
+ vs as stagedCatalogFill
2677
2772
  };