@nivaro/react 0.3.66 → 0.3.68

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -1
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ActivityEntry.js +28 -28
  6. package/dist/shared/components/CollectionBrowserView.js +584 -585
  7. package/dist/shared/components/ConformanceView.js +34 -34
  8. package/dist/shared/components/ItemEditForm.js +1758 -1758
  9. package/dist/shared/components/RecordCompare.js +149 -129
  10. package/dist/shared/components/ReportView.js +196 -196
  11. package/dist/shared/components/SlaRulesView.js +36 -36
  12. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  13. package/dist/shared/components/chat/ChatPanel.js +484 -487
  14. package/dist/shared/components/chat/ChatViews.js +66 -66
  15. package/dist/shared/components/chat/RoomParts.js +159 -157
  16. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  17. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  18. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  20. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  21. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  22. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  23. package/dist/shared/components/integrations/console/tone.js +22 -21
  24. package/dist/shared/components/item-edit/FieldRow.js +188 -188
  25. package/dist/shared/components/item-edit/FilePickerField.js +281 -297
  26. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  27. package/dist/shared/components/item-edit/RecordInsights.js +101 -101
  28. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  29. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  30. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  31. package/dist/shared/components/panels/BranchLanes.js +7 -7
  32. package/dist/shared/components/panels/CommentPanel.js +204 -197
  33. package/dist/shared/components/panels/PipelinePanel.js +264 -264
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  35. package/dist/shared/components/panels/RevisionsPanel.js +229 -229
  36. package/dist/shared/components/panels/TaskPanel.js +75 -75
  37. package/dist/shared/components/queue/QueueWorklist.js +591 -589
  38. package/dist/shared/lib/compare-value.js +73 -0
  39. package/dist/shared/lib/format-value.js +18 -17
  40. package/dist/shared/lib/utils.js +87 -80
  41. package/package.json +1 -1
