@nivaro/react 0.1.171 → 0.1.172

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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import * as _b from "lucide-react";
3
3
  import { RefreshCw as Pl, ChevronDown as qn, Check as jn, X as tn, LayoutGrid as Zp, Bell as Ms, BellRing as io, Clock as Kl, ChartColumn as Tv, History as Ml, FlaskConical as af, Activity as E0, Plus as Dn, Gauge as Sb, Users as bo, Lock as td, Pencil as fl, Trash2 as Pa, Siren as rf, Search as qa, ArrowUpRight as Cb, Eye as Zu, ChevronsUpDown as ii, Copy as Rl, ChevronsLeft as jv, ChevronsRight as Lv, Minus as em, ChevronRight as Xa, Sparkles as $i, AlertCircle as Li, MoreVertical as Av, MoreHorizontal as tm, Clipboard as $b, Calendar as Ov, Paperclip as zo, Folder as Rv, File as e0, FileText as du, Phone as ku, MessageSquare as _c, Mail as Ho, UserCheck as qb, UserPlus as M0, User as Nu, Zap as D0, Power as Ev, Filter as nd, Sliders as Mv, Settings as nm, RotateCcw as ad, Pause as Dv, Play as P0, HelpCircle as Fb, Info as rd, AlertTriangle as Or, Flag as Pv, Bookmark as Tb, Heart as Kv, Star as qi, Unlock as Iv, EyeOff as zv, Send as am, Upload as ni, Download as Ai, Save as wu, Edit2 as Uv, Edit as Bv, XCircle as Wv, CheckCircle as Qv, Share2 as Vv, Link as jb, ExternalLink as sd, ArrowDown as Jv, ArrowUp as Hv, ArrowLeft as go, ArrowRight as Rr, MapPin as t0, Loader2 as Ft, MessageSquareWarning as Gv, SmilePlus as K0, GripVertical as Go, FileVideo as Yv, FileAudio as Xv, FileSpreadsheet as I0, FileCode as Zv, Bold as e1, Italic as t1, UnderlineIcon as n1, Strikethrough as a1, Heading1 as r1, Heading2 as s1, Heading3 as l1, List as i1, ListOrdered as o1, Quote as d1, Code as c1, Link2Off as Lb, FileSymlink as Ab, SlidersHorizontal as Ob, Sigma as Rb, Building2 as Eb, MessageCircle as z0, FileDiff as u1, ClipboardPlus as Mb, CheckCircle2 as m1, Clock3 as p1, Code2 as h1, Satellite as sf, CopyPlus as f1, GitBranch as Um, CalendarClock as x1, GitCompareArrows as b1, Link2 as _u, ClipboardList as g1, GitFork as n0, Network as y1, UploadCloud as v1, Wrench as Db, ShieldAlert as k1, FileDown as lf, ChevronLeft as oo, RotateCw as Bm, Map as N1, Rows3 as Su, Rows2 as Pb, BellOff as Cu, Pin as dc, Hash as a0, PlayCircle as w1, LogOut as Kb, Video as _1, CheckCheck as S1, Inbox as $u, ChevronUp as Ib, FileUp as C1, KeyRound as zb, Braces as Ub, Ban as rm, ScrollText as $1, FileBarChart as q1, Users2 as cc, PlugZap as F1, ListChecks as Bb, Camera as uc, Undo2 as Wb, UserRound as r0, ShieldCheck as T1, Flame as j1, Rows4 as L1, PanelLeftClose as A1, Settings2 as Qb, Table as O1, StickyNote as R1, TrendingUp as E1, TrendingDown as M1, ServerCrash as D1, Compass as P1, WifiOff as K1 } from "lucide-react";
4
4
  import * as ta from "react";
5
5
  import xl, { createContext as ur, useContext as Ka, useState as S, useCallback as Cn, useSyncExternalStore as I1, useEffect as Ae, useMemo as ve, useRef as Ee, Fragment as Ns, useLayoutEffect as ld, useId as qu, memo as Vb } from "react";
6
- import { QueryClientContext as z1, QueryClient as U1, QueryClientProvider as B1, useQuery as se, useQueryClient as jt, useMutation as Ue, useQueries as wa } from "@tanstack/react-query";
6
+ import { QueryClientContext as z1, QueryClient as U1, QueryClientProvider as B1, useQuery as se, useQueryClient as jt, useMutation as Ue, useQueries as Na } from "@tanstack/react-query";
7
7
  import { readItems as co, readMyScopes as Jb, listNotificationSubscriptions as W1, deleteNotificationSubscription as Q1, listImportTemplates as V1, readUser as J1, readUserCard as H1, updateUser as of, setMyDelegate as G1, saveMyScopeDefaults as Y1, readReportWidgetData as Rc, listReportAlerts as X1, createReportAlert as Z1, toggleReportAlert as ek, deleteReportAlert as tk, readReportAlertLog as nk, resolveReportAlert as ak, readReportFilterOptions as rk, executeCustomQuery as sk, saveReportFilterPreset as df, listReportFilterPresets as lk, deleteReportFilterPreset as ik, readReport as ok, aiReportFilters as dk, endSessionRecording as cf, sessionRecordingEnabled as ck, appendSessionRecordingEvents as uf, startSessionRecording as mf } from "@nivaro/sdk";
8
8
  import { clsx as uk } from "clsx";
9
9
  import { twMerge as mk } from "tailwind-merge";
@@ -2415,7 +2415,7 @@ const Yk = sm(
2415
2415
  defaultVariants: { variant: "default" }
2416
2416
  }
2417
2417
  );
2418
- function Hr({ className: t, variant: n, ...r }) {
2418
+ function Gr({ className: t, variant: n, ...r }) {
2419
2419
  return /* @__PURE__ */ e("div", { className: H(Yk({ variant: n }), t), ...r });
2420
2420
  }
2421
2421
  const Xk = sm(
@@ -2521,7 +2521,7 @@ function hg({
2521
2521
  }
2522
2522
  );
2523
2523
  }
2524
- const Yr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2524
+ const Xr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2525
2525
  Cs,
2526
2526
  {
2527
2527
  ref: r,
@@ -2532,7 +2532,7 @@ const Yr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2532
2532
  ...n
2533
2533
  }
2534
2534
  ));
2535
- Yr.displayName = Cs.displayName;
2535
+ Xr.displayName = Cs.displayName;
2536
2536
  const ms = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
2537
2537
  /* @__PURE__ */ e(qa, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2538
2538
  /* @__PURE__ */ e(
@@ -2548,7 +2548,7 @@ const ms = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a("div",
2548
2548
  )
2549
2549
  ] }));
2550
2550
  ms.displayName = Cs.Input.displayName;
2551
- const Xr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2551
+ const Zr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2552
2552
  Cs.List,
2553
2553
  {
2554
2554
  ref: r,
@@ -2556,7 +2556,7 @@ const Xr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2556
2556
  ...n
2557
2557
  }
2558
2558
  ));
2559
- Xr.displayName = Cs.List.displayName;
2559
+ Zr.displayName = Cs.List.displayName;
2560
2560
  const ps = ta.forwardRef((t, n) => /* @__PURE__ */ e(Cs.Empty, { ref: n, className: "py-6 text-center text-sm", ...t }));
2561
2561
  ps.displayName = Cs.Empty.displayName;
2562
2562
  const Mi = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
@@ -2625,7 +2625,7 @@ const la = mc.Root, ia = mc.Trigger, ra = ta.forwardRef(({ className: t, align:
2625
2625
  }
2626
2626
  ) }));
2627
2627
  ra.displayName = mc.Content.displayName;
2628
- const Gr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2628
+ const Yr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2629
2629
  s0.Root,
2630
2630
  {
2631
2631
  className: H(
@@ -2644,7 +2644,7 @@ const Gr = ta.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ e(
2644
2644
  )
2645
2645
  }
2646
2646
  ));
2647
- Gr.displayName = s0.Root.displayName;
2647
+ Yr.displayName = s0.Root.displayName;
2648
2648
  const rN = {
2649
2649
  workflow_template: "",
2650
2650
  state_keys: [],
@@ -2739,9 +2739,9 @@ function yf({
2739
2739
  ]
2740
2740
  }
2741
2741
  ) }),
