@nivaro/react 0.3.105 → 0.3.106

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.
@@ -4,7 +4,7 @@ import { FileDiff as Ni, RotateCw as Sr, Network as Si, Map as Ci, Sparkles as C
4
4
  import Pi, { useState as _, useRef as pe, useEffect as me, useMemo as be, useLayoutEffect as Oi } from "react";
5
5
  import { createPortal as Xl } from "react-dom";
6
6
  import { toast as ge } from "sonner";
7
- import { useNivaroClient as Tt, useItemNavigation as Zl, useOverlayState as Mi, useItemEditAuth as Ta, useApiFetchConfig as Ai } from "../context.js";
7
+ import { useNivaroClient as Lt, useItemNavigation as Zl, useOverlayState as Mi, useItemEditAuth as Ta, useApiFetchConfig as Ai } from "../context.js";
8
8
  import { useDebounced as $l } from "../hooks/useDebounced.js";
9
9
  import { useElapsedLoading as Ii } from "../hooks/useElapsedLoading.js";
10
10
  import { useSlowReason as Ki } from "../hooks/useSlowReason.js";
@@ -109,7 +109,7 @@ function _a(n, o) {
109
109
  var w;
110
110
  if (!o || o.kind !== "m2m") return null;
111
111
  const h = o.relation.many_collection, d = o.relation.junction_field;
112
- return !h || !d ? null : ((w = n.find((S) => S.many_collection === h && S.many_field === d)) == null ? void 0 : w.one_collection) ?? null;
112
+ return !h || !d ? null : ((w = n.find((N) => N.many_collection === h && N.many_field === d)) == null ? void 0 : w.one_collection) ?? null;
113
113
  }
114
114
  function Xn(n) {
115
115
  if (!n) return "id";
@@ -128,13 +128,13 @@ function Na(n, o) {
128
128
  if (!o || o.length === 0) return null;
129
129
  const h = n == null ? "" : String(n), d = Number(h);
130
130
  for (const w of o) {
131
- const S = Number(w.value), $ = Number.isFinite(d) && Number.isFinite(S);
131
+ const N = Number(w.value), q = Number.isFinite(d) && Number.isFinite(N);
132
132
  switch (w.op) {
133
133
  case "gt":
134
- if ($ && d > S) return w.color;
134
+ if (q && d > N) return w.color;
135
135
  break;
136
136
  case "lt":
137
- if ($ && d < S) return w.color;
137
+ if (q && d < N) return w.color;
138
138
  break;
139
139
  case "eq":
140
140
  if (h.toLowerCase() === String(w.value ?? "").toLowerCase()) return w.color;
@@ -180,7 +180,7 @@ function Fa(n, o) {
180
180
  return String(o.id ?? "");
181
181
  }
182
182
  return n.replace(/\{\{([\w.]+)\}\}/g, (h, d) => {
183
- const w = d.split(".").reduce((S, $) => S == null ? void 0 : S[$], o);
183
+ const w = d.split(".").reduce((N, q) => N == null ? void 0 : N[q], o);
184
184
  return w == null ? "" : String(w);
185
185
  });
186
186
  }
@@ -199,55 +199,70 @@ function Pu(n) {
199
199
  if (d < 60) return `${d}m ago`;
200
200
  const w = Math.floor(d / 60);
201
201
  if (w < 24) return `${w}h ago`;
202
- const S = Math.floor(w / 24);
203
- return S < 7 ? `${S}d ago` : o.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
202
+ const N = Math.floor(w / 24);
203
+ return N < 7 ? `${N}d ago` : o.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
204
204
  }
205
- const xt = (n) => n.toLocaleString("en-US"), to = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]), Rt = (n) => n.startsWith("directus_") || n.startsWith("nivaro_"), Fr = /* @__PURE__ */ new Map();
206
- function no(n, o, h) {
207
- let d = Fr.get(o);
208
- d || (d = { ids: /* @__PURE__ */ new Set(), waiters: [], promise: null }, Fr.set(o, d));
209
- const w = d;
210
- return w.ids.add(h), w.promise || (w.promise = new Promise((S) => {
205
+ const xt = (n) => n.toLocaleString("en-US"), to = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]), Tt = (n) => n.startsWith("directus_") || n.startsWith("nivaro_"), Fr = /* @__PURE__ */ new Map();
206
+ function Ou(n) {
207
+ return n ? [
208
+ ...new Set(
209
+ [...n.matchAll(/\{\{([\w.]+)\}\}/g)].map((o) => o[1]).filter((o) => o.includes("."))
210
+ )
211
+ ] : [];
212
+ }
213
+ function no(n, o, h, d = []) {
214
+ const w = d.length > 0 ? `${o}\0${d.join(",")}` : o;
215
+ let N = Fr.get(w);
216
+ N || (N = { ids: /* @__PURE__ */ new Set(), waiters: [], promise: null }, Fr.set(w, N));
217
+ const q = N;
218
+ return q.ids.add(h), q.promise || (q.promise = new Promise(($) => {
211
219
  setTimeout(() => {
212
- Fr.delete(o);
213
- const $ = [...w.ids], q = [];
214
- for (let N = 0; N < $.length; N += 200) q.push($.slice(N, N + 200));
220
+ Fr.delete(w);
221
+ const S = [...q.ids], F = [];
222
+ for (let B = 0; B < S.length; B += 200) F.push(S.slice(B, B + 200));
223
+ const K = (B, L) => n.request(
224
+ G(`/items/${o}`, {
225
+ filter: JSON.stringify({ id: { _in: B } }),
226
+ limit: B.length,
227
+ // A template naming a linked record's field (categories:
228
+ // "{{core_category.name}} - {{sub_category.name}}") reads those through
229
+ // the link; a plain `*` row has only the ids and the label came out " - ".
230
+ fields: L ? ["*", ...d].join(",") : "*",
231
+ // #2444 — a display-label lookup: the server may answer it from its
232
+ // short-lived label row cache (busted by this collection's writes).
233
+ ...L ? {} : { labels: 1 }
234
+ })
235
+ ).then((u) => u.data ?? []);
215
236
  Promise.all(
216
- q.map(
217
- (N) => n.request(
218
- G(`/items/${o}`, {
219
- filter: JSON.stringify({ id: { _in: N } }),
220
- limit: N.length,
221
- fields: "*",
222
- // #2444 — a display-label lookup: the server may answer it from its
223
- // short-lived label row cache (busted by this collection's writes).
224
- labels: 1
225
- })
226
- ).then((L) => L.data ?? []).catch(() => [])
237
+ F.map(
238
+ (B) => (d.length > 0 ? (
239
+ // A stale template path must not cost the whole label: the plain row then.
240
+ K(B, !0).catch(() => K(B, !1))
241
+ ) : K(B, !1)).catch(() => [])
227
242
  )
228
- ).then((N) => {
243
+ ).then((B) => {
229
244
  const L = /* @__PURE__ */ new Map();
230
- for (const K of N.flat()) L.set(String(K.id), K);
231
- S(L);
245
+ for (const u of B.flat()) L.set(String(u.id), u);
246
+ $(L);
232
247
  });
233
248
  }, 0);
234
- })), w.promise.then((S) => S.get(h) ?? null);
249
+ })), q.promise.then(($) => $.get(h) ?? null);
235
250
  }
236
- const Ou = {
251
+ const Mu = {
237
252
  draft: "draft",
238
253
  submitted: "submitted",
239
254
  review: "in review",
240
255
  approved: "approved",
241
256
  rejected: "rejected"
242
257
  };
243
- function Mu({ summary: n }) {
244
- var N;
258
+ function Au({ summary: n }) {
259
+ var S;
245
260
  if (!n || n.total === 0) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
246
- const o = n.latest, h = n.active > 0, d = !!(o != null && o.workflow_state) && !["approved", "rejected", "reverted"].includes(o.status), w = o ? d ? ((N = o.workflow_state) == null ? void 0 : N.label) ?? "" : Ou[o.status] ?? o.status : "", S = o == null ? void 0 : o.cost_impact, $ = S != null && S !== 0 ? `${S > 0 ? "+" : "−"}$${Math.abs(S).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null, q = o ? `${o.title ?? "Addendum"} — ${w}${n.total > 1 ? ` (${n.total} total)` : ""}` : void 0;
261
+ const o = n.latest, h = n.active > 0, d = !!(o != null && o.workflow_state) && !["approved", "rejected", "reverted"].includes(o.status), w = o ? d ? ((S = o.workflow_state) == null ? void 0 : S.label) ?? "" : Mu[o.status] ?? o.status : "", N = o == null ? void 0 : o.cost_impact, q = N != null && N !== 0 ? `${N > 0 ? "+" : "−"}$${Math.abs(N).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null, $ = o ? `${o.title ?? "Addendum"} — ${w}${n.total > 1 ? ` (${n.total} total)` : ""}` : void 0;
247
262
  return /* @__PURE__ */ c(
248
263
  "span",
249
264
  {
250
- "data-tip": q,
265
+ "data-tip": $,
251
266
  className: `inline-flex max-w-[220px] items-center gap-1.5 truncate rounded-full border px-2 py-0.5 text-[11px] font-medium ${h ? "border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-500/50 dark:bg-amber-500/10 dark:text-amber-300" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300"}`,
252
267
  children: [
253
268
  /* @__PURE__ */ a(
@@ -258,38 +273,38 @@ function Mu({ summary: n }) {
258
273
  }
259
274
  ),
260
275
  h ? `${n.active} ${n.active === 1 ? "addendum" : "addendums"}${d ? ` · ${w}` : ` ${w || "active"}`}` : `${n.total} ${w}`,
261
- $ && /* @__PURE__ */ c("span", { className: "tabular-nums opacity-80", children: [
276
+ q && /* @__PURE__ */ c("span", { className: "tabular-nums opacity-80", children: [
262
277
  "· ",
263
- $
278
+ q
264
279
  ] })
265
280
  ]
266
281
  }
267
282
  );
268
283
  }
269
284
  function Ir({ relatedCollection: n, id: o }) {
270
- return rc(n) ? /* @__PURE__ */ a(Hc, { id: o }) : /* @__PURE__ */ a(Au, { relatedCollection: n, id: o });
285
+ return rc(n) ? /* @__PURE__ */ a(Hc, { id: o }) : /* @__PURE__ */ a(Iu, { relatedCollection: n, id: o });
271
286
  }
272
- function Au({
287
+ function Iu({
273
288
  relatedCollection: n,
274
289
  id: o
275
290
  }) {
276
- const h = Tt(), d = to.has(n), w = o != null && o !== "", { data: S } = ne({
291
+ const h = Lt(), d = to.has(n), w = o != null && o !== "", { data: N, isPending: q } = ne({
277
292
  queryKey: ["cbv-collection-meta", n],
278
293
  queryFn: () => h.request(G(`/collections/${n}`)).then((L) => L.data),
279
294
  staleTime: 10 * 6e4,
280
- enabled: !Rt(n),
295
+ enabled: !Tt(n),
281
296
  retry: !1
282
- }), { data: $, isLoading: q } = ne({
283
- queryKey: ["cbv-relation-item", n, String(o)],
284
- queryFn: () => d ? h.request(G(`/users/${o}`)).then((L) => L.data) : no(h, n, String(o)),
285
- enabled: w && (d || !Rt(n)),
297
+ }), $ = Ou(N == null ? void 0 : N.display_template), S = Tt(n) || !q, { data: F, isLoading: K } = ne({
298
+ queryKey: ["cbv-relation-item", n, String(o), $.join(",")],
299
+ queryFn: () => d ? h.request(G(`/users/${o}`)).then((L) => L.data) : no(h, n, String(o), $),
300
+ enabled: w && S && (d || !Tt(n)),
286
301
  staleTime: 30 * 6e4,
287
302
  retry: !1
288
303
  });
289
304
  if (!w) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
290
- if (q)
305
+ if (K || !S)
291
306
  return /* @__PURE__ */ a("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
292
- if (!$) {
307
+ if (!F) {
293
308
  const L = mu(null);
294
309
  return /* @__PURE__ */ a(
295
310
  "span",
@@ -301,16 +316,16 @@ function Au({
301
316
  }
302
317
  );
303
318
  }
304
- const N = d ? String(
305
- [$.first_name, $.last_name].filter(Boolean).join(" ") || $.email || $.id || ""
306
- ) : Fa((S == null ? void 0 : S.display_template) ?? null, $);
307
- return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: N });
319
+ const B = d ? String(
320
+ [F.first_name, F.last_name].filter(Boolean).join(" ") || F.email || F.id || ""
321
+ ) : Fa((N == null ? void 0 : N.display_template) ?? null, F);
322
+ return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: B });
308
323
  }
309
- function ao(n, o, h, d, w, S) {
310
- const $ = o.getQueryData(["cbv-collection-meta", h]);
324
+ function ao(n, o, h, d, w, N) {
325
+ const q = o.getQueryData(["cbv-collection-meta", h]);
311
326
  return Hd(
312
- Yd(n, h, $, d, w).then(
313
- (q) => window.location.origin + S({ collection: h, itemId: q })
327
+ Yd(n, h, q, d, w).then(
328
+ ($) => window.location.origin + N({ collection: h, itemId: $ })
314
329
  )
315
330
  ).catch(() => {
316
331
  });
@@ -327,62 +342,62 @@ function qa(n, o) {
327
342
  ])
328
343
  n.invalidateQueries({ queryKey: [h, o] });
329
344
  }
330
- function Iu(n, o) {
345
+ function Ku(n, o) {
331
346
  return n ? n.is_admin ? !0 : (n.collections ?? []).some(
332
347
  (h) => (h.collection === o || h.collection === "*") && (h.actions.includes("update") || h.actions.includes("*"))
333
348
  ) : !1;
334
349
  }
335
- function Ku(n, o) {
350
+ function ju(n, o) {
336
351
  return n ? n.is_admin ? !0 : (n.collections ?? []).some(
337
352
  (h) => (h.collection === o || h.collection === "*") && (h.actions.includes("delete") || h.actions.includes("*"))
338
353
  ) : !1;
339
354
  }
340
- function ju({
355
+ function Bu({
341
356
  collection: n,
342
357
  id: o,
343
358
  hasPipeline: h,
344
359
  onOpen: d,
345
360
  onPeek: w,
346
- onAudit: S,
347
- urlFor: $,
348
- onDeleted: q,
349
- onAfterTransition: N,
350
- row: L,
361
+ onAudit: N,
362
+ urlFor: q,
363
+ onDeleted: $,
364
+ onAfterTransition: S,
365
+ row: F,
351
366
  bulkEnabledKeys: K,
352
- disabled: V = !1,
353
- label: I
367
+ disabled: B = !1,
368
+ label: L
354
369
  }) {
355
370
  var pn, en, He, zt, yt, lt, Fn, mn, fn, tn, nn, ea, ta, ce, na, bn, hn, Rn, En, Dn;
356
- const u = Tt(), y = Ea(), { isAdmin: z } = Ta(), F = Pr({
357
- label: I,
371
+ const u = Lt(), y = Ea(), { isAdmin: W } = Ta(), R = Pr({
372
+ label: L,
358
373
  meta: y.getQueryData(["cbv-collection-meta", n]),
359
- row: L,
374
+ row: F,
360
375
  id: o,
361
376
  collection: n
362
- }), [m, E] = _(!1), [P, O] = _({ x: 0, y: 0 }), T = pe(null), de = pe(null);
377
+ }), [m, D] = _(!1), [O, M] = _({ x: 0, y: 0 }), T = pe(null), de = pe(null);
363
378
  me(() => {
364
- V && E(!1);
365
- }, [V]);
379
+ B && D(!1);
380
+ }, [B]);
366
381
  const { data: fe } = ne({
367
382
  queryKey: ["my-permissions"],
368
383
  queryFn: () => u.request(G("/security/my/permissions")).then((g) => g.data),
369
- enabled: m && !z,
384
+ enabled: m && !W,
370
385
  staleTime: 5 * 6e4
371
386
  }), we = pu(n, String(o), {
372
- enabled: m && z,
373
- onDone: () => E(!1)
387
+ enabled: m && W,
388
+ onDone: () => D(!1)
374
389
  }), [Ae, Y] = _(!1), Be = Zc(m), Se = eu() && !!(Be != null && Be.some((g) => g.collection === n));
375
390
  me(() => {
376
391
  if (!m) return;
377
392
  const g = (Z) => {
378
393
  var Ke, ae;
379
394
  const ue = Z.target;
380
- !((Ke = de.current) != null && Ke.contains(ue)) && !((ae = T.current) != null && ae.contains(ue)) && E(!1);
381
- }, R = (Z) => {
382
- Z.key === "Escape" && E(!1);
395
+ !((Ke = de.current) != null && Ke.contains(ue)) && !((ae = T.current) != null && ae.contains(ue)) && D(!1);
396
+ }, E = (Z) => {
397
+ Z.key === "Escape" && D(!1);
383
398
  };
384
- return window.addEventListener("mousedown", g), window.addEventListener("keydown", R), () => {
385
- window.removeEventListener("mousedown", g), window.removeEventListener("keydown", R);
399
+ return window.addEventListener("mousedown", g), window.addEventListener("keydown", E), () => {
400
+ window.removeEventListener("mousedown", g), window.removeEventListener("keydown", E);
386
401
  };
387
402
  }, [m]);
388
403
  const { data: X } = ne({
@@ -394,8 +409,8 @@ function ju({
394
409
  () => ((X == null ? void 0 : X.available_transitions) ?? []).filter((g) => g.in_row_menu !== !1),
395
410
  [X]
396
411
  ), { data: it } = bc(m ? [n] : []), rt = ad({
397
- isAdmin: z,
398
- roleMayDelete: Ku(fe, n),
412
+ isAdmin: W,
413
+ roleMayDelete: ju(fe, n),
399
414
  builtinOpen: it ? (it[n] ?? []).some((g) => g.source === "builtin" && g.key === "delete") && hc(K, n, "delete") : void 0,
400
415
  hasPipeline: h,
401
416
  run: h ? X === void 0 ? void 0 : X : null
@@ -408,11 +423,11 @@ function ju({
408
423
  [m, it, n, K]
409
424
  ), Oe = be(() => {
410
425
  const g = /* @__PURE__ */ new Set();
411
- for (const R of Ie)
412
- for (const Z of R.guard ?? [])
413
- Z && typeof Z.field == "string" && !(L && Z.field in L) && g.add(Z.field);
426
+ for (const E of Ie)
427
+ for (const Z of E.guard ?? [])
428
+ Z && typeof Z.field == "string" && !(F && Z.field in F) && g.add(Z.field);
414
429
  return [...g].sort();
415
- }, [Ie, L]), { data: We } = ne({
430
+ }, [Ie, F]), { data: We } = ne({
416
431
  queryKey: ["row-action-guard", n, String(o), Oe.join(",")],
417
432
  queryFn: () => u.request(
418
433
  G(`/items/${encodeURIComponent(n)}/${encodeURIComponent(String(o))}`, {
@@ -422,13 +437,13 @@ function ju({
422
437
  enabled: m && Oe.length > 0,
423
438
  staleTime: 0
424
439
  }), k = be(() => {
425
- if (Oe.length > 0 && !We) return Ie.filter((R) => {
440
+ if (Oe.length > 0 && !We) return Ie.filter((E) => {
426
441
  var Z;
427
- return !((Z = R.guard) != null && Z.length);
442
+ return !((Z = E.guard) != null && Z.length);
428
443
  });
429
- const g = { ...We ?? {}, ...L ?? {} };
430
- return Ie.filter((R) => xc(R.guard, g) !== !1);
431
- }, [Ie, Oe, We, L]), { pushActions: le, failedPartners: ee } = Sc({
444
+ const g = { ...We ?? {}, ...F ?? {} };
445
+ return Ie.filter((E) => xc(E.guard, g) !== !1);
446
+ }, [Ie, Oe, We, F]), { pushActions: le, failedPartners: ee } = Sc({
432
447
  collection: n,
433
448
  id: o,
434
449
  open: m,
@@ -439,30 +454,30 @@ function ju({
439
454
  [X]
440
455
  ), st = be(() => {
441
456
  const g = /* @__PURE__ */ new Map();
442
- return ((X == null ? void 0 : X.states) ?? []).forEach((R, Z) => g.set(R.id, Z)), g;
457
+ return ((X == null ? void 0 : X.states) ?? []).forEach((E, Z) => g.set(E.id, Z)), g;
443
458
  }, [X]), Ze = be(() => {
444
459
  var Z;
445
- const g = /* @__PURE__ */ new Map(), R = [];
460
+ const g = /* @__PURE__ */ new Map(), E = [];
446
461
  for (const ue of $e) {
447
462
  const Ke = (((Z = ue.group_label) == null ? void 0 : Z.trim()) || ue.label).trim();
448
463
  if (g.has(Ke))
449
464
  g.get(Ke).push(ue);
450
465
  else {
451
466
  const ae = [ue];
452
- g.set(Ke, ae), R.push({ key: `g:${Ke}`, label: Ke, options: ae });
467
+ g.set(Ke, ae), E.push({ key: `g:${Ke}`, label: Ke, options: ae });
453
468
  }
454
469
  }
455
- for (const ue of R)
470
+ for (const ue of E)
456
471
  ue.options.length > 1 && ue.options.sort(
457
472
  (Ke, ae) => (st.get(Ke.to_state ?? "") ?? 999) - (st.get(ae.to_state ?? "") ?? 999)
458
473
  );
459
- return R;
474
+ return E;
460
475
  }, [$e, st]), mt = (g) => {
461
- const R = g.to_state ? xe.get(g.to_state) : null;
462
- return (R == null ? void 0 : R.label) ?? g.label;
476
+ const E = g.to_state ? xe.get(g.to_state) : null;
477
+ return (E == null ? void 0 : E.label) ?? g.label;
463
478
  }, Et = (g) => {
464
- const R = g.to_state ? xe.get(g.to_state) : null;
465
- return (R == null ? void 0 : R.color) ?? g.color ?? "#94a3b8";
479
+ const E = g.to_state ? xe.get(g.to_state) : null;
480
+ return (E == null ? void 0 : E.color) ?? g.color ?? "#94a3b8";
466
481
  }, [f, H] = _(null), [te, oe] = _("");
467
482
  me(() => {
468
483
  m || (H(null), oe(""), Y(!1));
@@ -482,60 +497,60 @@ function ju({
482
497
  if (!m) return;
483
498
  const g = de.current;
484
499
  if (!g) return;
485
- const R = g.getBoundingClientRect();
486
- let { x: Z, y: ue } = P;
487
- if (R.right > window.innerWidth - 8 && (Z = Math.max(8, window.innerWidth - R.width - 8)), R.bottom > window.innerHeight - 8) {
488
- const ae = (Ke = T.current) == null ? void 0 : Ke.getBoundingClientRect(), an = ((ae == null ? void 0 : ae.top) ?? ue) - R.height - 4;
489
- ue = an >= 8 ? an : Math.max(8, window.innerHeight - R.height - 8);
500
+ const E = g.getBoundingClientRect();
501
+ let { x: Z, y: ue } = O;
502
+ if (E.right > window.innerWidth - 8 && (Z = Math.max(8, window.innerWidth - E.width - 8)), E.bottom > window.innerHeight - 8) {
503
+ const ae = (Ke = T.current) == null ? void 0 : Ke.getBoundingClientRect(), an = ((ae == null ? void 0 : ae.top) ?? ue) - E.height - 4;
504
+ ue = an >= 8 ? an : Math.max(8, window.innerHeight - E.height - 8);
490
505
  }
491
- (Z !== P.x || ue !== P.y) && O({ x: Z, y: ue });
492
- }, [m, P, f, $e.length]);
506
+ (Z !== O.x || ue !== O.y) && M({ x: Z, y: ue });
507
+ }, [m, O, f, $e.length]);
493
508
  const Dt = qt({
494
- mutationFn: ({ transitionId: g, comment: R }) => u.request(
509
+ mutationFn: ({ transitionId: g, comment: E }) => u.request(
495
510
  he(`/pipelines/instance/${n}/${o}/transition`, {
496
511
  transition_id: g,
497
- ...R != null && R.trim() ? { comment: R.trim() } : {}
512
+ ...E != null && E.trim() ? { comment: E.trim() } : {}
498
513
  })
499
514
  ),
500
- onSuccess: (g, R) => {
501
- E(!1);
502
- const Z = $e.find((ue) => ue.id === R.transitionId);
503
- ge.success(Z ? `${F.name} moved to ${mt(Z)}` : `${F.name} moved`), qa(y, n), Il(y, n, [o]), N == null || N();
515
+ onSuccess: (g, E) => {
516
+ D(!1);
517
+ const Z = $e.find((ue) => ue.id === E.transitionId);
518
+ ge.success(Z ? `${R.name} moved to ${mt(Z)}` : `${R.name} moved`), qa(y, n), Il(y, n, [o]), S == null || S();
504
519
  },
505
520
  onError: (g) => ge.error(
506
521
  Zt(g, "Transition failed"),
507
522
  $a(g, { action: "Transition" })
508
523
  )
509
524
  }), un = qt({
510
- mutationFn: async ({ action: g, comment: R }) => {
511
- const Z = { collection: n, ids: [o], reason: (R == null ? void 0 : R.trim()) || null }, ue = g.source === "db" ? await u.request(he("/bulk-actions/run", { ...Z, key: g.key })) : await u.request(he(`/bulk-actions/${g.key}/execute`, Z));
525
+ mutationFn: async ({ action: g, comment: E }) => {
526
+ const Z = { collection: n, ids: [o], reason: (E == null ? void 0 : E.trim()) || null }, ue = g.source === "db" ? await u.request(he("/bulk-actions/run", { ...Z, key: g.key })) : await u.request(he(`/bulk-actions/${g.key}/execute`, Z));
512
527
  return { action: g, result: ue.data ?? {} };
513
528
  },
514
- onSuccess: ({ action: g, result: R }) => {
529
+ onSuccess: ({ action: g, result: E }) => {
515
530
  var Z, ue, Ke, ae;
516
- if (E(!1), R.failed) {
517
- ge.error(`${g.label} failed on ${F.name}`, {
518
- description: (ue = (Z = R.errors) == null ? void 0 : Z[0]) == null ? void 0 : ue.error
531
+ if (D(!1), E.failed) {
532
+ ge.error(`${g.label} failed on ${R.name}`, {
533
+ description: (ue = (Z = E.errors) == null ? void 0 : Z[0]) == null ? void 0 : ue.error
519
534
  });
520
535
  return;
521
536
  }
522
- if (!R.succeeded && R.skipped) {
523
- const an = (ae = (Ke = R.outcomes) == null ? void 0 : Ke.find((Wt) => Wt.outcome === "skip")) == null ? void 0 : ae.reason;
524
- ge.info(`${F.name}: ${an ?? "nothing to change"}`);
537
+ if (!E.succeeded && E.skipped) {
538
+ const an = (ae = (Ke = E.outcomes) == null ? void 0 : Ke.find((Wt) => Wt.outcome === "skip")) == null ? void 0 : ae.reason;
539
+ ge.info(`${R.name}: ${an ?? "nothing to change"}`);
525
540
  return;
526
541
  }
527
- ge.success(`${g.label} — done on ${F.name}`), qa(y, n), Il(y, n, [o]), N == null || N();
542
+ ge.success(`${g.label} — done on ${R.name}`), qa(y, n), Il(y, n, [o]), S == null || S();
528
543
  },
529
544
  onError: (g) => {
530
- const R = g.response;
531
- ge.error((R == null ? void 0 : R.error) ?? Zt(g, "Action failed"), $a(g));
545
+ const E = g.response;
546
+ ge.error((E == null ? void 0 : E.error) ?? Zt(g, "Action failed"), $a(g));
532
547
  }
533
548
  }), bt = qt({
534
- mutationFn: ({ op: g, note: R, pick: Z }) => Cc(u, n, o, g, R, Z).then((ue) => ({ op: g, outcome: ue })),
535
- onSuccess: ({ op: g, outcome: R }) => {
536
- E(!1);
549
+ mutationFn: ({ op: g, note: E, pick: Z }) => Cc(u, n, o, g, E, Z).then((ue) => ({ op: g, outcome: ue })),
550
+ onSuccess: ({ op: g, outcome: E }) => {
551
+ D(!1);
537
552
  const Z = g.kind === "push" ? g.action.label : "Retry";
538
- R ? R.outcome === "fail" ? ge.error(`${Z} failed`, { description: R.reason, duration: 1e4 }) : R.outcome === "skip" ? ge.info(`${Z}: ${R.reason ?? "skipped"}`) : ge.success(R.reason ?? Z) : ge.info(`${Z}: nothing ran`);
553
+ E ? E.outcome === "fail" ? ge.error(`${Z} failed`, { description: E.reason, duration: 1e4 }) : E.outcome === "skip" ? ge.info(`${Z}: ${E.reason ?? "skipped"}`) : ge.success(E.reason ?? Z) : ge.info(`${Z}: nothing ran`);
539
554
  for (const ue of [
540
555
  "row-push-state",
541
556
  "erp-submissions",
@@ -545,17 +560,17 @@ function ju({
545
560
  "item-actions"
546
561
  ])
547
562
  y.invalidateQueries({ queryKey: [ue] });
548
- qa(y, n), N == null || N();
563
+ qa(y, n), S == null || S();
549
564
  },
550
565
  onError: (g) => {
551
- const R = g.response;
552
- ge.error((R == null ? void 0 : R.error) ?? Zt(g, "Push failed"), $a(g));
566
+ const E = g.response;
567
+ ge.error((E == null ? void 0 : E.error) ?? Zt(g, "Push failed"), $a(g));
553
568
  }
554
- }), Ln = !!f && !f.push && te.trim().length === 0 && (f.action ? f.action.require_reason : ((en = $e.find((g) => g.id === f.picked)) == null ? void 0 : en.comment_mode) === "required"), Ge = (g, R, Z = !1) => /* @__PURE__ */ a(
569
+ }), Ln = !!f && !f.push && te.trim().length === 0 && (f.action ? f.action.require_reason : ((en = $e.find((g) => g.id === f.picked)) == null ? void 0 : en.comment_mode) === "required"), Ge = (g, E, Z = !1) => /* @__PURE__ */ a(
555
570
  "button",
556
571
  {
557
572
  type: "button",
558
- onClick: R,
573
+ onClick: E,
559
574
  className: `block w-full px-3 py-1.5 text-left text-[12px] ${Z ? "text-red-600 hover:bg-red-50 dark:hover:bg-red-950" : "text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800"}`,
560
575
  children: g
561
576
  }
@@ -566,14 +581,14 @@ function ju({
566
581
  {
567
582
  ref: T,
568
583
  type: "button",
569
- disabled: V,
584
+ disabled: B,
570
585
  onClick: () => {
571
- var R;
572
- const g = (R = T.current) == null ? void 0 : R.getBoundingClientRect();
573
- g && O({ x: g.right - 176, y: g.bottom + 4 }), E((Z) => !Z);
586
+ var E;
587
+ const g = (E = T.current) == null ? void 0 : E.getBoundingClientRect();
588
+ g && M({ x: g.right - 176, y: g.bottom + 4 }), D((Z) => !Z);
574
589
  },
575
- "aria-label": `Actions for ${F.name}`,
576
- "data-tip": V ? "Turn off bulk mode to use a row’s own actions" : void 0,
590
+ "aria-label": `Actions for ${R.name}`,
591
+ "data-tip": B ? "Turn off bulk mode to use a row’s own actions" : void 0,
577
592
  className: "inline-flex h-6 items-center gap-1 rounded border border-slate-200 bg-white px-2 text-[11px] font-medium text-slate-600 hover:border-slate-300 hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-slate-200 disabled:hover:text-slate-600 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:hover:text-slate-100 dark:disabled:hover:border-slate-700 dark:disabled:hover:text-slate-300",
578
593
  children: [
579
594
  "Actions",
@@ -586,7 +601,7 @@ function ju({
586
601
  "div",
587
602
  {
588
603
  ref: de,
589
- style: { position: "fixed", left: P.x, top: P.y, zIndex: 60 },
604
+ style: { position: "fixed", left: O.x, top: O.y, zIndex: 60 },
590
605
  className: `nvr-pop-in ${f ? "w-64" : "w-44"} rounded-lg border border-slate-200 bg-white py-1 shadow-xl dark:border-slate-700 dark:bg-slate-900`,
591
606
  children: f ? /* @__PURE__ */ c("div", { className: "px-2 pb-2", children: [
592
607
  /* @__PURE__ */ c(
@@ -606,7 +621,7 @@ function ju({
606
621
  {
607
622
  className: "mb-1.5 px-1 text-[11.5px] leading-snug text-slate-500 dark:text-slate-400",
608
623
  "data-row-action-sentence": !0,
609
- children: ji(f.action, F.name)
624
+ children: ji(f.action, R.name)
610
625
  }
611
626
  ),
612
627
  f.push && /* @__PURE__ */ a(
@@ -630,7 +645,7 @@ function ju({
630
645
  "button",
631
646
  {
632
647
  type: "button",
633
- onClick: () => H((R) => R && { ...R, picked: g.id }),
648
+ onClick: () => H((E) => E && { ...E, picked: g.id }),
634
649
  className: `flex w-full items-center gap-2 rounded-md border px-2 py-1.5 text-left text-[12px] ${f.picked === g.id ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-600 hover:border-slate-300 dark:border-slate-700 dark:text-slate-300"}`,
635
650
  children: [
636
651
  /* @__PURE__ */ a(
@@ -693,27 +708,27 @@ function ju({
693
708
  ] })
694
709
  ] }) : /* @__PURE__ */ c(ze, { children: [
695
710
  Ge("Open", () => {
696
- E(!1), d();
711
+ D(!1), d();
697
712
  }),
698
713
  Ge("Open in new tab", () => {
699
- E(!1), window.open($({ collection: n, itemId: String(o) }), "_blank");
714
+ D(!1), window.open(q({ collection: n, itemId: String(o) }), "_blank");
700
715
  }),
701
716
  w && Ge("Peek details", () => {
702
- E(!1), w();
717
+ D(!1), w();
703
718
  }),
704
719
  Se && Ge("Discuss in chat", () => {
705
- E(!1), tu(u, n, String(o)).then((g) => {
720
+ D(!1), tu(u, n, String(o)).then((g) => {
706
721
  g || ge.error("This record has no chat room you can open");
707
722
  }).catch(() => ge.error("Could not open the chat room"));
708
723
  }),
709
- S && Ge("Audit log", () => {
710
- E(!1), S();
724
+ N && Ge("Audit log", () => {
725
+ D(!1), N();
711
726
  }),
712
727
  h && Ze.length > 0 && /* @__PURE__ */ c(ze, { children: [
713
728
  jt,
714
729
  /* @__PURE__ */ a("p", { className: "px-3 pb-0.5 pt-1 text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "Transitions" }),
715
730
  Ze.map((g) => {
716
- var R;
731
+ var E;
717
732
  return /* @__PURE__ */ c(
718
733
  "button",
719
734
  {
@@ -730,7 +745,7 @@ function ju({
730
745
  {
731
746
  "aria-hidden": !0,
732
747
  className: "h-1.5 w-1.5 shrink-0 rounded-full",
733
- style: { backgroundColor: ((R = g.options[0]) == null ? void 0 : R.color) ?? "#94a3b8" }
748
+ style: { backgroundColor: ((E = g.options[0]) == null ? void 0 : E.color) ?? "#94a3b8" }
734
749
  }
735
750
  ),
736
751
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate", children: g.label }),
@@ -808,14 +823,14 @@ function ju({
808
823
  )
809
824
  ] }),
810
825
  jt,
811
- F.copy != null && Ge("Copy ID", () => {
826
+ R.copy != null && Ge("Copy ID", () => {
812
827
  var g;
813
- E(!1), (g = navigator.clipboard) == null || g.writeText(F.copy ?? ""), ge.success("ID copied");
828
+ D(!1), (g = navigator.clipboard) == null || g.writeText(R.copy ?? ""), ge.success("ID copied");
814
829
  }),
815
830
  Ge("Copy link", () => {
816
- E(!1), ao(u, y, n, L, o, $), ge.success("Link copied");
831
+ D(!1), ao(u, y, n, F, o, q), ge.success("Link copied");
817
832
  }),
818
- z && /* @__PURE__ */ c(ze, { children: [
833
+ W && /* @__PURE__ */ c(ze, { children: [
819
834
  jt,
820
835
  /* @__PURE__ */ a(
821
836
  "p",
@@ -844,7 +859,7 @@ function ju({
844
859
  Ae ? /* @__PURE__ */ c("div", { className: "px-3 py-1.5", "data-row-delete-confirm": !0, children: [
845
860
  /* @__PURE__ */ c("p", { className: "text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: [
846
861
  "Delete ",
847
- F.name,
862
+ R.name,
848
863
  "? It moves to the trash, where it can be restored."
849
864
  ] }),
850
865
  /* @__PURE__ */ c("div", { className: "mt-1.5 flex gap-1.5", children: [
@@ -853,7 +868,7 @@ function ju({
853
868
  {
854
869
  type: "button",
855
870
  onClick: () => {
856
- E(!1), q();
871
+ D(!1), $();
857
872
  },
858
873
  className: "h-7 flex-1 rounded-md bg-red-600 text-[12px] font-semibold text-white hover:bg-red-700",
859
874
  children: "Delete"
@@ -888,9 +903,9 @@ function Vl({
888
903
  value: d,
889
904
  relations: w
890
905
  }) {
891
- const S = Ar(w, n, o);
892
- if (S != null && S.one_collection)
893
- return /* @__PURE__ */ a(Ir, { relatedCollection: S.one_collection, id: d });
906
+ const N = Ar(w, n, o);
907
+ if (N != null && N.one_collection)
908
+ return /* @__PURE__ */ a(Ir, { relatedCollection: N.one_collection, id: d });
894
909
  if (d == null) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
895
910
  if (h === "boolean")
896
911
  return /* @__PURE__ */ a(
@@ -901,13 +916,13 @@ function Vl({
901
916
  }
902
917
  );
903
918
  if (h === "timestamp" || h === "datetime" || h === "date") {
904
- const $ = String(d).match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
905
- if ($) {
906
- const q = new Date(Number($[1]), Number($[2]) - 1, Number($[3])).toLocaleDateString(
919
+ const q = String(d).match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
920
+ if (q) {
921
+ const $ = new Date(Number(q[1]), Number(q[2]) - 1, Number(q[3])).toLocaleDateString(
907
922
  "en-US",
908
923
  { month: "short", day: "numeric", year: "numeric" }
909
924
  );
910
- return /* @__PURE__ */ a("span", { className: "text-[12px] tabular-nums text-slate-400", children: q });
925
+ return /* @__PURE__ */ a("span", { className: "text-[12px] tabular-nums text-slate-400", children: $ });
911
926
  }
912
927
  return /* @__PURE__ */ a("span", { className: "text-[12px] tabular-nums text-slate-400", children: Pu(d) });
913
928
  }
@@ -941,49 +956,49 @@ function Da({
941
956
  selected: h,
942
957
  onChange: d,
943
958
  loading: w,
944
- block: S,
945
- onOpenChange: $,
946
- badge: q,
947
- onSearch: N
959
+ block: N,
960
+ onOpenChange: q,
961
+ badge: $,
962
+ onSearch: S
948
963
  }) {
949
- var E;
950
- const [L, K] = _(!1);
964
+ var D;
965
+ const [F, K] = _(!1);
951
966
  me(() => {
952
- $ == null || $(L);
953
- }, [L]);
954
- const [V, I] = _("");
967
+ q == null || q(F);
968
+ }, [F]);
969
+ const [B, L] = _("");
955
970
  me(() => {
956
- if (!N) return;
957
- const P = setTimeout(() => N(V.trim()), 250);
958
- return () => clearTimeout(P);
959
- }, [V]);
971
+ if (!S) return;
972
+ const O = setTimeout(() => S(B.trim()), 250);
973
+ return () => clearTimeout(O);
974
+ }, [B]);
960
975
  const u = pe(null);
961
976
  me(() => {
962
- if (!L) return;
963
- const P = (O) => {
977
+ if (!F) return;
978
+ const O = (M) => {
964
979
  var T;
965
- (T = u.current) != null && T.contains(O.target) || K(!1);
980
+ (T = u.current) != null && T.contains(M.target) || K(!1);
966
981
  };
967
- return window.addEventListener("mousedown", P), () => window.removeEventListener("mousedown", P);
968
- }, [L]);
969
- const y = V && !N ? o.filter((P) => P.label.toLowerCase().includes(V.toLowerCase())) : o, z = new Set(h.map(String)), F = ((E = o.find((P) => String(P.value) === String(h[0]))) == null ? void 0 : E.label) ?? String(h[0] ?? ""), m = h.length === 0 ? n : h.length === 1 ? F : `${F} +${h.length - 1}`;
970
- return /* @__PURE__ */ c("div", { ref: u, className: S ? "relative w-full" : "relative", children: [
982
+ return window.addEventListener("mousedown", O), () => window.removeEventListener("mousedown", O);
983
+ }, [F]);
984
+ const y = B && !S ? o.filter((O) => O.label.toLowerCase().includes(B.toLowerCase())) : o, W = new Set(h.map(String)), R = ((D = o.find((O) => String(O.value) === String(h[0]))) == null ? void 0 : D.label) ?? String(h[0] ?? ""), m = h.length === 0 ? n : h.length === 1 ? R : `${R} +${h.length - 1}`;
985
+ return /* @__PURE__ */ c("div", { ref: u, className: N ? "relative w-full" : "relative", children: [
971
986
  /* @__PURE__ */ c(
972
987
  "button",
973
988
  {
974
989
  type: "button",
975
- onClick: (P) => {
976
- P.stopPropagation(), K((O) => !O);
990
+ onClick: (O) => {
991
+ O.stopPropagation(), K((M) => !M);
977
992
  },
978
993
  title: n,
979
- className: `inline-flex h-6 items-center gap-1 rounded border px-1.5 text-[11px] font-normal normal-case tracking-normal ${S ? "w-full min-w-[64px]" : "max-w-[150px]"} ${h.length ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-slate-800 dark:text-slate-100" : "border-slate-200 bg-white text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400"}`,
994
+ className: `inline-flex h-6 items-center gap-1 rounded border px-1.5 text-[11px] font-normal normal-case tracking-normal ${N ? "w-full min-w-[64px]" : "max-w-[150px]"} ${h.length ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-slate-800 dark:text-slate-100" : "border-slate-200 bg-white text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400"}`,
980
995
  children: [
981
- q && /* @__PURE__ */ a(
996
+ $ && /* @__PURE__ */ a(
982
997
  "span",
983
998
  {
984
- title: q.title,
985
- className: `shrink-0 rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${q.cls}`,
986
- children: q.label
999
+ title: $.title,
1000
+ className: `shrink-0 rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${$.cls}`,
1001
+ children: $.label
987
1002
  }
988
1003
  ),
989
1004
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-left", children: m }),
@@ -992,8 +1007,8 @@ function Da({
992
1007
  {
993
1008
  role: "button",
994
1009
  tabIndex: -1,
995
- onClick: (P) => {
996
- P.stopPropagation(), d([]);
1010
+ onClick: (O) => {
1011
+ O.stopPropagation(), d([]);
997
1012
  },
998
1013
  "aria-label": `Clear ${n}`,
999
1014
  className: "text-slate-400 hover:text-slate-600",
@@ -1004,18 +1019,18 @@ function Da({
1004
1019
  ]
1005
1020
  }
1006
1021
  ),
1007
- L && /* @__PURE__ */ c("div", { className: "nvr-pop-in absolute left-0 top-full z-50 mt-1 flex max-h-72 w-max min-w-[13rem] max-w-[22rem] flex-col overflow-hidden rounded-lg border border-slate-200 bg-white text-left shadow-lg dark:border-slate-700 dark:bg-slate-900", children: [
1022
+ F && /* @__PURE__ */ c("div", { className: "nvr-pop-in absolute left-0 top-full z-50 mt-1 flex max-h-72 w-max min-w-[13rem] max-w-[22rem] flex-col overflow-hidden rounded-lg border border-slate-200 bg-white text-left shadow-lg dark:border-slate-700 dark:bg-slate-900", children: [
1008
1023
  /* @__PURE__ */ a(
1009
1024
  "input",
1010
1025
  {
1011
1026
  autoFocus: !0,
1012
- value: V,
1013
- onChange: (P) => I(P.target.value),
1027
+ value: B,
1028
+ onChange: (O) => L(O.target.value),
1014
1029
  placeholder: "Search…",
1015
1030
  className: "m-1.5 h-6 shrink-0 rounded border border-slate-200 bg-slate-50 px-1.5 text-[11px] font-normal normal-case outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
1016
1031
  }
1017
1032
  ),
1018
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-1", children: w ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "Loading…" }) : y.length === 0 ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "No options" }) : y.slice(0, 300).map((P) => /* @__PURE__ */ c(
1033
+ /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-1", children: w ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "Loading…" }) : y.length === 0 ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "No options" }) : y.slice(0, 300).map((O) => /* @__PURE__ */ c(
1019
1034
  "label",
1020
1035
  {
1021
1036
  className: "flex cursor-pointer items-center gap-1.5 rounded px-1.5 py-0.5 text-[11.5px] font-normal normal-case tracking-normal text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
@@ -1024,41 +1039,41 @@ function Da({
1024
1039
  "input",
1025
1040
  {
1026
1041
  type: "checkbox",
1027
- checked: z.has(String(P.value)),
1042
+ checked: W.has(String(O.value)),
1028
1043
  onChange: () => d(
1029
- z.has(String(P.value)) ? h.filter((O) => String(O) !== String(P.value)) : [...h, P.value]
1044
+ W.has(String(O.value)) ? h.filter((M) => String(M) !== String(O.value)) : [...h, O.value]
1030
1045
  )
1031
1046
  }
1032
1047
  ),
1033
- /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate", children: P.label }),
1034
- P.count != null && /* @__PURE__ */ a("span", { className: "shrink-0 pl-2 text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: P.count.toLocaleString() })
1048
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate", children: O.label }),
1049
+ O.count != null && /* @__PURE__ */ a("span", { className: "shrink-0 pl-2 text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: O.count.toLocaleString() })
1035
1050
  ]
1036
1051
  },
1037
- String(P.value)
1052
+ String(O.value)
1038
1053
  )) })
1039
1054
  ] })
1040
1055
  ] });
1041
1056
  }
1042
- function Bu({
1057
+ function Qu({
1043
1058
  target: n,
1044
1059
  label: o,
1045
1060
  selected: h,
1046
1061
  onChange: d,
1047
1062
  preferIds: w
1048
1063
  }) {
1049
- const S = Tt(), [$, q] = _(!1), N = $ || h.length > 0, [L, K] = _(""), V = (w ?? []).map(String).sort().join(","), { data: I } = ne({
1064
+ const N = Lt(), [q, $] = _(!1), S = q || h.length > 0, [F, K] = _(""), B = (w ?? []).map(String).sort().join(","), { data: L } = ne({
1050
1065
  queryKey: ["cbv-collection-meta", n],
1051
- queryFn: () => S.request(G(`/collections/${n}`)).then((T) => T.data),
1066
+ queryFn: () => N.request(G(`/collections/${n}`)).then((T) => T.data),
1052
1067
  staleTime: 10 * 6e4,
1053
- enabled: N,
1068
+ enabled: S,
1054
1069
  retry: !1
1055
- }), u = Xn(I), y = (I == null ? void 0 : I.display_template) ?? null, { data: z = [], isLoading: F } = ne({
1070
+ }), u = Xn(L), y = (L == null ? void 0 : L.display_template) ?? null, { data: W = [], isLoading: R } = ne({
1056
1071
  // Own key shape (an array of {value,label}) — 'cbv-filter-options' held the
1057
1072
  // page-only list; a new name keeps an old cached entry from answering.
1058
- queryKey: ["cbv-filter-options-all", n, u, y ?? "", L, V],
1073
+ queryKey: ["cbv-filter-options-all", n, u, y ?? "", F, B],
1059
1074
  queryFn: async () => {
1060
1075
  const T = Gc({
1061
- search: L,
1076
+ search: F,
1062
1077
  preferIds: w,
1063
1078
  labelField: u,
1064
1079
  fields: Mr(y, u)
@@ -1067,19 +1082,19 @@ function Bu({
1067
1082
  label: (y ? Fa(y, Ae) : "") || String(Ae[u] ?? Ae.id ?? "")
1068
1083
  })), fe = await Promise.all(
1069
1084
  T.map(
1070
- (we) => S.request(G(`/items/${n}`, we)).then((Ae) => de(Ae.data ?? []))
1085
+ (we) => N.request(G(`/items/${n}`, we)).then((Ae) => de(Ae.data ?? []))
1071
1086
  )
1072
1087
  );
1073
1088
  return Xc(fe);
1074
1089
  },
1075
1090
  staleTime: 10 * 6e4,
1076
- enabled: N && !!I,
1091
+ enabled: S && !!L,
1077
1092
  retry: !1
1078
- }), m = h.filter((T) => !z.some((de) => String(de.value) === String(T))), E = m.map(String).join(","), { data: P = [] } = ne({
1079
- queryKey: ["cbv-filter-selected-labels", n, u, y ?? "", E],
1093
+ }), m = h.filter((T) => !W.some((de) => String(de.value) === String(T))), D = m.map(String).join(","), { data: O = [] } = ne({
1094
+ queryKey: ["cbv-filter-selected-labels", n, u, y ?? "", D],
1080
1095
  queryFn: () => {
1081
1096
  const T = Mr(y, u);
1082
- return S.request(
1097
+ return N.request(
1083
1098
  G(`/items/${n}`, {
1084
1099
  limit: m.length,
1085
1100
  filter: JSON.stringify({ id: { _in: m } }),
@@ -1092,40 +1107,40 @@ function Bu({
1092
1107
  }))
1093
1108
  );
1094
1109
  },
1095
- enabled: N && !!I && !F && m.length > 0,
1110
+ enabled: S && !!L && !R && m.length > 0,
1096
1111
  staleTime: 10 * 6e4,
1097
1112
  retry: !1
1098
- }), O = P.length > 0 ? [
1099
- ...z,
1100
- ...P.filter((T) => !z.some((de) => String(de.value) === String(T.value)))
1101
- ] : z;
1113
+ }), M = O.length > 0 ? [
1114
+ ...W,
1115
+ ...O.filter((T) => !W.some((de) => String(de.value) === String(T.value)))
1116
+ ] : W;
1102
1117
  return /* @__PURE__ */ a(
1103
1118
  Da,
1104
1119
  {
1105
1120
  block: !0,
1106
1121
  label: o ?? "All",
1107
- options: O,
1122
+ options: M,
1108
1123
  selected: h,
1109
1124
  onChange: d,
1110
- loading: F,
1125
+ loading: R,
1111
1126
  onSearch: K,
1112
1127
  onOpenChange: (T) => {
1113
- T && q(!0);
1128
+ T && $(!0);
1114
1129
  }
1115
1130
  }
1116
1131
  );
1117
1132
  }
1118
- function Qu({
1133
+ function Uu({
1119
1134
  collection: n,
1120
1135
  field: o,
1121
1136
  selected: h,
1122
1137
  onChange: d
1123
1138
  }) {
1124
- const w = Tt(), [S, $] = _(!1), { data: q = [], isLoading: N } = ne({
1139
+ const w = Lt(), [N, q] = _(!1), { data: $ = [], isLoading: S } = ne({
1125
1140
  queryKey: ["cbv-distinct", n, o],
1126
- queryFn: () => w.request(G(`/items/${n}/distinct`, { field: o })).then((L) => L.data ?? []),
1141
+ queryFn: () => w.request(G(`/items/${n}/distinct`, { field: o })).then((F) => F.data ?? []),
1127
1142
  staleTime: 5 * 6e4,
1128
- enabled: S,
1143
+ enabled: N,
1129
1144
  retry: !1
1130
1145
  });
1131
1146
  return /* @__PURE__ */ a(
@@ -1133,49 +1148,49 @@ function Qu({
1133
1148
  {
1134
1149
  block: !0,
1135
1150
  label: "All",
1136
- options: q.map((L) => ({ value: String(L), label: je(String(L)) })),
1151
+ options: $.map((F) => ({ value: String(F), label: je(String(F)) })),
1137
1152
  selected: h,
1138
1153
  onChange: d,
1139
- loading: N,
1140
- onOpenChange: (L) => {
1141
- L && $(!0);
1154
+ loading: S,
1155
+ onOpenChange: (F) => {
1156
+ F && q(!0);
1142
1157
  }
1143
1158
  }
1144
1159
  );
1145
1160
  }
1146
- function Uu({
1161
+ function zu({
1147
1162
  value: n,
1148
1163
  onChange: o
1149
1164
  }) {
1150
- const [h, d] = _(!1), [w, S] = _(""), [$, q] = _(""), N = pe(null);
1165
+ const [h, d] = _(!1), [w, N] = _(""), [q, $] = _(""), S = pe(null);
1151
1166
  me(() => {
1152
1167
  if (!h) return;
1153
1168
  const u = (y) => {
1154
- var z;
1155
- (z = N.current) != null && z.contains(y.target) || d(!1);
1169
+ var W;
1170
+ (W = S.current) != null && W.contains(y.target) || d(!1);
1156
1171
  };
1157
1172
  return window.addEventListener("mousedown", u), () => window.removeEventListener("mousedown", u);
1158
1173
  }, [h]), me(() => {
1159
1174
  if (h && n.startsWith("r:")) {
1160
1175
  const [u, y] = n.slice(2).split("..");
1161
- S(u ?? ""), q(y ?? "");
1176
+ N(u ?? ""), $(y ?? "");
1162
1177
  }
1163
1178
  }, [h, n]);
1164
- const L = (() => {
1179
+ const F = (() => {
1165
1180
  var y;
1166
1181
  if (!n) return "All";
1167
1182
  const u = La(n);
1168
- return u ? ed(u) : ((y = Ra.find((z) => z.value === n)) == null ? void 0 : y.label) ?? n;
1169
- })(), [K, V] = _("between");
1183
+ return u ? ed(u) : ((y = Ra.find((W) => W.value === n)) == null ? void 0 : y.label) ?? n;
1184
+ })(), [K, B] = _("between");
1170
1185
  me(() => {
1171
1186
  var u;
1172
- h && V(((u = La(n)) == null ? void 0 : u.op) ?? "between");
1187
+ h && B(((u = La(n)) == null ? void 0 : u.op) ?? "between");
1173
1188
  }, [h, n]);
1174
- const I = () => {
1175
- const u = w || $;
1176
- u && (o(nd({ op: K, from: u, to: $ || w || u })), d(!1));
1189
+ const L = () => {
1190
+ const u = w || q;
1191
+ u && (o(nd({ op: K, from: u, to: q || w || u })), d(!1));
1177
1192
  };
1178
- return /* @__PURE__ */ c("div", { ref: N, className: "relative w-full", children: [
1193
+ return /* @__PURE__ */ c("div", { ref: S, className: "relative w-full", children: [
1179
1194
  /* @__PURE__ */ c(
1180
1195
  "button",
1181
1196
  {
@@ -1185,7 +1200,7 @@ function Uu({
1185
1200
  },
1186
1201
  className: `inline-flex h-6 w-full min-w-[64px] items-center gap-1 rounded border px-1.5 text-[11px] font-normal normal-case tracking-normal ${n ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-slate-800 dark:text-slate-100" : "border-slate-200 bg-white text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400"}`,
1187
1202
  children: [
1188
- /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-left", children: L }),
1203
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-left", children: F }),
1189
1204
  n && /* @__PURE__ */ a(
1190
1205
  "span",
1191
1206
  {
@@ -1224,7 +1239,7 @@ function Uu({
1224
1239
  type: "button",
1225
1240
  "data-date-op": u.op,
1226
1241
  "aria-pressed": K === u.op,
1227
- onClick: () => V(u.op),
1242
+ onClick: () => B(u.op),
1228
1243
  className: `rounded border px-1 py-0.5 text-[10px] font-normal normal-case leading-tight tracking-normal ${K === u.op ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"}`,
1229
1244
  children: u.label
1230
1245
  },
@@ -1236,7 +1251,7 @@ function Uu({
1236
1251
  {
1237
1252
  type: "date",
1238
1253
  value: w,
1239
- onChange: (u) => S(u.target.value),
1254
+ onChange: (u) => N(u.target.value),
1240
1255
  "aria-label": "From date",
1241
1256
  className: "h-6 min-w-0 flex-1 rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
1242
1257
  }
@@ -1246,8 +1261,8 @@ function Uu({
1246
1261
  "input",
1247
1262
  {
1248
1263
  type: "date",
1249
- value: $,
1250
- onChange: (u) => q(u.target.value),
1264
+ value: q,
1265
+ onChange: (u) => $(u.target.value),
1251
1266
  "aria-label": "To date",
1252
1267
  hidden: K !== "between",
1253
1268
  className: "h-6 min-w-0 flex-1 rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
@@ -1258,8 +1273,8 @@ function Uu({
1258
1273
  "button",
1259
1274
  {
1260
1275
  type: "button",
1261
- disabled: !w && !$,
1262
- onClick: I,
1276
+ disabled: !w && !q,
1277
+ onClick: L,
1263
1278
  className: "mt-1.5 h-6 w-full rounded bg-nvr-cyan text-[11px] font-semibold text-white disabled:opacity-40",
1264
1279
  children: "Apply"
1265
1280
  }
@@ -1268,53 +1283,53 @@ function Uu({
1268
1283
  ] })
1269
1284
  ] });
1270
1285
  }
1271
- function zu({
1286
+ function Wu({
1272
1287
  def: n,
1273
1288
  selected: o,
1274
1289
  onChange: h,
1275
1290
  allowedIds: d,
1276
1291
  scopeDefault: w,
1277
- narrowBy: S = []
1292
+ narrowBy: N = []
1278
1293
  }) {
1279
- const $ = Tt(), q = Ea(), N = n.value_field ?? "id", [L, K] = _(!1), V = JSON.stringify(S.filter((F) => F.values.length > 0)), { data: I = [], isLoading: u } = ne({
1294
+ const q = Lt(), $ = Ea(), S = n.value_field ?? "id", [F, K] = _(!1), B = JSON.stringify(N.filter((R) => R.values.length > 0)), { data: L = [], isLoading: u } = ne({
1280
1295
  // The cascade rides at the END of the key so label lookups by the prefix
1281
1296
  // (the filter sentence) still find every option list.
1282
1297
  queryKey: [
1283
1298
  "cbv-quick-options",
1284
1299
  n.collection,
1285
- N,
1300
+ S,
1286
1301
  n.label_field,
1287
1302
  n.sort ?? "",
1288
- V,
1303
+ B,
1289
1304
  o.map(String).sort().join(",")
1290
1305
  ],
1291
1306
  queryFn: async () => {
1292
- const F = V !== "[]" ? Ud(
1307
+ const R = B !== "[]" ? Ud(
1293
1308
  n.collection,
1294
- await zd($, q, n.collection),
1295
- S
1296
- ) : null, m = (T, de) => $.request(
1309
+ await zd(q, $, n.collection),
1310
+ N
1311
+ ) : null, m = (T, de) => q.request(
1297
1312
  G(`/items/${n.collection}`, {
1298
1313
  limit: 1e3,
1299
1314
  // Records hidden from pickers (a retired zone) are not offered.
1300
1315
  ...de ? { picker: "1" } : {},
1301
1316
  ...n.sort ? { sort: n.sort } : {},
1302
1317
  ...T ? { filter: JSON.stringify(T) } : {},
1303
- fields: [.../* @__PURE__ */ new Set(["id", N, n.label_field])].join(",")
1318
+ fields: [.../* @__PURE__ */ new Set(["id", S, n.label_field])].join(",")
1304
1319
  })
1305
1320
  ).then(
1306
1321
  (fe) => (fe.data ?? []).map((we) => ({
1307
- value: we[N],
1308
- label: String(we[n.label_field] ?? we[N] ?? ""),
1322
+ value: we[S],
1323
+ label: String(we[n.label_field] ?? we[S] ?? ""),
1309
1324
  id: we.id
1310
1325
  })).filter((we) => we.value != null && we.label !== "")
1311
- ), E = await m(F, !0), P = new Set(E.map((T) => String(T.value))), O = o.filter((T) => !P.has(String(T)));
1312
- return O.length === 0 ? E : [...E, ...await m({ [N]: { _in: O } }, !1)];
1326
+ ), D = await m(R, !0), O = new Set(D.map((T) => String(T.value))), M = o.filter((T) => !O.has(String(T)));
1327
+ return M.length === 0 ? D : [...D, ...await m({ [S]: { _in: M } }, !1)];
1313
1328
  },
1314
1329
  staleTime: 10 * 6e4,
1315
- enabled: L || o.length > 0,
1330
+ enabled: F || o.length > 0,
1316
1331
  retry: !1
1317
- }), y = d != null && d.length ? I.filter((F) => d.some((m) => String(m) === String(F.id))) : I, z = d != null && d.length ? {
1332
+ }), y = d != null && d.length ? L.filter((R) => d.some((m) => String(m) === String(R.id))) : L, W = d != null && d.length ? {
1318
1333
  label: "restricted",
1319
1334
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
1320
1335
  title: `Options limited to your restricted ${n.label} scope${w ? "; selection seeded from your defaults" : ""}`
@@ -1331,9 +1346,9 @@ function zu({
1331
1346
  selected: o,
1332
1347
  onChange: h,
1333
1348
  loading: u,
1334
- badge: z,
1335
- onOpenChange: (F) => {
1336
- F && K(!0);
1349
+ badge: W,
1350
+ onOpenChange: (R) => {
1351
+ R && K(!0);
1337
1352
  }
1338
1353
  }
1339
1354
  );
@@ -1352,7 +1367,7 @@ const ro = [
1352
1367
  { value: "30d", label: "30 days" },
1353
1368
  { value: "90d", label: "90 days" },
1354
1369
  { value: "year", label: "This year" }
1355
- ], Wu = {
1370
+ ], Vu = {
1356
1371
  _eq: "_neq",
1357
1372
  _neq: "_eq",
1358
1373
  _in: "_nin",
@@ -1381,13 +1396,13 @@ function Hl(n) {
1381
1396
  for (const d of n) {
1382
1397
  const w = d.fieldType === "date" || d.fieldType === "datetime" || d.fieldType === "timestamp";
1383
1398
  if (d.op === "_between") {
1384
- const [q, N] = String(d.value).split("..");
1399
+ const [$, S] = String(d.value).split("..");
1385
1400
  if (d.not) {
1386
- const L = [];
1387
- q && L.push({ path: d.path, op: "_lt", value: q }), N && L.push({ path: d.path, op: "_gt", value: w ? `${N}T23:59:59` : N }), L.length && o.push({ or: L });
1401
+ const F = [];
1402
+ $ && F.push({ path: d.path, op: "_lt", value: $ }), S && F.push({ path: d.path, op: "_gt", value: w ? `${S}T23:59:59` : S }), F.length && o.push({ or: F });
1388
1403
  continue;
1389
1404
  }
1390
- q && o.push({ path: d.path, op: "_gte", value: q }), N && o.push({ path: d.path, op: "_lte", value: w ? `${N}T23:59:59` : N });
1405
+ $ && o.push({ path: d.path, op: "_gte", value: $ }), S && o.push({ path: d.path, op: "_lte", value: w ? `${S}T23:59:59` : S });
1391
1406
  continue;
1392
1407
  }
1393
1408
  if ((h = d.path[0]) != null && h.startsWith("$has_") || d.path[0] === "$missing_required" || d.path[0] === "$unseen") {
@@ -1395,17 +1410,17 @@ function Hl(n) {
1395
1410
  continue;
1396
1411
  }
1397
1412
  if (d.op === "_preset") {
1398
- const q = so(String(d.value));
1399
- q && (d.not ? o.push({
1413
+ const $ = so(String(d.value));
1414
+ $ && (d.not ? o.push({
1400
1415
  or: [
1401
- { path: d.path, op: "_lt", value: q.from },
1402
- { path: d.path, op: "_gt", value: `${q.to}T23:59:59` }
1416
+ { path: d.path, op: "_lt", value: $.from },
1417
+ { path: d.path, op: "_gt", value: `${$.to}T23:59:59` }
1403
1418
  ]
1404
- }) : (o.push({ path: d.path, op: "_gte", value: q.from }), o.push({ path: d.path, op: "_lte", value: `${q.to}T23:59:59` })));
1419
+ }) : (o.push({ path: d.path, op: "_gte", value: $.from }), o.push({ path: d.path, op: "_lte", value: `${$.to}T23:59:59` })));
1405
1420
  continue;
1406
1421
  }
1407
- let S = d.op.includes(":") ? d.op.split(":")[0] : d.op, $ = d.op.includes(":") ? d.op.split(":")[1] : d.value || null;
1408
- d.fieldType === "boolean" && ($ === "true" || $ === "false") && ($ = $ === "true"), d.not && (S = Wu[S] ?? S), o.push({ path: d.path, op: S, value: $ });
1422
+ let N = d.op.includes(":") ? d.op.split(":")[0] : d.op, q = d.op.includes(":") ? d.op.split(":")[1] : d.value || null;
1423
+ d.fieldType === "boolean" && (q === "true" || q === "false") && (q = q === "true"), d.not && (N = Vu[N] ?? N), o.push({ path: d.path, op: N, value: q });
1409
1424
  }
1410
1425
  return o;
1411
1426
  }
@@ -1433,7 +1448,7 @@ const Yl = [
1433
1448
  { label: "After", value: "_gt" },
1434
1449
  { label: "Is empty", value: "_null" },
1435
1450
  { label: "Is not empty", value: "_nnull" }
1436
- ], Vu = {
1451
+ ], Hu = {
1437
1452
  string: Yl,
1438
1453
  text: Yl,
1439
1454
  integer: Er,
@@ -1454,8 +1469,8 @@ const Yl = [
1454
1469
  { label: "Is not empty", value: "_nnull" }
1455
1470
  ]
1456
1471
  };
1457
- function Hu(n) {
1458
- for (const o of Object.values(Vu)) {
1472
+ function Yu(n) {
1473
+ for (const o of Object.values(Hu)) {
1459
1474
  const h = o.find((d) => d.value === n);
1460
1475
  if (h) return h.label;
1461
1476
  }
@@ -1472,68 +1487,68 @@ function Kr({
1472
1487
  path: h,
1473
1488
  pathLabels: d,
1474
1489
  filterText: w,
1475
- includeAliases: S = !1,
1476
- onPick: $
1490
+ includeAliases: N = !1,
1491
+ onPick: q
1477
1492
  }) {
1478
- const q = Tt(), { data: N } = ne({
1493
+ const $ = Lt(), { data: S } = ne({
1479
1494
  queryKey: ["cbv-collection-meta", n],
1480
- queryFn: () => q.request(G(`/collections/${n}`)).then((I) => I.data),
1495
+ queryFn: () => $.request(G(`/collections/${n}`)).then((L) => L.data),
1481
1496
  staleTime: 10 * 6e4,
1482
1497
  retry: !1
1483
- }), [L, K] = _(/* @__PURE__ */ new Set());
1484
- if (!N)
1498
+ }), [F, K] = _(/* @__PURE__ */ new Set());
1499
+ if (!S)
1485
1500
  return /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1486
- const V = o < 2;
1487
- return /* @__PURE__ */ a(ze, { children: N.fields.filter((I) => !I.hidden && (!w || I.field.includes(w))).map((I) => {
1488
- const u = V ? ot(N.relations, n, I.field) : void 0, y = V && S ? Tn(N.relations, n, I.field) : void 0, z = (u == null ? void 0 : u.one_collection) ?? null, F = L.has(I.field);
1501
+ const B = o < 2;
1502
+ return /* @__PURE__ */ a(ze, { children: S.fields.filter((L) => !L.hidden && (!w || L.field.includes(w))).map((L) => {
1503
+ const u = B ? ot(S.relations, n, L.field) : void 0, y = B && N ? Tn(S.relations, n, L.field) : void 0, W = (u == null ? void 0 : u.one_collection) ?? null, R = F.has(L.field);
1489
1504
  return /* @__PURE__ */ c("div", { children: [
1490
1505
  /* @__PURE__ */ c(
1491
1506
  "button",
1492
1507
  {
1493
1508
  type: "button",
1494
1509
  onClick: () => {
1495
- z || y ? K((m) => {
1496
- const E = new Set(m);
1497
- return E.has(I.field) ? E.delete(I.field) : E.add(I.field), E;
1498
- }) : $(
1499
- [...h, I.field],
1500
- [...d, je(I.field)],
1501
- I.type ?? "string"
1510
+ W || y ? K((m) => {
1511
+ const D = new Set(m);
1512
+ return D.has(L.field) ? D.delete(L.field) : D.add(L.field), D;
1513
+ }) : q(
1514
+ [...h, L.field],
1515
+ [...d, je(L.field)],
1516
+ L.type ?? "string"
1502
1517
  );
1503
1518
  },
1504
1519
  className: "flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
1505
1520
  style: { paddingLeft: `${0.5 + o}rem` },
1506
1521
  children: [
1507
- z || y ? F ? "▾ " : "▸ " : "",
1508
- je(I.field),
1522
+ W || y ? R ? "▾ " : "▸ " : "",
1523
+ je(L.field),
1509
1524
  y && /* @__PURE__ */ a("span", { className: "text-[10px] text-slate-400", children: y.kind })
1510
1525
  ]
1511
1526
  }
1512
1527
  ),
1513
- z && F && /* @__PURE__ */ a(
1528
+ W && R && /* @__PURE__ */ a(
1514
1529
  Kr,
1515
1530
  {
1516
- relatedCollection: z,
1531
+ relatedCollection: W,
1517
1532
  depth: o + 1,
1518
- path: [...h, I.field],
1519
- pathLabels: [...d, je(I.field)],
1533
+ path: [...h, L.field],
1534
+ pathLabels: [...d, je(L.field)],
1520
1535
  filterText: "",
1521
- includeAliases: S,
1522
- onPick: $
1536
+ includeAliases: N,
1537
+ onPick: q
1523
1538
  }
1524
1539
  ),
1525
- y && F && /* @__PURE__ */ a(
1540
+ y && R && /* @__PURE__ */ a(
1526
1541
  lo,
1527
1542
  {
1528
1543
  aliasInfo: y,
1529
1544
  depth: o + 1,
1530
- path: [...h, I.field],
1531
- pathLabels: [...d, je(I.field)],
1532
- includeAliases: S,
1533
- onPick: $
1545
+ path: [...h, L.field],
1546
+ pathLabels: [...d, je(L.field)],
1547
+ includeAliases: N,
1548
+ onPick: q
1534
1549
  }
1535
1550
  )
1536
- ] }, I.field);
1551
+ ] }, L.field);
1537
1552
  }) });
1538
1553
  }
1539
1554
  function lo({
@@ -1542,33 +1557,33 @@ function lo({
1542
1557
  path: h,
1543
1558
  pathLabels: d,
1544
1559
  includeAliases: w,
1545
- onPick: S
1560
+ onPick: N
1546
1561
  }) {
1547
- const $ = Tt(), q = n.relation.many_collection ?? "", { data: N } = ne({
1548
- queryKey: ["cbv-collection-meta", q],
1549
- queryFn: () => $.request(G(`/collections/${q}`)).then((K) => K.data),
1562
+ const q = Lt(), $ = n.relation.many_collection ?? "", { data: S } = ne({
1563
+ queryKey: ["cbv-collection-meta", $],
1564
+ queryFn: () => q.request(G(`/collections/${$}`)).then((K) => K.data),
1550
1565
  staleTime: 10 * 6e4,
1551
- enabled: n.kind === "m2m" && !!q,
1566
+ enabled: n.kind === "m2m" && !!$,
1552
1567
  retry: !1
1553
1568
  });
1554
- let L = null;
1555
- if (n.kind === "o2m") L = q || null;
1569
+ let F = null;
1570
+ if (n.kind === "o2m") F = $ || null;
1556
1571
  else {
1557
- const K = N == null ? void 0 : N.relations.find(
1558
- (V) => V.many_collection === q && V.many_field === n.relation.junction_field
1572
+ const K = S == null ? void 0 : S.relations.find(
1573
+ (B) => B.many_collection === $ && B.many_field === n.relation.junction_field
1559
1574
  );
1560
- L = (K == null ? void 0 : K.one_collection) ?? null;
1575
+ F = (K == null ? void 0 : K.one_collection) ?? null;
1561
1576
  }
1562
- return L ? /* @__PURE__ */ a(
1577
+ return F ? /* @__PURE__ */ a(
1563
1578
  Kr,
1564
1579
  {
1565
- relatedCollection: L,
1580
+ relatedCollection: F,
1566
1581
  depth: o,
1567
1582
  path: h,
1568
1583
  pathLabels: d,
1569
1584
  filterText: "",
1570
1585
  includeAliases: w,
1571
- onPick: S
1586
+ onPick: N
1572
1587
  }
1573
1588
  ) : /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1574
1589
  }
@@ -1577,119 +1592,119 @@ function Jl(n, o, h) {
1577
1592
  const d = n.type ?? "string";
1578
1593
  return d === "integer" || d === "decimal" || d === "float" ? "number" : d === "datetime" || d === "timestamp" ? "date" : d;
1579
1594
  }
1580
- function Yu({
1595
+ function Ju({
1581
1596
  collection: n,
1582
1597
  path: o,
1583
1598
  pathLabels: h,
1584
1599
  search: d,
1585
1600
  depth: w,
1586
- onDrill: S,
1587
- onPick: $
1601
+ onDrill: N,
1602
+ onPick: q
1588
1603
  }) {
1589
- const q = Tt(), { data: N } = ne({
1604
+ const $ = Lt(), { data: S } = ne({
1590
1605
  queryKey: ["cbv-collection-meta", n],
1591
- queryFn: () => q.request(G(`/collections/${n}`)).then((m) => m.data),
1606
+ queryFn: () => $.request(G(`/collections/${n}`)).then((m) => m.data),
1592
1607
  staleTime: 10 * 6e4,
1593
1608
  retry: !1
1594
- }), L = be(() => {
1595
- if (!N) return [];
1609
+ }), F = be(() => {
1610
+ if (!S) return [];
1596
1611
  const m = /* @__PURE__ */ new Set();
1597
- for (const E of N.fields) {
1598
- if (E.hidden) continue;
1599
- const P = ot(N.relations, n, E.field);
1600
- P != null && P.one_collection && !Rt(P.one_collection) && m.add(P.one_collection);
1601
- const O = Tn(N.relations, n, E.field);
1602
- if (O) {
1603
- const T = _a(N.relations, O) ?? O.relation.many_collection;
1604
- T && !Rt(T) && m.add(T);
1612
+ for (const D of S.fields) {
1613
+ if (D.hidden) continue;
1614
+ const O = ot(S.relations, n, D.field);
1615
+ O != null && O.one_collection && !Tt(O.one_collection) && m.add(O.one_collection);
1616
+ const M = Tn(S.relations, n, D.field);
1617
+ if (M) {
1618
+ const T = _a(S.relations, M) ?? M.relation.many_collection;
1619
+ T && !Tt(T) && m.add(T);
1605
1620
  }
1606
1621
  }
1607
1622
  return [...m].slice(0, 12);
1608
- }, [N, n]), K = Sa({
1609
- queries: L.map((m) => ({
1623
+ }, [S, n]), K = Sa({
1624
+ queries: F.map((m) => ({
1610
1625
  queryKey: ["cbv-collection-meta", m],
1611
- queryFn: () => q.request(G(`/collections/${m}`)).then((E) => E.data),
1626
+ queryFn: () => $.request(G(`/collections/${m}`)).then((D) => D.data),
1612
1627
  staleTime: 10 * 6e4,
1613
1628
  retry: !1,
1614
1629
  enabled: !!d
1615
1630
  }))
1616
- }), V = be(() => {
1631
+ }), B = be(() => {
1617
1632
  const m = /* @__PURE__ */ new Map();
1618
- return L.forEach((E, P) => {
1619
- var O;
1620
- return m.set(E, (O = K[P]) == null ? void 0 : O.data);
1633
+ return F.forEach((D, O) => {
1634
+ var M;
1635
+ return m.set(D, (M = K[O]) == null ? void 0 : M.data);
1621
1636
  }), m;
1622
- }, [L, K]);
1623
- if (!N)
1637
+ }, [F, K]);
1638
+ if (!S)
1624
1639
  return /* @__PURE__ */ a("div", { className: "px-3 py-2", children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1625
- const I = d.trim().toLowerCase(), u = (m) => !I || m.toLowerCase().includes(I) || m.toLowerCase().replace(/ /g, "_").includes(I), y = [];
1626
- for (const m of N.fields) {
1640
+ const L = d.trim().toLowerCase(), u = (m) => !L || m.toLowerCase().includes(L) || m.toLowerCase().replace(/ /g, "_").includes(L), y = [];
1641
+ for (const m of S.fields) {
1627
1642
  if (m.hidden) continue;
1628
- const E = je(m.field), P = ot(N.relations, n, m.field), O = Tn(N.relations, n, m.field), T = [...o, m.field], de = [...h, E];
1629
- if (P != null && P.one_collection && !Rt(P.one_collection))
1630
- u(E) && y.push({
1643
+ const D = je(m.field), O = ot(S.relations, n, m.field), M = Tn(S.relations, n, m.field), T = [...o, m.field], de = [...h, D];
1644
+ if (O != null && O.one_collection && !Tt(O.one_collection))
1645
+ u(D) && y.push({
1631
1646
  key: m.field,
1632
- label: E,
1647
+ label: D,
1633
1648
  hint: "relation",
1634
- drillTo: w < 2 ? { collection: P.one_collection, path: T, pathLabels: de } : void 0,
1649
+ drillTo: w < 2 ? { collection: O.one_collection, path: T, pathLabels: de } : void 0,
1635
1650
  leaf: {
1636
1651
  path: T,
1637
1652
  pathLabels: de,
1638
1653
  fieldType: "relation",
1639
- relTarget: P.one_collection
1654
+ relTarget: O.one_collection
1640
1655
  }
1641
1656
  });
1642
- else if (O) {
1643
- const fe = _a(N.relations, O) ?? O.relation.many_collection;
1644
- u(E) && fe && y.push({
1657
+ else if (M) {
1658
+ const fe = _a(S.relations, M) ?? M.relation.many_collection;
1659
+ u(D) && fe && y.push({
1645
1660
  key: m.field,
1646
- label: E,
1647
- hint: O.kind === "m2m" ? "list" : "items",
1661
+ label: D,
1662
+ hint: M.kind === "m2m" ? "list" : "items",
1648
1663
  drillTo: w < 2 ? { collection: fe, path: T, pathLabels: de } : void 0,
1649
- leaf: O.kind === "m2m" && _a(N.relations, O) ? {
1664
+ leaf: M.kind === "m2m" && _a(S.relations, M) ? {
1650
1665
  path: T,
1651
1666
  pathLabels: de,
1652
1667
  fieldType: "relation",
1653
- relTarget: _a(N.relations, O)
1668
+ relTarget: _a(S.relations, M)
1654
1669
  } : void 0
1655
1670
  });
1656
- } else u(E) && y.push({
1671
+ } else u(D) && y.push({
1657
1672
  key: m.field,
1658
- label: E,
1673
+ label: D,
1659
1674
  hint: Jl(m, void 0),
1660
1675
  leaf: { path: T, pathLabels: de, fieldType: m.type ?? "string" }
1661
1676
  });
1662
1677
  }
1663
- const z = [];
1664
- if (I)
1665
- for (const m of N.fields) {
1678
+ const W = [];
1679
+ if (L)
1680
+ for (const m of S.fields) {
1666
1681
  if (m.hidden) continue;
1667
- const E = ot(N.relations, n, m.field);
1668
- if (!(E != null && E.one_collection) || Rt(E.one_collection)) continue;
1669
- const P = V.get(E.one_collection);
1670
- if (!P) continue;
1671
- const O = je(m.field);
1672
- for (const T of P.fields) {
1673
- if (T.hidden || Tn(P.relations, E.one_collection, T.field)) continue;
1682
+ const D = ot(S.relations, n, m.field);
1683
+ if (!(D != null && D.one_collection) || Tt(D.one_collection)) continue;
1684
+ const O = B.get(D.one_collection);
1685
+ if (!O) continue;
1686
+ const M = je(m.field);
1687
+ for (const T of O.fields) {
1688
+ if (T.hidden || Tn(O.relations, D.one_collection, T.field)) continue;
1674
1689
  const de = je(T.field);
1675
1690
  if (!u(de)) continue;
1676
- const fe = ot(P.relations, E.one_collection, T.field);
1677
- z.push({
1691
+ const fe = ot(O.relations, D.one_collection, T.field);
1692
+ W.push({
1678
1693
  key: `${m.field}.${T.field}`,
1679
1694
  label: de,
1680
- breadcrumb: O,
1695
+ breadcrumb: M,
1681
1696
  hint: Jl(T, fe ?? void 0),
1682
1697
  leaf: {
1683
1698
  path: [...o, m.field, T.field],
1684
- pathLabels: [...h, O, de],
1699
+ pathLabels: [...h, M, de],
1685
1700
  fieldType: fe != null && fe.one_collection ? "relation" : T.type ?? "string",
1686
1701
  relTarget: (fe == null ? void 0 : fe.one_collection) ?? void 0
1687
1702
  }
1688
1703
  });
1689
1704
  }
1690
1705
  }
1691
- const F = [...y, ...z.slice(0, 12)];
1692
- return F.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matching fields" }) : /* @__PURE__ */ a(ze, { children: F.map((m) => /* @__PURE__ */ c(
1706
+ const R = [...y, ...W.slice(0, 12)];
1707
+ return R.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matching fields" }) : /* @__PURE__ */ a(ze, { children: R.map((m) => /* @__PURE__ */ c(
1693
1708
  "div",
1694
1709
  {
1695
1710
  className: "group/frow flex w-full items-center gap-1 px-1.5 hover:bg-slate-50 dark:hover:bg-slate-800",
@@ -1699,7 +1714,7 @@ function Yu({
1699
1714
  {
1700
1715
  type: "button",
1701
1716
  onClick: () => {
1702
- m.leaf ? $(m.leaf) : m.drillTo && S(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels);
1717
+ m.leaf ? q(m.leaf) : m.drillTo && N(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels);
1703
1718
  },
1704
1719
  className: "flex min-w-0 flex-1 items-center gap-1.5 rounded px-1.5 py-1.5 text-left text-[12.5px] text-slate-700 dark:text-slate-200",
1705
1720
  children: [
@@ -1716,7 +1731,7 @@ function Yu({
1716
1731
  "button",
1717
1732
  {
1718
1733
  type: "button",
1719
- onClick: () => S(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels),
1734
+ onClick: () => N(m.drillTo.collection, m.drillTo.path, m.drillTo.pathLabels),
1720
1735
  "aria-label": `Drill into ${m.label}`,
1721
1736
  className: "shrink-0 rounded px-1.5 py-1 text-[11px] text-slate-300 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700",
1722
1737
  children: "▸"
@@ -1727,51 +1742,51 @@ function Yu({
1727
1742
  m.key
1728
1743
  )) });
1729
1744
  }
1730
- function Ju({
1745
+ function Gu({
1731
1746
  target: n,
1732
1747
  selected: o,
1733
1748
  labels: h,
1734
1749
  onToggle: d
1735
1750
  }) {
1736
- const w = Tt(), [S, $] = _(""), { data: q } = ne({
1751
+ const w = Lt(), [N, q] = _(""), { data: $ } = ne({
1737
1752
  queryKey: ["cbv-collection-meta", n],
1738
1753
  queryFn: () => w.request(G(`/collections/${n}`)).then((y) => y.data),
1739
1754
  staleTime: 10 * 6e4,
1740
1755
  retry: !1
1741
- }), N = Xn(q), L = (q == null ? void 0 : q.display_template) ?? null, { data: K = [], isLoading: V } = ne({
1742
- queryKey: ["cbv-filter-options", n, N, L ?? ""],
1756
+ }), S = Xn($), F = ($ == null ? void 0 : $.display_template) ?? null, { data: K = [], isLoading: B } = ne({
1757
+ queryKey: ["cbv-filter-options", n, S, F ?? ""],
1743
1758
  queryFn: () => {
1744
- const y = Mr(L, N);
1759
+ const y = Mr(F, S);
1745
1760
  return w.request(
1746
1761
  G(`/items/${n}`, {
1747
1762
  limit: 500,
1748
- sort: N,
1763
+ sort: S,
1749
1764
  picker: "1",
1750
1765
  ...y ? { fields: y } : {}
1751
1766
  })
1752
1767
  ).then(
1753
- (z) => (z.data ?? []).map((F) => ({
1754
- value: F.id,
1755
- label: (L ? Fa(L, F) : "") || String(F[N] ?? F.id ?? "")
1756
- })).filter((F) => F.value != null && F.label !== "")
1768
+ (W) => (W.data ?? []).map((R) => ({
1769
+ value: R.id,
1770
+ label: (F ? Fa(F, R) : "") || String(R[S] ?? R.id ?? "")
1771
+ })).filter((R) => R.value != null && R.label !== "")
1757
1772
  );
1758
1773
  },
1759
1774
  staleTime: 10 * 6e4,
1760
- enabled: !!q,
1775
+ enabled: !!$,
1761
1776
  retry: !1
1762
- }), I = new Set(o.map(String)), u = S ? K.filter((y) => y.label.toLowerCase().includes(S.toLowerCase())) : K;
1777
+ }), L = new Set(o.map(String)), u = N ? K.filter((y) => y.label.toLowerCase().includes(N.toLowerCase())) : K;
1763
1778
  return /* @__PURE__ */ c("div", { className: "flex max-h-64 flex-col", children: [
1764
1779
  /* @__PURE__ */ a(
1765
1780
  "input",
1766
1781
  {
1767
1782
  autoFocus: !0,
1768
- value: S,
1769
- onChange: (y) => $(y.target.value),
1783
+ value: N,
1784
+ onChange: (y) => q(y.target.value),
1770
1785
  placeholder: `Search ${je(n)}…`,
1771
1786
  className: "mx-2 mb-1 h-7 shrink-0 rounded border border-slate-200 bg-slate-50 px-2 text-[12px] outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
1772
1787
  }
1773
1788
  ),
1774
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto px-1 pb-1", children: V ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "Loading…" }) : u.length === 0 ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "No matches" }) : u.slice(0, 300).map((y) => /* @__PURE__ */ c(
1789
+ /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto px-1 pb-1", children: B ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "Loading…" }) : u.length === 0 ? /* @__PURE__ */ a("p", { className: "px-2 py-1 text-[11px] text-slate-400", children: "No matches" }) : u.slice(0, 300).map((y) => /* @__PURE__ */ c(
1775
1790
  "label",
1776
1791
  {
1777
1792
  className: "flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 text-[12px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
@@ -1780,7 +1795,7 @@ function Ju({
1780
1795
  "input",
1781
1796
  {
1782
1797
  type: "checkbox",
1783
- checked: I.has(String(y.value)),
1798
+ checked: L.has(String(y.value)),
1784
1799
  onChange: () => d(y.value, y.label)
1785
1800
  }
1786
1801
  ),
@@ -1798,7 +1813,7 @@ function Ju({
1798
1813
  ] })
1799
1814
  ] });
1800
1815
  }
1801
- function Gu(n) {
1816
+ function Xu(n) {
1802
1817
  var h, d;
1803
1818
  const o = n.pathLabels.join(" › ");
1804
1819
  if (Array.isArray(n.value)) {
@@ -1810,66 +1825,66 @@ function Gu(n) {
1810
1825
  };
1811
1826
  }
1812
1827
  if (n.op === "_between") {
1813
- const [w, S] = String(n.value).split("..");
1814
- return { field: o, op: "between", value: `${w} – ${S}` };
1828
+ const [w, N] = String(n.value).split("..");
1829
+ return { field: o, op: "between", value: `${w} – ${N}` };
1815
1830
  }
1816
1831
  if (n.op === "_preset") {
1817
- const w = ((h = Ra.find((S) => S.value === n.value)) == null ? void 0 : h.label) ?? String(n.value);
1832
+ const w = ((h = Ra.find((N) => N.value === n.value)) == null ? void 0 : h.label) ?? String(n.value);
1818
1833
  return { field: o, op: "in the", value: `${w} (rolling)` };
1819
1834
  }
1820
- return (d = n.path[0]) != null && d.startsWith("$has_") || n.path[0] === "$missing_required" ? { field: o, op: "", value: "" } : { field: o, op: Hu(n.op).toLowerCase(), value: String(n.value ?? "") };
1835
+ return (d = n.path[0]) != null && d.startsWith("$has_") || n.path[0] === "$missing_required" ? { field: o, op: "", value: "" } : { field: o, op: Yu(n.op).toLowerCase(), value: String(n.value ?? "") };
1821
1836
  }
1822
- function Xu({
1837
+ function Zu({
1823
1838
  collection: n,
1824
1839
  meta: o,
1825
1840
  search: h,
1826
1841
  onSearch: d,
1827
1842
  filters: w,
1828
- onFiltersChange: S
1843
+ onFiltersChange: N
1829
1844
  }) {
1830
- const [$, q] = _(!1), [N, L] = _(""), [K, V] = _({
1845
+ const [q, $] = _(!1), [S, F] = _(""), [K, B] = _({
1831
1846
  collection: n,
1832
1847
  path: [],
1833
1848
  pathLabels: []
1834
- }), [I, u] = _(null), [y, z] = _("_contains"), [F, m] = _(""), [E, P] = _(""), [O, T] = _([]), [de, fe] = _({}), [we, Ae] = _(null), Y = pe(null);
1849
+ }), [L, u] = _(null), [y, W] = _("_contains"), [R, m] = _(""), [D, O] = _(""), [M, T] = _([]), [de, fe] = _({}), [we, Ae] = _(null), Y = pe(null);
1835
1850
  me(() => {
1836
- if (!$) return;
1851
+ if (!q) return;
1837
1852
  const k = (ee) => {
1838
1853
  var xe;
1839
- (xe = Y.current) != null && xe.contains(ee.target) || q(!1);
1854
+ (xe = Y.current) != null && xe.contains(ee.target) || $(!1);
1840
1855
  }, le = (ee) => {
1841
- ee.key === "Escape" && q(!1);
1856
+ ee.key === "Escape" && $(!1);
1842
1857
  };
1843
1858
  return window.addEventListener("mousedown", k), window.addEventListener("keydown", le), () => {
1844
1859
  window.removeEventListener("mousedown", k), window.removeEventListener("keydown", le);
1845
1860
  };
1846
- }, [$]);
1861
+ }, [q]);
1847
1862
  const Be = () => {
1848
- L(""), V({ collection: n, path: [], pathLabels: [] }), u(null), z("_contains"), m(""), P(""), T([]), fe({}), Ae(null);
1863
+ F(""), B({ collection: n, path: [], pathLabels: [] }), u(null), W("_contains"), m(""), O(""), T([]), fe({}), Ae(null);
1849
1864
  }, Se = () => {
1850
- Be(), q(!0);
1865
+ Be(), $(!0);
1851
1866
  }, X = (k) => {
1852
- S(we ? w.map((le) => le.id === we ? { ...k, id: we } : le) : [...w, { ...k, id: crypto.randomUUID() }]), q(!1), Be();
1867
+ N(we ? w.map((le) => le.id === we ? { ...k, id: we } : le) : [...w, { ...k, id: crypto.randomUUID() }]), $(!1), Be();
1853
1868
  }, $e = (k, le) => {
1854
- I && X({
1855
- path: I.path,
1856
- pathLabels: I.pathLabels,
1857
- fieldType: I.fieldType,
1869
+ L && X({
1870
+ path: L.path,
1871
+ pathLabels: L.pathLabels,
1872
+ fieldType: L.fieldType,
1858
1873
  op: k,
1859
1874
  value: le
1860
1875
  });
1861
1876
  }, it = () => {
1862
- !I || O.length === 0 || X({
1863
- path: I.path,
1864
- pathLabels: I.pathLabels,
1877
+ !L || M.length === 0 || X({
1878
+ path: L.path,
1879
+ pathLabels: L.pathLabels,
1865
1880
  fieldType: "relation",
1866
1881
  op: "_in",
1867
- value: O,
1868
- valueLabels: O.map((k) => de[String(k)] ?? String(k)),
1869
- relTarget: I.relTarget
1882
+ value: M,
1883
+ valueLabels: M.map((k) => de[String(k)] ?? String(k)),
1884
+ relTarget: L.relTarget
1870
1885
  });
1871
1886
  }, rt = (k) => {
1872
- if (q(!0), L(""), V({ collection: n, path: [], pathLabels: [] }), Ae(k.id), Array.isArray(k.value)) {
1887
+ if ($(!0), F(""), B({ collection: n, path: [], pathLabels: [] }), Ae(k.id), Array.isArray(k.value)) {
1873
1888
  u({
1874
1889
  path: k.path,
1875
1890
  pathLabels: k.pathLabels,
@@ -1881,15 +1896,15 @@ function Xu({
1881
1896
  var st;
1882
1897
  le[String(ee)] = ((st = k.valueLabels) == null ? void 0 : st[xe]) ?? String(ee);
1883
1898
  }), fe(le);
1884
- } else if (u({ path: k.path, pathLabels: k.pathLabels, fieldType: k.fieldType }), z(k.op), k.op === "_between") {
1899
+ } else if (u({ path: k.path, pathLabels: k.pathLabels, fieldType: k.fieldType }), W(k.op), k.op === "_between") {
1885
1900
  const [le, ee] = String(k.value).split("..");
1886
- m(le ?? ""), P(ee ?? "");
1901
+ m(le ?? ""), O(ee ?? "");
1887
1902
  } else
1888
1903
  m(String(k.value ?? ""));
1889
1904
  }, Ie = (() => {
1890
- if (!I) return null;
1891
- if (I.relTarget !== void 0) return "relation";
1892
- const k = I.fieldType;
1905
+ if (!L) return null;
1906
+ if (L.relTarget !== void 0) return "relation";
1907
+ const k = L.fieldType;
1893
1908
  return k === "integer" || k === "decimal" || k === "float" ? "number" : k === "date" || k === "datetime" || k === "timestamp" ? "date" : k === "boolean" ? "boolean" : "string";
1894
1909
  })(), Oe = ro, We = [
1895
1910
  { value: "_contains", label: "Contains" },
@@ -1931,17 +1946,17 @@ function Xu({
1931
1946
  "button",
1932
1947
  {
1933
1948
  type: "button",
1934
- onClick: () => $ ? q(!1) : Se(),
1949
+ onClick: () => q ? $(!1) : Se(),
1935
1950
  className: "inline-flex h-8 items-center gap-1 whitespace-nowrap rounded-md border border-dashed border-slate-300 px-2.5 text-[12.5px] text-slate-500 hover:border-slate-400 hover:text-slate-700 dark:border-slate-600 dark:text-slate-400",
1936
1951
  children: "+ Add Filter"
1937
1952
  }
1938
1953
  ),
1939
- $ && /* @__PURE__ */ a("div", { className: "nvr-pop-in absolute left-0 top-full z-50 mt-1 w-80 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-slate-700 dark:bg-slate-900", children: I == null ? /* @__PURE__ */ c(ze, { children: [
1954
+ q && /* @__PURE__ */ a("div", { className: "nvr-pop-in absolute left-0 top-full z-50 mt-1 w-80 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-slate-700 dark:bg-slate-900", children: L == null ? /* @__PURE__ */ c(ze, { children: [
1940
1955
  K.path.length > 0 && /* @__PURE__ */ c(
1941
1956
  "button",
1942
1957
  {
1943
1958
  type: "button",
1944
- onClick: () => V({ collection: n, path: [], pathLabels: [] }),
1959
+ onClick: () => B({ collection: n, path: [], pathLabels: [] }),
1945
1960
  className: "flex w-full items-center gap-1 border-b border-slate-100 px-3 py-2 text-left text-[12px] font-medium text-slate-500 hover:bg-slate-50 dark:border-slate-800 dark:hover:bg-slate-800",
1946
1961
  children: [
1947
1962
  "‹ ",
@@ -1953,14 +1968,14 @@ function Xu({
1953
1968
  "input",
1954
1969
  {
1955
1970
  autoFocus: !0,
1956
- value: N,
1957
- onChange: (k) => L(k.target.value),
1971
+ value: S,
1972
+ onChange: (k) => F(k.target.value),
1958
1973
  placeholder: "Find field…",
1959
1974
  className: "h-8 w-full rounded-lg border-2 border-nvr-cyan/50 bg-white px-2.5 text-[12.5px] outline-none placeholder:text-slate-400 focus:ring-2 focus:ring-nvr-cyan/20 dark:border-nvr-cyan/40 dark:bg-slate-800 dark:text-slate-100"
1960
1975
  }
1961
1976
  ) }),
1962
1977
  /* @__PURE__ */ c("div", { className: "max-h-80 overflow-y-auto py-1", children: [
1963
- K.path.length === 0 && !N && /* @__PURE__ */ a("div", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-slate-800", children: [
1978
+ K.path.length === 0 && !S && /* @__PURE__ */ a("div", { className: "mb-1 border-b border-slate-100 pb-1 dark:border-slate-800", children: [
1964
1979
  ["$has_files", "Has attachments"],
1965
1980
  ["$has_comments", "Has comments"],
1966
1981
  ["$has_tasks", "Has open tasks"],
@@ -1972,7 +1987,7 @@ function Xu({
1972
1987
  {
1973
1988
  type: "button",
1974
1989
  onClick: () => {
1975
- S([
1990
+ N([
1976
1991
  ...w.filter((ee) => ee.path[0] !== k),
1977
1992
  {
1978
1993
  id: `${k}-${Date.now()}`,
@@ -1982,7 +1997,7 @@ function Xu({
1982
1997
  op: "_eq",
1983
1998
  value: "true"
1984
1999
  }
1985
- ]), q(!1);
2000
+ ]), $(!1);
1986
2001
  },
1987
2002
  className: "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12.5px] text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800",
1988
2003
  children: [
@@ -1993,18 +2008,18 @@ function Xu({
1993
2008
  k
1994
2009
  )) }),
1995
2010
  /* @__PURE__ */ a(
1996
- Yu,
2011
+ Ju,
1997
2012
  {
1998
2013
  collection: K.collection,
1999
2014
  path: K.path,
2000
2015
  pathLabels: K.pathLabels,
2001
- search: N,
2016
+ search: S,
2002
2017
  depth: K.path.length,
2003
2018
  onDrill: (k, le, ee) => {
2004
- V({ collection: k, path: le, pathLabels: ee }), L("");
2019
+ B({ collection: k, path: le, pathLabels: ee }), F("");
2005
2020
  },
2006
2021
  onPick: (k) => {
2007
- u(k), z(
2022
+ u(k), W(
2008
2023
  k.fieldType === "integer" || k.fieldType === "decimal" || k.fieldType === "float" ? "_eq" : "_contains"
2009
2024
  );
2010
2025
  }
@@ -2017,21 +2032,21 @@ function Xu({
2017
2032
  {
2018
2033
  type: "button",
2019
2034
  onClick: () => {
2020
- u(null), T([]), m(""), P("");
2035
+ u(null), T([]), m(""), O("");
2021
2036
  },
2022
2037
  className: "flex w-full items-center gap-1 border-b border-slate-100 px-3 py-2 text-left text-[12px] font-medium text-slate-500 hover:bg-slate-50 dark:border-slate-800 dark:hover:bg-slate-800",
2023
2038
  children: [
2024
2039
  "‹ ",
2025
- I.pathLabels.join(" › ")
2040
+ L.pathLabels.join(" › ")
2026
2041
  ]
2027
2042
  }
2028
2043
  ),
2029
- Ie === "relation" && I.relTarget ? /* @__PURE__ */ c("div", { className: "pt-2", children: [
2044
+ Ie === "relation" && L.relTarget ? /* @__PURE__ */ c("div", { className: "pt-2", children: [
2030
2045
  /* @__PURE__ */ a(
2031
- Ju,
2046
+ Gu,
2032
2047
  {
2033
- target: I.relTarget,
2034
- selected: O,
2048
+ target: L.relTarget,
2049
+ selected: M,
2035
2050
  labels: de,
2036
2051
  onToggle: (k, le) => {
2037
2052
  T(
@@ -2044,12 +2059,12 @@ function Xu({
2044
2059
  "button",
2045
2060
  {
2046
2061
  type: "button",
2047
- disabled: O.length === 0,
2062
+ disabled: M.length === 0,
2048
2063
  onClick: it,
2049
2064
  className: "h-8 w-full rounded-md bg-nvr-cyan text-[13px] font-medium text-white disabled:opacity-40",
2050
2065
  children: [
2051
2066
  "Apply",
2052
- O.length > 0 ? ` (${O.length})` : ""
2067
+ M.length > 0 ? ` (${M.length})` : ""
2053
2068
  ]
2054
2069
  }
2055
2070
  ) })
@@ -2087,7 +2102,7 @@ function Xu({
2087
2102
  "input",
2088
2103
  {
2089
2104
  type: "date",
2090
- value: F,
2105
+ value: R,
2091
2106
  onChange: (k) => m(k.target.value),
2092
2107
  "aria-label": "From date",
2093
2108
  className: "h-8 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
@@ -2098,8 +2113,8 @@ function Xu({
2098
2113
  "input",
2099
2114
  {
2100
2115
  type: "date",
2101
- value: E,
2102
- onChange: (k) => P(k.target.value),
2116
+ value: D,
2117
+ onChange: (k) => O(k.target.value),
2103
2118
  "aria-label": "To date",
2104
2119
  className: "h-8 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
2105
2120
  }
@@ -2109,9 +2124,9 @@ function Xu({
2109
2124
  "button",
2110
2125
  {
2111
2126
  type: "button",
2112
- disabled: !F && !E,
2127
+ disabled: !R && !D,
2113
2128
  onClick: () => {
2114
- F && E ? $e("_between", `${F}..${E}`) : F ? $e("_gte", F) : E && $e("_lte", E);
2129
+ R && D ? $e("_between", `${R}..${D}`) : R ? $e("_gte", R) : D && $e("_lte", D);
2115
2130
  },
2116
2131
  className: "h-8 w-full rounded-md bg-nvr-cyan text-[13px] font-medium text-white disabled:opacity-40",
2117
2132
  children: "Apply"
@@ -2122,7 +2137,7 @@ function Xu({
2122
2137
  {
2123
2138
  className: "space-y-2 p-3",
2124
2139
  onSubmit: (k) => {
2125
- k.preventDefault(), Ie === "number" && y === "_between" ? F !== "" && E !== "" && $e("_between", `${F}..${E}`) : F.trim() && $e(y, F.trim());
2140
+ k.preventDefault(), Ie === "number" && y === "_between" ? R !== "" && D !== "" && $e("_between", `${R}..${D}`) : R.trim() && $e(y, R.trim());
2126
2141
  },
2127
2142
  children: [
2128
2143
  /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1", children: [
@@ -2130,7 +2145,7 @@ function Xu({
2130
2145
  "button",
2131
2146
  {
2132
2147
  type: "button",
2133
- onClick: () => z(k.value),
2148
+ onClick: () => W(k.value),
2134
2149
  className: `rounded-md border px-2 py-1 text-[11.5px] ${y === k.value ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
2135
2150
  children: k.label
2136
2151
  },
@@ -2161,7 +2176,7 @@ function Xu({
2161
2176
  {
2162
2177
  autoFocus: !0,
2163
2178
  type: Ie === "number" ? "number" : "text",
2164
- value: F,
2179
+ value: R,
2165
2180
  onChange: (k) => m(k.target.value),
2166
2181
  placeholder: "Value…",
2167
2182
  className: "h-8 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2.5 text-[13px] outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
@@ -2173,8 +2188,8 @@ function Xu({
2173
2188
  "input",
2174
2189
  {
2175
2190
  type: "number",
2176
- value: E,
2177
- onChange: (k) => P(k.target.value),
2191
+ value: D,
2192
+ onChange: (k) => O(k.target.value),
2178
2193
  placeholder: "To…",
2179
2194
  className: "h-8 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2.5 text-[13px] outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
2180
2195
  }
@@ -2185,7 +2200,7 @@ function Xu({
2185
2200
  "button",
2186
2201
  {
2187
2202
  type: "submit",
2188
- disabled: y === "_between" ? F === "" || E === "" : !F.trim(),
2203
+ disabled: y === "_between" ? R === "" || D === "" : !R.trim(),
2189
2204
  className: "h-8 w-full rounded-md bg-nvr-cyan text-[13px] font-medium text-white disabled:opacity-40",
2190
2205
  children: we ? "Update" : "Apply"
2191
2206
  }
@@ -2197,7 +2212,7 @@ function Xu({
2197
2212
  ] })
2198
2213
  ] }),
2199
2214
  w.map((k) => {
2200
- const le = Gu(k);
2215
+ const le = Xu(k);
2201
2216
  return /* @__PURE__ */ c(
2202
2217
  "span",
2203
2218
  {
@@ -2207,7 +2222,7 @@ function Xu({
2207
2222
  "button",
2208
2223
  {
2209
2224
  type: "button",
2210
- onClick: () => S(w.map((ee) => ee.id === k.id ? { ...ee, not: !ee.not } : ee)),
2225
+ onClick: () => N(w.map((ee) => ee.id === k.id ? { ...ee, not: !ee.not } : ee)),
2211
2226
  "data-tip": k.not ? "Negated — click to restore" : "Click to negate (NOT)",
2212
2227
  className: k.not ? "rounded bg-amber-100 px-1 text-[10.5px] font-bold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400" : "rounded px-1 text-[10.5px] font-bold text-slate-300 hover:text-slate-500",
2213
2228
  children: "NOT"
@@ -2230,7 +2245,7 @@ function Xu({
2230
2245
  "button",
2231
2246
  {
2232
2247
  type: "button",
2233
- onClick: () => S(w.filter((ee) => ee.id !== k.id)),
2248
+ onClick: () => N(w.filter((ee) => ee.id !== k.id)),
2234
2249
  "aria-label": "Remove filter",
2235
2250
  className: "text-slate-400 hover:text-red-500",
2236
2251
  children: "✕"
@@ -2244,127 +2259,127 @@ function Xu({
2244
2259
  ] })
2245
2260
  );
2246
2261
  }
2247
- function Zu({
2262
+ function ep({
2248
2263
  collection: n,
2249
2264
  meta: o,
2250
2265
  onPick: h
2251
2266
  }) {
2252
- const [d, w] = _(/* @__PURE__ */ new Set()), S = ($, q) => h($, q);
2253
- return /* @__PURE__ */ a("div", { className: "max-h-56 overflow-y-auto", children: o.fields.filter(($) => !$.hidden).map(($) => {
2254
- const q = ot(o.relations, n, $.field), N = Tn(o.relations, n, $.field);
2255
- if (!(q != null && q.one_collection) && !N) return null;
2256
- const L = d.has($.field);
2267
+ const [d, w] = _(/* @__PURE__ */ new Set()), N = (q, $) => h(q, $);
2268
+ return /* @__PURE__ */ a("div", { className: "max-h-56 overflow-y-auto", children: o.fields.filter((q) => !q.hidden).map((q) => {
2269
+ const $ = ot(o.relations, n, q.field), S = Tn(o.relations, n, q.field);
2270
+ if (!($ != null && $.one_collection) && !S) return null;
2271
+ const F = d.has(q.field);
2257
2272
  return /* @__PURE__ */ c("div", { children: [
2258
2273
  /* @__PURE__ */ c(
2259
2274
  "button",
2260
2275
  {
2261
2276
  type: "button",
2262
2277
  onClick: () => w((K) => {
2263
- const V = new Set(K);
2264
- return V.has($.field) ? V.delete($.field) : V.add($.field), V;
2278
+ const B = new Set(K);
2279
+ return B.has(q.field) ? B.delete(q.field) : B.add(q.field), B;
2265
2280
  }),
2266
2281
  className: "flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-[12px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
2267
2282
  children: [
2268
- L ? "▾" : "▸",
2283
+ F ? "▾" : "▸",
2269
2284
  " ",
2270
- je($.field),
2271
- N && /* @__PURE__ */ a("span", { className: "text-[10px] text-slate-400", children: N.kind })
2285
+ je(q.field),
2286
+ S && /* @__PURE__ */ a("span", { className: "text-[10px] text-slate-400", children: S.kind })
2272
2287
  ]
2273
2288
  }
2274
2289
  ),
2275
- L && (q == null ? void 0 : q.one_collection) && /* @__PURE__ */ a(
2290
+ F && ($ == null ? void 0 : $.one_collection) && /* @__PURE__ */ a(
2276
2291
  Kr,
2277
2292
  {
2278
- relatedCollection: q.one_collection,
2293
+ relatedCollection: $.one_collection,
2279
2294
  depth: 1,
2280
- path: [$.field],
2281
- pathLabels: [je($.field)],
2295
+ path: [q.field],
2296
+ pathLabels: [je(q.field)],
2282
2297
  filterText: "",
2283
2298
  includeAliases: !0,
2284
- onPick: S
2299
+ onPick: N
2285
2300
  }
2286
2301
  ),
2287
- L && N && /* @__PURE__ */ a(
2302
+ F && S && /* @__PURE__ */ a(
2288
2303
  lo,
2289
2304
  {
2290
- aliasInfo: N,
2305
+ aliasInfo: S,
2291
2306
  depth: 1,
2292
- path: [$.field],
2293
- pathLabels: [je($.field)],
2307
+ path: [q.field],
2308
+ pathLabels: [je(q.field)],
2294
2309
  includeAliases: !0,
2295
- onPick: S
2310
+ onPick: N
2296
2311
  }
2297
2312
  )
2298
- ] }, $.field);
2313
+ ] }, q.field);
2299
2314
  }) });
2300
2315
  }
2301
- function ep({
2316
+ function tp({
2302
2317
  collection: n,
2303
2318
  ids: o,
2304
2319
  onDone: h,
2305
2320
  onCancel: d
2306
2321
  }) {
2307
- const w = Tt(), [S, $] = _(o[0]), [q, N] = _(!1), [L, K] = _(null), [V, I] = _(null), u = o.find((F) => String(F) !== String(S));
2322
+ const w = Lt(), [N, q] = _(o[0]), [$, S] = _(!1), [F, K] = _(null), [B, L] = _(null), u = o.find((R) => String(R) !== String(N));
2308
2323
  me(() => {
2309
- I(null);
2310
- let F = !0;
2324
+ L(null);
2325
+ let R = !0;
2311
2326
  return w.request(
2312
2327
  he(`/record-merge/${n}`, {
2313
- survivor_id: S,
2328
+ survivor_id: N,
2314
2329
  merged_id: u,
2315
2330
  dry_run: !0
2316
2331
  })
2317
2332
  ).then((m) => {
2318
- F && I(m.data);
2333
+ R && L(m.data);
2319
2334
  }).catch(() => {
2320
- F && I({ references: {} });
2335
+ R && L({ references: {} });
2321
2336
  }), () => {
2322
- F = !1;
2337
+ R = !1;
2323
2338
  };
2324
- }, [S]);
2325
- const y = V ? Object.values(V.references).reduce((F, m) => F + m, 0) : null, z = async () => {
2326
- var F;
2327
- N(!0), K(null);
2339
+ }, [N]);
2340
+ const y = B ? Object.values(B.references).reduce((R, m) => R + m, 0) : null, W = async () => {
2341
+ var R;
2342
+ S(!0), K(null);
2328
2343
  try {
2329
2344
  const m = await w.request(
2330
- he(`/record-merge/${n}`, { survivor_id: S, merged_id: u })
2345
+ he(`/record-merge/${n}`, { survivor_id: N, merged_id: u })
2331
2346
  );
2332
2347
  h(
2333
- m.data.delete_error ? `Merged — references repointed, but the duplicate was not deleted: ${m.data.delete_error}` : `Merged ${u} into ${S}`
2348
+ m.data.delete_error ? `Merged — references repointed, but the duplicate was not deleted: ${m.data.delete_error}` : `Merged ${u} into ${N}`
2334
2349
  );
2335
2350
  } catch (m) {
2336
2351
  K(
2337
- ((F = m == null ? void 0 : m.response) == null ? void 0 : F.error) ?? Zt(m, "Merge failed")
2352
+ ((R = m == null ? void 0 : m.response) == null ? void 0 : R.error) ?? Zt(m, "Merge failed")
2338
2353
  );
2339
2354
  } finally {
2340
- N(!1);
2355
+ S(!1);
2341
2356
  }
2342
2357
  };
2343
2358
  return /* @__PURE__ */ c("span", { className: "flex flex-wrap items-center gap-2", children: [
2344
2359
  /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300 dark:text-muted-foreground", children: "Keep" }),
2345
- o.map((F) => /* @__PURE__ */ a(
2360
+ o.map((R) => /* @__PURE__ */ a(
2346
2361
  "button",
2347
2362
  {
2348
2363
  type: "button",
2349
- onClick: () => $(F),
2364
+ onClick: () => q(R),
2350
2365
  className: Xt(
2351
2366
  "h-8 rounded-md border px-3 font-mono text-[12px]",
2352
- String(S) === String(F) ? "border-nvr-cyan bg-nvr-cyan/[0.13] text-[#7fe7ff]" : "border-white/20 dark:border-border text-slate-300 dark:text-muted-foreground hover:bg-white/10 dark:hover:bg-muted"
2367
+ String(N) === String(R) ? "border-nvr-cyan bg-nvr-cyan/[0.13] text-[#7fe7ff]" : "border-white/20 dark:border-border text-slate-300 dark:text-muted-foreground hover:bg-white/10 dark:hover:bg-muted"
2353
2368
  ),
2354
- children: String(F)
2369
+ children: String(R)
2355
2370
  },
2356
- String(F)
2371
+ String(R)
2357
2372
  )),
2358
2373
  /* @__PURE__ */ a("span", { className: "text-[11.5px] text-slate-300 dark:text-muted-foreground", children: y == null ? "Scanning references…" : `${y.toLocaleString()} reference(s) will repoint · ${u} goes to trash` }),
2359
- L && /* @__PURE__ */ a("span", { className: "text-[11.5px] text-red-300", children: L }),
2374
+ F && /* @__PURE__ */ a("span", { className: "text-[11.5px] text-red-300", children: F }),
2360
2375
  /* @__PURE__ */ a(
2361
2376
  "button",
2362
2377
  {
2363
2378
  type: "button",
2364
- disabled: q || y == null,
2365
- onClick: () => void z(),
2379
+ disabled: $ || y == null,
2380
+ onClick: () => void W(),
2366
2381
  className: "h-8 rounded-md bg-red-500 px-3 text-[12.5px] font-semibold text-white dark:text-foreground disabled:opacity-50",
2367
- children: q ? "Merging…" : "Merge"
2382
+ children: $ ? "Merging…" : "Merge"
2368
2383
  }
2369
2384
  ),
2370
2385
  /* @__PURE__ */ a(
@@ -2378,32 +2393,32 @@ function ep({
2378
2393
  )
2379
2394
  ] });
2380
2395
  }
2381
- function tp({
2396
+ function np({
2382
2397
  collection: n,
2383
2398
  selectedIds: o,
2384
2399
  transitions: h,
2385
2400
  states: d = [],
2386
2401
  fields: w,
2387
- relations: S,
2388
- registryKeys: $,
2389
- onClear: q,
2390
- onSuccess: N
2402
+ relations: N,
2403
+ registryKeys: q,
2404
+ onClear: $,
2405
+ onSuccess: S
2391
2406
  }) {
2392
- const L = Ta(), K = Tt(), V = Ea(), I = Zl(), [u, y] = _("actions"), z = vc([n], $), { data: F = [] } = ne({
2407
+ const F = Ta(), K = Lt(), B = Ea(), L = Zl(), [u, y] = _("actions"), W = vc([n], q), { data: R = [] } = ne({
2393
2408
  queryKey: ["bulk-recipes", n],
2394
2409
  queryFn: () => K.request(G("/bulk-recipes", { collection: n })).then((f) => f.data ?? []).catch(() => []),
2395
2410
  staleTime: 6e4
2396
- }), [m, E] = _(null), [P, O] = _(""), T = async () => {
2397
- if (!(!m || !P.trim()))
2411
+ }), [m, D] = _(null), [O, M] = _(""), T = async () => {
2412
+ if (!(!m || !O.trim()))
2398
2413
  try {
2399
2414
  await K.request(
2400
2415
  he("/bulk-recipes", {
2401
2416
  collection: n,
2402
- name: P.trim(),
2417
+ name: O.trim(),
2403
2418
  action_type: m.action_type,
2404
2419
  config: m.config
2405
2420
  })
2406
- ), V.invalidateQueries({ queryKey: ["bulk-recipes", n] }), Ze(`Recipe "${P.trim()}" saved`), E(null), O(""), y("actions");
2421
+ ), B.invalidateQueries({ queryKey: ["bulk-recipes", n] }), Ze(`Recipe "${O.trim()}" saved`), D(null), M(""), y("actions");
2407
2422
  } catch {
2408
2423
  Ze("Failed to save recipe");
2409
2424
  }
@@ -2477,7 +2492,7 @@ function tp({
2477
2492
  Ui(H, o);
2478
2493
  try {
2479
2494
  const te = await f(H);
2480
- Ze(te), N(), q(), y("actions");
2495
+ Ze(te), S(), $(), y("actions");
2481
2496
  } catch (te) {
2482
2497
  Ze(rd(te, "Bulk action failed"));
2483
2498
  } finally {
@@ -2507,7 +2522,7 @@ function tp({
2507
2522
  "button",
2508
2523
  {
2509
2524
  type: "button",
2510
- onClick: q,
2525
+ onClick: $,
2511
2526
  "aria-label": "Clear selection",
2512
2527
  className: "text-slate-400 hover:text-white dark:hover:text-foreground",
2513
2528
  children: "✕"
@@ -2522,7 +2537,7 @@ function tp({
2522
2537
  st && /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300 dark:text-muted-foreground", children: st }),
2523
2538
  /* @__PURE__ */ a("span", { className: "flex-1" }),
2524
2539
  u === "actions" && /* @__PURE__ */ c("span", { className: "flex flex-wrap items-center gap-1.5", children: [
2525
- z("recipes") && F.map((f) => {
2540
+ W("recipes") && R.map((f) => {
2526
2541
  var H, te, oe;
2527
2542
  return /* @__PURE__ */ c("span", { className: "group/recipe relative inline-flex", children: [
2528
2543
  /* @__PURE__ */ a(
@@ -2547,7 +2562,7 @@ function tp({
2547
2562
  confirmTitle: `Delete the recipe "${f.name}"?`,
2548
2563
  onConfirm: () => {
2549
2564
  K.request(Ca(`/bulk-recipes/${f.id}`)).then(
2550
- () => V.invalidateQueries({ queryKey: ["bulk-recipes", n] })
2565
+ () => B.invalidateQueries({ queryKey: ["bulk-recipes", n] })
2551
2566
  );
2552
2567
  },
2553
2568
  className: "absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full bg-slate-600 text-[9px] text-white dark:text-foreground hover:bg-red-600 group-hover/recipe:flex",
@@ -2563,7 +2578,7 @@ function tp({
2563
2578
  type: "button",
2564
2579
  onClick: () => {
2565
2580
  const f = Ad(
2566
- o.map((H) => I.urlFor({ collection: n, itemId: String(H) }))
2581
+ o.map((H) => L.urlFor({ collection: n, itemId: String(H) }))
2567
2582
  );
2568
2583
  f.blocked > 0 || f.capped > 0 ? ge.warning(Rl(f)) : ge.success(Rl(f));
2569
2584
  },
@@ -2573,17 +2588,17 @@ function tp({
2573
2588
  children: "Open in tabs"
2574
2589
  }
2575
2590
  ),
2576
- z("compare") && /* @__PURE__ */ a(
2591
+ W("compare") && /* @__PURE__ */ a(
2577
2592
  yc,
2578
2593
  {
2579
2594
  targets: o.map((f) => ({ collection: n, id: f })),
2580
2595
  fields: w,
2581
- relations: S,
2582
- renderValue: (f, H, te, oe) => ap(n, f, H, te, oe),
2596
+ relations: N,
2597
+ renderValue: (f, H, te, oe) => rp(n, f, H, te, oe),
2583
2598
  className: "h-8 rounded-md border border-white/20 dark:border-border px-3 text-[12.5px] font-medium hover:bg-white/10 dark:hover:bg-muted"
2584
2599
  }
2585
2600
  ),
2586
- z("merge") && o.length === 2 && L.isAdmin && /* @__PURE__ */ a(
2601
+ W("merge") && o.length === 2 && F.isAdmin && /* @__PURE__ */ a(
2587
2602
  "button",
2588
2603
  {
2589
2604
  type: "button",
@@ -2597,15 +2612,15 @@ function tp({
2597
2612
  kc,
2598
2613
  {
2599
2614
  targets: o.map((f) => ({ collection: n, id: f })),
2600
- enabledKeys: $,
2615
+ enabledKeys: q,
2601
2616
  tone: "dark",
2602
2617
  disabled: ee,
2603
2618
  onDone: (f) => {
2604
- Ze(null), N(), f.failed === 0 && q();
2619
+ Ze(null), S(), f.failed === 0 && $();
2605
2620
  }
2606
2621
  }
2607
2622
  ),
2608
- z("update-field") && /* @__PURE__ */ a(
2623
+ W("update-field") && /* @__PURE__ */ a(
2609
2624
  wc,
2610
2625
  {
2611
2626
  collection: n,
@@ -2613,12 +2628,12 @@ function tp({
2613
2628
  disabled: ee,
2614
2629
  onApply: Et,
2615
2630
  onSaveRecipe: (f, H) => {
2616
- O(""), E({ action_type: "update", config: { field: f, value: H } });
2631
+ M(""), D({ action_type: "update", config: { field: f, value: H } });
2617
2632
  },
2618
2633
  className: "h-8 rounded-md border border-white/20 dark:border-border px-3 text-[12.5px] font-medium hover:bg-white/10 dark:hover:bg-muted disabled:opacity-40"
2619
2634
  }
2620
2635
  ),
2621
- z("transition") && h.length > 0 && /* @__PURE__ */ a(
2636
+ W("transition") && h.length > 0 && /* @__PURE__ */ a(
2622
2637
  "button",
2623
2638
  {
2624
2639
  type: "button",
@@ -2627,7 +2642,7 @@ function tp({
2627
2642
  children: "Transition"
2628
2643
  }
2629
2644
  ),
2630
- z("message") && /* @__PURE__ */ a(
2645
+ W("message") && /* @__PURE__ */ a(
2631
2646
  "button",
2632
2647
  {
2633
2648
  type: "button",
@@ -2636,7 +2651,7 @@ function tp({
2636
2651
  children: "Message…"
2637
2652
  }
2638
2653
  ),
2639
- z("delete") && /* @__PURE__ */ a(
2654
+ W("delete") && /* @__PURE__ */ a(
2640
2655
  "button",
2641
2656
  {
2642
2657
  type: "button",
@@ -2647,12 +2662,12 @@ function tp({
2647
2662
  )
2648
2663
  ] }),
2649
2664
  u === "merge" && /* @__PURE__ */ a(
2650
- ep,
2665
+ tp,
2651
2666
  {
2652
2667
  collection: n,
2653
2668
  ids: o.slice(0, 2),
2654
2669
  onDone: (f) => {
2655
- Ze(f), N(), q(), y("actions");
2670
+ Ze(f), S(), $(), y("actions");
2656
2671
  },
2657
2672
  onCancel: () => y("actions")
2658
2673
  }
@@ -2770,7 +2785,7 @@ function tp({
2770
2785
  disabled: !fe,
2771
2786
  onClick: () => {
2772
2787
  const f = Se;
2773
- f && (O(""), E({ action_type: "transition", config: { transition_label: f.label } }));
2788
+ f && (M(""), D({ action_type: "transition", config: { transition_label: f.label } }));
2774
2789
  },
2775
2790
  title: "Save this transition as a reusable recipe",
2776
2791
  className: "h-8 rounded-md border border-white/20 dark:border-border px-2.5 text-[12.5px] text-slate-300 dark:text-muted-foreground hover:bg-white/10 dark:hover:bg-muted disabled:opacity-40",
@@ -2802,8 +2817,8 @@ function tp({
2802
2817
  "input",
2803
2818
  {
2804
2819
  autoFocus: !0,
2805
- value: P,
2806
- onChange: (f) => O(f.target.value),
2820
+ value: O,
2821
+ onChange: (f) => M(f.target.value),
2807
2822
  placeholder: "e.g. Close out — duplicate",
2808
2823
  className: "h-8 w-56 rounded-md border border-white/20 dark:border-border bg-white/10 dark:bg-background px-2 text-[12.5px] text-white dark:text-foreground placeholder:text-slate-400 dark:placeholder:text-muted-foreground"
2809
2824
  }
@@ -2812,7 +2827,7 @@ function tp({
2812
2827
  "button",
2813
2828
  {
2814
2829
  type: "submit",
2815
- disabled: !P.trim(),
2830
+ disabled: !O.trim(),
2816
2831
  className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#0f1e2d] disabled:opacity-50",
2817
2832
  children: "Save"
2818
2833
  }
@@ -2821,7 +2836,7 @@ function tp({
2821
2836
  "button",
2822
2837
  {
2823
2838
  type: "button",
2824
- onClick: () => E(null),
2839
+ onClick: () => D(null),
2825
2840
  className: "h-8 px-2 text-[12.5px] text-slate-300 dark:text-muted-foreground hover:text-white dark:hover:text-foreground",
2826
2841
  children: "Cancel"
2827
2842
  }
@@ -2863,7 +2878,7 @@ function tp({
2863
2878
  }
2864
2879
  );
2865
2880
  }
2866
- const np = {
2881
+ const ap = {
2867
2882
  state: "badge",
2868
2883
  entered: "date",
2869
2884
  aging: "short",
@@ -2875,45 +2890,45 @@ const np = {
2875
2890
  tasks: "short",
2876
2891
  addendums: "short"
2877
2892
  };
2878
- function X0({
2893
+ function Z0({
2879
2894
  collection: n,
2880
2895
  quickFilters: o = [],
2881
2896
  initialColumns: h,
2882
2897
  initialSort: d,
2883
2898
  pageSize: w = 25,
2884
- initialSearch: S = "",
2885
- initialFilters: $,
2886
- initialConditions: q,
2887
- onOpenItem: N,
2888
- initialAiPrompt: L,
2899
+ initialSearch: N = "",
2900
+ initialFilters: q,
2901
+ initialConditions: $,
2902
+ onOpenItem: S,
2903
+ initialAiPrompt: F,
2889
2904
  extraViews: K,
2890
- showCreate: V = !0,
2891
- className: I
2905
+ showCreate: B = !0,
2906
+ className: L
2892
2907
  }) {
2893
2908
  var ol, il, dl, cl, ul, pl, ml, fl, bl, hl, gl;
2894
- const u = Tt(), y = Ea(), { open: z, urlFor: F } = Zl(), [m] = _(
2909
+ const u = Lt(), y = Ea(), { open: W, urlFor: R } = Zl(), [m] = _(
2895
2910
  () => yd(wd(`cbv:${n}`))
2896
- ), [E] = _(
2911
+ ), [D] = _(
2897
2912
  () => m ? Pl(m.f ?? []) : null
2898
- ), [P] = _(
2913
+ ), [O] = _(
2899
2914
  () => m ? null : Nd(`cbv:${n}`)
2900
- ), [O, T] = _((m == null ? void 0 : m.p) ?? P ?? 1), de = pe(P);
2915
+ ), [M, T] = _((m == null ? void 0 : m.p) ?? O ?? 1), de = pe(O);
2901
2916
  me(() => {
2902
- const e = Fl(de.current, O);
2903
- if (e !== O) {
2917
+ const e = Fl(de.current, M);
2918
+ if (e !== M) {
2904
2919
  T(e);
2905
2920
  return;
2906
2921
  }
2907
- Sd(`cbv:${n}`, O);
2908
- }, [n, O]);
2909
- const fe = pe(ud()), [we, Ae] = _(m ? m.q ?? "" : S), Y = $l(we.trim(), 350), [Be, Se] = _(
2910
- E ? E.filters : $ ?? []
2922
+ Sd(`cbv:${n}`, M);
2923
+ }, [n, M]);
2924
+ const fe = pe(ud()), [we, Ae] = _(m ? m.q ?? "" : N), Y = $l(we.trim(), 350), [Be, Se] = _(
2925
+ D ? D.filters : q ?? []
2911
2926
  ), [X, $e] = _(m ? m.s ?? "" : d ?? ""), [it, rt] = _(h ?? null), [Ie, Oe] = _({}), [We, k] = _({}), [le, ee] = _(null), [xe, st] = _({}), [Ze, mt] = _({}), [Et, f] = _({}), [H, te] = _({}), [oe, re] = _(null), [qe, vt] = _(!1), Kt = pe(null), [cn, Ve] = _(
2912
2927
  () => (m == null ? void 0 : m.qf) ?? {}
2913
2928
  ), [ft, kt] = _(
2914
2929
  () => (m == null ? void 0 : m.qf) ?? {}
2915
2930
  ), [Dt, un] = _(
2916
- m ? m.lc ?? [] : q ?? []
2931
+ m ? m.lc ?? [] : $ ?? []
2917
2932
  ), { scopes: bt, ready: Ln } = sc(), [Ge, jt] = _(!1), [pn, en] = _(/* @__PURE__ */ new Set()), [He, zt] = _(
2918
2933
  () => (m == null ? void 0 : m.cf) ?? {}
2919
2934
  ), yt = Mi("drill.browser"), lt = yt.value, [Fn, mn] = _(null), [fn, tn] = _(!1), [nn, ea] = _(() => {
@@ -2942,7 +2957,7 @@ function X0({
2942
2957
  e ? localStorage.setItem(`nvr_cbv_group_${n}`, e) : localStorage.removeItem(`nvr_cbv_group_${n}`);
2943
2958
  } catch {
2944
2959
  }
2945
- }, [R, Z] = _(!1), [ue, Ke] = _(""), [ae, an] = _(null), Wt = qt({
2960
+ }, [E, Z] = _(!1), [ue, Ke] = _(""), [ae, an] = _(null), Wt = qt({
2946
2961
  mutationFn: (e) => u.request(he("/ai/query", { collection: n, prompt: e, limit: 200 })),
2947
2962
  onSuccess: (e) => {
2948
2963
  var t;
@@ -2961,8 +2976,8 @@ function X0({
2961
2976
  an(null), Ke("");
2962
2977
  }, jr = pe(!1);
2963
2978
  me(() => {
2964
- !L || jr.current || (jr.current = !0, Z(!0), Ke(L), Wt.mutate(L));
2965
- }, [L]);
2979
+ !F || jr.current || (jr.current = !0, Z(!0), Ke(F), Wt.mutate(F));
2980
+ }, [F]);
2966
2981
  const [ie, Vt] = _(null), [Pn, Br] = _(() => (m == null ? void 0 : m.ex) ?? []);
2967
2982
  me(() => {
2968
2983
  if (!ie) return;
@@ -2982,9 +2997,9 @@ function X0({
2982
2997
  };
2983
2998
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
2984
2999
  }, [Aa]);
2985
- const Wr = pe(null), Vr = pe(null), Ia = !m && ((q == null ? void 0 : q.length) ?? 0) > 0, Ka = pe(!!m || Ia), { isAdmin: wt } = Ta(), Hr = pe(n);
3000
+ const Wr = pe(null), Vr = pe(null), Ia = !m && (($ == null ? void 0 : $.length) ?? 0) > 0, Ka = pe(!!m || Ia), { isAdmin: wt } = Ta(), Hr = pe(n);
2986
3001
  me(() => {
2987
- Hr.current !== n && (Hr.current = n, T(1), Ae(S), Se([]), $e(d ?? ""), rt(h ?? null), Oe({}), k({}), st({}), mt({}), sn([]), On(null), Ve({}), kt({}), zt({}), un([]), lt != null && lt.length && yt.back(lt.length), mn(null), Ka.current = !1);
3002
+ Hr.current !== n && (Hr.current = n, T(1), Ae(N), Se([]), $e(d ?? ""), rt(h ?? null), Oe({}), k({}), st({}), mt({}), sn([]), On(null), Ve({}), kt({}), zt({}), un([]), lt != null && lt.length && yt.back(lt.length), mn(null), Ka.current = !1);
2988
3003
  }, [n]), me(() => {
2989
3004
  if (!fn) return;
2990
3005
  const e = (t) => {
@@ -3000,23 +3015,23 @@ function X0({
3000
3015
  };
3001
3016
  return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
3002
3017
  }, [bn]);
3003
- const { data: A } = ne({
3018
+ const { data: I } = ne({
3004
3019
  queryKey: ["cbv-collection-meta", n],
3005
3020
  queryFn: () => u.request(G(`/collections/${n}`)).then((e) => e.data),
3006
3021
  staleTime: 10 * 6e4,
3007
3022
  retry: !1
3008
- }), Pt = be(() => ((A == null ? void 0 : A.fields) ?? []).filter((e) => !e.hidden), [A]), Pe = (A == null ? void 0 : A.browser_config) ?? {}, Fe = (ol = Pe.fulfilment) != null && ol.shipped_field && ((il = Pe.fulfilment) != null && il.requested_field) ? Pe.fulfilment : null, Yr = pe(!!m);
3023
+ }), Pt = be(() => ((I == null ? void 0 : I.fields) ?? []).filter((e) => !e.hidden), [I]), Pe = (I == null ? void 0 : I.browser_config) ?? {}, Fe = (ol = Pe.fulfilment) != null && ol.shipped_field && ((il = Pe.fulfilment) != null && il.requested_field) ? Pe.fulfilment : null, Yr = pe(!!m);
3009
3024
  me(() => {
3010
- Yr.current || !A || (Yr.current = !0, !d && !X && Pe.default_sort && $e(Pe.default_sort));
3011
- }, [A]);
3025
+ Yr.current || !I || (Yr.current = !0, !d && !X && Pe.default_sort && $e(Pe.default_sort));
3026
+ }, [I]);
3012
3027
  const Ot = Pe.checkbox_selection !== !1, Jr = Pe.show_actions !== !1, [_t, uo] = _(!1), po = () => {
3013
3028
  _t && sn([]), uo(!_t);
3014
- }, aa = V && Pe.allow_create !== !1, Gr = typeof Pe.create_label == "string" && Pe.create_label.trim().slice(0, 40) || "New item", ra = ic(aa && !(A != null && A.singleton) ? n : null), [ja, Mn] = _(!1), [Ba, sa] = _(null), { steps: Qa } = cu(
3015
- aa && !(A != null && A.singleton) ? n : null,
3029
+ }, aa = B && Pe.allow_create !== !1, Gr = typeof Pe.create_label == "string" && Pe.create_label.trim().slice(0, 40) || "New item", ra = ic(aa && !(I != null && I.singleton) ? n : null), [ja, Mn] = _(!1), [Ba, sa] = _(null), { steps: Qa } = cu(
3030
+ aa && !(I != null && I.singleton) ? n : null,
3016
3031
  null
3017
3032
  ), Xr = (e) => {
3018
- e ? z({ collection: n, itemId: "new", layoutSlug: e }) : dn("new");
3019
- }, An = ou(aa && !(A != null && A.singleton) ? n : null), mo = Ai(), Zr = pe(null), [fo, bo] = _(null), [es, ts] = _(!1), ns = (e) => {
3033
+ e ? W({ collection: n, itemId: "new", layoutSlug: e }) : dn("new");
3034
+ }, An = ou(aa && !(I != null && I.singleton) ? n : null), mo = Ai(), Zr = pe(null), [fo, bo] = _(null), [es, ts] = _(!1), ns = (e) => {
3020
3035
  var t;
3021
3036
  bo(e), (t = Zr.current) == null || t.click();
3022
3037
  }, ho = async (e) => {
@@ -3025,7 +3040,7 @@ function X0({
3025
3040
  ts(!0);
3026
3041
  try {
3027
3042
  const r = await iu(mo, t, n);
3028
- z({ collection: n, itemId: "new", layoutSlug: fo, query: { autofill: r } });
3043
+ W({ collection: n, itemId: "new", layoutSlug: fo, query: { autofill: r } });
3029
3044
  } catch (r) {
3030
3045
  ql(r, "The document could not be read", { action: "New from document" });
3031
3046
  } finally {
@@ -3074,7 +3089,7 @@ function X0({
3074
3089
  const i = (b) => {
3075
3090
  var v;
3076
3091
  const x = { ...b };
3077
- for (const [Q, j] of Object.entries(l)) (((v = x[Q]) == null ? void 0 : v.length) ?? 0) || (x[Q] = j);
3092
+ for (const [U, j] of Object.entries(l)) (((v = x[U]) == null ? void 0 : v.length) ?? 0) || (x[U] = j);
3078
3093
  return x;
3079
3094
  };
3080
3095
  Ve(i), kt(i), en((b) => /* @__PURE__ */ new Set([...b, ...Object.keys(l)]));
@@ -3087,7 +3102,7 @@ function X0({
3087
3102
  }
3088
3103
  });
3089
3104
  me(() => {
3090
- if (Ge || !Ln || o.length === 0 && !A) return;
3105
+ if (Ge || !Ln || o.length === 0 && !I) return;
3091
3106
  const e = bt, t = Object.values((e == null ? void 0 : e.defaults) ?? {}).some((r) => r.length > 0) || Object.values((e == null ? void 0 : e.restricted) ?? {}).some((r) => r.length > 0);
3092
3107
  if (!e || Nt.length === 0 || !t || m || Ia) {
3093
3108
  jt(!0);
@@ -3107,18 +3122,18 @@ function X0({
3107
3122
  }
3108
3123
  jt(!0);
3109
3124
  })();
3110
- }, [Ge, Ln, bt, A, Nt]);
3125
+ }, [Ge, Ln, bt, I, Nt]);
3111
3126
  const ss = (e) => {
3112
3127
  const t = Dl(bt, { key: e.key, collection: e.collection }), r = t ? (bt == null ? void 0 : bt.restricted[t.name]) ?? [] : [];
3113
3128
  return r.length > 0 ? r : void 0;
3114
- }, St = be(() => new Map(Pt.map((e) => [e.field, e])), [Pt]), Xe = (A == null ? void 0 : A.relations) ?? [], ls = be(() => hd(Pe.inline_edit), [Pe.inline_edit]), { data: xo } = ne({
3129
+ }, St = be(() => new Map(Pt.map((e) => [e.field, e])), [Pt]), Xe = (I == null ? void 0 : I.relations) ?? [], ls = be(() => hd(Pe.inline_edit), [Pe.inline_edit]), { data: xo } = ne({
3115
3130
  queryKey: ["my-permissions"],
3116
3131
  queryFn: () => u.request(G("/security/my/permissions")).then((e) => e.data),
3117
3132
  enabled: ls.enabled && !wt,
3118
3133
  staleTime: 5 * 6e4
3119
- }), vo = wt || Iu(xo, n), os = be(
3120
- () => new Map(((A == null ? void 0 : A.fields) ?? []).map((e) => [e.field, e])),
3121
- [A]
3134
+ }), vo = wt || Ku(xo, n), os = be(
3135
+ () => new Map(((I == null ? void 0 : I.fields) ?? []).map((e) => [e.field, e])),
3136
+ [I]
3122
3137
  ), is = hu(), ds = (e) => (
3123
3138
  // Ask-the-table answers are a one-off overlay, not the list's own rows.
3124
3139
  ae ? null : vd({
@@ -3147,13 +3162,13 @@ function X0({
3147
3162
  optimistic: () => {
3148
3163
  const x = y.getQueriesData({ queryKey: ["cbv-items", n] });
3149
3164
  return y.setQueriesData({ queryKey: ["cbv-items", n] }, (v) => {
3150
- const Q = v;
3151
- return Q != null && Q.data ? {
3152
- ...Q,
3153
- data: Q.data.map((j) => String(j.id) === String(i) ? { ...j, [t]: s } : j)
3165
+ const U = v;
3166
+ return U != null && U.data ? {
3167
+ ...U,
3168
+ data: U.data.map((j) => String(j.id) === String(i) ? { ...j, [t]: s } : j)
3154
3169
  } : v;
3155
3170
  }), () => {
3156
- for (const [v, Q] of x) y.setQueryData(v, Q);
3171
+ for (const [v, U] of x) y.setQueryData(v, U);
3157
3172
  };
3158
3173
  },
3159
3174
  // Rollups, computed columns and the row's position may follow the change.
@@ -3182,7 +3197,7 @@ function X0({
3182
3197
  ), [it, Pt, St, We]), [Wa, oa] = _(null), In = be(
3183
3198
  () => Wa ?? (ve[0] ? { [ve[0]]: "left" } : {}),
3184
3199
  [Wa, ve]
3185
- ), Lt = (e) => In[e], wo = (e) => {
3200
+ ), Ft = (e) => In[e], wo = (e) => {
3186
3201
  const t = { ...In }, r = t[e];
3187
3202
  r ? r === "left" ? t[e] = "right" : delete t[e] : t[e] = "left", oa(t);
3188
3203
  }, et = (e) => Ie[e] ?? (e.startsWith("__f:") ? We[e] ?? "Formula" : e.includes(".") ? e.split(".").map(je).join(" › ") : e === "id" ? "ID" : je(e)), cs = (e, t) => {
@@ -3273,7 +3288,7 @@ function X0({
3273
3288
  l != null && l.one_collection && (e[t.field] = { kind: "m2m", target: l.one_collection });
3274
3289
  }
3275
3290
  return e;
3276
- }, [Yt, on]), Ya = $l(He, 350), [vn, So] = _((m == null ? void 0 : m.a) === !0), [bs, Co] = _(null), Kn = Kc(n, bs), [Ft, hs] = _(null), { data: jn } = Tc(n), [Mt, ia] = _(() => (E == null ? void 0 : E.riskIds) ?? []), _e = be(() => {
3291
+ }, [Yt, on]), Ya = $l(He, 350), [vn, So] = _((m == null ? void 0 : m.a) === !0), [bs, Co] = _(null), Kn = Kc(n, bs), [Rt, hs] = _(null), { data: jn } = Tc(n), [Mt, ia] = _(() => (D == null ? void 0 : D.riskIds) ?? []), _e = be(() => {
3277
3292
  var t;
3278
3293
  const e = Hl(Be);
3279
3294
  for (const r of Nt) {
@@ -3338,11 +3353,11 @@ function X0({
3338
3353
  Kn.condition,
3339
3354
  Mt
3340
3355
  ]), kn = be(() => {
3341
- const e = ((A == null ? void 0 : A.fields) ?? []).map((l) => l.field), t = e.find((l) => /^(latitude|lat)$/i.test(l)) ?? null, r = e.find((l) => /^(longitude|lng|long|lon)$/i.test(l)) ?? null;
3356
+ const e = ((I == null ? void 0 : I.fields) ?? []).map((l) => l.field), t = e.find((l) => /^(latitude|lat)$/i.test(l)) ?? null, r = e.find((l) => /^(longitude|lng|long|lon)$/i.test(l)) ?? null;
3342
3357
  if (!t || !r) return null;
3343
3358
  const s = e.find((l) => ["name", "title", "label", "short_name"].includes(l.toLowerCase())) ?? null;
3344
3359
  return { latField: t, lngField: r, labelField: s };
3345
- }, [A]), [da, gs] = _(!1), [xs, $o] = _(!1), vs = pe(_e);
3360
+ }, [I]), [da, gs] = _(!1), [xs, $o] = _(!1), vs = pe(_e);
3346
3361
  me(() => {
3347
3362
  vs.current !== _e && (vs.current = _e, T(Fl(de.current, 1)));
3348
3363
  }, [_e]);
@@ -3398,8 +3413,8 @@ function X0({
3398
3413
  refetch: Ga,
3399
3414
  error: tt
3400
3415
  } = ne({
3401
- queryKey: ks(O),
3402
- queryFn: () => ys(O),
3416
+ queryKey: ks(M),
3417
+ queryFn: () => ys(M),
3403
3418
  enabled: !!n && Ge,
3404
3419
  placeholderData: (e) => e,
3405
3420
  // #2490 — a collection whose live record events are off polls instead (visible tabs only).
@@ -3409,9 +3424,9 @@ function X0({
3409
3424
  });
3410
3425
  Kd({
3411
3426
  qc: y,
3412
- enabled: !!n && Ge && !ce && !Y && !ht && !!ke && O * Ye < (ke.total ?? 0),
3413
- queryKey: ks(O + 1),
3414
- queryFn: () => ys(O + 1).then((e) => (ws.current(e.data ?? []), e))
3427
+ enabled: !!n && Ge && !ce && !Y && !ht && !!ke && M * Ye < (ke.total ?? 0),
3428
+ queryKey: ks(M + 1),
3429
+ queryFn: () => ys(M + 1).then((e) => (ws.current(e.data ?? []), e))
3415
3430
  }), me(() => {
3416
3431
  const e = Cd({
3417
3432
  pending: de.current,
@@ -3423,11 +3438,11 @@ function X0({
3423
3438
  total: ke == null ? void 0 : ke.total,
3424
3439
  totalUnknown: (ke == null ? void 0 : ke.total_timed_out) === !0,
3425
3440
  pageSize: Ye,
3426
- page: O
3441
+ page: M
3427
3442
  });
3428
3443
  e && (de.current = null, e.page != null && T(e.page));
3429
- }, [Ge, ke, ht, Ja, O, Ye, tt]);
3430
- const Ce = ae ? ae.rows : (ke == null ? void 0 : ke.data) ?? [], Re = ae ? ae.total : (ke == null ? void 0 : ke.total) ?? 0, Bt = !ae && !!ke && (ke.total_timed_out === !0 || ke.total == null), Qn = !ae && (ke == null ? void 0 : ke.total_approx) === !0, Xa = ke == null ? void 0 : ke.aggregates, ua = Bt ? O + (Ce.length >= Ye ? 1 : 0) : Math.max(1, Math.ceil(Re / Ye)), [Za, _s] = _(!1), Ns = async () => {
3444
+ }, [Ge, ke, ht, Ja, M, Ye, tt]);
3445
+ const Ce = ae ? ae.rows : (ke == null ? void 0 : ke.data) ?? [], Re = ae ? ae.total : (ke == null ? void 0 : ke.total) ?? 0, Bt = !ae && !!ke && (ke.total_timed_out === !0 || ke.total == null), Qn = !ae && (ke == null ? void 0 : ke.total_approx) === !0, Xa = ke == null ? void 0 : ke.aggregates, ua = Bt ? M + (Ce.length >= Ye ? 1 : 0) : Math.max(1, Math.ceil(Re / Ye)), [Za, _s] = _(!1), Ns = async () => {
3431
3446
  if (!Qn && !Bt) {
3432
3447
  T(ua);
3433
3448
  return;
@@ -3513,7 +3528,7 @@ function X0({
3513
3528
  n ? {
3514
3529
  list: {
3515
3530
  collection: n,
3516
- label: (A == null ? void 0 : A.display_name) || n,
3531
+ label: (I == null ? void 0 : I.display_name) || n,
3517
3532
  ids: Ce.slice(0, 100).map((e) => String(e.id)),
3518
3533
  filters: Be.map((e) => ({
3519
3534
  path: e.path.join("."),
@@ -3529,7 +3544,7 @@ function X0({
3529
3544
  const Lo = fc(), $s = Ii(ht), tr = Ki({
3530
3545
  pending: ht,
3531
3546
  request: n ? { method: "GET", url: `/items/${n}` } : null,
3532
- noun: ((A == null ? void 0 : A.display_name) ?? n ?? "").replace(/_/g, " ").toLowerCase() || null,
3547
+ noun: ((I == null ? void 0 : I.display_name) ?? n ?? "").replace(/_/g, " ").toLowerCase() || null,
3533
3548
  // Only a total this person has already been shown (never a raw table count).
3534
3549
  knownRows: ht ? nc(y.getQueriesData({ queryKey: ["cbv-items", n] })) : null
3535
3550
  }), nr = Wd(), { userId: Wn } = Ta(), qs = (e) => wt || !!Wn && String(e.user ?? "").toUpperCase() === String(Wn).toUpperCase(), At = qd(), ar = pe(/* @__PURE__ */ new Set());
@@ -3543,7 +3558,7 @@ function X0({
3543
3558
  n,
3544
3559
  Y,
3545
3560
  X,
3546
- ce ? "grouped" : O,
3561
+ ce ? "grouped" : M,
3547
3562
  ce ? 500 : Ye,
3548
3563
  _e,
3549
3564
  Bn
@@ -3551,136 +3566,136 @@ function X0({
3551
3566
  const Fs = pe({
3552
3567
  conditions: _e,
3553
3568
  search: Y,
3554
- page: O,
3569
+ page: M,
3555
3570
  grouped: !!ce
3556
3571
  });
3557
3572
  Fs.current = {
3558
3573
  conditions: _e,
3559
3574
  search: Y,
3560
- page: O,
3575
+ page: M,
3561
3576
  grouped: !!ce
3562
3577
  };
3563
3578
  const rr = pe({}).current, [Ro, Eo] = _(0), [sr, lr] = _(0);
3564
3579
  me(() => {
3565
3580
  if (!nr || !n) return;
3566
- const e = (D = 1) => lr((U) => U + D), t = /* @__PURE__ */ new Map();
3581
+ const e = (P = 1) => lr((z) => z + P), t = /* @__PURE__ */ new Map();
3567
3582
  let r = null;
3568
- const s = (D) => {
3569
- const U = (J) => t.set(JSON.stringify(J), J);
3570
- D.includes($n.tasks) && U(["cbv-task-counts", n]), D.includes($n.addendums) && U(["cbv-addendum-summary", n]), D.includes($n.integrations) && U(["cbv-integrations-summary", n]), D.includes($n.comments) && U(["row-comment-counts", n]), D.includes($n.state) && (U(["cbv-pipeline-instances", n]), U(["cbv-owners", n]), U(["cbv-view-count", n])), D.includes($n.lock) && Eo((J) => J + 1), !r && (r = setTimeout(() => {
3583
+ const s = (P) => {
3584
+ const z = (J) => t.set(JSON.stringify(J), J);
3585
+ P.includes($n.tasks) && z(["cbv-task-counts", n]), P.includes($n.addendums) && z(["cbv-addendum-summary", n]), P.includes($n.integrations) && z(["cbv-integrations-summary", n]), P.includes($n.comments) && z(["row-comment-counts", n]), P.includes($n.state) && (z(["cbv-pipeline-instances", n]), z(["cbv-owners", n]), z(["cbv-view-count", n])), P.includes($n.lock) && Eo((J) => J + 1), !r && (r = setTimeout(() => {
3571
3586
  r = null;
3572
3587
  for (const J of t.values()) y.invalidateQueries({ queryKey: J });
3573
3588
  t.clear();
3574
3589
  }, 300));
3575
- }, l = (D) => y.setQueryData(
3590
+ }, l = (P) => y.setQueryData(
3576
3591
  Ls.current,
3577
- (U) => U && { ...U, ...D(U) }
3592
+ (z) => z && { ...z, ...P(z) }
3578
3593
  );
3579
3594
  let i = [], b = null, x = null, v = !1;
3580
- const Q = async () => {
3595
+ const U = async () => {
3581
3596
  b = null;
3582
- const D = i;
3583
- if (i = [], D.length === 0 || v) return;
3597
+ const P = i;
3598
+ if (i = [], P.length === 0 || v) return;
3584
3599
  x || (x = setTimeout(() => {
3585
3600
  x = null, y.invalidateQueries({ queryKey: ["cbv-view-count", n] });
3586
3601
  }, 1500));
3587
- const U = /* @__PURE__ */ new Map();
3602
+ const z = /* @__PURE__ */ new Map();
3588
3603
  let J = !1;
3589
- for (const W of D) {
3590
- const ye = String(W.item);
3604
+ for (const V of P) {
3605
+ const ye = String(V.item);
3591
3606
  if (ye === "*") {
3592
3607
  J = !0;
3593
3608
  continue;
3594
3609
  }
3595
- const se = U.get(ye), C = (se == null ? void 0 : se.action) === "delete" || W.action === "delete" ? "delete" : (se == null ? void 0 : se.action) === "create" ? "create" : W.action, B = /* @__PURE__ */ new Set([...(se == null ? void 0 : se.changed_fields) ?? [], ...W.changed_fields ?? []]);
3596
- U.set(ye, {
3597
- ...W,
3610
+ const se = z.get(ye), C = (se == null ? void 0 : se.action) === "delete" || V.action === "delete" ? "delete" : (se == null ? void 0 : se.action) === "create" ? "create" : V.action, Q = /* @__PURE__ */ new Set([...(se == null ? void 0 : se.changed_fields) ?? [], ...V.changed_fields ?? []]);
3611
+ z.set(ye, {
3612
+ ...V,
3598
3613
  action: C,
3599
- changed_fields: W.changed_fields || se != null && se.changed_fields ? [...B] : void 0
3614
+ changed_fields: V.changed_fields || se != null && se.changed_fields ? [...Q] : void 0
3600
3615
  });
3601
3616
  }
3602
3617
  J && e();
3603
- const p = ar.current, gt = (W) => Id(n, W.item), nt = (W) => {
3604
- const ye = Dd(W);
3618
+ const p = ar.current, gt = (V) => Id(n, V.item), nt = (V) => {
3619
+ const ye = Dd(V);
3605
3620
  return ye && Wn && ye.toUpperCase() === Wn.toUpperCase() ? "self" : ye;
3606
3621
  }, It = [];
3607
- for (const [W, ye] of U)
3608
- ye.action === "delete" && (p.has(W) ? It.push(W) : e(), U.delete(W));
3622
+ for (const [V, ye] of z)
3623
+ ye.action === "delete" && (p.has(V) ? It.push(V) : e(), z.delete(V));
3609
3624
  if (It.length > 0) {
3610
- const W = new Set(It);
3625
+ const V = new Set(It);
3611
3626
  l((ye) => ({
3612
- data: ye.data.filter((se) => !W.has(String(se.id))),
3627
+ data: ye.data.filter((se) => !V.has(String(se.id))),
3613
3628
  total: Math.max(0, ye.total - It.length)
3614
3629
  })), At.forget(It);
3615
3630
  }
3616
- if (U.size === 0) return;
3631
+ if (z.size === 0) return;
3617
3632
  const ut = Fs.current;
3618
3633
  let Gt;
3619
3634
  try {
3620
3635
  Gt = await Fd(
3621
3636
  u,
3622
3637
  n,
3623
- [...U.keys()],
3638
+ [...z.keys()],
3624
3639
  ut.conditions,
3625
3640
  ut.search
3626
3641
  );
3627
3642
  } catch {
3628
- for (const [W, ye] of U) {
3629
- if (!p.has(W)) {
3643
+ for (const [V, ye] of z) {
3644
+ if (!p.has(V)) {
3630
3645
  e();
3631
3646
  continue;
3632
3647
  }
3633
- u.request(G(`/items/${n}/${W}`)).then((se) => {
3648
+ u.request(G(`/items/${n}/${V}`)).then((se) => {
3634
3649
  const C = se == null ? void 0 : se.data;
3635
- C && (l((B) => ({
3636
- ...B,
3637
- data: B.data.map((Ne) => String(Ne.id) === W ? { ...Ne, ...C } : Ne)
3638
- })), gt(ye) || At.note([W], nt(C)));
3650
+ C && (l((Q) => ({
3651
+ ...Q,
3652
+ data: Q.data.map((Ne) => String(Ne.id) === V ? { ...Ne, ...C } : Ne)
3653
+ })), gt(ye) || At.note([V], nt(C)));
3639
3654
  }).catch(() => e());
3640
3655
  }
3641
3656
  return;
3642
3657
  }
3643
3658
  if (v) return;
3644
- const Nn = Rd(ut.conditions), Sn = ut.page === 1 && !ut.grouped, pt = /* @__PURE__ */ new Map(), M = [], at = [];
3645
- for (const [W, ye] of U) {
3646
- const se = Gt.get(W);
3647
- p.has(W) ? se ? pt.set(W, se) : M.push(W) : se && ((ye.action === "create" || !!ut.conditions && Ed(ye, Nn)) && Sn ? at.push({ row: se, ev: ye }) : e());
3659
+ const Nn = Rd(ut.conditions), Sn = ut.page === 1 && !ut.grouped, pt = /* @__PURE__ */ new Map(), A = [], at = [];
3660
+ for (const [V, ye] of z) {
3661
+ const se = Gt.get(V);
3662
+ p.has(V) ? se ? pt.set(V, se) : A.push(V) : se && ((ye.action === "create" || !!ut.conditions && Ed(ye, Nn)) && Sn ? at.push({ row: se, ev: ye }) : e());
3648
3663
  }
3649
- if (pt.size > 0 || M.length > 0 || at.length > 0) {
3650
- const W = new Set(M);
3664
+ if (pt.size > 0 || A.length > 0 || at.length > 0) {
3665
+ const V = new Set(A);
3651
3666
  l((ye) => {
3652
- const se = ye.data.filter((C) => !W.has(String(C.id))).map((C) => {
3653
- const B = pt.get(String(C.id));
3654
- return B ? { ...C, ...B } : C;
3667
+ const se = ye.data.filter((C) => !V.has(String(C.id))).map((C) => {
3668
+ const Q = pt.get(String(C.id));
3669
+ return Q ? { ...C, ...Q } : C;
3655
3670
  });
3656
3671
  return {
3657
3672
  data: [...at.map((C) => C.row), ...se],
3658
- total: Math.max(0, ye.total - M.length + at.length)
3673
+ total: Math.max(0, ye.total - A.length + at.length)
3659
3674
  };
3660
3675
  });
3661
3676
  }
3662
- M.length > 0 && At.forget(M);
3663
- for (const [W] of pt) {
3664
- const ye = U.get(W), se = nt(pt.get(W));
3665
- ye && !gt(ye) && se !== "self" && At.note([W], se);
3677
+ A.length > 0 && At.forget(A);
3678
+ for (const [V] of pt) {
3679
+ const ye = z.get(V), se = nt(pt.get(V));
3680
+ ye && !gt(ye) && se !== "self" && At.note([V], se);
3666
3681
  }
3667
- for (const { row: W, ev: ye } of at) {
3668
- const se = String(W.id);
3669
- nt(W) !== "self" && At.note([se], nt(W), "create");
3682
+ for (const { row: V, ev: ye } of at) {
3683
+ const se = String(V.id);
3684
+ nt(V) !== "self" && At.note([se], nt(V), "create");
3670
3685
  }
3671
- }, j = (D) => {
3672
- for (const U of D.flatMap((J) => $d(J))) {
3673
- const J = U.changed_fields;
3674
- if (!U.action && (J != null && J.length) && J.every((p) => p.startsWith("$"))) {
3675
- (String(U.item) === "*" || ar.current.has(String(U.item))) && s(J);
3686
+ }, j = (P) => {
3687
+ for (const z of P.flatMap((J) => $d(J))) {
3688
+ const J = z.changed_fields;
3689
+ if (!z.action && (J != null && J.length) && J.every((p) => p.startsWith("$"))) {
3690
+ (String(z.item) === "*" || ar.current.has(String(z.item))) && s(J);
3676
3691
  continue;
3677
3692
  }
3678
- i.push(U);
3693
+ i.push(z);
3679
3694
  }
3680
- i.length > 0 && !b && (b = setTimeout(() => void Q(), 300));
3695
+ i.length > 0 && !b && (b = setTimeout(() => void U(), 300));
3681
3696
  }, Le = nr.subscribeCollections(
3682
3697
  [n],
3683
- (D) => id(rr, [D], j)
3698
+ (P) => id(rr, [P], j)
3684
3699
  );
3685
3700
  return () => {
3686
3701
  v = !0, Le(), dd(rr), r && clearTimeout(r), b && clearTimeout(b), x && clearTimeout(x);
@@ -3714,7 +3729,7 @@ function X0({
3714
3729
  }), Qe = Ce.map((e) => String(e.id)).join(","), Mo = be(
3715
3730
  () => Ce.map((e) => ({ collection: n, id: e.id })),
3716
3731
  [Ce, n]
3717
- ), Ao = vu(Mo, wt), or = !!(A != null && A.addendums_enabled), { data: ir } = ne({
3732
+ ), Ao = vu(Mo, wt), or = !!(I != null && I.addendums_enabled), { data: ir } = ne({
3718
3733
  queryKey: ["cbv-addendum-summary", n, Qe],
3719
3734
  queryFn: () => u.request(
3720
3735
  he("/addendums/summary", { collection: n, ids: Qe.split(",") })
@@ -3823,7 +3838,7 @@ function X0({
3823
3838
  const r = t.includes(".") ? t : Je[t];
3824
3839
  if (!r) return null;
3825
3840
  const s = (i = Te == null ? void 0 : Te.targets) == null ? void 0 : i[r], l = ((v = (x = (b = Te == null ? void 0 : Te.rows) == null ? void 0 : b[String(e)]) == null ? void 0 : x[r]) == null ? void 0 : v.ids) ?? [];
3826
- return !s || Rt(s) || l.length === 0 ? null : { target: s, id: String(l[0]) };
3841
+ return !s || Tt(s) || l.length === 0 ? null : { target: s, id: String(l[0]) };
3827
3842
  }, Qt = (e) => e.includes(".") || e in Je;
3828
3843
  ws.current = (e) => Gi({
3829
3844
  qc: y,
@@ -3841,7 +3856,7 @@ function X0({
3841
3856
  if (e.includes(".")) return { kind: "text", path: e.split(".") };
3842
3857
  const t = ot(Xe, n, e);
3843
3858
  if (t != null && t.one_collection)
3844
- return Rt(t.one_collection) && t.one_collection !== "nivaro_users" ? null : { kind: "in", target: t.one_collection };
3859
+ return Tt(t.one_collection) && t.one_collection !== "nivaro_users" ? null : { kind: "in", target: t.one_collection };
3845
3860
  const r = fs[e];
3846
3861
  if (r) {
3847
3862
  if (r.kind === "m2m") return { kind: "in", target: r.target };
@@ -3854,22 +3869,22 @@ function X0({
3854
3869
  const s = { ...r };
3855
3870
  return t ? s[e] = t : delete s[e], s;
3856
3871
  }), Bo = (e) => {
3857
- var b, x, v, Q;
3872
+ var b, x, v, U;
3858
3873
  const { key: t, row: r, cellText: s } = e, l = r.id;
3859
3874
  if (t === "__state__") {
3860
3875
  const j = (b = Ee == null ? void 0 : Ee.instances) == null ? void 0 : b[String(l)];
3861
3876
  if (!(j != null && j.state_key)) return;
3862
- const Le = He.__state__, D = (Le == null ? void 0 : Le.kind) === "state" ? Le.value : [];
3863
- Ue("__state__", { kind: "state", value: [.../* @__PURE__ */ new Set([...D, j.state_key])] });
3877
+ const Le = He.__state__, P = (Le == null ? void 0 : Le.kind) === "state" ? Le.value : [];
3878
+ Ue("__state__", { kind: "state", value: [.../* @__PURE__ */ new Set([...P, j.state_key])] });
3864
3879
  return;
3865
3880
  }
3866
3881
  const i = yn(t);
3867
3882
  if (i) {
3868
3883
  if (i.kind === "in") {
3869
- const Le = ot(Xe, n, t) ? r[t] != null ? [r[t]] : [] : ((Q = (v = (x = Te == null ? void 0 : Te.rows) == null ? void 0 : x[String(l)]) == null ? void 0 : v[Je[t]]) == null ? void 0 : Q.ids) ?? [];
3884
+ const Le = ot(Xe, n, t) ? r[t] != null ? [r[t]] : [] : ((U = (v = (x = Te == null ? void 0 : Te.rows) == null ? void 0 : x[String(l)]) == null ? void 0 : v[Je[t]]) == null ? void 0 : U.ids) ?? [];
3870
3885
  if (Le.length === 0) return;
3871
- const D = He[t], U = (D == null ? void 0 : D.kind) === "in" ? D.value : [];
3872
- Ue(t, { kind: "in", value: [.../* @__PURE__ */ new Set([...U, ...Le])] });
3886
+ const P = He[t], z = (P == null ? void 0 : P.kind) === "in" ? P.value : [];
3887
+ Ue(t, { kind: "in", value: [.../* @__PURE__ */ new Set([...z, ...Le])] });
3873
3888
  return;
3874
3889
  }
3875
3890
  if (i.kind === "enum") {
@@ -3925,11 +3940,11 @@ function X0({
3925
3940
  const b = /* @__PURE__ */ new Set(), x = Je[e];
3926
3941
  for (const v of Ce)
3927
3942
  if (x)
3928
- for (const Q of ((i = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(v.id)]) == null ? void 0 : l[x]) == null ? void 0 : i.ids) ?? [])
3929
- b.add(Q);
3943
+ for (const U of ((i = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(v.id)]) == null ? void 0 : l[x]) == null ? void 0 : i.ids) ?? [])
3944
+ b.add(U);
3930
3945
  else v[e] != null && v[e] !== "" && typeof v[e] != "object" && b.add(v[e]);
3931
3946
  return /* @__PURE__ */ a(
3932
- Bu,
3947
+ Qu,
3933
3948
  {
3934
3949
  target: t.target,
3935
3950
  selected: (r == null ? void 0 : r.kind) === "in" ? r.value : [],
@@ -3940,7 +3955,7 @@ function X0({
3940
3955
  }
3941
3956
  if (t.kind === "enum")
3942
3957
  return /* @__PURE__ */ a(
3943
- Qu,
3958
+ Uu,
3944
3959
  {
3945
3960
  collection: n,
3946
3961
  field: e,
@@ -4000,7 +4015,7 @@ function X0({
4000
4015
  className: "w-full"
4001
4016
  }
4002
4017
  ) : t.kind === "date" ? /* @__PURE__ */ a(
4003
- Uu,
4018
+ zu,
4004
4019
  {
4005
4020
  value: (r == null ? void 0 : r.kind) === "date" ? r.value : "",
4006
4021
  onChange: (b) => Ue(e, b ? { kind: "date", value: b } : null)
@@ -4021,8 +4036,8 @@ function X0({
4021
4036
  var l, i, b;
4022
4037
  const s = xe[t];
4023
4038
  if ((s == null ? void 0 : s.type) === "count") {
4024
- const x = t.includes(".") ? t : Je[t], v = r != null && x ? (b = (i = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(r)]) == null ? void 0 : i[x]) == null ? void 0 : b.ids : void 0, Q = cd(e === "—" ? "" : e, v);
4025
- return String(Q);
4039
+ const x = t.includes(".") ? t : Je[t], v = r != null && x ? (b = (i = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(r)]) == null ? void 0 : i[x]) == null ? void 0 : b.ids : void 0, U = cd(e === "—" ? "" : e, v);
4040
+ return String(U);
4026
4041
  }
4027
4042
  return s && e && e !== "—" ? Ll(e, s) : e;
4028
4043
  }, Is = (e) => {
@@ -4069,12 +4084,12 @@ function X0({
4069
4084
  k(b);
4070
4085
  const x = i.filter((p) => p.includes(".") || St.has(p) || !!b[p]);
4071
4086
  x.length > 0 && rt(x);
4072
- const v = {}, Q = {}, j = {};
4087
+ const v = {}, U = {}, j = {};
4073
4088
  let Le = !1;
4074
- const D = {}, U = {}, J = {};
4089
+ const P = {}, z = {}, J = {};
4075
4090
  for (const p of e.columns)
4076
- typeof p != "string" && p.label && (v[p.key] = p.label), typeof p != "string" && p.format && (Q[p.key] = p.format), typeof p != "string" && p.pin && (Le = !0, p.pin !== "none" && (j[p.key] = p.pin)), typeof p != "string" && ((s = p.tint) != null && s.length) && (D[p.key] = p.tint), typeof p != "string" && p.width && (U[p.key] = p.width), typeof p != "string" && p.agg && (J[p.key] = p.agg);
4077
- mt(J), Oe(v), st(Q), te(D), f(U), oa(Le ? j : null);
4091
+ typeof p != "string" && p.label && (v[p.key] = p.label), typeof p != "string" && p.format && (U[p.key] = p.format), typeof p != "string" && p.pin && (Le = !0, p.pin !== "none" && (j[p.key] = p.pin)), typeof p != "string" && ((s = p.tint) != null && s.length) && (P[p.key] = p.tint), typeof p != "string" && p.width && (z[p.key] = p.width), typeof p != "string" && p.agg && (J[p.key] = p.agg);
4092
+ mt(J), Oe(v), st(U), te(P), f(z), oa(Le ? j : null);
4078
4093
  } else
4079
4094
  oa(null);
4080
4095
  T(1);
@@ -4123,7 +4138,7 @@ function X0({
4123
4138
  if (Ka.current || dt.length === 0 || Pt.length === 0) return;
4124
4139
  Ka.current = !0;
4125
4140
  const e = dt.find((t) => t.role_default) ?? dt.find((t) => t.is_default);
4126
- e && Ht == null && (ba(e), P && T(P));
4141
+ e && Ht == null && (ba(e), O && T(O));
4127
4142
  }, [dt, Pt]);
4128
4143
  const { data: Bs = [] } = ne({
4129
4144
  queryKey: ["cbv-export-presets", n],
@@ -4179,7 +4194,7 @@ function X0({
4179
4194
  ex: Pn,
4180
4195
  ...ce ? { g: ce } : {},
4181
4196
  ps: Ye,
4182
- ...O > 1 ? { p: O } : {},
4197
+ ...M > 1 ? { p: M } : {},
4183
4198
  ...vn ? { a: !0 } : {}
4184
4199
  };
4185
4200
  }, ga = qt({
@@ -4246,9 +4261,9 @@ function X0({
4246
4261
  Qr(!0);
4247
4262
  try {
4248
4263
  const { rows: r, truncated: s } = await Fc(
4249
- (C, B) => u.request(
4264
+ (C, Q) => u.request(
4250
4265
  G(`/items/${n}`, {
4251
- limit: B,
4266
+ limit: Q,
4252
4267
  offset: C,
4253
4268
  ...Y ? { search: Y } : {},
4254
4269
  sort: Rc(X),
@@ -4258,16 +4273,16 @@ function X0({
4258
4273
  ), l = ve, i = [], b = [];
4259
4274
  for (const C of l) {
4260
4275
  if (C.includes(".") || C.startsWith("__") || C in Je) continue;
4261
- const B = (e = ot(Xe, n, C)) == null ? void 0 : e.one_collection;
4262
- if (!B) continue;
4263
- if (to.has(B)) {
4276
+ const Q = (e = ot(Xe, n, C)) == null ? void 0 : e.one_collection;
4277
+ if (!Q) continue;
4278
+ if (to.has(Q)) {
4264
4279
  b.push(C);
4265
4280
  continue;
4266
4281
  }
4267
- if (Rt(B)) continue;
4282
+ if (Tt(Q)) continue;
4268
4283
  const Ne = await y.fetchQuery({
4269
- queryKey: ["cbv-collection-meta", B],
4270
- queryFn: () => u.request(G(`/collections/${B}`)).then((De) => De.data),
4284
+ queryKey: ["cbv-collection-meta", Q],
4285
+ queryFn: () => u.request(G(`/collections/${Q}`)).then((De) => De.data),
4271
4286
  staleTime: 10 * 6e4
4272
4287
  }).catch(() => {
4273
4288
  });
@@ -4280,86 +4295,86 @@ function X0({
4280
4295
  const x = [.../* @__PURE__ */ new Set([...Vn, ...i.flatMap(Ec)])], v = await Dc(
4281
4296
  r.map((C) => String(C.id)),
4282
4297
  x,
4283
- (C, B) => u.request(
4298
+ (C, Q) => u.request(
4284
4299
  G(`/items/${n}/resolve-paths`, {
4285
4300
  ids: C.join(","),
4286
- paths: B.join(",")
4301
+ paths: Q.join(",")
4287
4302
  })
4288
4303
  ).then((Ne) => {
4289
4304
  var De;
4290
4305
  return ((De = Ne.data) == null ? void 0 : De.rows) ?? {};
4291
4306
  })
4292
- ), Q = [
4307
+ ), U = [
4293
4308
  ...new Set(
4294
- b.flatMap((C) => r.map((B) => B[C]).filter((B) => B != null && B !== ""))
4309
+ b.flatMap((C) => r.map((Q) => Q[C]).filter((Q) => Q != null && Q !== ""))
4295
4310
  )
4296
4311
  ].map(String), j = /* @__PURE__ */ new Map();
4297
4312
  await Promise.all(
4298
- Q.map(
4299
- (C) => dc(u, C).then((B) => j.set(C.toUpperCase(), Pc(B, C))).catch(() => j.set(C.toUpperCase(), C))
4313
+ U.map(
4314
+ (C) => dc(u, C).then((Q) => j.set(C.toUpperCase(), Pc(Q, C))).catch(() => j.set(C.toUpperCase(), C))
4300
4315
  )
4301
4316
  );
4302
- const Le = new Map(i.map((C) => [C.column, C])), D = new Set(b), U = (C) => {
4303
- const B = C == null ? "" : String(typeof C == "object" ? JSON.stringify(C) : C);
4304
- return /[",\n]/.test(B) ? `"${B.replace(/"/g, '""')}"` : B;
4305
- }, J = (C, B) => {
4317
+ const Le = new Map(i.map((C) => [C.column, C])), P = new Set(b), z = (C) => {
4318
+ const Q = C == null ? "" : String(typeof C == "object" ? JSON.stringify(C) : C);
4319
+ return /[",\n]/.test(Q) ? `"${Q.replace(/"/g, '""')}"` : Q;
4320
+ }, J = (C, Q) => {
4306
4321
  var vl, kl;
4307
- const Ne = xe[B];
4308
- if (B.startsWith("__f:")) {
4309
- const ka = We[B], Cn = ka ? Tl(ka, (Nr) => {
4322
+ const Ne = xe[Q];
4323
+ if (Q.startsWith("__f:")) {
4324
+ const ka = We[Q], Cn = ka ? Tl(ka, (Nr) => {
4310
4325
  var yl, wl;
4311
4326
  const ya = Nr.includes(".") ? (wl = (yl = v[String(C.id)]) == null ? void 0 : yl[Nr]) == null ? void 0 : wl.value : C[Nr];
4312
4327
  return typeof ya == "string" && /^-?\d+(\.\d+)?$/.test(ya.trim()) ? Number(ya) : ya;
4313
4328
  }) : null;
4314
4329
  return Cn == null ? "" : Math.round(Cn * 100) / 100;
4315
4330
  }
4316
- if (B.includes(".") || B in Je) {
4317
- const ka = B.includes(".") ? B : Je[B], Cn = ((kl = (vl = v[String(C.id)]) == null ? void 0 : vl[ka]) == null ? void 0 : kl.value) ?? "";
4331
+ if (Q.includes(".") || Q in Je) {
4332
+ const ka = Q.includes(".") ? Q : Je[Q], Cn = ((kl = (vl = v[String(C.id)]) == null ? void 0 : vl[ka]) == null ? void 0 : kl.value) ?? "";
4318
4333
  return Ne && Cn ? Ll(Cn, Ne) : Cn;
4319
4334
  }
4320
- const De = C[B], xl = Le.get(B);
4321
- return xl && De != null && De !== "" ? Oc(xl, v[String(C.id)]) || De : D.has(B) && De != null && De !== "" ? j.get(String(De).toUpperCase()) ?? De : De != null && De !== "" && ((Ne == null ? void 0 : Ne.type) === "number" || mr(B)) ? Wi(De) : De != null && De !== "" && ((Ne == null ? void 0 : Ne.type) === "datetime" || Vo(B)) ? Vi(De) : B === "id" ? Tr(A, C) ?? De : Ne && De != null ? Gn(String(De), Ne) : De;
4335
+ const De = C[Q], xl = Le.get(Q);
4336
+ return xl && De != null && De !== "" ? Oc(xl, v[String(C.id)]) || De : P.has(Q) && De != null && De !== "" ? j.get(String(De).toUpperCase()) ?? De : De != null && De !== "" && ((Ne == null ? void 0 : Ne.type) === "number" || mr(Q)) ? Wi(De) : De != null && De !== "" && ((Ne == null ? void 0 : Ne.type) === "datetime" || Vo(Q)) ? Vi(De) : Q === "id" ? Tr(I, C) ?? De : Ne && De != null ? Gn(String(De), Ne) : De;
4322
4337
  }, p = Jt.filter((C) => C.kind !== "actions"), gt = new Set(
4323
4338
  p.filter((C) => C.kind !== "data" && C.kind !== "formula").map((C) => C.kind)
4324
4339
  ), nt = r.map((C) => String(C.id)), It = await Hi(nt, gt, {
4325
4340
  instances: (C) => u.request(
4326
4341
  G(`/pipelines/instances/${n}`, { ids: C.join(",") })
4327
- ).then((B) => {
4342
+ ).then((Q) => {
4328
4343
  var Ne;
4329
- return ((Ne = B.data) == null ? void 0 : Ne.instances) ?? {};
4344
+ return ((Ne = Q.data) == null ? void 0 : Ne.instances) ?? {};
4330
4345
  }),
4331
4346
  owners: (C) => u.request(
4332
4347
  he(`/pipelines/instance/${n}/owners/batch`, { ids: C })
4333
- ).then((B) => B.data ?? {}),
4348
+ ).then((Q) => Q.data ?? {}),
4334
4349
  addendums: (C) => u.request(
4335
4350
  he("/addendums/summary", { collection: n, ids: C })
4336
- ).then((B) => B.data ?? {}),
4351
+ ).then((Q) => Q.data ?? {}),
4337
4352
  integrations: (C) => u.request(
4338
4353
  he("/integration-obligations/summary", { collection: n, ids: C })
4339
- ).then((B) => B.data ?? {}),
4354
+ ).then((Q) => Q.data ?? {}),
4340
4355
  tasks: (C) => u.request(
4341
4356
  he("/tasks/counts", { collection: n, ids: C })
4342
- ).then((B) => B.data ?? {})
4343
- }), ut = Jd(A), Gt = ut ? l.includes(ut) || l.includes("id") ? [] : [{ header: et(ut), cell: (C) => C[ut] }] : l.includes("id") ? [] : [{ header: "ID", cell: (C) => C.id }], Nn = (C) => C.kind === "data" || C.kind === "formula" ? et(C.key) : C.kind === "fulfilment" && (Fe != null && Fe.label) ? `${Fe.label} shipped` : Yi[C.kind], Sn = Date.now(), pt = [
4344
- [...Gt.map((C) => C.header), ...p.map(Nn)].map(U).join(","),
4357
+ ).then((Q) => Q.data ?? {})
4358
+ }), ut = Jd(I), Gt = ut ? l.includes(ut) || l.includes("id") ? [] : [{ header: et(ut), cell: (C) => C[ut] }] : l.includes("id") ? [] : [{ header: "ID", cell: (C) => C.id }], Nn = (C) => C.kind === "data" || C.kind === "formula" ? et(C.key) : C.kind === "fulfilment" && (Fe != null && Fe.label) ? `${Fe.label} shipped` : Yi[C.kind], Sn = Date.now(), pt = [
4359
+ [...Gt.map((C) => C.header), ...p.map(Nn)].map(z).join(","),
4345
4360
  ...r.map(
4346
4361
  (C) => [
4347
- ...Gt.map((B) => B.cell(C)),
4362
+ ...Gt.map((Q) => Q.cell(C)),
4348
4363
  ...p.map(
4349
- (B) => B.kind === "data" || B.kind === "formula" ? J(C, B.key) : Ji(B.kind, String(C.id), It, C, {
4364
+ (Q) => Q.kind === "data" || Q.kind === "formula" ? J(C, Q.key) : Ji(Q.kind, String(C.id), It, C, {
4350
4365
  now: Sn,
4351
4366
  fulfilment: Fe
4352
4367
  })
4353
4368
  )
4354
- ].map(U).join(",")
4369
+ ].map(z).join(",")
4355
4370
  )
4356
4371
  ];
4357
4372
  s && (pt.push(""), pt.push(
4358
- U(
4373
+ z(
4359
4374
  `First ${r.length.toLocaleString()} of ${Re.toLocaleString()} rows — narrow the filter to export the rest`
4360
4375
  )
4361
- )), A != null && A.export_watermark && (pt.push(""), pt.push(
4362
- U(`Exported ${(/* @__PURE__ */ new Date()).toISOString()} · ${r.length} rows · ${n} · Nivaro`)
4376
+ )), I != null && I.export_watermark && (pt.push(""), pt.push(
4377
+ z(`Exported ${(/* @__PURE__ */ new Date()).toISOString()} · ${r.length} rows · ${n} · Nivaro`)
4363
4378
  )), u.request(
4364
4379
  he("/activity/export-log", {
4365
4380
  collection: n,
@@ -4369,11 +4384,11 @@ function X0({
4369
4384
  })
4370
4385
  ).catch(() => {
4371
4386
  });
4372
- const M = new Blob([pt.join(`
4373
- `)], { type: "text/csv;charset=utf-8" }), at = URL.createObjectURL(M), W = document.createElement("a");
4374
- W.href = at;
4387
+ const A = new Blob([pt.join(`
4388
+ `)], { type: "text/csv;charset=utf-8" }), at = URL.createObjectURL(A), V = document.createElement("a");
4389
+ V.href = at;
4375
4390
  const ye = Pe.export_filename, se = ((t = dt.find((C) => C.id === Ht)) == null ? void 0 : t.name) ?? "all";
4376
- W.download = ye ? `${ye.replace(/\{\{\s*collection\s*\}\}/g, n).replace(/\{\{\s*view\s*\}\}/g, se).replace(/\{\{\s*date\s*\}\}/g, Mc()).replace(/[^A-Za-z0-9 ._-]/g, "")}.csv` : `${n}.csv`, W.click(), setTimeout(() => URL.revokeObjectURL(at), 1e4), s && ge.warning(`Exported the first ${r.length.toLocaleString()} rows`, {
4391
+ V.download = ye ? `${ye.replace(/\{\{\s*collection\s*\}\}/g, n).replace(/\{\{\s*view\s*\}\}/g, se).replace(/\{\{\s*date\s*\}\}/g, Mc()).replace(/[^A-Za-z0-9 ._-]/g, "")}.csv` : `${n}.csv`, V.click(), setTimeout(() => URL.revokeObjectURL(at), 1e4), s && ge.warning(`Exported the first ${r.length.toLocaleString()} rows`, {
4377
4392
  description: `${Re.toLocaleString()} match — narrow the filter to export the rest.`
4378
4393
  });
4379
4394
  } catch (r) {
@@ -4396,13 +4411,13 @@ function X0({
4396
4411
  },
4397
4412
  onClick: (r) => {
4398
4413
  if (r.metaKey || r.ctrlKey) {
4399
- r.preventDefault(), window.open(F({ collection: n, itemId: String(e) }), "_blank", "noopener");
4414
+ r.preventDefault(), window.open(R({ collection: n, itemId: String(e) }), "_blank", "noopener");
4400
4415
  return;
4401
4416
  }
4402
4417
  dn(e);
4403
4418
  },
4404
4419
  onAuxClick: (r) => {
4405
- r.button === 1 && (r.preventDefault(), window.open(F({ collection: n, itemId: String(e) }), "_blank", "noopener"));
4420
+ r.button === 1 && (r.preventDefault(), window.open(R({ collection: n, itemId: String(e) }), "_blank", "noopener"));
4406
4421
  },
4407
4422
  onKeyDown: (r) => {
4408
4423
  var b, x;
@@ -4427,20 +4442,20 @@ function X0({
4427
4442
  type: "record",
4428
4443
  collection: n,
4429
4444
  item: e === "new" ? null : e
4430
- }), N ? N(e) : z({ collection: n, itemId: String(e) });
4445
+ }), S ? S(e) : W({ collection: n, itemId: String(e) });
4431
4446
  }, Ys = (e) => {
4432
4447
  const t = ot(Xe, n, e), r = (s) => {
4433
4448
  $e(ac(X, s, Pe.default_sort ?? "")), T(1);
4434
4449
  };
4435
- if (t != null && t.one_collection && !Rt(t.one_collection)) {
4450
+ if (t != null && t.one_collection && !Tt(t.one_collection)) {
4436
4451
  const s = t.one_collection;
4437
4452
  y.fetchQuery({
4438
4453
  queryKey: ["collection-meta", s],
4439
4454
  queryFn: () => u.request(G(`/collections/${s}`)).then((l) => l.data),
4440
4455
  staleTime: 6e4
4441
4456
  }).then((l) => {
4442
- var Q;
4443
- const b = (Q = ((l == null ? void 0 : l.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : Q[1], x = ((l == null ? void 0 : l.fields) ?? []).map((j) => j.field), v = (b && x.includes(b) ? b : null) ?? x.find(
4457
+ var U;
4458
+ const b = (U = ((l == null ? void 0 : l.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : U[1], x = ((l == null ? void 0 : l.fields) ?? []).map((j) => j.field), v = (b && x.includes(b) ? b : null) ?? x.find(
4444
4459
  (j) => ["name", "title", "label", "short_name", "subject"].includes(j.toLowerCase())
4445
4460
  ) ?? null;
4446
4461
  r(v ? `${e}.${v}` : e);
@@ -4465,7 +4480,7 @@ function X0({
4465
4480
  } finally {
4466
4481
  Gs(!1);
4467
4482
  }
4468
- }, ci = Re === 0 && !Bt ? 0 : (O - 1) * Ye + 1, ui = Bt ? (O - 1) * Ye + Ce.length : Math.min(O * Ye, Re), Yn = !!(Ee != null && Ee.instances), Xs = (Ot ? 1 : 0) + (Yn ? 2 : 0) + (Jr ? 1 : 0), gr = [
4483
+ }, ci = Re === 0 && !Bt ? 0 : (M - 1) * Ye + 1, ui = Bt ? (M - 1) * Ye + Ce.length : Math.min(M * Ye, Re), Yn = !!(Ee != null && Ee.instances), Xs = (Ot ? 1 : 0) + (Yn ? 2 : 0) + (Jr ? 1 : 0), gr = [
4469
4484
  ...ve.map(
4470
4485
  (e) => e.startsWith("__f:") ? { key: e, kind: "formula" } : { key: e, kind: "data" }
4471
4486
  ),
@@ -4483,15 +4498,15 @@ function X0({
4483
4498
  ...Rs ? [{ key: "__tasks__", kind: "tasks" }] : [],
4484
4499
  ...Jr ? [{ key: "__actions__", kind: "actions" }] : []
4485
4500
  ], Jt = [
4486
- ...gr.filter((e) => Lt(e.key) === "left"),
4487
- ...gr.filter((e) => !Lt(e.key)),
4488
- ...gr.filter((e) => Lt(e.key) === "right")
4501
+ ...gr.filter((e) => Ft(e.key) === "left"),
4502
+ ...gr.filter((e) => !Ft(e.key)),
4503
+ ...gr.filter((e) => Ft(e.key) === "right")
4489
4504
  ], pi = Jt.map((e) => {
4490
4505
  if (e.kind === "data") {
4491
4506
  const t = St.get(e.key.split(".")[0]);
4492
4507
  return { key: e.key, shape: tc(t == null ? void 0 : t.type, t == null ? void 0 : t.interface) };
4493
4508
  }
4494
- return { key: e.key, shape: np[e.kind] ?? "short" };
4509
+ return { key: e.key, shape: ap[e.kind] ?? "short" };
4495
4510
  }), Zs = [
4496
4511
  ...Yn ? [{ key: "__state__", label: "State" }] : [],
4497
4512
  ...ve.filter((e) => Qt(e) || !ot(Xe, n, e)).map((e) => ({ key: e, label: et(e) }))
@@ -4519,7 +4534,7 @@ function X0({
4519
4534
  if (r.push({ kind: "header", gkey: s, label: s, count: l.length }), !En.has(s)) for (const i of l) r.push({ kind: "row", row: i });
4520
4535
  }
4521
4536
  return r;
4522
- })(), [fi, bi] = _(null), hi = Bc(el, fi), xr = Jt.filter((e) => Lt(e.key) === "left").map((e) => e.key), tl = Jt.filter((e) => Lt(e.key) === "right").map((e) => e.key), vr = pe(/* @__PURE__ */ new Map()), [Jn, gi] = _({});
4537
+ })(), [fi, bi] = _(null), hi = Bc(el, fi), xr = Jt.filter((e) => Ft(e.key) === "left").map((e) => e.key), tl = Jt.filter((e) => Ft(e.key) === "right").map((e) => e.key), vr = pe(/* @__PURE__ */ new Map()), [Jn, gi] = _({});
4523
4538
  Oi(() => {
4524
4539
  const e = {};
4525
4540
  for (const [r, s] of vr.current)
@@ -4532,7 +4547,7 @@ function X0({
4532
4547
  }
4533
4548
  });
4534
4549
  const xi = 52, nl = (e) => {
4535
- if (Lt(e) === "left") {
4550
+ if (Ft(e) === "left") {
4536
4551
  let s = Ot ? Jn.__checkbox__ ?? xi : 0;
4537
4552
  for (const l of xr) {
4538
4553
  if (l === e) break;
@@ -4547,12 +4562,12 @@ function X0({
4547
4562
  }
4548
4563
  return Math.floor(r);
4549
4564
  }, ct = (e, t, r) => {
4550
- const s = Lt(e);
4565
+ const s = Ft(e);
4551
4566
  if (!s) return "";
4552
4567
  const l = s === "left" && xr[xr.length - 1] === e ? "border-r border-slate-200 dark:border-slate-700" : s === "right" && tl[0] === e ? "border-l border-slate-200 dark:border-slate-700" : "";
4553
4568
  return `sticky ${t} ${r} ${l}`;
4554
4569
  }, Me = (e) => {
4555
- const t = Lt(e);
4570
+ const t = Ft(e);
4556
4571
  if (t)
4557
4572
  return t === "left" ? { left: nl(e) } : { right: nl(e) };
4558
4573
  }, kr = (e) => (t) => {
@@ -4596,7 +4611,7 @@ function X0({
4596
4611
  className: "absolute right-0 top-0 h-full w-1.5 cursor-col-resize opacity-0 transition-opacity hover:bg-nvr-cyan/40 hover:opacity-100 group-hover/hcell:opacity-60"
4597
4612
  }
4598
4613
  ), rl = (e) => Et[e] ? { width: Et[e], minWidth: Et[e], maxWidth: Et[e] } : void 0, sl = (e) => {
4599
- const t = Lt(e);
4614
+ const t = Ft(e);
4600
4615
  return /* @__PURE__ */ a(
4601
4616
  "button",
4602
4617
  {
@@ -4645,9 +4660,9 @@ function X0({
4645
4660
  var s, l, i, b;
4646
4661
  if (ae) return null;
4647
4662
  let e = !1;
4648
- const t = (x, v, Q, j = !1) => {
4649
- const Le = v.map(Q);
4650
- return Le.every((D) => !!D) ? { kind: "is", field: x, values: Le, not: j } : (e = !0, { kind: "is", field: x, values: [], count: v.length, not: j });
4663
+ const t = (x, v, U, j = !1) => {
4664
+ const Le = v.map(U);
4665
+ return Le.every((P) => !!P) ? { kind: "is", field: x, values: Le, not: j } : (e = !0, { kind: "is", field: x, values: [], count: v.length, not: j });
4651
4666
  }, r = [];
4652
4667
  for (const x of Be) {
4653
4668
  const v = x.pathLabels.join(" › ") || x.path.join(".");
@@ -4655,80 +4670,80 @@ function X0({
4655
4670
  r.push({ kind: "phrase", text: `${x.not ? "not " : ""}${v.toLowerCase()}` });
4656
4671
  continue;
4657
4672
  }
4658
- const Q = x.fieldType ?? "", j = qr({
4673
+ const U = x.fieldType ?? "", j = qr({
4659
4674
  field: v,
4660
4675
  op: x.op,
4661
4676
  value: x.value,
4662
4677
  valueLabels: x.valueLabels,
4663
4678
  not: x.not,
4664
- kind: Q === "boolean" ? "boolean" : Q === "date" || Q === "datetime" || Q === "timestamp" ? "date" : ["integer", "decimal", "float", "bigInteger"].includes(Q) ? "number" : "text"
4679
+ kind: U === "boolean" ? "boolean" : U === "date" || U === "datetime" || U === "timestamp" ? "date" : ["integer", "decimal", "float", "bigInteger"].includes(U) ? "number" : "text"
4665
4680
  });
4666
4681
  j && r.push(j);
4667
4682
  }
4668
4683
  for (const x of Nt) {
4669
4684
  const v = ft[x.key] ?? [];
4670
4685
  if (v.length === 0) continue;
4671
- const Q = ["cbv-quick-options", x.collection, x.value_field ?? "id", x.label_field];
4672
- r.push(t(x.label, v, (j) => wr(Q, j)));
4686
+ const U = ["cbv-quick-options", x.collection, x.value_field ?? "id", x.label_field];
4687
+ r.push(t(x.label, v, (j) => wr(U, j)));
4673
4688
  }
4674
4689
  for (const [x, v] of Object.entries(Ya)) {
4675
4690
  if (!v) continue;
4676
- const Q = x === "__state__" ? "State" : x === "__fulfilment__" ? (Fe == null ? void 0 : Fe.label) ?? "Shipped" : x === "__integrations__" ? "Integrations" : x === "__aging__" ? "Time in state" : et(x), j = xe[x], Le = (j == null ? void 0 : j.type) === "number" && j.prefix === "$";
4691
+ const U = x === "__state__" ? "State" : x === "__fulfilment__" ? (Fe == null ? void 0 : Fe.label) ?? "Shipped" : x === "__integrations__" ? "Integrations" : x === "__aging__" ? "Time in state" : et(x), j = xe[x], Le = (j == null ? void 0 : j.type) === "number" && j.prefix === "$";
4677
4692
  if (v.kind === "in" && v.value.length) {
4678
- const D = Ar(Xe, n, x), U = (D == null ? void 0 : D.one_collection) ?? null, J = fs[x], p = U ?? ((J == null ? void 0 : J.kind) === "m2m" ? J.target : null);
4693
+ const P = Ar(Xe, n, x), z = (P == null ? void 0 : P.one_collection) ?? null, J = fs[x], p = z ?? ((J == null ? void 0 : J.kind) === "m2m" ? J.target : null);
4679
4694
  r.push(
4680
4695
  p ? t(
4681
- Q,
4696
+ U,
4682
4697
  v.value,
4683
4698
  (gt) => wr(["cbv-filter-options", p], gt) ?? wr(["cbv-filter-selected-labels", p], gt)
4684
- ) : { kind: "is", field: Q, values: v.value.map((gt) => je(String(gt))) }
4699
+ ) : { kind: "is", field: U, values: v.value.map((gt) => je(String(gt))) }
4685
4700
  );
4686
4701
  } else if (v.kind === "state" && v.value.length)
4687
4702
  r.push({
4688
4703
  kind: "is",
4689
- field: Q,
4704
+ field: U,
4690
4705
  values: v.value.map(
4691
- (D) => {
4692
- var U, J;
4693
- return ((J = (U = Ct == null ? void 0 : Ct.states) == null ? void 0 : U.find((p) => p.key === D)) == null ? void 0 : J.label) ?? je(D);
4706
+ (P) => {
4707
+ var z, J;
4708
+ return ((J = (z = Ct == null ? void 0 : Ct.states) == null ? void 0 : z.find((p) => p.key === P)) == null ? void 0 : J.label) ?? je(P);
4694
4709
  }
4695
4710
  )
4696
4711
  });
4697
4712
  else if (v.kind === "fulfilment" && Fe) {
4698
- const D = (l = Ml.find((U) => U.value === v.value)) == null ? void 0 : l.label;
4699
- D && r.push({ kind: "phrase", text: D.toLowerCase() });
4713
+ const P = (l = Ml.find((z) => z.value === v.value)) == null ? void 0 : l.label;
4714
+ P && r.push({ kind: "phrase", text: P.toLowerCase() });
4700
4715
  } else if (v.kind === "integrations") {
4701
- const D = (i = Al.find((U) => U.value === v.value)) == null ? void 0 : i.label;
4702
- D && r.push({ kind: "is", field: Q, values: [D.toLowerCase()] });
4716
+ const P = (i = Al.find((z) => z.value === v.value)) == null ? void 0 : i.label;
4717
+ P && r.push({ kind: "is", field: U, values: [P.toLowerCase()] });
4703
4718
  } else if (v.kind === "tasks")
4704
4719
  r.push({
4705
4720
  kind: "phrase",
4706
4721
  text: v.value === "none" ? "with no open tasks" : v.value === "overdue" ? "with overdue tasks" : "with open tasks"
4707
4722
  });
4708
4723
  else if (v.kind === "aging") {
4709
- const D = ld({ field: Q, type: "range", value: v.value, rangeUnit: "h" });
4710
- D && r.push(D);
4724
+ const P = ld({ field: U, type: "range", value: v.value, rangeUnit: "h" });
4725
+ P && r.push(P);
4711
4726
  } else if (v.kind === "text" && v.value.trim())
4712
- r.push({ kind: "text", field: Q, text: v.value });
4727
+ r.push({ kind: "text", field: U, text: v.value });
4713
4728
  else if (v.kind === "num" && v.value !== "") {
4714
- const D = qr({
4715
- field: Q,
4729
+ const P = qr({
4730
+ field: U,
4716
4731
  op: v.op,
4717
4732
  value: v.value,
4718
4733
  kind: Le ? "currency" : "number"
4719
4734
  });
4720
- D && r.push(D);
4735
+ P && r.push(P);
4721
4736
  } else if (v.kind === "bool")
4722
4737
  r.push({
4723
4738
  kind: "is",
4724
- field: Q,
4739
+ field: U,
4725
4740
  values: [
4726
4741
  (j == null ? void 0 : j.type) === "boolean" ? v.value === "true" ? j.true_label : j.false_label : v.value === "true" ? "yes" : "no"
4727
4742
  ]
4728
4743
  });
4729
4744
  else if (v.kind === "date" && v.value) {
4730
- const D = La(v.value), U = D ? { kind: "date", field: Q, op: D.op, from: D.from, to: D.to } : qr({ field: Q, op: "_preset", value: v.value, kind: "date" });
4731
- U && r.push(U);
4745
+ const P = La(v.value), z = P ? { kind: "date", field: U, op: P.op, from: P.from, to: P.to } : qr({ field: U, op: "_preset", value: v.value, kind: "date" });
4746
+ z && r.push(z);
4732
4747
  }
4733
4748
  }
4734
4749
  for (const x of Dt) {
@@ -4739,13 +4754,13 @@ function X0({
4739
4754
  r.push({ kind: "is", field: et(x.field), values: [x.label], not: !0 });
4740
4755
  if (vn && r.push({ kind: "phrase", text: "being amended" }), Mt.length > 0) {
4741
4756
  const x = Mt.map((v) => {
4742
- var Q;
4743
- return (Q = ma.find((j) => j.id === v)) == null ? void 0 : Q.name;
4757
+ var U;
4758
+ return (U = ma.find((j) => j.id === v)) == null ? void 0 : U.name;
4744
4759
  }).filter((v) => !!v);
4745
4760
  x.length > 0 && r.push({ kind: "phrase", text: `flagged ${x.join(" or ")}` });
4746
4761
  }
4747
4762
  return ll.current = e, od({
4748
- noun: (A == null ? void 0 : A.display_name) || je(n),
4763
+ noun: (I == null ? void 0 : I.display_name) || je(n),
4749
4764
  viewName: ((b = dt.find((x) => x.id === Ht)) == null ? void 0 : b.name) ?? null,
4750
4765
  search: Y,
4751
4766
  clauses: r,
@@ -4758,7 +4773,7 @@ function X0({
4758
4773
  "div",
4759
4774
  {
4760
4775
  "data-cbv": !0,
4761
- className: I ?? "flex h-full min-h-0 flex-col bg-slate-50 text-[13px] dark:bg-slate-950",
4776
+ className: L ?? "flex h-full min-h-0 flex-col bg-slate-50 text-[13px] dark:bg-slate-950",
4762
4777
  children: [
4763
4778
  /* @__PURE__ */ a("style", { children: `
4764
4779
  /* Horizontal overflow is hidden (HScrollProxy is the only h-bar);
@@ -4885,7 +4900,7 @@ function X0({
4885
4900
  },
4886
4901
  {
4887
4902
  label: "Open in new tab",
4888
- run: () => window.open(F({ collection: n, itemId: String(ie.row.id) }), "_blank")
4903
+ run: () => window.open(R({ collection: n, itemId: String(ie.row.id) }), "_blank")
4889
4904
  },
4890
4905
  {
4891
4906
  label: "Peek",
@@ -4893,7 +4908,7 @@ function X0({
4893
4908
  },
4894
4909
  // The friendly id, never the row id (army 7 N7); none = nothing to copy.
4895
4910
  ...Pr({
4896
- meta: A,
4911
+ meta: I,
4897
4912
  row: ie.row,
4898
4913
  id: ie.row.id
4899
4914
  }).copy != null ? [
@@ -4903,7 +4918,7 @@ function X0({
4903
4918
  var e;
4904
4919
  (e = navigator.clipboard) == null || e.writeText(
4905
4920
  Pr({
4906
- meta: A,
4921
+ meta: I,
4907
4922
  row: ie.row,
4908
4923
  id: ie.row.id
4909
4924
  }).copy ?? ""
@@ -4920,7 +4935,7 @@ function X0({
4920
4935
  n,
4921
4936
  ie.row,
4922
4937
  String(ie.row.id),
4923
- F
4938
+ R
4924
4939
  ), ge.success("Link copied");
4925
4940
  }
4926
4941
  }
@@ -4956,10 +4971,10 @@ function X0({
4956
4971
  ),
4957
4972
  /* @__PURE__ */ c("div", { className: "flex shrink-0 flex-wrap items-center gap-2 border-b border-slate-200 bg-white px-4 py-2.5 dark:border-slate-700 dark:bg-slate-900", children: [
4958
4973
  /* @__PURE__ */ a(
4959
- Xu,
4974
+ Zu,
4960
4975
  {
4961
4976
  collection: n,
4962
- meta: A,
4977
+ meta: I,
4963
4978
  search: we,
4964
4979
  onSearch: (e) => {
4965
4980
  Ae(e), T(1);
@@ -5051,7 +5066,7 @@ function X0({
5051
5066
  search: Y || void 0,
5052
5067
  sort: X || void 0,
5053
5068
  limit: Ye,
5054
- page: O
5069
+ page: M
5055
5070
  },
5056
5071
  fields: ve
5057
5072
  }
@@ -5076,10 +5091,10 @@ function X0({
5076
5091
  onClick: () => {
5077
5092
  gs(!1), hs((t) => t === e.key ? null : e.key);
5078
5093
  },
5079
- "aria-pressed": Ft === e.key,
5094
+ "aria-pressed": Rt === e.key,
5080
5095
  "data-cbv-view-toggle": e.key,
5081
- title: Ft === e.key ? "Back to the table" : `Show as ${e.label.toLowerCase()}`,
5082
- className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${Ft === e.key ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
5096
+ title: Rt === e.key ? "Back to the table" : `Show as ${e.label.toLowerCase()}`,
5097
+ className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${Rt === e.key ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
5083
5098
  children: [
5084
5099
  e.icon,
5085
5100
  e.label
@@ -5109,14 +5124,14 @@ function X0({
5109
5124
  type: "button",
5110
5125
  onClick: () => Z((e) => !e),
5111
5126
  title: "Ask the table a question",
5112
- className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${R || ae ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
5127
+ className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${E || ae ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
5113
5128
  children: [
5114
5129
  /* @__PURE__ */ a(Cr, { className: "h-3.5 w-3.5" }),
5115
5130
  "Ask"
5116
5131
  ]
5117
5132
  }
5118
5133
  ),
5119
- R && /* @__PURE__ */ c("div", { className: "order-last flex w-full items-center gap-2", children: [
5134
+ E && /* @__PURE__ */ c("div", { className: "order-last flex w-full items-center gap-2", children: [
5120
5135
  /* @__PURE__ */ a(Cr, { className: "h-4 w-4 shrink-0 text-[#00a5cc]" }),
5121
5136
  /* @__PURE__ */ a(
5122
5137
  "input",
@@ -5505,13 +5520,13 @@ function X0({
5505
5520
  },
5506
5521
  e.field
5507
5522
  )),
5508
- A && /* @__PURE__ */ c("div", { className: "mt-1 border-t border-slate-100 pt-1.5 dark:border-slate-800", children: [
5523
+ I && /* @__PURE__ */ c("div", { className: "mt-1 border-t border-slate-100 pt-1.5 dark:border-slate-800", children: [
5509
5524
  /* @__PURE__ */ a("p", { className: "px-1.5 pb-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "+ Related column" }),
5510
5525
  /* @__PURE__ */ a(
5511
- Zu,
5526
+ ep,
5512
5527
  {
5513
5528
  collection: n,
5514
- meta: A,
5529
+ meta: I,
5515
5530
  onPick: (e) => {
5516
5531
  const t = e.join(".");
5517
5532
  ve.includes(t) || rt([...ve, t]), tn(!1);
@@ -5699,7 +5714,7 @@ ${r}`).then(() => {
5699
5714
  ] })
5700
5715
  ] })
5701
5716
  ] }),
5702
- aa && !(A != null && A.singleton) && (ra ? /* @__PURE__ */ c("div", { className: "relative", "data-cbv-newitem-menu": !0, ref: Ua, children: [
5717
+ aa && !(I != null && I.singleton) && (ra ? /* @__PURE__ */ c("div", { className: "relative", "data-cbv-newitem-menu": !0, ref: Ua, children: [
5703
5718
  /* @__PURE__ */ c(
5704
5719
  "button",
5705
5720
  {
@@ -5857,10 +5872,10 @@ ${r}`).then(() => {
5857
5872
  onOpenChange: (e) => {
5858
5873
  e || sa(null);
5859
5874
  },
5860
- noun: (A == null ? void 0 : A.singular) ?? "record",
5875
+ noun: (I == null ? void 0 : I.singular) ?? "record",
5861
5876
  anchorEl: Ua.current ?? as.current,
5862
5877
  onDone: (e) => {
5863
- sa(null), z({ collection: n, itemId: "new", layoutSlug: Ba.slug, prefill: e });
5878
+ sa(null), W({ collection: n, itemId: "new", layoutSlug: Ba.slug, prefill: e });
5864
5879
  }
5865
5880
  }
5866
5881
  ),
@@ -5887,7 +5902,7 @@ ${r}`).then(() => {
5887
5902
  la && xn.editing && /* @__PURE__ */ a(wu, { ctl: xn, collection: n }),
5888
5903
  Nt.length > 0 && !(la && xn.editing) && /* @__PURE__ */ c("div", { className: "flex shrink-0 flex-wrap items-center gap-1.5 border-b border-slate-100 bg-white px-4 py-1.5 dark:border-slate-800 dark:bg-slate-900", children: [
5889
5904
  Nt.map((e) => /* @__PURE__ */ a(
5890
- zu,
5905
+ Wu,
5891
5906
  {
5892
5907
  def: e,
5893
5908
  allowedIds: ss(e),
@@ -6158,19 +6173,19 @@ ${r}`).then(() => {
6158
6173
  }
6159
6174
  )
6160
6175
  ] }),
6161
- Ft === "tree" && jn ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900", children: /* @__PURE__ */ a(
6176
+ Rt === "tree" && jn ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900", children: /* @__PURE__ */ a(
6162
6177
  Lc,
6163
6178
  {
6164
6179
  collection: n,
6165
6180
  config: jn,
6166
6181
  onOpen: (e) => dn(e),
6167
- onAddChild: V && Pe.allow_create !== !1 ? (e) => z({
6182
+ onAddChild: B && Pe.allow_create !== !1 ? (e) => W({
6168
6183
  collection: n,
6169
6184
  itemId: "new",
6170
6185
  prefill: { [jn.parent_field]: e }
6171
6186
  }) : void 0
6172
6187
  }
6173
- ) }) }) : Ft && (K != null && K.some((e) => e.key === Ft)) ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", "data-cbv-extra-view": Ft, children: (gl = K.find((e) => e.key === Ft)) == null ? void 0 : gl.render() }) : null,
6188
+ ) }) }) : Rt && (K != null && K.some((e) => e.key === Rt)) ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", "data-cbv-extra-view": Rt, children: (gl = K.find((e) => e.key === Rt)) == null ? void 0 : gl.render() }) : null,
6174
6189
  da && kn ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a(
6175
6190
  xu,
6176
6191
  {
@@ -6186,7 +6201,7 @@ ${r}`).then(() => {
6186
6201
  /* @__PURE__ */ c(
6187
6202
  "div",
6188
6203
  {
6189
- className: da && kn || Ft === "tree" && jn || Ft && (K != null && K.some((e) => e.key === Ft)) ? "hidden" : "flex min-h-0 flex-1 flex-col p-4 pt-3",
6204
+ className: da && kn || Rt === "tree" && jn || Rt && (K != null && K.some((e) => e.key === Rt)) ? "hidden" : "flex min-h-0 flex-1 flex-col p-4 pt-3",
6190
6205
  children: [
6191
6206
  _r && /* @__PURE__ */ a(
6192
6207
  "p",
@@ -6262,9 +6277,9 @@ ${r}`).then(() => {
6262
6277
  }
6263
6278
  ),
6264
6279
  Jt.map((e) => {
6265
- const t = e.key, r = !!Lt(t), s = `group/hcell sticky top-0 h-8 select-none whitespace-nowrap bg-slate-50 px-3 py-0 text-[10px] font-bold uppercase tracking-wider text-slate-500 dark:bg-slate-800 dark:text-slate-400 ${r ? "z-[4]" : "z-[2]"}`, l = ct(t, "", "");
6280
+ const t = e.key, r = !!Ft(t), s = `group/hcell sticky top-0 h-8 select-none whitespace-nowrap bg-slate-50 px-3 py-0 text-[10px] font-bold uppercase tracking-wider text-slate-500 dark:bg-slate-800 dark:text-slate-400 ${r ? "z-[4]" : "z-[2]"}`, l = ct(t, "", "");
6266
6281
  if (e.kind !== "data") {
6267
- const D = e.kind === "state" ? "State" : e.kind === "entered" ? "Last State Change" : e.kind === "aging" ? "Aging" : e.kind === "owners" ? "Owners" : e.kind === "addendums" ? "Addendums" : e.kind === "fulfilment" ? Fe != null && Fe.label ? `${Fe.label} shipped` : "Shipped" : e.kind === "integrations" ? "Integrations" : e.kind === "tasks" ? "Tasks" : e.kind === "formula" ? et(t) : "";
6282
+ const P = e.kind === "state" ? "State" : e.kind === "entered" ? "Last State Change" : e.kind === "aging" ? "Aging" : e.kind === "owners" ? "Owners" : e.kind === "addendums" ? "Addendums" : e.kind === "fulfilment" ? Fe != null && Fe.label ? `${Fe.label} shipped` : "Shipped" : e.kind === "integrations" ? "Integrations" : e.kind === "tasks" ? "Tasks" : e.kind === "formula" ? et(t) : "";
6268
6283
  return /* @__PURE__ */ c(
6269
6284
  "th",
6270
6285
  {
@@ -6272,14 +6287,14 @@ ${r}`).then(() => {
6272
6287
  style: Me(t),
6273
6288
  className: `${s} text-left ${e.kind === "actions" ? "w-20 px-2" : ""} ${l}`,
6274
6289
  children: [
6275
- D,
6290
+ P,
6276
6291
  sl(t)
6277
6292
  ]
6278
6293
  },
6279
6294
  t
6280
6295
  );
6281
6296
  }
6282
- const i = St.get(t), b = !!(i != null && i.computed_formula && !i.computed_store && !i.sql_filterable), x = Qt(t) || b, v = !x && (X === t || X === `-${t}` || X.replace(/^-/, "").startsWith(`${t}.`)), Q = X.startsWith("-") && v, j = St.get(t), Le = et(t);
6297
+ const i = St.get(t), b = !!(i != null && i.computed_formula && !i.computed_store && !i.sql_filterable), x = Qt(t) || b, v = !x && (X === t || X === `-${t}` || X.replace(/^-/, "").startsWith(`${t}.`)), U = X.startsWith("-") && v, j = St.get(t), Le = et(t);
6283
6298
  return /* @__PURE__ */ c(
6284
6299
  "th",
6285
6300
  {
@@ -6288,10 +6303,10 @@ ${r}`).then(() => {
6288
6303
  onClick: () => {
6289
6304
  x || Ys(t);
6290
6305
  },
6291
- "aria-sort": x ? void 0 : v ? Q ? "descending" : "ascending" : "none",
6306
+ "aria-sort": x ? void 0 : v ? U ? "descending" : "ascending" : "none",
6292
6307
  tabIndex: x ? void 0 : 0,
6293
- onKeyDown: (D) => {
6294
- x || D.target !== D.currentTarget || (D.key === "Enter" || D.key === " ") && (D.preventDefault(), Ys(t));
6308
+ onKeyDown: (P) => {
6309
+ x || P.target !== P.currentTarget || (P.key === "Enter" || P.key === " ") && (P.preventDefault(), Ys(t));
6295
6310
  },
6296
6311
  className: `${s} relative ${mr(t) ? "text-right" : "text-left"} ${x ? "" : "cursor-pointer hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan"} ${l}`,
6297
6312
  children: [
@@ -6310,7 +6325,7 @@ ${r}`).then(() => {
6310
6325
  {
6311
6326
  "aria-hidden": !0,
6312
6327
  className: `ml-1 inline-block transition-colors duration-200 ${v ? "text-[#00a5cc]" : "text-slate-300 dark:text-slate-500"}`,
6313
- children: v ? Q ? "▼" : "▲" : "⇅"
6328
+ children: v ? U ? "▼" : "▲" : "⇅"
6314
6329
  }
6315
6330
  ),
6316
6331
  sl(t),
@@ -6325,7 +6340,7 @@ ${r}`).then(() => {
6325
6340
  Ot && /* @__PURE__ */ a("th", { className: "sticky left-0 top-8 z-[4] w-11 bg-slate-50 py-1 pl-1.5 pr-3 dark:bg-slate-800" }),
6326
6341
  Jt.map((e) => {
6327
6342
  var l;
6328
- const t = e.key, s = `sticky top-8 bg-slate-50 px-2 py-1 text-left font-normal dark:bg-slate-800 ${!!Lt(t) ? "z-[4]" : "z-[2]"} ${ct(t, "", "")}`;
6343
+ const t = e.key, s = `sticky top-8 bg-slate-50 px-2 py-1 text-left font-normal dark:bg-slate-800 ${!!Ft(t) ? "z-[4]" : "z-[2]"} ${ct(t, "", "")}`;
6329
6344
  if (e.kind === "state")
6330
6345
  return /* @__PURE__ */ a("th", { style: Me(t), className: s, children: /* @__PURE__ */ a(
6331
6346
  Da,
@@ -6489,7 +6504,7 @@ ${r}`).then(() => {
6489
6504
  colSpan: ve.length + Xs,
6490
6505
  className: "nvr-fade-in py-16",
6491
6506
  children: (() => {
6492
- const e = Be.length === 0 && Object.keys(He).length === 0 && !Object.values(ft).some((s) => s.length > 0) && !Y, t = A == null ? void 0 : A.empty_state;
6507
+ const e = Be.length === 0 && Object.keys(He).length === 0 && !Object.values(ft).some((s) => s.length > 0) && !Y, t = I == null ? void 0 : I.empty_state;
6493
6508
  if (e && t && (t.title || t.message)) {
6494
6509
  const s = t.cta_url ?? "", l = s.startsWith("/"), i = /^https?:\/\//.test(s);
6495
6510
  return /* @__PURE__ */ c("div", { className: "flex flex-col items-center gap-2 text-center", children: [
@@ -6570,7 +6585,7 @@ ${r}`).then(() => {
6570
6585
  })()
6571
6586
  }
6572
6587
  ) }) : el.map((e, t) => {
6573
- var U;
6588
+ var z;
6574
6589
  const r = { animationDelay: `${Math.min(t, 14) * 16}ms` };
6575
6590
  if (e.kind === "header")
6576
6591
  return /* @__PURE__ */ a(
@@ -6602,14 +6617,14 @@ ${r}`).then(() => {
6602
6617
  },
6603
6618
  `__group__${e.gkey}`
6604
6619
  );
6605
- const s = e.row, l = s.id, i = rn.includes(l), b = (U = Ee == null ? void 0 : Ee.instances) == null ? void 0 : U[String(l)], x = Oo[String(l)], v = cr == null ? void 0 : cr[String(l)], Q = Do.get(String(l)) ?? null, j = Ao(n, l), Le = !i && x ? Xd(x.color) : void 0, D = i ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Le ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
6620
+ const s = e.row, l = s.id, i = rn.includes(l), b = (z = Ee == null ? void 0 : Ee.instances) == null ? void 0 : z[String(l)], x = Oo[String(l)], v = cr == null ? void 0 : cr[String(l)], U = Do.get(String(l)) ?? null, j = Ao(n, l), Le = !i && x ? Xd(x.color) : void 0, P = i ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Le ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
6606
6621
  return /* @__PURE__ */ c(
6607
6622
  "tr",
6608
6623
  {
6609
6624
  ...Lo({ collection: n, id: String(l) }),
6610
6625
  ...li(l),
6611
6626
  "data-row-key": String(l),
6612
- title: At.titleFor(String(l)) ?? (Q && !Q.is_mine ? Ld(Q) : void 0) ?? (x ? `At risk — ${x.rule}` : void 0) ?? (j ? yu : void 0),
6627
+ title: At.titleFor(String(l)) ?? (U && !U.is_mine ? Ld(U) : void 0) ?? (x ? `At risk — ${x.rule}` : void 0) ?? (j ? yu : void 0),
6613
6628
  "data-picker-excluded": j ? "" : void 0,
6614
6629
  style: r,
6615
6630
  className: `nvr-row-enter group h-8 cursor-pointer border-b border-slate-100 transition-colors duration-150 hover:bg-nvr-cyan/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan dark:border-slate-800 dark:hover:bg-nvr-cyan/[0.08] ${i ? "bg-nvr-cyan/[0.08]" : Le ?? ""} ${j ? ku : ""}`,
@@ -6617,13 +6632,13 @@ ${r}`).then(() => {
6617
6632
  Ot && /* @__PURE__ */ a(
6618
6633
  "td",
6619
6634
  {
6620
- className: `sticky left-0 z-[1] w-11 py-1.5 pl-1.5 pr-3 ${D}`,
6635
+ className: `sticky left-0 z-[1] w-11 py-1.5 pl-1.5 pr-3 ${P}`,
6621
6636
  onClick: (J) => J.stopPropagation(),
6622
6637
  children: /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
6623
- Q || At.isNew(String(l)) ? /* @__PURE__ */ a(
6638
+ U || At.isNew(String(l)) ? /* @__PURE__ */ a(
6624
6639
  fu,
6625
6640
  {
6626
- lock: Q,
6641
+ lock: U,
6627
6642
  isNew: At.isNew(String(l)),
6628
6643
  dataAttr: "data-cbv-live-mark"
6629
6644
  }
@@ -6641,7 +6656,7 @@ ${r}`).then(() => {
6641
6656
  type: "checkbox",
6642
6657
  checked: i,
6643
6658
  onChange: () => ii(l),
6644
- "aria-label": `Select ${Vd(A, s, l, n) || "this record"}`
6659
+ "aria-label": `Select ${Vd(I, s, l, n) || "this record"}`
6645
6660
  }
6646
6661
  )
6647
6662
  ] })
@@ -6655,16 +6670,16 @@ ${r}`).then(() => {
6655
6670
  "td",
6656
6671
  {
6657
6672
  style: Me(p),
6658
- onContextMenu: (M) => {
6659
- M.preventDefault(), Vt({
6660
- x: M.clientX,
6661
- y: M.clientY,
6673
+ onContextMenu: (A) => {
6674
+ A.preventDefault(), Vt({
6675
+ x: A.clientX,
6676
+ y: A.clientY,
6662
6677
  key: p,
6663
6678
  row: s,
6664
- cellText: M.currentTarget.innerText.trim()
6679
+ cellText: A.currentTarget.innerText.trim()
6665
6680
  });
6666
6681
  },
6667
- className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", D)}`,
6682
+ className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", P)}`,
6668
6683
  children: b ? /* @__PURE__ */ c(
6669
6684
  "span",
6670
6685
  {
@@ -6697,13 +6712,13 @@ ${r}`).then(() => {
6697
6712
  p
6698
6713
  );
6699
6714
  if (J.kind === "entered") {
6700
- const M = (It = Ee == null ? void 0 : Ee.instances) == null ? void 0 : It[String(l)];
6715
+ const A = (It = Ee == null ? void 0 : Ee.instances) == null ? void 0 : It[String(l)];
6701
6716
  return /* @__PURE__ */ a(
6702
6717
  "td",
6703
6718
  {
6704
6719
  style: Me(p),
6705
- className: `whitespace-nowrap px-3 py-1.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300 ${ct(p, "z-[1]", D)}`,
6706
- children: M != null && M.entered_at ? Gn(M.entered_at, {
6720
+ className: `whitespace-nowrap px-3 py-1.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300 ${ct(p, "z-[1]", P)}`,
6721
+ children: A != null && A.entered_at ? Gn(A.entered_at, {
6707
6722
  type: "datetime",
6708
6723
  template: "MM/DD/YYYY - h:mmA"
6709
6724
  }) : /* @__PURE__ */ a("span", { className: "text-slate-300 dark:text-slate-600", children: "—" })
@@ -6712,14 +6727,14 @@ ${r}`).then(() => {
6712
6727
  );
6713
6728
  }
6714
6729
  if (J.kind === "aging") {
6715
- const M = (ut = Ee == null ? void 0 : Ee.instances) == null ? void 0 : ut[String(l)], at = M != null && M.entered_at ? new Date(M.entered_at).getTime() : NaN, W = M != null && M.completed_at || !Number.isFinite(at) ? null : (Date.now() - at) / 36e5;
6730
+ const A = (ut = Ee == null ? void 0 : Ee.instances) == null ? void 0 : ut[String(l)], at = A != null && A.entered_at ? new Date(A.entered_at).getTime() : NaN, V = A != null && A.completed_at || !Number.isFinite(at) ? null : (Date.now() - at) / 36e5;
6716
6731
  return /* @__PURE__ */ a(
6717
6732
  "td",
6718
6733
  {
6719
6734
  style: Me(p),
6720
- "data-tip": W != null && (M != null && M.entered_at) ? `In ${M.state_label ?? "this state"} since ${pc(M.entered_at)}` : void 0,
6721
- className: `whitespace-nowrap px-3 py-1.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300 ${ct(p, "z-[1]", D)}`,
6722
- children: W == null ? /* @__PURE__ */ a("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : uc(W)
6735
+ "data-tip": V != null && (A != null && A.entered_at) ? `In ${A.state_label ?? "this state"} since ${pc(A.entered_at)}` : void 0,
6736
+ className: `whitespace-nowrap px-3 py-1.5 text-[12px] tabular-nums text-slate-600 dark:text-slate-300 ${ct(p, "z-[1]", P)}`,
6737
+ children: V == null ? /* @__PURE__ */ a("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : uc(V)
6723
6738
  },
6724
6739
  p
6725
6740
  );
@@ -6729,8 +6744,8 @@ ${r}`).then(() => {
6729
6744
  "td",
6730
6745
  {
6731
6746
  style: Me(p),
6732
- className: `whitespace-nowrap px-3 py-1 ${ct(p, "z-[1]", D)}`,
6733
- onClick: (M) => M.stopPropagation(),
6747
+ className: `whitespace-nowrap px-3 py-1 ${ct(p, "z-[1]", P)}`,
6748
+ onClick: (A) => A.stopPropagation(),
6734
6749
  children: /* @__PURE__ */ a(
6735
6750
  Kl,
6736
6751
  {
@@ -6742,13 +6757,13 @@ ${r}`).then(() => {
6742
6757
  p
6743
6758
  );
6744
6759
  if (J.kind === "addendums") {
6745
- const M = ir == null ? void 0 : ir[String(l)];
6760
+ const A = ir == null ? void 0 : ir[String(l)];
6746
6761
  return /* @__PURE__ */ a(
6747
6762
  "td",
6748
6763
  {
6749
6764
  style: Me(p),
6750
- className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", D)}`,
6751
- children: /* @__PURE__ */ a(Mu, { summary: M })
6765
+ className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", P)}`,
6766
+ children: /* @__PURE__ */ a(Au, { summary: A })
6752
6767
  },
6753
6768
  p
6754
6769
  );
@@ -6758,8 +6773,8 @@ ${r}`).then(() => {
6758
6773
  "td",
6759
6774
  {
6760
6775
  style: Me(p),
6761
- className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", D)}`,
6762
- onClick: (M) => M.stopPropagation(),
6776
+ className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", P)}`,
6777
+ onClick: (A) => A.stopPropagation(),
6763
6778
  children: /* @__PURE__ */ a(
6764
6779
  ru,
6765
6780
  {
@@ -6780,27 +6795,27 @@ ${r}`).then(() => {
6780
6795
  "td",
6781
6796
  {
6782
6797
  style: Me(p),
6783
- className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", D)}`,
6798
+ className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", P)}`,
6784
6799
  children: /* @__PURE__ */ a(du, { rows: ur == null ? void 0 : ur[String(l)] })
6785
6800
  },
6786
6801
  p
6787
6802
  );
6788
6803
  if (J.kind === "tasks") {
6789
- const M = dr == null ? void 0 : dr[String(l)];
6804
+ const A = dr == null ? void 0 : dr[String(l)];
6790
6805
  return /* @__PURE__ */ a(
6791
6806
  "td",
6792
6807
  {
6793
6808
  style: Me(p),
6794
- className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", D)}`,
6795
- "data-cbv-task-count": (M == null ? void 0 : M.open) ?? 0,
6796
- children: M && M.open > 0 ? /* @__PURE__ */ c(
6809
+ className: `whitespace-nowrap px-3 py-1.5 ${ct(p, "z-[1]", P)}`,
6810
+ "data-cbv-task-count": (A == null ? void 0 : A.open) ?? 0,
6811
+ children: A && A.open > 0 ? /* @__PURE__ */ c(
6797
6812
  "span",
6798
6813
  {
6799
- className: M.overdue > 0 ? "rounded-full bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold tabular-nums text-red-600 dark:text-red-400" : "rounded-full bg-slate-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold tabular-nums text-slate-600 dark:text-slate-300",
6800
- "data-tip": M.overdue > 0 ? `${M.open} open task${M.open === 1 ? "" : "s"}, ${M.overdue} overdue` : `${M.open} open task${M.open === 1 ? "" : "s"}`,
6814
+ className: A.overdue > 0 ? "rounded-full bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold tabular-nums text-red-600 dark:text-red-400" : "rounded-full bg-slate-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold tabular-nums text-slate-600 dark:text-slate-300",
6815
+ "data-tip": A.overdue > 0 ? `${A.open} open task${A.open === 1 ? "" : "s"}, ${A.overdue} overdue` : `${A.open} open task${A.open === 1 ? "" : "s"}`,
6801
6816
  children: [
6802
- M.open,
6803
- M.overdue > 0 ? ` · ${M.overdue} overdue` : ""
6817
+ A.open,
6818
+ A.overdue > 0 ? ` · ${A.overdue} overdue` : ""
6804
6819
  ]
6805
6820
  }
6806
6821
  ) : /* @__PURE__ */ a("span", { className: "text-[11px] text-slate-400", children: "—" })
@@ -6809,15 +6824,15 @@ ${r}`).then(() => {
6809
6824
  );
6810
6825
  }
6811
6826
  if (J.kind === "formula") {
6812
- const M = _o(s, p);
6827
+ const A = _o(s, p);
6813
6828
  return /* @__PURE__ */ a(
6814
6829
  "td",
6815
6830
  {
6816
6831
  style: Me(p),
6817
6832
  "data-cbv-formula-cell": p,
6818
6833
  "data-tip": No(s, p),
6819
- className: `whitespace-nowrap px-3 py-1.5 text-right tabular-nums text-slate-700 dark:text-slate-200 ${ct(p, "z-[1]", D)}`,
6820
- children: M == null ? /* @__PURE__ */ a("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : xe[p] ? Gn(String(M), xe[p]) : xt(Math.round(M * 100) / 100)
6834
+ className: `whitespace-nowrap px-3 py-1.5 text-right tabular-nums text-slate-700 dark:text-slate-200 ${ct(p, "z-[1]", P)}`,
6835
+ children: A == null ? /* @__PURE__ */ a("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : xe[p] ? Gn(String(A), xe[p]) : xt(Math.round(A * 100) / 100)
6821
6836
  },
6822
6837
  p
6823
6838
  );
@@ -6827,10 +6842,10 @@ ${r}`).then(() => {
6827
6842
  "td",
6828
6843
  {
6829
6844
  style: Me(p),
6830
- className: `w-20 whitespace-nowrap px-2 py-1 text-right ${ct(p, "z-[1]", D)}`,
6831
- onClick: (M) => M.stopPropagation(),
6845
+ className: `w-20 whitespace-nowrap px-2 py-1 text-right ${ct(p, "z-[1]", P)}`,
6846
+ onClick: (A) => A.stopPropagation(),
6832
6847
  children: /* @__PURE__ */ a(
6833
- ju,
6848
+ Bu,
6834
6849
  {
6835
6850
  collection: n,
6836
6851
  id: l,
@@ -6838,7 +6853,7 @@ ${r}`).then(() => {
6838
6853
  onOpen: () => dn(l),
6839
6854
  onPeek: () => yt.push([{ collection: n, itemId: String(l) }]),
6840
6855
  onAudit: () => mn(String(l)),
6841
- urlFor: F,
6856
+ urlFor: R,
6842
6857
  onDeleted: () => Hs.mutate(l),
6843
6858
  row: s,
6844
6859
  bulkEnabledKeys: Pe.bulk_actions ?? null,
@@ -6853,28 +6868,28 @@ ${r}`).then(() => {
6853
6868
  "td",
6854
6869
  {
6855
6870
  style: Me(p),
6856
- onContextMenu: (M) => {
6857
- M.preventDefault(), Vt({
6858
- x: M.clientX,
6859
- y: M.clientY,
6871
+ onContextMenu: (A) => {
6872
+ A.preventDefault(), Vt({
6873
+ x: A.clientX,
6874
+ y: A.clientY,
6860
6875
  key: p,
6861
6876
  row: s,
6862
- cellText: M.currentTarget.innerText.trim()
6877
+ cellText: A.currentTarget.innerText.trim()
6863
6878
  });
6864
6879
  },
6865
- className: `whitespace-nowrap px-3 py-1.5 ${mr(p) ? "text-right" : ""} ${ct(p, "z-[1]", D)}`,
6880
+ className: `whitespace-nowrap px-3 py-1.5 ${mr(p) ? "text-right" : ""} ${ct(p, "z-[1]", P)}`,
6866
6881
  children: yo(
6867
6882
  s,
6868
6883
  p,
6869
- !!Q && !Q.is_mine,
6884
+ !!U && !U.is_mine,
6870
6885
  Qt(p) ? As(p) === "nivaro_users" ? (() => {
6871
- var se, C, B;
6872
- const M = p.includes(".") ? p : Je[p], at = ((B = (C = (se = Te == null ? void 0 : Te.rows) == null ? void 0 : se[String(l)]) == null ? void 0 : C[M]) == null ? void 0 : B.ids) ?? [], W = $t(l, p) ?? "";
6873
- if (at.length === 0 || !W || W === "—")
6886
+ var se, C, Q;
6887
+ const A = p.includes(".") ? p : Je[p], at = ((Q = (C = (se = Te == null ? void 0 : Te.rows) == null ? void 0 : se[String(l)]) == null ? void 0 : C[A]) == null ? void 0 : Q.ids) ?? [], V = $t(l, p) ?? "";
6888
+ if (at.length === 0 || !V || V === "—")
6874
6889
  return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
6875
6890
  if (at.length === 1)
6876
6891
  return /* @__PURE__ */ a("span", { onClick: (Ne) => Ne.stopPropagation(), children: /* @__PURE__ */ a(jl, { userId: String(at[0]), size: "compact" }) });
6877
- const ye = W.split(", ");
6892
+ const ye = V.split(", ");
6878
6893
  return /* @__PURE__ */ a(
6879
6894
  Kl,
6880
6895
  {
@@ -6889,8 +6904,8 @@ ${r}`).then(() => {
6889
6904
  "button",
6890
6905
  {
6891
6906
  type: "button",
6892
- onClick: (M) => {
6893
- M.stopPropagation(), yt.push([
6907
+ onClick: (A) => {
6908
+ A.stopPropagation(), yt.push([
6894
6909
  { collection: gt.target, itemId: gt.id }
6895
6910
  ]);
6896
6911
  },
@@ -6908,12 +6923,12 @@ ${r}`).then(() => {
6908
6923
  "data-tip": $t(l, p) ?? void 0,
6909
6924
  children: $t(l, p) != null ? `${((Nn = xe[p]) == null ? void 0 : Nn.type) === "count" && Is(p) ? "📎 " : ""}${wn($t(l, p) ?? "", p, l)}` : /* @__PURE__ */ a("span", { className: "inline-block h-3.5 w-16 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
6910
6925
  }
6911
- ) : (nt == null ? void 0 : nt.one_collection) === "nivaro_users" && s[p] != null ? /* @__PURE__ */ a("span", { onClick: (M) => M.stopPropagation(), children: /* @__PURE__ */ a(jl, { userId: String(s[p]), size: "compact" }) }) : nt != null && nt.one_collection && s[p] != null && !Rt(nt.one_collection) ? /* @__PURE__ */ a(
6926
+ ) : (nt == null ? void 0 : nt.one_collection) === "nivaro_users" && s[p] != null ? /* @__PURE__ */ a("span", { onClick: (A) => A.stopPropagation(), children: /* @__PURE__ */ a(jl, { userId: String(s[p]), size: "compact" }) }) : nt != null && nt.one_collection && s[p] != null && !Tt(nt.one_collection) ? /* @__PURE__ */ a(
6912
6927
  "button",
6913
6928
  {
6914
6929
  type: "button",
6915
- onClick: (M) => {
6916
- M.stopPropagation(), yt.push([
6930
+ onClick: (A) => {
6931
+ A.stopPropagation(), yt.push([
6917
6932
  {
6918
6933
  collection: nt.one_collection,
6919
6934
  itemId: String(s[p])
@@ -6929,7 +6944,7 @@ ${r}`).then(() => {
6929
6944
  }
6930
6945
  )
6931
6946
  }
6932
- ) : p === "id" && Tr(A, s) ? (
6947
+ ) : p === "id" && Tr(I, s) ? (
6933
6948
  // #776 — the readable id; the internal one on hover.
6934
6949
  /* @__PURE__ */ a(
6935
6950
  "span",
@@ -6937,7 +6952,7 @@ ${r}`).then(() => {
6937
6952
  "data-record-ref": !0,
6938
6953
  "data-tip": `#${String(s.id)}`,
6939
6954
  className: "font-mono text-[12px] text-slate-700 dark:text-slate-200",
6940
- children: Tr(A, s)
6955
+ children: Tr(I, s)
6941
6956
  }
6942
6957
  )
6943
6958
  ) : xe[p] && s[p] != null ? /* @__PURE__ */ a(
@@ -7029,7 +7044,7 @@ ${r}`).then(() => {
7029
7044
  xt(Re),
7030
7045
  " records — narrow the filters to group everything."
7031
7046
  ] }),
7032
- !ce && !ae && (Bt ? O > 1 || Ce.length >= Ye : Re > Ye) && /* @__PURE__ */ c(
7047
+ !ce && !ae && (Bt ? M > 1 || Ce.length >= Ye : Re > Ye) && /* @__PURE__ */ c(
7033
7048
  "div",
7034
7049
  {
7035
7050
  className: "flex shrink-0 items-center justify-between border-t border-slate-100 bg-white py-2 pl-3 dark:border-slate-800 dark:bg-slate-900",
@@ -7064,7 +7079,7 @@ ${r}`).then(() => {
7064
7079
  "button",
7065
7080
  {
7066
7081
  type: "button",
7067
- disabled: O <= 1,
7082
+ disabled: M <= 1,
7068
7083
  onClick: () => T(1),
7069
7084
  "aria-label": "First page",
7070
7085
  "data-tip": "First page",
@@ -7079,14 +7094,14 @@ ${r}`).then(() => {
7079
7094
  "button",
7080
7095
  {
7081
7096
  type: "button",
7082
- disabled: O <= 1,
7097
+ disabled: M <= 1,
7083
7098
  onClick: () => T((e) => Math.max(1, e - 1)),
7084
7099
  className: "h-7 rounded px-2.5 text-[12px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
7085
7100
  children: "← Prev"
7086
7101
  }
7087
7102
  ),
7088
7103
  /* @__PURE__ */ c("span", { className: "min-w-[64px] text-center text-[12px] tabular-nums text-slate-500", children: [
7089
- xt(O),
7104
+ xt(M),
7090
7105
  " / ",
7091
7106
  xt(ua)
7092
7107
  ] }),
@@ -7094,7 +7109,7 @@ ${r}`).then(() => {
7094
7109
  "button",
7095
7110
  {
7096
7111
  type: "button",
7097
- disabled: O >= ua,
7112
+ disabled: M >= ua,
7098
7113
  onClick: () => T((e) => e + 1),
7099
7114
  className: "h-7 rounded px-2.5 text-[12px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
7100
7115
  children: "Next →"
@@ -7104,7 +7119,7 @@ ${r}`).then(() => {
7104
7119
  "button",
7105
7120
  {
7106
7121
  type: "button",
7107
- disabled: O >= ua || Za,
7122
+ disabled: M >= ua || Za,
7108
7123
  onClick: () => void Ns(),
7109
7124
  "aria-label": "Last page",
7110
7125
  "aria-busy": Za || void 0,
@@ -7168,14 +7183,14 @@ ${r}`).then(() => {
7168
7183
  )
7169
7184
  ] }),
7170
7185
  Ot && _t && rn.length > 0 && /* @__PURE__ */ a(
7171
- tp,
7186
+ np,
7172
7187
  {
7173
7188
  collection: n,
7174
7189
  selectedIds: rn,
7175
7190
  transitions: (Ct == null ? void 0 : Ct.transitions) ?? [],
7176
7191
  states: (Ct == null ? void 0 : Ct.states) ?? [],
7177
- fields: (A == null ? void 0 : A.fields) ?? [],
7178
- relations: (A == null ? void 0 : A.relations) ?? [],
7192
+ fields: (I == null ? void 0 : I.fields) ?? [],
7193
+ relations: (I == null ? void 0 : I.relations) ?? [],
7179
7194
  registryKeys: Pe.bulk_actions ?? null,
7180
7195
  onClear: () => sn([]),
7181
7196
  onSuccess: () => qa(y, n)
@@ -7185,18 +7200,19 @@ ${r}`).then(() => {
7185
7200
  }
7186
7201
  );
7187
7202
  }
7188
- function ap(n, o, h, d, w) {
7189
- const S = Ar(o, n, h);
7190
- return S != null && S.one_collection ? /* @__PURE__ */ a(Ir, { relatedCollection: S.one_collection, id: d }) : Xi(d, w);
7203
+ function rp(n, o, h, d, w) {
7204
+ const N = Ar(o, n, h);
7205
+ return N != null && N.one_collection ? /* @__PURE__ */ a(Ir, { relatedCollection: N.one_collection, id: d }) : Xi(d, w);
7191
7206
  }
7192
7207
  export {
7193
- X0 as CollectionBrowserView,
7208
+ Z0 as CollectionBrowserView,
7194
7209
  Da as MultiPick,
7195
- ju as RowActionsMenu,
7210
+ Bu as RowActionsMenu,
7196
7211
  Wl as TINT_TEXT,
7197
- ap as compareCell,
7212
+ rp as compareCell,
7198
7213
  qa as invalidateCbvRowQueries,
7199
- Ku as roleMayDelete,
7200
- Iu as roleMayUpdate,
7214
+ ju as roleMayDelete,
7215
+ Ku as roleMayUpdate,
7216
+ Ou as templateRelationPaths,
7201
7217
  Na as tintFor
7202
7218
  };