@@ -1,74 +1,71 @@
1
- import { jsxs as i, jsx as e, Fragment as B } from "react/jsx-runtime";
2
- import { useQueryClient as xe, useQuery as I } from "@tanstack/react-query";
3
- import { Clock as ge, Download as be, Loader2 as ee, Upload as oe, X as te, Plus as je, File as he, FileVideo as Pe, FileAudio as We, FileText as re, FileSpreadsheet as Ke, FileCode as Oe } from "lucide-react";
4
- import { useId as ce, useState as N, useRef as ye, useEffect as V } from "react";
5
- import { useNivaroClient as ue, useGridFlush as we, useParentDraft as ve } from "../../context.js";
6
- import { useFileHealth as Ne } from "../../hooks/useFileHealth.js";
7
- import { get as le, post as pe, del as fe } from "../../lib/commands.js";
8
- import { cn as de } from "../../lib/utils.js";
9
- import { FilePreviewLightbox as ke } from "../FilePreviewLightbox.js";
10
- import { useOnceVisible as _e, useFileUsage as Fe, FileUsageChip as Re } from "./FileUsage.js";
11
- import { useFileDownload as Ce } from "./file-download.js";
12
- import { useM2MStaging as Qe } from "./M2MStagingContext.js";
13
- function E(s) {
14
- var w;
15
- const a = ((s == null ? void 0 : s.title) ?? "").trim(), k = ((s == null ? void 0 : s.filename_download) ?? "").trim();
16
- if (!a) return k;
17
- const h = (w = /\.([A-Za-z0-9]{1,8})$/.exec(k)) == null ? void 0 : w[1];
18
- return h ? new RegExp(`\\.${h}$`, "i").test(a) ? a : `${a}.${h}` : a;
1
+ import { jsxs as i, jsx as e, Fragment as M } from "react/jsx-runtime";
2
+ import { useQueryClient as pe, useQuery as X } from "@tanstack/react-query";
3
+ import { Clock as fe, Download as xe, Loader2 as Z, Upload as ae, X as Y, Plus as qe, File as ue, FileVideo as je, FileAudio as Se, FileText as ne, FileSpreadsheet as We, FileCode as ze } from "lucide-react";
4
+ import { useId as ie, useState as $, useRef as ge, useEffect as B } from "react";
5
+ import { useNivaroClient as oe, useGridFlush as be, useParentDraft as we } from "../../context.js";
6
+ import { useFileHealth as ye } from "../../hooks/useFileHealth.js";
7
+ import { get as I, post as me, del as he } from "../../lib/commands.js";
8
+ import { cn as re, formatDateTime as Ke } from "../../lib/utils.js";
9
+ import { useOnceVisible as Ne, useFileUsage as ve, FileUsageChip as ke } from "./FileUsage.js";
10
+ import { useFileDownload as _e } from "./file-download.js";
11
+ import { useM2MStaging as Pe } from "./M2MStagingContext.js";
12
+ function de(s) {
13
+ var y;
14
+ const a = ((s == null ? void 0 : s.title) ?? "").trim(), v = ((s == null ? void 0 : s.filename_download) ?? "").trim();
15
+ if (!a) return v;
16
+ const m = (y = /\.([A-Za-z0-9]{1,8})$/.exec(v)) == null ? void 0 : y[1];
17
+ return m ? new RegExp(`\\.${m}$`, "i").test(a) ? a : `${a}.${m}` : a;
19
18
  }
20
- function se(s) {
19
+ function ee(s) {
21
20
  return s ? s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB` : null;
22
21
  }
23
- function Le(s) {
24
- if (!s) return null;
25
- const a = new Date(s);
26
- return a.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" }) + " " + a.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
22
+ function Fe(s) {
23
+ return s ? Ke(s) : null;
27
24
  }
28
- function Ee(s) {
25
+ function Oe(s) {
29
26
  return !!s && s.startsWith("image/");
30
27
  }
31
- function Te(s, a) {
32
- return s ? s.startsWith("video/") ? /* @__PURE__ */ e(Pe, { className: a, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(We, { className: a, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(re, { className: a, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(re, { className: a, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(Ke, { className: a, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(re, { className: a, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(Oe, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(he, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(he, { className: a, strokeWidth: 1.5 });
28
+ function Qe(s, a) {
29
+ return s ? s.startsWith("video/") ? /* @__PURE__ */ e(je, { className: a, strokeWidth: 1.5 }) : s.startsWith("audio/") ? /* @__PURE__ */ e(Se, { className: a, strokeWidth: 1.5 }) : s === "application/pdf" ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.startsWith("text/") ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.includes("spreadsheet") || s.includes("excel") || s === "text/csv" ? /* @__PURE__ */ e(We, { className: a, strokeWidth: 1.5 }) : s.includes("wordprocessing") || s.includes("msword") ? /* @__PURE__ */ e(ne, { className: a, strokeWidth: 1.5 }) : s.includes("json") || s.includes("javascript") || s.includes("typescript") || s.includes("xml") ? /* @__PURE__ */ e(ze, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(ue, { className: a, strokeWidth: 1.5 }) : /* @__PURE__ */ e(ue, { className: a, strokeWidth: 1.5 });
33
30
  }
34
- function H({
31
+ function V({
35
32
  url: s,
36
33
  type: a,
37
- filename: k,
38
- size: h = "md"
34
+ filename: v,
35
+ size: m = "md"
39
36
  }) {
40
- const w = h === "sm" ? "h-10 w-10" : h === "lg" ? "h-20 w-20" : "h-14 w-14";
41
- return Ee(a) ? /* @__PURE__ */ e(
37
+ const y = m === "sm" ? "h-10 w-10" : m === "lg" ? "h-20 w-20" : "h-14 w-14";
38
+ return Oe(a) ? /* @__PURE__ */ e(
42
39
  "img",
43
40
  {
44
41
  src: s,
45
- alt: k,
42
+ alt: v,
46
43
  "data-file-thumb": !0,
47
- className: de(w, "object-cover rounded shrink-0"),
44
+ className: re(y, "object-cover rounded shrink-0"),
48
45
  loading: "lazy",
49
- onError: (_) => {
50
- _.target.style.display = "none";
46
+ onError: (k) => {
47
+ k.target.style.display = "none";
51
48
  }
52
49
  }
53
- ) : /* @__PURE__ */ e("div", { className: de(w, "flex items-center justify-center rounded bg-slate-100 shrink-0"), children: Te(a, h === "sm" ? "h-4 w-4" : "h-6 w-6") });
50
+ ) : /* @__PURE__ */ e("div", { className: re(y, "flex items-center justify-center rounded bg-slate-100 shrink-0"), children: Qe(a, m === "sm" ? "h-4 w-4" : "h-6 w-6") });
54
51
  }
55
- function Ue({
52
+ function Re({
56
53
  selected: s,
57
54
  multi: a,
58
- onSelect: k,
59
- onClose: h,
60
- getUrl: w
55
+ onSelect: v,
56
+ onClose: m,
57
+ getUrl: y
61
58
  }) {
62
- const _ = ue(), [p, u] = N(""), { data: g = [], isLoading: f } = I({
63
- queryKey: ["file-browser", p],
64
- queryFn: () => _.request(
65
- le("/files", {
59
+ const k = oe(), [h, u] = $(""), { data: g = [], isLoading: p } = X({
60
+ queryKey: ["file-browser", h],
61
+ queryFn: () => k.request(
62
+ I("/files", {
66
63
  limit: "60",
67
64
  sort: "-uploaded_on",
68
65
  fields: "id,filename_download,title,type,filesize,width,height,missing_at",
69
- ...p ? { search: p } : {}
66
+ ...h ? { search: h } : {}
70
67
  })
71
- ).then((c) => c.data ?? []),
68
+ ).then((d) => d.data ?? []),
72
69
  staleTime: 3e4
73
70
  });
74
71
  return /* @__PURE__ */ i("div", { className: "flex flex-col", style: { width: 480, maxHeight: 420 }, children: [
@@ -82,9 +79,9 @@ function Ue({
82
79
  {
83
80
  type: "button",
84
81
  "aria-label": "Close",
85
- onClick: h,
82
+ onClick: m,
86
83
  className: "text-slate-400 hover:text-slate-600",
87
- children: /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5" })
84
+ children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
88
85
  }
89
86
  )
90
87
  ] }),
@@ -93,38 +90,38 @@ function Ue({
93
90
  {
94
91
  type: "text",
95
92
  placeholder: "Search files…",
96
- value: p,
97
- onChange: (c) => u(c.target.value),
93
+ value: h,
94
+ onChange: (d) => u(d.target.value),
98
95
  className: "w-full h-7 rounded border border-slate-200 px-2 text-[12px] focus:outline-none focus:ring-1 focus:ring-nvr-cyan",
99
96
  autoFocus: !0
100
97
  }
101
98
  ) }),
102
99
  /* @__PURE__ */ i("div", { className: "overflow-y-auto flex-1 p-3", children: [
103
- f && /* @__PURE__ */ e("div", { className: "flex justify-center py-6", children: /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin text-slate-300" }) }),
104
- !f && g.length === 0 && /* @__PURE__ */ e("p", { className: "text-center text-[12px] text-slate-400 py-6", children: "No files found" }),
105
- !f && g.length > 0 && /* @__PURE__ */ e("div", { className: "grid grid-cols-5 gap-2", children: g.map((c) => {
106
- const v = s.includes(c.id);
100
+ p && /* @__PURE__ */ e("div", { className: "flex justify-center py-6", children: /* @__PURE__ */ e(Z, { className: "h-5 w-5 animate-spin text-slate-300" }) }),
101
+ !p && g.length === 0 && /* @__PURE__ */ e("p", { className: "text-center text-[12px] text-slate-400 py-6", children: "No files found" }),
102
+ !p && g.length > 0 && /* @__PURE__ */ e("div", { className: "grid grid-cols-5 gap-2", children: g.map((d) => {
103
+ const N = s.includes(d.id);
107
104
  return /* @__PURE__ */ i(
108
105
  "button",
109
106
  {
110
107
  type: "button",
111
- onClick: () => k(c.id),
112
- className: de(
108
+ onClick: () => v(d.id),
109
+ className: re(
113
110
  "nvr-rise-in group flex flex-col items-center gap-1 rounded-lg p-1.5 text-left transition-colors border",
114
- v ? "border-nvr-cyan bg-nvr-cyan/5" : "border-transparent hover:border-slate-200 hover:bg-slate-50"
111
+ N ? "border-nvr-cyan bg-nvr-cyan/5" : "border-transparent hover:border-slate-200 hover:bg-slate-50"
115
112
  ),
116
113
  children: [
117
114
  /* @__PURE__ */ i("div", { className: "relative", children: [
118
115
  /* @__PURE__ */ e(
119
- H,
116
+ V,
120
117
  {
121
- url: w(c.id),
122
- type: c.type,
123
- filename: c.filename_download,
118
+ url: y(d.id),
119
+ type: d.type,
120
+ filename: d.filename_download,
124
121
  size: "md"
125
122
  }
126
123
  ),
127
- v && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center rounded bg-nvr-cyan/20", children: /* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-full bg-nvr-cyan flex items-center justify-center", children: /* @__PURE__ */ e(
124
+ N && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center rounded bg-nvr-cyan/20", children: /* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-full bg-nvr-cyan flex items-center justify-center", children: /* @__PURE__ */ e(
128
125
  "svg",
129
126
  {
130
127
  className: "h-2.5 w-2.5 text-white",
@@ -148,124 +145,121 @@ function Ue({
148
145
  {
149
146
  "data-file-name": !0,
150
147
  className: "text-[10px] text-slate-500 truncate w-full text-center leading-tight",
151
- children: E(c)
148
+ children: de(d)
152
149
  }
153
150
  )
154
151
  ]
155
152
  },
156
- c.id
153
+ d.id
157
154
  );
158
155
  }) })
159
156
  ] })
160
157
  ] });
161
158
  }
162
- function et({
159
+ function Ze({
163
160
  value: s,
164
161
  onChange: a,
165
- disabled: k,
166
- allowUpload: h = !0,
167
- allowPick: w = !0
162
+ disabled: v,
163
+ allowUpload: m = !0,
164
+ allowPick: y = !0
168
165
  }) {
169
- var z, Z;
170
- const _ = ue(), p = xe(), u = we(), g = ce(), [f, c] = N(!1), [v, U] = N(!1), [J, T] = N(null), [m, j] = N(null), [D, K] = N(null), x = ye(null), r = !m && s ? String(s) : null, R = (d) => _.fileUrl(d), P = Ce(), b = ve(), W = ((z = b == null ? void 0 : b.draft) == null ? void 0 : z.id) != null ? String(b.draft.id) : null, [G, q] = _e(!!r), C = Fe(
166
+ var j, J;
167
+ const k = oe(), h = pe(), u = be(), g = ie(), [p, d] = $(!1), [N, L] = $(!1), [f, z] = $(null), [D, E] = $(null), x = ge(null), r = !f && s ? String(s) : null, _ = (c) => k.fileUrl(c), S = _e(), b = we(), K = ((j = b == null ? void 0 : b.draft) == null ? void 0 : j.id) != null ? String(b.draft.id) : null, [H, q] = Ne(!!r), R = ve(
171
168
  b == null ? void 0 : b.collection,
172
- W,
169
+ K,
173
170
  r ? [r] : [],
174
171
  q
175
172
  );
176
- V(() => {
177
- if (!m) {
178
- K(null);
173
+ B(() => {
174
+ if (!f) {
175
+ E(null);
179
176
  return;
180
177
  }
181
- const d = URL.createObjectURL(m);
182
- return K(d), () => URL.revokeObjectURL(d);
183
- }, [m]), V(() => {
184
- if (!(!u || !m))
178
+ const c = URL.createObjectURL(f);
179
+ return E(c), () => URL.revokeObjectURL(c);
180
+ }, [f]), B(() => {
181
+ if (!(!u || !f))
185
182
  return u.register(g, async () => {
186
- const d = await _.upload(m);
187
- a(d.id), j(null), p.invalidateQueries({ queryKey: ["file-browser"] });
183
+ const c = await k.upload(f);
184
+ a(c.id), z(null), h.invalidateQueries({ queryKey: ["file-browser"] });
188
185
  }), () => u.unregister(g);
189
- }, [u, m, g, _, a, p]);
190
- const A = Ne([r]), { data: n, isLoading: $ } = I({
186
+ }, [u, f, g, k, a, h]);
187
+ const T = ye([r]), { data: n, isLoading: C } = X({
191
188
  queryKey: ["file-meta", r],
192
- queryFn: () => _.request(le(`/files/${r}/meta`)).then((d) => d.data ?? null),
189
+ queryFn: () => k.request(I(`/files/${r}/meta`)).then((c) => c.data ?? null),
193
190
  enabled: !!r,
194
191
  staleTime: 6e4
195
192
  });
196
- async function X(d) {
197
- var Y;
198
- const S = (Y = d.target.files) == null ? void 0 : Y[0];
199
- if (S)
193
+ async function P(c) {
194
+ var G;
195
+ const W = (G = c.target.files) == null ? void 0 : G[0];
196
+ if (W)
200
197
  if (x.current && (x.current.value = ""), u)
201
- j(S);
198
+ z(W);
202
199
  else {
203
- U(!0), window.dispatchEvent(
204
- new CustomEvent("nvr:upload-state", { detail: { name: S.name, state: "start" } })
200
+ L(!0), window.dispatchEvent(
201
+ new CustomEvent("nvr:upload-state", { detail: { name: W.name, state: "start" } })
205
202
  );
206
203
  try {
207
- const ae = await _.upload(S);
208
- a(ae.id), p.invalidateQueries({ queryKey: ["file-browser"] });
204
+ const le = await k.upload(W);
205
+ a(le.id), h.invalidateQueries({ queryKey: ["file-browser"] });
209
206
  } catch {
210
207
  } finally {
211
- U(!1), window.dispatchEvent(
212
- new CustomEvent("nvr:upload-state", { detail: { name: S.name, state: "done" } })
208
+ L(!1), window.dispatchEvent(
209
+ new CustomEvent("nvr:upload-state", { detail: { name: W.name, state: "done" } })
213
210
  );
214
211
  }
215
212
  }
216
213
  }
217
- function M(d) {
218
- j(null), a(d), c(!1);
214
+ function A(c) {
215
+ z(null), a(c), d(!1);
219
216
  }
220
- function ne() {
221
- j(null), a(null);
217
+ function te() {
218
+ z(null), a(null);
222
219
  }
223
- const y = !!m;
220
+ const w = !!f;
224
221
  return /* @__PURE__ */ i("div", { className: "relative", children: [
225
- J && /* @__PURE__ */ e(ke, { file: J, onClose: () => T(null) }),
226
- y || !!r ? /* @__PURE__ */ i(
222
+ w || !!r ? /* @__PURE__ */ i(
227
223
  "div",
228
224
  {
229
- ref: G,
225
+ ref: H,
230
226
  className: "flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
231
227
  children: [
232
- y ? /* @__PURE__ */ e(
233
- H,
228
+ w ? /* @__PURE__ */ e(
229
+ V,
234
230
  {
235
231
  url: D ?? "",
236
- type: m.type || null,
237
- filename: m.name,
232
+ type: f.type || null,
233
+ filename: f.name,
238
234
  size: "sm"
239
235
  }
240
- ) : $ ? /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }) : /* @__PURE__ */ e(
241
- "button",
242
- {
243
- type: "button",
244
- title: "Preview",
245
- onClick: () => T({
246
- id: r,
247
- url: R(r),
248
- name: E(n) || r,
249
- type: (n == null ? void 0 : n.type) ?? null,
250
- size: (n == null ? void 0 : n.filesize) ?? null
251
- }),
252
- className: "shrink-0 cursor-zoom-in",
253
- children: /* @__PURE__ */ e(
254
- H,
255
- {
256
- url: R(r),
257
- type: (n == null ? void 0 : n.type) ?? null,
258
- filename: (n == null ? void 0 : n.filename_download) ?? "",
259
- size: "sm"
260
- }
261
- )
262
- }
236
+ ) : C ? /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }) : (
237
+ // Every file click downloads (2026-11-08): no in-app preview.
238
+ /* @__PURE__ */ e(
239
+ "a",
240
+ {
241
+ href: `${_(r)}?download=1`,
242
+ download: (n == null ? void 0 : n.filename_download) || !0,
243
+ onClick: S(`${_(r)}?download=1`, n == null ? void 0 : n.filename_download),
244
+ title: "Download",
245
+ className: "shrink-0",
246
+ children: /* @__PURE__ */ e(
247
+ V,
248
+ {
249
+ url: _(r),
250
+ type: (n == null ? void 0 : n.type) ?? null,
251
+ filename: (n == null ? void 0 : n.filename_download) ?? "",
252
+ size: "sm"
253
+ }
254
+ )
255
+ }
256
+ )
263
257
  ),
264
258
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
265
259
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
266
- y && /* @__PURE__ */ e(ge, { className: "h-3 w-3 text-amber-400 shrink-0" }),
267
- /* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children: y ? m.name : E(n) || r }),
268
- !y && (A.verdict(r) ?? !!(n != null && n.missing_at)) && /* @__PURE__ */ e(
260
+ w && /* @__PURE__ */ e(fe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
261
+ /* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children: w ? f.name : de(n) || r }),
262
+ !w && (T.verdict(r) ?? !!(n != null && n.missing_at)) && /* @__PURE__ */ e(
269
263
  "span",
270
264
  {
271
265
  className: "shrink-0 rounded bg-red-500/10 px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",
@@ -274,205 +268,205 @@ function et({
274
268
  }
275
269
  )
276
270
  ] }),
277
- /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: y ? /* @__PURE__ */ i(B, { children: [
278
- m.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: m.type }),
279
- /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: se(m.size) }),
271
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: w ? /* @__PURE__ */ i(M, { children: [
272
+ f.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: f.type }),
273
+ /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(f.size) }),
280
274
  /* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
281
- ] }) : /* @__PURE__ */ i(B, { children: [
275
+ ] }) : /* @__PURE__ */ i(M, { children: [
282
276
  (n == null ? void 0 : n.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: n.type }),
283
- (n == null ? void 0 : n.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: se(n.filesize) }),
284
- (n == null ? void 0 : n.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Le(n.uploaded_on) }),
277
+ (n == null ? void 0 : n.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(n.filesize) }),
278
+ (n == null ? void 0 : n.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Fe(n.uploaded_on) }),
285
279
  (n == null ? void 0 : n.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500", children: [
286
280
  "by ",
287
281
  n.uploaded_by_name
288
282
  ] })
289
283
  ] }) })
290
284
  ] }),
291
- !y && r && /* @__PURE__ */ e(
292
- Re,
285
+ !w && r && /* @__PURE__ */ e(
286
+ ke,
293
287
  {
294
288
  fileId: r,
295
- uses: (Z = C.data) == null ? void 0 : Z[r],
296
- loading: C.isLoading,
289
+ uses: (J = R.data) == null ? void 0 : J[r],
290
+ loading: R.isLoading,
297
291
  collection: b == null ? void 0 : b.collection,
298
- itemId: W
292
+ itemId: K
299
293
  }
300
294
  ),
301
- !y && r && /* @__PURE__ */ e(
295
+ !w && r && /* @__PURE__ */ e(
302
296
  "a",
303
297
  {
304
- href: `${R(r)}?download=1`,
305
- onClick: P(`${R(r)}?download=1`, n == null ? void 0 : n.filename_download),
298
+ href: `${_(r)}?download=1`,
299
+ onClick: S(`${_(r)}?download=1`, n == null ? void 0 : n.filename_download),
306
300
  title: "Download",
307
301
  className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
308
- children: /* @__PURE__ */ e(be, { className: "h-3.5 w-3.5" })
302
+ children: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" })
309
303
  }
310
304
  ),
311
- !k && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
312
- w && /* @__PURE__ */ e(
305
+ !v && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 shrink-0", children: [
306
+ y && /* @__PURE__ */ e(
313
307
  "button",
314
308
  {
315
309
  type: "button",
316
- onClick: () => c(!0),
310
+ onClick: () => d(!0),
317
311
  className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400",
318
312
  children: "Replace"
319
313
  }
320
314
  ),
321
- h && /* @__PURE__ */ i(B, { children: [
315
+ m && /* @__PURE__ */ i(M, { children: [
322
316
  /* @__PURE__ */ i(
323
317
  "button",
324
318
  {
325
319
  type: "button",
326
320
  onClick: () => {
327
- var d;
328
- return (d = x.current) == null ? void 0 : d.click();
321
+ var c;
322
+ return (c = x.current) == null ? void 0 : c.click();
329
323
  },
330
- disabled: v,
324
+ disabled: N,
331
325
  className: "h-6 px-2 rounded border border-slate-200 text-[11px] text-slate-600 hover:border-slate-400 disabled:opacity-40 flex items-center gap-1",
332
326
  children: [
333
- v ? /* @__PURE__ */ e(ee, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(oe, { className: "h-3 w-3" }),
327
+ N ? /* @__PURE__ */ e(Z, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3 w-3" }),
334
328
  "Upload"
335
329
  ]
336
330
  }
337
331
  ),
338
- /* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: X })
332
+ /* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: P })
339
333
  ] }),
340
334
  /* @__PURE__ */ e(
341
335
  "button",
342
336
  {
343
337
  type: "button",
344
338
  "aria-label": "Remove file",
345
- onClick: ne,
339
+ onClick: te,
346
340
  className: "text-slate-300 hover:text-red-400 p-0.5",
347
- children: /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5" })
341
+ children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
348
342
  }
349
343
  )
350
344
  ] })
351
345
  ]
352
346
  }
353
347
  ) : /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
354
- w && /* @__PURE__ */ e(
348
+ y && /* @__PURE__ */ e(
355
349
  "button",
356
350
  {
357
351
  type: "button",
358
- disabled: k,
359
- onClick: () => c(!0),
352
+ disabled: v,
353
+ onClick: () => d(!0),
360
354
  className: "flex h-9 flex-1 items-center gap-2 rounded-md border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 disabled:opacity-40 transition-colors",
361
355
  children: "Select file…"
362
356
  }
363
357
  ),
364
- h && !k && /* @__PURE__ */ i(B, { children: [
358
+ m && !v && /* @__PURE__ */ i(M, { children: [
365
359
  /* @__PURE__ */ i(
366
360
  "button",
367
361
  {
368
362
  type: "button",
369
363
  onClick: () => {
370
- var d;
371
- return (d = x.current) == null ? void 0 : d.click();
364
+ var c;
365
+ return (c = x.current) == null ? void 0 : c.click();
372
366
  },
373
- disabled: v,
367
+ disabled: N,
374
368
  className: "flex h-9 items-center gap-1.5 rounded-md border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 disabled:opacity-40 transition-colors",
375
369
  children: [
376
- v ? /* @__PURE__ */ e(ee, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" }),
370
+ N ? /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" }),
377
371
  "Upload"
378
372
  ]
379
373
  }
380
374
  ),
381
- /* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: X })
375
+ /* @__PURE__ */ e("input", { ref: x, type: "file", className: "hidden", onChange: P })
382
376
  ] })
383
377
  ] }),
384
- f && /* @__PURE__ */ e(
378
+ p && /* @__PURE__ */ e(
385
379
  "div",
386
380
  {
387
381
  className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
388
382
  style: { minWidth: 480 },
389
383
  children: /* @__PURE__ */ e(
390
- Ue,
384
+ Re,
391
385
  {
392
386
  selected: r ? [r] : [],
393
387
  multi: !1,
394
- onSelect: M,
395
- onClose: () => c(!1),
396
- getUrl: R
388
+ onSelect: A,
389
+ onClose: () => d(!1),
390
+ getUrl: _
397
391
  }
398
392
  )
399
393
  }
400
394
  )
401
395
  ] });
402
396
  }
403
- function tt({
397
+ function Ye({
404
398
  relation: s,
405
399
  parentId: a,
406
- allRelations: k,
407
- disabled: h,
408
- allowUpload: w = !0,
409
- allowPick: _ = !0,
410
- pendingSave: p = !1
400
+ allRelations: v,
401
+ disabled: m,
402
+ allowUpload: y = !0,
403
+ allowPick: k = !0,
404
+ pendingSave: h = !1
411
405
  }) {
412
- const u = ue(), g = xe(), f = we(), c = ce(), v = ce(), U = Qe(), [J, T] = N(!1), [m, j] = N(!1), [D, K] = N(null), [x, r] = N([]), R = ye(null), [P, b] = N([]), [W, G] = N(/* @__PURE__ */ new Set()), q = s.junction_field ?? "", C = s.many_field ?? "", A = s.one_field ?? `${s.many_collection}.${q}`, n = a === "new", $ = (l) => u.fileUrl(l), X = Ce();
413
- V(() => () => {
406
+ const u = oe(), g = pe(), p = be(), d = ie(), N = ie(), L = Pe(), [f, z] = $(!1), [D, E] = $(!1), [x, r] = $([]), _ = ge(null), [S, b] = $([]), [K, H] = $(/* @__PURE__ */ new Set()), q = s.junction_field ?? "", R = s.many_field ?? "", T = s.one_field ?? `${s.many_collection}.${q}`, n = a === "new", C = (l) => u.fileUrl(l), P = _e();
407
+ B(() => () => {
414
408
  r((l) => (l.forEach((t) => URL.revokeObjectURL(t.url)), []));
415
- }, []), V(() => {
416
- if (!f || !x.length || p) return;
409
+ }, []), B(() => {
410
+ if (!p || !x.length || h) return;
417
411
  const l = x;
418
- return f.register(c, async () => {
412
+ return p.register(d, async () => {
419
413
  for (const t of l) {
420
414
  const o = await u.upload(t.file);
421
- URL.revokeObjectURL(t.url), await ie(o.id);
415
+ URL.revokeObjectURL(t.url), await se(o.id);
422
416
  }
423
417
  r([]), g.invalidateQueries({ queryKey: ["file-browser"] });
424
- }), () => f.unregister(c);
425
- }, [f, x, c, p]), V(() => {
426
- if (!f || !p) return;
427
- if (!(P.length > 0 || W.size > 0 || x.length > 0)) {
428
- f.unregister(v);
418
+ }), () => p.unregister(d);
419
+ }, [p, x, d, h]), B(() => {
420
+ if (!p || !h) return;
421
+ if (!(S.length > 0 || K.size > 0 || x.length > 0)) {
422
+ p.unregister(N);
429
423
  return;
430
424
  }
431
- const t = P, o = new Set(W), L = x;
432
- return f.register(v, async () => {
433
- const me = [];
434
- for (const O of L) {
425
+ const t = S, o = new Set(K), U = x;
426
+ return p.register(N, async () => {
427
+ const ce = [];
428
+ for (const O of U) {
435
429
  const Q = await u.upload(O.file);
436
- URL.revokeObjectURL(O.url), me.push(Q.id);
430
+ URL.revokeObjectURL(O.url), ce.push(Q.id);
437
431
  }
438
- for (const O of [...t, ...me])
432
+ for (const O of [...t, ...ce])
439
433
  await u.request(
440
- pe(`/items/${s.many_collection}`, {
441
- [C]: a,
434
+ me(`/items/${s.many_collection}`, {
435
+ [R]: a,
442
436
  [q]: O
443
437
  })
444
438
  );
445
439
  for (const O of o) {
446
- const Q = M.find((Se) => String(Se[q]) === O);
447
- Q != null && Q.id && await u.request(fe(`/items/${s.many_collection}/${Q.id}`));
440
+ const Q = A.find((Le) => String(Le[q]) === O);
441
+ Q != null && Q.id && await u.request(he(`/items/${s.many_collection}/${Q.id}`));
448
442
  }
449
- b([]), G(/* @__PURE__ */ new Set()), r([]), g.invalidateQueries({
450
- queryKey: ["m2m-items", s.many_collection, C, a]
443
+ b([]), H(/* @__PURE__ */ new Set()), r([]), g.invalidateQueries({
444
+ queryKey: ["m2m-items", s.many_collection, R, a]
451
445
  }), g.invalidateQueries({ queryKey: ["file-browser"] });
452
- }), () => f.unregister(v);
453
- }, [f, p, P, W, x, v]);
454
- const { data: M = [] } = I({
455
- queryKey: ["m2m-items", s.many_collection, C, a],
446
+ }), () => p.unregister(N);
447
+ }, [p, h, S, K, x, N]);
448
+ const { data: A = [] } = X({
449
+ queryKey: ["m2m-items", s.many_collection, R, a],
456
450
  queryFn: () => u.request(
457
- le(`/items/${s.many_collection}`, {
458
- filter: JSON.stringify({ [C]: { _eq: a } }),
451
+ I(`/items/${s.many_collection}`, {
452
+ filter: JSON.stringify({ [R]: { _eq: a } }),
459
453
  limit: "200",
460
454
  fields: `id,${q}`
461
455
  })
462
456
  ).then((l) => l.data ?? []),
463
457
  enabled: !!a && !n,
464
458
  staleTime: 3e4
465
- }), ne = n && U ? U.getStagedLinks(A) : [], y = M.map((l) => String(l[q])), F = n ? ne : p ? [...y.filter((l) => !W.has(l)), ...P] : y, z = ve(), [Z, d] = _e(y.length > 0), S = Fe(
466
- z == null ? void 0 : z.collection,
459
+ }), te = n && L ? L.getStagedLinks(T) : [], w = A.map((l) => String(l[q])), F = n ? te : h ? [...w.filter((l) => !K.has(l)), ...S] : w, j = we(), [J, c] = Ne(w.length > 0), W = ve(
460
+ j == null ? void 0 : j.collection,
467
461
  n ? null : a,
468
- y,
469
- d
470
- ), Y = Ne(F), { data: ae = {} } = I({
462
+ w,
463
+ c
464
+ ), G = ye(F), { data: le = {} } = X({
471
465
  queryKey: ["files-meta", ...F.sort()],
472
466
  queryFn: async () => {
473
467
  if (!F.length) return {};
474
468
  const l = await u.request(
475
- le("/files", {
469
+ I("/files", {
476
470
  filter: JSON.stringify({ id: { _in: F } }),
477
471
  limit: String(F.length),
478
472
  fields: "id,filename_download,title,type,filesize,uploaded_on,uploaded_by_name,missing_at"
@@ -484,84 +478,78 @@ function tt({
484
478
  enabled: F.length > 0,
485
479
  staleTime: 6e4
486
480
  });
487
- async function qe(l) {
488
- if (n && U) {
489
- U.unstageLink(A, l);
481
+ async function Ce(l) {
482
+ if (n && L) {
483
+ L.unstageLink(T, l);
490
484
  return;
491
485
  }
492
- if (p) {
493
- P.includes(l) ? b((o) => o.filter((L) => L !== l)) : G((o) => /* @__PURE__ */ new Set([...o, l]));
486
+ if (h) {
487
+ S.includes(l) ? b((o) => o.filter((U) => U !== l)) : H((o) => /* @__PURE__ */ new Set([...o, l]));
494
488
  return;
495
489
  }
496
- const t = M.find((o) => String(o[q]) === l);
497
- t != null && t.id && (await u.request(fe(`/items/${s.many_collection}/${t.id}`)), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, C, a] }));
490
+ const t = A.find((o) => String(o[q]) === l);
491
+ t != null && t.id && (await u.request(he(`/items/${s.many_collection}/${t.id}`)), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, R, a] }));
498
492
  }
499
- async function ie(l) {
493
+ async function se(l) {
500
494
  if (!F.includes(l)) {
501
- if (n && U) {
502
- U.stageLink(A, l);
495
+ if (n && L) {
496
+ L.stageLink(T, l);
503
497
  return;
504
498
  }
505
- if (p) {
499
+ if (h) {
506
500
  b((t) => t.includes(l) ? t : [...t, l]);
507
501
  return;
508
502
  }
509
503
  await u.request(
510
- pe(`/items/${s.many_collection}`, { [C]: a, [q]: l })
511
- ), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, C, a] });
504
+ me(`/items/${s.many_collection}`, { [R]: a, [q]: l })
505
+ ), g.invalidateQueries({ queryKey: ["m2m-items", s.many_collection, R, a] });
512
506
  }
513
507
  }
514
- function ze(l) {
508
+ function Ue(l) {
515
509
  URL.revokeObjectURL(l), r((t) => t.filter((o) => o.url !== l));
516
510
  }
517
511
  async function $e(l) {
518
512
  const t = Array.from(l.target.files ?? []);
519
513
  if (t.length)
520
- if (R.current && (R.current.value = ""), f) {
521
- const o = t.map((L) => ({ file: L, url: URL.createObjectURL(L) }));
522
- r((L) => [...L, ...o]);
514
+ if (_.current && (_.current.value = ""), p) {
515
+ const o = t.map((U) => ({ file: U, url: URL.createObjectURL(U) }));
516
+ r((U) => [...U, ...o]);
523
517
  } else {
524
- j(!0);
518
+ E(!0);
525
519
  try {
526
520
  for (const o of t) {
527
- const L = await u.upload(o);
528
- await ie(L.id);
521
+ const U = await u.upload(o);
522
+ await se(U.id);
529
523
  }
530
524
  g.invalidateQueries({ queryKey: ["file-browser"] });
531
525
  } catch {
532
526
  } finally {
533
- j(!1);
527
+ E(!1);
534
528
  }
535
529
  }
536
530
  }
537
531
  return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
538
- D && /* @__PURE__ */ e(ke, { file: D, onClose: () => K(null) }),
539
- (F.length > 0 || x.length > 0) && /* @__PURE__ */ i("div", { ref: Z, className: "flex flex-col gap-1.5", children: [
532
+ (F.length > 0 || x.length > 0) && /* @__PURE__ */ i("div", { ref: J, className: "flex flex-col gap-1.5", children: [
540
533
  F.map((l) => {
541
534
  var o;
542
- const t = ae[l];
535
+ const t = le[l];
543
536
  return /* @__PURE__ */ i(
544
537
  "div",
545
538
  {
546
539
  className: "flex items-center gap-2 rounded-lg border border-slate-200 p-2 bg-slate-50",
547
540
  children: [
548
541
  /* @__PURE__ */ e(
549
- "button",
542
+ "a",
550
543
  {
551
- type: "button",
552
- title: "Preview",
553
- onClick: () => K({
554
- id: l,
555
- url: $(l),
556
- name: E(t) || l,
557
- type: (t == null ? void 0 : t.type) ?? null,
558
- size: (t == null ? void 0 : t.filesize) ?? null
559
- }),
560
- className: "shrink-0 cursor-zoom-in",
544
+ href: `${C(l)}?download=1`,
545
+ download: (t == null ? void 0 : t.filename_download) || !0,
546
+ onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
547
+ title: "Download",
548
+ className: "shrink-0",
561
549
  children: /* @__PURE__ */ e(
562
- H,
550
+ V,
563
551
  {
564
- url: $(l),
552
+ url: C(l),
565
553
  type: (t == null ? void 0 : t.type) ?? null,
566
554
  filename: (t == null ? void 0 : t.filename_download) ?? l,
567
555
  size: "sm"
@@ -571,32 +559,28 @@ function tt({
571
559
  ),
572
560
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
573
561
  /* @__PURE__ */ e(
574
- "button",
562
+ "a",
575
563
  {
576
- type: "button",
577
- onClick: () => K({
578
- id: l,
579
- url: $(l),
580
- name: E(t) || l,
581
- type: (t == null ? void 0 : t.type) ?? null,
582
- size: (t == null ? void 0 : t.filesize) ?? null
583
- }),
564
+ href: `${C(l)}?download=1`,
565
+ download: (t == null ? void 0 : t.filename_download) || !0,
566
+ onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
567
+ title: "Download",
584
568
  "data-file-name": !0,
585
569
  className: "block w-full truncate text-left text-[12px] font-medium text-slate-700 hover:underline",
586
- children: E(t) || l
570
+ children: de(t) || l
587
571
  }
588
572
  ),
589
573
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
590
574
  (t == null ? void 0 : t.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: t.type }),
591
- (t == null ? void 0 : t.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: se(t.filesize) }),
592
- (t == null ? void 0 : t.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Le(t.uploaded_on) }),
575
+ (t == null ? void 0 : t.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(t.filesize) }),
576
+ (t == null ? void 0 : t.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: Fe(t.uploaded_on) }),
593
577
  (t == null ? void 0 : t.uploaded_by_name) && /* @__PURE__ */ i("span", { className: "text-[10px] text-slate-500", children: [
594
578
  "by ",
595
579
  t.uploaded_by_name
596
580
  ] })
597
581
  ] })
598
582
  ] }),
599
- (Y.verdict(l) ?? !!(t != null && t.missing_at)) && /* @__PURE__ */ e(
583
+ (G.verdict(l) ?? !!(t != null && t.missing_at)) && /* @__PURE__ */ e(
600
584
  "span",
601
585
  {
602
586
  className: "shrink-0 self-center rounded bg-red-500/10 px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400",
@@ -604,34 +588,34 @@ function tt({
604
588
  children: "file missing"
605
589
  }
606
590
  ),
607
- !n && y.includes(l) && /* @__PURE__ */ e(
608
- Re,
591
+ !n && w.includes(l) && /* @__PURE__ */ e(
592
+ ke,
609
593
  {
610
594
  fileId: l,
611
- uses: (o = S.data) == null ? void 0 : o[l],
612
- loading: S.isLoading,
613
- collection: z == null ? void 0 : z.collection,
595
+ uses: (o = W.data) == null ? void 0 : o[l],
596
+ loading: W.isLoading,
597
+ collection: j == null ? void 0 : j.collection,
614
598
  itemId: a
615
599
  }
616
600
  ),
617
601
  /* @__PURE__ */ e(
618
602
  "a",
619
603
  {
620
- href: `${$(l)}?download=1`,
621
- onClick: X(`${$(l)}?download=1`, t == null ? void 0 : t.filename_download),
604
+ href: `${C(l)}?download=1`,
605
+ onClick: P(`${C(l)}?download=1`, t == null ? void 0 : t.filename_download),
622
606
  title: "Download",
623
607
  className: "shrink-0 text-slate-400 hover:text-nvr-cyan p-0.5",
624
- children: /* @__PURE__ */ e(be, { className: "h-3.5 w-3.5" })
608
+ children: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" })
625
609
  }
626
610
  ),
627
- !h && /* @__PURE__ */ e(
611
+ !m && /* @__PURE__ */ e(
628
612
  "button",
629
613
  {
630
614
  type: "button",
631
615
  "aria-label": "Remove file",
632
- onClick: () => qe(l),
616
+ onClick: () => Ce(l),
633
617
  className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
634
- children: /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5" })
618
+ children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
635
619
  }
636
620
  )
637
621
  ]
@@ -645,7 +629,7 @@ function tt({
645
629
  className: "flex items-center gap-2 rounded-lg border border-amber-200 p-2 bg-amber-50/50",
646
630
  children: [
647
631
  /* @__PURE__ */ e(
648
- H,
632
+ V,
649
633
  {
650
634
  url: l.url,
651
635
  type: l.file.type || null,
@@ -655,23 +639,23 @@ function tt({
655
639
  ),
656
640
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
657
641
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
658
- /* @__PURE__ */ e(ge, { className: "h-3 w-3 text-amber-400 shrink-0" }),
642
+ /* @__PURE__ */ e(fe, { className: "h-3 w-3 text-amber-400 shrink-0" }),
659
643
  /* @__PURE__ */ e("p", { "data-file-name": !0, className: "text-[12px] font-medium text-slate-700 truncate", children: l.file.name })
660
644
  ] }),
661
645
  /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: [
662
646
  l.file.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: l.file.type }),
663
- /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: se(l.file.size) }),
647
+ /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: ee(l.file.size) }),
664
648
  /* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
665
649
  ] })
666
650
  ] }),
667
- !h && /* @__PURE__ */ e(
651
+ !m && /* @__PURE__ */ e(
668
652
  "button",
669
653
  {
670
654
  type: "button",
671
655
  "aria-label": "Remove file",
672
- onClick: () => ze(l.url),
656
+ onClick: () => Ue(l.url),
673
657
  className: "text-slate-300 hover:text-red-400 p-0.5 shrink-0",
674
- children: /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5" })
658
+ children: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" })
675
659
  }
676
660
  )
677
661
  ]
@@ -679,51 +663,51 @@ function tt({
679
663
  l.url
680
664
  ))
681
665
  ] }),
682
- !h && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
683
- _ && /* @__PURE__ */ i("div", { className: "relative", children: [
666
+ !m && /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
667
+ k && /* @__PURE__ */ i("div", { className: "relative", children: [
684
668
  /* @__PURE__ */ i(
685
669
  "button",
686
670
  {
687
671
  type: "button",
688
- onClick: () => T((l) => !l),
672
+ onClick: () => z((l) => !l),
689
673
  className: "flex h-8 items-center gap-1.5 rounded border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 transition-colors",
690
674
  children: [
691
- /* @__PURE__ */ e(je, { className: "h-3.5 w-3.5" }),
675
+ /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
692
676
  "Add existing…"
693
677
  ]
694
678
  }
695
679
  ),
696
- J && /* @__PURE__ */ e(
680
+ f && /* @__PURE__ */ e(
697
681
  "div",
698
682
  {
699
683
  className: "absolute z-50 mt-1 rounded-lg border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card",
700
684
  style: { minWidth: 480 },
701
685
  children: /* @__PURE__ */ e(
702
- Ue,
686
+ Re,
703
687
  {
704
688
  selected: F,
705
689
  multi: !0,
706
- onSelect: (l) => ie(l),
707
- onClose: () => T(!1),
708
- getUrl: $
690
+ onSelect: (l) => se(l),
691
+ onClose: () => z(!1),
692
+ getUrl: C
709
693
  }
710
694
  )
711
695
  }
712
696
  )
713
697
  ] }),
714
- w && /* @__PURE__ */ i(B, { children: [
698
+ y && /* @__PURE__ */ i(M, { children: [
715
699
  /* @__PURE__ */ i(
716
700
  "button",
717
701
  {
718
702
  type: "button",
719
703
  onClick: () => {
720
704
  var l;
721
- return (l = R.current) == null ? void 0 : l.click();
705
+ return (l = _.current) == null ? void 0 : l.click();
722
706
  },
723
- disabled: m,
707
+ disabled: D,
724
708
  className: "flex h-8 items-center gap-1.5 rounded border border-dashed border-slate-300 px-3 text-[12px] text-slate-400 hover:border-slate-400 hover:text-slate-600 disabled:opacity-40 transition-colors",
725
709
  children: [
726
- m ? /* @__PURE__ */ e(ee, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" }),
710
+ D ? /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" }),
727
711
  "Upload…"
728
712
  ]
729
713
  }
@@ -731,7 +715,7 @@ function tt({
731
715
  /* @__PURE__ */ e(
732
716
  "input",
733
717
  {
734
- ref: R,
718
+ ref: _,
735
719
  type: "file",
736
720
  multiple: !0,
737
721
  className: "hidden",
@@ -743,7 +727,7 @@ function tt({
743
727
  ] });
744
728
  }
745
729
  export {
746
- tt as FileM2MField,
747
- et as FilePickerField,
748
- E as fileDisplayName
730
+ Ye as FileM2MField,
731
+ Ze as FilePickerField,
732
+ de as fileDisplayName
749
733
  };