@nivaro/react 0.3.29 → 0.3.31

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.
@@ -1,39 +1,40 @@
1
1
  import { jsx as e, jsxs as n, Fragment as de } from "react/jsx-runtime";
2
2
  import { useQueryClient as Oe, useQuery as te, useMutation as xe } from "@tanstack/react-query";
3
- import { ArrowRight as Fe, Loader2 as se, Check as Ce, GitBranch as Te, AlertTriangle as wt, ChevronDown as me, Users as st, Minus as vt, UserPlus as Nt, X as it, Zap as lt, Search as kt } from "lucide-react";
4
- import { useState as K, useRef as ne, useEffect as ue, useMemo as et, Suspense as ot, lazy as _t } from "react";
3
+ import { ArrowRight as Fe, Loader2 as se, Check as Ce, GitBranch as Te, AlertTriangle as Nt, ChevronDown as me, Users as it, Minus as kt, UserPlus as _t, X as lt, Zap as ot, Search as Ct } from "lucide-react";
4
+ import { useState as K, useRef as ne, useEffect as ue, useMemo as et, Suspense as dt, lazy as St } from "react";
5
5
  import { toast as ee } from "sonner";
6
- import { useNivaroClient as fe, useItemEditAuth as Ct } from "../../context.js";
7
- import { get as ie, post as be, del as St } from "../../lib/commands.js";
8
- import { useRecordSignalWhile as dt, useRecordSignalPeers as $t, signalSentence as Tt } from "../../lib/presence-signals.js";
6
+ import { useNivaroClient as fe, useItemEditAuth as $t } from "../../context.js";
7
+ import { get as ie, post as be, del as Tt } from "../../lib/commands.js";
8
+ import { useRecordSignalWhile as ct, useRecordSignalPeers as qt, signalSentence as Pt } from "../../lib/presence-signals.js";
9
9
  import { RUN_TRANSITION_EVENT as Ne } from "../../lib/run-transition.js";
10
10
  import { userErrorMessage as he } from "../../lib/safe-error.js";
11
- import { serverNow as qt } from "../../lib/server-clock.js";
12
- import { userCardQuery as Pt } from "../../lib/user-cards.js";
13
- import { cn as ge, formatRelative as ct, humanHours as At } from "../../lib/utils.js";
14
- import { PushReadinessChip as Rt } from "../integrations/RecordIntegrationPreview.js";
15
- import { useHeaderFold as Dt } from "../item-edit/HeaderTools.js";
11
+ import { serverNow as At } from "../../lib/server-clock.js";
12
+ import { userCardQuery as Rt } from "../../lib/user-cards.js";
13
+ import { cn as ge, formatRelative as mt, humanHours as Dt } from "../../lib/utils.js";
14
+ import { PushReadinessChip as jt } from "../integrations/RecordIntegrationPreview.js";
15
+ import { useHeaderFold as Bt } from "../item-edit/HeaderTools.js";
16
16
  import { invalidateRecordInsights as ke, invalidateRecordData as _e } from "../item-edit/RecordInsights.js";
17
- import { OwnerAvatars as jt } from "../queue/OwnerAvatars.js";
18
- import { UserAvatar as Mt } from "../UserAvatar.js";
17
+ import { UserChip as ut } from "../item-edit/UserChip.js";
18
+ import { OwnerAvatars as Mt } from "../queue/OwnerAvatars.js";
19
+ import { UserAvatar as Lt } from "../UserAvatar.js";
19
20
  import { Button as Y } from "../ui/button.js";
20
- import { DropdownMenu as Pe, DropdownMenuTrigger as Ae, DropdownMenuContent as Re, DropdownMenuGroup as tt, DropdownMenuSeparator as nt, DropdownMenuItem as we, DropdownMenuLabel as Bt } from "../ui/dropdown-menu.js";
21
- import { Popover as Ee, PopoverTrigger as Ie, PopoverContent as Ue } from "../ui/popover.js";
21
+ import { DropdownMenu as Pe, DropdownMenuTrigger as Ae, DropdownMenuContent as Re, DropdownMenuGroup as tt, DropdownMenuSeparator as nt, DropdownMenuItem as we, DropdownMenuLabel as Ot } from "../ui/dropdown-menu.js";
22
+ import { Popover as Ie, PopoverTrigger as Ee, PopoverContent as Ue } from "../ui/popover.js";
22
23
  import { Skeleton as le } from "../ui/skeleton.js";
