@nivaro/react 0.3.32 → 0.3.34

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