@nivaro/react 0.3.57 → 0.3.59

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 (69) hide show
  1. package/dist/components/fields/RelationField.js +110 -80
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useRelationOptions.js +1 -0
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +37 -2
  6. package/dist/index.js +523 -520
  7. package/dist/shared/components/CollectionBrowserView.js +2693 -2619
  8. package/dist/shared/components/DataTable.js +538 -495
  9. package/dist/shared/components/ItemEditForm.js +4559 -4386
  10. package/dist/shared/components/PageRenderer.js +537 -508
  11. package/dist/shared/components/ProfileView.js +716 -715
  12. package/dist/shared/components/QueryTable.js +74 -74
  13. package/dist/shared/components/RecordReadView.js +367 -364
  14. package/dist/shared/components/ReportView.js +64 -39
  15. package/dist/shared/components/WidgetSlot.js +543 -520
  16. package/dist/shared/components/alerts/AlertManagerView.js +324 -317
  17. package/dist/shared/components/alerts/types.js +37 -14
  18. package/dist/shared/components/cbv/row-focus.js +19 -0
  19. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  20. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  21. package/dist/shared/components/integrations/console/tone.js +52 -30
  22. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  23. package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
  24. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  25. package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
  26. package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
  27. package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
  28. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  29. package/dist/shared/components/item-edit/PlanGrid.js +973 -894
  30. package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
  31. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  32. package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
  33. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
  34. package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
  35. package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
  36. package/dist/shared/components/item-edit/line-midair.js +82 -75
  37. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  38. package/dist/shared/components/item-edit/related-missing.js +45 -0
  39. package/dist/shared/components/item-edit/save-outcome.js +9 -7
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  41. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  42. package/dist/shared/components/panels/ItemLockBanner.js +213 -211
  43. package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
  44. package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
  45. package/dist/shared/components/panels/RevisionsPanel.js +316 -299
  46. package/dist/shared/components/panels/TaskPanel.js +265 -249
  47. package/dist/shared/components/panels/landing-state.js +27 -0
  48. package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
  49. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  50. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  51. package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
  52. package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
  53. package/dist/shared/components/queue/group-sums.js +27 -0
  54. package/dist/shared/components/queue/live-state-aspect.js +9 -5
  55. package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
  56. package/dist/shared/lib/back-closes.js +25 -0
  57. package/dist/shared/lib/display-prefs.js +60 -52
  58. package/dist/shared/lib/draft-store.js +71 -48
  59. package/dist/shared/lib/expression.js +53 -53
  60. package/dist/shared/lib/form-usage-beacon.js +7 -7
  61. package/dist/shared/lib/list-page-memory.js +63 -0
  62. package/dist/shared/lib/live.js +44 -44
  63. package/dist/shared/lib/money-input.js +45 -0
  64. package/dist/shared/lib/own-writes.js +76 -28
  65. package/dist/shared/lib/request-gate.js +110 -109
  66. package/dist/shared/lib/sanitize-html.js +10 -6
  67. package/dist/shared/lib/staged-row-labels.js +18 -0
  68. package/dist/shared/lib/validation-rules.js +34 -19
  69. package/package.json +1 -1
@@ -1,131 +1,124 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
- import { useQuery as w } from "@tanstack/react-query";
3
- import { ChevronDown as te, Loader2 as ae, AlertTriangle as ce, X as oe, Check as de } from "lucide-react";
4
- import { useState as ne, useRef as me, useEffect as ue } from "react";
5
- import { useNivaroClient as fe, useItemEditAuth as pe, useDrilldown as Ie } from "../../context.js";
6
- import { parseAllowedCollections as Ae } from "../../lib/allowed-collections.js";
7
- import { get as q } from "../../lib/commands.js";
8
- import { compareByMatch as he } from "../../lib/picker-rank.js";
9
- import { useRecordReader as Ke } from "../../lib/record-loader.js";
10
- import { useOnlineUsers as be } from "../../lib/use-online-users.js";
11
- import { cn as Q, userOptionFilter as ye } from "../../lib/utils.js";
12
- import { UserAvatar as xe } from "../UserAvatar.js";
13
- import { Command as ve, CommandInput as ge, CommandList as ke, CommandEmpty as we, CommandGroup as Ne, CommandItem as Se } from "../ui/command.js";
14
- import { Popover as _e, PopoverTrigger as qe, PopoverContent as Ce } from "../ui/popover.js";
15
- import { applyDisplayTemplate as Le } from "./helpers.js";
1
+ import { jsx as l, jsxs as c } from "react/jsx-runtime";
2
+ import { useQuery as L } from "@tanstack/react-query";
3
+ import { ChevronDown as re, Loader2 as ce, AlertTriangle as ue, X as de, Check as me } from "lucide-react";
4
+ import { useState as se, useRef as fe, useEffect as pe } from "react";
5
+ import { useNivaroClient as he, useItemEditAuth as be, useDrilldown as Pe } from "../../context.js";
6
+ import { parseAllowedCollections as De } from "../../lib/allowed-collections.js";
7
+ import { get as U } from "../../lib/commands.js";
8
+ import { compareByMatch as ye } from "../../lib/picker-rank.js";
9
+ import { useRecordReader as Ee } from "../../lib/record-loader.js";
10
+ import { useOnlineUsers as xe } from "../../lib/use-online-users.js";
11
+ import { cn as W, userOptionFilter as ge, matchesAllTokens as Re } from "../../lib/utils.js";
12
+ import { UserAvatar as ve } from "../UserAvatar.js";
13
+ import { Command as ke, CommandInput as Se, CommandList as we, CommandEmpty as Ne, CommandGroup as _e, CommandItem as Le } from "../ui/command.js";
14
+ import { Popover as Ce, PopoverTrigger as qe, PopoverContent as Oe } from "../ui/popover.js";
15
+ import { applyDisplayTemplate as Fe } from "./helpers.js";
16
16
  import { useM2MStaging as je } from "./M2MStagingContext.js";