23
- import { TooltipProvider as mt, Tooltip as De, TooltipTrigger as je, TooltipContent as Me } from "../ui/tooltip.js";
24
- import { isAccessRefusal as ut, deniedToastAction as pt, WhyOwnersButton as Lt } from "./AccessInsights.js";
25
- import { BranchLanes as Ot } from "./BranchLanes.js";
26
- import { SlaClockLine as Ft } from "./SlaClock.js";
27
- const ft = _t(
24
+ import { TooltipProvider as pt, Tooltip as De, TooltipTrigger as je, TooltipContent as Be } from "../ui/tooltip.js";
25
+ import { isAccessRefusal as ft, deniedToastAction as ht, WhyOwnersButton as Ft } from "./AccessInsights.js";
26
+ import { BranchLanes as It } from "./BranchLanes.js";
27
+ import { SlaClockLine as Et } from "./SlaClock.js";
28
+ const xt = St(
28
29
  () => import("./TransitionRequirementsDialog.js").then((r) => ({
29
30
  default: r.TransitionRequirementsDialog
30
31
  }))
31
32
  );
32
- function ht(r, t) {
33
+ function bt(r, t) {
33
34
  const u = r || "System";
34
35
  return t.on_behalf_of_name ? `${u}, for ${t.on_behalf_of_name}` : u;
35
36
  }
36
- function Et(r) {
37
+ function Ut(r) {
37
38
  if (r.transition) return null;
38
39
  const t = (r.comment ?? "").trim();
39
40
  if (!t.startsWith("{")) return null;
@@ -50,7 +51,7 @@ function Et(r) {
50
51
  function ve(r) {
51
52
  return !(r.first_name || r.last_name || r.user_email);
52
53
  }
53
- function Be(r) {
54
+ function Me(r) {
54
55
  const t = (r.comment ?? "").trim().toLowerCase();
55
56
  return r.origin === "import" || t.startsWith("import:") ? "Imported" : r.origin === "integration" ? "By an integration" : /-state-sync$/.test(t) || t.startsWith("legacy-") ? "Synced from another system" : t === "state-merge" || t === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
56
57
  }
@@ -68,24 +69,24 @@ const rt = {
68
69
  rate_limited: "the partner asked us to slow down",
69
70
  unknown: "the partner refused it"
70
71
  };
71
- function It(r) {
72
- const t = Math.ceil((new Date(r).getTime() - qt()) / 6e4);
72
+ function Qt(r) {
73
+ const t = Math.ceil((new Date(r).getTime() - At()) / 6e4);
73
74
  return !Number.isFinite(t) || t <= 0 ? "on the next check" : t < 60 ? `in ${t} min` : `in ${Math.round(t / 60)}h`;
74
75
  }
75
- function Ut({ held: r }) {
76
+ function zt({ held: r }) {
76
77
  return r.length === 0 ? null : /* @__PURE__ */ e(
77
78
  "div",
78
79
  {
79
80
  className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
80
81
  "data-pipeline-auto-held": !0,
81
82
  children: r.map((t) => {
82
- const u = t.transition_label ?? "An automatic move", l = rt[t.error_class ?? "unknown"] ?? rt.unknown;
83
+ const u = t.transition_label ?? "An automatic move", i = rt[t.error_class ?? "unknown"] ?? rt.unknown;
83
84
  return /* @__PURE__ */ n("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
84
85
  /* @__PURE__ */ n("p", { className: "font-medium", children: [
85
86
  "Needs a person: ",
86
87
  u,
87
88
  " stopped retrying — ",
88
- l,
89
+ i,
89
90
  "."
90
91
  ] }),
91
92
  t.error && /* @__PURE__ */ e(
@@ -97,7 +98,7 @@ function Ut({ held: r }) {
97
98
  }
98
99
  ),
99
100
  /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
100
- t.retry_at ? `It tries the same push again ${It(t.retry_at)}. ` : "It will not send the same push again on its own. ",
101
+ t.retry_at ? `It tries the same push again ${Qt(t.retry_at)}. ` : "It will not send the same push again on its own. ",
101
102
  "Fix the record so what it sends changes, retry the push, or move the record by hand.",
102
103
  t.attempts > 1 ? ` ${t.attempts} attempts so far.` : ""
103
104
  ] })
@@ -106,12 +107,12 @@ function Ut({ held: r }) {
106
107
  }
107
108
  );
108
109
  }
109
- function xt(r) {
110
+ function gt(r) {
110
111
  var u;
111
112
  const t = r == null ? void 0 : r.response;
112
113
  return ((t == null ? void 0 : t.code) ?? ((u = t == null ? void 0 : t.data) == null ? void 0 : u.code)) === "TRANSITION_DUPLICATE";
113
114
  }
114
- function bt(r) {
115
+ function yt(r) {
115
116
  var u;
116
117
  const t = r;
117
118
  return (t == null ? void 0 : t.status) === 422 && ((u = t.response) == null ? void 0 : u.error) === "TRANSITION_REQUIREMENTS" ? t.response.requirements ?? [] : null;
@@ -137,9 +138,9 @@ function oe({
137
138
  }
138
139
  function qe(r) {
139
140
  const t = Math.floor(r / 6e4);
140
- return t < 60 ? `${Math.max(1, t)}m` : At(r / 36e5);
141
+ return t < 60 ? `${Math.max(1, t)}m` : Dt(r / 36e5);
141
142
  }
142
- function Qt({
143
+ function Kt({
143
144
  history: r,
144
145
  completedAt: t
145
146
  }) {
@@ -147,8 +148,8 @@ function Qt({
147
148
  (f, N) => new Date(f.timestamp).getTime() - new Date(N.timestamp).getTime()
148
149
  );
149
150
  if (u.length === 0) return null;
150
- const l = t ? new Date(t).getTime() : Date.now(), q = u.map((f, N) => {
151
- const P = new Date(f.timestamp).getTime(), j = N + 1 < u.length ? new Date(u[N + 1].timestamp).getTime() : l;
151
+ const i = t ? new Date(t).getTime() : Date.now(), q = u.map((f, N) => {
152
+ const P = new Date(f.timestamp).getTime(), j = N + 1 < u.length ? new Date(u[N + 1].timestamp).getTime() : i;
152
153
  return {
153
154
  key: f.id,
154
155
  label: f.to_state_label,
@@ -199,11 +200,11 @@ function Qt({
199
200
  }) })
200
201
  ] });
201
202
  }
202
- function zt({
203
+ function Wt({
203
204
  states: r,
204
205
  allTransitions: t,
205
206
  availableTransitions: u,
206
- currentStateId: l,
207
+ currentStateId: i,
207
208
  history: q,
208
209
  onPathIds: p,
209
210
  skippedStates: f
@@ -211,39 +212,39 @@ function zt({
211
212
  var S;
212
213
  const N = ne(null);
213
214
  ue(() => {
214
- const i = N.current;
215
- if (!i || i.scrollWidth <= i.clientWidth) return;
216
- const w = i.querySelector("[data-track-current]");
215
+ const l = N.current;
216
+ if (!l || l.scrollWidth <= l.clientWidth) return;
217
+ const w = l.querySelector("[data-track-current]");
217
218
  if (!w) return;
218
- const s = i.getBoundingClientRect(), v = w.getBoundingClientRect();
219
- i.scrollLeft += v.left + v.width / 2 - (s.left + s.width / 2);
220
- }, [l]);
221
- const P = new Set(q.map((i) => i.to_state)), j = r.find((i) => i.is_initial);
222
- j && j.id !== l && P.add(j.id);
219
+ const s = l.getBoundingClientRect(), v = w.getBoundingClientRect();
220
+ l.scrollLeft += v.left + v.width / 2 - (s.left + s.width / 2);
221
+ }, [i]);
222
+ const P = new Set(q.map((l) => l.to_state)), j = r.find((l) => l.is_initial);
223
+ j && j.id !== i && P.add(j.id);
223
224
  const x = (S = q[0]) == null ? void 0 : S.from_state;
224
- x && x !== l && P.add(x);
225
+ x && x !== i && P.add(x);
225
226
  const R = (() => {
226
227
  if (p)
227
- return r.filter((c) => p.has(c.id) || P.has(c.id) || c.id === l).filter((c) => {
228
+ return r.filter((c) => p.has(c.id) || P.has(c.id) || c.id === i).filter((c) => {
228
229
  const y = c.stage_visibility ?? "always";
229
- return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === l : !0;
230
+ return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === i : !0;
230
231
  }).sort((c, y) => c.sort - y.sort);
231
232
  if (t.length === 0) {
232
233
  const c = /* @__PURE__ */ new Set([...P]);
233
- return l && c.add(l), r.filter((y) => c.has(y.id)).sort((y, d) => y.sort - d.sort);
234
+ return i && c.add(i), r.filter((y) => c.has(y.id)).sort((y, d) => y.sort - d.sort);
234
235
  }
235
- const i = new Set(
236
+ const l = new Set(
236
237
  q.filter((c) => c.from_state).map((c) => `${c.from_state}:${c.to_state}`)
237
238
  ), w = new Set(q.map((c) => c.from_state).filter(Boolean)), s = t.filter((c) => c.from_state !== null), v = /* @__PURE__ */ new Map();
238
239
  for (const c of s) {
239
240
  const y = c.from_state;
240
- if (w.has(y) && !i.has(`${y}:${c.to_state}`)) continue;
241
+ if (w.has(y) && !l.has(`${y}:${c.to_state}`)) continue;
241
242
  const d = v.get(y) ?? [];
242
243
  d.push(c.to_state), v.set(y, d);
243
244
  }
244
- if (l) {
245
- const c = s.filter((y) => y.from_state === l).map((y) => y.to_state);
246
- v.set(l, [
245
+ if (i) {
246
+ const c = s.filter((y) => y.from_state === i).map((y) => y.to_state);
247
+ v.set(i, [
247
248
  .../* @__PURE__ */ new Set([...u.map((y) => y.to_state), ...c])
248
249
  ]);
249
250
  }
@@ -256,46 +257,46 @@ function zt({
256
257
  }
257
258
  }
258
259
  const W = /* @__PURE__ */ new Set([...k, ...P]);
259
- return l && W.add(l), r.filter((c) => W.has(c.id)).filter((c) => {
260
+ return i && W.add(i), r.filter((c) => W.has(c.id)).filter((c) => {
260
261
  const y = c.stage_visibility ?? "always";
261
- return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === l : !0;
262
+ return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === i : !0;
262
263
  }).sort((c, y) => c.sort - y.sort);
263
264
  })();
264
265
  if (R.length < 2) return null;
265
- const C = new Map(R.map((i, w) => [i.id, w])), I = new Map(r.map((i) => [i.id, i.label]));
266
- function L(i, w) {
267
- const s = C.get(i);
266
+ const C = new Map(R.map((l, w) => [l.id, w])), E = new Map(r.map((l) => [l.id, l.label]));
267
+ function L(l, w) {
268
+ const s = C.get(l);
268
269
  return s == null ? [] : [...q].filter((v) => {
269
270
  if (!v.from_state) return !1;
270
271
  const k = C.get(v.from_state), A = C.get(v.to_state);
271
272
  return k == null || A == null ? !1 : k === s && A > s || A === s && k > s;
272
273
  }).sort((v, k) => new Date(v.timestamp).getTime() - new Date(k.timestamp).getTime());
273
274
  }
274
- function B(i) {
275
+ function M(l) {
275
276
  var w, s, v, k;
276
- return ve(i) ? /* @__PURE__ */ e(lt, { className: "inline h-2.5 w-2.5", "aria-label": Be(i) }) : ((((w = i.first_name) == null ? void 0 : w[0]) ?? "") + (((s = i.last_name) == null ? void 0 : s[0]) ?? "")).toUpperCase() || ((k = (v = i.user_email) == null ? void 0 : v[0]) == null ? void 0 : k.toUpperCase()) || "?";
277
+ return ve(l) ? /* @__PURE__ */ e(ot, { className: "inline h-2.5 w-2.5", "aria-label": Me(l) }) : ((((w = l.first_name) == null ? void 0 : w[0]) ?? "") + (((s = l.last_name) == null ? void 0 : s[0]) ?? "")).toUpperCase() || ((k = (v = l.user_email) == null ? void 0 : v[0]) == null ? void 0 : k.toUpperCase()) || "?";
277
278
  }
278
- function M(i) {
279
- return ht([i.first_name, i.last_name].filter(Boolean).join(" ") || i.user_email, i);
279
+ function B(l) {
280
+ return bt([l.first_name, l.last_name].filter(Boolean).join(" ") || l.user_email, l);
280
281
  }
281
282
  const U = /* @__PURE__ */ new Map();
282
- for (const i of [...q].sort(
283
+ for (const l of [...q].sort(
283
284
  (w, s) => new Date(w.timestamp).getTime() - new Date(s.timestamp).getTime()
284
285
  )) {
285
- if (!i.from_state) continue;
286
- const w = C.get(i.from_state), s = C.get(i.to_state);
286
+ if (!l.from_state) continue;
287
+ const w = C.get(l.from_state), s = C.get(l.to_state);
287
288
  if (!(w == null || s == null || s <= w + 1))
288
289
  for (let v = w + 1; v < s; v++) {
289
290
  const k = R[v].id;
290
- !P.has(k) && !U.has(k) && U.set(k, i);
291
+ !P.has(k) && !U.has(k) && U.set(k, l);
291
292
  }
292
293
  }
293
- function b(i) {
294
- const w = I.get(i.from_state ?? "") ?? "the previous step", s = I.get(i.to_state) ?? "the next step", v = ve(i) ? "it moved automatically" : `${M(i)} moved it`;
295
- return `Passed over on ${new Date(i.timestamp).toLocaleString()} — ${v} straight from ${w} to ${s}`;
294
+ function b(l) {
295
+ const w = E.get(l.from_state ?? "") ?? "the previous step", s = E.get(l.to_state) ?? "the next step", v = ve(l) ? "it moved automatically" : `${B(l)} moved it`;
296
+ return `Passed over on ${new Date(l.timestamp).toLocaleString()} — ${v} straight from ${w} to ${s}`;
296
297
  }
297
- return /* @__PURE__ */ e(mt, { delayDuration: 200, children: /* @__PURE__ */ e("div", { ref: N, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children: R.map((i, w) => {
298
- const s = i.id === l, v = P.has(i.id), k = v && !s, A = !v && !s ? U.get(i.id) : void 0, W = !v && !s ? f == null ? void 0 : f.get(i.id) : void 0, c = A || W ? [...A ? [b(A)] : [], ...W ?? []] : void 0, y = c !== void 0, d = i.color ?? "#94a3b8", m = w === R.length - 1, g = m ? null : R[w + 1], _ = g ? L(i.id, g.id) : [];
298
+ return /* @__PURE__ */ e(pt, { delayDuration: 200, children: /* @__PURE__ */ e("div", { ref: N, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children: R.map((l, w) => {
299
+ const s = l.id === i, v = P.has(l.id), k = v && !s, A = !v && !s ? U.get(l.id) : void 0, W = !v && !s ? f == null ? void 0 : f.get(l.id) : void 0, c = A || W ? [...A ? [b(A)] : [], ...W ?? []] : void 0, y = c !== void 0, d = l.color ?? "#94a3b8", m = w === R.length - 1, g = m ? null : R[w + 1], _ = g ? L(l.id, g.id) : [];
299
300
  return /* @__PURE__ */ n("div", { className: "flex flex-1 items-start", children: [
300
301
  /* @__PURE__ */ n("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
301
302
  /* @__PURE__ */ e(
@@ -303,13 +304,13 @@ function zt({
303
304
  {
304
305
  "data-track-current": s || void 0,
305
306
  className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${s || k ? "nvr-fill-sweep" : ""}`,
306
- "data-tip": i.description || void 0,
307
+ "data-tip": l.description || void 0,
307
308
  style: {
308
309
  backgroundColor: s || k ? d : y ? "transparent" : "#f1f5f9",
309
310
  border: s || k ? "none" : y ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
310
311
  boxShadow: s ? `0 0 0 3px white, 0 0 0 5px ${d}` : void 0
311
312
  },
312
- children: k ? /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : s ? /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : y ? /* @__PURE__ */ e(vt, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
313
+ children: k ? /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : s ? /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : y ? /* @__PURE__ */ e(kt, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
313
314
  },
314
315
  s ? "cur" : k ? "done" : y ? "skip" : "todo"
315
316
  ),
@@ -326,10 +327,10 @@ function zt({
326
327
  textDecoration: "line-through",
327
328
  textDecorationColor: "#cbd5e1"
328
329
  },
329
- children: i.label
330
+ children: l.label
330
331
  }
331
332
  ) }),
332
- /* @__PURE__ */ n(Me, { className: "max-w-[260px]", children: [
333
+ /* @__PURE__ */ n(Be, { className: "max-w-[260px]", children: [
333
334
  /* @__PURE__ */ e("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
334
335
  c.length > 0 ? /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: c.map((h) => /* @__PURE__ */ e("li", { children: h }, h)) }) : /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
335
336
  ] })
@@ -343,7 +344,7 @@ function zt({
343
344
  fontWeight: s ? 600 : k ? 500 : 400,
344
345
  wordBreak: "break-word"
345
346
  },
346
- children: i.label
347
+ children: l.label
347
348
  }
348
349
  )
349
350
  ] }),
@@ -373,9 +374,9 @@ function zt({
373
374
  ] });
374
375
  })(),
375
376
  _.map((h) => {
376
- const $ = h.from_state !== i.id, Q = Math.abs(
377
+ const $ = h.from_state !== l.id, Q = Math.abs(
377
378
  (C.get(h.to_state) ?? 0) - (C.get(h.from_state ?? "") ?? 0)
378
- ) > 1 ? I.get(h.to_state) ?? "" : null;
379
+ ) > 1 ? E.get(h.to_state) ?? "" : null;
379
380
  return /* @__PURE__ */ n(De, { children: [
380
381
  /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
381
382
  /* @__PURE__ */ n(
@@ -385,23 +386,23 @@ function zt({
385
386
  style: { color: $ ? "#d97706" : "#475569" },
386
387
  children: [
387
388
  $ && "↩ ",
388
- B(h)
389
+ M(h)
389
390
  ]
390
391
  }
391
392
  ),
392
- /* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: ct(h.timestamp) })
393
+ /* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: mt(h.timestamp) })
393
394
  ] }) }),
394
- /* @__PURE__ */ n(Me, { side: "top", className: "space-y-0.5 text-[12px]", children: [
395
+ /* @__PURE__ */ n(Be, { side: "top", className: "space-y-0.5 text-[12px]", children: [
395
396
  ve(h) ? /* @__PURE__ */ n(de, { children: [
396
397
  /* @__PURE__ */ n("p", { className: "font-medium", children: [
397
398
  $ ? "↩ Sent back · " : "",
398
- Be(h)
399
+ Me(h)
399
400
  ] }),
400
401
  Le(h) && /* @__PURE__ */ e("p", { className: "max-w-[280px] text-muted-foreground", children: Le(h) })
401
402
  ] }) : /* @__PURE__ */ n("p", { className: "font-medium", children: [
402
403
  $ ? "↩ Sent back by" : "Approved by",
403
404
  " ",
404
- M(h)
405
+ B(h)
405
406
  ] }),
406
407
  Q && /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: [
407
408
  "→ straight to ",
@@ -412,12 +413,12 @@ function zt({
412
413
  ] }, h.id);
413
414
  })
414
415
  ] })
415
- ] }, i.id);
416
+ ] }, l.id);
416
417
  }) }) }) });
417
418
  }
418
- function Kt({ history: r }) {
419
+ function Ht({ history: r }) {
419
420
  return r.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: r.map((t) => {
420
- const u = ve(t), l = u ? Be(t) : ht([t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email, t), q = Et(t), p = t.comment && !u && !q ? t.comment : null, f = q ?? (u ? Le(t) : null);
421
+ const u = ve(t), i = u ? Me(t) : bt([t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email, t), q = Ut(t), p = t.comment && !u && !q ? t.comment : null, f = q ?? (u ? Le(t) : null);
421
422
  return /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
422
423
  /* @__PURE__ */ e("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
423
424
  /* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
@@ -437,11 +438,11 @@ function Kt({ history: r }) {
437
438
  className: "mt-0.5 text-slate-400",
438
439
  "data-history-on-behalf": t.on_behalf_of_name ? t.on_behalf_of ?? "" : void 0,
439
440
  children: [
440
- u && /* @__PURE__ */ e(lt, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
441
- l,
441
+ u && /* @__PURE__ */ e(ot, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
442
+ i,
442
443
  f ? ` · ${f}` : "",
443
444
  " · ",
444
- ct(t.timestamp)
445
+ mt(t.timestamp)
445
446
  ]
446
447
  }
447
448
  )
@@ -449,14 +450,14 @@ function Kt({ history: r }) {
449
450
  ] }, t.id);
450
451
  }) });
451
452
  }
452
- function Wt({ value: r, onChange: t }) {
453
- const u = fe(), [l, q] = K(!1), [p, f] = K(""), [N, P] = K(""), j = ne(null), x = ne(null);
453
+ function Vt({ value: r, onChange: t }) {
454
+ const u = fe(), [i, q] = K(!1), [p, f] = K(""), [N, P] = K(""), j = ne(null), x = ne(null);
454
455
  ue(() => {
455
- l ? setTimeout(() => {
456
+ i ? setTimeout(() => {
456
457
  var b;
457
458
  return (b = j.current) == null ? void 0 : b.focus();
458
459
  }, 50) : f("");
459
- }, [l]), ue(() => (x.current && clearTimeout(x.current), x.current = setTimeout(() => P(p), 250), () => {
460
+ }, [i]), ue(() => (x.current && clearTimeout(x.current), x.current = setTimeout(() => P(p), 250), () => {
460
461
  x.current && clearTimeout(x.current);
461
462
  }), [p]);
462
463
  const { data: R, isLoading: C } = te({
@@ -468,22 +469,22 @@ function Wt({ value: r, onChange: t }) {
468
469
  ...N ? { search: N } : {}
469
470
  })
470
471
  ).then((b) => b.data),
471
- enabled: l,
472
+ enabled: i,
472
473
  staleTime: 3e4
473
- }), { data: I } = te({
474
- ...Pt(u, r),
474
+ }), { data: E } = te({
475
+ ...Rt(u, r),
475
476
  enabled: !!r,
476
477
  staleTime: 5 * 6e4
477
- }), L = R ?? [], B = I ?? L.find((b) => b.id === r) ?? null, M = B ? [B.first_name, B.last_name].filter(Boolean).join(" ").trim() || B.email : r ? "Selected person" : null, U = (b) => [b.first_name, b.last_name].filter(Boolean).join(" ").trim();
478
- return /* @__PURE__ */ n(Ee, { open: l, onOpenChange: q, children: [
478
+ }), L = R ?? [], M = E ?? L.find((b) => b.id === r) ?? null, B = M ? [M.first_name, M.last_name].filter(Boolean).join(" ").trim() || M.email : r ? "Selected person" : null, U = (b) => [b.first_name, b.last_name].filter(Boolean).join(" ").trim();
479
+ return /* @__PURE__ */ n(Ie, { open: i, onOpenChange: q, children: [
479
480
  /* @__PURE__ */ n("div", { className: "relative flex h-8 w-full", children: [
480
- /* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ n(
481
+ /* @__PURE__ */ e(Ee, { asChild: !0, children: /* @__PURE__ */ n(
481
482
  "button",
482
483
  {
483
484
  type: "button",
484
485
  className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 hover:border-slate-300",
485
486
  children: [
486
- /* @__PURE__ */ e("span", { className: `flex-1 truncate ${M ? "" : "text-slate-400"}`, children: M ?? "Select a user…" }),
487
+ /* @__PURE__ */ e("span", { className: `flex-1 truncate ${B ? "" : "text-slate-400"}`, children: B ?? "Select a user…" }),
487
488
  /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
488
489
  ]
489
490
  }
@@ -496,13 +497,13 @@ function Wt({ value: r, onChange: t }) {
496
497
  b.stopPropagation(), t("");
497
498
  },
498
499
  className: "absolute right-6 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
499
- children: /* @__PURE__ */ e(it, { className: "h-3 w-3" })
500
+ children: /* @__PURE__ */ e(lt, { className: "h-3 w-3" })
500
501
  }
501
502
  )
502
503
  ] }),
503
504
  /* @__PURE__ */ n(Ue, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
504
505
  /* @__PURE__ */ e("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ n("div", { className: "relative", children: [
505
- /* @__PURE__ */ e(kt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
506
+ /* @__PURE__ */ e(Ct, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
506
507
  /* @__PURE__ */ e(
507
508
  "input",
508
509
  {
@@ -518,7 +519,7 @@ function Wt({ value: r, onChange: t }) {
518
519
  /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }),
519
520
  "Loading…"
520
521
  ] }) : L.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : L.map((b) => {
521
- const S = U(b), i = S ? `${S} (${b.email})` : b.email, w = b.id === r;
522
+ const S = U(b), l = S ? `${S} (${b.email})` : b.email, w = b.id === r;
522
523
  return /* @__PURE__ */ n(
523
524
  "button",
524
525
  {
@@ -534,7 +535,7 @@ function Wt({ value: r, onChange: t }) {
534
535
  className: `h-3.5 w-3.5 shrink-0 ${w ? "text-nvr-cyan" : "opacity-0"}`
535
536
  }
536
537
  ),
537
- i
538
+ l
538
539
  ]
539
540
  },
540
541
  b.id
@@ -543,21 +544,51 @@ function Wt({ value: r, onChange: t }) {
543
544
  ] })
544
545
  ] });
545
546
  }
546
- function Ht({
547
+ function at({
548
+ userId: r,
549
+ name: t,
550
+ email: u,
551
+ initials: i
552
+ }) {
553
+ return /* @__PURE__ */ e(ut, { userId: r, children: /* @__PURE__ */ n(
554
+ "button",
555
+ {
556
+ type: "button",
557
+ "aria-label": `${t} — profile`,
558
+ className: "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
559
+ children: [
560
+ /* @__PURE__ */ e(
561
+ Lt,
562
+ {
563
+ userId: r,
564
+ alt: t,
565
+ className: "h-6 w-6",
566
+ fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80 dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: i })
567
+ }
568
+ ),
569
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
570
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 underline-offset-2 group-hover/owner:underline dark:text-slate-200", children: t }),
571
+ /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children: u })
572
+ ] })
573
+ ]
574
+ }
575
+ ) });
576
+ }
577
+ function Gt({
547
578
  collection: r,
548
579
  item: t,
549
580
  states: u,
550
- currentStateId: l,
581
+ currentStateId: i,
551
582
  returned: q = !1
552
583
  }) {
553
584
  var O, re, F;
554
- const p = fe(), f = Oe(), { isAdmin: N } = Ct(), [P, j] = K(!1), [x, R] = K(""), [C, I] = K(""), [L, B] = K(!1), M = ["pipeline-instance-owners", r, t], U = ["pipeline-owners-can-add", r, t], b = () => p.request(
585
+ const p = fe(), f = Oe(), { isAdmin: N } = $t(), [P, j] = K(!1), [x, R] = K(""), [C, E] = K(""), [L, M] = K(!1), B = ["pipeline-instance-owners", r, t], U = ["pipeline-owners-can-add", r, t], b = () => p.request(
555
586
  ie(`/pipelines/instance/${r}/${t}/owners`)
556
587
  ).then((a) => {
557
588
  var D;
558
589
  return f.setQueryData(U, ((D = a.meta) == null ? void 0 : D.can_add) ?? null), a;
559
- }), { data: S, isLoading: i } = te({
560
- queryKey: M,
590
+ }), { data: S, isLoading: l } = te({
591
+ queryKey: B,
561
592
  queryFn: () => b().then((a) => a.data)
562
593
  }), { data: w } = te({
563
594
  queryKey: U,
@@ -565,16 +596,16 @@ function Ht({
565
596
  var D;
566
597
  return ((D = a.meta) == null ? void 0 : D.can_add) ?? null;
567
598
  }),
568
- enabled: !i,
599
+ enabled: !l,
569
600
  staleTime: 3e4
570
601
  }), s = typeof w == "boolean" ? w : N, { data: v, isLoading: k } = te({
571
602
  queryKey: ["pipeline-all-owners", r, t],
572
603
  queryFn: () => p.request(
573
604
  ie(`/pipelines/instance/${r}/${t}/owners/all`)
574
605
  ).then((a) => a.data ?? null),
575
- enabled: !!l,
606
+ enabled: !!i,
576
607
  staleTime: 3e4
577
- }), A = new Set((S ?? []).map((a) => a.user)), W = l ? (((O = v == null ? void 0 : v[l]) == null ? void 0 : O.owners) ?? []).filter((a) => !A.has(a.id)) : [], c = W.length + ((S == null ? void 0 : S.length) ?? 0), y = !!((re = u.find((a) => a.id === l)) != null && re.is_initial), d = !i && !k, { data: m } = te({
608
+ }), A = new Set((S ?? []).map((a) => a.user)), W = i ? (((O = v == null ? void 0 : v[i]) == null ? void 0 : O.owners) ?? []).filter((a) => !A.has(a.id)) : [], c = W.length + ((S == null ? void 0 : S.length) ?? 0), y = !!((re = u.find((a) => a.id === i)) != null && re.is_initial), d = !l && !k, { data: m } = te({
578
609
  queryKey: ["pipeline-record-creator", r, t],
579
610
  queryFn: () => p.request(
580
611
  ie(`/pipelines/instance/${r}/${t}/creator`)
@@ -582,7 +613,7 @@ function Ht({
582
613
  enabled: y && d && c === 0,
583
614
  staleTime: 6e4
584
615
  }), g = y && c === 0 && (m != null && m.name) ? m : null, _ = () => {
585
- f.invalidateQueries({ queryKey: M }), f.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
616
+ f.invalidateQueries({ queryKey: B }), f.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
586
617
  }, h = xe({
587
618
  mutationFn: () => p.request(
588
619
  be(`/pipelines/instance/${r}/${t}/owners`, {
@@ -591,12 +622,12 @@ function Ht({
591
622
  })
592
623
  ),
593
624
  onSuccess: () => {
594
- _(), R(""), I(""), j(!1), ee.success("Owner added");
625
+ _(), R(""), E(""), j(!1), ee.success("Owner added");
595
626
  },
596
627
  // The server's reason (a 403 says why), not a bare status phrase.
597
628
  onError: (a) => ee.error(he(a, "Failed to add owner"))
598
629
  }), $ = xe({
599
- mutationFn: (a) => p.request(St(`/pipelines/instance-owners/${a.id}`)),
630
+ mutationFn: (a) => p.request(Tt(`/pipelines/instance-owners/${a.id}`)),
600
631
  onSuccess: (a, D) => {
601
632
  _();
602
633
  const H = [D.first_name, D.last_name].filter(Boolean).join(" ") || D.email;
@@ -624,16 +655,16 @@ function Ht({
624
655
  return /* @__PURE__ */ n("div", { children: [
625
656
  /* @__PURE__ */ n("div", { className: "mb-3 flex items-center justify-between", children: [
626
657
  /* @__PURE__ */ n("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
627
- /* @__PURE__ */ e(st, { className: "h-3.5 w-3.5" }),
658
+ /* @__PURE__ */ e(it, { className: "h-3.5 w-3.5" }),
628
659
  "Owners",
629
- i || k ? /* @__PURE__ */ e("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : g ? null : /* @__PURE__ */ n("span", { className: "text-slate-300", children: [
660
+ l || k ? /* @__PURE__ */ e("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : g ? null : /* @__PURE__ */ n("span", { className: "text-slate-300", children: [
630
661
  "(",
631
662
  c,
632
663
  ")"
633
664
  ] })
634
665
  ] }),
635
666
  /* @__PURE__ */ n("span", { className: "flex items-center gap-3", children: [
636
- l && /* @__PURE__ */ e(Lt, { collection: r, itemId: String(t) }),
667
+ i && /* @__PURE__ */ e(Ft, { collection: r, itemId: String(t) }),
637
668
  !P && s && /* @__PURE__ */ n(
638
669
  "button",
639
670
  {
@@ -641,20 +672,28 @@ function Ht({
641
672
  onClick: () => j(!0),
642
673
  className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
643
674
  children: [
644
- /* @__PURE__ */ e(Nt, { className: "h-3 w-3" }),
675
+ /* @__PURE__ */ e(_t, { className: "h-3 w-3" }),
645
676
  "Add"
646
677
  ]
647
678
  }
648
679
  )
649
680
  ] })
650
681
  ] }),
651
- i || k ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
682
+ l || k ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
652
683
  /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }),
653
684
  "Resolving owners…"
654
685
  ] }) : g ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
655
686
  q ? "Back with" : "With",
656
687
  " ",
657
- /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: g.name })
688
+ /* @__PURE__ */ e(ut, { userId: g.id, children: /* @__PURE__ */ e(
689
+ "button",
690
+ {
691
+ type: "button",
692
+ "aria-label": `${g.name} — profile`,
693
+ className: "rounded font-medium text-slate-700 underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-foreground",
694
+ children: g.name
695
+ }
696
+ ) })
658
697
  ] }) : c === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ n("div", { className: "space-y-px", children: [
659
698
  W.map((a) => {
660
699
  var V, Z;
@@ -662,21 +701,9 @@ function Ht({
662
701
  return /* @__PURE__ */ n(
663
702
  "div",
664
703
  {
665
- className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
704
+ className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
666
705
  children: [
667
- /* @__PURE__ */ e(
668
- Mt,
669
- {
670
- userId: a.id,
671
- alt: D,
672
- className: "h-6 w-6",
673
- fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: H })
674
- }
675
- ),
676
- /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
677
- /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: D }),
678
- /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: a.email })
679
- ] }),
706
+ /* @__PURE__ */ e(at, { userId: a.id, name: D, email: a.email, initials: H }),
680
707
  a.queue_only ? /* @__PURE__ */ e(
681
708
  "span",
682
709
  {
@@ -693,13 +720,17 @@ function Ht({
693
720
  (S ?? []).map((a) => /* @__PURE__ */ n(
694
721
  "div",
695
722
  {
696
- className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
723
+ className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
697
724
  children: [
698
- /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: Q(a) }),
699
- /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
700
- /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email }),
701
- /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: a.email })
702
- ] }),
725
+ /* @__PURE__ */ e(
726
+ at,
727
+ {
728
+ userId: a.user,
729
+ name: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email,
730
+ email: a.email,
731
+ initials: Q(a)
732
+ }
733
+ ),
703
734
  /* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
704
735
  /* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: a.state ? J(a.state) : "all states" }),
705
736
  /* @__PURE__ */ e(
@@ -710,7 +741,7 @@ function Ht({
710
741
  disabled: $.isPending,
711
742
  onClick: () => $.mutate(a),
712
743
  className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
713
- children: /* @__PURE__ */ e(it, { className: "h-3 w-3" })
744
+ children: /* @__PURE__ */ e(lt, { className: "h-3 w-3" })
714
745
  }
715
746
  )
716
747
  ]
@@ -720,9 +751,9 @@ function Ht({
720
751
  ] }),
721
752
  P && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
722
753
  /* @__PURE__ */ e("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
723
- /* @__PURE__ */ e(Wt, { value: x, onChange: R }),
724
- N ? /* @__PURE__ */ n(Ee, { open: L, onOpenChange: B, children: [
725
- /* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ n(
754
+ /* @__PURE__ */ e(Vt, { value: x, onChange: R }),
755
+ N ? /* @__PURE__ */ n(Ie, { open: L, onOpenChange: M, children: [
756
+ /* @__PURE__ */ e(Ee, { asChild: !0, children: /* @__PURE__ */ n(
726
757
  "button",
727
758
  {
728
759
  type: "button",
@@ -745,7 +776,7 @@ function Ht({
745
776
  C === a && "font-medium text-slate-800 dark:text-slate-200"
746
777
  ),
747
778
  onClick: () => {
748
- I(a), B(!1);
779
+ E(a), M(!1);
749
780
  },
750
781
  children: D
751
782
  },
@@ -762,7 +793,7 @@ function Ht({
762
793
  variant: "ghost",
763
794
  className: "h-7 text-[12px]",
764
795
  onClick: () => {
765
- j(!1), R(""), I("");
796
+ j(!1), R(""), E("");
766
797
  },
767
798
  children: "Cancel"
768
799
  }
@@ -782,16 +813,16 @@ function Ht({
782
813
  ] })
783
814
  ] });
784
815
  }
785
- const at = {
816
+ const st = {
786
817
  out: "out of office",
787
818
  suspended: "suspended",
788
819
  redacted: "redacted"
789
820
  };
790
- function Vt({
821
+ function Xt({
791
822
  collection: r,
792
823
  item: t,
793
824
  states: u,
794
- currentStateId: l
825
+ currentStateId: i
795
826
  }) {
796
827
  const q = fe(), [p, f] = K(!1), { data: N, isLoading: P } = te({
797
828
  queryKey: ["pipeline-all-owners", r, t],
@@ -804,15 +835,15 @@ function Vt({
804
835
  var R;
805
836
  return !N || ((R = N[x.id]) == null ? void 0 : R.on_path) !== !1;
806
837
  }).sort((x, R) => x.sort - R.sort);
807
- return /* @__PURE__ */ n(Ee, { open: p, onOpenChange: f, children: [
808
- /* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ e(
838
+ return /* @__PURE__ */ n(Ie, { open: p, onOpenChange: f, children: [
839
+ /* @__PURE__ */ e(Ee, { asChild: !0, children: /* @__PURE__ */ e(
809
840
  "button",
810
841
  {
811
842
  type: "button",
812
843
  title: "View approval chain",
813
844
  className: "flex h-6 w-6 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-muted dark:hover:text-slate-300",
814
845
  onClick: (x) => x.stopPropagation(),
815
- children: /* @__PURE__ */ e(st, { className: "h-3.5 w-3.5" })
846
+ children: /* @__PURE__ */ e(it, { className: "h-3.5 w-3.5" })
816
847
  }
817
848
  ) }),
818
849
  /* @__PURE__ */ n(Ue, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
@@ -821,11 +852,11 @@ function Vt({
821
852
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
822
853
  ] }),
823
854
  /* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children: P ? /* @__PURE__ */ e("div", { className: "space-y-px p-3", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(le, { className: "h-10 w-full" }, x)) }) : N ? /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: j.map((x) => {
824
- var U, b, S, i, w;
855
+ var U, b, S, l, w;
825
856
  const R = (((U = N[x.id]) == null ? void 0 : U.owners) ?? []).map((s) => ({
826
857
  id: s.id,
827
858
  name: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email
828
- })), C = x.id === l, I = ((b = N[x.id]) == null ? void 0 : b.skipped) === !0 && !C, L = (((S = N[x.id]) == null ? void 0 : S.skip_reasons) ?? []).filter(Boolean), B = ((i = N[x.id]) == null ? void 0 : i.unavailable) ?? [], M = ((w = N[x.id]) == null ? void 0 : w.blocked) === !0 && !I;
859
+ })), C = x.id === i, E = ((b = N[x.id]) == null ? void 0 : b.skipped) === !0 && !C, L = (((S = N[x.id]) == null ? void 0 : S.skip_reasons) ?? []).filter(Boolean), M = ((l = N[x.id]) == null ? void 0 : l.unavailable) ?? [], B = ((w = N[x.id]) == null ? void 0 : w.blocked) === !0 && !E;
829
860
  return /* @__PURE__ */ n(
830
861
  "div",
831
862
  {
@@ -836,23 +867,23 @@ function Vt({
836
867
  // drops opacity modifiers on it. Kept very light so the
837
868
  // tint doesn't clash with the state badge's own color.
838
869
  C && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
839
- I && "opacity-60",
840
- M && "bg-red-50 dark:bg-red-500/10"
870
+ E && "opacity-60",
871
+ B && "bg-red-50 dark:bg-red-500/10"
841
872
  ),
842
- "data-chain-blocked": M ? "" : void 0,
873
+ "data-chain-blocked": B ? "" : void 0,
843
874
  children: [
844
875
  /* @__PURE__ */ e(oe, { label: x.label, color: x.color, small: !0 }),
845
- /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: I ? (
876
+ /* @__PURE__ */ e("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: E ? (
846
877
  // Radix tooltip with zero delay — native `title` waits on
847
878
  // the OS hover timer, and a truncated reason needs its
848
879
  // full text the moment the cursor lands on it.
849
- /* @__PURE__ */ e(mt, { delayDuration: 0, children: /* @__PURE__ */ n(De, { children: [
880
+ /* @__PURE__ */ e(pt, { delayDuration: 0, children: /* @__PURE__ */ n(De, { children: [
850
881
  /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
851
882
  /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
852
883
  L.length > 0 && /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: L.join(" · ") })
853
884
  ] }) }),
854
885
  /* @__PURE__ */ n(
855
- Me,
886
+ Be,
856
887
  {
857
888
  side: "bottom",
858
889
  align: "start",
@@ -865,11 +896,11 @@ function Vt({
865
896
  )
866
897
  ] }) })
867
898
  ) : /* @__PURE__ */ n(de, { children: [
868
- /* @__PURE__ */ e(jt, { owners: R, max: 10, emptyLabel: "—" }),
869
- B.map((s) => /* @__PURE__ */ n(
899
+ /* @__PURE__ */ e(Mt, { owners: R, max: 10, emptyLabel: "—" }),
900
+ M.map((s) => /* @__PURE__ */ n(
870
901
  "span",
871
902
  {
872
- "data-tip": `${s.name} is ${at[s.reason] ?? s.reason}${s.delegate ? ` — ${s.delegate.name} covers${s.delegate.expires_at ? ` until ${new Date(s.delegate.expires_at).toLocaleDateString()}` : ""}` : " and nobody is covering"}`,
903
+ "data-tip": `${s.name} is ${st[s.reason] ?? s.reason}${s.delegate ? ` — ${s.delegate.name} covers${s.delegate.expires_at ? ` until ${new Date(s.delegate.expires_at).toLocaleDateString()}` : ""}` : " and nobody is covering"}`,
873
904
  className: ge(
874
905
  "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
875
906
  s.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
@@ -893,13 +924,13 @@ function Vt({
893
924
  ] }) : /* @__PURE__ */ n("span", { className: "opacity-80", children: [
894
925
  " ",
895
926
  "· ",
896
- at[s.reason] ?? s.reason
927
+ st[s.reason] ?? s.reason
897
928
  ] })
898
929
  ]
899
930
  },
900
931
  s.id
901
932
  )),
902
- M && /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
933
+ B && /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
903
934
  ] }) })
904
935
  ]
905
936
  },
@@ -909,11 +940,11 @@ function Vt({
909
940
  ] })
910
941
  ] });
911
942
  }
912
- function _n({
943
+ function $n({
913
944
  collection: r,
914
945
  item: t,
915
946
  defaultExpanded: u,
916
- title: l,
947
+ title: i,
917
948
  showApprovalChain: q,
918
949
  hideActionsCollapsed: p,
919
950
  hideActionsExpanded: f,
@@ -923,12 +954,12 @@ function _n({
923
954
  asRole: x
924
955
  }) {
925
956
  return t === "new" ? null : /* @__PURE__ */ e(
926
- Gt,
957
+ Jt,
927
958
  {
928
959
  collection: r,
929
960
  item: t,
930
961
  defaultExpanded: u,
931
- title: l,
962
+ title: i,
932
963
  showApprovalChain: q,
933
964
  hideActionsCollapsed: p,
934
965
  hideActionsExpanded: f,
@@ -940,14 +971,14 @@ function _n({
940
971
  `${r}:${t}`
941
972
  );
942
973
  }
943
- function gt({ collection: r, item: t }) {
944
- const u = fe(), { data: l } = te({
974
+ function wt({ collection: r, item: t }) {
975
+ const u = fe(), { data: i } = te({
945
976
  queryKey: ["approval-brief", r, String(t)],
946
977
  queryFn: () => u.request(ie(`/pipelines/instance/${r}/${t}/approval-brief`)).then((p) => p.data),
947
978
  staleTime: 3e4,
948
979
  retry: !1
949
980
  });
950
- if (!l) return null;
981
+ if (!i) return null;
951
982
  const q = (p) => {
952
983
  if (p == null || p === "") return "—";
953
984
  const f = String(p);
@@ -958,34 +989,34 @@ function gt({ collection: r, item: t }) {
958
989
  /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
959
990
  " ",
960
991
  "(",
961
- l.days_in_state,
992
+ i.days_in_state,
962
993
  "d ago):",
963
994
  " ",
964
- l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ n(de, { children: [
965
- l.changed_total > 0 && /* @__PURE__ */ n("span", { children: [
966
- l.changed_total,
995
+ i.changed_total === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ n(de, { children: [
996
+ i.changed_total > 0 && /* @__PURE__ */ n("span", { children: [
997
+ i.changed_total,
967
998
  " field",
968
- l.changed_total === 1 ? "" : "s",
999
+ i.changed_total === 1 ? "" : "s",
969
1000
  " changed",
970
- l.edited_by.length > 0 ? ` by ${l.edited_by.join(", ")}` : ""
1001
+ i.edited_by.length > 0 ? ` by ${i.edited_by.join(", ")}` : ""
971
1002
  ] }),
972
- l.comments > 0 && /* @__PURE__ */ n("span", { children: [
973
- l.changed_total > 0 ? " · " : "",
974
- l.comments,
1003
+ i.comments > 0 && /* @__PURE__ */ n("span", { children: [
1004
+ i.changed_total > 0 ? " · " : "",
1005
+ i.comments,
975
1006
  " comment",
976
- l.comments === 1 ? "" : "s"
1007
+ i.comments === 1 ? "" : "s"
977
1008
  ] }),
978
- l.addendums.count > 0 && /* @__PURE__ */ n("span", { children: [
1009
+ i.addendums.count > 0 && /* @__PURE__ */ n("span", { children: [
979
1010
  " · ",
980
- l.addendums.count,
1011
+ i.addendums.count,
981
1012
  " addendum",
982
- l.addendums.count === 1 ? "" : "s",
983
- l.addendums.cost_impact !== 0 ? ` (${l.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(l.addendums.cost_impact).toLocaleString()})` : ""
1013
+ i.addendums.count === 1 ? "" : "s",
1014
+ i.addendums.cost_impact !== 0 ? ` (${i.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(i.addendums.cost_impact).toLocaleString()})` : ""
984
1015
  ] })
985
1016
  ] })
986
1017
  ] }),
987
- l.field_changes.length > 0 && /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
988
- l.field_changes.slice(0, 5).map((p) => /* @__PURE__ */ n(
1018
+ i.field_changes.length > 0 && /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
1019
+ i.field_changes.slice(0, 5).map((p) => /* @__PURE__ */ n(
989
1020
  "p",
990
1021
  {
991
1022
  className: "font-mono text-[10.5px] text-slate-500 dark:text-muted-foreground",
@@ -1002,13 +1033,13 @@ function gt({ collection: r, item: t }) {
1002
1033
  },
1003
1034
  p.field
1004
1035
  )),
1005
- l.field_changes.length > 5 && /* @__PURE__ */ n("p", { className: "text-[10.5px] text-slate-400", children: [
1036
+ i.field_changes.length > 5 && /* @__PURE__ */ n("p", { className: "text-[10.5px] text-slate-400", children: [
1006
1037
  "+",
1007
- l.field_changes.length - 5,
1038
+ i.field_changes.length - 5,
1008
1039
  " more — see History for the full trail"
1009
1040
  ] })
1010
1041
  ] }),
1011
- (l.lines ?? []).map((p) => /* @__PURE__ */ n(
1042
+ (i.lines ?? []).map((p) => /* @__PURE__ */ n(
1012
1043
  "p",
1013
1044
  {
1014
1045
  "data-brief-line": p.label,
@@ -1029,11 +1060,11 @@ function gt({ collection: r, item: t }) {
1029
1060
  ))
1030
1061
  ] });
1031
1062
  }
1032
- function Gt({
1063
+ function Jt({
1033
1064
  collection: r,
1034
1065
  item: t,
1035
1066
  defaultExpanded: u,
1036
- title: l,
1067
+ title: i,
1037
1068
  showApprovalChain: q,
1038
1069
  hideActionsCollapsed: p,
1039
1070
  hideActionsExpanded: f,
@@ -1043,11 +1074,11 @@ function Gt({
1043
1074
  asRole: x
1044
1075
  }) {
1045
1076
  var We, He, Ve;
1046
- const R = fe(), C = Oe(), [I, L] = K(""), [B, M] = K(null), [U, b] = K(!1), [S, i] = K(!1), [w, s] = K(null);
1047
- dt(r, t, "transition", !!B || !!w);
1048
- const v = $t(r, t, "transition"), k = ne(!1);
1077
+ const R = fe(), C = Oe(), [E, L] = K(""), [M, B] = K(null), [U, b] = K(!1), [S, l] = K(!1), [w, s] = K(null);
1078
+ ct(r, t, "transition", !!M || !!w);
1079
+ const v = qt(r, t, "transition"), k = ne(!1);
1049
1080
  ue(() => {
1050
- !k.current && u !== void 0 && (k.current = !0, i(u));
1081
+ !k.current && u !== void 0 && (k.current = !0, l(u));
1051
1082
  }, [u]);
1052
1083
  const A = ne(!1), W = (o) => {
1053
1084
  A.current || (A.current = !0, J.mutate(o, {
@@ -1057,8 +1088,8 @@ function Gt({
1057
1088
  }));
1058
1089
  }, c = async (o) => {
1059
1090
  if (A.current) return;
1060
- if (B === o) {
1061
- M(null);
1091
+ if (M === o) {
1092
+ B(null);
1062
1093
  return;
1063
1094
  }
1064
1095
  if (N) {
@@ -1071,12 +1102,12 @@ function Gt({
1071
1102
  }
1072
1103
  if (!z) return;
1073
1104
  }
1074
- const T = (a ?? []).find((z) => z.id === o), E = String((T == null ? void 0 : T.comment_mode) ?? "none");
1075
- if (E !== "optional" && E !== "required") {
1105
+ const T = (a ?? []).find((z) => z.id === o), I = String((T == null ? void 0 : T.comment_mode) ?? "none");
1106
+ if (I !== "optional" && I !== "required") {
1076
1107
  W({ transition_id: o });
1077
1108
  return;
1078
1109
  }
1079
- M(o);
1110
+ B(o);
1080
1111
  }, y = x ? ["pipeline-instance", r, t, x] : ["pipeline-instance", r, t], { data: d, isLoading: m } = te({
1081
1112
  queryKey: y,
1082
1113
  queryFn: () => R.request(
@@ -1117,8 +1148,8 @@ function Gt({
1117
1148
  }, [g]), $ = et(() => {
1118
1149
  if (!g) return null;
1119
1150
  const o = /* @__PURE__ */ new Map();
1120
- for (const [T, E] of Object.entries(g))
1121
- E.skipped && o.set(T, E.skip_reasons ?? []);
1151
+ for (const [T, I] of Object.entries(g))
1152
+ I.skipped && o.set(T, I.skip_reasons ?? []);
1122
1153
  return o;
1123
1154
  }, [g]), Q = xe({
1124
1155
  mutationFn: () => R.request(be(`/pipelines/instance/${r}/${t}/start`, {})),
@@ -1130,26 +1161,26 @@ function Gt({
1130
1161
  mutationFn: ({
1131
1162
  transition_id: o,
1132
1163
  comment: T,
1133
- reviewed: E
1164
+ reviewed: I
1134
1165
  }) => R.request(
1135
1166
  be(`/pipelines/instance/${r}/${t}/transition`, {
1136
1167
  transition_id: o,
1137
1168
  comment: T,
1138
- ...E ? { reviewed: !0 } : {}
1169
+ ...I ? { reviewed: !0 } : {}
1139
1170
  })
1140
1171
  ),
1141
1172
  onSuccess: () => {
1142
- C.invalidateQueries({ queryKey: y }), r === "nivaro_addendums" && C.invalidateQueries({ queryKey: ["addendums"] }), ke(C, r, String(t)), _e(C, r, String(t)), L(""), M(null), s(null), ee.success("Transition executed");
1173
+ C.invalidateQueries({ queryKey: y }), r === "nivaro_addendums" && C.invalidateQueries({ queryKey: ["addendums"] }), ke(C, r, String(t)), _e(C, r, String(t)), L(""), B(null), s(null), ee.success("Transition executed");
1143
1174
  },
1144
1175
  onError: (o, T) => {
1145
- if (xt(o)) {
1176
+ if (gt(o)) {
1146
1177
  C.invalidateQueries({ queryKey: y });
1147
1178
  return;
1148
1179
  }
1149
- const E = bt(o);
1150
- if (E) {
1180
+ const I = yt(o);
1181
+ if (I) {
1151
1182
  s((G) => ({
1152
- payload: E,
1183
+ payload: I,
1153
1184
  transitionId: T.transition_id,
1154
1185
  comment: T.comment,
1155
1186
  revision: ((G == null ? void 0 : G.revision) ?? 0) + 1
@@ -1161,25 +1192,25 @@ function Gt({
1161
1192
  duration: 12e3,
1162
1193
  // #1867: a refusal carries "Why?" — the role, owner or access rule
1163
1194
  // that stopped it, and who can change it.
1164
- ...ut(o) ? {
1165
- action: pt(R, {
1195
+ ...ft(o) ? {
1196
+ action: ht(R, {
1166
1197
  collection: r,
1167
1198
  itemId: String(t),
1168
1199
  action: "transition",
1169
1200
  transitionId: T.transition_id
1170
1201
  })
1171
1202
  } : {}
1172
- }), s(null), M(null), ke(C, r, String(t)), _e(C, r, String(t)), (z == null ? void 0 : z.status) === 409 && C.invalidateQueries({ queryKey: y });
1203
+ }), s(null), B(null), ke(C, r, String(t)), _e(C, r, String(t)), (z == null ? void 0 : z.status) === 409 && C.invalidateQueries({ queryKey: y });
1173
1204
  }
1174
1205
  }), O = ne(c);
1175
1206
  O.current = c;
1176
1207
  const re = ne((d == null ? void 0 : d.available_transitions) ?? []);
1177
1208
  if (re.current = (d == null ? void 0 : d.available_transitions) ?? [], ue(() => {
1178
1209
  const o = (T) => {
1179
- const E = T.detail;
1180
- if (!E || E.claimed || E.collection !== r || String(E.item) !== String(t)) return;
1181
- E.claimed = !0;
1182
- const z = String(E.transition_id).toUpperCase(), G = re.current.find((ce) => String(ce.id).toUpperCase() === z);
1210
+ const I = T.detail;
1211
+ if (!I || I.claimed || I.collection !== r || String(I.item) !== String(t)) return;
1212
+ I.claimed = !0;
1213
+ const z = String(I.transition_id).toUpperCase(), G = re.current.find((ce) => String(ce.id).toUpperCase() === z);
1183
1214
  if (!G) {
1184
1215
  ee.error("That step is not available from where the record is now");
1185
1216
  return;
@@ -1195,17 +1226,17 @@ function Gt({
1195
1226
  /* @__PURE__ */ e(le, { className: "ml-auto h-3.5 w-3.5 rounded" })
1196
1227
  ] }) });
1197
1228
  if (!(d != null && d.binding)) return null;
1198
- const { instance: F, available_transitions: a, history: D, states: H } = d, V = new Map((H ?? []).map((o) => [o.id, o])), Z = (F == null ? void 0 : F.current_state_obj) ?? null, ae = B ? (a ?? []).find((o) => o.id === B) : null, Se = ae ? V.get(ae.to_state) : null, yt = F != null && F.completed_at && a ? a.filter(
1229
+ const { instance: F, available_transitions: a, history: D, states: H } = d, V = new Map((H ?? []).map((o) => [o.id, o])), Z = (F == null ? void 0 : F.current_state_obj) ?? null, ae = M ? (a ?? []).find((o) => o.id === M) : null, Se = ae ? V.get(ae.to_state) : null, vt = F != null && F.completed_at && a ? a.filter(
1199
1230
  (o) => o.from_state && String(o.from_state).toUpperCase() === String(F.current_state).toUpperCase()
1200
- ) : null, $e = F != null && F.completed_at ? yt ?? [] : a ?? [], Qe = $e.length > 0, ze = (o, T = !1) => {
1201
- const E = /* @__PURE__ */ new Map();
1231
+ ) : null, $e = F != null && F.completed_at ? vt ?? [] : a ?? [], Qe = $e.length > 0, ze = (o, T = !1) => {
1232
+ const I = /* @__PURE__ */ new Map();
1202
1233
  for (const z of o) {
1203
- const G = E.get(z.label) ?? [];
1204
- G.push(z), E.set(z.label, G);
1234
+ const G = I.get(z.label) ?? [];
1235
+ G.push(z), I.set(z.label, G);
1205
1236
  }
1206
- return Array.from(E.entries()).map(([z, G]) => {
1237
+ return Array.from(I.entries()).map(([z, G]) => {
1207
1238
  var Xe, Je;
1208
- const ce = ((Xe = G[0]) == null ? void 0 : Xe.color) ?? null, ye = G.some((X) => X.id === B), Ge = (X) => ce ? X ? { backgroundColor: ce, borderColor: ce } : { borderColor: ce, color: ce } : void 0;
1239
+ const ce = ((Xe = G[0]) == null ? void 0 : Xe.color) ?? null, ye = G.some((X) => X.id === M), Ge = (X) => ce ? X ? { backgroundColor: ce, borderColor: ce } : { borderColor: ce, color: ce } : void 0;
1209
1240
  if (G.length === 1) {
1210
1241
  const X = G[0], pe = J.isPending && ((Je = J.variables) == null ? void 0 : Je.transition_id) === X.id;
1211
1242
  return /* @__PURE__ */ n(
@@ -1270,12 +1301,12 @@ function Gt({
1270
1301
  /* @__PURE__ */ e(oe, { label: Se.label, color: Se.color, small: !0 })
1271
1302
  ] })
1272
1303
  ] }),
1273
- /* @__PURE__ */ e(gt, { collection: r, item: t }),
1304
+ /* @__PURE__ */ e(wt, { collection: r, item: t }),
1274
1305
  /* @__PURE__ */ e(
1275
1306
  "input",
1276
1307
  {
1277
1308
  type: "text",
1278
- value: I,
1309
+ value: E,
1279
1310
  onChange: (o) => L(o.target.value),
1280
1311
  placeholder: String((ae == null ? void 0 : ae.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
1281
1312
  className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
@@ -1289,7 +1320,7 @@ function Gt({
1289
1320
  size: "sm",
1290
1321
  variant: "ghost",
1291
1322
  className: "h-7 text-[12px]",
1292
- onClick: () => M(null),
1323
+ onClick: () => B(null),
1293
1324
  children: "Cancel"
1294
1325
  }
1295
1326
  ),
@@ -1299,10 +1330,10 @@ function Gt({
1299
1330
  type: "button",
1300
1331
  size: "sm",
1301
1332
  className: "h-7 gap-1.5 text-[12px]",
1302
- disabled: J.isPending || String((ae == null ? void 0 : ae.comment_mode) ?? "") === "required" && I.trim() === "",
1333
+ disabled: J.isPending || String((ae == null ? void 0 : ae.comment_mode) ?? "") === "required" && E.trim() === "",
1303
1334
  onClick: () => W({
1304
- transition_id: B,
1305
- comment: I.trim() || void 0
1335
+ transition_id: M,
1336
+ comment: E.trim() || void 0
1306
1337
  }),
1307
1338
  children: J.isPending ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(de, { children: [
1308
1339
  /* @__PURE__ */ e("span", { children: "Confirm" }),
@@ -1323,12 +1354,12 @@ function Gt({
1323
1354
  {
1324
1355
  role: "button",
1325
1356
  tabIndex: 0,
1326
- onClick: () => i((o) => !o),
1327
- onKeyDown: (o) => (o.key === "Enter" || o.key === " ") && i((T) => !T),
1357
+ onClick: () => l((o) => !o),
1358
+ onKeyDown: (o) => (o.key === "Enter" || o.key === " ") && l((T) => !T),
1328
1359
  className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
1329
1360
  children: [
1330
1361
  /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
1331
- /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: l || "Pipeline" }),
1362
+ /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: i || "Pipeline" }),
1332
1363
  /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
1333
1364
  j && /* @__PURE__ */ e("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
1334
1365
  Z && /* @__PURE__ */ e(oe, { label: Z.label, color: Z.color }),
@@ -1340,7 +1371,7 @@ function Gt({
1340
1371
  `),
1341
1372
  "data-pipeline-auto-held-pill": !0,
1342
1373
  children: [
1343
- /* @__PURE__ */ e(wt, { className: "h-3 w-3 shrink-0" }),
1374
+ /* @__PURE__ */ e(Nt, { className: "h-3 w-3 shrink-0" }),
1344
1375
  "Needs a person"
1345
1376
  ]
1346
1377
  }
@@ -1356,7 +1387,7 @@ function Gt({
1356
1387
  "data-pipeline-approving": !0,
1357
1388
  children: [
1358
1389
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
1359
- Tt(v, "approving")
1390
+ Pt(v, "approving")
1360
1391
  ]
1361
1392
  }
1362
1393
  )
@@ -1380,7 +1411,7 @@ function Gt({
1380
1411
  }
1381
1412
  ),
1382
1413
  q && ((d == null ? void 0 : d.binding) || (d == null ? void 0 : d.instance)) && /* @__PURE__ */ e(
1383
- Vt,
1414
+ Xt,
1384
1415
  {
1385
1416
  collection: r,
1386
1417
  item: t,
@@ -1401,9 +1432,9 @@ function Gt({
1401
1432
  ]
1402
1433
  }
1403
1434
  ),
1404
- !S && B && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ke }),
1435
+ !S && M && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ke }),
1405
1436
  S && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
1406
- /* @__PURE__ */ e(Ut, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
1437
+ /* @__PURE__ */ e(zt, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
1407
1438
  P && /* @__PURE__ */ n("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
1408
1439
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
1409
1440
  /* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
@@ -1423,7 +1454,7 @@ function Gt({
1423
1454
  /* @__PURE__ */ e(le, { className: "ml-2 h-3 w-24" })
1424
1455
  ] })
1425
1456
  ) : /* @__PURE__ */ e(
1426
- zt,
1457
+ Wt,
1427
1458
  {
1428
1459
  states: H,
1429
1460
  allTransitions: (d == null ? void 0 : d.all_transitions) ?? [],
@@ -1434,9 +1465,9 @@ function Gt({
1434
1465
  skippedStates: $
1435
1466
  }
1436
1467
  ),
1437
- (d == null ? void 0 : d.branches) && /* @__PURE__ */ e(Ot, { data: d.branches }),
1468
+ (d == null ? void 0 : d.branches) && /* @__PURE__ */ e(It, { data: d.branches }),
1438
1469
  /* @__PURE__ */ e(
1439
- Qt,
1470
+ Kt,
1440
1471
  {
1441
1472
  history: D ?? [],
1442
1473
  completedAt: F.completed_at
@@ -1444,9 +1475,9 @@ function Gt({
1444
1475
  )
1445
1476
  ] }),
1446
1477
  /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
1447
- !F.completed_at && /* @__PURE__ */ e(Ft, { collection: r, itemId: String(t) }),
1478
+ !F.completed_at && /* @__PURE__ */ e(Et, { collection: r, itemId: String(t) }),
1448
1479
  /* @__PURE__ */ e(
1449
- Ht,
1480
+ Gt,
1450
1481
  {
1451
1482
  collection: r,
1452
1483
  item: t,
@@ -1463,7 +1494,7 @@ function Gt({
1463
1494
  ] }),
1464
1495
  Qe && !f && /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
1465
1496
  /* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: ze($e) }),
1466
- B && Ke
1497
+ M && Ke
1467
1498
  ] }),
1468
1499
  /* @__PURE__ */ n("div", { className: "px-5 py-3", children: [
1469
1500
  /* @__PURE__ */ n(
@@ -1492,7 +1523,7 @@ function Gt({
1492
1523
  ]
1493
1524
  }
1494
1525
  ),
1495
- U && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(Kt, { history: D ?? [] }) })
1526
+ U && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(Ht, { history: D ?? [] }) })
1496
1527
  ] })
1497
1528
  ] }) : /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
1498
1529
  /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
@@ -1515,8 +1546,8 @@ function Gt({
1515
1546
  ]
1516
1547
  }
1517
1548
  ),
1518
- w && /* @__PURE__ */ e(ot, { fallback: null, children: /* @__PURE__ */ e(
1519
- ft,
1549
+ w && /* @__PURE__ */ e(dt, { fallback: null, children: /* @__PURE__ */ e(
1550
+ xt,
1520
1551
  {
1521
1552
  payload: w.payload,
1522
1553
  isRetry: w.revision > 1,
@@ -1537,37 +1568,37 @@ function Gt({
1537
1568
  ) })
1538
1569
  ] });
1539
1570
  }
1540
- function Cn({
1571
+ function Tn({
1541
1572
  collection: r,
1542
1573
  item: t,
1543
1574
  onBeforeTransition: u,
1544
- wrap: l = !0
1575
+ wrap: i = !0
1545
1576
  }) {
1546
1577
  return t === "new" ? null : /* @__PURE__ */ e(
1547
- Xt,
1578
+ Zt,
1548
1579
  {
1549
1580
  collection: r,
1550
1581
  item: t,
1551
1582
  onBeforeTransition: u,
1552
- wrap: l
1583
+ wrap: i
1553
1584
  }
1554
1585
  );
1555
1586
  }
1556
- function Xt({
1587
+ function Zt({
1557
1588
  collection: r,
1558
1589
  item: t,
1559
1590
  onBeforeTransition: u,
1560
- wrap: l = !0
1591
+ wrap: i = !0
1561
1592
  }) {
1562
1593
  const q = fe(), p = Oe(), [f, N] = K(""), [P, j] = K(null), [x, R] = K(null);
1563
- dt(r, t, "transition", !!P || !!x);
1564
- const C = ne(null), I = Dt(C, !l), L = ne(!1), B = (m) => {
1594
+ ct(r, t, "transition", !!P || !!x);
1595
+ const C = ne(null), E = Bt(C, !i), L = ne(!1), M = (m) => {
1565
1596
  L.current || (L.current = !0, S.mutate(m, {
1566
1597
  onSettled: () => {
1567
1598
  L.current = !1;
1568
1599
  }
1569
1600
  }));
1570
- }, M = async (m) => {
1601
+ }, B = async (m) => {
1571
1602
  if (L.current) return;
1572
1603
  if (P === m) {
1573
1604
  j(null);
@@ -1585,7 +1616,7 @@ function Xt({
1585
1616
  }
1586
1617
  const g = (s ?? []).find((h) => h.id === m), _ = String((g == null ? void 0 : g.comment_mode) ?? "none");
1587
1618
  if (_ !== "optional" && _ !== "required") {
1588
- B({ transition_id: m });
1619
+ M({ transition_id: m });
1589
1620
  return;
1590
1621
  }
1591
1622
  j(m);
@@ -1620,11 +1651,11 @@ function Xt({
1620
1651
  p.invalidateQueries({ queryKey: U }), r === "nivaro_addendums" && p.invalidateQueries({ queryKey: ["addendums"] }), ke(p, r, String(t)), _e(p, r, String(t)), N(""), j(null), R(null), ee.success("Transition executed");
1621
1652
  },
1622
1653
  onError: (m, g) => {
1623
- if (xt(m)) {
1654
+ if (gt(m)) {
1624
1655
  p.invalidateQueries({ queryKey: U });
1625
1656
  return;
1626
1657
  }
1627
- const _ = bt(m);
1658
+ const _ = yt(m);
1628
1659
  if (_) {
1629
1660
  R(($) => ({
1630
1661
  payload: _,
@@ -1639,8 +1670,8 @@ function Xt({
1639
1670
  duration: 12e3,
1640
1671
  // #1867: a refusal carries "Why?" — the role, owner or access rule
1641
1672
  // that stopped it, and who can change it.
1642
- ...ut(m) ? {
1643
- action: pt(q, {
1673
+ ...ft(m) ? {
1674
+ action: ht(q, {
1644
1675
  collection: r,
1645
1676
  itemId: String(t),
1646
1677
  action: "transition",
@@ -1649,8 +1680,8 @@ function Xt({
1649
1680
  } : {}
1650
1681
  }), R(null), j(null), ke(p, r, String(t)), _e(p, r, String(t)), (h == null ? void 0 : h.status) === 409 && p.invalidateQueries({ queryKey: U });
1651
1682
  }
1652
- }), i = ne(M);
1653
- i.current = M;
1683
+ }), l = ne(B);
1684
+ l.current = B;
1654
1685
  const w = ne((b == null ? void 0 : b.available_transitions) ?? []);
1655
1686
  if (w.current = (b == null ? void 0 : b.available_transitions) ?? [], ue(() => {
1656
1687
  const m = (g) => {
@@ -1662,7 +1693,7 @@ function Xt({
1662
1693
  ee.error("That step is not available from where the record is now");
1663
1694
  return;
1664
1695
  }
1665
- i.current($.id);
1696
+ l.current($.id);
1666
1697
  };
1667
1698
  return window.addEventListener(Ne, m), () => window.removeEventListener(Ne, m);
1668
1699
  }, [r, t]), !(b != null && b.binding) || !(b != null && b.instance)) return null;
@@ -1688,7 +1719,7 @@ function Xt({
1688
1719
  return Math.max(260, Math.min(600, m.right - ((g == null ? void 0 : g.left) ?? 0) - 12));
1689
1720
  })();
1690
1721
  return /* @__PURE__ */ n("div", { ref: C, className: "relative", children: [
1691
- I ? /* @__PURE__ */ n(Pe, { children: [
1722
+ E ? /* @__PURE__ */ n(Pe, { children: [
1692
1723
  /* @__PURE__ */ e(Ae, { asChild: !0, children: /* @__PURE__ */ n(
1693
1724
  Y,
1694
1725
  {
@@ -1707,7 +1738,7 @@ function Xt({
1707
1738
  /* @__PURE__ */ e(Re, { align: "end", className: "min-w-[200px]", children: Array.from(c.entries()).map(
1708
1739
  ([m, g], _, h) => g.length === 1 ? /* @__PURE__ */ n(tt, { children: [
1709
1740
  _ > 0 && h[_ - 1][1].length > 1 && /* @__PURE__ */ e(nt, {}),
1710
- /* @__PURE__ */ n(we, { onSelect: () => M(g[0].id), children: [
1741
+ /* @__PURE__ */ n(we, { onSelect: () => B(g[0].id), children: [
1711
1742
  g[0].color && /* @__PURE__ */ e(
1712
1743
  "span",
1713
1744
  {
@@ -1719,10 +1750,10 @@ function Xt({
1719
1750
  ] })
1720
1751
  ] }, m) : /* @__PURE__ */ n(tt, { children: [
1721
1752
  _ > 0 && /* @__PURE__ */ e(nt, {}),
1722
- /* @__PURE__ */ e(Bt, { className: "text-[11px] text-muted-foreground", children: m }),
1753
+ /* @__PURE__ */ e(Ot, { className: "text-[11px] text-muted-foreground", children: m }),
1723
1754
  y(g).map(($) => {
1724
1755
  var Q;
1725
- return /* @__PURE__ */ n(we, { onSelect: () => M($.id), children: [
1756
+ return /* @__PURE__ */ n(we, { onSelect: () => B($.id), children: [
1726
1757
  $.color && /* @__PURE__ */ e(
1727
1758
  "span",
1728
1759
  {
@@ -1738,7 +1769,7 @@ function Xt({
1738
1769
  ] }) : /* @__PURE__ */ e(
1739
1770
  "div",
1740
1771
  {
1741
- className: l ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
1772
+ className: i ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
1742
1773
  children: Array.from(c.entries()).map(([m, g]) => {
1743
1774
  var Q, J;
1744
1775
  const _ = ((Q = g[0]) == null ? void 0 : Q.color) ?? null, h = g.some((O) => O.id === P), $ = (O) => _ ? O ? { backgroundColor: _, borderColor: _ } : { borderColor: _, color: _ } : void 0;
@@ -1751,7 +1782,7 @@ function Xt({
1751
1782
  className: "gap-1.5 text-[12px]",
1752
1783
  style: $(h),
1753
1784
  disabled: S.isPending,
1754
- onClick: () => M(O.id),
1785
+ onClick: () => B(O.id),
1755
1786
  children: [
1756
1787
  re && /* @__PURE__ */ e(se, { className: "h-3 w-3 animate-spin" }),
1757
1788
  m
@@ -1762,7 +1793,7 @@ function Xt({
1762
1793
  return O.pushes && O.pushes > 0 ? /* @__PURE__ */ n("span", { className: "relative inline-flex", children: [
1763
1794
  F,
1764
1795
  /* @__PURE__ */ e(
1765
- Rt,
1796
+ jt,
1766
1797
  {
1767
1798
  collection: r,
1768
1799
  itemId: t,
@@ -1790,7 +1821,7 @@ function Xt({
1790
1821
  ) }),
1791
1822
  /* @__PURE__ */ e(Re, { align: "start", children: y(g).map((O) => {
1792
1823
  var re;
1793
- return /* @__PURE__ */ n(we, { onSelect: () => M(O.id), children: [
1824
+ return /* @__PURE__ */ n(we, { onSelect: () => B(O.id), children: [
1794
1825
  O.color && /* @__PURE__ */ e(
1795
1826
  "span",
1796
1827
  {
@@ -1820,7 +1851,7 @@ function Xt({
1820
1851
  /* @__PURE__ */ e(oe, { label: W.label, color: W.color, small: !0 })
1821
1852
  ] })
1822
1853
  ] }),
1823
- /* @__PURE__ */ e(gt, { collection: r, item: t }),
1854
+ /* @__PURE__ */ e(wt, { collection: r, item: t }),
1824
1855
  /* @__PURE__ */ e(
1825
1856
  "input",
1826
1857
  {
@@ -1850,7 +1881,7 @@ function Xt({
1850
1881
  size: "sm",
1851
1882
  className: "h-7 gap-1.5 text-[12px]",
1852
1883
  disabled: S.isPending || String((A == null ? void 0 : A.comment_mode) ?? "") === "required" && f.trim() === "",
1853
- onClick: () => B({
1884
+ onClick: () => M({
1854
1885
  transition_id: P,
1855
1886
  comment: f.trim() || void 0
1856
1887
  }),
@@ -1864,8 +1895,8 @@ function Xt({
1864
1895
  ]
1865
1896
  }
1866
1897
  ),
1867
- x && /* @__PURE__ */ e(ot, { fallback: null, children: /* @__PURE__ */ e(
1868
- ft,
1898
+ x && /* @__PURE__ */ e(dt, { fallback: null, children: /* @__PURE__ */ e(
1899
+ xt,
1869
1900
  {
1870
1901
  payload: x.payload,
1871
1902
  isRetry: x.revision > 1,
@@ -1887,8 +1918,8 @@ function Xt({
1887
1918
  ] });
1888
1919
  }
1889
1920
  export {
1890
- _n as PipelinePanel,
1891
- Cn as PipelineTransitionButtons,
1892
- xt as isDuplicateTransition,
1893
- bt as transitionRequirementsFromError
1921
+ $n as PipelinePanel,
1922
+ Tn as PipelineTransitionButtons,
1923
+ gt as isDuplicateTransition,
1924
+ yt as transitionRequirementsFromError
1894
1925
  };