2742
- /* @__PURE__ */ e(ra, { className: "w-[--radix-popover-trigger-width] min-w-[440px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { shouldFilter: !1, children: [
2742
+ /* @__PURE__ */ e(ra, { className: "w-[--radix-popover-trigger-width] min-w-[440px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { shouldFilter: !1, children: [
2743
2743
  /* @__PURE__ */ e(ms, { placeholder: "Search people…", value: f, onValueChange: y }),
2744
- /* @__PURE__ */ a(Xr, { children: [
2744
+ /* @__PURE__ */ a(Zr, { children: [
2745
2745
  /* @__PURE__ */ e(ps, { children: f.trim() ? "No matches." : "Type to search…" }),
2746
2746
  /* @__PURE__ */ a(Mi, { children: [
2747
2747
  o && n && /* @__PURE__ */ e(
@@ -2888,14 +2888,14 @@ function vf({
2888
2888
  disabled: !c.workflow_template,
2889
2889
  className: "flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border border-input bg-transparent px-3 py-1.5 text-left text-sm shadow-sm disabled:cursor-not-allowed disabled:opacity-50",
2890
2890
  children: [
2891
- c.state_keys.length === 0 ? /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: c.workflow_template ? "Select state…" : "Pick a workflow first" }) : c.state_keys.map((_) => /* @__PURE__ */ e(Hr, { variant: "outline", className: "text-[11px] font-normal", children: F(_) }, _)),
2891
+ c.state_keys.length === 0 ? /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: c.workflow_template ? "Select state…" : "Pick a workflow first" }) : c.state_keys.map((_) => /* @__PURE__ */ e(Gr, { variant: "outline", className: "text-[11px] font-normal", children: F(_) }, _)),
2892
2892
  /* @__PURE__ */ e(ii, { className: "ml-auto h-3.5 w-3.5 shrink-0 text-muted-foreground" })
2893
2893
  ]
2894
2894
  }
2895
2895
  ) }),
2896
- /* @__PURE__ */ e(ra, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
2896
+ /* @__PURE__ */ e(ra, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
2897
2897
  /* @__PURE__ */ e(ms, { placeholder: "Search states…" }),
2898
- /* @__PURE__ */ a(Xr, { children: [
2898
+ /* @__PURE__ */ a(Zr, { children: [
2899
2899
  /* @__PURE__ */ e(ps, { children: "No states found." }),
2900
2900
  /* @__PURE__ */ e(Mi, { children: b.map((_) => /* @__PURE__ */ a(
2901
2901
  sr,
@@ -2977,7 +2977,7 @@ function vf({
2977
2977
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "The clock only runs during working hours (as configured in Settings — weekends and holidays don't count)." })
2978
2978
  ] }),
2979
2979
  /* @__PURE__ */ e(
2980
- Gr,
2980
+ Yr,
2981
2981
  {
2982
2982
  checked: c.business_hours_only,
2983
2983
  onCheckedChange: (_) => x("business_hours_only", _)
@@ -2995,7 +2995,7 @@ function vf({
2995
2995
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Owners are notified as the record turns amber." })
2996
2996
  ] }),
2997
2997
  /* @__PURE__ */ e(
2998
- Gr,
2998
+ Yr,
2999
2999
  {
3000
3000
  checked: c.notify_on_warning,
3001
3001
  onCheckedChange: (_) => x("notify_on_warning", _)
@@ -3008,7 +3008,7 @@ function vf({
3008
3008
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Owners are notified the moment time runs out." })
3009
3009
  ] }),
3010
3010
  /* @__PURE__ */ e(
3011
- Gr,
3011
+ Yr,
3012
3012
  {
3013
3013
  checked: c.notify_on_breach,
3014
3014
  onCheckedChange: (_) => x("notify_on_breach", _)
@@ -3121,7 +3121,7 @@ function vf({
3121
3121
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "Active" }),
3122
3122
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Paused rules keep their config but stop tracking and notifying." })
3123
3123
  ] }),
3124
- /* @__PURE__ */ e(Gr, { checked: c.is_active, onCheckedChange: (_) => x("is_active", _) })
3124
+ /* @__PURE__ */ e(Yr, { checked: c.is_active, onCheckedChange: (_) => x("is_active", _) })
3125
3125
  ] })
3126
3126
  ] })
3127
3127
  ] }),
@@ -3396,7 +3396,7 @@ function z6() {
3396
3396
  }), o = ve(
3397
3397
  () => [...new Set(r.map((T) => T.workflow_template))],
3398
3398
  [r]
3399
- ), u = wa({
3399
+ ), u = Na({
3400
3400
  queries: o.map((T) => ({
3401
3401
  queryKey: ["sla-template-states", T],
3402
3402
  staleTime: 3e5,
@@ -3557,17 +3557,17 @@ function z6() {
3557
3557
  }
3558
3558
  ) }),
3559
3559
  /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: [
3560
- /* @__PURE__ */ e(Hr, { variant: "outline", className: "whitespace-nowrap text-[10.5px] font-normal", children: j.business_hours_only ? "Business hours" : "Calendar time" }),
3561
- (j.notify_on_warning || j.notify_on_breach) && /* @__PURE__ */ a(Hr, { variant: "outline", className: "gap-1 whitespace-nowrap text-[10.5px] font-normal", children: [
3560
+ /* @__PURE__ */ e(Gr, { variant: "outline", className: "whitespace-nowrap text-[10.5px] font-normal", children: j.business_hours_only ? "Business hours" : "Calendar time" }),
3561
+ (j.notify_on_warning || j.notify_on_breach) && /* @__PURE__ */ a(Gr, { variant: "outline", className: "gap-1 whitespace-nowrap text-[10.5px] font-normal", children: [
3562
3562
  /* @__PURE__ */ e(Ms, { className: "h-2.5 w-2.5" }),
3563
3563
  j.notify_on_warning && j.notify_on_breach ? "Warn + breach" : j.notify_on_warning ? "Warn only" : "Breach only"
3564
3564
  ] }),
3565
- q && /* @__PURE__ */ a(Hr, { variant: "outline", className: "gap-1 whitespace-nowrap text-[10.5px] font-normal", children: [
3565
+ q && /* @__PURE__ */ a(Gr, { variant: "outline", className: "gap-1 whitespace-nowrap text-[10.5px] font-normal", children: [
3566
3566
  /* @__PURE__ */ e(Cb, { className: "h-2.5 w-2.5" }),
3567
3567
  Xi(q)
3568
3568
  ] }),
3569
3569
  O.length > 0 && /* @__PURE__ */ a(
3570
- Hr,
3570
+ Gr,
3571
3571
  {
3572
3572
  variant: "outline",
3573
3573
  className: "whitespace-nowrap text-[10.5px] font-normal",
@@ -3597,7 +3597,7 @@ function z6() {
3597
3597
  }
3598
3598
  ),
3599
3599
  /* @__PURE__ */ e(
3600
- Gr,
3600
+ Yr,
3601
3601
  {
3602
3602
  checked: j.is_active,
3603
3603
  onCheckedChange: (P) => L.mutate({ id: j.id, active: P }),
@@ -3895,7 +3895,7 @@ function kg({
3895
3895
  collections: t,
3896
3896
  className: n
3897
3897
  }) {
3898
- const r = je(), s = wa({
3898
+ const r = je(), s = Na({
3899
3899
  queries: t.map((d) => ({
3900
3900
  queryKey: ["row-highlight-rules", d],
3901
3901
  queryFn: () => r.request(Z("/at-risk/rules/active", { collection: d })).then((o) => o.data ?? []).catch(() => []),
@@ -4377,7 +4377,7 @@ function Ss({
4377
4377
  ) : /* @__PURE__ */ e(ot, { children: n });
4378
4378
  }
4379
4379
  const bN = ["👍", "✅", "👀", "🎉", "❤️", "😂"], _g = ur(null);
4380
- function Zr() {
4380
+ function es() {
4381
4381
  const t = Ka(_g);
4382
4382
  if (!t) throw new Error("Chat components must be wrapped in <ChatProvider>");
4383
4383
  return t;
@@ -4412,7 +4412,7 @@ function gN() {
4412
4412
  }
4413
4413
  }
4414
4414
  function xm(t, n) {
4415
- const r = Zr(), s = jt(), l = (n ?? []).join("|");
4415
+ const r = es(), s = jt(), l = (n ?? []).join("|");
4416
4416
  Ae(() => {
4417
4417
  const i = () => {
4418
4418
  for (const d of t) s.invalidateQueries({ queryKey: d });
@@ -4422,7 +4422,7 @@ function xm(t, n) {
4422
4422
  }, [r.subscribeRooms, r.realtime, l, s]);
4423
4423
  }
4424
4424
  function yN(t, n) {
4425
- const r = Zr(), s = jt();
4425
+ const r = es(), s = jt();
4426
4426
  Ae(() => {
4427
4427
  if (r.realtime)
4428
4428
  return r.realtime(t, () => {
@@ -4431,7 +4431,7 @@ function yN(t, n) {
4431
4431
  }, [r.realtime, t, s]);
4432
4432
  }
4433
4433
  function vN(t) {
4434
- const n = Zr(), r = je(), { data: s, isLoading: l } = se({
4434
+ const n = es(), r = je(), { data: s, isLoading: l } = se({
4435
4435
  queryKey: ["nvr-chat", t],
4436
4436
  queryFn: async () => (await r.request(
4437
4437
  Z("/chat/messages", { room: t, limit: 80 })
@@ -4443,7 +4443,7 @@ function vN(t) {
4443
4443
  return xm([["nvr-chat"], ["nvr-chat-rooms"]], t ? [t] : []), { messages: s ?? [], loading: l };
4444
4444
  }
4445
4445
  function kN(t) {
4446
- Zr();
4446
+ es();
4447
4447
  const n = je(), r = jt();
4448
4448
  return Ue({
4449
4449
  mutationFn: async (s) => {
@@ -4458,7 +4458,7 @@ function kN(t) {
4458
4458
  });
4459
4459
  }
4460
4460
  function Sg() {
4461
- const t = Zr(), n = je(), r = t.me, s = se({
4461
+ const t = es(), n = je(), r = t.me, s = se({
4462
4462
  queryKey: ["nvr-chat-rooms", r == null ? void 0 : r.id],
4463
4463
  queryFn: async () => (await n.request(Z("/chat/rooms"))).data ?? [],
4464
4464
  enabled: !!r,
@@ -4600,7 +4600,7 @@ function SN() {
4600
4600
  let wf = 0;
4601
4601
  const Xm = /* @__PURE__ */ new Map();
4602
4602
  function U6(t, n) {
4603
- const r = Zr();
4603
+ const r = es();
4604
4604
  Ae(() => {
4605
4605
  const s = t > wf;
4606
4606
  if (r.sound && s && gN(), n) {
@@ -4642,7 +4642,7 @@ function CN() {
4642
4642
  });
4643
4643
  }
4644
4644
  function $N(t) {
4645
- const n = Zr(), r = je(), s = (t == null ? void 0 : t.indexOf(":")) ?? -1, l = t && s > 0 ? t.slice(0, s) : null, i = t && s > 0 ? t.slice(s + 1) : null, d = !!t && !!l && !!i && t !== n.globalRoom && l !== "dm" && l !== "ch", { data: o } = se({
4645
+ const n = es(), r = je(), s = (t == null ? void 0 : t.indexOf(":")) ?? -1, l = t && s > 0 ? t.slice(0, s) : null, i = t && s > 0 ? t.slice(s + 1) : null, d = !!t && !!l && !!i && t !== n.globalRoom && l !== "dm" && l !== "ch", { data: o } = se({
4646
4646
  queryKey: ["nvr-chat-room-types"],
4647
4647
  queryFn: async () => (await r.request(Z("/chat/room-types"))).data ?? [],
4648
4648
  enabled: d,
@@ -4692,7 +4692,7 @@ function TN(t, n) {
4692
4692
  }
4693
4693
  const jN = 3e3;
4694
4694
  function LN(t) {
4695
- const n = Zr(), r = je();
4695
+ const n = es(), r = je();
4696
4696
  jt();
4697
4697
  const s = Ee(!1), l = Ee(null), i = n.me, d = Cn(() => {
4698
4698
  l.current && clearTimeout(l.current), l.current = null, s.current && i && n.setTypingRoom && (s.current = !1, n.setTypingRoom(i.id, null));
@@ -4728,7 +4728,7 @@ function LN(t) {
4728
4728
  return { onType: o, clearTyping: d, typingText: c };
4729
4729
  }
4730
4730
  function AN(t) {
4731
- const n = Zr(), r = je(), s = n.me, l = t && s ? Z0(t, s.id) : null, { data: i } = se({
4731
+ const n = es(), r = je(), s = n.me, l = t && s ? Z0(t, s.id) : null, { data: i } = se({
4732
4732
  queryKey: ["nvr-chat-peer-read", t],
4733
4733
  queryFn: async () => {
4734
4734
  var o;
@@ -8833,9 +8833,9 @@ function gc({
8833
8833
  children: _
8834
8834
  }
8835
8835
  ) : /* @__PURE__ */ e(De, { type: "button", variant: "outline", size: "sm", disabled: h, children: _ }) }),
8836
- /* @__PURE__ */ e(ra, { className: "w-[220px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
8836
+ /* @__PURE__ */ e(ra, { className: "w-[220px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
8837
8837
  /* @__PURE__ */ e(ms, { placeholder: "Search templates…", className: "h-8 text-[12px]" }),
8838
- /* @__PURE__ */ a(Xr, { children: [
8838
+ /* @__PURE__ */ a(Zr, { children: [
8839
8839
  /* @__PURE__ */ e(ps, { children: "No template found." }),
8840
8840
  x.map((k) => /* @__PURE__ */ e(
8841
8841
  sr,
@@ -10260,7 +10260,7 @@ function y5({
10260
10260
  placeholder: "0",
10261
10261
  className: H(
10262
10262
  "h-7 w-28 rounded border px-2 text-[12px] tabular-nums focus:outline-none focus:ring-1",
10263
- Ne ? "border-red-400 bg-red-50 text-red-700 focus:ring-red-400" : "border-slate-200 focus:ring-[#00ceff]"
10263
+ Ne ? "border-red-400 bg-red-50 text-red-700 focus:ring-red-400 dark:border-red-700 dark:bg-red-950/30 dark:text-red-300" : "border-slate-200 focus:ring-[#00ceff]"
10264
10264
  )
10265
10265
  }
10266
10266
  );
@@ -10729,7 +10729,7 @@ function N5({
10729
10729
  ).then((Q) => Q.data ?? []),
10730
10730
  enabled: !V,
10731
10731
  staleTime: 3e4
10732
- }), Ht = p ?? [], Wt = wa({
10732
+ }), Ht = p ?? [], Wt = Na({
10733
10733
  queries: Ht.map((Q) => ({
10734
10734
  queryKey: ["resolve-cascade", Y == null ? void 0 : Y.collection, Q.parent_field, t, Q.child_field],
10735
10735
  queryFn: () => W.request(
@@ -10754,11 +10754,11 @@ function N5({
10754
10754
  _exists_junction: { table: fe.table, self_fk: fe.self_fk, filter_fk: fe.filter_fk, value: ze }
10755
10755
  }));
10756
10756
  }), Q;
10757
- }, [Ht, Wt, Y]), Qt = u === "pending", Nn = A ? A.getPendingRows(t, n) : [], wn = Qt && A ? A.getPendingEdits(t, n) : /* @__PURE__ */ new Map(), [Zn, Rn] = S({});
10757
+ }, [Ht, Wt, Y]), Vt = u === "pending", Nn = A ? A.getPendingRows(t, n) : [], wn = Vt && A ? A.getPendingEdits(t, n) : /* @__PURE__ */ new Map(), [Zn, Rn] = S({});
10758
10758
  Ae(() => {
10759
10759
  bn.current || Rn({});
10760
10760
  }, [Kt]);
10761
- const oe = Qt && A ? A.getPendingDeletes(t, n) : /* @__PURE__ */ new Set(), He = ve(
10761
+ const oe = Vt && A ? A.getPendingDeletes(t, n) : /* @__PURE__ */ new Set(), He = ve(
10762
10762
  () => new Map(
10763
10763
  zt.filter((Q) => Q.computed_type === "write" && !!Q.computed_formula).map((Q) => [Q.field, String(Q.computed_formula)])
10764
10764
  ),
@@ -10815,7 +10815,7 @@ function N5({
10815
10815
  };
10816
10816
  }),
10817
10817
  [kt, r, Y == null ? void 0 : Y.draft]
10818
- ), on = wa({
10818
+ ), on = Na({
10819
10819
  queries: Tt.map((Q) => ({
10820
10820
  queryKey: [
10821
10821
  "match-agg",
@@ -10890,13 +10890,13 @@ function N5({
10890
10890
  let Q = Wn ? Yt.map((ie) => ({ ...ie, ...Wn[String(ie.id)] ?? {} })) : Yt;
10891
10891
  if (Ct) {
10892
10892
  const ie = (he) => {
10893
- const fe = Qt ? wn.get(String(he.id)) : void 0, ze = (fe == null ? void 0 : fe[Ct]) ?? he[Ct];
10893
+ const fe = Vt ? wn.get(String(he.id)) : void 0, ze = (fe == null ? void 0 : fe[Ct]) ?? he[Ct];
10894
10894
  return Number(ze ?? -1);
10895
10895
  };
10896
10896
  Q = [...Q].sort((he, fe) => ie(he) - ie(fe));
10897
10897
  }
10898
10898
  if (b && (Q = [...Q].sort((ie, he) => {
10899
- const fe = Qt ? wn.get(String(ie.id)) : void 0, ze = Qt ? wn.get(String(he.id)) : void 0, Qe = (fe == null ? void 0 : fe[b]) ?? ie[b], Xe = (ze == null ? void 0 : ze[b]) ?? he[b];
10899
+ const fe = Vt ? wn.get(String(ie.id)) : void 0, ze = Vt ? wn.get(String(he.id)) : void 0, Qe = (fe == null ? void 0 : fe[b]) ?? ie[b], Xe = (ze == null ? void 0 : ze[b]) ?? he[b];
10900
10900
  let Ze = 0;
10901
10901
  return Qe == null && Xe == null ? Ze = 0 : Qe == null ? Ze = 1 : Xe == null ? Ze = -1 : typeof Qe == "number" && typeof Xe == "number" ? Ze = Qe - Xe : Ze = String(Qe).localeCompare(String(Xe), void 0, { sensitivity: "base" }), F === "desc" ? -Ze : Ze;
10902
10902
  })), C && Wn) {
@@ -10907,7 +10907,7 @@ function N5({
10907
10907
  });
10908
10908
  }
10909
10909
  return Q;
10910
- }, [Yt, Wn, Ct, Qt, wn, b, F, C]), xa = !!C && !!Wn, [Na, Kn] = S(/* @__PURE__ */ new Set()), Jn = (Q) => String(Q[C ?? ""] ?? "").trim() || "Uncategorized", ir = (Q) => Kn((ie) => {
10910
+ }, [Yt, Wn, Ct, Vt, wn, b, F, C]), xa = !!C && !!Wn, [ka, Kn] = S(/* @__PURE__ */ new Set()), Jn = (Q) => String(Q[C ?? ""] ?? "").trim() || "Uncategorized", ir = (Q) => Kn((ie) => {
10911
10911
  const he = new Set(ie);
10912
10912
  return he.has(Q) ? he.delete(Q) : he.add(Q), he;
10913
10913
  }), $s = ve(
@@ -10985,19 +10985,19 @@ function N5({
10985
10985
  Q.set(ie, he != null && he.many_collection && (he != null && he.many_field) ? { grandCollection: he.many_collection, fkField: he.many_field } : null);
10986
10986
  }
10987
10987
  return Q;
10988
- }, [da, we, t]), es = ve(
10988
+ }, [da, we, t]), ts = ve(
10989
10989
  () => [...new Set(
10990
10990
  [...Fa.values()].filter((Q) => !!Q).map((Q) => Q.grandCollection)
10991
10991
  )],
10992
10992
  [Fa]
10993
- ), Xn = wa({
10994
- queries: es.map((Q) => ({
10993
+ ), Xn = Na({
10994
+ queries: ts.map((Q) => ({
10995
10995
  queryKey: ["field-config", Q, null],
10996
10996
  queryFn: () => W.request(Z(`/field-config/${Q}`)).then((ie) => ie.data ?? []),
10997
10997
  staleTime: 6e4
10998
10998
  }))
10999
- }), Ks = wa({
11000
- queries: es.map((Q) => ({
10999
+ }), Ks = Na({
11000
+ queries: ts.map((Q) => ({
11001
11001
  queryKey: ["collection-meta", Q],
11002
11002
  queryFn: () => W.request(Z(`/collections/${Q}`)).then((ie) => {
11003
11003
  var he;
@@ -11007,17 +11007,17 @@ function N5({
11007
11007
  }))
11008
11008
  }), zl = ve(() => {
11009
11009
  const Q = /* @__PURE__ */ new Map();
11010
- return es.forEach((ie, he) => {
11010
+ return ts.forEach((ie, he) => {
11011
11011
  var fe;
11012
11012
  Q.set(ie, ((fe = Xn[he]) == null ? void 0 : fe.data) ?? []);
11013
11013
  }), Q;
11014
- }, [es, Xn]), fa = ve(() => {
11014
+ }, [ts, Xn]), fa = ve(() => {
11015
11015
  const Q = /* @__PURE__ */ new Map();
11016
- return es.forEach((ie, he) => {
11016
+ return ts.forEach((ie, he) => {
11017
11017
  var fe;
11018
11018
  Q.set(ie, ((fe = Ks[he]) == null ? void 0 : fe.data) ?? []);
11019
11019
  }), Q;
11020
- }, [es, Ks]), Fr = ve(() => {
11020
+ }, [ts, Ks]), Fr = ve(() => {
11021
11021
  const Q = /* @__PURE__ */ new Map();
11022
11022
  for (const ie of da) {
11023
11023
  const he = Fa.get(ie);
@@ -11034,7 +11034,7 @@ function N5({
11034
11034
  }, [da, Fa, fa, fs]), Qa = ve(() => Rt.map((Q) => String(Q.id)), [Rt]), Fs = ve(() => `nvr-gf-${Math.abs(x5(`${t}:${O ?? n}`)) % 1e5}`, [t, O, n]), Zs = ve(() => {
11035
11035
  if (!L) return null;
11036
11036
  const Q = [];
11037
- m && (Ct || V || Qt) && Q.push(24), c && Q.push(32), (V || Qt) && Q.push(80), Q.push(220);
11037
+ m && (Ct || V || Vt) && Q.push(24), c && Q.push(32), (V || Vt) && Q.push(80), Q.push(220);
11038
11038
  let ie = 0;
11039
11039
  const he = [];
11040
11040
  return Q.forEach((fe, ze) => {
@@ -11043,19 +11043,19 @@ function N5({
11043
11043
  ), ie += fe;
11044
11044
  }), he.push(`.${Fs} thead tr > *:nth-child(-n+${Q.length}){z-index:3}`), he.push(`.${Fs} tr > *:nth-child(${Q.length}){box-shadow:2px 0 0 0 rgba(100,116,139,0.18)}`), he.join(`
11045
11045
  `);
11046
- }, [L, Fs, m, Ct, V, Qt, c]), [xs, ts] = S(150), _a = Ee(null);
11046
+ }, [L, Fs, m, Ct, V, Vt, c]), [xs, ns] = S(150), wa = Ee(null);
11047
11047
  Ae(() => {
11048
- const Q = _a.current;
11048
+ const Q = wa.current;
11049
11049
  if (!Q || Rt.length <= xs) return;
11050
11050
  const ie = new IntersectionObserver(
11051
11051
  (he) => {
11052
- he.some((fe) => fe.isIntersecting) && ts((fe) => fe + 150);
11052
+ he.some((fe) => fe.isIntersecting) && ns((fe) => fe + 150);
11053
11053
  },
11054
11054
  { rootMargin: "400px" }
11055
11055
  );
11056
11056
  return ie.observe(Q), () => ie.disconnect();
11057
11057
  }, [Rt.length, xs]);
11058
- const Ua = Qa.join(","), Is = o5(t, Qa, !!d && !V), Ra = wa({
11058
+ const Ua = Qa.join(","), Is = o5(t, Qa, !!d && !V), Ra = Na({
11059
11059
  queries: da.map((Q) => {
11060
11060
  const ie = Fa.get(Q);
11061
11061
  return {
@@ -11070,7 +11070,7 @@ function N5({
11070
11070
  staleTime: 3e4
11071
11071
  };
11072
11072
  })
11073
- }), Wr = ve(() => {
11073
+ }), Qr = ve(() => {
11074
11074
  const Q = /* @__PURE__ */ new Map();
11075
11075
  return da.forEach((ie, he) => {
11076
11076
  var Qe;
@@ -11082,9 +11082,9 @@ function N5({
11082
11082
  }
11083
11083
  Q.set(ie, ze);
11084
11084
  }), Q;
11085
- }, [da, Fa, Ra]), ns = K == null ? void 0 : K.report;
11085
+ }, [da, Fa, Ra]), as = K == null ? void 0 : K.report;
11086
11086
  Ae(() => {
11087
- if (!ns || !v || v.length === 0) return;
11087
+ if (!as || !v || v.length === 0) return;
11088
11088
  const Q = `${t}.${n}`, ie = (fe, ze) => {
11089
11089
  const Qe = {};
11090
11090
  for (const [Xe, Ze] of Object.entries(fe))
@@ -11115,20 +11115,20 @@ function N5({
11115
11115
  for (const sn of lt.deleted ?? []) Ze.deleted.push(sn);
11116
11116
  }
11117
11117
  if (oe.size > 0) {
11118
- const mt = Wr.get(ze);
11118
+ const mt = Qr.get(ze);
11119
11119
  for (const Xt of oe)
11120
11120
  for (const lt of (mt == null ? void 0 : mt.get(String(Xt))) ?? [])
11121
11121
  lt.id != null && Ze.deleted.push(lt.id);
11122
11122
  }
11123
11123
  (Ze.created.length || Ze.updated.length || Ze.deleted.length) && (he[Qe.many_collection] = Ze);
11124
11124
  }
11125
- ns(Q, Object.keys(he).length > 0 ? he : null);
11125
+ as(Q, Object.keys(he).length > 0 ? he : null);
11126
11126
  });
11127
11127
  const Mr = ve(() => {
11128
11128
  const Q = /* @__PURE__ */ new Map(), ie = (he, fe) => {
11129
11129
  fe == null || fe === "" || (Q.has(he) || Q.set(he, []), Q.get(he).push(String(fe)));
11130
11130
  };
11131
- for (const [he, fe] of Wr) {
11131
+ for (const [he, fe] of Qr) {
11132
11132
  const ze = Fr.get(he);
11133
11133
  if (!(!ze || ze.size === 0)) {
11134
11134
  for (const Qe of fe.values())
@@ -11158,7 +11158,7 @@ function N5({
11158
11158
  }
11159
11159
  for (const [he, fe] of Q) Q.set(he, [...new Set(fe)].sort());
11160
11160
  return Q;
11161
- }, [Wr, Fr, Nn, wn, Zn]), { data: Va = {} } = se({
11161
+ }, [Qr, Fr, Nn, wn, Zn]), { data: Va = {} } = se({
11162
11162
  queryKey: ["summary-m2o-display", t, ...Array.from(Mr.entries()).flat(2)],
11163
11163
  queryFn: async () => {
11164
11164
  const Q = {};
@@ -11211,7 +11211,7 @@ function N5({
11211
11211
  }
11212
11212
  const fe = String(ie.id), ze = Zn[`${fe}|${Q}`];
11213
11213
  if (ze) return ze;
11214
- const Qe = ((Xt = Wr.get(Q)) == null ? void 0 : Xt.get(fe)) ?? [], Xe = (lt = wn.get(fe)) == null ? void 0 : lt[`__nested_ops_${Q}`];
11214
+ const Qe = ((Xt = Qr.get(Q)) == null ? void 0 : Xt.get(fe)) ?? [], Xe = (lt = wn.get(fe)) == null ? void 0 : lt[`__nested_ops_${Q}`];
11215
11215
  if (!Xe) return Qe;
11216
11216
  const Ze = new Set((Xe.deleted ?? []).map(String)), mt = new Map((Xe.updated ?? []).map((qt) => [String(qt.id), qt.changes]));
11217
11217
  return [
@@ -11219,7 +11219,7 @@ function N5({
11219
11219
  ...Xe.created ?? []
11220
11220
  ];
11221
11221
  }
11222
- function Qr(Q, ie, he) {
11222
+ function Vr(Q, ie, he) {
11223
11223
  var Xt;
11224
11224
  const fe = Q.field.indexOf(".");
11225
11225
  if (fe < 0) return "—";
@@ -11239,7 +11239,7 @@ function N5({
11239
11239
  const fe = Q.field.slice(0, he), ze = Q.field.slice(he + 1), Qe = wl(fe, ie, !1);
11240
11240
  if (Qe.length === 0) return "—";
11241
11241
  const Xe = (Xt = Fr.get(fe)) == null ? void 0 : Xt.get(ze);
11242
- if (!(Xe != null && Xe.one_collection) || !M) return Qr(Q, ie, !1);
11242
+ if (!(Xe != null && Xe.one_collection) || !M) return Vr(Q, ie, !1);
11243
11243
  const Ze = Xe.one_collection, mt = Qe.map((lt) => {
11244
11244
  var xn;
11245
11245
  const qt = lt[ze];
@@ -11258,7 +11258,7 @@ function N5({
11258
11258
  `${lt.id}:${qt}`
11259
11259
  )) });
11260
11260
  }
11261
- const ga = or && (Xs.length > 0 || Ts.length > 0) ? [...Xs, ...Ts] : Ia, na = ve(
11261
+ const _a = or && (Xs.length > 0 || Ts.length > 0) ? [...Xs, ...Ts] : Ia, na = ve(
11262
11262
  () => zt.filter((Q) => Q.group_key === "__apply_values__" && !op.has(Q.type ?? "") && !Qo.has(Q.field)),
11263
11263
  [zt]
11264
11264
  ), bs = ve(
@@ -11286,7 +11286,7 @@ function N5({
11286
11286
  ze.length && Q.push({ field: ie, target: fe.one_collection, filter: he, ids: ze });
11287
11287
  }
11288
11288
  return Q;
11289
- }, [fn, hr, Rt, Nn]), dr = wa({
11289
+ }, [fn, hr, Rt, Nn]), dr = Na({
11290
11290
  queries: Dr.map((Q) => ({
11291
11291
  queryKey: [
11292
11292
  "cascade-stale-sweep",
@@ -11389,7 +11389,7 @@ function N5({
11389
11389
  }
11390
11390
  return Q;
11391
11391
  }
11392
- function Vr(Q, ie) {
11392
+ function Jr(Q, ie) {
11393
11393
  !W || !(h != null && h.some((he) => he.target_type === "lock")) || W.request(
11394
11394
  Ie("/field-rules/evaluate", {
11395
11395
  collection: t,
@@ -11403,24 +11403,24 @@ function N5({
11403
11403
  }).catch(() => {
11404
11404
  });
11405
11405
  }
11406
- function as(Q) {
11406
+ function rs(Q) {
11407
11407
  if (q) return;
11408
11408
  const ie = String(Q.id);
11409
11409
  if ((Ye == null ? void 0 : Ye.rowId) === ie) return;
11410
11410
  const he = ha({ ...Q });
11411
- Nt({ rowId: ie, draft: he }), Vr(ie, he);
11411
+ Nt({ rowId: ie, draft: he }), Jr(ie, he);
11412
11412
  }
11413
11413
  function aa(Q, ie) {
11414
11414
  if (q) return;
11415
11415
  const he = `pending:${ie}`;
11416
11416
  if ((Ye == null ? void 0 : Ye.rowId) === he) return;
11417
11417
  const fe = ha({ ...Q });
11418
- Nt({ rowId: he, draft: fe }), Vr(he, fe);
11418
+ Nt({ rowId: he, draft: fe }), Jr(he, fe);
11419
11419
  }
11420
11420
  function _l() {
11421
- q || (Nt({ rowId: "new", draft: { ...rn } }), Vr("new", { ...rn }));
11421
+ q || (Nt({ rowId: "new", draft: { ...rn } }), Jr("new", { ...rn }));
11422
11422
  }
11423
- function rs() {
11423
+ function ss() {
11424
11424
  var ie;
11425
11425
  const Q = (ie = bn.current) == null ? void 0 : ie.rowId;
11426
11426
  Nt(null), Ut(null), Rn((he) => {
@@ -11491,7 +11491,7 @@ function N5({
11491
11491
  return;
11492
11492
  }
11493
11493
  if (Ye.rowId === "new") {
11494
- if ((V || Qt) && A) {
11494
+ if ((V || Vt) && A) {
11495
11495
  A.queueRow(t, n, { ...Ye.draft }), ie();
11496
11496
  return;
11497
11497
  }
@@ -11513,7 +11513,7 @@ function N5({
11513
11513
  R.invalidateQueries({ queryKey: ["o2m-rows", t, n, r] });
11514
11514
  } else {
11515
11515
  const Qe = new Set(Ia.map((Ze) => Ze.field).filter((Ze) => !Ze.startsWith("__m2m_"))), Xe = Object.fromEntries(Object.entries(Ye.draft).filter(([Ze]) => Qe.has(Ze)));
11516
- if (Qt && A) {
11516
+ if (Vt && A) {
11517
11517
  const Ze = Object.entries(Ye.draft).filter(([lt]) => lt.startsWith("__nested_ops_")), mt = Rt.find((lt) => String(lt.id) === Ye.rowId), Xt = mt ? Object.fromEntries(Object.entries(Xe).filter(([lt, qt]) => String(qt ?? "") !== String(mt[lt] ?? ""))) : Xe;
11518
11518
  A.queueEdit(t, n, Ye.rowId, { ...Xt, ...Object.fromEntries(Ze) }), ie();
11519
11519
  return;
@@ -11542,15 +11542,15 @@ function N5({
11542
11542
  St(!1);
11543
11543
  }
11544
11544
  }
11545
- const [zs, Tr] = S(/* @__PURE__ */ new Set()), [er, Us] = S(null), [Ja, jr] = S(null), [ss, tl] = S(!1), [xr, U] = S(1), [qe, pt] = S(!1), [Dt, cn] = S(!1), [dn, Hn] = S({}), [ca, Kr] = S(!1), [Ma, Ir] = S({}), [br, ls] = S(!1);
11545
+ const [zs, Tr] = S(/* @__PURE__ */ new Set()), [er, Us] = S(null), [Ja, jr] = S(null), [ls, tl] = S(!1), [xr, U] = S(1), [qe, pt] = S(!1), [Dt, cn] = S(!1), [dn, Hn] = S({}), [ca, Kr] = S(!1), [Ma, Ir] = S({}), [br, is] = S(!1);
11546
11546
  function cd(Q, ie) {
11547
11547
  Hn((he) => ({ ...he, [Q]: ie }));
11548
11548
  }
11549
11549
  async function ud() {
11550
11550
  if (Object.keys(Ma).some((ie) => Ma[ie] !== null && Ma[ie] !== void 0)) {
11551
- ls(!0);
11551
+ is(!0);
11552
11552
  try {
11553
- Rt.length && (Qt && A ? Rt.filter((ie) => !oe.has(String(ie.id))).forEach((ie) => A.queueEdit(t, n, String(ie.id), Ma)) : (await Promise.all(
11553
+ Rt.length && (Vt && A ? Rt.filter((ie) => !oe.has(String(ie.id))).forEach((ie) => A.queueEdit(t, n, String(ie.id), Ma)) : (await Promise.all(
11554
11554
  Rt.map(
11555
11555
  (ie) => W.request(Fn(`/items/${t}/${ie.id}${ee}`, Ma))
11556
11556
  )
@@ -11559,7 +11559,7 @@ function N5({
11559
11559
  ), Kr(!1), Ir({});
11560
11560
  } catch {
11561
11561
  } finally {
11562
- ls(!1);
11562
+ is(!1);
11563
11563
  }
11564
11564
  }
11565
11565
  }
@@ -11568,7 +11568,7 @@ function N5({
11568
11568
  const Xe = new Date(he.getFullYear(), he.getMonth() + 1 + Qe, 1), Ze = `${Xe.getFullYear()}-${String(Xe.getMonth() + 1).padStart(2, "0")}-01`;
11569
11569
  return { ...rn, ...dn, [Q]: Ze };
11570
11570
  });
11571
- if ((V || Qt) && A) {
11571
+ if ((V || Vt) && A) {
11572
11572
  for (const ze of fe) A.queueRow(t, n, ze);
11573
11573
  return;
11574
11574
  }
@@ -11586,7 +11586,7 @@ function N5({
11586
11586
  }
11587
11587
  async function nl(Q) {
11588
11588
  const ie = Math.max(1, Math.min(100, xr)), he = Q ? { ...rn, ...dn } : { ...rn };
11589
- if ((V || Qt) && A) {
11589
+ if ((V || Vt) && A) {
11590
11590
  for (let fe = 0; fe < ie; fe++) A.queueRow(t, n, { ...he });
11591
11591
  return;
11592
11592
  }
@@ -11620,10 +11620,10 @@ function N5({
11620
11620
  const ie = [...Rt], [he] = ie.splice(er, 1);
11621
11621
  ie.splice(Ja, 0, he);
11622
11622
  const fe = ie.map((ze, Qe) => ({ row: ze, newOrder: Qe })).filter(({ row: ze, newOrder: Qe }) => {
11623
- const Xe = Qt ? wn.get(String(ze.id)) : void 0, Ze = (Xe == null ? void 0 : Xe[Ct]) ?? ze[Ct];
11623
+ const Xe = Vt ? wn.get(String(ze.id)) : void 0, Ze = (Xe == null ? void 0 : Xe[Ct]) ?? ze[Ct];
11624
11624
  return Number(Ze ?? -1) !== Qe;
11625
11625
  });
11626
- if (Qt && A) {
11626
+ if (Vt && A) {
11627
11627
  fe.forEach(
11628
11628
  ({ row: ze, newOrder: Qe }) => A.queueEdit(t, n, String(ze.id), { [Ct]: Qe })
11629
11629
  ), Nr();
@@ -11642,7 +11642,7 @@ function N5({
11642
11642
  async function pi(Q, ie) {
11643
11643
  ie.stopPropagation();
11644
11644
  const he = Q.id;
11645
- if (Qt && A) {
11645
+ if (Vt && A) {
11646
11646
  A.queueDelete(t, n, String(he)), (Ye == null ? void 0 : Ye.rowId) === String(he) && Nt(null), i && nt((fe) => fe.some((ze) => ze.id === he) ? fe : [...fe, Q]);
11647
11647
  return;
11648
11648
  }
@@ -11666,41 +11666,41 @@ function N5({
11666
11666
  const qt = fe ?? Rt.find((Tn) => String(Tn.id) === he) ?? {}, xn = _i(
11667
11667
  lt,
11668
11668
  (Tn) => {
11669
- var ya, va;
11670
- return Tn.includes(".") ? he ? (va = (ya = pn == null ? void 0 : pn.rows[he]) == null ? void 0 : ya[Tn]) == null ? void 0 : va.value : void 0 : qt[Tn];
11669
+ var ga, ya;
11670
+ return Tn.includes(".") ? he ? (ya = (ga = pn == null ? void 0 : pn.rows[he]) == null ? void 0 : ga[Tn]) == null ? void 0 : ya.value : void 0 : qt[Tn];
11671
11671
  }
11672
11672
  );
11673
11673
  if (xn === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
11674
11674
  const sn = xn.toLocaleString(
11675
11675
  "en-US",
11676
11676
  Gi(ze, ze.format)
11677
- ), ln = lt.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (Tn, ya) => {
11677
+ ), ln = lt.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (Tn, ga) => {
11678
11678
  var Ha, I;
11679
- const va = ya.includes(".") ? he ? (I = (Ha = pn == null ? void 0 : pn.rows[he]) == null ? void 0 : Ha[ya]) == null ? void 0 : I.value : void 0 : qt[ya];
11680
- return va == null || va === "" ? "0" : String(va);
11679
+ const ya = ga.includes(".") ? he ? (I = (Ha = pn == null ? void 0 : pn.rows[he]) == null ? void 0 : Ha[ga]) == null ? void 0 : I.value : void 0 : qt[ga];
11680
+ return ya == null || ya === "" ? "0" : String(ya);
11681
11681
  });
11682
11682
  return /* @__PURE__ */ e("span", { className: "tabular-nums", "data-tip": `${lt} = ${ln} = ${sn}`, children: sn });
11683
11683
  }
11684
11684
  if (Q.interface === "match-agg-column") {
11685
11685
  const lt = ut.get(Q.field);
11686
11686
  if (!lt || !he) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
11687
- const qt = Rt.find((ya) => String(ya.id) === he) ?? {}, xn = (ya, va) => va.split(".").reduce(
11687
+ const qt = Rt.find((ga) => String(ga.id) === he) ?? {}, xn = (ga, ya) => ya.split(".").reduce(
11688
11688
  (Ha, I) => Ha && typeof Ha == "object" ? Ha[I] : void 0,
11689
- ya
11689
+ ga
11690
11690
  ), sn = lt.rows.filter(
11691
- (ya) => lt.cfg.rowKeys.every(([va, Ha]) => {
11692
- const I = xn(ya, va), pe = qt[Ha];
11691
+ (ga) => lt.cfg.rowKeys.every(([ya, Ha]) => {
11692
+ const I = xn(ga, ya), pe = qt[Ha];
11693
11693
  return I == null || pe === null || pe === void 0 ? !1 : String(I) === String(pe);
11694
11694
  })
11695
11695
  );
11696
- let ln = lt.cfg.aggregate === "count" ? sn.length : sn.reduce((ya, va) => ya + (Number(va[lt.cfg.valueField]) || 0), 0);
11696
+ let ln = lt.cfg.aggregate === "count" ? sn.length : sn.reduce((ga, ya) => ga + (Number(ya[lt.cfg.valueField]) || 0), 0);
11697
11697
  if (lt.cfg.formula) {
11698
- const ya = _i(lt.cfg.formula, {
11698
+ const ga = _i(lt.cfg.formula, {
11699
11699
  ...qt,
11700
11700
  __agg__: ln
11701
11701
  });
11702
- if (ya === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
11703
- ln = ya;
11702
+ if (ga === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
11703
+ ln = ga;
11704
11704
  }
11705
11705
  const Tn = ln.toLocaleString("en-US", Gi(ze, lt.cfg.format));
11706
11706
  return /* @__PURE__ */ e("span", { className: "tabular-nums", children: Tn });
@@ -11799,8 +11799,8 @@ function N5({
11799
11799
  }
11800
11800
  if (gn || !V && Ve)
11801
11801
  return /* @__PURE__ */ e("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ e(Ft, { className: "h-4 w-4 animate-spin inline" }) });
11802
- const Ca = (Ye == null ? void 0 : Ye.rowId) === "new", is = ga.length + (V || Qt ? 2 : 1) + (Ct || V || Qt ? 1 : 0), tr = ga.filter((Q) => !pr(Q)).length >= 6 ? "panel" : "inline", Di = (Q) => {
11803
- for (const ie of ga) {
11802
+ const Ca = (Ye == null ? void 0 : Ye.rowId) === "new", zr = (m && (Ct || V || Vt) ? 1 : 0) + (c ? 1 : 0) + (V || Vt ? 1 : 0) + _a.length + 1, tr = _a.filter((Q) => !pr(Q)).length >= 6 ? "panel" : "inline", Di = (Q) => {
11803
+ for (const ie of _a) {
11804
11804
  if (pr(ie)) continue;
11805
11805
  const he = Q[ie.field];
11806
11806
  if (typeof he == "string" && he.trim() !== "" && !/^-?\d+(\.\d+)?$/.test(he.trim()))
@@ -11809,7 +11809,7 @@ function N5({
11809
11809
  return Q.id != null ? `#${Q.id}` : "New line";
11810
11810
  }, Sl = (Q, ie) => {
11811
11811
  const he = (ie == null ? void 0 : ie.rowKey) ?? "__new__", fe = { ...Q };
11812
- for (const ze of ga) {
11812
+ for (const ze of _a) {
11813
11813
  if (ze.computed_type !== "rollup" || !ze.computed_formula) continue;
11814
11814
  let Qe = null;
11815
11815
  try {
@@ -11831,7 +11831,7 @@ function N5({
11831
11831
  }
11832
11832
  Xe != null && (fe[ze.field] = Xe);
11833
11833
  }
11834
- for (const ze of ga)
11834
+ for (const ze of _a)
11835
11835
  if (ze.computed_type === "write" && ze.computed_formula) {
11836
11836
  const Qe = Rs(ze.computed_formula, fe);
11837
11837
  Qe != null && (fe[ze.field] = Qe);
@@ -11853,7 +11853,7 @@ function N5({
11853
11853
  matchCollection: Qe.collection,
11854
11854
  matchQuery: (Xe == null ? void 0 : Xe.query) ?? null,
11855
11855
  matchSeed: (Xe == null ? void 0 : Xe.seed) ?? {}
11856
- } : Q ? Qt ? {
11856
+ } : Q ? Vt ? {
11857
11857
  deferred: !0,
11858
11858
  stagedOps: ie[`__nested_ops_${fe}`] ?? Gd,
11859
11859
  onStagedOpsChange: (Ze) => Ba(`__nested_ops_${fe}`, Ze)
@@ -11873,9 +11873,8 @@ function N5({
11873
11873
  }) }), Bl = (Q) => Q.computed_type === "write" && !!Q.computed_formula || Q.interface === "formula-column" || Q.interface === "match-agg-column" || Q.interface === "relation-path" || !!Q.readonly || pr(Q), Wl = (Q) => (
11874
11874
  // Spans EVERY column — the leading grip/number/status cells are hidden
11875
11875
  // while the panel renders (the panel header already says "Line N · …"),
11876
- // so nothing pushes the form to the right. Overshoot is clamped by the
11877
- // browser to the table's real column count.
11878
- /* @__PURE__ */ e("td", { colSpan: is + (c ? 2 : 1), className: "p-0", children: /* @__PURE__ */ a(
11876
+ // so nothing pushes the form to the right.
11877
+ /* @__PURE__ */ e("td", { colSpan: zr, className: "p-0", children: /* @__PURE__ */ a(
11879
11878
  "div",
11880
11879
  {
11881
11880
  className: "my-1.5 rounded-lg border border-nvr-cyan/40 bg-white px-4 py-3 shadow-[0_6px_24px_-8px_rgba(15,23,42,0.35)] ring-1 ring-nvr-cyan/15 dark:border-nvr-cyan/30 dark:bg-card",
@@ -11897,7 +11896,7 @@ function N5({
11897
11896
  "button",
11898
11897
  {
11899
11898
  type: "button",
11900
- onClick: rs,
11899
+ onClick: ss,
11901
11900
  className: "rounded px-2 py-1 text-[11px] text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
11902
11901
  children: "Cancel"
11903
11902
  }
@@ -11917,7 +11916,7 @@ function N5({
11917
11916
  (() => {
11918
11917
  const ie = [
11919
11918
  ...Ia.filter(Bl),
11920
- ...ga.filter((he) => pr(he))
11919
+ ..._a.filter((he) => pr(he))
11921
11920
  ];
11922
11921
  return ie.length > 0 && (() => {
11923
11922
  const he = Sl(Q.draft, { rowKey: Q.rowId ?? "__new__" });
@@ -11940,7 +11939,7 @@ function N5({
11940
11939
  /* @__PURE__ */ e("span", { className: "mt-0.5 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: Qe ? ea(fe, he[fe.field] ?? Q.draft[fe.field]) : mt != null ? /* @__PURE__ */ e("span", { className: "tabular-nums", children: mt.toLocaleString(
11941
11940
  "en-US",
11942
11941
  Gi(Xe, Xe.format)
11943
- ) }) : fe.computed_type === "rollup" ? ea(fe, he[fe.field] ?? Q.draft[fe.field], Q.rowId) : pr(fe) ? Qr(fe, Q.draft, !0) : ea(fe, Q.draft[fe.field], Q.rowId) })
11942
+ ) }) : fe.computed_type === "rollup" ? ea(fe, he[fe.field] ?? Q.draft[fe.field], Q.rowId) : pr(fe) ? Vr(fe, Q.draft, !0) : ea(fe, Q.draft[fe.field], Q.rowId) })
11944
11943
  ] }, fe.field);
11945
11944
  }) });
11946
11945
  })();
@@ -11950,12 +11949,12 @@ function N5({
11950
11949
  {
11951
11950
  className: "grid items-start gap-x-4 gap-y-3",
11952
11951
  style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
11953
- children: ga.filter((ie) => !Bl(ie)).map((ie) => {
11952
+ children: _a.filter((ie) => !Bl(ie)).map((ie) => {
11954
11953
  var Qe, Xe;
11955
11954
  const he = ie.computed_type === "write" && !!ie.computed_formula, fe = ie.label || Bt(ie.field), ze = ie.interface === "formula-column" || ie.interface === "match-agg-column" || ie.interface === "relation-path";
11956
11955
  return pr(ie) ? /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
11957
11956
  /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: fe }),
11958
- /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: Qr(ie, Q.draft, !0) })
11957
+ /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: Vr(ie, Q.draft, !0) })
11959
11958
  ] }, ie.field) : /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
11960
11959
  /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: fe }),
11961
11960
  he ? /* @__PURE__ */ e("div", { className: "text-[12px] italic text-slate-500", children: ea(ie, Rs(ie.computed_formula, Q.draft) ?? Q.draft[ie.field]) }) : ze || ie.readonly || (Qe = Ye == null ? void 0 : Ye.locks) != null && Qe.includes(ie.field) ? /* @__PURE__ */ e(
@@ -12085,7 +12084,7 @@ function N5({
12085
12084
  parentDraft: Y == null ? void 0 : Y.draft,
12086
12085
  invalidate: () => R.invalidateQueries({ queryKey: ["o2m-rows", t, n, r] }),
12087
12086
  staging: A,
12088
- stagingActive: (V || Qt) && !!A,
12087
+ stagingActive: (V || Vt) && !!A,
12089
12088
  pendingRows: Nn,
12090
12089
  pendingEdits: wn,
12091
12090
  pendingDeletes: oe
@@ -12125,7 +12124,7 @@ function N5({
12125
12124
  return;
12126
12125
  }
12127
12126
  const ze = String(ie.id);
12128
- if (Qt && A) {
12127
+ if (Vt && A) {
12129
12128
  A.queueEdit(t, n, ze, he);
12130
12129
  return;
12131
12130
  }
@@ -12194,7 +12193,7 @@ function N5({
12194
12193
  onClick: () => Kr((Q) => !Q),
12195
12194
  className: H(
12196
12195
  "h-6 px-2.5 rounded border transition-colors",
12197
- ca ? "border-amber-400 bg-amber-50 text-amber-700" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
12196
+ ca ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
12198
12197
  ),
12199
12198
  children: "apply values…"
12200
12199
  }
@@ -12252,24 +12251,24 @@ function N5({
12252
12251
  ] }),
12253
12252
  q && wr,
12254
12253
  /* @__PURE__ */ a("div", { className: Me ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${L ? " overflow-x-auto" : ""}`, children: [
12255
- ss && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
12254
+ ls && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
12256
12255
  /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5 animate-spin" }),
12257
12256
  "Saving order…"
12258
12257
  ] }) }),
12259
12258
  Zs && /* @__PURE__ */ e("style", { children: Zs }),
12260
12259
  /* @__PURE__ */ a("table", { className: L ? `w-full min-w-max ${Fs}` : "w-full table-fixed", children: [
12261
12260
  /* @__PURE__ */ e("thead", { className: "bg-slate-50 border-b border-slate-200 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg", children: /* @__PURE__ */ a("tr", { children: [
12262
- m && (Ct || V || Qt) && /* @__PURE__ */ e("th", { className: "w-6" }),
12261
+ m && (Ct || V || Vt) && /* @__PURE__ */ e("th", { className: "w-6" }),
12263
12262
  c && /* @__PURE__ */ e("th", { className: "w-8 px-2 py-2 text-left font-medium text-slate-400 text-[11px]", children: "#" }),
12264
- (V || Qt) && /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-400 text-[11px] w-20", children: "Status" }),
12265
- ga.map((Q) => /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]", children: Q.label ?? Bt(Q.field) }, Q.field)),
12263
+ (V || Vt) && /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-400 text-[11px] w-20", children: "Status" }),
12264
+ _a.map((Q) => /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]", children: Q.label ?? Bt(Q.field) }, Q.field)),
12266
12265
  /* @__PURE__ */ e("th", { className: "w-20" })
12267
12266
  ] }) }),
12268
12267
  /* @__PURE__ */ a("tbody", { children: [
12269
12268
  Dt && /* @__PURE__ */ a("tr", { className: "border-b border-[#00ceff]/20 bg-[#00ceff]/5", children: [
12270
- m && (Ct || V || Qt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12269
+ m && (Ct || V || Vt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12271
12270
  c && /* @__PURE__ */ e("td", { className: "w-8" }),
12272
- (V || Qt) && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-[#009abe]", children: "Defaults" }) }),
12271
+ (V || Vt) && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-[#009abe]", children: "Defaults" }) }),
12273
12272
  bs.map((Q) => /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e(
12274
12273
  ml,
12275
12274
  {
@@ -12293,7 +12292,7 @@ function N5({
12293
12292
  ) })
12294
12293
  ] }),
12295
12294
  !V && Pt === "original" && Rt.slice(0, xs).map((Q, ie) => {
12296
- const he = String(Q.id), fe = xa ? Jn(Q) : null, ze = fe !== null && (ie === 0 || Jn(Rt[ie - 1]) !== fe), Qe = fe !== null && Na.has(fe), Xe = ze && fe !== null ? /* @__PURE__ */ e("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ e("td", { colSpan: ga.length + 1 + (V || Qt ? 1 : 0) + (c ? 1 : 0) + (m && (Ct || V || Qt) ? 1 : 0), className: "px-2 py-1", children: /* @__PURE__ */ a(
12295
+ const he = String(Q.id), fe = xa ? Jn(Q) : null, ze = fe !== null && (ie === 0 || Jn(Rt[ie - 1]) !== fe), Qe = fe !== null && ka.has(fe), Xe = ze && fe !== null ? /* @__PURE__ */ e("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ e("td", { colSpan: zr, className: "px-2 py-1", children: /* @__PURE__ */ a(
12297
12296
  "button",
12298
12297
  {
12299
12298
  type: "button",
@@ -12322,7 +12321,7 @@ function N5({
12322
12321
  onDragOver: (ln) => js(ln, ie),
12323
12322
  onDrop: md,
12324
12323
  onDragEnd: Nr,
12325
- onClick: () => !Ze && !qt && as(xn),
12324
+ onClick: () => !Ze && !qt && rs(xn),
12326
12325
  onBlur: (ln) => {
12327
12326
  !Ze || _e || qt || ln.currentTarget.contains(ln.relatedTarget) || nn(ln.relatedTarget) || (Lt.current = setTimeout(() => {
12328
12327
  Jt.current || nn(document.activeElement) || Ea();
@@ -12341,9 +12340,9 @@ function N5({
12341
12340
  ),
12342
12341
  children: [
12343
12342
  !(Ze && !qt && tr === "panel") && /* @__PURE__ */ a(ot, { children: [
12344
- m && (Ct || Qt) && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (ln) => ln.stopPropagation(), children: Ct && /* @__PURE__ */ e(Go, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
12343
+ m && (Ct || Vt) && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (ln) => ln.stopPropagation(), children: Ct && /* @__PURE__ */ e(Go, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
12345
12344
  c && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: ie + 1 }),
12346
- Qt && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: qt ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5", children: "Delete" }) : lt ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null })
12345
+ Vt && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: qt ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: "Delete" }) : lt ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null })
12347
12346
  ] }),
12348
12347
  Ze && !qt && tr === "panel" ? Wl({
12349
12348
  identity: `${c ? `Line ${ie + 1} · ` : ""}${Di(xn)}`,
@@ -12354,11 +12353,11 @@ function N5({
12354
12353
  drawer: gs(he, (Ye == null ? void 0 : Ye.draft) ?? xn)
12355
12354
  }) : (() => {
12356
12355
  const ln = Sl(xn, { rowKey: he });
12357
- return ga.map((Tn) => {
12356
+ return _a.map((Tn) => {
12358
12357
  if (pr(Tn))
12359
12358
  return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: el(Tn, xn) }) }, Tn.field);
12360
- const ya = Tn.computed_type === "write" && !!Tn.computed_formula, va = ya ? Rs(Tn.computed_formula, Ze ? (Ye == null ? void 0 : Ye.draft) ?? xn : xn) ?? xn[Tn.field] : null;
12361
- return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: ya ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: ea(Tn, va) }) : Ze && !qt || mr(Tn.interface) ? /* @__PURE__ */ e("div", { onClick: (Ha) => Ha.stopPropagation(), children: /* @__PURE__ */ e(
12359
+ const ga = Tn.computed_type === "write" && !!Tn.computed_formula, ya = ga ? Rs(Tn.computed_formula, Ze ? (Ye == null ? void 0 : Ye.draft) ?? xn : xn) ?? xn[Tn.field] : null;
12360
+ return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: ga ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: ea(Tn, ya) }) : Ze && !qt || mr(Tn.interface) ? /* @__PURE__ */ e("div", { onClick: (Ha) => Ha.stopPropagation(), children: /* @__PURE__ */ e(
12362
12361
  ml,
12363
12362
  {
12364
12363
  field: { ...Tn, sort: Tn.sort ?? 0 },
@@ -12388,7 +12387,7 @@ function N5({
12388
12387
  "button",
12389
12388
  {
12390
12389
  type: "button",
12391
- onClick: rs,
12390
+ onClick: ss,
12392
12391
  className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
12393
12392
  children: "✕"
12394
12393
  }
@@ -12412,9 +12411,9 @@ function N5({
12412
12411
  title: "Undo edit",
12413
12412
  onClick: (ln) => {
12414
12413
  ln.stopPropagation(), A == null || A.cancelPendingEdit(t, n, he), Rn((Tn) => {
12415
- const ya = {};
12416
- for (const [va, Ha] of Object.entries(Tn)) va.startsWith(`${he}|`) || (ya[va] = Ha);
12417
- return ya;
12414
+ const ga = {};
12415
+ for (const [ya, Ha] of Object.entries(Tn)) ya.startsWith(`${he}|`) || (ga[ya] = Ha);
12416
+ return ga;
12418
12417
  });
12419
12418
  },
12420
12419
  className: "rounded p-0.5 text-amber-400 hover:text-amber-600 text-[10px]",
@@ -12457,7 +12456,7 @@ function N5({
12457
12456
  sn && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ a(
12458
12457
  "td",
12459
12458
  {
12460
- colSpan: is,
12459
+ colSpan: zr,
12461
12460
  className: "border-b border-red-100 bg-red-50/60 px-3 py-1 text-[11px] leading-snug text-red-700 dark:border-red-900/30 dark:bg-red-900/10 dark:text-red-400",
12462
12461
  children: [
12463
12462
  "⚠ ",
@@ -12465,8 +12464,8 @@ function N5({
12465
12464
  ]
12466
12465
  }
12467
12466
  ) }),
12468
- Ze && !qt && tr !== "panel" && v && v.length > 0 && /* @__PURE__ */ e("tr", { "data-o2m-editing": !0, className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: is, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: v.map((ln) => {
12469
- const Tn = typeof ln == "string" ? ln : ln.field, ya = typeof ln == "string" ? void 0 : ln.hint, va = typeof ln == "string" ? void 0 : ln.match, Ha = (Ye == null ? void 0 : Ye.draft) ?? xn, I = va ? Ou(va, Ha, r, Y == null ? void 0 : Y.draft) : null;
12467
+ Ze && !qt && tr !== "panel" && v && v.length > 0 && /* @__PURE__ */ e("tr", { "data-o2m-editing": !0, className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: zr, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: v.map((ln) => {
12468
+ const Tn = typeof ln == "string" ? ln : ln.field, ga = typeof ln == "string" ? void 0 : ln.hint, ya = typeof ln == "string" ? void 0 : ln.match, Ha = (Ye == null ? void 0 : Ye.draft) ?? xn, I = ya ? Ou(ya, Ha, r, Y == null ? void 0 : Y.draft) : null;
12470
12469
  return /* @__PURE__ */ e(
12471
12470
  ip,
12472
12471
  {
@@ -12474,13 +12473,13 @@ function N5({
12474
12473
  relationField: Tn,
12475
12474
  parentRowId: he,
12476
12475
  parentDraft: (Ye == null ? void 0 : Ye.draft) ?? xn,
12477
- hint: ya,
12476
+ hint: ga,
12478
12477
  outerGridInvalidateKey: ["o2m-rows", t, n, r],
12479
- ...va ? {
12480
- matchCollection: va.collection,
12478
+ ...ya ? {
12479
+ matchCollection: ya.collection,
12481
12480
  matchQuery: (I == null ? void 0 : I.query) ?? null,
12482
12481
  matchSeed: (I == null ? void 0 : I.seed) ?? {}
12483
- } : Qt ? {
12482
+ } : Vt ? {
12484
12483
  deferred: !0,
12485
12484
  stagedOps: (Ye == null ? void 0 : Ye.draft[`__nested_ops_${Tn}`]) ?? Gd,
12486
12485
  onStagedOpsChange: (pe) => Ba(`__nested_ops_${Tn}`, pe)
@@ -12493,9 +12492,9 @@ function N5({
12493
12492
  }),
12494
12493
  Ca && /* @__PURE__ */ a("tr", { "data-o2m-editing": !0, className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5", children: [
12495
12494
  tr !== "panel" && /* @__PURE__ */ a(ot, { children: [
12496
- (Ct || V || Qt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12495
+ (Ct || V || Vt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12497
12496
  c && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: Rt.length + Nn.length + 1 }),
12498
- (V || Qt) && /* @__PURE__ */ e("td", { className: "px-3 py-1.5" })
12497
+ (V || Vt) && /* @__PURE__ */ e("td", { className: "px-3 py-1.5" })
12499
12498
  ] }),
12500
12499
  tr === "panel" ? Wl({
12501
12500
  identity: `${c ? `Line ${Rt.length + Nn.length + 1} · ` : ""}New line`,
@@ -12503,9 +12502,9 @@ function N5({
12503
12502
  rowId: void 0,
12504
12503
  saveLabel: "Save",
12505
12504
  drawer: gs(void 0, Ye.draft)
12506
- }) : ga.map((Q) => {
12505
+ }) : _a.map((Q) => {
12507
12506
  if (pr(Q))
12508
- return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Qr(Q, Ye.draft, !0) }) }, Q.field);
12507
+ return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Vr(Q, Ye.draft, !0) }) }, Q.field);
12509
12508
  const ie = Q.computed_type === "write" && !!Q.computed_formula, he = mr(Q.interface), fe = `__m2m_${Q.field}`, ze = he ? Oa(Q) : null;
12510
12509
  return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: ie ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: ea(Q, Rs(Q.computed_formula, Ye.draft) ?? null) }) : he && ze ? /* @__PURE__ */ e("div", { onClick: (Qe) => Qe.stopPropagation(), children: /* @__PURE__ */ e(
12511
12510
  Es,
@@ -12543,36 +12542,36 @@ function N5({
12543
12542
  "button",
12544
12543
  {
12545
12544
  type: "button",
12546
- onClick: rs,
12545
+ onClick: ss,
12547
12546
  className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
12548
12547
  children: "✕"
12549
12548
  }
12550
12549
  )
12551
12550
  ] }) })
12552
12551
  ] }),
12553
- Rt.length === 0 && Nn.length === 0 && !Ca && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: ga.length + (V || Qt ? 2 : 1) + (Ct || V || Qt ? 1 : 0), className: "px-3 py-14 text-center text-slate-400", children: P ? `No ${P.toLowerCase()} yet` : V ? "No pending rows" : "No rows yet" }) }),
12552
+ Rt.length === 0 && Nn.length === 0 && !Ca && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: zr, className: "px-3 py-14 text-center text-slate-400", children: P ? `No ${P.toLowerCase()} yet` : V ? "No pending rows" : "No rows yet" }) }),
12554
12553
  !V && Pt !== "original" && (() => {
12555
- const Q = ae.find((he) => he.addendumId === Pt), ie = (m && (Ct || Qt) ? 1 : 0) + (c ? 1 : 0) + (Qt ? 1 : 0) + ga.length + 1;
12554
+ const Q = ae.find((he) => he.addendumId === Pt), ie = (m && (Ct || Vt) ? 1 : 0) + (c ? 1 : 0) + (Vt ? 1 : 0) + _a.length + 1;
12556
12555
  return Q ? Q.rows.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: ie, className: "px-3 py-8 text-center text-[11px] text-amber-500", children: "No proposed rows in this addendum" }) }) : Q.rows.map((he, fe) => {
12557
12556
  const ze = ha({ ...he }), Qe = Rt.find((lt) => String(lt.id) === String(ze.id)), Xe = Qe ? ha({ ...Qe }) : void 0, Ze = !Xe, mt = new Set(
12558
12557
  Ze ? Ia.map((lt) => lt.field) : Ia.filter((lt) => String(ze[lt.field] ?? "") !== String(Xe[lt.field] ?? "")).map((lt) => lt.field)
12559
12558
  ), Xt = Ze || mt.size > 0;
12560
12559
  return /* @__PURE__ */ a("tr", { className: Xt ? "border-b border-amber-100 bg-amber-50/40 dark:border-amber-500/25 dark:bg-amber-400/10" : "border-b border-slate-100", children: [
12561
- m && (Ct || Qt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12560
+ m && (Ct || Vt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12562
12561
  c && /* @__PURE__ */ e("td", { className: `w-8 px-2 align-middle text-[11px] select-none ${Xt ? "text-amber-400" : "text-slate-400"}`, children: fe + 1 }),
12563
- Qt && /* @__PURE__ */ e("td", { className: "w-20" }),
12564
- ga.map((lt) => /* @__PURE__ */ e("td", { className: `px-2 py-1.5 text-[11px] ${mt.has(lt.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`, children: pr(lt) ? el(lt, ze) : ea(lt, ze[lt.field], ze.id != null ? String(ze.id) : void 0) }, lt.field)),
12562
+ Vt && /* @__PURE__ */ e("td", { className: "w-20" }),
12563
+ _a.map((lt) => /* @__PURE__ */ e("td", { className: `px-2 py-1.5 text-[11px] ${mt.has(lt.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`, children: pr(lt) ? el(lt, ze) : ea(lt, ze[lt.field], ze.id != null ? String(ze.id) : void 0) }, lt.field)),
12565
12564
  /* @__PURE__ */ e("td", { className: "w-20 px-2 py-1.5 text-right", children: Xt && /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children: Ze ? "New" : "Modified" }) })
12566
12565
  ] }, fe);
12567
12566
  }) : Rt.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: ie, className: "px-3 py-8 text-center text-[11px] text-slate-400", children: P ? `No ${P.toLowerCase()} yet` : "No rows" }) }) : Rt.map((he, fe) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100", children: [
12568
- m && (Ct || Qt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12567
+ m && (Ct || Vt) && /* @__PURE__ */ e("td", { className: "w-6" }),
12569
12568
  c && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: fe + 1 }),
12570
- Qt && /* @__PURE__ */ e("td", { className: "w-20" }),
12571
- ga.map((ze) => /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: pr(ze) ? el(ze, he) : ea(ze, he[ze.field], he.id != null ? String(he.id) : void 0) }, ze.field)),
12569
+ Vt && /* @__PURE__ */ e("td", { className: "w-20" }),
12570
+ _a.map((ze) => /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: pr(ze) ? el(ze, he) : ea(ze, he[ze.field], he.id != null ? String(he.id) : void 0) }, ze.field)),
12572
12571
  /* @__PURE__ */ e("td", { className: "w-20" })
12573
12572
  ] }, fe));
12574
12573
  })(),
12575
- !V && Pt === "original" && Rt.length > xs && /* @__PURE__ */ e("tr", { ref: _a, children: /* @__PURE__ */ a("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
12574
+ !V && Pt === "original" && Rt.length > xs && /* @__PURE__ */ e("tr", { ref: wa, children: /* @__PURE__ */ a("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
12576
12575
  "Showing ",
12577
12576
  xs,
12578
12577
  " of ",
@@ -12630,9 +12629,9 @@ function N5({
12630
12629
  drawer: gs(void 0, (Ye == null ? void 0 : Ye.draft) ?? Q)
12631
12630
  }) : (() => {
12632
12631
  const Ze = Sl(fe ? Ye.draft : Q, { rowKey: he });
12633
- return ga.map((mt) => {
12632
+ return _a.map((mt) => {
12634
12633
  if (pr(mt))
12635
- return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Qr(mt, fe ? Ye.draft : Q, !0) }) }, mt.field);
12634
+ return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Vr(mt, fe ? Ye.draft : Q, !0) }) }, mt.field);
12636
12635
  const Xt = mt.computed_type === "write" && !!mt.computed_formula, lt = mr(mt.interface), qt = `__m2m_${mt.field}`, xn = lt && fe ? Oa(mt) : null, sn = Xt ? Rs(mt.computed_formula, fe ? Ye.draft : Q) ?? Q[mt.field] : fe ? Ye.draft[mt.field] : Q[mt.field];
12637
12636
  return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: Xt ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: ea(mt, sn) }) : lt && fe && xn ? /* @__PURE__ */ e("div", { onClick: (ln) => ln.stopPropagation(), children: /* @__PURE__ */ e(
12638
12637
  Es,
@@ -12671,7 +12670,7 @@ function N5({
12671
12670
  "button",
12672
12671
  {
12673
12672
  type: "button",
12674
- onClick: rs,
12673
+ onClick: ss,
12675
12674
  className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
12676
12675
  children: "✕"
12677
12676
  }
@@ -12704,7 +12703,7 @@ function N5({
12704
12703
  ]
12705
12704
  }
12706
12705
  ),
12707
- fe && tr !== "panel" && v && v.length > 0 && /* @__PURE__ */ e("tr", { "data-o2m-editing": !0, className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: is, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: v.map((Ze) => {
12706
+ fe && tr !== "panel" && v && v.length > 0 && /* @__PURE__ */ e("tr", { "data-o2m-editing": !0, className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: zr, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: v.map((Ze) => {
12708
12707
  const mt = typeof Ze == "string" ? Ze : Ze.field, Xt = typeof Ze == "string" ? void 0 : Ze.hint;
12709
12708
  return /* @__PURE__ */ e(
12710
12709
  ip,
@@ -12724,7 +12723,7 @@ function N5({
12724
12723
  })
12725
12724
  ] }),
12726
12725
  Pt === "original" && (() => {
12727
- if (ga.filter((he) => !!(he.options ? typeof he.options == "string" ? (() => {
12726
+ if (_a.filter((he) => !!(he.options ? typeof he.options == "string" ? (() => {
12728
12727
  try {
12729
12728
  return JSON.parse(he.options);
12730
12729
  } catch {
@@ -12741,10 +12740,10 @@ function N5({
12741
12740
  ...Nn.map((he, fe) => Sl(ha(he), { rowKey: `pending:${fe}` }))
12742
12741
  ];
12743
12742
  return /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ a("tr", { className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600", children: [
12744
- m && (Ct || V || Qt) && /* @__PURE__ */ e("td", {}),
12743
+ m && (Ct || V || Vt) && /* @__PURE__ */ e("td", {}),
12745
12744
  c && /* @__PURE__ */ e("td", {}),
12746
- (V || Qt) && /* @__PURE__ */ e("td", {}),
12747
- ga.map((he) => {
12745
+ (V || Vt) && /* @__PURE__ */ e("td", {}),
12746
+ _a.map((he) => {
12748
12747
  const fe = he.options ? typeof he.options == "string" ? (() => {
12749
12748
  try {
12750
12749
  return JSON.parse(he.options);
@@ -12794,7 +12793,7 @@ function N5({
12794
12793
  ] }) });
12795
12794
  })()
12796
12795
  ] }),
12797
- en && /* @__PURE__ */ e("div", { className: "border-t border-red-100 bg-red-50 px-3 py-1.5 text-[11px] text-red-600", children: en }),
12796
+ en && /* @__PURE__ */ e("div", { className: "border-t border-red-100 bg-red-50 px-3 py-1.5 text-[11px] text-red-600 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: en }),
12798
12797
  Pt === "original" && !Ca && !q && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ e(
12799
12798
  "button",
12800
12799
  {
@@ -13110,7 +13109,7 @@ function S5({
13110
13109
  for (const He of de) oe.add(He);
13111
13110
  for (const He of ge) oe.add(String(He.id));
13112
13111
  return [...oe];
13113
- }, [P, V, de, ge]), st = wa({
13112
+ }, [P, V, de, ge]), st = Na({
13114
13113
  queries: (l.related_columns ?? []).map((oe) => {
13115
13114
  const He = Zd(oe.match, $);
13116
13115
  return {
@@ -13220,7 +13219,7 @@ function S5({
13220
13219
  return Tt != null && Tt !== "" ? String(Tt) : null;
13221
13220
  })
13222
13221
  ].some((kt) => kt && rt.idents.has(kt)) ? rt.error : null;
13223
- }, Nt = l.summary_fields ?? [], bn = R.map((oe) => String(oe.id)).join(","), _e = wa({
13222
+ }, Nt = l.summary_fields ?? [], bn = R.map((oe) => String(oe.id)).join(","), _e = Na({
13224
13223
  queries: Nt.filter((oe) => oe.m2m).map((oe) => ({
13225
13224
  queryKey: ["catalog-summary-m2m", oe.field, oe.m2m.junction, bn],
13226
13225
  queryFn: async () => {
@@ -13495,7 +13494,7 @@ function S5({
13495
13494
  const Tt = (an(He) ?? 0) + 1;
13496
13495
  await Ht(He, String(Tt), kt);
13497
13496
  }
13498
- const Qt = V.length, Nn = Object.keys(l.copy_fields ?? {}), wn = Object.keys(l.compute_fields ?? {}), Zn = (oe, He) => {
13497
+ const Vt = V.length, Nn = Object.keys(l.copy_fields ?? {}), wn = Object.keys(l.compute_fields ?? {}), Zn = (oe, He) => {
13499
13498
  const at = an(oe), kt = F[oe], Tt = kt !== void 0 ? kt : at && at > 0 ? String(at) : "";
13500
13499
  return /* @__PURE__ */ e(
13501
13500
  "input",
@@ -13534,7 +13533,7 @@ function S5({
13534
13533
  }
13535
13534
  ),
13536
13535
  /* @__PURE__ */ a("span", { className: "shrink-0 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-muted dark:text-slate-400", children: [
13537
- Qt,
13536
+ Vt,
13538
13537
  " picked"
13539
13538
  ] })
13540
13539
  ] }),
@@ -13861,9 +13860,9 @@ function S5({
13861
13860
  min: 0,
13862
13861
  step: "any",
13863
13862
  defaultValue: ut.row[Rt] == null ? "" : String(ut.row[Rt]),
13864
- onBlur: (Na) => void Wt(ut.key, Rt, Na.target.value),
13865
- onKeyDown: (Na) => {
13866
- Na.key === "Enter" && Na.currentTarget.blur();
13863
+ onBlur: (ka) => void Wt(ut.key, Rt, ka.target.value),
13864
+ onKeyDown: (ka) => {
13865
+ ka.key === "Enter" && ka.currentTarget.blur();
13867
13866
  },
13868
13867
  className: "h-7 w-20 shrink-0 rounded border border-slate-200 bg-white px-2 text-right text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
13869
13868
  },
@@ -13884,12 +13883,12 @@ function S5({
13884
13883
  ] }),
13885
13884
  wn.map((Rt) => {
13886
13885
  var Kn, Jn;
13887
- const xa = ut.row[Rt], Na = xa != null && xa !== "" ? xa : Rs(((Kn = l.compute_fields) == null ? void 0 : Kn[Rt]) ?? "", ut.row);
13886
+ const xa = ut.row[Rt], ka = xa != null && xa !== "" ? xa : Rs(((Kn = l.compute_fields) == null ? void 0 : Kn[Rt]) ?? "", ut.row);
13888
13887
  return /* @__PURE__ */ e(
13889
13888
  "span",
13890
13889
  {
13891
13890
  className: "w-20 shrink-0 text-right tabular-nums text-slate-600 dark:text-slate-300",
13892
- children: kn(Na, (Jn = l.field_formats) == null ? void 0 : Jn[Rt])
13891
+ children: kn(ka, (Jn = l.field_formats) == null ? void 0 : Jn[Rt])
13893
13892
  },
13894
13893
  Rt
13895
13894
  );
@@ -14273,7 +14272,7 @@ function q5({
14273
14272
  for (const Y of w) V.add(String(Y.id));
14274
14273
  for (const Y of l) V.add(Y);
14275
14274
  return [...V];
14276
- }, [w, l]), W = wa({
14275
+ }, [w, l]), W = Na({
14277
14276
  queries: d.map((V) => {
14278
14277
  const Y = Zd(V.match, o);
14279
14278
  return {
@@ -15921,7 +15920,7 @@ function ty({
15921
15920
  ]
15922
15921
  }
15923
15922
  ) }),
15924
- /* @__PURE__ */ e(ra, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { shouldFilter: !1, children: [
15923
+ /* @__PURE__ */ e(ra, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { shouldFilter: !1, children: [
15925
15924
  /* @__PURE__ */ e(
15926
15925
  ms,
15927
15926
  {
@@ -15931,7 +15930,7 @@ function ty({
15931
15930
  className: "h-9 text-[13px]"
15932
15931
  }
15933
15932
  ),
15934
- /* @__PURE__ */ a(Xr, { children: [
15933
+ /* @__PURE__ */ a(Zr, { children: [
15935
15934
  D ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ e(Ft, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ e(ps, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
15936
15935
  /* @__PURE__ */ e(Mi, { children: !D && (T ? [...j] : [...j].sort(
15937
15936
  (te, xe) => l === "-label" ? de(xe).localeCompare(de(te)) : de(te).localeCompare(de(xe))
@@ -16112,7 +16111,7 @@ function D5({
16112
16111
  ]
16113
16112
  }
16114
16113
  ) }),
16115
- /* @__PURE__ */ e(ra, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { shouldFilter: !1, children: [
16114
+ /* @__PURE__ */ e(ra, { className: "w-[320px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { shouldFilter: !1, children: [
16116
16115
  /* @__PURE__ */ e(
16117
16116
  ms,
16118
16117
  {
@@ -16136,7 +16135,7 @@ function D5({
16136
16135
  ]
16137
16136
  }
16138
16137
  ),
16139
- /* @__PURE__ */ a(Xr, { children: [
16138
+ /* @__PURE__ */ a(Zr, { children: [
16140
16139
  D ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ e(Ft, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : /* @__PURE__ */ e(ps, { className: "py-3 text-left text-[12px] text-muted-foreground px-3", children: "No results" }),
16141
16140
  !D && /* @__PURE__ */ e(Mi, { children: [...j].sort(
16142
16141
  (ue, J) => T ? 0 : l === "-label" ? te(J).localeCompare(te(ue)) : te(ue).localeCompare(te(J))
@@ -17189,13 +17188,13 @@ function ml({
17189
17188
  if (g === "color")
17190
17189
  return /* @__PURE__ */ e(Kf, { field: t, value: n, onChange: r, readOnly: !0 });
17191
17190
  if (g === "phone") return /* @__PURE__ */ e(If, { value: n, onChange: r, readOnly: !0 });
17192
- const A = n == null ? /* @__PURE__ */ e("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ e(Hr, { variant: n ? "default" : "secondary", children: n ? "Yes" : "No" }) : /* @__PURE__ */ e("span", { className: "text-sm tabular-nums", children: wi(n, t) });
17191
+ const A = n == null ? /* @__PURE__ */ e("span", { className: "text-muted-foreground italic text-sm", children: "—" }) : typeof n == "boolean" ? /* @__PURE__ */ e(Gr, { variant: n ? "default" : "secondary", children: n ? "Yes" : "No" }) : /* @__PURE__ */ e("span", { className: "text-sm tabular-nums", children: wi(n, t) });
17193
17192
  return /* @__PURE__ */ e("div", { className: "min-h-[36px] flex items-center", children: A });
17194
17193
  }
17195
17194
  const L = n == null ? "" : String(n);
17196
17195
  if (t.type === "boolean")
17197
17196
  return /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
17198
- /* @__PURE__ */ e(Gr, { checked: !!n, onCheckedChange: r }),
17197
+ /* @__PURE__ */ e(Yr, { checked: !!n, onCheckedChange: r }),
17199
17198
  /* @__PURE__ */ e(Sn, { className: "font-normal text-sm", children: n ? "Yes" : "No" })
17200
17199
  ] });
17201
17200
  if (t.type === "datetime" || g === "datetime") {
@@ -17842,7 +17841,7 @@ function Po({
17842
17841
  (ee) => ee.many_collection === J.many_collection && ee.id !== J.id
17843
17842
  );
17844
17843
  return ce != null && ce.many_field ? [{ rule: ue, rel: { ...J, junction_field: ce.many_field } }] : [];
17845
- }), w = wa({
17844
+ }), w = Na({
17846
17845
  queries: _.map(({ rel: ue }) => ({
17847
17846
  queryKey: ["m2m-items", ue.many_collection, ue.many_field, i],
17848
17847
  queryFn: () => b.request(
@@ -20198,7 +20197,7 @@ function N_({
20198
20197
  }).filter((z) => {
20199
20198
  var K, ae;
20200
20199
  return ((K = z.rel) == null ? void 0 : K.many_collection) && ((ae = z.rel) == null ? void 0 : ae.many_field);
20201
- }), g = wa({
20200
+ }), g = Na({
20202
20201
  queries: v.map(({ rel: z }) => ({
20203
20202
  queryKey: ["o2m-rows", z.many_collection, z.many_field, d],
20204
20203
  queryFn: () => u.request(
@@ -26013,9 +26012,9 @@ function xp({
26013
26012
  ]
26014
26013
  }
26015
26014
  ) }),
26016
- /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
26015
+ /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
26017
26016
  /* @__PURE__ */ e(ms, { placeholder: "Search collections…", className: "h-8 text-[12px]" }),
26018
- /* @__PURE__ */ a(Xr, { children: [
26017
+ /* @__PURE__ */ a(Zr, { children: [
26019
26018
  /* @__PURE__ */ e(ps, { children: "No collection found." }),
26020
26019
  [...C].sort(
26021
26020
  (_, w) => (_.display_name || _.collection).localeCompare(w.display_name || w.collection)
@@ -26123,9 +26122,9 @@ function mx({
26123
26122
  ]
26124
26123
  }
26125
26124
  ) }),
26126
- /* @__PURE__ */ e(ra, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
26125
+ /* @__PURE__ */ e(ra, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
26127
26126
  /* @__PURE__ */ e(ms, { placeholder: "Search users…", className: "h-8 text-[12px]" }),
26128
- /* @__PURE__ */ a(Xr, { children: [
26127
+ /* @__PURE__ */ a(Zr, { children: [
26129
26128
  /* @__PURE__ */ e(ps, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No users found" }),
26130
26129
  /* @__PURE__ */ e(Mi, { children: t.map((u) => /* @__PURE__ */ a(
26131
26130
  sr,
@@ -27076,7 +27075,7 @@ function X2({ collection: t, itemId: n, fields: r, relations: s, currentValues:
27076
27075
  const N = b(C.field, L);
27077
27076
  return /* @__PURE__ */ a("div", { className: "flex items-start gap-2", children: [
27078
27077
  /* @__PURE__ */ e(
27079
- Gr,
27078
+ Yr,
27080
27079
  {
27081
27080
  checked: L.include,
27082
27081
  onCheckedChange: () => h((_) => ({ ..._, [C.field]: { ..._[C.field], include: !_[C.field].include } })),
@@ -27109,7 +27108,7 @@ function X2({ collection: t, itemId: n, fields: r, relations: s, currentValues:
27109
27108
  /* @__PURE__ */ e("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
27110
27109
  /* @__PURE__ */ e("div", { className: "space-y-2", children: g.map((C) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
27111
27110
  /* @__PURE__ */ e(
27112
- Gr,
27111
+ Yr,
27113
27112
  {
27114
27113
  checked: !!f[C.field],
27115
27114
  onCheckedChange: (L) => y((N) => ({ ...N, [C.field]: L })),
@@ -28024,7 +28023,7 @@ function u3({
28024
28023
  const m = ve(() => t.filter((N) => N.relation), [t]), p = ve(
28025
28024
  () => [...new Set(m.map((N) => N.relation.target))],
28026
28025
  [m]
28027
- ), h = wa({
28026
+ ), h = Na({
28028
28027
  queries: p.map((N) => ({
28029
28028
  queryKey: ["find-meta", N],
28030
28029
  queryFn: () => r.request(Z(`/collections/${N}`)).then((_) => {
@@ -28055,7 +28054,7 @@ function u3({
28055
28054
  target: _,
28056
28055
  ids: [...w].slice(0, 60)
28057
28056
  }));
28058
- }, [m]), v = wa({
28057
+ }, [m]), v = Na({
28059
28058
  queries: y.map((N) => ({
28060
28059
  queryKey: ["find-labels", N.target, N.ids.join(",")],
28061
28060
  queryFn: () => r.request(
@@ -28067,7 +28066,7 @@ function u3({
28067
28066
  enabled: s,
28068
28067
  staleTime: 6e4
28069
28068
  }))
28070
- }), g = ve(() => m.filter((N) => N.relation.kind === "o2m"), [m]), x = wa({
28069
+ }), g = ve(() => m.filter((N) => N.relation.kind === "o2m"), [m]), x = Na({
28071
28070
  queries: g.map((N) => ({
28072
28071
  queryKey: [
28073
28072
  "find-o2m",
@@ -29337,7 +29336,7 @@ function K3({
29337
29336
  Ae(() => {
29338
29337
  const E = (B) => {
29339
29338
  const G = B.detail;
29340
- G != null && G.field && Qr(G.field, G.value ?? null);
29339
+ G != null && G.field && Vr(G.field, G.value ?? null);
29341
29340
  };
29342
29341
  return window.addEventListener("nvr:set-field", E), () => window.removeEventListener("nvr:set-field", E);
29343
29342
  });
@@ -29368,7 +29367,7 @@ function K3({
29368
29367
  })
29369
29368
  );
29370
29369
  }
29371
- const fn = Ee({}), Qt = Ee(/* @__PURE__ */ new Set()), [Nn, wn] = S(null), [Zn, Rn] = S([]), oe = Cn((E) => {
29370
+ const fn = Ee({}), Vt = Ee(/* @__PURE__ */ new Set()), [Nn, wn] = S(null), [Zn, Rn] = S([]), oe = Cn((E) => {
29372
29371
  Rn((B) => [...B, E]);
29373
29372
  }, []), [He, at] = S([]), kt = Cn((E) => {
29374
29373
  at((B) => [...B, E]);
@@ -29418,7 +29417,7 @@ function K3({
29418
29417
  })
29419
29418
  }),
29420
29419
  [Tt, ut, On]
29421
- ), [Wn, Rt] = S([]), xa = Ee(!1), Na = Ee(!1), [Kn, Jn] = S(/* @__PURE__ */ new Map()), [ir, $s] = S(/* @__PURE__ */ new Map()), ha = Ee(
29420
+ ), [Wn, Rt] = S([]), xa = Ee(!1), ka = Ee(!1), [Kn, Jn] = S(/* @__PURE__ */ new Map()), [ir, $s] = S(/* @__PURE__ */ new Map()), ha = Ee(
29422
29421
  null
29423
29422
  ), oa = Ee(/* @__PURE__ */ new Map()), mr = Ee(0), Oa = Ee(/* @__PURE__ */ new Map()), qr = Ee(/* @__PURE__ */ new Map()), ba = ve(
29424
29423
  () => ({
@@ -29645,7 +29644,7 @@ function K3({
29645
29644
  }
29646
29645
  }
29647
29646
  const Pn = [];
29648
- let ka = !1;
29647
+ let va = !1;
29649
29648
  const An = 10;
29650
29649
  for (let In = 0; In < It.length; In += An) {
29651
29650
  const ct = It.slice(In, In + An), Et = await Promise.all(
@@ -29660,12 +29659,12 @@ function K3({
29660
29659
  parent_context: zn,
29661
29660
  row_rules: Zt
29662
29661
  })
29663
- ).then((mn) => mn.updates ?? {}).catch(() => (ka = !0, {}));
29662
+ ).then((mn) => mn.updates ?? {}).catch(() => (va = !0, {}));
29664
29663
  })
29665
29664
  );
29666
29665
  Pn.push(...Et);
29667
29666
  }
29668
- ka && Ke.push({
29667
+ va && Ke.push({
29669
29668
  severity: "warn",
29670
29669
  rule: "reimport-apply",
29671
29670
  message: "Some line autofill rules could not be evaluated — check the affected rows before saving."
@@ -29688,11 +29687,11 @@ function K3({
29688
29687
  if (Ln)
29689
29688
  for (const [zn, Pn] of Object.entries(Zt)) {
29690
29689
  if (!zn.startsWith("__o2m_")) continue;
29691
- const ka = zn.slice(6), An = $t.get(ka) ?? [];
29690
+ const va = zn.slice(6), An = $t.get(va) ?? [];
29692
29691
  An.push({
29693
29692
  id: Ln,
29694
29693
  members: Array.isArray(Pn) ? Pn : []
29695
- }), $t.set(ka, An);
29694
+ }), $t.set(va, An);
29696
29695
  }
29697
29696
  }
29698
29697
  for (const [Zt, Ln] of $t) {
@@ -29707,13 +29706,13 @@ function K3({
29707
29706
  });
29708
29707
  continue;
29709
29708
  }
29710
- const Pn = zn.many_collection, ka = zn.many_field, An = Ln.map((Et) => Et.id);
29709
+ const Pn = zn.many_collection, va = zn.many_field, An = Ln.map((Et) => Et.id);
29711
29710
  let In = [];
29712
29711
  try {
29713
29712
  In = await q.request(
29714
29713
  Z(`/items/${Pn}`, {
29715
- filter: JSON.stringify({ [ka]: { _in: An } }),
29716
- fields: `id,${ka}`,
29714
+ filter: JSON.stringify({ [va]: { _in: An } }),
29715
+ fields: `id,${va}`,
29717
29716
  limit: 2e3
29718
29717
  })
29719
29718
  ).then((Et) => Et.data ?? []);
@@ -29727,7 +29726,7 @@ function K3({
29727
29726
  }
29728
29727
  const ct = /* @__PURE__ */ new Map();
29729
29728
  for (const Et of In) {
29730
- const Gt = String(Et[ka]), _n = ct.get(Gt) ?? [];
29729
+ const Gt = String(Et[va]), _n = ct.get(Gt) ?? [];
29731
29730
  _n.push(String(Et.id)), ct.set(Gt, _n);
29732
29731
  }
29733
29732
  for (const Et of Ln)
@@ -29829,14 +29828,14 @@ function K3({
29829
29828
  Je && (fn.current = Je, dt.current = Je, At(Je), Jt(!1));
29830
29829
  }, [Je]), Ae(() => {
29831
29830
  var le;
29832
- if (!z || K === void 0 || Na.current) return;
29831
+ if (!z || K === void 0 || ka.current) return;
29833
29832
  const E = (le = K == null ? void 0 : K.layout) == null ? void 0 : le.default_values;
29834
29833
  if (!E) {
29835
- Na.current = !0;
29834
+ ka.current = !0;
29836
29835
  return;
29837
29836
  }
29838
29837
  if (Object.values(E).some(Array.isArray) && !te) return;
29839
- Na.current = !0;
29838
+ ka.current = !0;
29840
29839
  const B = {};
29841
29840
  for (const [me, Ce] of Object.entries(E)) {
29842
29841
  if (Array.isArray(Ce)) {
@@ -29868,7 +29867,7 @@ function K3({
29868
29867
  ).then((E) => E.data ?? {}),
29869
29868
  enabled: !z && da.length > 0,
29870
29869
  staleTime: 3e4
29871
- }), es = ve(() => {
29870
+ }), ts = ve(() => {
29872
29871
  if (!Fa) return null;
29873
29872
  const E = {};
29874
29873
  for (const [B, G] of Object.entries(Fa))
@@ -29893,7 +29892,7 @@ function K3({
29893
29892
  me && G.set(le, me);
29894
29893
  }
29895
29894
  return G;
29896
- }, [xe, de, t]), Ks = [...Xn.values()], zl = wa({
29895
+ }, [xe, de, t]), Ks = [...Xn.values()], zl = Na({
29897
29896
  queries: Ks.map((E) => ({
29898
29897
  queryKey: ["m2m-items", E.manyCollection, E.manyField, A],
29899
29898
  queryFn: () => q.request(
@@ -29946,12 +29945,12 @@ function K3({
29946
29945
  G != null && G.option_filter && typeof G.option_filter == "object" && (E[B.field] = G.option_filter);
29947
29946
  }
29948
29947
  return E;
29949
- }, [V]), ts = ve(() => {
29948
+ }, [V]), ns = ve(() => {
29950
29949
  const E = { ...rt };
29951
29950
  for (const [B, G] of Object.entries(fa))
29952
29951
  G != null && G.known && G.ids.length > 0 && (E[B] = G.ids);
29953
29952
  return E;
29954
- }, [rt, fa]), _a = Cn(
29953
+ }, [rt, fa]), wa = Cn(
29955
29954
  (E) => {
29956
29955
  const B = Oa.current.get(E);
29957
29956
  if (B) {
@@ -29976,7 +29975,7 @@ function K3({
29976
29975
  (E, B, G = 0, le, me) => {
29977
29976
  if (B == null || B === "" || G > 3) return;
29978
29977
  const Ce = me ?? E;
29979
- G === 0 && _a(Ce);
29978
+ G === 0 && wa(Ce);
29980
29979
  const Ke = le ?? /* @__PURE__ */ new Set(), Re = `${E}:${String(B)}`;
29981
29980
  if (Ke.has(Re)) return;
29982
29981
  Ke.add(Re);
@@ -30005,9 +30004,9 @@ function K3({
30005
30004
  It && (async () => {
30006
30005
  var xt, $t, Zt, Ln, zn, Pn;
30007
30006
  let gt = null;
30008
- for (const ka of yt)
30007
+ for (const va of yt)
30009
30008
  try {
30010
- const An = ka.parent_field;
30009
+ const An = va.parent_field;
30011
30010
  if (Xn.has(An)) {
30012
30011
  if ((((xt = Fr.current[An]) == null ? void 0 : xt.ids) ?? []).length > 0) continue;
30013
30012
  } else {
@@ -30015,7 +30014,7 @@ function K3({
30015
30014
  if (Gt != null && Gt !== "")
30016
30015
  continue;
30017
30016
  }
30018
- const In = String(ka.filter_column);
30017
+ const In = String(va.filter_column);
30019
30018
  let ct = [];
30020
30019
  if (In.includes(".")) {
30021
30020
  const [Gt, _n] = [In.slice(0, In.indexOf(".")), In.slice(In.indexOf(".") + 1)];
@@ -30062,7 +30061,7 @@ function K3({
30062
30061
  }
30063
30062
  }
30064
30063
  if (ct = [...new Set(ct)], ct.length === 0) continue;
30065
- const Et = ka.parent_field;
30064
+ const Et = va.parent_field;
30066
30065
  if (Xn.has(Et)) {
30067
30066
  const Gt = Xn.get(Et), _n = new Set(
30068
30067
  ((($t = Fr.current[Et]) == null ? void 0 : $t.ids) ?? []).map((Gn) => String(Gn))
@@ -30091,10 +30090,10 @@ function K3({
30091
30090
  }
30092
30091
  })();
30093
30092
  },
30094
- [V, de, t, Xn, ba, q, _a, Ua]
30093
+ [V, de, t, Xn, ba, q, wa, Ua]
30095
30094
  ), Ra = Ee(Is);
30096
30095
  Ra.current = Is;
30097
- const Wr = Cn(
30096
+ const Qr = Cn(
30098
30097
  (E, B, G = 0) => {
30099
30098
  if (!(B == null || B === "") && !(G > 2))
30100
30099
  for (const le of V ?? []) {
@@ -30107,7 +30106,7 @@ function K3({
30107
30106
  continue;
30108
30107
  }
30109
30108
  if (((Ce == null ? void 0 : Ce.source_fk_field) || le.field) !== E || !(Ce != null && Ce.source_collection) || !Ce.field_map) continue;
30110
- G === 0 && _a(E);
30109
+ G === 0 && wa(E);
30111
30110
  const Re = Ce.field_map, Ge = [
30112
30111
  ...new Set(
30113
30112
  Object.entries(Re).filter(([_t]) => !Xn.has(_t)).flatMap(
@@ -30124,7 +30123,7 @@ function K3({
30124
30123
  Z(`/items/${Ce.source_collection}/${B}`, { fields: "id" })
30125
30124
  )
30126
30125
  ).then(async (_t) => {
30127
- var ka;
30126
+ var va;
30128
30127
  const It = _t.data;
30129
30128
  if (!It) return;
30130
30129
  const gt = {}, xt = Object.entries(Re), $t = xt.some(
@@ -30193,15 +30192,15 @@ function K3({
30193
30192
  }
30194
30193
  dt.current = { ...dt.current, ...gt }, At((An) => ({ ...An, ...gt })), Jt(!0);
30195
30194
  for (const [An, In] of Object.entries(gt))
30196
- An !== E && In != null && In !== "" && (Wr(An, In, G + 1), (ka = Ra.current) == null || ka.call(Ra, An, In, G + 1));
30195
+ An !== E && In != null && In !== "" && (Qr(An, In, G + 1), (va = Ra.current) == null || va.call(Ra, An, In, G + 1));
30197
30196
  }).catch(() => {
30198
30197
  });
30199
30198
  }
30200
30199
  },
30201
- [V, q, Xn, ba, _a, Ua]
30200
+ [V, q, Xn, ba, wa, Ua]
30202
30201
  );
30203
- ha.current = Wr;
30204
- const ns = Cn(
30202
+ ha.current = Qr;
30203
+ const as = Cn(
30205
30204
  (E) => {
30206
30205
  var me;
30207
30206
  const { scalar: B, alias: G } = P3(
@@ -30217,10 +30216,10 @@ function K3({
30217
30216
  if (Object.keys(B).length > 0) {
30218
30217
  const Ce = L3(dt.current, B);
30219
30218
  dt.current = Ce, At(Ce);
30220
- for (const [Ke, Re] of Object.entries(B)) Wr(Ke, Re);
30219
+ for (const [Ke, Re] of Object.entries(B)) Qr(Ke, Re);
30221
30220
  }
30222
30221
  },
30223
- [Xn, fa, ba, Wr]
30222
+ [Xn, fa, ba, Qr]
30224
30223
  ), Mr = Ee({});
30225
30224
  Ae(() => {
30226
30225
  const E = Mr.current;
@@ -30247,11 +30246,11 @@ function K3({
30247
30246
  trigger_value: me,
30248
30247
  draft: Ce
30249
30248
  })
30250
- ).then((Ke) => ns(Ke.data)).catch(() => {
30249
+ ).then((Ke) => as(Ke.data)).catch(() => {
30251
30250
  });
30252
30251
  }, 300);
30253
30252
  },
30254
- [xe, t, q, Qa, ns]
30253
+ [xe, t, q, Qa, as]
30255
30254
  ), Ts = Ee({}), pr = Ee(!1), wl = ve(
30256
30255
  () => [...Xn.entries()].filter(
30257
30256
  ([E]) => kx(xe, E).length > 0
@@ -30280,7 +30279,7 @@ function K3({
30280
30279
  Fs,
30281
30280
  Va
30282
30281
  ]);
30283
- const Qr = Cn(
30282
+ const Vr = Cn(
30284
30283
  (E, B) => {
30285
30284
  if (Ko(dt.current[E], B)) return;
30286
30285
  Ye.current.add(E);
@@ -30295,18 +30294,18 @@ function K3({
30295
30294
  }
30296
30295
  dt.current = G, At(G), Jt(!0);
30297
30296
  const le = B == null || B === "";
30298
- le || Qt.current.add(E), St((me) => {
30297
+ le || Vt.current.add(E), St((me) => {
30299
30298
  const Ce = { ...me }, Ke = (V ?? []).find((Re) => Re.field === E);
30300
- return Ke != null && Ke.required && le && Qt.current.has(E) ? Ce[E] = "This field is required" : delete Ce[E], Ce;
30301
- }), Va(E), le || Wr(E, B), le || Ra.current(E, B);
30299
+ return Ke != null && Ke.required && le && Vt.current.has(E) ? Ce[E] = "This field is required" : delete Ce[E], Ce;
30300
+ }), Va(E), le || Qr(E, B), le || Ra.current(E, B);
30302
30301
  },
30303
- [V, Va, Wr]
30304
- ), [el, ga] = S({}), na = ve(
30302
+ [V, Va, Qr]
30303
+ ), [el, _a] = S({}), na = ve(
30305
30304
  () => de.filter(
30306
30305
  (E) => !E.junction_field && E.one_collection === t && E.one_field && E.many_field && E.many_collection
30307
30306
  ),
30308
30307
  [de, t]
30309
- ), bs = wa({
30308
+ ), bs = Na({
30310
30309
  queries: na.map((E) => ({
30311
30310
  queryKey: ["o2m-count", E.many_collection, E.many_field, A],
30312
30311
  queryFn: () => q.request(
@@ -30358,11 +30357,11 @@ function K3({
30358
30357
  }, [dr, Dr]);
30359
30358
  const Pr = Cn(
30360
30359
  (E, B) => {
30361
- ga((G) => G[E] === B ? G : { ...G, [E]: B }), B > 0 && Qt.current.add(E), St((G) => {
30360
+ _a((G) => G[E] === B ? G : { ...G, [E]: B }), B > 0 && Vt.current.add(E), St((G) => {
30362
30361
  const le = (V ?? []).find((Ce) => Ce.field === E);
30363
30362
  if (!(le != null && le.required)) return G;
30364
30363
  const me = { ...G };
30365
- return B === 0 && Qt.current.has(E) ? me[E] = "This field is required" : delete me[E], me;
30364
+ return B === 0 && Vt.current.has(E) ? me[E] = "This field is required" : delete me[E], me;
30366
30365
  });
30367
30366
  },
30368
30367
  [V]
@@ -30372,23 +30371,23 @@ function K3({
30372
30371
  isReadOnly: Za,
30373
30372
  takeOver: ui,
30374
30373
  takingOver: Ul,
30375
- requestLock: Vr,
30376
- requesting: as
30377
- } = Q_(t, z ? void 0 : A, fr), aa = (K == null ? void 0 : K.assignments) ?? [], _l = aa.some((E) => E.lock_conditions), rs = !!(ye != null && ye.addendums_enabled) && !z, { data: Ba } = se({
30374
+ requestLock: Jr,
30375
+ requesting: rs
30376
+ } = Q_(t, z ? void 0 : A, fr), aa = (K == null ? void 0 : K.assignments) ?? [], _l = aa.some((E) => E.lock_conditions), ss = !!(ye != null && ye.addendums_enabled) && !z, { data: Ba } = se({
30378
30377
  queryKey: ["current-user-me"],
30379
30378
  queryFn: () => q.request(Z("/users/me")).then((E) => E.data ?? null),
30380
30379
  staleTime: 5 * 6e4,
30381
- enabled: _l || rs
30380
+ enabled: _l || ss
30382
30381
  }), { data: Ea } = se({
30383
30382
  queryKey: ["pipeline-instance-lock", t, A],
30384
30383
  queryFn: () => q.request(Z(`/pipelines/instance/${t}/${A}`)).then(
30385
30384
  (E) => E.data
30386
30385
  ).catch(() => null),
30387
30386
  staleTime: 3e4,
30388
- enabled: (_l || rs) && !z
30387
+ enabled: (_l || ss) && !z
30389
30388
  }), zs = ve(() => {
30390
30389
  var E, B, G;
30391
- if (!rs) return !1;
30390
+ if (!ss) return !1;
30392
30391
  if (ye != null && ye.addendum_allowed_roles)
30393
30392
  try {
30394
30393
  const le = JSON.parse(ye.addendum_allowed_roles);
@@ -30411,7 +30410,7 @@ function K3({
30411
30410
  }
30412
30411
  return !0;
30413
30412
  }, [
30414
- rs,
30413
+ ss,
30415
30414
  ye == null ? void 0 : ye.addendum_allowed_roles,
30416
30415
  ye == null ? void 0 : ye.addendum_allowed_states,
30417
30416
  Ba == null ? void 0 : Ba.role,
@@ -30419,7 +30418,7 @@ function K3({
30419
30418
  ]), { data: Tr = [] } = se({
30420
30419
  queryKey: ["addendums", t, A],
30421
30420
  queryFn: () => q.request(Z(`/addendums/${t}/${A}`)).then((E) => E.data ?? []),
30422
- enabled: rs,
30421
+ enabled: ss,
30423
30422
  staleTime: 3e4
30424
30423
  }), er = ve(() => {
30425
30424
  const E = {};
@@ -30440,7 +30439,7 @@ function K3({
30440
30439
  if (ge === "original") return null;
30441
30440
  const E = Tr.find((B) => B.id === ge);
30442
30441
  return E != null && E.data ? Object.fromEntries(Object.entries(E.data).filter(([, B]) => !Array.isArray(B))) : null;
30443
- }, [ge, Tr]), [ss, tl] = S(/* @__PURE__ */ new Map()), xr = ve(() => {
30442
+ }, [ge, Tr]), [ls, tl] = S(/* @__PURE__ */ new Map()), xr = ve(() => {
30444
30443
  const E = /* @__PURE__ */ new Map();
30445
30444
  for (const B of V ?? [])
30446
30445
  if (!(B.computed_type !== "rollup" || !B.computed_formula))
@@ -30471,8 +30470,8 @@ function K3({
30471
30470
  const Ce = G.map((Ke) => me.map((Re) => String(Ke[Re] ?? "")).join("")).join("");
30472
30471
  qe.current.get(le) !== Ce && (qe.current.set(le, Ce), tl((Ke) => new Map(Ke).set(le, G)));
30473
30472
  }, []), Dt = ve(
30474
- () => ({ rows: ss, report: pt }),
30475
- [ss, pt]
30473
+ () => ({ rows: ls, report: pt }),
30474
+ [ls, pt]
30476
30475
  ), [cn, dn] = S(/* @__PURE__ */ new Map()), Hn = Ee(/* @__PURE__ */ new Map()), ca = Cn((E, B) => {
30477
30476
  if (B === null) {
30478
30477
  if (!Hn.current.has(E)) return;
@@ -30493,12 +30492,12 @@ function K3({
30493
30492
  return [];
30494
30493
  const E = [];
30495
30494
  for (const B of xr.keys()) {
30496
- if (ss.has(B)) continue;
30495
+ if (ls.has(B)) continue;
30497
30496
  const G = Tt.get(B) ?? [];
30498
30497
  G.length !== 0 && E.push({ key: B, collection: B.split(".")[0], rows: G });
30499
30498
  }
30500
30499
  return E;
30501
- }, [z, xr, ss, Tt]), Ir = wa({
30500
+ }, [z, xr, ls, Tt]), Ir = Na({
30502
30501
  queries: Ma.map((E) => ({
30503
30502
  queryKey: ["field-config", E.collection, null],
30504
30503
  queryFn: () => q.request(Z(`/field-config/${E.collection}`)).then((B) => B.data ?? []),
@@ -30523,7 +30522,7 @@ function K3({
30523
30522
  })
30524
30523
  );
30525
30524
  }), E;
30526
- }, [Ma, Ir]), [ls, cd] = S(() => /* @__PURE__ */ new Set()), ud = Cn((E, B) => {
30525
+ }, [Ma, Ir]), [is, cd] = S(() => /* @__PURE__ */ new Set()), ud = Cn((E, B) => {
30527
30526
  cd((G) => {
30528
30527
  if (G.has(E) === B) return G;
30529
30528
  const le = new Set(G);
@@ -30533,13 +30532,13 @@ function K3({
30533
30532
  const E = /* @__PURE__ */ new Map();
30534
30533
  for (const B of V ?? []) {
30535
30534
  if (B.computed_type !== "rollup" || !B.computed_formula) continue;
30536
- const G = new Map(ss);
30535
+ const G = new Map(ls);
30537
30536
  for (const [me, Ce] of br) G.has(me) || G.set(me, Ce);
30538
30537
  const le = ry(x0(B.computed_formula), G);
30539
30538
  le !== null && E.set(B.field, le);
30540
30539
  }
30541
30540
  return E;
30542
- }, [V, ss, br]), nl = ve(
30541
+ }, [V, ls, br]), nl = ve(
30543
30542
  () => jr ? { ...rt, ...jr } : rt,
30544
30543
  [rt, jr]
30545
30544
  ), Da = ge !== "original", js = Da ? "nivaro_addendums" : t, Nr = Da ? ge : A, md = ve(() => {
@@ -30561,7 +30560,7 @@ function K3({
30561
30560
  return pi ? G.filter(
30562
30561
  (le) => pi.has(le.field) || Ol.has(le.field) || Kc(le.field)
30563
30562
  ) : G;
30564
- }, [V, pi, r, K]), Ca = ve(() => ((K == null ? void 0 : K.groups) ?? []).sort((E, B) => E.sort - B.sort), [K]), is = ve(() => {
30563
+ }, [V, pi, r, K]), Ca = ve(() => ((K == null ? void 0 : K.groups) ?? []).sort((E, B) => E.sort - B.sort), [K]), zr = ve(() => {
30565
30564
  const E = {};
30566
30565
  for (const B of Ca) {
30567
30566
  const G = gx(B.summary_fields);
@@ -30571,9 +30570,9 @@ function K3({
30571
30570
  }
30572
30571
  return E;
30573
30572
  }, [Ca]), tr = ve(
30574
- () => na.filter((E) => E.one_field && E.one_field in is),
30575
- [na, is]
30576
- ), Di = wa({
30573
+ () => na.filter((E) => E.one_field && E.one_field in zr),
30574
+ [na, zr]
30575
+ ), Di = Na({
30577
30576
  queries: tr.map((E) => ({
30578
30577
  queryKey: ["field-config", E.many_collection],
30579
30578
  queryFn: () => q.request(
@@ -30583,19 +30582,19 @@ function K3({
30583
30582
  staleTime: 12e4
30584
30583
  }))
30585
30584
  }), Sl = ve(() => {
30586
- const E = { ...is };
30585
+ const E = { ...zr };
30587
30586
  return tr.forEach((B, G) => {
30588
30587
  var Re;
30589
30588
  if (!B.one_field) return;
30590
- const le = is[B.one_field];
30589
+ const le = zr[B.one_field];
30591
30590
  if (!le || !le.agg_field) return;
30592
30591
  const Ce = (((Re = Di[G]) == null ? void 0 : Re.data) ?? []).find((Ge) => Ge.field === le.agg_field);
30593
30592
  if (!Ce) return;
30594
30593
  const Ke = Ce.options ? typeof Ce.options == "string" ? Ce.options : JSON.stringify(Ce.options) : null;
30595
30594
  Ke && (E[B.one_field] = { ...le, field_options: Ke });
30596
30595
  }), E;
30597
- }, [is, tr, Di]), gs = wa({
30598
- queries: tr.map((E) => (is[E.one_field], {
30596
+ }, [zr, tr, Di]), gs = Na({
30597
+ queries: tr.map((E) => (zr[E.one_field], {
30599
30598
  queryKey: ["o2m-rows", E.many_collection, E.many_field, A],
30600
30599
  queryFn: () => q.request(
30601
30600
  Z(`/items/${E.many_collection}`, {
@@ -30633,7 +30632,7 @@ function K3({
30633
30632
  }, [
30634
30633
  tr,
30635
30634
  gs,
30636
- is,
30635
+ zr,
30637
30636
  Tt,
30638
30637
  ut,
30639
30638
  On
@@ -30719,19 +30718,19 @@ function K3({
30719
30718
  ), fe = ve(
30720
30719
  () => Ca.filter((E) => E.type === "section" || E.type === "metadata"),
30721
30720
  [Ca]
30722
- ), ze = Ql.length > 0, Qe = ie.length > 0, Xe = K == null ? void 0 : K.layout, Ze = Xe ? !!Xe.ai_enabled : !0, mt = Qe && (Xe == null ? void 0 : Xe.tab_mode) === "steps", Xt = !!(Xe != null && Xe.validate_before_next), lt = !!(Xe != null && Xe.summary_enabled), qt = !!(Xe != null && Xe.summary_hide_empty), xn = Xe ? !Xe.disable_revisions && y : y, sn = Xe ? !Xe.disable_comments && b : b, ln = Xe ? !Xe.disable_tasks && F : F, Tn = Xe ? !Xe.disable_clone && v : v, ya = Xe ? !Xe.disable_delete : !0, va = !!(Xe != null && Xe.accordion_mode), [Ha, I] = S(!1), [pe, Te] = S(null), [Se, tt] = S(/* @__PURE__ */ new Set()), vt = Ee(!1);
30721
+ ), ze = Ql.length > 0, Qe = ie.length > 0, Xe = K == null ? void 0 : K.layout, Ze = Xe ? !!Xe.ai_enabled : !0, mt = Qe && (Xe == null ? void 0 : Xe.tab_mode) === "steps", Xt = !!(Xe != null && Xe.validate_before_next), lt = !!(Xe != null && Xe.summary_enabled), qt = !!(Xe != null && Xe.summary_hide_empty), xn = Xe ? !Xe.disable_revisions && y : y, sn = Xe ? !Xe.disable_comments && b : b, ln = Xe ? !Xe.disable_tasks && F : F, Tn = Xe ? !Xe.disable_clone && v : v, ga = Xe ? !Xe.disable_delete : !0, ya = !!(Xe != null && Xe.accordion_mode), [Ha, I] = S(!1), [pe, Te] = S(null), [Se, tt] = S(/* @__PURE__ */ new Set()), vt = Ee(!1);
30723
30722
  Ae(() => {
30724
- if (!va) {
30723
+ if (!ya) {
30725
30724
  vt.current = !1;
30726
30725
  return;
30727
30726
  }
30728
- if (va && !vt.current) {
30727
+ if (ya && !vt.current) {
30729
30728
  vt.current = !0;
30730
30729
  const E = fe.find((B) => !B.is_collapsed) ?? fe[0];
30731
30730
  E && Te(E.id);
30732
30731
  }
30733
- }, [va, fe]);
30734
- const Vt = Ee(null), un = (E) => {
30732
+ }, [ya, fe]);
30733
+ const Qt = Ee(null), un = (E) => {
30735
30734
  const B = document.querySelector(`[data-field="${E}"]`);
30736
30735
  B && (B.scrollIntoView({ behavior: "smooth", block: "center" }), B.style.transition = "box-shadow 0.15s ease", B.style.boxShadow = "0 0 0 2px #00ceff, 0 0 0 5px rgba(0,206,255,0.25)", B.style.borderRadius = "12px", setTimeout(() => {
30737
30736
  B.style.boxShadow = "none", setTimeout(() => {
@@ -30871,7 +30870,7 @@ function K3({
30871
30870
  (Pn) => Pn.many_collection === yt.manyCollection && Pn.many_field === yt.junctionField
30872
30871
  ), zn = Ln == null ? void 0 : Ln.one_collection;
30873
30872
  if (zn) {
30874
- const Pn = (await Promise.all(Zt.ids.slice(0, 15).map((ka) => G(zn, ka)))).filter(Boolean);
30873
+ const Pn = (await Promise.all(Zt.ids.slice(0, 15).map((va) => G(zn, va)))).filter(Boolean);
30875
30874
  Pn.length > 0 && le.push(
30876
30875
  `${Ge}: ${Pn.join(", ")}${Zt.ids.length > 15 ? ` +${Zt.ids.length - 15} more` : ""}`
30877
30876
  );
@@ -30934,7 +30933,7 @@ ${le.join(`
30934
30933
  const le = G.get(E.id) ?? /* @__PURE__ */ new Set();
30935
30934
  return le.has(B) ? G : new Map(G).set(E.id, /* @__PURE__ */ new Set([...le, B]));
30936
30935
  });
30937
- }, [zr, pd] = S(() => {
30936
+ }, [Ur, pd] = S(() => {
30938
30937
  var E;
30939
30938
  try {
30940
30939
  return localStorage.getItem(`nvr_tab_${t}`) ?? ((E = ie[0]) == null ? void 0 : E.key) ?? "__general__";
@@ -30967,7 +30966,7 @@ ${le.join(`
30967
30966
  G.searchParams.set("step", E), window.history.replaceState(window.history.state, "", G);
30968
30967
  } catch {
30969
30968
  }
30970
- (B = Vt.current) == null || B.scrollTo({ top: 0 });
30969
+ (B = Qt.current) == null || B.scrollTo({ top: 0 });
30971
30970
  }, La = ve(() => {
30972
30971
  if (!Qe) return [];
30973
30972
  const E = [];
@@ -30983,8 +30982,8 @@ ${le.join(`
30983
30982
  } catch {
30984
30983
  }
30985
30984
  }, [Qe, La]), Ae(() => {
30986
- !Qe || La.length === 0 || La.some((E) => E.key === zr) || ql(La[0].key);
30987
- }, [Qe, La, zr]);
30985
+ !Qe || La.length === 0 || La.some((E) => E.key === Ur) || ql(La[0].key);
30986
+ }, [Qe, La, Ur]);
30988
30987
  const qh = Ee(!1);
30989
30988
  Ae(() => {
30990
30989
  var G;
@@ -31006,9 +31005,9 @@ ${le.join(`
31006
31005
  return Ke != null && Ke !== "" && Ke !== !1;
31007
31006
  });
31008
31007
  };
31009
- if (qh.current = !0, mt && La.length > 0 && B(ie.find((le) => le.key === zr))) {
31008
+ if (qh.current = !0, mt && La.length > 0 && B(ie.find((le) => le.key === Ur))) {
31010
31009
  const le = La.find((me) => !B(ie.find((Ce) => Ce.key === me.key)));
31011
- le && le.key !== zr && ql(le.key);
31010
+ le && le.key !== Ur && ql(le.key);
31012
31011
  }
31013
31012
  for (const le of Ca.filter((me) => me.type === "container" && me.tab_mode === "steps")) {
31014
31013
  const me = Ca.filter((Ge) => Ge.type === "tab" && Ge.container_id === le.id).sort((Ge, yt) => Ge.sort - yt.sort);
@@ -31018,7 +31017,7 @@ ${le.join(`
31018
31017
  const Re = me.find((Ge) => !B(Ge));
31019
31018
  Re && Re.key !== Ce && hi((Ge) => new Map(Ge).set(le.id, Re.key));
31020
31019
  }
31021
- }, [z, mt, Je, La, ie, zr, Ca, $l]);
31020
+ }, [z, mt, Je, La, ie, Ur, Ca, $l]);
31022
31021
  const fv = ve(() => {
31023
31022
  const E = /* @__PURE__ */ new Set();
31024
31023
  if (!Lt) return E;
@@ -31059,7 +31058,7 @@ ${le.join(`
31059
31058
  ]);
31060
31059
  function bv() {
31061
31060
  if (Xt) {
31062
- const B = zr === "__general__" ? mt ? wr : [...wr, ...fe.flatMap((le) => cr[le.key] ?? [])] : cr[zr] ?? [], G = {};
31061
+ const B = Ur === "__general__" ? mt ? wr : [...wr, ...fe.flatMap((le) => cr[le.key] ?? [])] : cr[Ur] ?? [], G = {};
31063
31062
  for (const le of B)
31064
31063
  if (le.required && !le.hidden) {
31065
31064
  const me = rt[le.field];
@@ -31070,7 +31069,7 @@ ${le.join(`
31070
31069
  return;
31071
31070
  }
31072
31071
  }
31073
- const E = La.findIndex((B) => B.key === zr);
31072
+ const E = La.findIndex((B) => B.key === Ur);
31074
31073
  E < La.length - 1 && ql(La[E + 1].key);
31075
31074
  }
31076
31075
  const Aa = aa.find((E) => E.field === "__pipeline__"), Fh = ve(() => {
@@ -31152,7 +31151,7 @@ ${le.join(`
31152
31151
  } catch {
31153
31152
  }
31154
31153
  return E;
31155
- }, [K]), Ur = ve(() => {
31154
+ }, [K]), Br = ve(() => {
31156
31155
  const E = ((K == null ? void 0 : K.assignments) ?? []).find((B) => B.field === "__subtitle__");
31157
31156
  if (!E) return null;
31158
31157
  try {
@@ -31167,33 +31166,33 @@ ${le.join(`
31167
31166
  return null;
31168
31167
  }
31169
31168
  }, [K]), Lm = ve(
31170
- () => new Set(((Ur == null ? void 0 : Ur.fields) ?? []).map((E) => E.field)),
31171
- [Ur]
31169
+ () => new Set(((Br == null ? void 0 : Br.fields) ?? []).map((E) => E.field)),
31170
+ [Br]
31172
31171
  ), xd = ve(() => {
31173
31172
  var E, B;
31174
- if (!Ur) return null;
31175
- for (const G of Ur.fields) {
31173
+ if (!Br) return null;
31174
+ for (const G of Br.fields) {
31176
31175
  const le = (V ?? []).find((me) => me.field === G.field);
31177
31176
  if (le && ((B = (E = ma(le.options ?? null)) == null ? void 0 : E.auto_id) != null && B.pattern))
31178
31177
  return le;
31179
31178
  }
31180
31179
  return null;
31181
- }, [Ur, V]), Am = Ug({
31180
+ }, [Br, V]), Am = Ug({
31182
31181
  collection: t,
31183
31182
  field: xd,
31184
31183
  draft: rt,
31185
31184
  itemId: A,
31186
31185
  staging: ba
31187
31186
  }), Ac = ve(() => {
31188
- if (!Ur) return [];
31187
+ if (!Br) return [];
31189
31188
  const E = Je ?? rt;
31190
- return Ur.fields.map((B) => {
31189
+ return Br.fields.map((B) => {
31191
31190
  const G = B.field === (xd == null ? void 0 : xd.field);
31192
31191
  if (z && !G) return null;
31193
31192
  let le = E[B.field];
31194
31193
  return G && Am && (le = Am), le == null || le === "" ? null : { value: String(le), color: B.color, weight: B.weight, display_as: B.display_as };
31195
31194
  }).filter(Boolean);
31196
- }, [Ur, z, Je, rt, xd, Am]), { data: $r } = se({
31195
+ }, [Br, z, Je, rt, xd, Am]), { data: $r } = se({
31197
31196
  queryKey: ["last-touch", t, String(A)],
31198
31197
  queryFn: () => q.request(Z(`/last-touch/${t}/${encodeURIComponent(String(A))}`)).then((E) => E.data ?? null).catch(() => null),
31199
31198
  enabled: !z && !!A,
@@ -31254,8 +31253,8 @@ ${le.join(`
31254
31253
  const E = Date.now() - new Date($r.timestamp).getTime(), B = Math.floor(E / 6e4), G = B < 1 ? "just now" : B < 60 ? `${B}m ago` : B < 2880 ? `${Math.floor(B / 60)}h ago` : `${Math.floor(B / 1440)}d ago`;
31255
31254
  return `${$r.action === "create" ? "Created" : "Edited"} ${G}${$r.user_name ? ` by ${$r.user_name}` : ""}`;
31256
31255
  }, [$r]), Dh = ve(
31257
- () => Ac.map((E) => E.value).join((Ur == null ? void 0 : Ur.separator) ?? " | "),
31258
- [Ac, Ur]
31256
+ () => Ac.map((E) => E.value).join((Br == null ? void 0 : Br.separator) ?? " | "),
31257
+ [Ac, Br]
31259
31258
  ), Ph = ve(
31260
31259
  () => ((K == null ? void 0 : K.assignments) ?? []).filter(
31261
31260
  (E) => (E.field === "__owners__" || !E.field.startsWith("__")) && (E.group_key ?? null) === "__header__"
@@ -31645,15 +31644,15 @@ ${le.join(`
31645
31644
  Ie(`/items/${Gt}`, { ...zi, [_n]: Ln })
31646
31645
  ), kd = (Ui = Bs == null ? void 0 : Bs.data) == null ? void 0 : Ui.id;
31647
31646
  Wt(Et, (nr) => {
31648
- var Jr;
31647
+ var Hr;
31649
31648
  return {
31650
- progress: { done: (((Jr = nr.progress) == null ? void 0 : Jr.done) ?? 0) + 1, total: mn.length }
31649
+ progress: { done: (((Hr = nr.progress) == null ? void 0 : Hr.done) ?? 0) + 1, total: mn.length }
31651
31650
  };
31652
31651
  });
31653
- for (const [nr, Jr] of $o) {
31652
+ for (const [nr, Hr] of $o) {
31654
31653
  const Pm = nr.slice(6), Ws = de.find(
31655
31654
  (xi) => xi.one_collection === Gt && xi.one_field === Pm
31656
- ), jl = Array.isArray(Jr) ? Jr : [];
31655
+ ), jl = Array.isArray(Hr) ? Hr : [];
31657
31656
  if (kd == null || !(Ws != null && Ws.many_collection) || !Ws.many_field) {
31658
31657
  vn += jl.length;
31659
31658
  continue;
@@ -31698,22 +31697,22 @@ ${le.join(`
31698
31697
  let kd = !1;
31699
31698
  if (Object.keys(Bs).length > 0 && (Pt.current && (Bs._change_reason = Pt.current), await q.request(Fn(`/items/${Gt}/${Gn}`, Bs)).catch((nr) => {
31700
31699
  mn = !0, kd = !0;
31701
- const Jr = bc(nr);
31702
- Jr ? (B = Jr, Wt(Et, { status: "error", error: "Waiting for a change reason" })) : Wt(Et, { status: "error", error: E(nr) });
31700
+ const Hr = bc(nr);
31701
+ Hr ? (B = Hr, Wt(Et, { status: "error", error: "Waiting for a change reason" })) : Wt(Et, { status: "error", error: E(nr) });
31703
31702
  })), kd) {
31704
31703
  vn.set(Gn, $o), Wt(Et, (nr) => {
31705
- var Jr;
31704
+ var Hr;
31706
31705
  return {
31707
- progress: { done: (((Jr = nr.progress) == null ? void 0 : Jr.done) ?? 0) + 1, total: _n.size }
31706
+ progress: { done: (((Hr = nr.progress) == null ? void 0 : Hr.done) ?? 0) + 1, total: _n.size }
31708
31707
  };
31709
31708
  });
31710
31709
  return;
31711
31710
  }
31712
31711
  const Ui = {};
31713
- for (const [nr, Jr] of zi) {
31712
+ for (const [nr, Hr] of zi) {
31714
31713
  const Pm = nr.slice(13), Ws = de.find(
31715
31714
  (Qs) => Qs.one_collection === Gt && Qs.one_field === Pm
31716
- ), jl = Jr;
31715
+ ), jl = Hr;
31717
31716
  if (!(Ws != null && Ws.many_collection) || !Ws.many_field) {
31718
31717
  hn += jl.created.length + jl.updated.length + jl.deleted.length, Ui[nr] = jl;
31719
31718
  continue;
@@ -31746,9 +31745,9 @@ ${le.join(`
31746
31745
  });
31747
31746
  }
31748
31747
  Object.keys(Ui).length > 0 && vn.set(Gn, Ui), Wt(Et, (nr) => {
31749
- var Jr;
31748
+ var Hr;
31750
31749
  return {
31751
- progress: { done: (((Jr = nr.progress) == null ? void 0 : Jr.done) ?? 0) + 1, total: _n.size }
31750
+ progress: { done: (((Hr = nr.progress) == null ? void 0 : Hr.done) ?? 0) + 1, total: _n.size }
31752
31751
  };
31753
31752
  });
31754
31753
  })
@@ -31758,7 +31757,7 @@ ${le.join(`
31758
31757
  });
31759
31758
  }
31760
31759
  yn(Pn), B && Ut(B);
31761
- const ka = new Map(On);
31760
+ const va = new Map(On);
31762
31761
  for (const ct of Ce) {
31763
31762
  const Et = `o2m:del:${ct}`, [Gt] = ct.split("."), _n = On.get(ct) ?? /* @__PURE__ */ new Set();
31764
31763
  Wt(Et, { status: "running", progress: { done: 0, total: _n.size } });
@@ -31774,9 +31773,9 @@ ${le.join(`
31774
31773
  };
31775
31774
  });
31776
31775
  })
31777
- ), mn || (Wt(Et, { status: "done" }), ka.delete(ct));
31776
+ ), mn || (Wt(Et, { status: "done" }), va.delete(ct));
31778
31777
  }
31779
- return En(ka), z && He.length > 0 && await Promise.all(
31778
+ return En(va), z && He.length > 0 && await Promise.all(
31780
31779
  He.map(
31781
31780
  (ct) => q.request(
31782
31781
  Ie("/tasks", {
@@ -32045,7 +32044,7 @@ ${le.join(`
32045
32044
  {
32046
32045
  field: G,
32047
32046
  draft: nl,
32048
- onChange: Qr,
32047
+ onChange: Vr,
32049
32048
  relations: de,
32050
32049
  collection: t,
32051
32050
  itemId: A,
@@ -32096,8 +32095,8 @@ ${le.join(`
32096
32095
  const An = dr[Pn.field];
32097
32096
  return An === void 0 || An > 0;
32098
32097
  }
32099
- const ka = rt[Pn.field];
32100
- return ka != null && ka !== "";
32098
+ const va = rt[Pn.field];
32099
+ return va != null && va !== "";
32101
32100
  })) && _t.add(xt.key);
32102
32101
  }
32103
32102
  return /* @__PURE__ */ a("div", { className: "rounded-xl border border-slate-200 bg-white", children: [
@@ -32132,7 +32131,7 @@ ${le.join(`
32132
32131
  /* @__PURE__ */ a("div", { className: "px-5 py-5", children: [
32133
32132
  /* @__PURE__ */ e(Np, { children: (xt) => Ge.map(($t) => {
32134
32133
  var mn;
32135
- const Zt = Fl == null ? void 0 : Fl[$t.field], Ln = Zt == null ? void 0 : Zt.entries, zn = (Zt == null ? void 0 : Zt.separator) ?? null, Pn = rt[$t.field], ka = Pn != null && Pn !== "", An = Ln != null && Ln.length && ka ? ((mn = de.find(
32134
+ const Zt = Fl == null ? void 0 : Fl[$t.field], Ln = Zt == null ? void 0 : Zt.entries, zn = (Zt == null ? void 0 : Zt.separator) ?? null, Pn = rt[$t.field], va = Pn != null && Pn !== "", An = Ln != null && Ln.length && va ? ((mn = de.find(
32136
32135
  (hn) => hn.many_collection === t && hn.many_field === $t.field && !hn.junction_field
32137
32136
  )) == null ? void 0 : mn.one_collection) ?? null : null, In = (Ce == null ? void 0 : Ce.enabled) && $t.field === Ce.primary_field, ct = (() => {
32138
32137
  const hn = rt[(Ce == null ? void 0 : Ce.primary_field) ?? ""];
@@ -32202,7 +32201,7 @@ ${le.join(`
32202
32201
  {
32203
32202
  field: vn,
32204
32203
  draft: nl,
32205
- onChange: Qr,
32204
+ onChange: Vr,
32206
32205
  relations: de,
32207
32206
  collection: t,
32208
32207
  itemId: A,
@@ -32226,7 +32225,7 @@ ${le.join(`
32226
32225
  {
32227
32226
  field: $t,
32228
32227
  draft: nl,
32229
- onChange: Qr,
32228
+ onChange: Vr,
32230
32229
  relations: de,
32231
32230
  collection: t,
32232
32231
  itemId: A,
@@ -32240,7 +32239,7 @@ ${le.join(`
32240
32239
  swapContent: _n
32241
32240
  }
32242
32241
  ),
32243
- (Ln == null ? void 0 : Ln.length) && ka && An && /* @__PURE__ */ e(
32242
+ (Ln == null ? void 0 : Ln.length) && va && An && /* @__PURE__ */ e(
32244
32243
  hu,
32245
32244
  {
32246
32245
  relCollection: An,
@@ -32373,7 +32372,7 @@ ${le.join(`
32373
32372
  };
32374
32373
  }), Re = fd && _o === B.key && g, Ge = hd && wo === B.key && !z, yt = Tc.filter((gt) => (gt.group_key ?? null) === B.key);
32375
32374
  if (Ke.length === 0 && !Re && !Ge && yt.length === 0) return null;
32376
- const _t = va && B.type !== "tab";
32375
+ const _t = ya && B.type !== "tab";
32377
32376
  return /* @__PURE__ */ e(
32378
32377
  i_,
32379
32378
  {
@@ -32386,7 +32385,7 @@ ${le.join(`
32386
32385
  widgetAssignments: yt.length > 0 ? yt : void 0,
32387
32386
  layoutId: ((It = K == null ? void 0 : K.layout) == null ? void 0 : It.id) ?? null,
32388
32387
  draft: rt,
32389
- onChange: Qr,
32388
+ onChange: Vr,
32390
32389
  relations: de,
32391
32390
  collection: t,
32392
32391
  itemId: A,
@@ -32508,7 +32507,7 @@ ${le.join(`
32508
32507
  }
32509
32508
  if (Ge._t === "pdf") {
32510
32509
  if (!ae) return null;
32511
- const Pn = Ge.slot.col_span ?? 12, ka = ((Ln = Ge.slot.label_override) == null ? void 0 : Ln.trim()) || "Generate PDF", An = !ll;
32510
+ const Pn = Ge.slot.col_span ?? 12, va = ((Ln = Ge.slot.label_override) == null ? void 0 : Ln.trim()) || "Generate PDF", An = !ll;
32512
32511
  return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${Pn}` }, children: /* @__PURE__ */ a(
32513
32512
  "button",
32514
32513
  {
@@ -32535,7 +32534,7 @@ ${le.join(`
32535
32534
  ]
32536
32535
  }
32537
32536
  ),
32538
- re ? "Generating…" : ka
32537
+ re ? "Generating…" : va
32539
32538
  ]
32540
32539
  }
32541
32540
  ) }, "__pdf__");
@@ -32563,7 +32562,7 @@ ${le.join(`
32563
32562
  {
32564
32563
  field: yt,
32565
32564
  draft: nl,
32566
- onChange: Qr,
32565
+ onChange: Vr,
32567
32566
  relations: de,
32568
32567
  collection: t,
32569
32568
  itemId: A,
@@ -32607,7 +32606,7 @@ ${le.join(`
32607
32606
  onClick: () => ql(G.key),
32608
32607
  className: H(
32609
32608
  "whitespace-nowrap px-4 py-2.5 text-sm font-medium border-b-2 transition-colors flex items-center gap-1.5",
32610
- zr === G.key ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
32609
+ Ur === G.key ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
32611
32610
  ),
32612
32611
  children: [
32613
32612
  G.label,
@@ -32617,7 +32616,7 @@ ${le.join(`
32617
32616
  G.key
32618
32617
  );
32619
32618
  }) }),
32620
- Bh(zr),
32619
+ Bh(Ur),
32621
32620
  Oc.filter((G) => typeof G == "string" && G !== "__ungrouped__").map((G) => zh(G)),
32622
32621
  !Aa && g && /* @__PURE__ */ e(
32623
32622
  Wc,
@@ -32671,13 +32670,13 @@ ${le.join(`
32671
32670
  }
32672
32671
  function qv() {
32673
32672
  var Re;
32674
- const E = La.findIndex((Ge) => Ge.key === zr), B = E === La.length - 1, le = /* @__PURE__ */ e("div", { className: "mt-6 border-t border-slate-200 pt-4", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2", children: [
32673
+ const E = La.findIndex((Ge) => Ge.key === Ur), B = E === La.length - 1, le = /* @__PURE__ */ e("div", { className: "mt-6 border-t border-slate-200 pt-4", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2", children: [
32675
32674
  /* @__PURE__ */ a(
32676
32675
  "button",
32677
32676
  {
32678
32677
  type: "button",
32679
32678
  onClick: () => {
32680
- const Ge = La.findIndex((yt) => yt.key === zr);
32679
+ const Ge = La.findIndex((yt) => yt.key === Ur);
32681
32680
  Ge > 0 && ql(La[Ge - 1].key);
32682
32681
  },
32683
32682
  disabled: E === 0,
@@ -32748,7 +32747,7 @@ ${le.join(`
32748
32747
  bx,
32749
32748
  {
32750
32749
  steps: La,
32751
- active: zr,
32750
+ active: Ur,
32752
32751
  completed: xv,
32753
32752
  dirtySteps: fv,
32754
32753
  errorSteps: new Set(
@@ -32757,7 +32756,7 @@ ${le.join(`
32757
32756
  onStepClick: ql
32758
32757
  }
32759
32758
  ),
32760
- Bh(zr, !0),
32759
+ Bh(Ur, !0),
32761
32760
  Ke.map((Ge, yt) => {
32762
32761
  const _t = typeof Ge == "string" ? Ge : Ge.key;
32763
32762
  return /* @__PURE__ */ e("div", { children: Dm(Ge) }, _t ?? yt);
@@ -32854,16 +32853,16 @@ ${le.join(`
32854
32853
  /* @__PURE__ */ e("p", { className: "text-[13px] font-medium text-slate-500 dark:text-muted-foreground", children: "Loading record…" })
32855
32854
  ] })
32856
32855
  ] });
32857
- const Wh = (ye == null ? void 0 : ye.display_name) ?? Bt(t ?? ""), Qh = (ye == null ? void 0 : ye.singular) || Wh, Co = !z && Je && (ye != null && ye.display_template) ? pa(ye.display_template, Je) : Wh, Vh = !z && W && ya;
32856
+ const Wh = (ye == null ? void 0 : ye.display_name) ?? Bt(t ?? ""), Qh = (ye == null ? void 0 : ye.singular) || Wh, Co = !z && Je && (ye != null && ye.display_template) ? pa(ye.display_template, Je) : Wh, Vh = !z && W && ga;
32858
32857
  return /* @__PURE__ */ e(
32859
32858
  ag.Provider,
32860
32859
  {
32861
32860
  value: z ? null : za,
32862
- children: /* @__PURE__ */ e(sg.Provider, { value: es, children: /* @__PURE__ */ e(Dg.Provider, { value: md, children: /* @__PURE__ */ e(Kg.Provider, { value: ge, children: /* @__PURE__ */ e(Mg.Provider, { value: er, children: /* @__PURE__ */ e(
32861
+ children: /* @__PURE__ */ e(sg.Provider, { value: ts, children: /* @__PURE__ */ e(Dg.Provider, { value: md, children: /* @__PURE__ */ e(Kg.Provider, { value: ge, children: /* @__PURE__ */ e(Mg.Provider, { value: er, children: /* @__PURE__ */ e(
32863
32862
  ng.Provider,
32864
32863
  {
32865
32864
  value: {
32866
- draft: ts,
32865
+ draft: ns,
32867
32866
  collection: t,
32868
32867
  dirtyFields: Ye.current,
32869
32868
  fieldLabels: Zs,
@@ -33022,7 +33021,7 @@ ${le.join(`
33022
33021
  "data-tip": Dh,
33023
33022
  className: "max-w-[350px] overflow-hidden text-ellipsis whitespace-nowrap",
33024
33023
  children: Ac.map((E, B) => {
33025
- const G = E.weight === "bold" ? "font-bold" : E.weight === "semibold" ? "font-semibold" : E.weight === "medium" ? "font-medium" : "font-normal", le = E.color === "cyan" ? "text-nvr-cyan" : E.color === "blue" ? "text-blue-600 dark:text-blue-400" : E.color === "green" ? "text-emerald-600 dark:text-emerald-400" : E.color === "amber" ? "text-amber-600 dark:text-amber-400" : E.color === "red" ? "text-red-600 dark:text-red-400" : E.color === "purple" ? "text-purple-600 dark:text-purple-400" : "text-slate-500 dark:text-slate-400", me = E.display_as === "pill", Ce = E.display_as === "tag", Ke = (Ur == null ? void 0 : Ur.separator) ?? " | ";
33024
+ const G = E.weight === "bold" ? "font-bold" : E.weight === "semibold" ? "font-semibold" : E.weight === "medium" ? "font-medium" : "font-normal", le = E.color === "cyan" ? "text-nvr-cyan" : E.color === "blue" ? "text-blue-600 dark:text-blue-400" : E.color === "green" ? "text-emerald-600 dark:text-emerald-400" : E.color === "amber" ? "text-amber-600 dark:text-amber-400" : E.color === "red" ? "text-red-600 dark:text-red-400" : E.color === "purple" ? "text-purple-600 dark:text-purple-400" : "text-slate-500 dark:text-slate-400", me = E.display_as === "pill", Ce = E.display_as === "tag", Ke = (Br == null ? void 0 : Br.separator) ?? " | ";
33026
33025
  return /* @__PURE__ */ a(
33027
33026
  "span",
33028
33027
  {
@@ -33609,7 +33608,7 @@ ${le.join(`
33609
33608
  }
33610
33609
  )
33611
33610
  ] }),
33612
- !z && rs && Tr.length > 0 && /* @__PURE__ */ a("div", { className: "relative", children: [
33611
+ !z && ss && Tr.length > 0 && /* @__PURE__ */ a("div", { className: "relative", children: [
33613
33612
  /* @__PURE__ */ a(
33614
33613
  "button",
33615
33614
  {
@@ -33921,7 +33920,7 @@ ${le.join(`
33921
33920
  /* @__PURE__ */ a(
33922
33921
  "div",
33923
33922
  {
33924
- ref: Vt,
33923
+ ref: Qt,
33925
33924
  className: H(
33926
33925
  "p-6 space-y-4",
33927
33926
  lt ? "flex-1 overflow-y-auto" : ""
@@ -33969,8 +33968,8 @@ ${le.join(`
33969
33968
  onTakeOver: ui,
33970
33969
  takingOver: Ul,
33971
33970
  isAdmin: W,
33972
- onRequestLock: Vr,
33973
- requesting: as
33971
+ onRequestLock: Jr,
33972
+ requesting: rs
33974
33973
  }
33975
33974
  ),
33976
33975
  !z && /* @__PURE__ */ e(
@@ -34048,7 +34047,7 @@ ${le.join(`
34048
34047
  itemId: A,
34049
34048
  staging: ba,
34050
34049
  errors: _e,
34051
- staleFields: ls,
34050
+ staleFields: is,
34052
34051
  aliasEmptiness: {
34053
34052
  // O2M aliases: effective row count (saved − staged
34054
34053
  // deletes + pending) — without this a populated grid
@@ -34077,7 +34076,7 @@ ${le.join(`
34077
34076
  (Re) => Re.type === "tab" && Re.container_id === Ke.id && Re.key === E
34078
34077
  )
34079
34078
  );
34080
- Ce ? (Jl(Ce, E), (me = Vt.current) == null || me.scrollTo({ top: 0 })) : ql(E);
34079
+ Ce ? (Jl(Ce, E), (me = Qt.current) == null || me.scrollTo({ top: 0 })) : ql(E);
34081
34080
  } else
34082
34081
  ql(E);
34083
34082
  let G = 0;
@@ -35762,7 +35761,7 @@ function nS({
35762
35761
  }
35763
35762
  }
35764
35763
  return [...x].slice(0, 12);
35765
- }, [u, t]), m = wa({
35764
+ }, [u, t]), m = Na({
35766
35765
  queries: c.map((x) => ({
35767
35766
  queryKey: ["cbv-collection-meta", x],
35768
35767
  queryFn: () => o.request(Z(`/collections/${x}`)).then((b) => b.data),
@@ -36956,7 +36955,7 @@ function eF({
36956
36955
  showCreate: c = !0,
36957
36956
  className: m
36958
36957
  }) {
36959
- var ya, va, Ha;
36958
+ var ga, ya, Ha;
36960
36959
  const p = je(), h = jt(), { open: f, urlFor: y } = Ps(), [v, g] = S(1), [x, b] = S(i), F = ko(x.trim(), 350), [C, L] = S(d ?? []), [N, _] = S(s ?? ""), [w, k] = S(r ?? null), [T, $] = S({}), [j, D] = S(null), [O, q] = S({}), [P, W] = S({}), [M, R] = S({}), [A, z] = S({}), [K, ae] = S(null), [V, Y] = S(!1), ne = Ee(null), [de, te] = S({}), [xe, ye] = S({}), [Me, Ne] = S(o ?? []), { scopes: Be, ready: ue } = Sc(), [J, ce] = S(!1), [ee, re] = S(/* @__PURE__ */ new Set()), [be, Fe] = S({}), X = cm("drill.browser"), ge = X.value, [Pe, st] = S(null), [nt, $e] = S(!1), [Je, et] = S(() => {
36961
36960
  try {
36962
36961
  return localStorage.getItem("nvr_table_density") === "comfortable" ? "comfortable" : "compact";
@@ -37016,14 +37015,14 @@ function eF({
37016
37015
  };
37017
37016
  return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
37018
37017
  }, [Ht]);
37019
- const Qt = Ee(null), Nn = Ee(null), wn = Ee(!1), { isAdmin: Zn } = _s(), Rn = Ee(t);
37018
+ const Vt = Ee(null), Nn = Ee(null), wn = Ee(!1), { isAdmin: Zn } = _s(), Rn = Ee(t);
37020
37019
  Ae(() => {
37021
37020
  Rn.current !== t && (Rn.current = t, g(1), b(i), L([]), _(s ?? ""), k(r ?? null), $({}), q({}), W({}), $n([]), gn(null), te({}), ye({}), Fe({}), Ne([]), ge != null && ge.length && X.back(ge.length), st(null), wn.current = !1);
37022
37021
  }, [t]), Ae(() => {
37023
37022
  if (!nt) return;
37024
37023
  const I = (pe) => {
37025
37024
  var Te;
37026
- (Te = Qt.current) != null && Te.contains(pe.target) || $e(!1);
37025
+ (Te = Vt.current) != null && Te.contains(pe.target) || $e(!1);
37027
37026
  };
37028
37027
  return window.addEventListener("mousedown", I), () => window.removeEventListener("mousedown", I);
37029
37028
  }, [nt]), Ae(() => {
@@ -37067,17 +37066,17 @@ function eF({
37067
37066
  if (!tt) continue;
37068
37067
  const vt = Cc(I, tt.name);
37069
37068
  if (vt.length === 0) continue;
37070
- const Vt = await pc(p, tt, vt, Se.value_field).catch(
37069
+ const Qt = await pc(p, tt, vt, Se.value_field).catch(
37071
37070
  () => []
37072
37071
  );
37073
- Vt.length > 0 && (Te[Se.key] = Vt);
37072
+ Qt.length > 0 && (Te[Se.key] = Qt);
37074
37073
  }
37075
37074
  if (Object.keys(Te).length > 0) {
37076
37075
  const Se = (tt) => {
37077
- var Vt;
37076
+ var Qt;
37078
37077
  const vt = { ...tt };
37079
37078
  for (const [un, Qn] of Object.entries(Te))
37080
- (((Vt = vt[un]) == null ? void 0 : Vt.length) ?? 0) > 0 || (vt[un] = Qn);
37079
+ (((Qt = vt[un]) == null ? void 0 : Qt.length) ?? 0) > 0 || (vt[un] = Qn);
37081
37080
  return vt;
37082
37081
  };
37083
37082
  te(Se), ye(Se), re(new Set(Object.keys(Te)));
@@ -37088,7 +37087,7 @@ function eF({
37088
37087
  const xa = (I) => {
37089
37088
  const pe = vo(Be, { key: I.key, collection: I.collection }), Te = pe ? (Be == null ? void 0 : Be.restricted[pe.name]) ?? [] : [];
37090
37089
  return Te.length > 0 ? Te : void 0;
37091
- }, Na = ve(() => new Map(He.map((I) => [I.field, I])), [He]), Kn = (oe == null ? void 0 : oe.relations) ?? [], Jn = ve(() => (w ?? He.slice(0, 7).map((pe) => pe.field)).filter((pe) => pe.includes(".") || Na.has(pe)), [w, He, Na]), [ir, $s] = S(null), ha = ve(
37090
+ }, ka = ve(() => new Map(He.map((I) => [I.field, I])), [He]), Kn = (oe == null ? void 0 : oe.relations) ?? [], Jn = ve(() => (w ?? He.slice(0, 7).map((pe) => pe.field)).filter((pe) => pe.includes(".") || ka.has(pe)), [w, He, ka]), [ir, $s] = S(null), ha = ve(
37092
37091
  () => ir ?? (Jn[0] ? { [Jn[0]]: "left" } : {}),
37093
37092
  [ir, Jn]
37094
37093
  ), oa = (I) => ha[I], mr = (I) => {
@@ -37096,11 +37095,11 @@ function eF({
37096
37095
  Te ? Te === "left" ? pe[I] = "right" : delete pe[I] : pe[I] = "left", $s(pe);
37097
37096
  }, Oa = (I) => T[I] ?? (I.includes(".") ? I.split(".").map(Ar).join(" › ") : I === "id" ? "ID" : Ar(I)), qr = ve(
37098
37097
  () => Jn.filter((I) => !I.includes(".")).map((I) => ({ field: I, info: kc(Kn, t, I) })).filter((I) => !!I.info),
37099
- [Jn, Na, Kn, t]
37098
+ [Jn, ka, Kn, t]
37100
37099
  ), ba = ve(
37101
37100
  () => [...new Set(qr.map((I) => I.info.relation.many_collection ?? "").filter(Boolean))],
37102
37101
  [qr]
37103
- ), qs = wa({
37102
+ ), qs = Na({
37104
37103
  queries: ba.map((I) => ({
37105
37104
  queryKey: ["cbv-collection-meta", I],
37106
37105
  queryFn: () => p.request(Z(`/collections/${I}`)).then((pe) => pe.data),
@@ -37125,7 +37124,7 @@ function eF({
37125
37124
  )
37126
37125
  ],
37127
37126
  [qr, ua]
37128
- ), Ia = wa({
37127
+ ), Ia = Na({
37129
37128
  queries: hs.map((I) => ({
37130
37129
  queryKey: ["cbv-collection-meta", I],
37131
37130
  queryFn: () => p.request(Z(`/collections/${I}`)).then((pe) => pe.data),
@@ -37146,7 +37145,7 @@ function eF({
37146
37145
  I[pe.field] = `${pe.field}.${Ku(ua.get(Te))}`;
37147
37146
  else {
37148
37147
  const Se = ua.get(Te), tt = Se == null ? void 0 : Se.relations.find(
37149
- (Vt) => Vt.many_collection === Te && Vt.many_field === pe.info.relation.junction_field
37148
+ (Qt) => Qt.many_collection === Te && Qt.many_field === pe.info.relation.junction_field
37150
37149
  ), vt = (tt == null ? void 0 : tt.one_collection) ?? "";
37151
37150
  I[pe.field] = `${pe.field}.${Ku(vt ? or.get(vt) : void 0)}`;
37152
37151
  }
@@ -37193,8 +37192,8 @@ function eF({
37193
37192
  }) : (I.push({ path: Se.path, op: "_gte", value: un.from }), I.push({ path: Se.path, op: "_lte", value: `${un.to}T23:59:59` })));
37194
37193
  continue;
37195
37194
  }
37196
- let vt = Se.op.includes(":") ? Se.op.split(":")[0] : Se.op, Vt = Se.op.includes(":") ? Se.op.split(":")[1] : Se.value || null;
37197
- Se.fieldType === "boolean" && (Vt === "true" || Vt === "false") && (Vt = Vt === "true"), Se.not && (vt = Z3[vt] ?? vt), I.push({ path: Se.path, op: vt, value: Vt });
37195
+ let vt = Se.op.includes(":") ? Se.op.split(":")[0] : Se.op, Qt = Se.op.includes(":") ? Se.op.split(":")[1] : Se.value || null;
37196
+ Se.fieldType === "boolean" && (Qt === "true" || Qt === "false") && (Qt = Qt === "true"), Se.not && (vt = Z3[vt] ?? vt), I.push({ path: Se.path, op: vt, value: Qt });
37198
37197
  }
37199
37198
  for (const Se of Rt) {
37200
37199
  const tt = xe[Se.key] ?? [];
@@ -37211,8 +37210,8 @@ function eF({
37211
37210
  else if (tt.kind === "bool") I.push({ path: [Se], op: "_eq", value: tt.value === "true" });
37212
37211
  else if (tt.kind === "date" && tt.value) {
37213
37212
  const vt = tt.value.startsWith("r:") ? (() => {
37214
- const [Vt, un] = tt.value.slice(2).split("..");
37215
- return Vt ? { from: Vt, to: un || Vt } : null;
37213
+ const [Qt, un] = tt.value.slice(2).split("..");
37214
+ return Qt ? { from: Qt, to: un || Qt } : null;
37216
37215
  })() : _x(tt.value);
37217
37216
  vt && (I.push({ path: [Se], op: "_gte", value: vt.from }), I.push({ path: [Se], op: "_lte", value: `${vt.to}T23:59:59` }));
37218
37217
  }
@@ -37231,7 +37230,7 @@ function eF({
37231
37230
  if (!pe || !Te) return null;
37232
37231
  const Se = I.find((tt) => ["name", "title", "label", "short_name"].includes(tt.toLowerCase())) ?? null;
37233
37232
  return { latField: pe, lngField: Te, labelField: Se };
37234
- }, [oe]), [es, Xn] = S(!1), [Ks, zl] = S(!1), fa = Ee(da);
37233
+ }, [oe]), [ts, Xn] = S(!1), [Ks, zl] = S(!1), fa = Ee(da);
37235
37234
  Ae(() => {
37236
37235
  fa.current !== da && (fa.current = da, g(1));
37237
37236
  }, [da]);
@@ -37240,7 +37239,7 @@ function eF({
37240
37239
  isLoading: Fs,
37241
37240
  isFetching: Zs,
37242
37241
  refetch: xs,
37243
- error: ts
37242
+ error: ns
37244
37243
  } = se({
37245
37244
  queryKey: ["cbv-items", t, F, N, ht ? "grouped" : v, ht ? 500 : Wn, da, Fr],
37246
37245
  queryFn: () => p.request(
@@ -37256,8 +37255,8 @@ function eF({
37256
37255
  enabled: !!t && J,
37257
37256
  placeholderData: (I) => I,
37258
37257
  retry: !1
37259
- }), _a = We ? We.rows : (Qa == null ? void 0 : Qa.data) ?? [], Ua = We ? We.total : (Qa == null ? void 0 : Qa.total) ?? 0, Is = Qa == null ? void 0 : Qa.aggregates, Ra = Math.max(1, Math.ceil(Ua / Wn)), Wr = bg(Zs), ns = fm(), Mr = Ee(/* @__PURE__ */ new Set());
37260
- Mr.current = new Set(_a.map((I) => String(I.id)));
37258
+ }), wa = We ? We.rows : (Qa == null ? void 0 : Qa.data) ?? [], Ua = We ? We.total : (Qa == null ? void 0 : Qa.total) ?? 0, Is = Qa == null ? void 0 : Qa.aggregates, Ra = Math.max(1, Math.ceil(Ua / Wn)), Qr = bg(Zs), as = fm(), Mr = Ee(/* @__PURE__ */ new Set());
37259
+ Mr.current = new Set(wa.map((I) => String(I.id)));
37261
37260
  const Va = Ee([]);
37262
37261
  Va.current = [
37263
37262
  "cbv-items",
@@ -37270,16 +37269,16 @@ function eF({
37270
37269
  ];
37271
37270
  const [Ts, pr] = S(0);
37272
37271
  Ae(() => {
37273
- if (!ns || !t) return;
37274
- const I = () => pr((Te) => Te + 1), pe = ns.subscribeCollections([t], (Te) => {
37272
+ if (!as || !t) return;
37273
+ const I = () => pr((Te) => Te + 1), pe = as.subscribeCollections([t], (Te) => {
37275
37274
  const Se = String(Te.item);
37276
37275
  Te.action !== "delete" && Mr.current.has(Se) ? p.request(Z(`/items/${t}/${Se}`)).then((tt) => {
37277
37276
  const vt = tt == null ? void 0 : tt.data;
37278
37277
  vt && h.setQueryData(
37279
37278
  Va.current,
37280
- (Vt) => Vt && {
37281
- ...Vt,
37282
- data: Vt.data.map(
37279
+ (Qt) => Qt && {
37280
+ ...Qt,
37281
+ data: Qt.data.map(
37283
37282
  (un) => String(un.id) === Se ? { ...un, ...vt } : un
37284
37283
  )
37285
37284
  }
@@ -37289,7 +37288,7 @@ function eF({
37289
37288
  return () => {
37290
37289
  pe();
37291
37290
  };
37292
- }, [ns, t, h, p]);
37291
+ }, [as, t, h, p]);
37293
37292
  const { data: wl = [] } = se({
37294
37293
  queryKey: ["cbv-risk-rules", t],
37295
37294
  queryFn: () => p.request(
@@ -37298,67 +37297,67 @@ function eF({
37298
37297
  enabled: !!t,
37299
37298
  staleTime: 6e4,
37300
37299
  retry: !1
37301
- }), Qr = _a.map((I) => String(I.id)).join(","), { data: el = {} } = se({
37302
- queryKey: ["cbv-risk", t, Qr],
37300
+ }), Vr = wa.map((I) => String(I.id)).join(","), { data: el = {} } = se({
37301
+ queryKey: ["cbv-risk", t, Vr],
37303
37302
  queryFn: () => p.request(
37304
37303
  Ie("/at-risk/evaluate", {
37305
37304
  collection: t,
37306
- ids: _a.map((I) => String(I.id))
37305
+ ids: wa.map((I) => String(I.id))
37307
37306
  })
37308
37307
  ).then((I) => I.data ?? {}).catch(() => ({})),
37309
- enabled: !!t && wl.length > 0 && _a.length > 0,
37308
+ enabled: !!t && wl.length > 0 && wa.length > 0,
37310
37309
  staleTime: 3e4,
37311
37310
  retry: !1
37312
- }), ga = _a.map((I) => String(I.id)).join(","), { data: na } = se({
37313
- queryKey: ["cbv-pipeline-instances", t, ga],
37311
+ }), _a = wa.map((I) => String(I.id)).join(","), { data: na } = se({
37312
+ queryKey: ["cbv-pipeline-instances", t, _a],
37314
37313
  queryFn: () => p.request(
37315
- Z(`/pipelines/instances/${t}`, ga ? { ids: ga } : void 0)
37314
+ Z(`/pipelines/instances/${t}`, _a ? { ids: _a } : void 0)
37316
37315
  ).then((I) => I.data),
37317
- enabled: !!t && ga.length > 0,
37316
+ enabled: !!t && _a.length > 0,
37318
37317
  placeholderData: (I) => I,
37319
37318
  staleTime: 3e4,
37320
37319
  retry: !1
37321
- }), bs = (ya = na == null ? void 0 : na.binding) == null ? void 0 : ya.template, { data: hr } = se({
37320
+ }), bs = (ga = na == null ? void 0 : na.binding) == null ? void 0 : ga.template, { data: hr } = se({
37322
37321
  queryKey: ["cbv-pipeline-template", bs],
37323
37322
  queryFn: () => p.request(Z(`/pipelines/${bs}`)).then((I) => I.data),
37324
37323
  enabled: !!bs,
37325
37324
  retry: !1
37326
37325
  }), Dr = !!(na != null && na.binding), { data: dr } = se({
37327
- queryKey: ["cbv-owners", t, ga],
37326
+ queryKey: ["cbv-owners", t, _a],
37328
37327
  queryFn: () => p.request(
37329
37328
  Ie(`/pipelines/instance/${t}/owners/batch`, {
37330
- ids: ga.split(",").filter(Boolean)
37329
+ ids: _a.split(",").filter(Boolean)
37331
37330
  })
37332
37331
  ).then((I) => I.data ?? {}),
37333
- enabled: Dr && ga.length > 0,
37332
+ enabled: Dr && _a.length > 0,
37334
37333
  staleTime: 6e4,
37335
37334
  retry: !1
37336
37335
  }), Pr = ve(() => Jn.filter((I) => I.includes(".")), [Jn]), fr = ve(
37337
37336
  () => [.../* @__PURE__ */ new Set([...Pr, ...Object.values(za)])].slice(0, 20),
37338
37337
  [Pr, za]
37339
- ), ci = _a.map((I) => String(I.id)).join(","), { data: Ta } = se({
37338
+ ), ci = wa.map((I) => String(I.id)).join(","), { data: Ta } = se({
37340
37339
  queryKey: ["cbv-resolved", t, ci, fr.join(",")],
37341
37340
  queryFn: () => p.request(Z(`/items/${t}/resolve-paths`, { ids: ci, paths: fr.join(",") })).then((I) => I.data ?? { rows: {}, targets: {} }),
37342
- enabled: _a.length > 0 && fr.length > 0,
37341
+ enabled: wa.length > 0 && fr.length > 0,
37343
37342
  staleTime: 3e4,
37344
37343
  retry: !1
37345
37344
  }), Za = (I, pe) => {
37346
- var tt, vt, Vt;
37345
+ var tt, vt, Qt;
37347
37346
  const Te = pe.includes(".") ? pe : za[pe];
37348
37347
  if (!Te) return null;
37349
- const Se = (Vt = (vt = (tt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : tt[String(I)]) == null ? void 0 : vt[Te]) == null ? void 0 : Vt.value;
37348
+ const Se = (Qt = (vt = (tt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : tt[String(I)]) == null ? void 0 : vt[Te]) == null ? void 0 : Qt.value;
37350
37349
  return Se == null || Se === "" ? "—" : Se;
37351
37350
  }, ui = (I) => {
37352
37351
  var Te;
37353
37352
  const pe = I.includes(".") ? I : za[I];
37354
37353
  return pe ? ((Te = Ta == null ? void 0 : Ta.targets) == null ? void 0 : Te[pe]) ?? null : null;
37355
37354
  }, Ul = (I, pe) => {
37356
- var vt, Vt, un, Qn;
37355
+ var vt, Qt, un, Qn;
37357
37356
  const Te = pe.includes(".") ? pe : za[pe];
37358
37357
  if (!Te) return null;
37359
- const Se = (vt = Ta == null ? void 0 : Ta.targets) == null ? void 0 : vt[Te], tt = ((Qn = (un = (Vt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : Vt[String(I)]) == null ? void 0 : un[Te]) == null ? void 0 : Qn.ids) ?? [];
37358
+ const Se = (vt = Ta == null ? void 0 : Ta.targets) == null ? void 0 : vt[Te], tt = ((Qn = (un = (Qt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : Qt[String(I)]) == null ? void 0 : un[Te]) == null ? void 0 : Qn.ids) ?? [];
37360
37359
  return !Se || El(Se) || tt.length === 0 ? null : { target: Se, id: String(tt[0]) };
37361
- }, Vr = (I) => I.includes(".") || I in za, as = (I) => {
37360
+ }, Jr = (I) => I.includes(".") || I in za, rs = (I) => {
37362
37361
  if (I.includes(".")) return { kind: "text", path: I.split(".") };
37363
37362
  const pe = ks(Kn, t, I);
37364
37363
  if (pe != null && pe.one_collection)
@@ -37369,22 +37368,22 @@ function eF({
37369
37368
  const tt = za[I];
37370
37369
  return tt ? { kind: "text", path: tt.split(".") } : null;
37371
37370
  }
37372
- const Se = Na.get(I);
37371
+ const Se = ka.get(I);
37373
37372
  return !Se || Se.computed_formula && !Se.computed_store ? null : Se.type === "integer" || Se.type === "decimal" || Se.type === "float" ? { kind: "num" } : Se.type === "boolean" ? { kind: "bool" } : Se.type === "date" || Se.type === "datetime" || Se.type === "timestamp" ? { kind: "date" } : Se.interface === "select-dropdown" ? { kind: "enum" } : Se.type === "string" || Se.type === "text" ? { kind: "text", path: [I] } : null;
37374
37373
  }, aa = (I, pe) => Fe((Te) => {
37375
37374
  const Se = { ...Te };
37376
37375
  return pe ? Se[I] = pe : delete Se[I], Se;
37377
37376
  }), _l = (I) => {
37378
- var Vt, un, Qn, sa;
37377
+ var Qt, un, Qn, sa;
37379
37378
  const { key: pe, row: Te, cellText: Se } = I, tt = Te.id;
37380
37379
  if (pe === "__state__") {
37381
- const Ot = (Vt = na == null ? void 0 : na.instances) == null ? void 0 : Vt[String(tt)];
37380
+ const Ot = (Qt = na == null ? void 0 : na.instances) == null ? void 0 : Qt[String(tt)];
37382
37381
  if (!(Ot != null && Ot.state_key)) return;
37383
37382
  const Bn = be.__state__, Yn = (Bn == null ? void 0 : Bn.kind) === "state" ? Bn.value : [];
37384
37383
  aa("__state__", { kind: "state", value: [.../* @__PURE__ */ new Set([...Yn, Ot.state_key])] });
37385
37384
  return;
37386
37385
  }
37387
- const vt = as(pe);
37386
+ const vt = rs(pe);
37388
37387
  if (vt) {
37389
37388
  if (vt.kind === "in") {
37390
37389
  const Bn = ks(Kn, t, pe) ? Te[pe] != null ? [Te[pe]] : [] : ((sa = (Qn = (un = Ta == null ? void 0 : Ta.rows) == null ? void 0 : un[String(tt)]) == null ? void 0 : Qn[za[pe]]) == null ? void 0 : sa.ids) ?? [];
@@ -37419,26 +37418,26 @@ function eF({
37419
37418
  Ot && aa(pe, { kind: "date", value: `r:${Ot}..${Ot}` });
37420
37419
  }
37421
37420
  }
37422
- }, rs = (I, pe) => {
37421
+ }, ss = (I, pe) => {
37423
37422
  if (I === "__state__") return !1;
37424
- const Te = as(I);
37423
+ const Te = rs(I);
37425
37424
  return Te ? Te.kind === "in" ? !!ks(Kn, t, I) && pe[I] != null : Te.kind === "enum" || Te.kind === "num" ? pe[I] != null && pe[I] !== "" : Te.kind === "text" : !1;
37426
37425
  }, Ba = (I) => {
37427
- const { key: pe, row: Te, cellText: Se } = I, tt = Te.id, vt = as(pe);
37426
+ const { key: pe, row: Te, cellText: Se } = I, tt = Te.id, vt = rs(pe);
37428
37427
  if (!vt) return;
37429
- let Vt = null;
37428
+ let Qt = null;
37430
37429
  const un = `${pe}:${Date.now().toString(36)}`;
37431
37430
  if (vt.kind === "in" && ks(Kn, t, pe) && Te[pe] != null)
37432
- Vt = { id: un, path: [pe], op: "_neq", value: Te[pe], label: Se, field: pe };
37431
+ Qt = { id: un, path: [pe], op: "_neq", value: Te[pe], label: Se, field: pe };
37433
37432
  else if ((vt.kind === "enum" || vt.kind === "num") && Te[pe] != null && Te[pe] !== "")
37434
- Vt = { id: un, path: [pe], op: "_neq", value: Te[pe], label: Se, field: pe };
37433
+ Qt = { id: un, path: [pe], op: "_neq", value: Te[pe], label: Se, field: pe };
37435
37434
  else if (vt.kind === "text") {
37436
37435
  const Qn = pe.includes(".") || pe in za ? Za(tt, pe) : String(Te[pe] ?? "");
37437
- Qn && Qn !== "—" && (Vt = { id: un, path: vt.path, op: "_ncontains", value: Qn, label: Qn, field: pe });
37436
+ Qn && Qn !== "—" && (Qt = { id: un, path: vt.path, op: "_ncontains", value: Qn, label: Qn, field: pe });
37438
37437
  }
37439
- Vt && nn((Qn) => [...Qn, Vt]);
37438
+ Qt && nn((Qn) => [...Qn, Qt]);
37440
37439
  }, Ea = (I) => {
37441
- const pe = as(I);
37440
+ const pe = rs(I);
37442
37441
  if (!pe) return null;
37443
37442
  const Te = be[I];
37444
37443
  if (pe.kind === "in")
@@ -37515,17 +37514,17 @@ function eF({
37515
37514
  onChange: (Se) => aa(I, Se ? { kind: "date", value: Se } : null)
37516
37515
  }
37517
37516
  ) : null;
37518
- }, zs = Jn.some((I) => as(I) != null), Tr = (I) => {
37517
+ }, zs = Jn.some((I) => rs(I) != null), Tr = (I) => {
37519
37518
  var Te, Se;
37520
37519
  if (((Te = O[I]) == null ? void 0 : Te.type) === "number") return !0;
37521
37520
  if (I.includes(".") || I in za || ks(Kn, t, I)) return !1;
37522
- const pe = (Se = Na.get(I)) == null ? void 0 : Se.type;
37521
+ const pe = (Se = ka.get(I)) == null ? void 0 : Se.type;
37523
37522
  return pe === "integer" || pe === "decimal" || pe === "float";
37524
37523
  }, er = (I, pe, Te) => {
37525
- var tt, vt, Vt;
37524
+ var tt, vt, Qt;
37526
37525
  const Se = O[pe];
37527
37526
  if ((Se == null ? void 0 : Se.type) === "count") {
37528
- const un = pe.includes(".") ? pe : za[pe], Qn = Te != null && un ? (Vt = (vt = (tt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : tt[String(Te)]) == null ? void 0 : vt[un]) == null ? void 0 : Vt.ids : void 0, sa = pN(I === "—" ? "" : I, Qn);
37527
+ const un = pe.includes(".") ? pe : za[pe], Qn = Te != null && un ? (Qt = (vt = (tt = Ta == null ? void 0 : Ta.rows) == null ? void 0 : tt[String(Te)]) == null ? void 0 : vt[un]) == null ? void 0 : Qt.ids : void 0, sa = pN(I === "—" ? "" : I, Qn);
37529
37528
  return String(sa);
37530
37529
  }
37531
37530
  return Se && I && I !== "—" ? ao(I, Se) : I;
@@ -37536,22 +37535,22 @@ function eF({
37536
37535
  queryKey: ["cbv-views", t],
37537
37536
  queryFn: () => p.request(Z("/saved-views", { collection: t })).then((I) => I.data ?? []),
37538
37537
  staleTime: 3e4
37539
- }), jr = () => h.invalidateQueries({ queryKey: ["cbv-views", t] }), ss = (I) => {
37538
+ }), jr = () => h.invalidateQueries({ queryKey: ["cbv-views", t] }), ls = (I) => {
37540
37539
  var pe, Te;
37541
37540
  if (gn(I.id), L(I.filters ?? []), _(I.sort ?? ""), (pe = I.columns) != null && pe.length) {
37542
- const tt = I.columns.map(B3).filter((Bn) => Bn.includes(".") || Na.has(Bn));
37541
+ const tt = I.columns.map(B3).filter((Bn) => Bn.includes(".") || ka.has(Bn));
37543
37542
  tt.length > 0 && k(tt);
37544
- const vt = {}, Vt = {}, un = {}, Qn = {}, sa = {}, Ot = {};
37543
+ const vt = {}, Qt = {}, un = {}, Qn = {}, sa = {}, Ot = {};
37545
37544
  for (const Bn of I.columns)
37546
- typeof Bn != "string" && Bn.label && (vt[Bn.key] = Bn.label), typeof Bn != "string" && Bn.format && (Vt[Bn.key] = Bn.format), typeof Bn != "string" && Bn.pin && (un[Bn.key] = Bn.pin), typeof Bn != "string" && ((Te = Bn.tint) != null && Te.length) && (Qn[Bn.key] = Bn.tint), typeof Bn != "string" && Bn.width && (sa[Bn.key] = Bn.width), typeof Bn != "string" && Bn.agg && (Ot[Bn.key] = Bn.agg);
37547
- W(Ot), $(vt), q(Vt), z(Qn), R(sa), $s(Object.keys(un).length ? un : null);
37545
+ typeof Bn != "string" && Bn.label && (vt[Bn.key] = Bn.label), typeof Bn != "string" && Bn.format && (Qt[Bn.key] = Bn.format), typeof Bn != "string" && Bn.pin && (un[Bn.key] = Bn.pin), typeof Bn != "string" && ((Te = Bn.tint) != null && Te.length) && (Qn[Bn.key] = Bn.tint), typeof Bn != "string" && Bn.width && (sa[Bn.key] = Bn.width), typeof Bn != "string" && Bn.agg && (Ot[Bn.key] = Bn.agg);
37546
+ W(Ot), $(vt), q(Qt), z(Qn), R(sa), $s(Object.keys(un).length ? un : null);
37548
37547
  } else
37549
37548
  $s(null);
37550
37549
  g(1);
37551
37550
  }, tl = () => {
37552
37551
  const I = Ja.find((pe) => pe.is_default);
37553
37552
  if (I) {
37554
- ss(I);
37553
+ ls(I);
37555
37554
  return;
37556
37555
  }
37557
37556
  gn(null), L([]), _(s ?? ""), k(r ?? null), $({}), q({}), W({}), $s(null), g(1);
@@ -37560,15 +37559,15 @@ function eF({
37560
37559
  sort: N,
37561
37560
  columns: [
37562
37561
  ...Jn.map((I) => {
37563
- const pe = T[I], Te = O[I], Se = ha[I], tt = A[I], vt = M[I], Vt = P[I];
37564
- return !pe && !Te && !Se && !(tt != null && tt.length) && !vt && !Vt ? I : {
37562
+ const pe = T[I], Te = O[I], Se = ha[I], tt = A[I], vt = M[I], Qt = P[I];
37563
+ return !pe && !Te && !Se && !(tt != null && tt.length) && !vt && !Qt ? I : {
37565
37564
  key: I,
37566
37565
  ...pe ? { label: pe } : {},
37567
37566
  ...Te ? { format: Te } : {},
37568
37567
  ...Se ? { pin: Se } : {},
37569
37568
  ...tt != null && tt.length ? { tint: tt } : {},
37570
37569
  ...vt ? { width: vt } : {},
37571
- ...Vt ? { agg: Vt } : {}
37570
+ ...Qt ? { agg: Qt } : {}
37572
37571
  };
37573
37572
  }),
37574
37573
  // Synthetic columns (State/Owners/Actions) persist pins as pin-only
@@ -37580,7 +37579,7 @@ function eF({
37580
37579
  if (wn.current || Ja.length === 0 || He.length === 0) return;
37581
37580
  wn.current = !0;
37582
37581
  const I = Ja.find((pe) => pe.is_default);
37583
- I && zt == null && ss(I);
37582
+ I && zt == null && ls(I);
37584
37583
  }, [Ja, He]);
37585
37584
  const { data: U = [] } = se({
37586
37585
  queryKey: ["cbv-export-presets", t],
@@ -37638,9 +37637,9 @@ function eF({
37638
37637
  queryKey: ["cbv-view-subs"],
37639
37638
  queryFn: () => p.request(Z("/view-subscriptions")).then((I) => I.data ?? []).catch(() => []),
37640
37639
  staleTime: 6e4
37641
- }), ls = (I) => br.find((pe) => pe.view_id === I), cd = Ue({
37640
+ }), is = (I) => br.find((pe) => pe.view_id === I), cd = Ue({
37642
37641
  mutationFn: async (I) => {
37643
- const pe = ls(I);
37642
+ const pe = is(I);
37644
37643
  return pe ? p.request(Mn(`/view-subscriptions/${pe.id}`)) : p.request(Ie("/view-subscriptions", { view_id: I, digest: "daily" }));
37645
37644
  },
37646
37645
  onSuccess: () => h.invalidateQueries({ queryKey: ["cbv-view-subs"] })
@@ -37684,11 +37683,11 @@ function eF({
37684
37683
  }
37685
37684
  const $l = Yn[Ga];
37686
37685
  return Cl && $l != null ? uu(String($l), Cl) : $l;
37687
- }, Vt = [
37686
+ }, Qt = [
37688
37687
  ["id", ...Te.map((Yn) => Oa(Yn))].map(tt).join(","),
37689
37688
  ...pe.map((Yn) => [Yn.id, ...Te.map((Ga) => vt(Yn, Ga))].map(tt).join(","))
37690
37689
  ];
37691
- oe != null && oe.export_watermark && (Vt.push(""), Vt.push(
37690
+ oe != null && oe.export_watermark && (Qt.push(""), Qt.push(
37692
37691
  tt(`Exported ${(/* @__PURE__ */ new Date()).toISOString()} · ${pe.length} rows · ${t} · Nivaro`)
37693
37692
  )), p.request(Ie("/activity/export-log", {
37694
37693
  collection: t,
@@ -37697,7 +37696,7 @@ function eF({
37697
37696
  filters: da ? JSON.parse(da) : void 0
37698
37697
  })).catch(() => {
37699
37698
  });
37700
- const un = new Blob([Vt.join(`
37699
+ const un = new Blob([Qt.join(`
37701
37700
  `)], { type: "text/csv;charset=utf-8" }), Qn = URL.createObjectURL(un), sa = document.createElement("a");
37702
37701
  sa.href = Qn;
37703
37702
  const Ot = at.export_filename, Bn = ((I = Ja.find((Yn) => Yn.id === zt)) == null ? void 0 : I.name) ?? "all";
@@ -37730,16 +37729,16 @@ function eF({
37730
37729
  staleTime: 6e4
37731
37730
  }).then((tt) => {
37732
37731
  var sa;
37733
- const Vt = (sa = ((tt == null ? void 0 : tt.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : sa[1], un = ((tt == null ? void 0 : tt.fields) ?? []).map((Ot) => Ot.field), Qn = (Vt && un.includes(Vt) ? Vt : null) ?? un.find((Ot) => ["name", "title", "label", "short_name", "subject"].includes(Ot.toLowerCase())) ?? null;
37732
+ const Qt = (sa = ((tt == null ? void 0 : tt.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : sa[1], un = ((tt == null ? void 0 : tt.fields) ?? []).map((Ot) => Ot.field), Qn = (Qt && un.includes(Qt) ? Qt : null) ?? un.find((Ot) => ["name", "title", "label", "short_name", "subject"].includes(Ot.toLowerCase())) ?? null;
37734
37733
  Te(Qn ? `${I}.${Qn}` : I);
37735
37734
  }).catch(() => Te(I));
37736
37735
  return;
37737
37736
  }
37738
37737
  Te(I);
37739
- }, Nr = _a.length > 0 && _a.every((I) => kn.includes(I.id)), md = () => $n(
37740
- Nr ? kn.filter((I) => !_a.some((pe) => pe.id === I)) : [.../* @__PURE__ */ new Set([...kn, ..._a.map((I) => I.id)])]
37741
- ), pi = (I) => $n((pe) => pe.includes(I) ? pe.filter((Te) => Te !== I) : [...pe, I]), ea = 2e3, [Ca, is] = S(!1), tr = async () => {
37742
- is(!0);
37738
+ }, Nr = wa.length > 0 && wa.every((I) => kn.includes(I.id)), md = () => $n(
37739
+ Nr ? kn.filter((I) => !wa.some((pe) => pe.id === I)) : [.../* @__PURE__ */ new Set([...kn, ...wa.map((I) => I.id)])]
37740
+ ), pi = (I) => $n((pe) => pe.includes(I) ? pe.filter((Te) => Te !== I) : [...pe, I]), ea = 2e3, [Ca, zr] = S(!1), tr = async () => {
37741
+ zr(!0);
37743
37742
  try {
37744
37743
  const I = await p.request(
37745
37744
  Z(`/items/${t}`, {
@@ -37751,7 +37750,7 @@ function eF({
37751
37750
  );
37752
37751
  $n(I.data.map((pe) => pe.id));
37753
37752
  } finally {
37754
- is(!1);
37753
+ zr(!1);
37755
37754
  }
37756
37755
  }, Di = Ua === 0 ? 0 : (v - 1) * Wn + 1, Sl = Math.min(v * Wn, Ua), gs = !!(na != null && na.instances), Bl = (Tt ? 1 : 0) + (gs ? 2 : 0) + (on ? 1 : 0), Wl = [
37757
37756
  ...Jn.map((I) => ({ key: I, kind: "data" })),
@@ -37766,7 +37765,7 @@ function eF({
37766
37765
  ...Wl.filter((I) => oa(I.key) === "right")
37767
37766
  ], cr = [
37768
37767
  ...gs ? [{ key: "__state__", label: "State" }] : [],
37769
- ...Jn.filter((I) => Vr(I) || !ks(Kn, t, I)).map((I) => ({ key: I, label: Oa(I) }))
37768
+ ...Jn.filter((I) => Jr(I) || !ks(Kn, t, I)).map((I) => ({ key: I, label: Oa(I) }))
37770
37769
  ], wr = (I) => {
37771
37770
  var Se;
37772
37771
  if (!ht) return "";
@@ -37775,13 +37774,13 @@ function eF({
37775
37774
  const tt = (Se = na == null ? void 0 : na.instances) == null ? void 0 : Se[String(pe)];
37776
37775
  return (tt == null ? void 0 : tt.state_label) ?? (tt == null ? void 0 : tt.state_key) ?? "(no state)";
37777
37776
  }
37778
- if (Vr(ht)) return Za(pe, ht) || "(empty)";
37777
+ if (Jr(ht)) return Za(pe, ht) || "(empty)";
37779
37778
  const Te = I[ht];
37780
37779
  return Te == null || Te === "" ? "(empty)" : typeof Te == "boolean" ? Te ? "Yes" : "No" : er(String(Te), ht) || String(Te);
37781
37780
  }, Ql = (() => {
37782
- if (!ht) return _a.map((Se) => ({ kind: "row", row: Se }));
37781
+ if (!ht) return wa.map((Se) => ({ kind: "row", row: Se }));
37783
37782
  const I = /* @__PURE__ */ new Map();
37784
- for (const Se of _a) {
37783
+ for (const Se of wa) {
37785
37784
  const tt = wr(Se), vt = I.get(tt) ?? [];
37786
37785
  vt.push(Se), I.set(tt, vt);
37787
37786
  }
@@ -37849,8 +37848,8 @@ function eF({
37849
37848
  }, []);
37850
37849
  const xn = (I) => {
37851
37850
  let pe = Oa(I).length;
37852
- for (const Te of _a) {
37853
- const Se = Vr(I) ? Za(Te.id, I) ?? "" : er(String(Te[I] ?? ""), I, Te.id);
37851
+ for (const Te of wa) {
37852
+ const Se = Jr(I) ? Za(Te.id, I) ?? "" : er(String(Te[I] ?? ""), I, Te.id);
37854
37853
  Se.length > pe && (pe = Math.min(Se.length, 90));
37855
37854
  }
37856
37855
  R((Te) => ({ ...Te, [I]: Math.max(60, Math.round(pe * 6.6) + 28) }));
@@ -37964,7 +37963,7 @@ function eF({
37964
37963
  className: "w-56 overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-xl dark:border-slate-700 dark:bg-slate-900",
37965
37964
  onMouseDown: (I) => I.stopPropagation(),
37966
37965
  children: [
37967
- (bt.key === "__state__" || as(bt.key)) && bt.cellText && bt.cellText !== "—" && /* @__PURE__ */ a(
37966
+ (bt.key === "__state__" || rs(bt.key)) && bt.cellText && bt.cellText !== "—" && /* @__PURE__ */ a(
37968
37967
  "button",
37969
37968
  {
37970
37969
  type: "button",
@@ -37978,7 +37977,7 @@ function eF({
37978
37977
  ]
37979
37978
  }
37980
37979
  ),
37981
- rs(bt.key, bt.row) && bt.cellText && bt.cellText !== "—" && /* @__PURE__ */ a(
37980
+ ss(bt.key, bt.row) && bt.cellText && bt.cellText !== "—" && /* @__PURE__ */ a(
37982
37981
  "button",
37983
37982
  {
37984
37983
  type: "button",
@@ -38136,8 +38135,8 @@ function eF({
38136
38135
  {
38137
38136
  type: "button",
38138
38137
  onClick: () => Xn((I) => !I),
38139
- title: es ? "Back to the table" : "Show these records on a map",
38140
- className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${es ? "border-[#00ceff66] bg-[#00ceff14] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
38138
+ title: ts ? "Back to the table" : "Show these records on a map",
38139
+ className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${ts ? "border-[#00ceff66] bg-[#00ceff14] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
38141
38140
  "data-cbv-map-toggle": !0,
38142
38141
  children: [
38143
38142
  /* @__PURE__ */ e(N1, { className: "h-3.5 w-3.5" }),
@@ -38275,7 +38274,7 @@ function eF({
38275
38274
  children: Je === "compact" ? /* @__PURE__ */ e(Su, { className: "h-4 w-4" }) : /* @__PURE__ */ e(Pb, { className: "h-4 w-4" })
38276
38275
  }
38277
38276
  ),
38278
- /* @__PURE__ */ a("div", { className: "relative", ref: Qt, children: [
38277
+ /* @__PURE__ */ a("div", { className: "relative", ref: Vt, children: [
38279
38278
  /* @__PURE__ */ e(
38280
38279
  "button",
38281
38280
  {
@@ -38303,8 +38302,8 @@ function eF({
38303
38302
  Se.preventDefault();
38304
38303
  const tt = ne.current;
38305
38304
  if (ne.current = null, tt == null || tt === pe) return;
38306
- const vt = [...Jn], [Vt] = vt.splice(tt, 1);
38307
- vt.splice(pe, 0, Vt), k(vt);
38305
+ const vt = [...Jn], [Qt] = vt.splice(tt, 1);
38306
+ vt.splice(pe, 0, Qt), k(vt);
38308
38307
  },
38309
38308
  className: "group flex items-center gap-1.5 rounded px-1.5 py-1 hover:bg-slate-50 dark:hover:bg-slate-800",
38310
38309
  children: [
@@ -38385,8 +38384,8 @@ function eF({
38385
38384
  type: "button",
38386
38385
  onClick: () => {
38387
38386
  q((vt) => {
38388
- const Vt = { ...vt };
38389
- return Se.cfg ? Vt[I] = Se.cfg : delete Vt[I], Vt;
38387
+ const Qt = { ...vt };
38388
+ return Se.cfg ? Qt[I] = Se.cfg : delete Qt[I], Qt;
38390
38389
  }), ae(null);
38391
38390
  },
38392
38391
  className: `rounded border px-1.5 py-0.5 text-[10.5px] ${tt ? "border-[#00ceff66] bg-[#00ceff14] text-slate-800 dark:text-slate-100" : "border-slate-200 bg-white text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400"}`,
@@ -38422,9 +38421,9 @@ function eF({
38422
38421
  {
38423
38422
  ariaLabel: "Rule operator",
38424
38423
  value: Se.op,
38425
- onChange: (vt) => z((Vt) => ({
38426
- ...Vt,
38427
- [I]: (Vt[I] ?? []).map(
38424
+ onChange: (vt) => z((Qt) => ({
38425
+ ...Qt,
38426
+ [I]: (Qt[I] ?? []).map(
38428
38427
  (un, Qn) => Qn === tt ? { ...un, op: vt } : un
38429
38428
  )
38430
38429
  })),
@@ -38443,9 +38442,9 @@ function eF({
38443
38442
  "input",
38444
38443
  {
38445
38444
  value: Se.value ?? "",
38446
- onChange: (vt) => z((Vt) => ({
38447
- ...Vt,
38448
- [I]: (Vt[I] ?? []).map(
38445
+ onChange: (vt) => z((Qt) => ({
38446
+ ...Qt,
38447
+ [I]: (Qt[I] ?? []).map(
38449
38448
  (un, Qn) => Qn === tt ? { ...un, value: vt.target.value } : un
38450
38449
  )
38451
38450
  })),
@@ -38458,9 +38457,9 @@ function eF({
38458
38457
  {
38459
38458
  type: "button",
38460
38459
  "aria-label": vt,
38461
- onClick: () => z((Vt) => ({
38462
- ...Vt,
38463
- [I]: (Vt[I] ?? []).map((un, Qn) => Qn === tt ? { ...un, color: vt } : un)
38460
+ onClick: () => z((Qt) => ({
38461
+ ...Qt,
38462
+ [I]: (Qt[I] ?? []).map((un, Qn) => Qn === tt ? { ...un, color: vt } : un)
38464
38463
  })),
38465
38464
  className: H(
38466
38465
  "h-3.5 w-3.5 rounded-full border",
@@ -38480,7 +38479,7 @@ function eF({
38480
38479
  "aria-label": "Remove rule",
38481
38480
  onClick: () => z((vt) => ({
38482
38481
  ...vt,
38483
- [I]: (vt[I] ?? []).filter((Vt, un) => un !== tt)
38482
+ [I]: (vt[I] ?? []).filter((Qt, un) => un !== tt)
38484
38483
  })),
38485
38484
  className: "ml-auto text-slate-300 hover:text-slate-500",
38486
38485
  children: "✕"
@@ -38624,10 +38623,10 @@ function eF({
38624
38623
  onClick: () => {
38625
38624
  var Se;
38626
38625
  Wt(!1);
38627
- const I = Jn, pe = I.map((tt) => Oa(tt)).join(" "), Te = _a.map(
38626
+ const I = Jn, pe = I.map((tt) => Oa(tt)).join(" "), Te = wa.map(
38628
38627
  (tt) => I.map((vt) => {
38629
- const Vt = Vr(vt) ? er(Za(tt.id, vt) ?? "", vt, tt.id) : er(String(tt[vt] ?? ""), vt, tt.id);
38630
- return String(Vt ?? "").replace(/[\t\n]/g, " ");
38628
+ const Qt = Jr(vt) ? er(Za(tt.id, vt) ?? "", vt, tt.id) : er(String(tt[vt] ?? ""), vt, tt.id);
38629
+ return String(Qt ?? "").replace(/[\t\n]/g, " ");
38631
38630
  }).join(" ")
38632
38631
  ).join(`
38633
38632
  `);
@@ -38708,7 +38707,7 @@ ${Te}`).then(() => {
38708
38707
  },
38709
38708
  className: "flex w-full items-center rounded px-2 py-1.5 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
38710
38709
  children: [
38711
- ((va = yn.active) == null ? void 0 : va.create_label) ?? ((Ha = yn.active) == null ? void 0 : Ha.name) ?? "Default layout",
38710
+ ((ya = yn.active) == null ? void 0 : ya.create_label) ?? ((Ha = yn.active) == null ? void 0 : Ha.name) ?? "Default layout",
38712
38711
  /* @__PURE__ */ e("span", { className: "ml-auto pl-3 text-[10px] text-slate-400 dark:text-slate-500", children: "default" })
38713
38712
  ]
38714
38713
  }
@@ -38813,17 +38812,17 @@ ${Te}`).then(() => {
38813
38812
  children: [
38814
38813
  I.is_default && /* @__PURE__ */ e("span", { title: "Collection default view", className: "text-[#00a5cc]", children: "★" }),
38815
38814
  I.is_shared && !I.is_default && /* @__PURE__ */ e("span", { title: "Shared", children: "⚭" }),
38816
- /* @__PURE__ */ e("button", { type: "button", onClick: () => ss(I), children: I.name }),
38815
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => ls(I), children: I.name }),
38817
38816
  zt === I.id && /* @__PURE__ */ a(ot, { children: [
38818
38817
  /* @__PURE__ */ e(
38819
38818
  "button",
38820
38819
  {
38821
38820
  type: "button",
38822
38821
  onClick: () => cd.mutate(I.id),
38823
- title: ls(I.id) ? "Subscribed — a daily digest reports records that enter this view. Click to unsubscribe." : "Subscribe — get a daily digest of records that enter this view",
38822
+ title: is(I.id) ? "Subscribed — a daily digest reports records that enter this view. Click to unsubscribe." : "Subscribe — get a daily digest of records that enter this view",
38824
38823
  "aria-label": `Toggle digest subscription for ${I.name}`,
38825
- className: ls(I.id) ? "text-[#00a5cc]" : "text-slate-400 hover:text-[#00a5cc]",
38826
- children: ls(I.id) ? /* @__PURE__ */ e(Ms, { className: "h-3 w-3", fill: "currentColor" }) : /* @__PURE__ */ e(Cu, { className: "h-3 w-3" })
38824
+ className: is(I.id) ? "text-[#00a5cc]" : "text-slate-400 hover:text-[#00a5cc]",
38825
+ children: is(I.id) ? /* @__PURE__ */ e(Ms, { className: "h-3 w-3", fill: "currentColor" }) : /* @__PURE__ */ e(Cu, { className: "h-3 w-3" })
38827
38826
  }
38828
38827
  ),
38829
38828
  /* @__PURE__ */ e("button", { type: "button", onClick: () => Hn.mutate(I.id), title: "Update with current state", "aria-label": `Update ${I.name}`, children: "↺" }),
@@ -38868,9 +38867,9 @@ ${Te}`).then(() => {
38868
38867
  }
38869
38868
  ) : /* @__PURE__ */ e("button", { type: "button", onClick: () => wt(!0), className: "text-[12px] font-medium text-slate-400 hover:text-[#00a5cc]", children: "☆ Save view" })
38870
38869
  ] }),
38871
- ts != null && /* @__PURE__ */ a("div", { className: "mx-4 mt-3 flex flex-wrap items-center gap-3 rounded-md border border-red-200 bg-red-50 px-4 py-2.5 text-[13px] text-red-700 dark:border-red-900/40 dark:bg-red-900/10 dark:text-red-400", children: [
38872
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: ts instanceof Error ? ts.message : "Failed to load records" }),
38873
- (ts == null ? void 0 : ts.status) === 403 && /* @__PURE__ */ e(
38870
+ ns != null && /* @__PURE__ */ a("div", { className: "mx-4 mt-3 flex flex-wrap items-center gap-3 rounded-md border border-red-200 bg-red-50 px-4 py-2.5 text-[13px] text-red-700 dark:border-red-900/40 dark:bg-red-900/10 dark:text-red-400", children: [
38871
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: ns instanceof Error ? ns.message : "Failed to load records" }),
38872
+ (ns == null ? void 0 : ns.status) === 403 && /* @__PURE__ */ e(
38874
38873
  "button",
38875
38874
  {
38876
38875
  type: "button",
@@ -38883,7 +38882,7 @@ ${Te}`).then(() => {
38883
38882
  }
38884
38883
  )
38885
38884
  ] }),
38886
- es && Fa ? /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ e(
38885
+ ts && Fa ? /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ e(
38887
38886
  xN,
38888
38887
  {
38889
38888
  collection: t,
@@ -38895,12 +38894,12 @@ ${Te}`).then(() => {
38895
38894
  onOpen: (I) => Da(I)
38896
38895
  }
38897
38896
  ) }) : null,
38898
- /* @__PURE__ */ e("div", { className: es && Fa ? "hidden" : "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a("div", { className: "relative 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: [
38897
+ /* @__PURE__ */ e("div", { className: ts && Fa ? "hidden" : "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a("div", { className: "relative 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: [
38899
38898
  Zs && !Fs && /* @__PURE__ */ a(ot, { children: [
38900
38899
  /* @__PURE__ */ e("div", { className: "cbv-progress pointer-events-none absolute inset-x-0 top-0 z-[6] h-[3px] overflow-hidden" }),
38901
38900
  /* @__PURE__ */ e("div", { className: "cbv-overlay pointer-events-none absolute inset-0 z-[5] flex items-start justify-center bg-white/40 pt-24 dark:bg-slate-950/35", children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-[12px] font-medium text-slate-600 shadow-lg dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", children: [
38902
38901
  /* @__PURE__ */ e(Bm, { "aria-hidden": !0, className: "h-3.5 w-3.5 animate-spin text-[#00a5cc]" }),
38903
- Wr != null ? `Still working — ${Wr}s` : "Loading…"
38902
+ Qr != null ? `Still working — ${Qr}s` : "Loading…"
38904
38903
  ] }) })
38905
38904
  ] }),
38906
38905
  /* @__PURE__ */ e(
@@ -38961,20 +38960,20 @@ ${Te}`).then(() => {
38961
38960
  pe
38962
38961
  );
38963
38962
  }
38964
- const vt = Na.get(pe), Vt = Vr(pe) || !!(vt != null && vt.computed_formula && !vt.computed_store), un = !Vt && (N === pe || N === `-${pe}` || N.replace(/^-/, "").startsWith(`${pe}.`)), Qn = N.startsWith("-") && un, sa = Na.get(pe), Ot = Oa(pe);
38963
+ const vt = ka.get(pe), Qt = Jr(pe) || !!(vt != null && vt.computed_formula && !vt.computed_store), un = !Qt && (N === pe || N === `-${pe}` || N.replace(/^-/, "").startsWith(`${pe}.`)), Qn = N.startsWith("-") && un, sa = ka.get(pe), Ot = Oa(pe);
38965
38964
  return /* @__PURE__ */ a(
38966
38965
  "th",
38967
38966
  {
38968
38967
  ref: Te ? Xt(pe) : void 0,
38969
38968
  style: { ...ln(pe), ...mt(pe) },
38970
38969
  onClick: () => {
38971
- Vt || js(pe);
38970
+ Qt || js(pe);
38972
38971
  },
38973
- className: `${Se} relative ${Tr(pe) ? "text-right" : "text-left"} ${Vt ? "" : "cursor-pointer hover:text-slate-600"} ${tt}`,
38972
+ className: `${Se} relative ${Tr(pe) ? "text-right" : "text-left"} ${Qt ? "" : "cursor-pointer hover:text-slate-600"} ${tt}`,
38974
38973
  children: [
38975
38974
  Ot,
38976
38975
  (sa == null ? void 0 : sa.computed_formula) && /* @__PURE__ */ e("span", { title: `Computed: ${sa.computed_formula}`, className: "ml-1 text-violet-400", children: "ƒ" }),
38977
- !Vt && /* @__PURE__ */ e("span", { className: un ? "ml-1 text-[#00a5cc]" : "ml-1 text-slate-300", children: un ? Qn ? "▼" : "▲" : "⇅" }),
38976
+ !Qt && /* @__PURE__ */ e("span", { className: un ? "ml-1 text-[#00a5cc]" : "ml-1 text-slate-300", children: un ? Qn ? "▼" : "▲" : "⇅" }),
38978
38977
  Tn(pe),
38979
38978
  sn(pe)
38980
38979
  ]
@@ -39020,7 +39019,7 @@ ${Te}`).then(() => {
39020
39019
  className: "cbv-shimmer block h-3.5 rounded",
39021
39020
  style: { width: `${55 + pe * 17 % 40}%` }
39022
39021
  }
39023
- ) }) }, pe)) : _a.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: Jn.length + Bl, className: "py-16", children: (() => {
39022
+ ) }) }, pe)) : wa.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: Jn.length + Bl, className: "py-16", children: (() => {
39024
39023
  const I = C.length === 0 && Object.keys(be).length === 0 && !Object.values(xe).some((Te) => Te.length > 0) && !F, pe = oe == null ? void 0 : oe.empty_state;
39025
39024
  if (I && pe && (pe.title || pe.message)) {
39026
39025
  const Te = pe.cta_url ?? "", Se = Te.startsWith("/"), tt = /^https?:\/\//.test(Te);
@@ -39074,14 +39073,14 @@ ${Te}`).then(() => {
39074
39073
  },
39075
39074
  `__group__${I.gkey}`
39076
39075
  );
39077
- const pe = I.row, Te = pe.id, Se = kn.includes(Te), tt = (Qn = na == null ? void 0 : na.instances) == null ? void 0 : Qn[String(Te)], vt = el[String(Te)], Vt = !Se && vt ? yg(vt.color) : void 0, un = Se ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Vt ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
39076
+ const pe = I.row, Te = pe.id, Se = kn.includes(Te), tt = (Qn = na == null ? void 0 : na.instances) == null ? void 0 : Qn[String(Te)], vt = el[String(Te)], Qt = !Se && vt ? yg(vt.color) : void 0, un = Se ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Qt ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
39078
39077
  return /* @__PURE__ */ a(
39079
39078
  "tr",
39080
39079
  {
39081
39080
  onClick: () => Da(Te),
39082
39081
  onMouseEnter: () => nl(Te),
39083
39082
  title: vt ? `At risk — ${vt.rule}` : void 0,
39084
- className: `group h-8 cursor-pointer border-b border-slate-100 transition-colors duration-75 hover:bg-[#00ceff0a] dark:border-slate-800 dark:hover:bg-[#00ceff14] ${Se ? "bg-[#00ceff14]" : Vt ?? ""}`,
39083
+ className: `group h-8 cursor-pointer border-b border-slate-100 transition-colors duration-75 hover:bg-[#00ceff0a] dark:border-slate-800 dark:hover:bg-[#00ceff14] ${Se ? "bg-[#00ceff14]" : Qt ?? ""}`,
39085
39084
  children: [
39086
39085
  Tt && /* @__PURE__ */ e(
39087
39086
  "td",
@@ -39178,7 +39177,7 @@ ${Te}`).then(() => {
39178
39177
  },
39179
39178
  Ot
39180
39179
  );
39181
- const Bn = Vr(Ot) ? Ul(Te, Ot) : null, Yn = Vr(Ot) ? null : ks(Kn, t, Ot);
39180
+ const Bn = Jr(Ot) ? Ul(Te, Ot) : null, Yn = Jr(Ot) ? null : ks(Kn, t, Ot);
39182
39181
  return /* @__PURE__ */ e(
39183
39182
  "td",
39184
39183
  {
@@ -39193,9 +39192,9 @@ ${Te}`).then(() => {
39193
39192
  });
39194
39193
  },
39195
39194
  className: `whitespace-nowrap px-3 py-1.5 ${Tr(Ot) ? "text-right" : ""} ${Ze(Ot, "z-[1]", un)}`,
39196
- children: Vr(Ot) ? ui(Ot) === "nivaro_users" ? (() => {
39197
- var Jl, zr, pd;
39198
- const ja = Ot.includes(".") ? Ot : za[Ot], fi = ((pd = (zr = (Jl = Ta == null ? void 0 : Ta.rows) == null ? void 0 : Jl[String(Te)]) == null ? void 0 : zr[ja]) == null ? void 0 : pd.ids) ?? [], Vl = Za(Te, Ot) ?? "";
39195
+ children: Jr(Ot) ? ui(Ot) === "nivaro_users" ? (() => {
39196
+ var Jl, Ur, pd;
39197
+ const ja = Ot.includes(".") ? Ot : za[Ot], fi = ((pd = (Ur = (Jl = Ta == null ? void 0 : Ta.rows) == null ? void 0 : Jl[String(Te)]) == null ? void 0 : Ur[ja]) == null ? void 0 : pd.ids) ?? [], Vl = Za(Te, Ot) ?? "";
39199
39198
  if (fi.length === 0 || !Vl || Vl === "—")
39200
39199
  return /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-300", children: "—" });
39201
39200
  if (fi.length === 1)
@@ -39268,7 +39267,7 @@ ${Te}`).then(() => {
39268
39267
  {
39269
39268
  collection: t,
39270
39269
  field: Ot,
39271
- fieldType: (($l = Na.get(Ot)) == null ? void 0 : $l.type) ?? null,
39270
+ fieldType: (($l = ka.get(Ot)) == null ? void 0 : $l.type) ?? null,
39272
39271
  value: pe[Ot],
39273
39272
  relations: Kn
39274
39273
  }
@@ -39279,7 +39278,7 @@ ${Te}`).then(() => {
39279
39278
  {
39280
39279
  collection: t,
39281
39280
  field: Ot,
39282
- fieldType: ((hi = Na.get(Ot)) == null ? void 0 : hi.type) ?? null,
39281
+ fieldType: ((hi = ka.get(Ot)) == null ? void 0 : hi.type) ?? null,
39283
39282
  value: pe[Ot],
39284
39283
  relations: Kn
39285
39284
  }
@@ -39415,10 +39414,10 @@ ${Te}`).then(() => {
39415
39414
  }
39416
39415
  }
39417
39416
  ),
39418
- Tt && Nr && !ht && Ua > _a.length && kn.length < Math.min(Ua, ea) && /* @__PURE__ */ a("div", { className: "fixed bottom-16 left-1/2 z-40 -translate-x-1/2 rounded-full border border-slate-200 bg-white px-4 py-2 text-[12.5px] shadow-lg dark:border-border dark:bg-card", children: [
39417
+ Tt && Nr && !ht && Ua > wa.length && kn.length < Math.min(Ua, ea) && /* @__PURE__ */ a("div", { className: "fixed bottom-16 left-1/2 z-40 -translate-x-1/2 rounded-full border border-slate-200 bg-white px-4 py-2 text-[12.5px] shadow-lg dark:border-border dark:bg-card", children: [
39419
39418
  /* @__PURE__ */ a("span", { className: "text-slate-600 dark:text-muted-foreground", children: [
39420
39419
  "All ",
39421
- _a.length,
39420
+ wa.length,
39422
39421
  " rows on this page are selected."
39423
39422
  ] }),
39424
39423
  " ",
@@ -39654,7 +39653,7 @@ function Zo({ id: t, name: n, size: r = 32 }) {
39654
39653
  return /* @__PURE__ */ e(Ss, { userId: t, fallback: s, style: { width: r, height: r }, alt: n ?? "" });
39655
39654
  }
39656
39655
  function uS({ token: t, url: n, mine: r }) {
39657
- const s = Zr(), l = Nl(), i = je(), { data: d } = se({
39656
+ const s = es(), l = Nl(), i = je(), { data: d } = se({
39658
39657
  queryKey: ["nvr-chat-room-types"],
39659
39658
  queryFn: async () => ((await i.request(
39660
39659
  Z(
@@ -39732,7 +39731,7 @@ function uS({ token: t, url: n, mine: r }) {
39732
39731
  );
39733
39732
  }
39734
39733
  function mS({ text: t, mine: n }) {
39735
- const r = Zr(), s = Nl(), l = ve(() => FN(t, r.entityPattern), [t, r.entityPattern]);
39734
+ const r = es(), s = Nl(), l = ve(() => FN(t, r.entityPattern), [t, r.entityPattern]);
39736
39735
  return /* @__PURE__ */ e(ot, { children: l.map((i, d) => {
39737
39736
  if (i.entity) {
39738
39737
  const o = r.entityUrl(i.entity);
@@ -39842,7 +39841,7 @@ function hS({ botName: t }) {
39842
39841
  ] });
39843
39842
  }
39844
39843
  function fS({ room: t }) {
39845
- const n = Zr(), r = Nl(), s = je(), l = t.indexOf(":"), i = l > 0 ? t.slice(0, l) : null, d = l > 0 ? t.slice(l + 1) : null, o = !!i && !!d && t !== n.globalRoom && i !== "dm" && i !== "ch", { data: u } = se({
39844
+ const n = es(), r = Nl(), s = je(), l = t.indexOf(":"), i = l > 0 ? t.slice(0, l) : null, d = l > 0 ? t.slice(l + 1) : null, o = !!i && !!d && t !== n.globalRoom && i !== "dm" && i !== "ch", { data: u } = se({
39846
39845
  queryKey: ["nvr-chat-room-card", t],
39847
39846
  queryFn: async () => {
39848
39847
  var x, b, F, C;
@@ -39922,7 +39921,7 @@ function xS({
39922
39921
  initialUnread: i
39923
39922
  }) {
39924
39923
  var zt, gn;
39925
- const d = Zr(), o = Nl(), u = je(), c = d.me, { messages: m, loading: p } = vN(t), h = kN(t), f = CN(), y = LN(t), v = AN(t.startsWith("dm:") ? t : null), g = $N(t), x = ON(t), b = KN(t), F = IN(t), C = t.startsWith("ch:"), { data: L = [] } = se({
39924
+ const d = es(), o = Nl(), u = je(), c = d.me, { messages: m, loading: p } = vN(t), h = kN(t), f = CN(), y = LN(t), v = AN(t.startsWith("dm:") ? t : null), g = $N(t), x = ON(t), b = KN(t), F = IN(t), C = t.startsWith("ch:"), { data: L = [] } = se({
39926
39925
  queryKey: ["chat-read-marks", t],
39927
39926
  queryFn: () => u.request(
39928
39927
  Z(`/chat/rooms/${encodeURIComponent(t)}/read-marks`)
@@ -40277,7 +40276,7 @@ function xS({
40277
40276
  ] })
40278
40277
  ] }) }) : nn.map((we, wt) => {
40279
40278
  var wn, Zn;
40280
- const Ct = ((wn = we.sender) == null ? void 0 : wn.toLowerCase()) === Lt, an = nn[wt - 1], rn = wt === 0 || an && new Date(an.date_created).toDateString() !== new Date(we.date_created).toDateString(), Yt = Ct && wt === kn, Ve = Yt && $n > 0 && new Date(we.date_created).getTime() <= $n, Kt = !!we.deleted_at, Ht = Ct && !Kt && Date.now() - new Date(we.date_created).getTime() < 15 * 6e4, Wt = !Kt && (Ct || A), fn = ce === we.id, Qt = !Jt && _e.current > 0 && wt === Math.max(0, nn.length - _e.current), Nn = /* @__PURE__ */ new Map();
40279
+ const Ct = ((wn = we.sender) == null ? void 0 : wn.toLowerCase()) === Lt, an = nn[wt - 1], rn = wt === 0 || an && new Date(an.date_created).toDateString() !== new Date(we.date_created).toDateString(), Yt = Ct && wt === kn, Ve = Yt && $n > 0 && new Date(we.date_created).getTime() <= $n, Kt = !!we.deleted_at, Ht = Ct && !Kt && Date.now() - new Date(we.date_created).getTime() < 15 * 6e4, Wt = !Kt && (Ct || A), fn = ce === we.id, Vt = !Jt && _e.current > 0 && wt === Math.max(0, nn.length - _e.current), Nn = /* @__PURE__ */ new Map();
40281
40280
  for (const Rn of we.reactions ?? []) {
40282
40281
  const oe = Nn.get(Rn.emoji) ?? { count: 0, mine: !1, names: [] };
40283
40282
  oe.count++, ((Zn = Rn.user) == null ? void 0 : Zn.toLowerCase()) === Lt && (oe.mine = !0), Rn.user_name && oe.names.push(Rn.user_name), Nn.set(Rn.emoji, oe);
@@ -40288,7 +40287,7 @@ function xS({
40288
40287
  /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-slate-400", children: pS(we.date_created) }),
40289
40288
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" })
40290
40289
  ] }),
40291
- Qt && /* @__PURE__ */ a("div", { ref: bn, className: "my-2 flex items-center gap-2", "data-chat-unread-divider": !0, children: [
40290
+ Vt && /* @__PURE__ */ a("div", { ref: bn, className: "my-2 flex items-center gap-2", "data-chat-unread-divider": !0, children: [
40292
40291
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" }),
40293
40292
  /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-red-400", children: "New messages" }),
40294
40293
  _e.current > 20 && /* @__PURE__ */ e(
@@ -40303,7 +40302,7 @@ function xS({
40303
40302
  ),
40304
40303
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" })
40305
40304
  ] }),
40306
- Qt && T && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-[#00ceff40] bg-[#00ceff0d] px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: T }),
40305
+ Vt && T && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-[#00ceff40] bg-[#00ceff0d] px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: T }),
40307
40306
  /* @__PURE__ */ a("div", { className: H("group/msg flex gap-2", Ct && "flex-row-reverse"), children: [
40308
40307
  !Ct && /* @__PURE__ */ e(Zo, { id: we.sender, name: we.sender_name, size: 26 }),
40309
40308
  /* @__PURE__ */ a("div", { className: H("relative max-w-[78%]", Ct && "text-right"), children: [
@@ -40693,7 +40692,7 @@ function gS({
40693
40692
  label: n,
40694
40693
  onBack: r
40695
40694
  }) {
40696
- const s = Nl(), l = Zr(), { isAdmin: i } = _s(), d = Cg(), { members: o, loading: u } = wN(t.id), { update: c, addMember: m, removeMember: p } = _N(t.id), [h, f] = S(n), [y, v] = S(t.topic ?? ""), [g, x] = S(t.visibility), [b, F] = S(t.role ?? ""), [C, L] = S(""), N = $y(C, 250), { users: _ } = $g(N, g === "private"), w = i || !!l.me && String(t.created_by ?? "") === String(l.me.id), k = new Set(o.map(($) => String($.user).toUpperCase())), T = h !== n || y !== (t.topic ?? "") || g !== t.visibility || g === "role" && b !== (t.role ?? "");
40695
+ const s = Nl(), l = es(), { isAdmin: i } = _s(), d = Cg(), { members: o, loading: u } = wN(t.id), { update: c, addMember: m, removeMember: p } = _N(t.id), [h, f] = S(n), [y, v] = S(t.topic ?? ""), [g, x] = S(t.visibility), [b, F] = S(t.role ?? ""), [C, L] = S(""), N = $y(C, 250), { users: _ } = $g(N, g === "private"), w = i || !!l.me && String(t.created_by ?? "") === String(l.me.id), k = new Set(o.map(($) => String($.user).toUpperCase())), T = h !== n || y !== (t.topic ?? "") || g !== t.visibility || g === "role" && b !== (t.role ?? "");
40697
40696
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-settings": !0, children: [
40698
40697
  /* @__PURE__ */ a("div", { className: H("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", s.divider), children: [
40699
40698
  /* @__PURE__ */ e(
@@ -40872,7 +40871,7 @@ function yS({
40872
40871
  onOpen: n,
40873
40872
  onNewGroup: r
40874
40873
  }) {
40875
- const s = Nl(), l = Zr(), { setMuted: i, leave: d } = eh(), o = qg(), [u, c] = S(""), m = $y(u.trim(), 250), { hits: p, loading: h } = MN(m), f = ve(() => new Map(t.map((g) => [g.room, g])), [t]), y = m ? t.filter((g) => g.label.toLowerCase().includes(m.toLowerCase())) : t, v = (g) => {
40874
+ const s = Nl(), l = es(), { setMuted: i, leave: d } = eh(), o = qg(), [u, c] = S(""), m = $y(u.trim(), 250), { hits: p, loading: h } = MN(m), f = ve(() => new Map(t.map((g) => [g.room, g])), [t]), y = m ? t.filter((g) => g.label.toLowerCase().includes(m.toLowerCase())) : t, v = (g) => {
40876
40875
  var x;
40877
40876
  return g.kind === "channel" && ((x = g.channel) == null ? void 0 : x.is_direct);
40878
40877
  };
@@ -41422,7 +41421,7 @@ function nF({
41422
41421
  requestedRoom: l
41423
41422
  }) {
41424
41423
  var O;
41425
- const i = Zr(), d = Nl(), o = i.me, [u, c] = S("online"), [m, p] = S(null), [h, f] = S(!1), [y, v] = S(!1), { rooms: g, totalUnread: x } = Sg(), b = (q, P, W) => {
41424
+ const i = es(), d = Nl(), o = i.me, [u, c] = S("online"), [m, p] = S(null), [h, f] = S(!1), [y, v] = S(!1), { rooms: g, totalUnread: x } = Sg(), b = (q, P, W) => {
41426
41425
  var R, A;
41427
41426
  if (!P) return [{ key: "all", label: null, users: q }];
41428
41427
  const M = /* @__PURE__ */ new Map();
@@ -41811,7 +41810,7 @@ function FS({
41811
41810
  ]
41812
41811
  }
41813
41812
  ) }),
41814
- /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { shouldFilter: !y, children: [
41813
+ /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { shouldFilter: !y, children: [
41815
41814
  /* @__PURE__ */ e(
41816
41815
  ms,
41817
41816
  {
@@ -41821,7 +41820,7 @@ function FS({
41821
41820
  onValueChange: d
41822
41821
  }
41823
41822
  ),
41824
- /* @__PURE__ */ a(Xr, { children: [
41823
+ /* @__PURE__ */ a(Zr, { children: [
41825
41824
  /* @__PURE__ */ e(ps, { className: "py-3 text-center text-[12px] text-slate-400", children: c ? "Searching…" : "No results" }),
41826
41825
  g.map((F) => {
41827
41826
  const C = v.includes(F.value);
@@ -42631,9 +42630,9 @@ function Yc({
42631
42630
  ]
42632
42631
  }
42633
42632
  ) }),
42634
- /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
42633
+ /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
42635
42634
  /* @__PURE__ */ e(ms, { placeholder: "Search…", className: "h-8 text-[12px]" }),
42636
- /* @__PURE__ */ a(Xr, { children: [
42635
+ /* @__PURE__ */ a(Zr, { children: [
42637
42636
  /* @__PURE__ */ e(ps, { children: "Nothing matches." }),
42638
42637
  r.map((u) => /* @__PURE__ */ a(
42639
42638
  sr,
@@ -43874,9 +43873,9 @@ function rr({
43874
43873
  ]
43875
43874
  }
43876
43875
  ) }),
43877
- /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
43876
+ /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
43878
43877
  /* @__PURE__ */ e(ms, { placeholder: "Search…", className: "h-8 text-[12px]" }),
43879
- /* @__PURE__ */ a(Xr, { className: "max-h-[240px]", children: [
43878
+ /* @__PURE__ */ a(Zr, { className: "max-h-[240px]", children: [
43880
43879
  /* @__PURE__ */ e(ps, { className: "py-4 text-center text-[11.5px] text-slate-400", children: "No match." }),
43881
43880
  /* @__PURE__ */ a(Mi, { children: [
43882
43881
  i && t && /* @__PURE__ */ a(
@@ -44074,7 +44073,7 @@ function zS({
44074
44073
  /* @__PURE__ */ e("td", { className: "px-2.5 py-1 text-right", children: /* @__PURE__ */ a("label", { className: "inline-flex items-center gap-1.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
44075
44074
  "Lookup",
44076
44075
  /* @__PURE__ */ e(
44077
- Gr,
44076
+ Yr,
44078
44077
  {
44079
44078
  checked: C.lookupOn,
44080
44079
  onCheckedChange: (w) => N({ lookupOn: w }),
@@ -44176,7 +44175,7 @@ function zS({
44176
44175
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
44177
44176
  /* @__PURE__ */ e(pl, { sub: "Combines two numeric file columns into a first-of-month date (2026 + 7 → 2026-07-01).", children: "Calendar month from year + month columns" }),
44178
44177
  /* @__PURE__ */ e(
44179
- Gr,
44178
+ Yr,
44180
44179
  {
44181
44180
  checked: o.monthOn,
44182
44181
  onCheckedChange: (C) => c({ ...o, monthOn: C })
@@ -44517,7 +44516,7 @@ function QS({
44517
44516
  }
44518
44517
  ) }),
44519
44518
  /* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(
44520
- Gr,
44519
+ Yr,
44521
44520
  {
44522
44521
  checked: m.required,
44523
44522
  onCheckedChange: (f) => h({ required: f }),
@@ -45160,7 +45159,7 @@ function ZS({
45160
45159
  ] }),
45161
45160
  /* @__PURE__ */ a("label", { className: "flex shrink-0 items-center gap-2 text-[12px] text-slate-600 dark:text-muted-foreground", children: [
45162
45161
  /* @__PURE__ */ e(
45163
- Gr,
45162
+ Yr,
45164
45163
  {
45165
45164
  checked: c.is_active,
45166
45165
  onCheckedChange: (w) => m((k) => ({ ...k, is_active: w }))
@@ -48879,7 +48878,7 @@ function Uy({
48879
48878
  Ae(() => {
48880
48879
  p.current !== m && (p.current = m, o(n));
48881
48880
  }, [m, n]);
48882
- const h = wa({
48881
+ const h = Na({
48883
48882
  queries: i.filter((g) => (d[g.name] ?? []).length > 0).map((g) => ({
48884
48883
  queryKey: ["team-scope-labels", g.target_collection, (d[g.name] ?? []).join(",")],
48885
48884
  queryFn: () => s.request(
@@ -49166,7 +49165,7 @@ function A4({ templateId: t, states: n, bindings: r }) {
49166
49165
  }
49167
49166
  const ht = j0(y, h, $e);
49168
49167
  return ht != null && ht.many_collection ? ht.many_collection : null;
49169
- }), D = wa({
49168
+ }), D = Na({
49170
49169
  queries: $.map(($e, Je) => {
49171
49170
  const et = j[Je];
49172
49171
  return !et || $e.midFields.length === 0 ? {
@@ -49199,7 +49198,7 @@ function A4({ templateId: t, states: n, bindings: r }) {
49199
49198
  }), [q, P] = S({}), [W, M] = S({}), R = ($e) => ($e.cascade ?? []).map((Je) => {
49200
49199
  const et = d.find((ft) => ft.field === Je.parent_field);
49201
49200
  return et ? `${Je.parent_field}=${q[et.id] ?? ""}` : "";
49202
- }).join("&"), A = wa({
49201
+ }).join("&"), A = Na({
49203
49202
  queries: d.map(($e, Je) => {
49204
49203
  const et = O[Je], ft = W[$e.id] ?? "";
49205
49204
  if (et != null && et.relatedCollection) {
@@ -49244,7 +49243,7 @@ function A4({ templateId: t, states: n, bindings: r }) {
49244
49243
  enabled: !1
49245
49244
  };
49246
49245
  })
49247
- }), z = wa({
49246
+ }), z = Na({
49248
49247
  queries: d.map(($e, Je) => {
49249
49248
  const et = O[Je];
49250
49249
  return !(et != null && et.relatedCollection) || et.subField ? {
@@ -51770,9 +51769,9 @@ function Wx({
51770
51769
  ]
51771
51770
  }
51772
51771
  ) }),
51773
- /* @__PURE__ */ e(ra, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
51772
+ /* @__PURE__ */ e(ra, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
51774
51773
  /* @__PURE__ */ e(ms, { placeholder: "Search users…", className: "h-8 text-[12px]" }),
51775
- /* @__PURE__ */ a(Xr, { children: [
51774
+ /* @__PURE__ */ a(Zr, { children: [
51776
51775
  /* @__PURE__ */ e(ps, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No users found" }),
51777
51776
  /* @__PURE__ */ e(Mi, { children: r.map((o) => /* @__PURE__ */ a(
51778
51777
  sr,
@@ -53575,14 +53574,14 @@ function Rp({
53575
53574
  /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: "Automatic" }),
53576
53575
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Fired by the engine when the conditions above match — never shown to users. Evaluated after record writes, after manual transitions, and hourly." })
53577
53576
  ] }),
53578
- /* @__PURE__ */ e(Gr, { checked: o.auto_trigger, onCheckedChange: (f) => c("auto_trigger", f) })
53577
+ /* @__PURE__ */ e(Yr, { checked: o.auto_trigger, onCheckedChange: (f) => c("auto_trigger", f) })
53579
53578
  ] }),
53580
53579
  /* @__PURE__ */ a("label", { className: "flex items-center justify-between gap-3 rounded-md border border-slate-200 px-3 py-2 dark:border-border", children: [
53581
53580
  /* @__PURE__ */ a("div", { children: [
53582
53581
  /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: "Return to the record's previous state" }),
53583
53582
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Uncancel and friends: the target becomes whatever state the record was in before it entered this one, mined from its history. The state picked above is only the fallback for records with no usable history." })
53584
53583
  ] }),
53585
- /* @__PURE__ */ e(Gr, { checked: o.to_previous, onCheckedChange: (f) => c("to_previous", f) })
53584
+ /* @__PURE__ */ e(Yr, { checked: o.to_previous, onCheckedChange: (f) => c("to_previous", f) })
53586
53585
  ] }),
53587
53586
  /* @__PURE__ */ a("div", { className: "flex gap-2 justify-end", children: [
53588
53587
  /* @__PURE__ */ e(De, { type: "button", variant: "outline", size: "sm", onClick: i, children: "Cancel" }),
@@ -53696,9 +53695,9 @@ function xC({
53696
53695
  /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2 flex-wrap", children: [
53697
53696
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: t.label }),
53698
53697
  /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-400", children: t.key }),
53699
- t.is_initial && /* @__PURE__ */ e(Hr, { variant: "secondary", className: "text-[10px] h-4 px-1", children: "initial" }),
53700
- t.is_terminal && /* @__PURE__ */ e(Hr, { variant: "secondary", className: "text-[10px] h-4 px-1", children: "terminal" }),
53701
- t.lock_record && /* @__PURE__ */ e(Hr, { variant: "outline", className: "text-[10px] h-4 px-1", children: "locked" })
53698
+ t.is_initial && /* @__PURE__ */ e(Gr, { variant: "secondary", className: "text-[10px] h-4 px-1", children: "initial" }),
53699
+ t.is_terminal && /* @__PURE__ */ e(Gr, { variant: "secondary", className: "text-[10px] h-4 px-1", children: "terminal" }),
53700
+ t.lock_record && /* @__PURE__ */ e(Gr, { variant: "outline", className: "text-[10px] h-4 px-1", children: "locked" })
53702
53701
  ] }) }),
53703
53702
  /* @__PURE__ */ e(
53704
53703
  fC,
@@ -53810,7 +53809,7 @@ function bC({
53810
53809
  ),
53811
53810
  /* @__PURE__ */ a("label", { className: "flex shrink-0 items-center gap-1 text-[11px] text-slate-500", children: [
53812
53811
  /* @__PURE__ */ e(
53813
- Gr,
53812
+ Yr,
53814
53813
  {
53815
53814
  checked: !!c.via_many,
53816
53815
  onCheckedChange: (p) => o(d.map((h, f) => f === m ? { ...h, via_many: p } : h))
@@ -53888,16 +53887,16 @@ function gC({
53888
53887
  /* @__PURE__ */ a("div", { className: "flex-1 min-w-0 flex items-center gap-3 flex-wrap", children: [
53889
53888
  /* @__PURE__ */ e("span", { className: "font-mono text-[12px] text-slate-600 shrink-0", children: t.field }),
53890
53889
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: t.label }),
53891
- t.is_row_axis && /* @__PURE__ */ e(Hr, { variant: "secondary", className: "text-[10px] h-4 px-1.5 shrink-0", children: "row axis" }),
53890
+ t.is_row_axis && /* @__PURE__ */ e(Gr, { variant: "secondary", className: "text-[10px] h-4 px-1.5 shrink-0", children: "row axis" }),
53892
53891
  t.required && /* @__PURE__ */ e(
53893
- Hr,
53892
+ Gr,
53894
53893
  {
53895
53894
  variant: "secondary",
53896
53895
  className: "text-[10px] h-4 px-1.5 shrink-0 bg-amber-50 text-amber-600 border-amber-200",
53897
53896
  children: "required"
53898
53897
  }
53899
53898
  ),
53900
- (t.cascade ?? []).length > 0 && /* @__PURE__ */ a(Hr, { variant: "secondary", className: "text-[10px] h-4 px-1.5 shrink-0", children: [
53899
+ (t.cascade ?? []).length > 0 && /* @__PURE__ */ a(Gr, { variant: "secondary", className: "text-[10px] h-4 px-1.5 shrink-0", children: [
53901
53900
  "cascades (",
53902
53901
  (t.cascade ?? []).length,
53903
53902
  ")"
@@ -55557,7 +55556,7 @@ function CC({ bindings: t }) {
55557
55556
  }
55558
55557
  ),
55559
55558
  /* @__PURE__ */ e("p", { className: "truncate text-[12px] font-semibold text-slate-800", children: m.label }),
55560
- m.is_current && /* @__PURE__ */ e(Hr, { className: "ml-auto h-4 shrink-0 px-1.5 text-[9px]", children: "current" })
55559
+ m.is_current && /* @__PURE__ */ e(Gr, { className: "ml-auto h-4 shrink-0 px-1.5 text-[9px]", children: "current" })
55561
55560
  ] }),
55562
55561
  /* @__PURE__ */ e("p", { className: "mt-1.5 text-[11px] text-slate-500", children: m.owners.length === 0 ? "No owners" : m.owners.map(
55563
55562
  (p) => [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email
@@ -55598,7 +55597,7 @@ function CC({ bindings: t }) {
55598
55597
  }
55599
55598
  ) }),
55600
55599
  /* @__PURE__ */ e("td", { className: "py-1.5", children: m.required_roles.length === 0 ? "—" : m.role_pass ? "✓" : "✗ restricted" }),
55601
- /* @__PURE__ */ e("td", { className: "py-1.5", children: m.available ? /* @__PURE__ */ e(Hr, { className: "h-4 bg-green-100 px-1.5 text-[9px] text-green-700", children: "yes" }) : /* @__PURE__ */ e("span", { className: "text-[11px]", children: "no" }) })
55600
+ /* @__PURE__ */ e("td", { className: "py-1.5", children: m.available ? /* @__PURE__ */ e(Gr, { className: "h-4 bg-green-100 px-1.5 text-[9px] text-green-700", children: "yes" }) : /* @__PURE__ */ e("span", { className: "text-[11px]", children: "no" }) })
55602
55601
  ] }, m.id)) })
55603
55602
  ] })
55604
55603
  ] })
@@ -60621,9 +60620,9 @@ function k$({
60621
60620
  ]
60622
60621
  }
60623
60622
  ) }),
60624
- /* @__PURE__ */ e(ra, { className: "w-[200px] p-0", align: "center", side: "top", children: /* @__PURE__ */ a(Yr, { children: [
60623
+ /* @__PURE__ */ e(ra, { className: "w-[200px] p-0", align: "center", side: "top", children: /* @__PURE__ */ a(Xr, { children: [
60625
60624
  /* @__PURE__ */ e(ms, { placeholder: "Target state…", className: "h-8 text-[12px]" }),
60626
- /* @__PURE__ */ a(Xr, { children: [
60625
+ /* @__PURE__ */ a(Zr, { children: [
60627
60626
  /* @__PURE__ */ e(ps, { children: "No state found." }),
60628
60627
  n.map((m) => /* @__PURE__ */ e(
60629
60628
  sr,
@@ -60727,7 +60726,7 @@ function _$({
60727
60726
  /* @__PURE__ */ a("div", { className: "min-w-0", children: [
60728
60727
  /* @__PURE__ */ e(si, { className: "truncate text-[15px] font-semibold", children: t.label }),
60729
60728
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex items-center gap-2", children: [
60730
- /* @__PURE__ */ e(Hr, { variant: "outline", children: u ? u(t.collection) : t.collection }),
60729
+ /* @__PURE__ */ e(Gr, { variant: "outline", children: u ? u(t.collection) : t.collection }),
60731
60730
  t.state && /* @__PURE__ */ e(
60732
60731
  "span",
60733
60732
  {
@@ -61293,7 +61292,7 @@ function D$({
61293
61292
  ] });
61294
61293
  }
61295
61294
  function uF({ queueId: t, realtime: n, renderError: r }) {
61296
- var er, Us, Ja, jr, ss, tl, xr;
61295
+ var er, Us, Ja, jr, ls, tl, xr;
61297
61296
  const s = jt(), l = je(), { userId: i } = _s(), d = Ps(), { navigate: o } = Ds(), [u, c] = S("all"), [m, p] = S(1), [h, f] = S(() => {
61298
61297
  try {
61299
61298
  return localStorage.getItem("nvr_table_density") === "comfortable" ? "comfortable" : "compact";
@@ -61604,7 +61603,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61604
61603
  if (qe.length < 3 || !rn) return null;
61605
61604
  const pt = qe.map((Hn) => u === "mine" ? Hn.owned ?? Hn.total : Hn.total), Dt = pt.slice(1).map((Hn, ca) => Hn - pt[ca]), cn = Dt.reduce((Hn, ca) => Hn + ca, 0) / Dt.length, dn = rn.total;
61606
61605
  return Math.abs(cn) < 0.05 ? { dir: "flat", pace: cn, days: null } : cn < 0 ? { dir: "down", pace: cn, days: Math.max(1, Math.ceil(dn / -cn)) } : { dir: "up", pace: cn, days: null };
61607
- }, [Kt == null ? void 0 : Kt.data, Ht == null ? void 0 : Ht.data, u, rn]), Qt = ve(
61606
+ }, [Kt == null ? void 0 : Kt.data, Ht == null ? void 0 : Ht.data, u, rn]), Vt = ve(
61608
61607
  () => [
61609
61608
  ...new Set(
61610
61609
  ((q == null ? void 0 : q.sources) ?? []).filter((U) => U.type === "collection" && U.collection).map((U) => U.collection)
@@ -61615,8 +61614,8 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61615
61614
  queryKey: ["collections"],
61616
61615
  queryFn: () => l.request(Z("/collections")).then((U) => U.data),
61617
61616
  staleTime: 300 * 1e3
61618
- }), wn = wa({
61619
- queries: Qt.map((U) => ({
61617
+ }), wn = Na({
61618
+ queries: Vt.map((U) => ({
61620
61619
  queryKey: ["queue-collection-states", U],
61621
61620
  queryFn: () => l.request(
61622
61621
  Z(`/queues/collection-states/${U}`)
@@ -61652,7 +61651,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61652
61651
  return pt.has(U) ? pt.delete(U) : pt.add(U), pt;
61653
61652
  });
61654
61653
  }
61655
- const ut = ve(() => Tt ? Tt.filter((U) => !N.has(U.key)).flatMap((U) => U.rows) : an, [Tt, an, N]), yn = (U) => `${U.collection}:${U.item_id}`, [On, En] = S(null), [pn, Wn] = S(!1), [Rt, xa] = S(null), Na = (U) => d.open({
61654
+ const ut = ve(() => Tt ? Tt.filter((U) => !N.has(U.key)).flatMap((U) => U.rows) : an, [Tt, an, N]), yn = (U) => `${U.collection}:${U.item_id}`, [On, En] = S(null), [pn, Wn] = S(!1), [Rt, xa] = S(null), ka = (U) => d.open({
61656
61655
  collection: U.collection,
61657
61656
  itemId: U.item_id,
61658
61657
  layoutSlug: (xe == null ? void 0 : xe.item_layout) ?? null
@@ -61670,7 +61669,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61670
61669
  xa(yn(U));
61671
61670
  const qe = (xe == null ? void 0 : xe.row_click) ?? "preview";
61672
61671
  if (qe === "full") {
61673
- Na(U);
61672
+ ka(U);
61674
61673
  return;
61675
61674
  }
61676
61675
  if (qe === "layout") {
@@ -61698,7 +61697,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61698
61697
  return;
61699
61698
  }
61700
61699
  if (xa(yn(pt)), te && !pt.claimed_by && kn.mutate(pt), (xe == null ? void 0 : xe.row_click) === "full") {
61701
- Na(pt);
61700
+ ka(pt);
61702
61701
  return;
61703
61702
  }
61704
61703
  Wn(!0), En(pt);
@@ -61725,7 +61724,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61725
61724
  qe.preventDefault();
61726
61725
  const dn = ut[Dt];
61727
61726
  ((cn = dn.claimed_by) == null ? void 0 : cn.id) === i ? $n.mutate(dn) : kn.mutate(dn);
61728
- } else qe.key === "o" && Dt >= 0 && (qe.preventDefault(), Na(ut[Dt]));
61727
+ } else qe.key === "o" && Dt >= 0 && (qe.preventDefault(), ka(ut[Dt]));
61729
61728
  }
61730
61729
  return window.addEventListener("keydown", U), () => window.removeEventListener("keydown", U);
61731
61730
  }, [y, ut, Rt, On, i, kn, $n, te]);
@@ -61752,7 +61751,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61752
61751
  const U = zt.data.default_view_id, qe = U != null ? oa.data.find((Dt) => Dt.id === U) : void 0, pt = oa.data.find((Dt) => Dt.is_default);
61753
61752
  qe ? Xs(qe) : pt ? Xs(pt) : (v(q.display_config.default_view), c(q.display_config.default_scope)), ce(!0);
61754
61753
  }, [q, zt, oa, J]);
61755
- const { isAdmin: da } = _s(), Fa = da || (q == null ? void 0 : q.owner) != null && q.owner === i, es = Ue({
61754
+ const { isAdmin: da } = _s(), Fa = da || (q == null ? void 0 : q.owner) != null && q.owner === i, ts = Ue({
61756
61755
  mutationFn: ({ viewId: U, on: qe }) => l.request(Fn(`/queues/views/${U}`, { is_default: qe })),
61757
61756
  onSuccess: () => {
61758
61757
  s.invalidateQueries({ queryKey: ["queue-views", t] }), Le.success("Queue default view updated");
@@ -61821,18 +61820,18 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61821
61820
  const Dt = await Promise.allSettled(pt.map(qe)), cn = Dt.filter((Hn) => Hn.status === "fulfilled").length, dn = Dt.length - cn;
61822
61821
  Zs(!1), Qa([]), s.invalidateQueries({ queryKey: ["queue-items", t] }), dn ? Le.warning(`${U}: ${cn} succeeded, ${dn} failed`) : Le.success(`${U}: ${cn} succeeded`);
61823
61822
  }
61824
- const ts = (U) => {
61823
+ const ns = (U) => {
61825
61824
  var qe;
61826
61825
  for (const pt of (q == null ? void 0 : q.sources) ?? []) {
61827
61826
  const Dt = (qe = pt.column_formats) == null ? void 0 : qe[U];
61828
61827
  if (Dt) return Dt;
61829
61828
  }
61830
61829
  return null;
61831
- }, _a = (U) => {
61830
+ }, wa = (U) => {
61832
61831
  if (C === "state") return U === "No state" ? U : at(U);
61833
61832
  if (C === "collection") return kt(U);
61834
61833
  if (C != null && C.startsWith("extra.") && U !== "—") {
61835
- const qe = ts(C.slice(6));
61834
+ const qe = ns(C.slice(6));
61836
61835
  if (qe) return ao(U, qe);
61837
61836
  }
61838
61837
  return U;
@@ -61840,7 +61839,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61840
61839
  key: U.key,
61841
61840
  rows: U.rows,
61842
61841
  header: /* @__PURE__ */ a(ot, { children: [
61843
- /* @__PURE__ */ e("span", { children: _a(U.key) }),
61842
+ /* @__PURE__ */ e("span", { children: wa(U.key) }),
61844
61843
  /* @__PURE__ */ a("span", { className: "font-normal text-slate-400", children: [
61845
61844
  "(",
61846
61845
  Vn(U.rows.length),
@@ -61861,7 +61860,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61861
61860
  key: "collection",
61862
61861
  header: Be("collection", "Collection"),
61863
61862
  sortable: !0,
61864
- render: (U) => /* @__PURE__ */ e(Hr, { variant: "outline", children: kt(U.collection) })
61863
+ render: (U) => /* @__PURE__ */ e(Gr, { variant: "outline", children: kt(U.collection) })
61865
61864
  }
61866
61865
  ] : [],
61867
61866
  {
@@ -61945,7 +61944,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61945
61944
  sortable: !0,
61946
61945
  render: (U) => U.at_risk ? /* @__PURE__ */ e("span", { className: hN(U.at_risk_color ?? "red"), children: "⚑ At risk" }) : U.predicted_risk ? /* @__PURE__ */ e("span", { className: "text-amber-500", title: U.predicted_note ?? void 0, children: "⚑ Predicted" }) : null
61947
61946
  }
61948
- ], Wr = {
61947
+ ], Qr = {
61949
61948
  key: "claim",
61950
61949
  header: "",
61951
61950
  render: (U) => U.claimed_by ? /* @__PURE__ */ e(
@@ -61969,7 +61968,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61969
61968
  children: "Claim"
61970
61969
  }
61971
61970
  )
61972
- }, ns = (q == null ? void 0 : q.available_extra_fields) ?? [], Mr = cm("drill.queue"), Va = Mr.value, Ts = (U) => Mr.push([U]), pr = (U) => {
61971
+ }, as = (q == null ? void 0 : q.available_extra_fields) ?? [], Mr = cm("drill.queue"), Va = Mr.value, Ts = (U) => Mr.push([U]), pr = (U) => {
61973
61972
  var qe;
61974
61973
  for (const pt of (q == null ? void 0 : q.sources) ?? []) {
61975
61974
  const Dt = (qe = pt.drilldown) == null ? void 0 : qe[U];
@@ -61987,9 +61986,9 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
61987
61986
  for (const [pt, Dt] of Object.entries(qe.column_formats ?? {}))
61988
61987
  pt in U || (U[pt] = Dt);
61989
61988
  return U;
61990
- }, [q == null ? void 0 : q.sources]), Qr = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, el = /^\d{4}-\d{2}-\d{2}T\d{2}:/;
61991
- function ga(U) {
61992
- if (Qr.test(U)) return { text: U.split("@")[0], title: U };
61989
+ }, [q == null ? void 0 : q.sources]), Vr = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, el = /^\d{4}-\d{2}-\d{2}T\d{2}:/;
61990
+ function _a(U) {
61991
+ if (Vr.test(U)) return { text: U.split("@")[0], title: U };
61993
61992
  if (el.test(U)) {
61994
61993
  const qe = new Date(U);
61995
61994
  if (!Number.isNaN(qe.getTime()))
@@ -62000,7 +61999,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62000
61999
  }
62001
62000
  return { text: U, title: U };
62002
62001
  }
62003
- const na = ns.map((U) => ({
62002
+ const na = as.map((U) => ({
62004
62003
  key: `extra.${U}`,
62005
62004
  header: Be(`extra.${U}`, zd(U)),
62006
62005
  sortable: !0,
@@ -62008,13 +62007,13 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62008
62007
  var Ir, br;
62009
62008
  const pt = (Ir = qe.extra) == null ? void 0 : Ir[U];
62010
62009
  if (pt == null || pt === "") return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
62011
- const Dt = ts(U), cn = Dt ? ao(String(pt), Dt) : String(pt), { text: dn, title: Hn } = ga(cn), ca = ((q == null ? void 0 : q.extra_field_meta) ?? []).find((ls) => ls.path === U), Kr = ((br = qe.extra_ids) == null ? void 0 : br[U]) ?? [], Ma = pr(U);
62010
+ const Dt = ns(U), cn = Dt ? ao(String(pt), Dt) : String(pt), { text: dn, title: Hn } = _a(cn), ca = ((q == null ? void 0 : q.extra_field_meta) ?? []).find((is) => is.path === U), Kr = ((br = qe.extra_ids) == null ? void 0 : br[U]) ?? [], Ma = pr(U);
62012
62011
  return (ca == null ? void 0 : ca.kind) === "relation" && ca.target_collection && Kr.length > 0 && Ma.enabled && !ca.aggregate ? /* @__PURE__ */ e(
62013
62012
  "button",
62014
62013
  {
62015
62014
  type: "button",
62016
- onClick: (ls) => {
62017
- ls.stopPropagation(), Ts({
62015
+ onClick: (is) => {
62016
+ is.stopPropagation(), Ts({
62018
62017
  collection: ca.target_collection,
62019
62018
  itemId: Kr[0],
62020
62019
  layoutId: Ma.layout_id,
@@ -62030,8 +62029,8 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62030
62029
  "button",
62031
62030
  {
62032
62031
  type: "button",
62033
- onClick: (ls) => {
62034
- ls.stopPropagation(), rt({ row: qe, path: U, value: cn });
62032
+ onClick: (is) => {
62033
+ is.stopPropagation(), rt({ row: qe, path: U, value: cn });
62035
62034
  },
62036
62035
  title: "Show the rows behind this number",
62037
62036
  className: "block max-w-[200px] truncate text-left text-[12px] tabular-nums underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-nvr-navy hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
@@ -62046,7 +62045,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62046
62045
  "aging_hours",
62047
62046
  "sla_status",
62048
62047
  "at_risk",
62049
- ...ns.map((U) => `extra.${U}`)
62048
+ ...as.map((U) => `extra.${U}`)
62050
62049
  ], hr = [
62051
62050
  ...Is ? ["collection"] : [],
62052
62051
  "state",
@@ -62054,7 +62053,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62054
62053
  "aging_hours",
62055
62054
  "sla_status",
62056
62055
  "at_risk",
62057
- ...ns.slice(0, 2).map((U) => `extra.${U}`)
62056
+ ...as.slice(0, 2).map((U) => `extra.${U}`)
62058
62057
  ], Dr = (xe == null ? void 0 : xe.default_columns) ?? null, dr = gn ?? Dr, Pr = new Set(dr ?? hr), fr = [
62059
62058
  ...(dr ?? []).filter((U) => bs.includes(U)),
62060
62059
  ...bs.filter((U) => !(dr ?? []).includes(U))
@@ -62084,7 +62083,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62084
62083
  return Number.isFinite(cn) ? /* @__PURE__ */ e("span", { className: "tabular-nums", children: U.format === "currency" ? cn.toLocaleString(void 0, { style: "currency", currency: "USD" }) : cn.toLocaleString() }) : /* @__PURE__ */ e("span", { children: String(Dt) });
62085
62084
  }
62086
62085
  })
62087
- ), Ul = [...Ra, ...na, ...ui], Vr = {
62086
+ ), Ul = [...Ra, ...na, ...ui], Jr = {
62088
62087
  key: "__actions__",
62089
62088
  header: "",
62090
62089
  render: (U) => U.collection === "tasks" ? null : /* @__PURE__ */ e("span", { onClick: (qe) => qe.stopPropagation(), children: /* @__PURE__ */ e(
@@ -62093,7 +62092,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62093
62092
  collection: U.collection,
62094
62093
  id: U.item_id,
62095
62094
  hasPipeline: U.state != null,
62096
- onOpen: () => Na(U),
62095
+ onOpen: () => ka(U),
62097
62096
  onPeek: () => En(U),
62098
62097
  urlFor: d.urlFor,
62099
62098
  onDeleted: () => {
@@ -62106,24 +62105,24 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62106
62105
  onAfterTransition: () => void s.invalidateQueries({ queryKey: ["queue-items", t] })
62107
62106
  }
62108
62107
  ) })
62109
- }, as = [
62108
+ }, rs = [
62110
62109
  Za,
62111
62110
  ...fr.filter((U) => Pr.has(U)).map((U) => Ul.find((qe) => qe.key === U)).filter((U) => U !== void 0),
62112
- ...te ? [Wr] : [],
62113
- Vr
62111
+ ...te ? [Qr] : [],
62112
+ Jr
62114
62113
  ], aa = ve(() => {
62115
62114
  var Dt;
62116
- const U = xe == null ? void 0 : xe.default_pins, qe = T ?? (U && Object.keys(U).length > 0 ? U : { [((Dt = as[0]) == null ? void 0 : Dt.key) ?? "label"]: "left" }), pt = new Set(as.map((cn) => cn.key));
62115
+ const U = xe == null ? void 0 : xe.default_pins, qe = T ?? (U && Object.keys(U).length > 0 ? U : { [((Dt = rs[0]) == null ? void 0 : Dt.key) ?? "label"]: "left" }), pt = new Set(rs.map((cn) => cn.key));
62117
62116
  return Object.fromEntries(Object.entries(qe).filter(([cn]) => pt.has(cn)));
62118
- }, [T, xe == null ? void 0 : xe.default_pins, as.map((U) => U.key).join("|")]), _l = [
62117
+ }, [T, xe == null ? void 0 : xe.default_pins, rs.map((U) => U.key).join("|")]), _l = [
62119
62118
  { value: "state", label: "State" },
62120
62119
  { value: "collection", label: "Collection" },
62121
62120
  { value: "sla_status", label: "SLA status" },
62122
62121
  { value: "at_risk", label: "At risk" },
62123
62122
  { value: "owners", label: "Owner" },
62124
62123
  { value: "aging", label: "Aging" },
62125
- ...ns.filter((U) => Pr.has(`extra.${U}`)).map((U) => ({ value: `extra.${U}`, label: Be(`extra.${U}`, zd(U)) }))
62126
- ], rs = (U) => async (qe) => {
62124
+ ...as.filter((U) => Pr.has(`extra.${U}`)).map((U) => ({ value: `extra.${U}`, label: Be(`extra.${U}`, zd(U)) }))
62125
+ ], ss = (U) => async (qe) => {
62127
62126
  if (!U.target_collection || !U.display_field) return [];
62128
62127
  const pt = {
62129
62128
  limit: 25,
@@ -62132,7 +62131,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62132
62131
  qe.trim() && (pt.filter = JSON.stringify({ [U.display_field]: { _contains: qe.trim() } }));
62133
62132
  const cn = (await l.request(
62134
62133
  Z(`/items/${U.target_collection}`, pt)
62135
- )).data ?? [], dn = ts(U.path), Hn = K[U.path] ? new Set(K[U.path]) : null, ca = /* @__PURE__ */ new Set(), Kr = [];
62134
+ )).data ?? [], dn = ns(U.path), Hn = K[U.path] ? new Set(K[U.path]) : null, ca = /* @__PURE__ */ new Set(), Kr = [];
62136
62135
  for (const Ma of cn) {
62137
62136
  const Ir = Ma[U.display_field];
62138
62137
  if (Ir == null || Ir === "") continue;
@@ -62142,7 +62141,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62142
62141
  return Kr;
62143
62142
  }, Ba = new Map(((q == null ? void 0 : q.extra_field_meta) ?? []).map((U) => [U.path, U])), Ea = (U, qe) => {
62144
62143
  if (U.key.startsWith("extra.")) {
62145
- const pt = ts(U.key.slice(6));
62144
+ const pt = ns(U.key.slice(6));
62146
62145
  if (pt) {
62147
62146
  const cn = (Array.isArray(qe) ? qe : [qe]).filter((dn) => dn !== "").map((dn) => ao(String(dn), pt));
62148
62147
  return cn.slice(0, 2).join(", ") + (cn.length > 2 ? ` +${cn.length - 2}` : "");
@@ -62218,7 +62217,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62218
62217
  value: U.id
62219
62218
  }))
62220
62219
  },
62221
- ...ns.map((U) => {
62220
+ ...as.map((U) => {
62222
62221
  var pt;
62223
62222
  const qe = Ba.get(U);
62224
62223
  return (qe == null ? void 0 : qe.kind) === "relation" ? {
@@ -62227,7 +62226,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62227
62226
  type: "combobox",
62228
62227
  multi: !0,
62229
62228
  restricted: !!((pt = K[U]) != null && pt.length),
62230
- loadOptions: rs(qe)
62229
+ loadOptions: ss(qe)
62231
62230
  } : {
62232
62231
  key: `extra.${U}`,
62233
62232
  placeholder: `Search ${Be(`extra.${U}`, zd(U))}…`,
@@ -62462,9 +62461,9 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62462
62461
  ]
62463
62462
  }
62464
62463
  ) }),
62465
- /* @__PURE__ */ e(ra, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
62464
+ /* @__PURE__ */ e(ra, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
62466
62465
  /* @__PURE__ */ e(ms, { placeholder: "Group by…", className: "h-8 text-[12px]" }),
62467
- /* @__PURE__ */ a(Xr, { children: [
62466
+ /* @__PURE__ */ a(Zr, { children: [
62468
62467
  /* @__PURE__ */ e(ps, { children: "No attribute found." }),
62469
62468
  /* @__PURE__ */ e(sr, { value: "__none__", onSelect: () => L(null), children: "None" }),
62470
62469
  _l.map((U) => /* @__PURE__ */ e(
@@ -62522,7 +62521,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62522
62521
  ]
62523
62522
  }
62524
62523
  ) }),
62525
- /* @__PURE__ */ e(ra, { className: "w-[180px] p-0", align: "start", children: /* @__PURE__ */ e(Yr, { children: /* @__PURE__ */ a(Xr, { children: [
62524
+ /* @__PURE__ */ e(ra, { className: "w-[180px] p-0", align: "start", children: /* @__PURE__ */ e(Xr, { children: /* @__PURE__ */ a(Zr, { children: [
62526
62525
  /* @__PURE__ */ e(sr, { value: "none", onSelect: () => k(null), children: "None" }),
62527
62526
  /* @__PURE__ */ e(sr, { value: "collection", onSelect: () => k("collection"), children: "Collection" }),
62528
62527
  /* @__PURE__ */ e(sr, { value: "owner", onSelect: () => k("owners"), children: "Owner" })
@@ -62592,7 +62591,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62592
62591
  "button",
62593
62592
  {
62594
62593
  type: "button",
62595
- onClick: () => es.mutate({ viewId: U.id, on: !U.is_default }),
62594
+ onClick: () => ts.mutate({ viewId: U.id, on: !U.is_default }),
62596
62595
  title: U.is_default ? "Queue default — click to unset" : "Set as the default view for everyone on this queue",
62597
62596
  className: H(
62598
62597
  "shrink-0",
@@ -62811,7 +62810,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
62811
62810
  }),
62812
62811
  className: "flex w-full items-center rounded px-2 py-1.5 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
62813
62812
  children: [
62814
- ((ss = de.active) == null ? void 0 : ss.create_label) ?? ((tl = de.active) == null ? void 0 : tl.name) ?? "Default layout",
62813
+ ((ls = de.active) == null ? void 0 : ls.create_label) ?? ((tl = de.active) == null ? void 0 : tl.name) ?? "Default layout",
62815
62814
  /* @__PURE__ */ e("span", { className: "ml-auto pl-3 text-[10px] text-slate-400 dark:text-slate-500", children: "default" })
62816
62815
  ]
62817
62816
  }
@@ -63009,7 +63008,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
63009
63008
  fillHeight: !0,
63010
63009
  density: h,
63011
63010
  minBodyHeight: 360,
63012
- columns: as,
63011
+ columns: rs,
63013
63012
  rows: an,
63014
63013
  rowKey: (U) => `${U.collection}:${U.item_id}`,
63015
63014
  total: (Ut == null ? void 0 : Ut.total) ?? 0,
@@ -63146,7 +63145,7 @@ function uF({ queueId: t, realtime: n, renderError: r }) {
63146
63145
  { label: "Open", run: () => ir(Kn.row) },
63147
63146
  {
63148
63147
  label: "Open full record",
63149
- run: () => Na(Kn.row)
63148
+ run: () => ka(Kn.row)
63150
63149
  },
63151
63150
  { label: "Peek", run: () => En(Kn.row) },
63152
63151
  ...te ? [
@@ -64152,9 +64151,9 @@ function av({
64152
64151
  ]
64153
64152
  }
64154
64153
  ) }),
64155
- /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Yr, { children: [
64154
+ /* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(Xr, { children: [
64156
64155
  /* @__PURE__ */ e(ms, { placeholder: `Filter ${r}…`, className: "h-8 text-[12.5px]" }),
64157
- /* @__PURE__ */ a(Xr, { className: "max-h-52", children: [
64156
+ /* @__PURE__ */ a(Zr, { className: "max-h-52", children: [
64158
64157
  /* @__PURE__ */ e(ps, { children: "No values." }),
64159
64158
  p.map((f) => {
64160
64159
  const y = l.some((v) => String(v) === f.value);
@@ -65700,9 +65699,9 @@ const db = Vb(function({
65700
65699
  String(Yt.id)
65701
65700
  )) }),
65702
65701
  (zt == null ? void 0 : zt.grand_total) && we.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: bt.map((Yt, Ve) => {
65703
- var fn, Qt, Nn;
65702
+ var fn, Vt, Nn;
65704
65703
  const Kt = we.map((wn) => Number(wn[Yt])).filter((wn) => Number.isFinite(wn)), Ht = Kt.length > we.length / 2, Wt = Kt.reduce((wn, Zn) => wn + Zn, 0);
65705
- return /* @__PURE__ */ e("td", { className: H("px-1.5 py-1 text-slate-800 dark:text-slate-100", Ht && "text-right tabular-nums"), children: Ve === 0 && !Ht ? "Total" : Ht ? (fn = Lt(Yt)) != null && fn.format ? Zi(Wt, (Qt = Lt(Yt)) == null ? void 0 : Qt.format, (Nn = Lt(Yt)) == null ? void 0 : Nn.decimals) : Wt.toLocaleString() : "" }, Yt);
65704
+ return /* @__PURE__ */ e("td", { className: H("px-1.5 py-1 text-slate-800 dark:text-slate-100", Ht && "text-right tabular-nums"), children: Ve === 0 && !Ht ? "Total" : Ht ? (fn = Lt(Yt)) != null && fn.format ? Zi(Wt, (Vt = Lt(Yt)) == null ? void 0 : Vt.format, (Nn = Lt(Yt)) == null ? void 0 : Nn.decimals) : Wt.toLocaleString() : "" }, Yt);
65706
65705
  }) }) })
65707
65706
  ] }) })
65708
65707
  ] });
@@ -66378,7 +66377,7 @@ function mF({
66378
66377
  values: [Kt],
66379
66378
  labels: [Ht]
66380
66379
  };
66381
- g((fn) => [...fn.filter((Qt) => Qt.field !== Ve), Wt]), C((fn) => [...fn.filter((Qt) => Qt.field !== Ve), Wt]);
66380
+ g((fn) => [...fn.filter((Vt) => Vt.field !== Ve), Wt]), C((fn) => [...fn.filter((Vt) => Vt.field !== Ve), Wt]);
66382
66381
  }, []), [Ne, Be] = S(!1), [ue, J] = S(null), [ce, ee] = S(null), re = Ue({
66383
66382
  mutationFn: (Ve) => u.request(
66384
66383
  dd(`/report-studio/${t}/widgets`, {
@@ -66413,10 +66412,10 @@ function mF({
66413
66412
  const Ye = () => {
66414
66413
  J(be((Pt == null ? void 0 : Pt.widgets) ?? [])), Be(!0), window.__nvrReportId = t;
66415
66414
  }, Nt = (Ve) => J((Kt) => (Kt ?? []).map((Ht) => Ht.id === Ve.id ? Ve : Ht)), bn = (Ve, Kt) => J((Ht) => {
66416
- const Wt = [...Ht ?? []], fn = Wt.findIndex((Zn) => Zn.id === Ve), Qt = fn + Kt;
66417
- if (fn < 0 || Qt < 0 || Qt >= Wt.length) return Wt;
66418
- const Nn = Wt[fn], wn = Wt[Qt];
66419
- return Wt[fn] = { ...wn, x: Nn.x, y: Nn.y }, Wt[Qt] = { ...Nn, x: wn.x, y: wn.y }, Wt;
66415
+ const Wt = [...Ht ?? []], fn = Wt.findIndex((Zn) => Zn.id === Ve), Vt = fn + Kt;
66416
+ if (fn < 0 || Vt < 0 || Vt >= Wt.length) return Wt;
66417
+ const Nn = Wt[fn], wn = Wt[Vt];
66418
+ return Wt[fn] = { ...wn, x: Nn.x, y: Nn.y }, Wt[Vt] = { ...Nn, x: wn.x, y: wn.y }, Wt;
66420
66419
  }), [_e, St] = S(""), [en, Ut] = S(!1), [ke, We] = S(null), { data: Pt, isLoading: Oe } = se({
66421
66420
  queryKey: ["nivaro-report", t],
66422
66421
  queryFn: () => u.request(ok(t)).then((Ve) => Ve.data),
@@ -66445,16 +66444,16 @@ function mF({
66445
66444
  collection: (Ht = Wt.options) == null ? void 0 : Ht.collection
66446
66445
  });
66447
66446
  if (!fn) continue;
66448
- const Qt = Wt.options ? Wt.options.value_field ?? "id" : "id", Nn = L.restricted[fn.name] ?? [];
66447
+ const Vt = Wt.options ? Wt.options.value_field ?? "id" : "id", Nn = L.restricted[fn.name] ?? [];
66449
66448
  if (Nn.length > 0) {
66450
- const Zn = await pc(u, fn, Nn, Qt).catch(
66449
+ const Zn = await pc(u, fn, Nn, Vt).catch(
66451
66450
  () => []
66452
66451
  );
66453
66452
  Zn.length > 0 && (Kt[Wt.field] = Zn);
66454
66453
  }
66455
66454
  const wn = Cc(L, fn.name);
66456
66455
  if (wn.length > 0) {
66457
- const Zn = await pc(u, fn, wn, Qt).catch(
66456
+ const Zn = await pc(u, fn, wn, Vt).catch(
66458
66457
  () => []
66459
66458
  );
66460
66459
  Zn.length > 0 && Ve.push({ field: Wt.field, values: Zn, labels: Zn.map(String) });
@@ -66462,9 +66461,9 @@ function mF({
66462
66461
  }
66463
66462
  if (Object.keys(Kt).length > 0 && T(Kt), Ve.length > 0) {
66464
66463
  const Wt = (fn) => {
66465
- const Qt = [...fn];
66466
- for (const Nn of Ve) Qt.some((wn) => wn.field === Nn.field) || Qt.push(Nn);
66467
- return Qt;
66464
+ const Vt = [...fn];
66465
+ for (const Nn of Ve) Vt.some((wn) => wn.field === Nn.field) || Vt.push(Nn);
66466
+ return Vt;
66468
66467
  };
66469
66468
  C(Wt), g(Wt);
66470
66469
  }
@@ -66485,11 +66484,11 @@ function mF({
66485
66484
  Ut(!0), We(null);
66486
66485
  try {
66487
66486
  const Wt = await u.request(
66488
- dk(t, Ve, nn.map((Qt) => ({ field: Qt.field, label: Qt.label })))
66489
- ), fn = (Wt.data.entity_filters ?? []).filter((Qt) => {
66487
+ dk(t, Ve, nn.map((Vt) => ({ field: Vt.field, label: Vt.label })))
66488
+ ), fn = (Wt.data.entity_filters ?? []).filter((Vt) => {
66490
66489
  var Nn;
66491
- return nn.some((wn) => wn.field === Qt.field) && ((Nn = Qt.values) == null ? void 0 : Nn.length) > 0;
66492
- }).map((Qt) => ({ field: Qt.field, values: Qt.values, labels: Qt.values.map(String) }));
66490
+ return nn.some((wn) => wn.field === Vt.field) && ((Nn = Vt.values) == null ? void 0 : Nn.length) > 0;
66491
+ }).map((Vt) => ({ field: Vt.field, values: Vt.values, labels: Vt.values.map(String) }));
66493
66492
  C(fn), g(fn), y(Wt.data.date_range ?? null), b(void 0), St("");
66494
66493
  } catch (Wt) {
66495
66494
  We(
@@ -66532,7 +66531,7 @@ function mF({
66532
66531
  allowedValues: k[Ve.field],
66533
66532
  selected: ((Kt = F.find((Ht) => Ht.field === Ve.field)) == null ? void 0 : Kt.values) ?? [],
66534
66533
  onChange: (Ht, Wt) => C((fn) => [
66535
- ...fn.filter((Qt) => Qt.field !== Ve.field),
66534
+ ...fn.filter((Vt) => Vt.field !== Ve.field),
66536
66535
  ...Ht.length > 0 ? [{ field: Ve.field, values: Ht, labels: Wt }] : []
66537
66536
  ])
66538
66537
  },
@@ -69259,7 +69258,7 @@ function Qp({
69259
69258
  }
69260
69259
  );
69261
69260
  }
69262
- function Br(t, n) {
69261
+ function Wr(t, n) {
69263
69262
  return { _method: "GET", _path: t, _params: n };
69264
69263
  }
69265
69264
  function li(t, n) {
@@ -69310,7 +69309,7 @@ function Eq(t, n, r) {
69310
69309
  let g = !0;
69311
69310
  p(!0), f(null);
69312
69311
  const x = { limit: l };
69313
- return s && (x.search = s), o && (x.filter = JSON.stringify(o)), t.request(Br(`/items/${n}`, x)).then((b) => {
69312
+ return s && (x.search = s), o && (x.filter = JSON.stringify(o)), t.request(Wr(`/items/${n}`, x)).then((b) => {
69314
69313
  if (!g || v !== y.current) return;
69315
69314
  const F = b.data ?? [];
69316
69315
  c(
@@ -69603,7 +69602,7 @@ function Dq({
69603
69602
  if (!(!r || !n || !i || !d))
69604
69603
  try {
69605
69604
  const j = await r.request(
69606
- Br(`/items/${i}`, {
69605
+ Wr(`/items/${i}`, {
69607
69606
  filter: JSON.stringify({ [d]: { _eq: n } }),
69608
69607
  limit: 200,
69609
69608
  fields: "*"
@@ -69615,7 +69614,7 @@ function Dq({
69615
69614
  }
69616
69615
  }, [r, n, i, d]);
69617
69616
  Ae(() => {
69618
- !r || !i || r.request(Br(`/field-config/${i}`)).then((j) => {
69617
+ !r || !i || r.request(Wr(`/field-config/${i}`)).then((j) => {
69619
69618
  if (!x.current) return;
69620
69619
  const D = (j.data ?? []).filter(
69621
69620
  (O) => !O.field.startsWith("_") && O.field !== "id" && O.field !== d
@@ -69887,7 +69886,7 @@ function Uq({
69887
69886
  m(!0);
69888
69887
  try {
69889
69888
  const k = await l.request(
69890
- Br("/comments", { collection: t, item: String(n) })
69889
+ Wr("/comments", { collection: t, item: String(n) })
69891
69890
  );
69892
69891
  F.current && u(k.data ?? []);
69893
69892
  } catch {
@@ -70206,7 +70205,7 @@ function Wq({
70206
70205
  if (s)
70207
70206
  try {
70208
70207
  const _ = await s.request(
70209
- Br(`/pipelines/instance/${t}/${n}/owners`)
70208
+ Wr(`/pipelines/instance/${t}/${n}/owners`)
70210
70209
  );
70211
70210
  b.current && i(_.data ?? []);
70212
70211
  } catch {
@@ -70218,7 +70217,7 @@ function Wq({
70218
70217
  Ae(() => {
70219
70218
  F();
70220
70219
  }, [F]), Ae(() => {
70221
- s && s.request(Br("/users", { limit: 200, sort: "first_name" })).then((_) => {
70220
+ s && s.request(Wr("/users", { limit: 200, sort: "first_name" })).then((_) => {
70222
70221
  b.current && o(_.data ?? []);
70223
70222
  }).catch(() => {
70224
70223
  });
@@ -70687,7 +70686,7 @@ function Vq({
70687
70686
  if (!(!l || !n))
70688
70687
  try {
70689
70688
  const q = await l.request(
70690
- Br(`/pipelines/instance/${t}/${n}`)
70689
+ Wr(`/pipelines/instance/${t}/${n}`)
70691
70690
  );
70692
70691
  x.current && u(q.data ?? null);
70693
70692
  } catch {
@@ -71035,7 +71034,7 @@ function Gq({
71035
71034
  if (!(!l || !n))
71036
71035
  try {
71037
71036
  const W = await l.request(
71038
- Br("/tasks", { collection: t, item: String(n) })
71037
+ Wr("/tasks", { collection: t, item: String(n) })
71039
71038
  );
71040
71039
  _.current && u(W.data ?? []);
71041
71040
  } catch {
@@ -71045,7 +71044,7 @@ function Gq({
71045
71044
  Ae(() => {
71046
71045
  k();
71047
71046
  }, [k]), Ae(() => {
71048
- l && l.request(Br("/users", { limit: 200 })).then((W) => {
71047
+ l && l.request(Wr("/users", { limit: 200 })).then((W) => {
71049
71048
  _.current && m(W.data ?? []);
71050
71049
  }).catch(() => {
71051
71050
  });
@@ -71839,12 +71838,12 @@ function r6(t, n, r, s, l) {
71839
71838
  async function s6(t, n, r, s, l) {
71840
71839
  if (s != null) {
71841
71840
  const [m, p, h, f] = await Promise.all([
71842
- t.request(Br(`/collections/${n}`)),
71843
- t.request(Br(`/collection-layouts/${s}`)).catch(() => ({ data: void 0 })),
71841
+ t.request(Wr(`/collections/${n}`)),
71842
+ t.request(Wr(`/collection-layouts/${s}`)).catch(() => ({ data: void 0 })),
71844
71843
  t.request(
71845
- Br(`/field-groups/${n}`, { layout_id: s })
71844
+ Wr(`/field-groups/${n}`, { layout_id: s })
71846
71845
  ),
71847
- t.request(Br(`/collection-layouts/${s}/assignments`))
71846
+ t.request(Wr(`/collection-layouts/${s}/assignments`))
71848
71847
  ]), y = /* @__PURE__ */ new Map();
71849
71848
  let v = null;
71850
71849
  const g = f.data ?? [];
@@ -71871,9 +71870,9 @@ async function s6(t, n, r, s, l) {
71871
71870
  return x.ungroupedSort = v, gb(x, p.data), x.slotAssignments = yb(g), x;
71872
71871
  }
71873
71872
  const [i, d] = await Promise.all([
71874
- t.request(Br(`/collections/${n}`)),
71873
+ t.request(Wr(`/collections/${n}`)),
71875
71874
  t.request(
71876
- Br(
71875
+ Wr(
71877
71876
  "/collection-layouts/active",
71878
71877
  l ? { collection: n, slug: l } : { collection: n }
71879
71878
  )
@@ -72133,7 +72132,7 @@ function RF(t, n, r) {
72133
72132
  return ye.fieldType === "relation-m2m" && ((Me = ye.relation) == null ? void 0 : Me.relatedCollection) && ((Ne = ye.relation) == null ? void 0 : Ne.manyField) && ((Be = ye.relation) == null ? void 0 : Be.junctionField);
72134
72133
  }
72135
72134
  );
72136
- return l.request(Br(`/items/${t}/${d}`)).then(async (ye) => {
72135
+ return l.request(Wr(`/items/${t}/${d}`)).then(async (ye) => {
72137
72136
  if (!te) return;
72138
72137
  const Me = {
72139
72138
  ...vb(v, o),
@@ -72144,7 +72143,7 @@ function RF(t, n, r) {
72144
72143
  xe.map((Be) => {
72145
72144
  const ue = Be.relation, J = ue.junctionCollection ?? ue.relatedCollection;
72146
72145
  return l.request(
72147
- Br(`/items/${J}`, {
72146
+ Wr(`/items/${J}`, {
72148
72147
  filter: JSON.stringify({ [ue.manyField]: { _eq: d } }),
72149
72148
  fields: `id,${ue.junctionField}`,
72150
72149
  limit: 200
@@ -72701,7 +72700,7 @@ export {
72701
72700
  _N as useChannelAdmin,
72702
72701
  NN as useChannelDirectory,
72703
72702
  wN as useChannelMembers,
72704
- Zr as useChatConfig,
72703
+ es as useChatConfig,
72705
72704
  vN as useChatMessages,
72706
72705
  Cg as useChatRoles,
72707
72706
  Sg as useChatRooms,