17
- import { useStaleTip as Je, RelatedItemLabel as ie } from "./RelationCombobox.js";
18
- function Fe(s) {
19
- return s.replace(/\(.*$/, "").trim().split(/\s+/).map((o) => o[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
17
+ import { useStaleTip as ze, RelatedItemLabel as oe } from "./RelationCombobox.js";
18
+ function Te(n) {
19
+ return n.replace(/\(.*$/, "").trim().split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?";
20
20
  }
21
- function Te(s) {
22
- return Ae(s == null ? void 0 : s.one_allowed_collections);
21
+ function Ie(n) {
22
+ return De(n == null ? void 0 : n.one_allowed_collections);
23
23
  }
24
- function Oe(s) {
25
- if (!s) return null;
26
- if (s.one_collection) return s.one_collection;
27
- const o = Te(s);
28
- return o.length === 0 ? null : o.some((N) => N === "directus_users" || N === "nivaro_users") ? "nivaro_users" : o[0];
24
+ function Ue(n) {
25
+ if (!n) return null;
26
+ if (n.one_collection) return n.one_collection;
27
+ const i = Ie(n);
28
+ return i.length === 0 ? null : i.some((p) => p === "directus_users" || p === "nivaro_users") ? "nivaro_users" : i[0];
29
29
  }
30
- function nt(s) {
31
- if (!s || s.one_collection) return null;
32
- const o = Te(s);
33
- if (o.length === 0) return null;
34
- const N = o.includes("directus_users") ? "directus_users" : o.includes("nivaro_users") ? "nivaro_users" : o[0];
35
- return { field: s.one_collection_field ?? "collection", value: N };
30
+ function ot(n) {
31
+ if (!n || n.one_collection) return null;
32
+ const i = Ie(n);
33
+ if (i.length === 0) return null;
34
+ const p = i.includes("directus_users") ? "directus_users" : i.includes("nivaro_users") ? "nivaro_users" : i[0];
35
+ return { field: n.one_collection_field ?? "collection", value: p };
36
36
  }
37
- function lt({
38
- relation: s,
39
- parentId: o,
40
- allRelations: N,
41
- extraFilter: h,
42
- optionSort: b,
43
- requiredParent: K,
44
- onCountChange: J,
45
- drilldown: D
37
+ function Q(n) {
38
+ return String(n).toLowerCase();
39
+ }
40
+ function ct({
41
+ relation: n,
42
+ parentId: i,
43
+ allRelations: p,
44
+ extraFilter: d,
45
+ optionSort: h,
46
+ requiredParent: S,
47
+ onCountChange: w,
48
+ drilldown: C
46
49
  }) {
47
- const y = fe(), W = Ie(), t = je(), [P, C] = ne(!1), [x, T] = ne(""), le = N.find(
48
- (e) => e.many_collection === s.many_collection && e.many_field === s.junction_field && e.id !== s.id
49
- ), r = Oe(le), v = s.junction_field ?? "", R = s.many_field ?? "", d = s.one_field ?? `${s.many_collection}.${v}`, { data: a } = w({
50
- queryKey: ["col-meta", r],
51
- queryFn: () => y.request(q(`/collections/${r}`)).then((e) => e.data),
52
- enabled: !!r,
50
+ const x = he(), F = Pe(), t = je(), [j, v] = se(!1), [y, q] = se(""), T = p.find(
51
+ (e) => e.many_collection === n.many_collection && e.many_field === n.junction_field && e.id !== n.id
52
+ ), s = Ue(T), N = n.junction_field ?? "", P = n.many_field ?? "", u = n.one_field ?? `${n.many_collection}.${N}`, { data: o } = L({
53
+ queryKey: ["col-meta", s],
54
+ queryFn: () => x.request(U(`/collections/${s}`)).then((e) => e.data),
55
+ enabled: !!s,
53
56
  staleTime: 3e5,
54
57
  retry: !1
55
- }), { data: X = [] } = w({
56
- queryKey: ["m2m-items", s.many_collection, R, o],
57
- queryFn: () => y.request(
58
- q(`/items/${s.many_collection}`, {
59
- filter: JSON.stringify({ [R]: { _eq: o } }),
58
+ }), { data: X = [] } = L({
59
+ queryKey: ["m2m-items", n.many_collection, P, i],
60
+ queryFn: () => x.request(
61
+ U(`/items/${n.many_collection}`, {
62
+ filter: JSON.stringify({ [P]: { _eq: i } }),
60
63
  limit: 200,
61
- fields: `id,${v}`
64
+ fields: `id,${N}`
62
65
  })
63
66
  ).then((e) => e.data ?? []),
64
67
  staleTime: 3e4,
65
- enabled: !!o && o !== "new"
66
- }), re = pe().isAdmin, z = r === "nivaro_users" ? ye(re) : null, E = be(r === "nivaro_users"), H = h ? z ? { _and: [h, z] } : h : z, L = H ? JSON.stringify(H) : void 0, g = b && !/^-?label$/.test(b) ? b : void 0, S = (() => {
67
- const e = a == null ? void 0 : a.display_template;
68
+ enabled: !!i && i !== "new"
69
+ }), ae = be().isAdmin, D = s === "nivaro_users" ? ge(ae) : null, E = xe(s === "nivaro_users"), H = d ? D ? { _and: [d, D] } : d : D, R = H ? JSON.stringify(H) : void 0, z = h && !/^-?label$/.test(h) ? h : void 0, Y = (() => {
70
+ const e = o == null ? void 0 : o.display_template;
68
71
  if (!e || !e.includes(".")) return null;
69
- const i = [...e.matchAll(/\{\{([^}]+)\}\}/g)].map((u) => u[1].trim());
70
- return i.length === 0 ? null : ["id", ...i].join(",");
71
- })(), { data: O = [], isFetching: B } = w({
72
- queryKey: [
73
- "m2m-options",
74
- r,
75
- x,
76
- L,
77
- g ?? "",
78
- S ?? ""
79
- ],
80
- queryFn: () => y.request(
81
- q(`/items/${r}`, {
82
- limit: 200,
83
- search: x || void 0,
84
- filter: L,
85
- picker: "1",
86
- // A dotted display template ({{core_category.name}}) needs the
87
- // nested expansion — a bare row only carries the FK id.
88
- ...S ? { fields: S } : {},
89
- ...g ? { sort: g } : {}
90
- })
91
- ).then((e) => e.data ?? []),
92
- enabled: P && !!r,
93
- staleTime: L ? 0 : 3e4
94
- }), V = (t == null ? void 0 : t.getStagedLinks(d)) ?? [], k = (t == null ? void 0 : t.getStagedUnlinks(d)) ?? /* @__PURE__ */ new Set(), U = X.filter((e) => !k.has(e.id)), f = new Set(U.map((e) => String(e[v]))), _ = [...f], Y = JSON.stringify(h ? { _and: [{ id: { _in: _ } }, h] } : { id: { _in: _ } }), { data: m } = w({
95
- queryKey: ["m2m-avail", r, _.join(","), L],
96
- queryFn: () => y.request(
97
- q(`/items/${r}`, {
98
- filter: Y,
72
+ const a = [...e.matchAll(/\{\{([^}]+)\}\}/g)].map((f) => f[1].trim());
73
+ return a.length === 0 ? null : ["id", ...a].join(",");
74
+ })(), {
75
+ options: Z,
76
+ isLoading: M,
77
+ localSearch: B
78
+ } = Ae({
79
+ client: x,
80
+ relatedCollection: s,
81
+ search: y,
82
+ filterParam: R,
83
+ serverSort: z,
84
+ templateNestedFields: Y,
85
+ enabled: j && !!s,
86
+ labelOf: k
87
+ }), ee = (t == null ? void 0 : t.getStagedLinks(u)) ?? [], _ = (t == null ? void 0 : t.getStagedUnlinks(u)) ?? /* @__PURE__ */ new Set(), A = X.filter((e) => !_.has(e.id)), g = new Set(A.map((e) => String(e[N]))), O = [...g], te = JSON.stringify(d ? { _and: [{ id: { _in: O } }, d] } : { id: { _in: O } }), { data: m } = L({
88
+ queryKey: ["m2m-avail", s, O.join(","), R],
89
+ queryFn: () => x.request(
90
+ U(`/items/${s}`, {
91
+ filter: te,
99
92
  picker: "1",
100
93
  limit: 200,
101
94
  fields: "id"
102
95
  })
103
96
  ).then((e) => e.data ?? []),
104
- enabled: !!r && _.length > 0,
97
+ enabled: !!s && O.length > 0,
105
98
  staleTime: 3e4
106
- }), Z = new Set((m ?? []).map((e) => String(e.id))), $ = m !== void 0 ? new Set(_.filter((e) => !Z.has(e))) : /* @__PURE__ */ new Set(), I = new Set(V.map(String)), A = /* @__PURE__ */ new Set([...f, ...I]), j = me(J);
107
- j.current = J, ue(() => {
99
+ }), ne = new Set((m ?? []).map((e) => String(e.id))), $ = m !== void 0 ? new Set(O.filter((e) => !ne.has(e))) : /* @__PURE__ */ new Set(), K = new Set(ee.map(Q)), J = /* @__PURE__ */ new Set([...[...g].map(Q), ...K]), I = fe(w);
100
+ I.current = w, pe(() => {
108
101
  var e;
109
- (e = j.current) == null || e.call(j, A.size);
110
- }, [A.size]);
102
+ (e = I.current) == null || e.call(I, J.size);
103
+ }, [J.size]);
111
104
  function G(e) {
112
- const i = String(e);
113
- if (I.has(i)) {
114
- t == null || t.unstageLink(d, e);
105
+ const a = Q(e);
106
+ if (K.has(a)) {
107
+ t == null || t.unstageLink(u, e);
115
108
  return;
116
109
  }
117
- const u = X.find((M) => String(M[v]) === i);
118
- if (u) {
119
- k.has(u.id) ? t == null || t.unstageUnlink(d, u.id) : t == null || t.stageUnlink(d, u.id);
110
+ const f = X.find((V) => Q(V[N]) === a);
111
+ if (f) {
112
+ _.has(f.id) ? t == null || t.unstageUnlink(u, f.id) : t == null || t.stageUnlink(u, f.id);
120
113
  return;
121
114
  }
122
- t == null || t.stageLink(d, e);
115
+ t == null || t.stageLink(u, e);
123
116
  }
124
- function F(e) {
125
- const i = (a == null ? void 0 : a.display_template) ?? null;
126
- return i ? Le(i, e) : String(e._display ?? e.id ?? "");
117
+ function k(e) {
118
+ const a = (o == null ? void 0 : o.display_template) ?? null;
119
+ return a ? Fe(a, e) : String(e._display ?? e.id ?? "");
127
120
  }
128
- return K ? /* @__PURE__ */ c(
121
+ return S ? /* @__PURE__ */ c(
129
122
  "button",
130
123
  {
131
124
  type: "button",
@@ -134,31 +127,31 @@ function lt({
134
127
  children: [
135
128
  /* @__PURE__ */ c("span", { className: "truncate", children: [
136
129
  "Select ",
137
- K,
130
+ S,
138
131
  " first"
139
132
  ] }),
140
- /* @__PURE__ */ n(te, { className: "h-4 w-4 shrink-0 opacity-50" })
133
+ /* @__PURE__ */ l(re, { className: "h-4 w-4 shrink-0 opacity-50" })
141
134
  ]
142
135
  }
143
- ) : /* @__PURE__ */ n("div", { children: /* @__PURE__ */ c(
144
- _e,
136
+ ) : /* @__PURE__ */ l("div", { children: /* @__PURE__ */ c(
137
+ Ce,
145
138
  {
146
- open: P,
139
+ open: j,
147
140
  onOpenChange: (e) => {
148
- C(e), e || T("");
141
+ v(e), e || q("");
149
142
  },
150
143
  children: [
151
- /* @__PURE__ */ n(qe, { asChild: !0, children: /* @__PURE__ */ c(
144
+ /* @__PURE__ */ l(qe, { asChild: !0, children: /* @__PURE__ */ c(
152
145
  "div",
153
146
  {
154
147
  role: "button",
155
148
  tabIndex: 0,
156
149
  onKeyDown: (e) => {
157
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), C((i) => !i));
150
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), v((a) => !a));
158
151
  },
159
152
  className: "flex min-h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm text-left font-normal hover:bg-muted",
160
153
  children: [
161
- A.size > 0 ? /* @__PURE__ */ c(
154
+ J.size > 0 ? /* @__PURE__ */ c(
162
155
  "span",
163
156
  {
164
157
  className: "flex min-w-0 flex-1 flex-wrap items-center gap-1",
@@ -166,55 +159,55 @@ function lt({
166
159
  e.target.closest("button") && e.stopPropagation();
167
160
  },
168
161
  children: [
169
- U.map((e) => {
170
- const i = e[v], u = $.has(String(i));
162
+ A.map((e) => {
163
+ const a = e[N], f = $.has(String(a));
171
164
  return /* @__PURE__ */ c(
172
165
  "span",
173
166
  {
174
- title: u ? "This record is no longer an available option" : void 0,
175
- className: Q(
167
+ title: f ? "This record is no longer an available option" : void 0,
168
+ className: W(
176
169
  "inline-flex items-center gap-1 rounded-full border pl-2.5 pr-1.5 py-0.5 text-[12px]",
177
- u ? "border-amber-300 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-400" : "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200"
170
+ f ? "border-amber-300 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-400" : "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200"
178
171
  ),
179
172
  children: [
180
- u && /* @__PURE__ */ n(ce, { className: "h-3 w-3 shrink-0 text-amber-500" }),
181
- r && (D && W ? /* @__PURE__ */ n(
173
+ f && /* @__PURE__ */ l(ue, { className: "h-3 w-3 shrink-0 text-amber-500" }),
174
+ s && (C && F ? /* @__PURE__ */ l(
182
175
  "button",
183
176
  {
184
177
  type: "button",
185
178
  title: "Open detail panel",
186
- onClick: () => W.open({
187
- collection: r,
188
- itemId: String(i),
189
- layoutId: D.layout_id,
190
- width: D.width
179
+ onClick: () => F.open({
180
+ collection: s,
181
+ itemId: String(a),
182
+ layoutId: C.layout_id,
183
+ width: C.width
191
184
  }),
192
185
  className: "underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
193
- children: /* @__PURE__ */ n(
194
- ie,
186
+ children: /* @__PURE__ */ l(
187
+ oe,
195
188
  {
196
- collection: r,
197
- id: i,
198
- displayTemplate: a == null ? void 0 : a.display_template
189
+ collection: s,
190
+ id: a,
191
+ displayTemplate: o == null ? void 0 : o.display_template
199
192
  }
200
193
  )
201
194
  }
202
- ) : /* @__PURE__ */ n(
203
- ie,
195
+ ) : /* @__PURE__ */ l(
196
+ oe,
204
197
  {
205
- collection: r,
206
- id: i,
207
- displayTemplate: a == null ? void 0 : a.display_template
198
+ collection: s,
199
+ id: a,
200
+ displayTemplate: o == null ? void 0 : o.display_template
208
201
  }
209
202
  )),
210
- /* @__PURE__ */ n(
203
+ /* @__PURE__ */ l(
211
204
  "button",
212
205
  {
213
206
  type: "button",
214
207
  "aria-label": "Remove",
215
- onClick: () => t == null ? void 0 : t.stageUnlink(d, e.id),
208
+ onClick: () => t == null ? void 0 : t.stageUnlink(u, e.id),
216
209
  className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
217
- children: /* @__PURE__ */ n(oe, { className: "h-3 w-3" })
210
+ children: /* @__PURE__ */ l(de, { className: "h-3 w-3" })
218
211
  }
219
212
  )
220
213
  ]
@@ -222,27 +215,27 @@ function lt({
222
215
  String(e.id)
223
216
  );
224
217
  }),
225
- V.map((e) => /* @__PURE__ */ c(
218
+ ee.map((e) => /* @__PURE__ */ c(
226
219
  "span",
227
220
  {
228
221
  className: "inline-flex items-center gap-1 rounded-full border border-dashed border-nvr-cyan/50 bg-nvr-cyan/5 pl-2.5 pr-1.5 py-0.5 text-[12px] text-slate-600 dark:text-slate-300",
229
222
  children: [
230
- r ? /* @__PURE__ */ n(
231
- ie,
223
+ s ? /* @__PURE__ */ l(
224
+ oe,
232
225
  {
233
- collection: r,
226
+ collection: s,
234
227
  id: e,
235
- displayTemplate: a == null ? void 0 : a.display_template
228
+ displayTemplate: o == null ? void 0 : o.display_template
236
229
  }
237
230
  ) : String(e),
238
- /* @__PURE__ */ n(
231
+ /* @__PURE__ */ l(
239
232
  "button",
240
233
  {
241
234
  type: "button",
242
235
  "aria-label": "Remove",
243
- onClick: () => t == null ? void 0 : t.unstageLink(d, e),
236
+ onClick: () => t == null ? void 0 : t.unstageLink(u, e),
244
237
  className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
245
- children: /* @__PURE__ */ n(oe, { className: "h-3 w-3" })
238
+ children: /* @__PURE__ */ l(de, { className: "h-3 w-3" })
246
239
  }
247
240
  )
248
241
  ]
@@ -251,63 +244,63 @@ function lt({
251
244
  ))
252
245
  ]
253
246
  }
254
- ) : /* @__PURE__ */ n("span", { className: "truncate text-muted-foreground", children: "Select items…" }),
255
- /* @__PURE__ */ n(te, { className: "h-4 w-4 shrink-0 opacity-50" })
247
+ ) : /* @__PURE__ */ l("span", { className: "truncate text-muted-foreground", children: "Select items…" }),
248
+ /* @__PURE__ */ l(re, { className: "h-4 w-4 shrink-0 opacity-50" })
256
249
  ]
257
250
  }
258
251
  ) }),
259
- /* @__PURE__ */ n(Ce, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(ve, { shouldFilter: !1, children: [
260
- /* @__PURE__ */ n(
261
- ge,
252
+ /* @__PURE__ */ l(Oe, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(ke, { shouldFilter: !1, children: [
253
+ /* @__PURE__ */ l(
254
+ Se,
262
255
  {
263
256
  placeholder: "Search…",
264
- value: x,
265
- onValueChange: T,
257
+ value: y,
258
+ onValueChange: q,
266
259
  className: "h-9 text-[13px]"
267
260
  }
268
261
  ),
269
- /* @__PURE__ */ c(ke, { children: [
270
- B ? /* @__PURE__ */ n("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ n(ae, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ n(we, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
271
- /* @__PURE__ */ n(Ne, { children: !B && (g ? [...O] : [...O].sort(
272
- (e, i) => he(F(e), F(i), x, b === "-label")
262
+ /* @__PURE__ */ c(we, { children: [
263
+ M ? /* @__PURE__ */ l("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ l(ce, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ l(Ne, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
264
+ /* @__PURE__ */ l(_e, { children: !M && (z ? [...ie(Z, y, B, k)] : [...ie(Z, y, B, k)].sort(
265
+ (e, a) => ye(k(e), k(a), y, h === "-label")
273
266
  )).map((e) => {
274
- const i = String(e.id), u = A.has(i);
267
+ const a = String(e.id), f = J.has(Q(a));
275
268
  return /* @__PURE__ */ c(
276
- Se,
269
+ Le,
277
270
  {
278
- value: i,
271
+ value: a,
279
272
  onSelect: () => G(e.id),
280
273
  className: "flex items-center gap-2 text-[13px]",
281
274
  children: [
282
- /* @__PURE__ */ n(
275
+ /* @__PURE__ */ l(
283
276
  "div",
284
277
  {
285
- className: Q(
278
+ className: W(
286
279
  "flex h-4 w-4 shrink-0 items-center justify-center rounded border",
287
- u ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
280
+ f ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
288
281
  ),
289
- children: u && /* @__PURE__ */ n(de, { className: "h-2.5 w-2.5 text-white" })
282
+ children: f && /* @__PURE__ */ l(me, { className: "h-2.5 w-2.5 text-white" })
290
283
  }
291
284
  ),
292
- r === "nivaro_users" && /* @__PURE__ */ n(
293
- xe,
285
+ s === "nivaro_users" && /* @__PURE__ */ l(
286
+ ve,
294
287
  {
295
- userId: i,
288
+ userId: a,
296
289
  className: "h-4 w-4",
297
- fallback: /* @__PURE__ */ n("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children: Fe(F(e)) })
290
+ fallback: /* @__PURE__ */ l("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children: Te(k(e)) })
298
291
  }
299
292
  ),
300
- r === "nivaro_users" && E.has(i.toUpperCase()) && /* @__PURE__ */ n(
293
+ s === "nivaro_users" && E.has(a.toUpperCase()) && /* @__PURE__ */ l(
301
294
  "span",
302
295
  {
303
296
  className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
304
297
  "data-tip": "Online now"
305
298
  }
306
299
  ),
307
- /* @__PURE__ */ n("span", { className: "truncate", children: F(e) })
300
+ /* @__PURE__ */ l("span", { className: "truncate", children: k(e) })
308
301
  ]
309
302
  },
310
- i
303
+ a
311
304
  );
312
305
  }) })
313
306
  ] })
@@ -316,101 +309,131 @@ function lt({
316
309
  }
317
310
  ) });
318
311
  }
319
- function rt({
320
- relation: s,
321
- parentId: o,
322
- allRelations: N,
323
- extraFilter: h,
324
- optionSort: b,
325
- requiredParent: K,
326
- onCountChange: J,
327
- readOnly: D
312
+ function Ae(n) {
313
+ const { client: i, relatedCollection: p, search: d, filterParam: h, serverSort: S, templateNestedFields: w } = n, C = (T) => i.request(
314
+ U(`/items/${p}`, {
315
+ limit: $e,
316
+ search: T || void 0,
317
+ filter: h,
318
+ picker: "1",
319
+ // A dotted display template ({{core_category.name}}) needs the
320
+ // nested expansion — a bare row only carries the FK id.
321
+ ...w ? { fields: w } : {},
322
+ ...S ? { sort: S } : {}
323
+ })
324
+ ).then((s) => s.data ?? []), x = (T) => [
325
+ "m2m-options",
326
+ p,
327
+ T,
328
+ h,
329
+ S ?? "",
330
+ w ?? ""
331
+ ], F = h ? 0 : 3e4, { data: t, isFetching: j } = L({
332
+ queryKey: x(""),
333
+ queryFn: () => C(""),
334
+ enabled: n.enabled,
335
+ staleTime: F
336
+ }), v = Me(t, d, n.labelOf), { data: y, isFetching: q } = L({
337
+ queryKey: x(d),
338
+ queryFn: () => C(d),
339
+ enabled: n.enabled && v,
340
+ staleTime: F
341
+ });
342
+ return v ? { options: y ?? [], isLoading: !y && q, localSearch: !1 } : { options: t ?? [], isLoading: !t && j, localSearch: !!d };
343
+ }
344
+ const $e = 200;
345
+ function Me(n, i, p) {
346
+ return i.trim() ? !n || n.length >= $e ? !0 : ie(n, i, !0, p).length === 0 : !1;
347
+ }
348
+ function ie(n, i, p, d) {
349
+ return !p || !i.trim() ? n : n.filter((h) => Re(d(h), i));
350
+ }
351
+ function dt({
352
+ relation: n,
353
+ parentId: i,
354
+ allRelations: p,
355
+ extraFilter: d,
356
+ optionSort: h,
357
+ requiredParent: S,
358
+ onCountChange: w,
359
+ readOnly: C
328
360
  }) {
329
- const y = fe(), W = Ke(), t = je(), [P, C] = ne(!1), [x, T] = ne(""), le = N.find(
330
- (l) => l.many_collection === s.many_collection && l.many_field === s.junction_field && l.id !== s.id
331
- ), r = Oe(le), v = s.junction_field ?? "", R = s.many_field ?? "", d = s.one_field ?? `${s.many_collection}.${v}`, { data: a } = w({
332
- queryKey: ["col-meta", r],
333
- queryFn: () => y.request(q(`/collections/${r}`)).then((l) => l.data),
334
- enabled: !!r,
361
+ const x = he(), F = Ee(), t = je(), [j, v] = se(!1), [y, q] = se(""), T = p.find(
362
+ (r) => r.many_collection === n.many_collection && r.many_field === n.junction_field && r.id !== n.id
363
+ ), s = Ue(T), N = n.junction_field ?? "", P = n.many_field ?? "", u = n.one_field ?? `${n.many_collection}.${N}`, { data: o } = L({
364
+ queryKey: ["col-meta", s],
365
+ queryFn: () => x.request(U(`/collections/${s}`)).then((r) => r.data),
366
+ enabled: !!s,
335
367
  staleTime: 3e5,
336
368
  retry: !1
337
- }), { data: X = [], isFetching: re } = w({
338
- queryKey: ["m2m-items", s.many_collection, R, o],
339
- queryFn: () => y.request(
340
- q(`/items/${s.many_collection}`, {
341
- filter: JSON.stringify({ [R]: { _eq: o } }),
369
+ }), { data: X = [], isFetching: ae } = L({
370
+ queryKey: ["m2m-items", n.many_collection, P, i],
371
+ queryFn: () => x.request(
372
+ U(`/items/${n.many_collection}`, {
373
+ filter: JSON.stringify({ [P]: { _eq: i } }),
342
374
  limit: 1,
343
- fields: `id,${v}`
375
+ fields: `id,${N}`
344
376
  })
345
- ).then((l) => l.data ?? []),
377
+ ).then((r) => r.data ?? []),
346
378
  staleTime: 3e4,
347
- enabled: !!o && o !== "new"
348
- }), z = pe().isAdmin, E = r === "nivaro_users" ? ye(z) : null, H = be(r === "nivaro_users"), L = h ? E ? { _and: [h, E] } : h : E, g = L ? JSON.stringify(L) : void 0, S = b && !/^-?label$/.test(b) ? b : void 0, O = (() => {
349
- const l = a == null ? void 0 : a.display_template;
350
- if (!l || !l.includes(".")) return null;
351
- const p = [...l.matchAll(/\{\{([^}]+)\}\}/g)].map((ee) => ee[1].trim());
352
- return p.length === 0 ? null : ["id", ...p].join(",");
353
- })(), { data: B = [], isFetching: V } = w({
354
- queryKey: [
355
- "m2m-options",
356
- r,
357
- x,
358
- g,
359
- S ?? "",
360
- O ?? ""
361
- ],
362
- queryFn: () => y.request(
363
- q(`/items/${r}`, {
364
- limit: 200,
365
- search: x || void 0,
366
- filter: g,
367
- picker: "1",
368
- // A dotted display template ({{core_category.name}}) needs the
369
- // nested expansion — a bare row only carries the FK id.
370
- ...O ? { fields: O } : {},
371
- ...S ? { sort: S } : {}
372
- })
373
- ).then((l) => l.data ?? []),
374
- enabled: P && !!r,
375
- staleTime: g ? 0 : 3e4
376
- }), k = (t == null ? void 0 : t.getStagedLinks(d)) ?? [], U = (t == null ? void 0 : t.getStagedUnlinks(d)) ?? /* @__PURE__ */ new Set(), f = X.find((l) => !U.has(l.id)) ?? null, _ = f ? f[v] : null, Y = k.length > 0 ? k[k.length - 1] : null, m = Y ?? _, Z = k.length > 0 || U.size > 0, $ = me(J);
377
- $.current = J, ue(() => {
378
- var l;
379
- (l = $.current) == null || l.call($, m != null ? 1 : 0);
379
+ enabled: !!i && i !== "new"
380
+ }), D = be().isAdmin, E = s === "nivaro_users" ? ge(D) : null, H = xe(s === "nivaro_users"), R = d ? E ? { _and: [d, E] } : d : E, z = R ? JSON.stringify(R) : void 0, Y = h && !/^-?label$/.test(h) ? h : void 0, Z = (() => {
381
+ const r = o == null ? void 0 : o.display_template;
382
+ if (!r || !r.includes(".")) return null;
383
+ const b = [...r.matchAll(/\{\{([^}]+)\}\}/g)].map((le) => le[1].trim());
384
+ return b.length === 0 ? null : ["id", ...b].join(",");
385
+ })(), {
386
+ options: M,
387
+ isLoading: B,
388
+ localSearch: ee
389
+ } = Ae({
390
+ client: x,
391
+ relatedCollection: s,
392
+ search: y,
393
+ filterParam: z,
394
+ serverSort: Y,
395
+ templateNestedFields: Z,
396
+ enabled: j && !!s,
397
+ labelOf: e
398
+ }), _ = (t == null ? void 0 : t.getStagedLinks(u)) ?? [], A = (t == null ? void 0 : t.getStagedUnlinks(u)) ?? /* @__PURE__ */ new Set(), g = X.find((r) => !A.has(r.id)) ?? null, O = g ? g[N] : null, te = _.length > 0 ? _[_.length - 1] : null, m = te ?? O, ne = _.length > 0 || A.size > 0, $ = fe(w);
399
+ $.current = w, pe(() => {
400
+ var r;
401
+ (r = $.current) == null || r.call($, m != null ? 1 : 0);
380
402
  }, [m]);
381
- const { data: I } = w({
382
- queryKey: ["relation-single", r, String(m)],
383
- queryFn: () => W(r, m),
384
- enabled: !!r && m != null,
403
+ const { data: K } = L({
404
+ queryKey: ["relation-single", s, String(m)],
405
+ queryFn: () => F(s, m),
406
+ enabled: !!s && m != null,
385
407
  staleTime: 6e4
386
- }), A = JSON.stringify(h ? { _and: [{ id: { _eq: m } }, h] } : { id: { _eq: m } }), { data: j } = w({
387
- queryKey: ["relation-avail", r, String(m), g],
388
- queryFn: () => y.request(
389
- q(`/items/${r}`, {
390
- filter: A,
408
+ }), J = JSON.stringify(d ? { _and: [{ id: { _eq: m } }, d] } : { id: { _eq: m } }), { data: I } = L({
409
+ queryKey: ["relation-avail", s, String(m), z],
410
+ queryFn: () => x.request(
411
+ U(`/items/${s}`, {
412
+ filter: J,
391
413
  picker: "1",
392
414
  limit: 1,
393
415
  fields: "id"
394
416
  })
395
- ).then((l) => l.data ?? []),
396
- enabled: !!r && m != null && !!I,
417
+ ).then((r) => r.data ?? []),
418
+ enabled: !!s && m != null && !!K,
397
419
  staleTime: 3e4
398
- }), G = j !== void 0 && j.length === 0, F = Je(G), e = (a == null ? void 0 : a.display_template) ?? null;
399
- function i(l) {
400
- return e ? Le(e, l) : String(l.name ?? l.title ?? l.label ?? l.id ?? "");
420
+ }), G = I !== void 0 && I.length === 0, k = ze(G);
421
+ function e(r) {
422
+ const b = (o == null ? void 0 : o.display_template) ?? null;
423
+ return b ? Fe(b, r) : String(r.name ?? r.title ?? r.label ?? r.id ?? "");
401
424
  }
402
- const u = B.find((l) => String(l.id) === String(m)) ?? I, M = m != null && !I && !u, se = u ? i(u) : null;
403
- if (D)
404
- return /* @__PURE__ */ n("span", { className: "block truncate text-[12px] text-slate-700 dark:text-slate-200", children: M ? "…" : se ?? "—" });
405
- function Ue(l) {
406
- for (const p of k) t == null || t.unstageLink(d, p);
407
- f && !U.has(f.id) && (t == null || t.stageUnlink(d, f.id)), String(l) === String(_) && f ? t == null || t.unstageUnlink(d, f.id) : String(l) !== String(m) && (t == null || t.stageLink(d, l)), C(!1), T("");
425
+ const a = M.find((r) => String(r.id) === String(m)) ?? K, f = m != null && !K && !a, V = a ? e(a) : null;
426
+ if (C)
427
+ return /* @__PURE__ */ l("span", { className: "block truncate text-[12px] text-slate-700 dark:text-slate-200", children: f ? "…" : V ?? "—" });
428
+ function Ke(r) {
429
+ for (const b of _) t == null || t.unstageLink(u, b);
430
+ g && !A.has(g.id) && (t == null || t.stageUnlink(u, g.id)), String(r) === String(O) && g ? t == null || t.unstageUnlink(u, g.id) : String(r) !== String(m) && (t == null || t.stageLink(u, r)), v(!1), q("");
408
431
  }
409
- function $e() {
410
- for (const l of k) t == null || t.unstageLink(d, l);
411
- f && (t == null || t.stageUnlink(d, f.id)), C(!1);
432
+ function Je() {
433
+ for (const r of _) t == null || t.unstageLink(u, r);
434
+ g && (t == null || t.stageUnlink(u, g.id)), v(!1);
412
435
  }
413
- return K ? /* @__PURE__ */ c(
436
+ return S ? /* @__PURE__ */ c(
414
437
  "button",
415
438
  {
416
439
  type: "button",
@@ -419,54 +442,54 @@ function rt({
419
442
  children: [
420
443
  /* @__PURE__ */ c("span", { className: "truncate text-muted-foreground", children: [
421
444
  "Select ",
422
- K,
445
+ S,
423
446
  " first"
424
447
  ] }),
425
- /* @__PURE__ */ n(te, { className: "h-4 w-4 shrink-0 opacity-50" })
448
+ /* @__PURE__ */ l(re, { className: "h-4 w-4 shrink-0 opacity-50" })
426
449
  ]
427
450
  }
428
- ) : /* @__PURE__ */ c("div", { ...F.bind, children: [
451
+ ) : /* @__PURE__ */ c("div", { ...k.bind, children: [
429
452
  /* @__PURE__ */ c(
430
- _e,
453
+ Ce,
431
454
  {
432
- open: P,
433
- onOpenChange: (l) => {
434
- C(l), l || T("");
455
+ open: j,
456
+ onOpenChange: (r) => {
457
+ v(r), r || q("");
435
458
  },
436
459
  children: [
437
- /* @__PURE__ */ n(qe, { asChild: !0, children: /* @__PURE__ */ c(
460
+ /* @__PURE__ */ l(qe, { asChild: !0, children: /* @__PURE__ */ c(
438
461
  "button",
439
462
  {
440
463
  type: "button",
441
- className: Q(
464
+ className: W(
442
465
  "w-full h-9 px-3 text-[12px] border rounded-md bg-background text-left flex items-center justify-between hover:bg-muted cursor-pointer transition-colors disabled:pointer-events-none disabled:opacity-50",
443
- G ? "border-amber-300 dark:border-amber-600" : Z ? "border-nvr-cyan/50" : "border-input"
466
+ G ? "border-amber-300 dark:border-amber-600" : ne ? "border-nvr-cyan/50" : "border-input"
444
467
  ),
445
468
  children: [
446
- M || re && Y == null && o !== "new" ? /* @__PURE__ */ n(ae, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ c(
469
+ f || ae && te == null && i !== "new" ? /* @__PURE__ */ l(ce, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ c(
447
470
  "span",
448
471
  {
449
- className: Q(
472
+ className: W(
450
473
  "flex items-center gap-1.5 truncate min-w-0",
451
- se ? Z ? "text-nvr-cyan" : "text-slate-800 dark:text-slate-100" : "text-muted-foreground"
474
+ V ? ne ? "text-nvr-cyan" : "text-slate-800 dark:text-slate-100" : "text-muted-foreground"
452
475
  ),
453
476
  children: [
454
- G && /* @__PURE__ */ n(ce, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
455
- /* @__PURE__ */ n("span", { className: "truncate", children: se ?? "Select…" })
477
+ G && /* @__PURE__ */ l(ue, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
478
+ /* @__PURE__ */ l("span", { className: "truncate", children: V ?? "Select…" })
456
479
  ]
457
480
  }
458
481
  ),
459
- /* @__PURE__ */ n(te, { className: "h-4 w-4 shrink-0 opacity-50" })
482
+ /* @__PURE__ */ l(re, { className: "h-4 w-4 shrink-0 opacity-50" })
460
483
  ]
461
484
  }
462
485
  ) }),
463
- /* @__PURE__ */ n(Ce, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(ve, { shouldFilter: !1, children: [
464
- /* @__PURE__ */ n(
465
- ge,
486
+ /* @__PURE__ */ l(Oe, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ c(ke, { shouldFilter: !1, children: [
487
+ /* @__PURE__ */ l(
488
+ Se,
466
489
  {
467
490
  placeholder: "Search…",
468
- value: x,
469
- onValueChange: T,
491
+ value: y,
492
+ onValueChange: q,
470
493
  className: "h-9 text-[12px]"
471
494
  }
472
495
  ),
@@ -475,57 +498,57 @@ function rt({
475
498
  {
476
499
  type: "button",
477
500
  onClick: () => {
478
- $e(), C(!1);
501
+ Je(), v(!1);
479
502
  },
480
503
  className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-slate-500 hover:bg-muted border-b border-slate-100 dark:text-slate-400 dark:border-border",
481
504
  children: [
482
- /* @__PURE__ */ n(oe, { className: "h-3.5 w-3.5 text-slate-400" }),
505
+ /* @__PURE__ */ l(de, { className: "h-3.5 w-3.5 text-slate-400" }),
483
506
  "Clear selection"
484
507
  ]
485
508
  }
486
509
  ),
487
- /* @__PURE__ */ c(ke, { children: [
488
- V ? /* @__PURE__ */ n("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ n(ae, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ n(we, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
489
- !V && /* @__PURE__ */ n(Ne, { children: [...B].sort(
490
- (l, p) => S ? 0 : he(i(l), i(p), x, b === "-label")
491
- ).map((l) => {
492
- const p = String(l.id), ee = String(m) === p;
510
+ /* @__PURE__ */ c(we, { children: [
511
+ B ? /* @__PURE__ */ l("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ l(ce, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ l(Ne, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
512
+ !B && /* @__PURE__ */ l(_e, { children: [...ie(M, y, ee, e)].sort(
513
+ (r, b) => Y ? 0 : ye(e(r), e(b), y, h === "-label")
514
+ ).map((r) => {
515
+ const b = String(r.id), le = String(m) === b;
493
516
  return /* @__PURE__ */ c(
494
- Se,
517
+ Le,
495
518
  {
496
- value: p,
497
- onSelect: () => Ue(l.id),
519
+ value: b,
520
+ onSelect: () => Ke(r.id),
498
521
  className: "flex items-center gap-2 text-[12px]",
499
522
  children: [
500
- /* @__PURE__ */ n(
523
+ /* @__PURE__ */ l(
501
524
  "div",
502
525
  {
503
- className: Q(
526
+ className: W(
504
527
  "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border transition-colors",
505
- ee ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
528
+ le ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-500"
506
529
  ),
507
- children: ee && /* @__PURE__ */ n(de, { className: "h-2.5 w-2.5 text-white" })
530
+ children: le && /* @__PURE__ */ l(me, { className: "h-2.5 w-2.5 text-white" })
508
531
  }
509
532
  ),
510
- r === "nivaro_users" && /* @__PURE__ */ n(
511
- xe,
533
+ s === "nivaro_users" && /* @__PURE__ */ l(
534
+ ve,
512
535
  {
513
- userId: p,
536
+ userId: b,
514
537
  className: "h-4 w-4",
515
- fallback: /* @__PURE__ */ n("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children: Fe(i(l)) })
538
+ fallback: /* @__PURE__ */ l("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[8px] font-bold text-nvr-navy dark:text-nvr-cyan", children: Te(e(r)) })
516
539
  }
517
540
  ),
518
- r === "nivaro_users" && H.has(p.toUpperCase()) && /* @__PURE__ */ n(
541
+ s === "nivaro_users" && H.has(b.toUpperCase()) && /* @__PURE__ */ l(
519
542
  "span",
520
543
  {
521
544
  className: "h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",
522
545
  "data-tip": "Online now"
523
546
  }
524
547
  ),
525
- /* @__PURE__ */ n("span", { className: "truncate", children: i(l) })
548
+ /* @__PURE__ */ l("span", { className: "truncate", children: e(r) })
526
549
  ]
527
550
  },
528
- p
551
+ b
529
552
  );
530
553
  }) })
531
554
  ] })
@@ -533,12 +556,15 @@ function rt({
533
556
  ]
534
557
  }
535
558
  ),
536
- F.tip
559
+ k.tip
537
560
  ] });
538
561
  }
539
562
  export {
540
- lt as M2MCombobox,
541
- rt as M2MSingleSelectCombobox,
542
- nt as m2aWriteMeta,
543
- Oe as resolveM2MRelatedCollection
563
+ ct as M2MCombobox,
564
+ dt as M2MSingleSelectCombobox,
565
+ ot as m2aWriteMeta,
566
+ Me as m2mAsksServer,
567
+ Q as m2mIdKey,
568
+ ie as narrowM2MOptions,
569
+ Ue as resolveM2MRelatedCollection
544
570
  };