@nivaro/react 0.3.104 → 0.3.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,33 @@
1
- var Kn = Object.defineProperty;
2
- var Wn = (t, e, r) => e in t ? Kn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var lt = (t, e, r) => Wn(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { jsx as n, jsxs as i, Fragment as Se } from "react/jsx-runtime";
5
- import { useQueryClient as Ve, useQuery as be, useMutation as Qe } from "@tanstack/react-query";
6
- import { ArrowRight as Nt, Loader2 as ye, Check as rt, GitBranch as dt, AlertTriangle as Vt, ChevronDown as Fe, Send as Xt, Users as Yt, Undo2 as zn, Minus as Hn, UserPlus as Gn, X as Jt, Zap as Zt, Search as Vn } from "lucide-react";
7
- import { useState as Q, useRef as ce, useEffect as _e, useMemo as et, Suspense as en, useCallback as tn, lazy as Xn, Fragment as Yn } from "react";
8
- import { toast as V } from "sonner";
9
- import { useNivaroClient as Pe, useItemEditAuth as nn } from "../../context.js";
10
- import { get as we, post as Ge, del as Jn } from "../../lib/commands.js";
11
- import { errorToastOptions as rn, toastError as Zn } from "../../lib/error-toast.js";
1
+ var Qn = Object.defineProperty;
2
+ var Kn = (t, e, r) => e in t ? Qn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var lt = (t, e, r) => Kn(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { jsx as n, jsxs as s, Fragment as Se } from "react/jsx-runtime";
5
+ import { useQueryClient as Ve, useQuery as xe, useMutation as je } from "@tanstack/react-query";
6
+ import { ArrowRight as Nt, Loader2 as we, Check as rt, GitBranch as dt, AlertTriangle as Vt, ChevronDown as Pe, Send as Xt, Users as Yt, Undo2 as Wn, Minus as zn, UserPlus as Hn, X as Jt, Zap as Zt, Search as Gn } from "lucide-react";
7
+ import { useState as G, useRef as fe, useEffect as Te, useMemo as et, Suspense as en, useCallback as tn, lazy as Vn, Fragment as Xn } from "react";
8
+ import { toast as X } from "sonner";
9
+ import { useNivaroClient as Re, useItemEditAuth as nn } from "../../context.js";
10
+ import { get as ke, post as Ge, del as Yn } from "../../lib/commands.js";
11
+ import { errorToastOptions as rn, toastError as Jn } from "../../lib/error-toast.js";
12
12
  import { partnerMoveFailure as an, partnerMoveReading as sn } from "../../lib/move-failure.js";
13
- import { OPEN_MOVE_STATE_EVENT as Lt } from "../../lib/move-state.js";
14
- import { useRecordSignalWhile as on, useRecordSignalPeers as er, signalSentence as tr } from "../../lib/presence-signals.js";
13
+ import { OPEN_MOVE_STATE_EVENT as Et } from "../../lib/move-state.js";
14
+ import { useRecordSignalWhile as on, useRecordSignalPeers as Zn, signalSentence as er } from "../../lib/presence-signals.js";
15
15
  import { RUN_TRANSITION_EVENT as tt } from "../../lib/run-transition.js";
16
16
  import { userErrorMessage as Ae } from "../../lib/safe-error.js";
17
- import { serverNow as nr } from "../../lib/server-clock.js";
17
+ import { serverNow as tr } from "../../lib/server-clock.js";
18
+ import { useStartsOpen as nr } from "../../lib/use-starts-open.js";
18
19
  import { userCardQuery as rr } from "../../lib/user-cards.js";
19
- import { cn as ge, titleCase as ar, toLocalDateString as sr, formatRelative as _t, formatDateTime as Et, humanHours as ir } from "../../lib/utils.js";
20
+ import { cn as ve, titleCase as ar, toLocalDateString as sr, formatRelative as _t, formatDateTime as Lt, humanHours as ir } from "../../lib/utils.js";
20
21
  import { PushReadinessChip as or } from "../integrations/RecordIntegrationPreview.js";
21
22
  import { useHeaderFold as lr } from "../item-edit/HeaderTools.js";
22
- import { invalidateRecordInsights as Ie, invalidateRecordData as je } from "../item-edit/RecordInsights.js";
23
+ import { invalidateRecordInsights as Le, invalidateRecordData as Ie } from "../item-edit/RecordInsights.js";
23
24
  import { UserChip as ln } from "../item-edit/UserChip.js";
24
25
  import { OwnerAvatars as dr } from "../queue/OwnerAvatars.js";
25
26
  import { UserAvatar as cr } from "../UserAvatar.js";
26
27
  import { Button as pe } from "../ui/button.js";
27
28
  import { DropdownMenu as mt, DropdownMenuTrigger as pt, DropdownMenuContent as ft, DropdownMenuGroup as It, DropdownMenuSeparator as ht, DropdownMenuItem as Je, DropdownMenuLabel as ur } from "../ui/dropdown-menu.js";
28
29
  import { Popover as St, PopoverTrigger as Ct, PopoverContent as $t } from "../ui/popover.js";
29
- import { Skeleton as Me } from "../ui/skeleton.js";
30
+ import { Skeleton as qe } from "../ui/skeleton.js";
30
31
  import { TooltipProvider as dn, Tooltip as bt, TooltipTrigger as gt, TooltipContent as xt } from "../ui/tooltip.js";
31
32
  import { isAccessRefusal as cn, deniedToastAction as un, WhyOwnersButton as mr } from "./AccessInsights.js";
32
33
  import { runningMovePoll as mn, useRunEnded as pn, startedInBackground as fn, pendingOptIn as hn, sameMoveId as vt, runningMoveTip as pr, unansweredHoldTip as bn, RunningMoveNotice as fr, MoveProblemNotice as hr } from "./BackgroundMove.js";
@@ -35,7 +36,7 @@ import { landingState as gr, landingSkipGroups as xr, joinLabels as jt } from ".
35
36
  import { distinctAdvisories as gn, MoveAdvisoryNotice as xn, REFUSAL_FIX_ACTIONS as vr, useRecordFixAction as yr } from "./MoveAdvisory.js";
36
37
  import { MoveToStatePanel as wr } from "./MoveToStatePanel.js";
37
38
  import { SlaClockLine as kr } from "./SlaClock.js";
38
- const vn = Xn(
39
+ const vn = Vn(
39
40
  () => import("./TransitionRequirementsDialog.js").then((t) => ({
40
41
  default: t.TransitionRequirementsDialog
41
42
  }))
@@ -80,7 +81,7 @@ const Qt = {
80
81
  unknown: "the partner refused it"
81
82
  };
82
83
  function _r(t) {
83
- const e = Math.ceil((new Date(t).getTime() - nr()) / 6e4);
84
+ const e = Math.ceil((new Date(t).getTime() - tr()) / 6e4);
84
85
  return !Number.isFinite(e) || e <= 0 ? "on the next check" : e < 60 ? `in ${e} min` : `in ${Math.round(e / 60)}h`;
85
86
  }
86
87
  function Sr({ held: t }) {
@@ -90,13 +91,13 @@ function Sr({ held: t }) {
90
91
  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",
91
92
  "data-pipeline-auto-held": !0,
92
93
  children: t.map((e) => {
93
- const r = e.transition_label ?? "An automatic move", s = Qt[e.error_class ?? "unknown"] ?? Qt.unknown;
94
- return /* @__PURE__ */ i("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
95
- /* @__PURE__ */ i("p", { className: "font-medium", children: [
94
+ const r = e.transition_label ?? "An automatic move", a = Qt[e.error_class ?? "unknown"] ?? Qt.unknown;
95
+ return /* @__PURE__ */ s("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
96
+ /* @__PURE__ */ s("p", { className: "font-medium", children: [
96
97
  "Needs a person: ",
97
98
  r,
98
99
  " stopped retrying — ",
99
- s,
100
+ a,
100
101
  "."
101
102
  ] }),
102
103
  e.error && /* @__PURE__ */ n(
@@ -107,7 +108,7 @@ function Sr({ held: t }) {
107
108
  children: e.error
108
109
  }
109
110
  ),
110
- /* @__PURE__ */ i("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
111
+ /* @__PURE__ */ s("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
111
112
  e.retry_at ? `It tries the same push again ${_r(e.retry_at)}. ` : "It will not send the same push again on its own. ",
112
113
  "Fix the record so what it sends changes, retry the push, or move the record by hand.",
113
114
  e.attempts > 1 ? ` ${e.attempts} attempts so far.` : ""
@@ -128,41 +129,41 @@ function wn(t) {
128
129
  return (e == null ? void 0 : e.status) === 422 && ((r = e.response) == null ? void 0 : r.error) === "TRANSITION_REQUIREMENTS" ? e.response.requirements ?? [] : null;
129
130
  }
130
131
  function at(t) {
131
- var s;
132
- const e = t == null ? void 0 : t.response, r = (e == null ? void 0 : e.code) ?? ((s = e == null ? void 0 : e.data) == null ? void 0 : s.code);
132
+ var a;
133
+ const e = t == null ? void 0 : t.response, r = (e == null ? void 0 : e.code) ?? ((a = e == null ? void 0 : e.data) == null ? void 0 : a.code);
133
134
  return typeof r == "string" ? r : null;
134
135
  }
135
136
  function kn(t) {
136
137
  if (at(t) !== "RECORD_LOCKED") return null;
137
138
  const e = t == null ? void 0 : t.response, r = e != null && e.data && typeof e.data == "object" ? e.data : e;
138
139
  if ((r == null ? void 0 : r.move_anyway) !== !0) return null;
139
- const s = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
140
- return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${s ?? "Someone else"} is editing this record right now.`, holder: s };
140
+ const a = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
141
+ return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${a ?? "Someone else"} is editing this record right now.`, holder: a };
141
142
  }
142
143
  function Nn(t, e) {
143
- var m, h, p;
144
- const r = at(t), s = t == null ? void 0 : t.response, o = ((m = s == null ? void 0 : s.fix) == null ? void 0 : m.action) ?? ((p = (h = s == null ? void 0 : s.data) == null ? void 0 : h.fix) == null ? void 0 : p.action), c = typeof o == "string" && o.trim() || (r ? vr[r] : void 0);
144
+ var m, b, p;
145
+ const r = at(t), a = t == null ? void 0 : t.response, i = ((m = a == null ? void 0 : a.fix) == null ? void 0 : m.action) ?? ((p = (b = a == null ? void 0 : a.data) == null ? void 0 : b.fix) == null ? void 0 : p.action), c = typeof i == "string" && i.trim() || (r ? vr[r] : void 0);
145
146
  return !r || !c ? null : { code: r, actionKey: c, transitionId: e.transition_id, comment: e.comment };
146
147
  }
147
148
  const Cr = 600;
148
149
  function _n(t) {
149
- const e = Ve(), [r, s] = Q(!1), o = ce(!0);
150
- _e(() => (o.current = !0, () => {
151
- o.current = !1;
150
+ const e = Ve(), [r, a] = G(!1), i = fe(!0);
151
+ Te(() => (i.current = !0, () => {
152
+ i.current = !1;
152
153
  }), []);
153
- const c = ce(t);
154
+ const c = fe(t);
154
155
  c.current = t;
155
156
  const m = tn(async () => {
156
- s(!0);
157
+ a(!0);
157
158
  try {
158
159
  await e.refetchQueries({ queryKey: [...c.current], type: "active" });
159
160
  } catch {
160
161
  }
161
- await new Promise((h) => setTimeout(h, Cr)), o.current && s(!1);
162
+ await new Promise((b) => setTimeout(b, Cr)), i.current && a(!1);
162
163
  }, [e]);
163
164
  return { settling: r, settle: m };
164
165
  }
165
- const Be = 1500, Kt = 4e3;
166
+ const Ue = 1500, Kt = 4e3;
166
167
  class $r {
167
168
  constructor() {
168
169
  lt(this, "seen", null);
@@ -170,17 +171,17 @@ class $r {
170
171
  }
171
172
  /** Feed the ids on offer now. */
172
173
  observe(e, r) {
173
- const s = new Set(e.map((o) => String(o).toUpperCase()));
174
+ const a = new Set(e.map((i) => String(i).toUpperCase()));
174
175
  if (this.seen)
175
- for (const o of s)
176
- this.seen.has(o) || this.fresh.set(o, { at: r, hovered: !1, left: !1 });
177
- for (const o of [...this.fresh.keys()]) s.has(o) || this.fresh.delete(o);
178
- this.seen = s;
176
+ for (const i of a)
177
+ this.seen.has(i) || this.fresh.set(i, { at: r, hovered: !1, left: !1 });
178
+ for (const i of [...this.fresh.keys()]) a.has(i) || this.fresh.delete(i);
179
+ this.seen = a;
179
180
  }
180
181
  /** The pointer is on the button. */
181
182
  enter(e, r) {
182
- const s = this.fresh.get(String(e).toUpperCase());
183
- s && !s.left && r - s.at < Be && (s.hovered = !0);
183
+ const a = this.fresh.get(String(e).toUpperCase());
184
+ a && !a.left && r - a.at < Ue && (a.hovered = !0);
184
185
  }
185
186
  /** The pointer left the button. */
186
187
  leave(e) {
@@ -189,22 +190,22 @@ class $r {
189
190
  }
190
191
  /** Still inert (no state change)? */
191
192
  inert(e, r) {
192
- const s = this.fresh.get(String(e).toUpperCase());
193
- return !s || r - s.at >= Kt ? !1 : r - s.at < Be || s.hovered && !s.left;
193
+ const a = this.fresh.get(String(e).toUpperCase());
194
+ return !a || r - a.at >= Kt ? !1 : r - a.at < Ue || a.hovered && !a.left;
194
195
  }
195
196
  /** A press: true = let it through. A press inside the window counts as the pointer being there. */
196
197
  press(e, r) {
197
- const s = String(e).toUpperCase(), o = this.fresh.get(s);
198
- return o ? r - o.at < Be ? (o.hovered = !0, o.left = !1, !1) : o.hovered && !o.left && r - o.at < Kt ? !1 : (this.fresh.delete(s), !0) : !0;
198
+ const a = String(e).toUpperCase(), i = this.fresh.get(a);
199
+ return i ? r - i.at < Ue ? (i.hovered = !0, i.left = !1, !1) : i.hovered && !i.left && r - i.at < Kt ? !1 : (this.fresh.delete(a), !0) : !0;
199
200
  }
200
201
  /** Inside its time window (drawn dimmed)? */
201
202
  timed(e, r) {
202
- const s = this.fresh.get(String(e).toUpperCase());
203
- return !!s && r - s.at < Be;
203
+ const a = this.fresh.get(String(e).toUpperCase());
204
+ return !!a && r - a.at < Ue;
204
205
  }
205
206
  /** Any button still inside its time window? */
206
207
  hasTimed(e) {
207
- for (const r of this.fresh.values()) if (e - r.at < Be) return !0;
208
+ for (const r of this.fresh.values()) if (e - r.at < Ue) return !0;
208
209
  return !1;
209
210
  }
210
211
  reset() {
@@ -212,24 +213,24 @@ class $r {
212
213
  }
213
214
  }
214
215
  function Sn(t, e) {
215
- const r = ce(null);
216
+ const r = fe(null);
216
217
  r.current || (r.current = new $r());
217
- const s = r.current, o = ce(e);
218
- o.current !== e && (o.current = e, s.reset());
219
- const [, c] = Q(0), m = t ? t.join(",") : null;
218
+ const a = r.current, i = fe(e);
219
+ i.current !== e && (i.current = e, a.reset());
220
+ const [, c] = G(0), m = t ? t.join(",") : null;
220
221
  return et(() => {
221
- t && s.observe(t, Date.now());
222
- }, [s, m]), _e(() => {
223
- if (!s.hasTimed(Date.now())) return;
224
- const h = setTimeout(() => c((p) => p + 1), Be + 20);
225
- return () => clearTimeout(h);
226
- }, [s, m]), {
227
- dimmed: (h) => s.timed(h, Date.now()),
228
- press: (h) => s.press(h, Date.now()),
229
- bind: (h) => ({
230
- onPointerEnter: () => s.enter(h, Date.now()),
231
- onPointerMove: () => s.enter(h, Date.now()),
232
- onPointerLeave: () => s.leave(h)
222
+ t && a.observe(t, Date.now());
223
+ }, [a, m]), Te(() => {
224
+ if (!a.hasTimed(Date.now())) return;
225
+ const b = setTimeout(() => c((p) => p + 1), Ue + 20);
226
+ return () => clearTimeout(b);
227
+ }, [a, m]), {
228
+ dimmed: (b) => a.timed(b, Date.now()),
229
+ press: (b) => a.press(b, Date.now()),
230
+ bind: (b) => ({
231
+ onPointerEnter: () => a.enter(b, Date.now()),
232
+ onPointerMove: () => a.enter(b, Date.now()),
233
+ onPointerLeave: () => a.leave(b)
233
234
  })
234
235
  };
235
236
  }
@@ -238,8 +239,8 @@ function Cn(t, e) {
238
239
  }
239
240
  function $n(t, e, r) {
240
241
  return t.request(
241
- we(`/pipelines/instance/${e}/${r}/approval-brief`)
242
- ).then((s) => s.data);
242
+ ke(`/pipelines/instance/${e}/${r}/approval-brief`)
243
+ ).then((a) => a.data);
243
244
  }
244
245
  function Tr(t) {
245
246
  return (t ?? []).filter((e) => e.tone === "warn" || e.tone === "danger");
@@ -252,25 +253,25 @@ function qr(t) {
252
253
  return e === 0 ? "today" : e === 1 ? "1 day ago" : `${e} days ago`;
253
254
  }
254
255
  function Mr(t, e, r = 40) {
255
- const s = (x) => x == null || x === "" ? "" : String(x), o = s(t), c = s(e), m = (x) => x === "" ? "(empty)" : x;
256
+ const a = (v) => v == null || v === "" ? "" : String(v), i = a(t), c = a(e), m = (v) => v === "" ? "(empty)" : v;
256
257
  if (t === void 0) return { old: null, new: ct(m(c), 0, r) };
257
- if (o.length <= r && c.length <= r) return { old: m(o), new: m(c) };
258
- let h = 0;
259
- for (; h < o.length && h < c.length && o[h] === c[h]; ) h++;
260
- const p = h > r / 2 ? h - Math.floor(r / 3) : 0;
261
- return { old: ct(m(o), p, r), new: ct(m(c), p, r) };
258
+ if (i.length <= r && c.length <= r) return { old: m(i), new: m(c) };
259
+ let b = 0;
260
+ for (; b < i.length && b < c.length && i[b] === c[b]; ) b++;
261
+ const p = b > r / 2 ? b - Math.floor(r / 3) : 0;
262
+ return { old: ct(m(i), p, r), new: ct(m(c), p, r) };
262
263
  }
263
264
  function ct(t, e, r) {
264
- const s = Math.min(e, Math.max(0, t.length - r)), o = t.slice(s, s + r);
265
- return `${s > 0 ? "…" : ""}${o}${s + r < t.length ? "…" : ""}`;
265
+ const a = Math.min(e, Math.max(0, t.length - r)), i = t.slice(a, a + r);
266
+ return `${a > 0 ? "…" : ""}${i}${a + r < t.length ? "…" : ""}`;
266
267
  }
267
268
  const Rr = 4e3;
268
269
  function Tn(t, e) {
269
- const r = Pe(), s = Ve();
270
+ const r = Re(), a = Ve();
270
271
  return tn(async () => {
271
272
  try {
272
- const o = await Promise.race([
273
- s.fetchQuery({
273
+ const i = await Promise.race([
274
+ a.fetchQuery({
274
275
  queryKey: Cn(t, e),
275
276
  queryFn: () => $n(r, t, e),
276
277
  staleTime: 0,
@@ -278,20 +279,20 @@ function Tn(t, e) {
278
279
  }),
279
280
  new Promise((c) => setTimeout(() => c(null), Rr))
280
281
  ]);
281
- return Tr(o == null ? void 0 : o.lines);
282
+ return Tr(i == null ? void 0 : i.lines);
282
283
  } catch {
283
284
  return [];
284
285
  }
285
- }, [r, s, t, e]);
286
+ }, [r, a, t, e]);
286
287
  }
287
288
  function qn({ lines: t }) {
288
- return t.length === 0 ? null : /* @__PURE__ */ i(
289
+ return t.length === 0 ? null : /* @__PURE__ */ s(
289
290
  "div",
290
291
  {
291
292
  "data-forward-warning": !0,
292
293
  className: "rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",
293
294
  children: [
294
- t.map((e) => /* @__PURE__ */ i("p", { children: [
295
+ t.map((e) => /* @__PURE__ */ s("p", { children: [
295
296
  /* @__PURE__ */ n("span", { className: "font-semibold", children: e.label ? `${e.label}: ` : "" }),
296
297
  e.text
297
298
  ] }, `${e.label}:${e.text}`)),
@@ -302,18 +303,18 @@ function qn({ lines: t }) {
302
303
  }
303
304
  function Xe(t, e, r) {
304
305
  if (!r) return !1;
305
- const s = e.find(
306
+ const a = e.find(
306
307
  (c) => String(c.id).toUpperCase() === String(r).toUpperCase()
307
- ), o = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
308
- return !!s && !!o && o.sort < s.sort;
308
+ ), i = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
309
+ return !!a && !!i && i.sort < a.sort;
309
310
  }
310
311
  function qt(t, e, r) {
311
- var o;
312
+ var i;
312
313
  if (!t) return !1;
313
- if ((((o = t.order_partners) == null ? void 0 : o.length) ?? 0) > 0) return !0;
314
+ if ((((i = t.order_partners) == null ? void 0 : i.length) ?? 0) > 0) return !0;
314
315
  if (Xe(t, e, r)) return !1;
315
- const s = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
316
- return !!(s != null && s.is_terminal) && !/(^|_)cancel/i.test(String(s.key ?? ""));
316
+ const a = e.find((c) => String(c.id).toUpperCase() === String(t.to_state).toUpperCase());
317
+ return !!(a != null && a.is_terminal) && !/(^|_)cancel/i.test(String(a.key ?? ""));
317
318
  }
318
319
  const zt = {
319
320
  red: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
@@ -324,11 +325,11 @@ const zt = {
324
325
  purple: "border-violet-200 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300"
325
326
  };
326
327
  function Pr({ flags: t }) {
327
- return !t || t.length === 0 ? null : /* @__PURE__ */ n(Se, { children: t.map((e) => /* @__PURE__ */ i(
328
+ return !t || t.length === 0 ? null : /* @__PURE__ */ n(Se, { children: t.map((e) => /* @__PURE__ */ s(
328
329
  "span",
329
330
  {
330
331
  "data-record-flag": e.name,
331
- className: ge(
332
+ className: ve(
332
333
  "inline-flex shrink-0 items-center gap-1 self-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",
333
334
  zt[e.color] ?? zt.amber
334
335
  ),
@@ -348,26 +349,26 @@ function Mn({
348
349
  item: e,
349
350
  tx: r
350
351
  }) {
351
- const s = Pe(), o = (r == null ? void 0 : r.order_partners) ?? [], { data: c } = be({
352
+ const a = Re(), i = (r == null ? void 0 : r.order_partners) ?? [], { data: c } = xe({
352
353
  queryKey: ["push-preflight", t, e, "t", (r == null ? void 0 : r.id) ?? ""],
353
- queryFn: () => s.request(
354
- we(`/integration-preview/${t}/${encodeURIComponent(e)}/preflight`, {
354
+ queryFn: () => a.request(
355
+ ke(`/integration-preview/${t}/${encodeURIComponent(e)}/preflight`, {
355
356
  transition_id: (r == null ? void 0 : r.id) ?? ""
356
357
  })
357
358
  ).then((p) => p.data),
358
- enabled: o.length > 0 && !!(r != null && r.id),
359
+ enabled: i.length > 0 && !!(r != null && r.id),
359
360
  staleTime: 2e4
360
361
  });
361
- if (o.length === 0) return null;
362
- const m = c != null && c.pushes ? c.pushes.filter((p) => p.status === "would_push" && o.includes(p.api_name)).map((p) => Ht(p.api_name)) : null, h = [...new Set(m ?? o.map(Ht))];
363
- return /* @__PURE__ */ i(
362
+ if (i.length === 0) return null;
363
+ const m = c != null && c.pushes ? c.pushes.filter((p) => p.status === "would_push" && i.includes(p.api_name)).map((p) => Ht(p.api_name)) : null, b = [...new Set(m ?? i.map(Ht))];
364
+ return /* @__PURE__ */ s(
364
365
  "p",
365
366
  {
366
367
  "data-order-send-note": !0,
367
368
  className: "flex items-start gap-1.5 rounded-md border border-sky-200 bg-sky-50 px-2.5 py-1.5 text-[12px] text-sky-900 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-200",
368
369
  children: [
369
370
  /* @__PURE__ */ n(Xt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
370
- m && m.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${h.join(" or ")}. It cannot be called back from here.`
371
+ m && m.length === 0 ? "Nothing is sent to a partner for this record — it only moves the record on." : `This places an order with ${b.join(" or ")}. It cannot be called back from here.`
371
372
  ]
372
373
  }
373
374
  );
@@ -380,65 +381,65 @@ function Rn(t) {
380
381
  }
381
382
  ) : !1;
382
383
  }
383
- function Pn(t, e, r, s) {
384
- if (!s || s.size === 0) return t;
385
- const o = new Set([...s.keys()].map((c) => String(c).toUpperCase()));
384
+ function Pn(t, e, r, a) {
385
+ if (!a || a.size === 0) return t;
386
+ const i = new Set([...a.keys()].map((c) => String(c).toUpperCase()));
386
387
  return t.filter(
387
- (c) => !(!c.to_previous && o.has(String(c.to_state).toUpperCase()) && Xe(c, e, r))
388
+ (c) => !(!c.to_previous && i.has(String(c.to_state).toUpperCase()) && Xe(c, e, r))
388
389
  );
389
390
  }
390
- function Fn(t, e, r) {
391
- var p, x, k, R, _, U;
392
- const s = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
391
+ function An(t, e, r) {
392
+ var p, v, N, A, C, U;
393
+ const a = [...(t == null ? void 0 : t.available_transitions) ?? [], ...(t == null ? void 0 : t.all_transitions) ?? []].find(
393
394
  (j) => j.id === e
394
- ), o = r == null ? void 0 : r.data, c = ((p = o == null ? void 0 : o.new_state) == null ? void 0 : p.id) ?? ((x = o == null ? void 0 : o.instance) == null ? void 0 : x.current_state) ?? null, m = ((k = o == null ? void 0 : o.new_state) == null ? void 0 : k.label) ?? (s ? (_ = (R = t == null ? void 0 : t.states) == null ? void 0 : R.find((j) => j.id === s.to_state)) == null ? void 0 : _.label : void 0) ?? null, h = ((U = t == null ? void 0 : t.instance) == null ? void 0 : U.current_state) ?? null;
395
- return h && c && String(h) === String(c) ? "Nothing moved" : s != null && s.label && m ? `${s.label} — now ${m}` : m ? `Moved to ${m}` : s != null && s.label ? `${s.label} done` : "Transition executed";
395
+ ), i = r == null ? void 0 : r.data, c = ((p = i == null ? void 0 : i.new_state) == null ? void 0 : p.id) ?? ((v = i == null ? void 0 : i.instance) == null ? void 0 : v.current_state) ?? null, m = ((N = i == null ? void 0 : i.new_state) == null ? void 0 : N.label) ?? (a ? (C = (A = t == null ? void 0 : t.states) == null ? void 0 : A.find((j) => j.id === a.to_state)) == null ? void 0 : C.label : void 0) ?? null, b = ((U = t == null ? void 0 : t.instance) == null ? void 0 : U.current_state) ?? null;
396
+ return b && c && String(b) === String(c) ? "Nothing moved" : a != null && a.label && m ? `${a.label} — now ${m}` : m ? `Moved to ${m}` : a != null && a.label ? `${a.label} done` : "Transition executed";
396
397
  }
397
- const Fr = 1200;
398
- function An(t) {
398
+ const Ar = 1200;
399
+ function Fn(t) {
399
400
  const e = `nvr-move-${Math.random().toString(36).slice(2)}`;
400
401
  let r = !1;
401
- const s = setTimeout(() => {
402
- r = !0, V.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
403
- }, Fr);
402
+ const a = setTimeout(() => {
403
+ r = !0, X.loading(`${(t == null ? void 0 : t.trim()) || "Moving"}…`, { id: e });
404
+ }, Ar);
404
405
  return {
405
406
  /** Options for the result toast: replaces the loading one when shown. */
406
- done: () => (clearTimeout(s), r ? { id: e, duration: 7e3 } : {}),
407
+ done: () => (clearTimeout(a), r ? { id: e, duration: 7e3 } : {}),
407
408
  /** An error toast of its own follows — drop the loading one. */
408
409
  fail: () => {
409
- clearTimeout(s), r && V.dismiss(e);
410
+ clearTimeout(a), r && X.dismiss(e);
410
411
  }
411
412
  };
412
413
  }
413
414
  function nt(t, e, r) {
414
- for (const s of [
415
+ for (const a of [
415
416
  "pipeline-owners-resolved",
416
417
  "pipeline-instance-owners",
417
418
  "pipeline-all-owners"
418
419
  ])
419
- t.invalidateQueries({ queryKey: [s, e, r] });
420
+ t.invalidateQueries({ queryKey: [a, e, r] });
420
421
  }
421
- function Ar(t, e, r) {
422
- var h;
422
+ function Fr(t, e, r) {
423
+ var b;
423
424
  if (!e) return null;
424
- const s = new Map(r.map((p) => [String(p.id).toUpperCase(), p.sort])), o = [...t].sort(
425
- (p, x) => new Date(x.timestamp).getTime() - new Date(p.timestamp).getTime()
425
+ const a = new Map(r.map((p) => [String(p.id).toUpperCase(), p.sort])), i = [...t].sort(
426
+ (p, v) => new Date(v.timestamp).getTime() - new Date(p.timestamp).getTime()
426
427
  )[0];
427
- if (!(o != null && o.from_state) || String(o.to_state).toUpperCase() !== String(e).toUpperCase() || !((h = o.comment) != null && h.trim()) || o.origin && o.origin !== "person") return null;
428
- const c = s.get(String(o.from_state).toUpperCase()), m = s.get(String(o.to_state).toUpperCase());
429
- return c == null || m == null || m >= c ? null : o;
428
+ if (!(i != null && i.from_state) || String(i.to_state).toUpperCase() !== String(e).toUpperCase() || !((b = i.comment) != null && b.trim()) || i.origin && i.origin !== "person") return null;
429
+ const c = a.get(String(i.from_state).toUpperCase()), m = a.get(String(i.to_state).toUpperCase());
430
+ return c == null || m == null || m >= c ? null : i;
430
431
  }
431
- function Ne({ className: t }) {
432
+ function _e({ className: t }) {
432
433
  return /* @__PURE__ */ n(
433
434
  Vt,
434
435
  {
435
436
  "aria-hidden": !0,
436
437
  "data-move-blocked-mark": !0,
437
- className: ge("h-3 w-3 shrink-0 text-amber-600 dark:text-amber-400", t)
438
+ className: ve("h-3 w-3 shrink-0 text-amber-600 dark:text-amber-400", t)
438
439
  }
439
440
  );
440
441
  }
441
- function Le(t, e = "button") {
442
+ function Be(t, e = "button") {
442
443
  return t.advisory ? {
443
444
  "data-move-blocked": t.advisory.code,
444
445
  "aria-description": t.advisory.message,
@@ -451,49 +452,49 @@ function kt({
451
452
  nameOf: e
452
453
  }) {
453
454
  const r = gn(t);
454
- return r.map(({ advisory: s, moves: o }) => /* @__PURE__ */ i(Yn, { children: [
455
+ return r.map(({ advisory: a, moves: i }) => /* @__PURE__ */ s(Xn, { children: [
455
456
  /* @__PURE__ */ n(ht, {}),
456
- /* @__PURE__ */ i(
457
+ /* @__PURE__ */ s(
457
458
  "div",
458
459
  {
459
- "data-move-blocked-note": s.code,
460
+ "data-move-blocked-note": a.code,
460
461
  className: "flex max-w-[280px] items-start gap-2 px-2 py-1.5 text-[11px] leading-snug text-slate-600 dark:text-slate-300",
461
462
  children: [
462
- /* @__PURE__ */ n(Ne, { className: "mt-0.5" }),
463
- /* @__PURE__ */ i("span", { className: "min-w-0", children: [
464
- s.message,
465
- r.length > 1 && /* @__PURE__ */ i("span", { className: "mt-0.5 block text-amber-800/80 dark:text-amber-300/80", children: [
463
+ /* @__PURE__ */ n(_e, { className: "mt-0.5" }),
464
+ /* @__PURE__ */ s("span", { className: "min-w-0", children: [
465
+ a.message,
466
+ r.length > 1 && /* @__PURE__ */ s("span", { className: "mt-0.5 block text-amber-800/80 dark:text-amber-300/80", children: [
466
467
  "Stops: ",
467
- [...new Set(o.map(e))].join(", ")
468
+ [...new Set(i.map(e))].join(", ")
468
469
  ] })
469
470
  ] })
470
471
  ]
471
472
  }
472
473
  )
473
- ] }, `${s.code}:${s.message}`));
474
+ ] }, `${a.code}:${a.message}`));
474
475
  }
475
476
  function Dn(t, e, r) {
476
- const s = String(t.comment_mode ?? "none");
477
- return s === "optional" || s === "required" || qt(t, e, r);
477
+ const a = String(t.comment_mode ?? "none");
478
+ return a === "optional" || a === "required" || qt(t, e, r);
478
479
  }
479
480
  function Or({ entry: t }) {
480
481
  const e = [t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email || "Someone";
481
- return /* @__PURE__ */ i(
482
+ return /* @__PURE__ */ s(
482
483
  "div",
483
484
  {
484
485
  className: "flex items-start gap-2.5 border-t border-amber-200/80 bg-amber-50/70 px-4 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/[0.06]",
485
486
  "data-send-back-notice": !0,
486
487
  children: [
487
488
  /* @__PURE__ */ n(
488
- zn,
489
+ Wn,
489
490
  {
490
491
  "aria-hidden": !0,
491
492
  className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
492
493
  }
493
494
  ),
494
- /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
495
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
495
496
  /* @__PURE__ */ n("p", { className: "whitespace-pre-line break-words text-[13px] leading-snug text-slate-800 dark:text-slate-100", children: t.comment }),
496
- /* @__PURE__ */ i("p", { className: "mt-0.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: [
497
+ /* @__PURE__ */ s("p", { className: "mt-0.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: [
497
498
  "Sent back by ",
498
499
  Tt(e, t),
499
500
  " · ",
@@ -508,47 +509,47 @@ function Un({
508
509
  collection: t,
509
510
  item: e,
510
511
  offer: r,
511
- onFixed: s,
512
- onDismiss: o,
512
+ onFixed: a,
513
+ onDismiss: i,
513
514
  className: c,
514
515
  style: m
515
516
  }) {
516
- const [h, p] = Q(""), { action: x, isLoading: k, run: R } = yr(t, e, r.actionKey), _ = Qe({
517
- mutationFn: () => R(h),
517
+ const [b, p] = G(""), { action: v, isLoading: N, run: A } = yr(t, e, r.actionKey), C = je({
518
+ mutationFn: () => A(b),
518
519
  onSuccess: () => {
519
- V.success(`${(x == null ? void 0 : x.label) ?? "Done"} — trying again`), s();
520
+ X.success(`${(v == null ? void 0 : v.label) ?? "Done"} — trying again`), a();
520
521
  },
521
- onError: (j) => Zn(j, `${(x == null ? void 0 : x.label) ?? "The fix"} failed`)
522
+ onError: (j) => Jn(j, `${(v == null ? void 0 : v.label) ?? "The fix"} failed`)
522
523
  });
523
- if (k || !x) return null;
524
- const U = !_.isPending && (!x.require_reason || h.trim().length > 0);
525
- return /* @__PURE__ */ i(
524
+ if (N || !v) return null;
525
+ const U = !C.isPending && (!v.require_reason || b.trim().length > 0);
526
+ return /* @__PURE__ */ s(
526
527
  "div",
527
528
  {
528
- className: ge(
529
+ className: ve(
529
530
  "space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
530
531
  c
531
532
  ),
532
533
  style: m,
533
534
  "data-refusal-fix": r.code,
534
535
  children: [
535
- /* @__PURE__ */ i("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
536
+ /* @__PURE__ */ s("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
536
537
  "You can fix this here: ",
537
- x.label,
538
+ v.label,
538
539
  ", then the move is tried again."
539
540
  ] }),
540
- x.require_reason && /* @__PURE__ */ n(
541
+ v.require_reason && /* @__PURE__ */ n(
541
542
  "input",
542
543
  {
543
544
  type: "text",
544
- value: h,
545
+ value: b,
545
546
  onChange: (j) => p(j.target.value),
546
547
  placeholder: "Reason (required)",
547
548
  "aria-label": "Reason",
548
549
  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 dark:border-border dark:bg-card"
549
550
  }
550
551
  ),
551
- /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
552
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
552
553
  /* @__PURE__ */ n(
553
554
  pe,
554
555
  {
@@ -556,21 +557,21 @@ function Un({
556
557
  size: "sm",
557
558
  variant: "ghost",
558
559
  className: "h-7 text-[12px]",
559
- onClick: o,
560
+ onClick: i,
560
561
  children: "Not now"
561
562
  }
562
563
  ),
563
- /* @__PURE__ */ i(
564
+ /* @__PURE__ */ s(
564
565
  pe,
565
566
  {
566
567
  type: "button",
567
568
  size: "sm",
568
569
  className: "h-7 gap-1.5 text-[12px]",
569
570
  disabled: !U,
570
- onClick: () => _.mutate(),
571
+ onClick: () => C.mutate(),
571
572
  children: [
572
- _.isPending && /* @__PURE__ */ n(ye, { className: "h-3 w-3 animate-spin" }),
573
- x.label,
573
+ C.isPending && /* @__PURE__ */ n(we, { className: "h-3 w-3 animate-spin" }),
574
+ v.label,
574
575
  ", then try again"
575
576
  ]
576
577
  }
@@ -580,7 +581,7 @@ function Un({
580
581
  }
581
582
  );
582
583
  }
583
- function Re({
584
+ function Me({
584
585
  label: t,
585
586
  color: e,
586
587
  small: r
@@ -608,43 +609,43 @@ function Dr({
608
609
  completedAt: e
609
610
  }) {
610
611
  const r = [...t].sort(
611
- (m, h) => new Date(m.timestamp).getTime() - new Date(h.timestamp).getTime()
612
+ (m, b) => new Date(m.timestamp).getTime() - new Date(b.timestamp).getTime()
612
613
  );
613
614
  if (r.length === 0) return null;
614
- const s = e ? new Date(e).getTime() : Date.now(), o = r.map((m, h) => {
615
- const p = new Date(m.timestamp).getTime(), x = h + 1 < r.length ? new Date(r[h + 1].timestamp).getTime() : s;
615
+ const a = e ? new Date(e).getTime() : Date.now(), i = r.map((m, b) => {
616
+ const p = new Date(m.timestamp).getTime(), v = b + 1 < r.length ? new Date(r[b + 1].timestamp).getTime() : a;
616
617
  return {
617
618
  key: m.id,
618
619
  label: m.to_state_label,
619
620
  color: m.to_state_color,
620
- ms: Math.max(0, x - p),
621
- current: h === r.length - 1 && !e
621
+ ms: Math.max(0, v - p),
622
+ current: b === r.length - 1 && !e
622
623
  };
623
624
  }).filter((m) => m.ms > 0 || m.current);
624
- if (o.length < 2) return null;
625
- const c = o.reduce((m, h) => m + h.ms, 0);
626
- return c <= 0 ? null : /* @__PURE__ */ i("div", { "data-state-timeline": !0, children: [
627
- /* @__PURE__ */ i("div", { className: "mb-1 flex items-center justify-between", children: [
625
+ if (i.length < 2) return null;
626
+ const c = i.reduce((m, b) => m + b.ms, 0);
627
+ return c <= 0 ? null : /* @__PURE__ */ s("div", { "data-state-timeline": !0, children: [
628
+ /* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between", children: [
628
629
  /* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
629
- /* @__PURE__ */ i("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
630
+ /* @__PURE__ */ s("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
630
631
  ut(c),
631
632
  " total",
632
633
  e ? "" : " · so far"
633
634
  ] })
634
635
  ] }),
635
- /* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: o.map((m) => {
636
- const h = m.ms / c * 100;
637
- return /* @__PURE__ */ i(
636
+ /* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: i.map((m) => {
637
+ const b = m.ms / c * 100;
638
+ return /* @__PURE__ */ s(
638
639
  "div",
639
640
  {
640
641
  "data-tip": `${m.label} — ${ut(m.ms)}${m.current ? " (current)" : ""}`,
641
642
  className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
642
643
  style: {
643
- width: `${h}%`,
644
+ width: `${b}%`,
644
645
  backgroundColor: m.color ? `${m.color}55` : "rgba(100,116,139,.25)"
645
646
  },
646
647
  children: [
647
- h >= 14 && /* @__PURE__ */ i("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
648
+ b >= 14 && /* @__PURE__ */ s("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
648
649
  m.label,
649
650
  " · ",
650
651
  ut(m.ms)
@@ -667,118 +668,118 @@ function Ur({
667
668
  states: t,
668
669
  allTransitions: e,
669
670
  availableTransitions: r,
670
- currentStateId: s,
671
- history: o,
671
+ currentStateId: a,
672
+ history: i,
672
673
  onPathIds: c,
673
674
  skippedStates: m
674
675
  }) {
675
676
  var K;
676
- const h = ce(null);
677
- _e(() => {
678
- const f = h.current;
677
+ const b = fe(null);
678
+ Te(() => {
679
+ const f = b.current;
679
680
  if (!f || f.scrollWidth <= f.clientWidth) return;
680
- const v = f.querySelector("[data-track-current]");
681
- if (!v) return;
682
- const g = f.getBoundingClientRect(), $ = v.getBoundingClientRect();
683
- f.scrollLeft += $.left + $.width / 2 - (g.left + g.width / 2);
684
- }, [s]);
685
- const p = new Set(o.map((f) => f.to_state)), x = t.find((f) => f.is_initial);
686
- x && x.id !== s && p.add(x.id);
687
- const k = (K = o[0]) == null ? void 0 : K.from_state;
688
- k && k !== s && p.add(k);
689
- const R = (() => {
681
+ const k = f.querySelector("[data-track-current]");
682
+ if (!k) return;
683
+ const x = f.getBoundingClientRect(), M = k.getBoundingClientRect();
684
+ f.scrollLeft += M.left + M.width / 2 - (x.left + x.width / 2);
685
+ }, [a]);
686
+ const p = new Set(i.map((f) => f.to_state)), v = t.find((f) => f.is_initial);
687
+ v && v.id !== a && p.add(v.id);
688
+ const N = (K = i[0]) == null ? void 0 : K.from_state;
689
+ N && N !== a && p.add(N);
690
+ const A = (() => {
690
691
  if (c)
691
- return t.filter((b) => c.has(b.id) || p.has(b.id) || b.id === s).filter((b) => {
692
- const M = b.stage_visibility ?? "always";
693
- return M === "hide" ? !1 : M === "hide_unless_active" ? p.has(b.id) || b.id === s : !0;
694
- }).sort((b, M) => b.sort - M.sort);
692
+ return t.filter((g) => c.has(g.id) || p.has(g.id) || g.id === a).filter((g) => {
693
+ const R = g.stage_visibility ?? "always";
694
+ return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(g.id) || g.id === a : !0;
695
+ }).sort((g, R) => g.sort - R.sort);
695
696
  if (e.length === 0) {
696
- const b = /* @__PURE__ */ new Set([...p]);
697
- return s && b.add(s), t.filter((M) => b.has(M.id)).sort((M, ee) => M.sort - ee.sort);
697
+ const g = /* @__PURE__ */ new Set([...p]);
698
+ return a && g.add(a), t.filter((R) => g.has(R.id)).sort((R, ee) => R.sort - ee.sort);
698
699
  }
699
700
  const f = new Set(
700
- o.filter((b) => b.from_state).map((b) => `${b.from_state}:${b.to_state}`)
701
- ), v = new Set(o.map((b) => b.from_state).filter(Boolean)), g = e.filter((b) => b.from_state !== null), $ = /* @__PURE__ */ new Map();
702
- for (const b of g) {
703
- const M = b.from_state;
704
- if (v.has(M) && !f.has(`${M}:${b.to_state}`)) continue;
705
- const ee = $.get(M) ?? [];
706
- ee.push(b.to_state), $.set(M, ee);
701
+ i.filter((g) => g.from_state).map((g) => `${g.from_state}:${g.to_state}`)
702
+ ), k = new Set(i.map((g) => g.from_state).filter(Boolean)), x = e.filter((g) => g.from_state !== null), M = /* @__PURE__ */ new Map();
703
+ for (const g of x) {
704
+ const R = g.from_state;
705
+ if (k.has(R) && !f.has(`${R}:${g.to_state}`)) continue;
706
+ const ee = M.get(R) ?? [];
707
+ ee.push(g.to_state), M.set(R, ee);
707
708
  }
708
- if (s) {
709
- const b = g.filter((M) => M.from_state === s).map((M) => M.to_state);
710
- $.set(s, [
711
- .../* @__PURE__ */ new Set([...r.map((M) => M.to_state), ...b])
709
+ if (a) {
710
+ const g = x.filter((R) => R.from_state === a).map((R) => R.to_state);
711
+ M.set(a, [
712
+ .../* @__PURE__ */ new Set([...r.map((R) => R.to_state), ...g])
712
713
  ]);
713
714
  }
714
- const T = /* @__PURE__ */ new Set(), X = t.filter((b) => b.is_initial).map((b) => b.id);
715
- for (; X.length; ) {
716
- const b = X.shift();
717
- if (!T.has(b)) {
718
- T.add(b);
719
- for (const M of $.get(b) ?? []) T.has(M) || X.push(M);
715
+ const T = /* @__PURE__ */ new Set(), Y = t.filter((g) => g.is_initial).map((g) => g.id);
716
+ for (; Y.length; ) {
717
+ const g = Y.shift();
718
+ if (!T.has(g)) {
719
+ T.add(g);
720
+ for (const R of M.get(g) ?? []) T.has(R) || Y.push(R);
720
721
  }
721
722
  }
722
723
  const u = /* @__PURE__ */ new Set([...T, ...p]);
723
- return s && u.add(s), t.filter((b) => u.has(b.id)).filter((b) => {
724
- const M = b.stage_visibility ?? "always";
725
- return M === "hide" ? !1 : M === "hide_unless_active" ? p.has(b.id) || b.id === s : !0;
726
- }).sort((b, M) => b.sort - M.sort);
724
+ return a && u.add(a), t.filter((g) => u.has(g.id)).filter((g) => {
725
+ const R = g.stage_visibility ?? "always";
726
+ return R === "hide" ? !1 : R === "hide_unless_active" ? p.has(g.id) || g.id === a : !0;
727
+ }).sort((g, R) => g.sort - R.sort);
727
728
  })();
728
- if (R.length < 2) return null;
729
- const _ = R.findIndex((f) => f.id === s), U = new Map(R.map((f, v) => [f.id, v])), j = new Map(t.map((f) => [f.id, f.label]));
730
- function ne(f, v) {
731
- const g = U.get(f);
732
- return g == null ? [] : [...o].filter(($) => {
733
- if (!$.from_state) return !1;
734
- const T = U.get($.from_state), X = U.get($.to_state);
735
- return T == null || X == null ? !1 : T === g && X > g || X < T && T - 1 === g;
736
- }).sort(($, T) => new Date($.timestamp).getTime() - new Date(T.timestamp).getTime());
729
+ if (A.length < 2) return null;
730
+ const C = A.findIndex((f) => f.id === a), U = new Map(A.map((f, k) => [f.id, k])), j = new Map(t.map((f) => [f.id, f.label]));
731
+ function ne(f, k) {
732
+ const x = U.get(f);
733
+ return x == null ? [] : [...i].filter((M) => {
734
+ if (!M.from_state) return !1;
735
+ const T = U.get(M.from_state), Y = U.get(M.to_state);
736
+ return T == null || Y == null ? !1 : T === x && Y > x || Y < T && T - 1 === x;
737
+ }).sort((M, T) => new Date(M.timestamp).getTime() - new Date(T.timestamp).getTime());
737
738
  }
738
739
  function re(f) {
739
- var v, g, $, T;
740
- return Ze(f) ? /* @__PURE__ */ n(Zt, { className: "inline h-2.5 w-2.5", "aria-label": yt(f) }) : ((((v = f.first_name) == null ? void 0 : v[0]) ?? "") + (((g = f.last_name) == null ? void 0 : g[0]) ?? "")).toUpperCase() || ((T = ($ = f.user_email) == null ? void 0 : $[0]) == null ? void 0 : T.toUpperCase()) || "?";
740
+ var k, x, M, T;
741
+ return Ze(f) ? /* @__PURE__ */ n(Zt, { className: "inline h-2.5 w-2.5", "aria-label": yt(f) }) : ((((k = f.first_name) == null ? void 0 : k[0]) ?? "") + (((x = f.last_name) == null ? void 0 : x[0]) ?? "")).toUpperCase() || ((T = (M = f.user_email) == null ? void 0 : M[0]) == null ? void 0 : T.toUpperCase()) || "?";
741
742
  }
742
743
  function ae(f) {
743
744
  return Tt([f.first_name, f.last_name].filter(Boolean).join(" ") || f.user_email, f);
744
745
  }
745
746
  const F = /* @__PURE__ */ new Map();
746
- for (const f of [...o].sort(
747
- (v, g) => new Date(v.timestamp).getTime() - new Date(g.timestamp).getTime()
747
+ for (const f of [...i].sort(
748
+ (k, x) => new Date(k.timestamp).getTime() - new Date(x.timestamp).getTime()
748
749
  )) {
749
750
  if (!f.from_state) continue;
750
- const v = U.get(f.from_state), g = U.get(f.to_state);
751
- if (!(v == null || g == null || g <= v + 1))
752
- for (let $ = v + 1; $ < g; $++) {
753
- const T = R[$].id;
751
+ const k = U.get(f.from_state), x = U.get(f.to_state);
752
+ if (!(k == null || x == null || x <= k + 1))
753
+ for (let M = k + 1; M < x; M++) {
754
+ const T = A[M].id;
754
755
  !p.has(T) && !F.has(T) && F.set(T, f);
755
756
  }
756
757
  }
757
- function E(f) {
758
- const v = j.get(f.from_state ?? "") ?? "the previous step", g = j.get(f.to_state) ?? "the next step", $ = Ze(f) ? "it moved automatically" : `${ae(f)} moved it`;
759
- return `Passed over on ${Et(f.timestamp)} — ${$} straight from ${v} to ${g}`;
758
+ function I(f) {
759
+ const k = j.get(f.from_state ?? "") ?? "the previous step", x = j.get(f.to_state) ?? "the next step", M = Ze(f) ? "it moved automatically" : `${ae(f)} moved it`;
760
+ return `Passed over on ${Lt(f.timestamp)} — ${M} straight from ${k} to ${x}`;
760
761
  }
761
- return /* @__PURE__ */ n(dn, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: h, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: R.map((f, v) => {
762
- const g = f.id === s, $ = p.has(f.id), T = $ && !g && (_ < 0 || v < _), X = $ && !g && !T, u = !$ && !g ? F.get(f.id) : void 0, b = !$ && !g ? m == null ? void 0 : m.get(f.id) : void 0, M = u || b ? [...u ? [E(u)] : [], ...b ?? []] : void 0, ee = M !== void 0, W = f.color ?? "#94a3b8", ue = v === R.length - 1, xe = ue ? null : R[v + 1], de = xe ? ne(f.id, xe.id) : [];
763
- return /* @__PURE__ */ i("div", { className: "flex flex-1 items-start", children: [
764
- /* @__PURE__ */ i("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
762
+ return /* @__PURE__ */ n(dn, { delayDuration: 200, children: /* @__PURE__ */ n("div", { ref: b, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-start", children: A.map((f, k) => {
763
+ const x = f.id === a, M = p.has(f.id), T = M && !x && (C < 0 || k < C), Y = M && !x && !T, u = !M && !x ? F.get(f.id) : void 0, g = !M && !x ? m == null ? void 0 : m.get(f.id) : void 0, R = u || g ? [...u ? [I(u)] : [], ...g ?? []] : void 0, ee = R !== void 0, W = f.color ?? "#94a3b8", ce = k === A.length - 1, ye = ce ? null : A[k + 1], oe = ye ? ne(f.id, ye.id) : [];
764
+ return /* @__PURE__ */ s("div", { className: "flex flex-1 items-start", children: [
765
+ /* @__PURE__ */ s("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
765
766
  /* @__PURE__ */ n(
766
767
  "div",
767
768
  {
768
- "data-track-current": g || void 0,
769
- className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${g || T ? "nvr-fill-sweep" : ""}`,
770
- "data-tip": X ? `Passed before the record was sent back — it needs this step again.${f.description ? ` ${f.description}` : ""}` : f.description || void 0,
771
- "data-track-again": X || void 0,
769
+ "data-track-current": x || void 0,
770
+ className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${x || T ? "nvr-fill-sweep" : ""}`,
771
+ "data-tip": Y ? `Passed before the record was sent back — it needs this step again.${f.description ? ` ${f.description}` : ""}` : f.description || void 0,
772
+ "data-track-again": Y || void 0,
772
773
  style: {
773
- backgroundColor: g || T ? W : ee ? "transparent" : "#f1f5f9",
774
- border: g || T ? "none" : ee ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
775
- boxShadow: g ? `0 0 0 3px white, 0 0 0 5px ${W}` : void 0
774
+ backgroundColor: x || T ? W : ee ? "transparent" : "#f1f5f9",
775
+ border: x || T ? "none" : ee ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
776
+ boxShadow: x ? `0 0 0 3px white, 0 0 0 5px ${W}` : void 0
776
777
  },
777
- children: T ? /* @__PURE__ */ n(rt, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : g ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : ee ? /* @__PURE__ */ n(Hn, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
778
+ children: T ? /* @__PURE__ */ n(rt, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : x ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : ee ? /* @__PURE__ */ n(zn, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
778
779
  },
779
- g ? "cur" : T ? "done" : ee ? "skip" : "todo"
780
+ x ? "cur" : T ? "done" : ee ? "skip" : "todo"
780
781
  ),
781
- ee ? /* @__PURE__ */ i(bt, { children: [
782
+ ee ? /* @__PURE__ */ s(bt, { children: [
782
783
  /* @__PURE__ */ n(gt, { asChild: !0, children: /* @__PURE__ */ n(
783
784
  "span",
784
785
  {
@@ -794,36 +795,36 @@ function Ur({
794
795
  children: f.label
795
796
  }
796
797
  ) }),
797
- /* @__PURE__ */ i(xt, { className: "max-w-[260px]", children: [
798
+ /* @__PURE__ */ s(xt, { className: "max-w-[260px]", children: [
798
799
  /* @__PURE__ */ n("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
799
- M.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: M.map((D) => /* @__PURE__ */ n("li", { children: D }, D)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
800
+ R.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: R.map((P) => /* @__PURE__ */ n("li", { children: P }, P)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
800
801
  ] })
801
802
  ] }) : /* @__PURE__ */ n(
802
803
  "span",
803
804
  {
804
- className: ge(
805
+ className: ve(
805
806
  "w-full break-words text-center leading-snug",
806
- !g && !T && "text-slate-500 dark:text-slate-400"
807
+ !x && !T && "text-slate-500 dark:text-slate-400"
807
808
  ),
808
809
  style: {
809
810
  fontSize: "11px",
810
- color: g ? W : T ? "#475569" : void 0,
811
- fontWeight: g ? 600 : T ? 500 : 400,
811
+ color: x ? W : T ? "#475569" : void 0,
812
+ fontWeight: x ? 600 : T ? 500 : 400,
812
813
  wordBreak: "break-word"
813
814
  },
814
815
  children: f.label
815
816
  }
816
817
  )
817
818
  ] }),
818
- !ue && /* @__PURE__ */ i("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
819
+ !ce && /* @__PURE__ */ s("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
819
820
  (() => {
820
- const D = T ? `${W}55` : "#e8ecf0";
821
- return /* @__PURE__ */ i("div", { className: "flex w-full shrink-0 items-center", children: [
821
+ const P = T ? `${W}55` : "#e8ecf0";
822
+ return /* @__PURE__ */ s("div", { className: "flex w-full shrink-0 items-center", children: [
822
823
  /* @__PURE__ */ n(
823
824
  "div",
824
825
  {
825
826
  className: "h-0.5 flex-1 rounded-l-sm",
826
- style: { backgroundColor: D }
827
+ style: { backgroundColor: P }
827
828
  }
828
829
  ),
829
830
  /* @__PURE__ */ n(
@@ -834,50 +835,50 @@ function Ur({
834
835
  height: 0,
835
836
  borderTop: "3px solid transparent",
836
837
  borderBottom: "3px solid transparent",
837
- borderLeft: `5px solid ${D}`
838
+ borderLeft: `5px solid ${P}`
838
839
  }
839
840
  }
840
841
  )
841
842
  ] });
842
843
  })(),
843
- de.map((D) => {
844
- const Y = D.from_state !== f.id, z = Math.abs(
845
- (U.get(D.to_state) ?? 0) - (U.get(D.from_state ?? "") ?? 0)
846
- ) > 1 ? j.get(D.to_state) ?? "" : null;
847
- return /* @__PURE__ */ i(bt, { children: [
848
- /* @__PURE__ */ n(gt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
849
- /* @__PURE__ */ i(
844
+ oe.map((P) => {
845
+ const le = P.from_state !== f.id, Q = Math.abs(
846
+ (U.get(P.to_state) ?? 0) - (U.get(P.from_state ?? "") ?? 0)
847
+ ) > 1 ? j.get(P.to_state) ?? "" : null;
848
+ return /* @__PURE__ */ s(bt, { children: [
849
+ /* @__PURE__ */ n(gt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
850
+ /* @__PURE__ */ s(
850
851
  "span",
851
852
  {
852
853
  className: "text-center font-mono text-[9px] font-semibold leading-none",
853
- style: { color: Y ? "#d97706" : "#475569" },
854
+ style: { color: le ? "#d97706" : "#475569" },
854
855
  children: [
855
- Y && "↩ ",
856
- re(D)
856
+ le && "↩ ",
857
+ re(P)
857
858
  ]
858
859
  }
859
860
  ),
860
- /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: _t(D.timestamp) })
861
+ /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: _t(P.timestamp) })
861
862
  ] }) }),
862
- /* @__PURE__ */ i(xt, { side: "top", className: "space-y-0.5 text-[12px]", children: [
863
- Ze(D) ? /* @__PURE__ */ i(Se, { children: [
864
- /* @__PURE__ */ i("p", { className: "font-medium", children: [
865
- Y ? "↩ Sent back · " : "",
866
- yt(D)
863
+ /* @__PURE__ */ s(xt, { side: "top", className: "space-y-0.5 text-[12px]", children: [
864
+ Ze(P) ? /* @__PURE__ */ s(Se, { children: [
865
+ /* @__PURE__ */ s("p", { className: "font-medium", children: [
866
+ le ? "↩ Sent back · " : "",
867
+ yt(P)
867
868
  ] }),
868
- wt(D) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: wt(D) })
869
- ] }) : /* @__PURE__ */ i("p", { className: "font-medium", children: [
870
- Y ? "↩ Sent back by" : "Approved by",
869
+ wt(P) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: wt(P) })
870
+ ] }) : /* @__PURE__ */ s("p", { className: "font-medium", children: [
871
+ le ? "↩ Sent back by" : "Approved by",
871
872
  " ",
872
- ae(D)
873
+ ae(P)
873
874
  ] }),
874
- z && /* @__PURE__ */ i("p", { className: "text-muted-foreground", children: [
875
+ Q && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: [
875
876
  "→ straight to ",
876
- z
877
+ Q
877
878
  ] }),
878
- /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Et(D.timestamp) })
879
+ /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Lt(P.timestamp) })
879
880
  ] })
880
- ] }, D.id);
881
+ ] }, P.id);
881
882
  })
882
883
  ] })
883
884
  ] }, f.id);
@@ -885,28 +886,28 @@ function Ur({
885
886
  }
886
887
  function Br({ history: t }) {
887
888
  return t.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: t.map((e) => {
888
- const r = Ze(e), s = r ? yt(e) : Tt([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), o = Nr(e), c = e.comment && !r && !o ? e.comment : null, m = o ?? (r ? wt(e) : null);
889
- return /* @__PURE__ */ i("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
889
+ const r = Ze(e), a = r ? yt(e) : Tt([e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email, e), i = Nr(e), c = e.comment && !r && !i ? e.comment : null, m = i ?? (r ? wt(e) : null);
890
+ return /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
890
891
  /* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
891
- /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
892
- /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
893
- e.from_state_label ? /* @__PURE__ */ n(Re, { label: e.from_state_label, color: e.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
892
+ /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
893
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
894
+ e.from_state_label ? /* @__PURE__ */ n(Me, { label: e.from_state_label, color: e.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
894
895
  /* @__PURE__ */ n(Nt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
895
- /* @__PURE__ */ n(Re, { label: e.to_state_label, color: e.to_state_color, small: !0 })
896
+ /* @__PURE__ */ n(Me, { label: e.to_state_label, color: e.to_state_color, small: !0 })
896
897
  ] }),
897
- c && /* @__PURE__ */ i("p", { className: "mt-1 text-slate-500 italic", children: [
898
+ c && /* @__PURE__ */ s("p", { className: "mt-1 text-slate-500 italic", children: [
898
899
  '"',
899
900
  c,
900
901
  '"'
901
902
  ] }),
902
- /* @__PURE__ */ i(
903
+ /* @__PURE__ */ s(
903
904
  "p",
904
905
  {
905
906
  className: "mt-0.5 text-slate-400",
906
907
  "data-history-on-behalf": e.on_behalf_of_name ? e.on_behalf_of ?? "" : void 0,
907
908
  children: [
908
909
  r && /* @__PURE__ */ n(Zt, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
909
- s,
910
+ a,
910
911
  m ? ` · ${m}` : "",
911
912
  " · ",
912
913
  _t(e.timestamp)
@@ -917,42 +918,42 @@ function Br({ history: t }) {
917
918
  ] }, e.id);
918
919
  }) });
919
920
  }
920
- function Lr({ value: t, onChange: e }) {
921
- const r = Pe(), [s, o] = Q(!1), [c, m] = Q(""), [h, p] = Q(""), x = ce(null), k = ce(null);
922
- _e(() => {
923
- s ? setTimeout(() => {
921
+ function Er({ value: t, onChange: e }) {
922
+ const r = Re(), [a, i] = G(!1), [c, m] = G(""), [b, p] = G(""), v = fe(null), N = fe(null);
923
+ Te(() => {
924
+ a ? setTimeout(() => {
924
925
  var F;
925
- return (F = x.current) == null ? void 0 : F.focus();
926
+ return (F = v.current) == null ? void 0 : F.focus();
926
927
  }, 50) : m("");
927
- }, [s]), _e(() => (k.current && clearTimeout(k.current), k.current = setTimeout(() => p(c), 250), () => {
928
- k.current && clearTimeout(k.current);
928
+ }, [a]), Te(() => (N.current && clearTimeout(N.current), N.current = setTimeout(() => p(c), 250), () => {
929
+ N.current && clearTimeout(N.current);
929
930
  }), [c]);
930
- const { data: R, isLoading: _ } = be({
931
- queryKey: ["users", "async-search", h],
931
+ const { data: A, isLoading: C } = xe({
932
+ queryKey: ["users", "async-search", b],
932
933
  queryFn: () => r.request(
933
- we("/users", {
934
+ ke("/users", {
934
935
  limit: 50,
935
936
  sort: "first_name",
936
- ...h ? { search: h } : {}
937
+ ...b ? { search: b } : {}
937
938
  })
938
939
  ).then((F) => F.data),
939
- enabled: s,
940
+ enabled: a,
940
941
  staleTime: 3e4
941
- }), { data: U } = be({
942
+ }), { data: U } = xe({
942
943
  ...rr(r, t),
943
944
  enabled: !!t,
944
945
  staleTime: 5 * 6e4
945
- }), j = R ?? [], ne = U ?? j.find((F) => F.id === t) ?? null, re = ne ? [ne.first_name, ne.last_name].filter(Boolean).join(" ").trim() || ne.email : t ? "Selected person" : null, ae = (F) => [F.first_name, F.last_name].filter(Boolean).join(" ").trim();
946
- return /* @__PURE__ */ i(St, { open: s, onOpenChange: o, children: [
947
- /* @__PURE__ */ i("div", { className: "relative flex h-8 w-full", children: [
948
- /* @__PURE__ */ n(Ct, { asChild: !0, children: /* @__PURE__ */ i(
946
+ }), j = A ?? [], ne = U ?? j.find((F) => F.id === t) ?? null, re = ne ? [ne.first_name, ne.last_name].filter(Boolean).join(" ").trim() || ne.email : t ? "Selected person" : null, ae = (F) => [F.first_name, F.last_name].filter(Boolean).join(" ").trim();
947
+ return /* @__PURE__ */ s(St, { open: a, onOpenChange: i, children: [
948
+ /* @__PURE__ */ s("div", { className: "relative flex h-8 w-full", children: [
949
+ /* @__PURE__ */ n(Ct, { asChild: !0, children: /* @__PURE__ */ s(
949
950
  "button",
950
951
  {
951
952
  type: "button",
952
953
  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",
953
954
  children: [
954
955
  /* @__PURE__ */ n("span", { className: `flex-1 truncate ${re ? "" : "text-slate-400"}`, children: re ?? "Select a user…" }),
955
- /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
956
+ /* @__PURE__ */ n(Pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
956
957
  ]
957
958
  }
958
959
  ) }),
@@ -968,13 +969,13 @@ function Lr({ value: t, onChange: e }) {
968
969
  }
969
970
  )
970
971
  ] }),
971
- /* @__PURE__ */ i($t, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
972
- /* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ i("div", { className: "relative", children: [
973
- /* @__PURE__ */ n(Vn, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
972
+ /* @__PURE__ */ s($t, { align: "start", className: "w-72 p-0", sideOffset: 4, children: [
973
+ /* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-2 py-1.5", children: /* @__PURE__ */ s("div", { className: "relative", children: [
974
+ /* @__PURE__ */ n(Gn, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
974
975
  /* @__PURE__ */ n(
975
976
  "input",
976
977
  {
977
- ref: x,
978
+ ref: v,
978
979
  value: c,
979
980
  onChange: (F) => m(F.target.value),
980
981
  placeholder: "Search users…",
@@ -982,17 +983,17 @@ function Lr({ value: t, onChange: e }) {
982
983
  }
983
984
  )
984
985
  ] }) }),
985
- /* @__PURE__ */ n("div", { className: "max-h-56 overflow-y-auto py-1", children: _ ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
986
- /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }),
986
+ /* @__PURE__ */ n("div", { className: "max-h-56 overflow-y-auto py-1", children: C ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
987
+ /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }),
987
988
  "Loading…"
988
989
  ] }) : j.length === 0 ? /* @__PURE__ */ n("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : j.map((F) => {
989
- const E = ae(F), K = E ? `${E} (${F.email})` : F.email, f = F.id === t;
990
- return /* @__PURE__ */ i(
990
+ const I = ae(F), K = I ? `${I} (${F.email})` : F.email, f = F.id === t;
991
+ return /* @__PURE__ */ s(
991
992
  "button",
992
993
  {
993
994
  type: "button",
994
995
  onClick: () => {
995
- e(F.id), o(!1);
996
+ e(F.id), i(!1);
996
997
  },
997
998
  className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${f ? "font-medium text-slate-800" : "text-slate-600"}`,
998
999
  children: [
@@ -1015,9 +1016,9 @@ function Gt({
1015
1016
  userId: t,
1016
1017
  name: e,
1017
1018
  email: r,
1018
- initials: s
1019
+ initials: a
1019
1020
  }) {
1020
- return /* @__PURE__ */ n(ln, { userId: t, children: /* @__PURE__ */ i(
1021
+ return /* @__PURE__ */ n(ln, { userId: t, children: /* @__PURE__ */ s(
1021
1022
  "button",
1022
1023
  {
1023
1024
  type: "button",
@@ -1030,10 +1031,10 @@ function Gt({
1030
1031
  userId: t,
1031
1032
  alt: e,
1032
1033
  className: "h-6 w-6",
1033
- fallback: /* @__PURE__ */ n("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: s })
1034
+ fallback: /* @__PURE__ */ n("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: a })
1034
1035
  }
1035
1036
  ),
1036
- /* @__PURE__ */ i("span", { className: "min-w-0 flex-1", children: [
1037
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
1037
1038
  /* @__PURE__ */ n("span", { className: "block truncate text-[12px] font-medium text-slate-700 underline-offset-2 group-hover/owner:underline dark:text-slate-200", children: e }),
1038
1039
  /* @__PURE__ */ n("span", { className: "block truncate text-[11px] text-slate-400 dark:text-slate-500", children: r })
1039
1040
  ] })
@@ -1041,157 +1042,157 @@ function Gt({
1041
1042
  }
1042
1043
  ) });
1043
1044
  }
1044
- function Er({
1045
+ function Lr({
1045
1046
  collection: t,
1046
1047
  item: e,
1047
1048
  states: r,
1048
- currentStateId: s,
1049
- returned: o = !1
1049
+ currentStateId: a,
1050
+ returned: i = !1
1050
1051
  }) {
1051
- var ie, H, qe, Oe;
1052
- const c = Pe(), m = Ve(), { isAdmin: h } = nn(), [p, x] = Q(!1), [k, R] = Q(""), [_, U] = Q(""), [j, ne] = Q(!1), re = ["pipeline-instance-owners", t, e], ae = ["pipeline-owners-can-add", t, e], F = () => c.request(
1053
- we(`/pipelines/instance/${t}/${e}/owners`)
1054
- ).then((a) => {
1055
- var I;
1056
- return m.setQueryData(ae, ((I = a.meta) == null ? void 0 : I.can_add) ?? null), a;
1057
- }), { data: E, isLoading: K } = be({
1052
+ var J, se, Fe, o;
1053
+ const c = Re(), m = Ve(), { isAdmin: b } = nn(), [p, v] = G(!1), [N, A] = G(""), [C, U] = G(""), [j, ne] = G(!1), re = ["pipeline-instance-owners", t, e], ae = ["pipeline-owners-can-add", t, e], F = () => c.request(
1054
+ ke(`/pipelines/instance/${t}/${e}/owners`)
1055
+ ).then((h) => {
1056
+ var B;
1057
+ return m.setQueryData(ae, ((B = h.meta) == null ? void 0 : B.can_add) ?? null), h;
1058
+ }), { data: I, isLoading: K } = xe({
1058
1059
  queryKey: re,
1059
- queryFn: () => F().then((a) => a.data)
1060
- }), { data: f } = be({
1060
+ queryFn: () => F().then((h) => h.data)
1061
+ }), { data: f } = xe({
1061
1062
  queryKey: ae,
1062
- queryFn: () => F().then((a) => {
1063
- var I;
1064
- return ((I = a.meta) == null ? void 0 : I.can_add) ?? null;
1063
+ queryFn: () => F().then((h) => {
1064
+ var B;
1065
+ return ((B = h.meta) == null ? void 0 : B.can_add) ?? null;
1065
1066
  }),
1066
1067
  enabled: !K,
1067
1068
  staleTime: 3e4
1068
- }), v = typeof f == "boolean" ? f : h, { data: g, isLoading: $ } = be({
1069
+ }), k = typeof f == "boolean" ? f : b, { data: x, isLoading: M } = xe({
1069
1070
  queryKey: ["pipeline-all-owners", t, e],
1070
1071
  queryFn: () => c.request(
1071
- we(`/pipelines/instance/${t}/${e}/owners/all`)
1072
- ).then((a) => a.data ?? null),
1073
- enabled: !!s,
1072
+ ke(`/pipelines/instance/${t}/${e}/owners/all`)
1073
+ ).then((h) => h.data ?? null),
1074
+ enabled: !!a,
1074
1075
  staleTime: 3e4
1075
- }), T = new Set((E ?? []).map((a) => a.user)), X = s ? (((ie = g == null ? void 0 : g[s]) == null ? void 0 : ie.owners) ?? []).filter((a) => !T.has(a.id)) : [], u = new Map(
1076
- (s ? ((H = g == null ? void 0 : g[s]) == null ? void 0 : H.unavailable) ?? [] : []).map((a) => [
1077
- String(a.id).toUpperCase(),
1078
- a
1076
+ }), T = new Set((I ?? []).map((h) => h.user)), Y = a ? (((J = x == null ? void 0 : x[a]) == null ? void 0 : J.owners) ?? []).filter((h) => !T.has(h.id)) : [], u = new Map(
1077
+ (a ? ((se = x == null ? void 0 : x[a]) == null ? void 0 : se.unavailable) ?? [] : []).map((h) => [
1078
+ String(h.id).toUpperCase(),
1079
+ h
1079
1080
  ])
1080
- ), b = X.length + ((E == null ? void 0 : E.length) ?? 0), M = !!((qe = r.find((a) => a.id === s)) != null && qe.is_initial), ee = !K && !$, { data: W } = be({
1081
+ ), g = Y.length + ((I == null ? void 0 : I.length) ?? 0), R = !!((Fe = r.find((h) => h.id === a)) != null && Fe.is_initial), ee = !K && !M, { data: W } = xe({
1081
1082
  queryKey: ["pipeline-record-creator", t, e],
1082
1083
  queryFn: () => c.request(
1083
- we(`/pipelines/instance/${t}/${e}/creator`)
1084
- ).then((a) => a.data ?? null),
1085
- enabled: M && ee && b === 0,
1084
+ ke(`/pipelines/instance/${t}/${e}/creator`)
1085
+ ).then((h) => h.data ?? null),
1086
+ enabled: R && ee && g === 0,
1086
1087
  staleTime: 6e4
1087
- }), ue = M && b === 0 && (W != null && W.name) ? W : null, xe = () => {
1088
+ }), ce = R && g === 0 && (W != null && W.name) ? W : null, ye = () => {
1088
1089
  m.invalidateQueries({ queryKey: re }), m.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1089
- }, de = Qe({
1090
+ }, oe = je({
1090
1091
  mutationFn: () => c.request(
1091
1092
  Ge(`/pipelines/instance/${t}/${e}/owners`, {
1092
- user: k,
1093
- state: _ || void 0
1093
+ user: N,
1094
+ state: C || void 0
1094
1095
  })
1095
1096
  ),
1096
1097
  onSuccess: () => {
1097
- xe(), R(""), U(""), x(!1), V.success("Owner added");
1098
+ ye(), A(""), U(""), v(!1), X.success("Owner added");
1098
1099
  },
1099
1100
  // The server's reason (a 403 says why), not a bare status phrase.
1100
- onError: (a) => V.error(Ae(a, "Failed to add owner"))
1101
- }), D = Qe({
1102
- mutationFn: (a) => c.request(Jn(`/pipelines/instance-owners/${a.id}`)),
1103
- onSuccess: (a, I) => {
1104
- xe();
1105
- const Z = [I.first_name, I.last_name].filter(Boolean).join(" ") || I.email;
1106
- V.success(`${Z} removed as an owner`, {
1101
+ onError: (h) => X.error(Ae(h, "Failed to add owner"))
1102
+ }), P = je({
1103
+ mutationFn: (h) => c.request(Yn(`/pipelines/instance-owners/${h.id}`)),
1104
+ onSuccess: (h, B) => {
1105
+ ye();
1106
+ const V = [B.first_name, B.last_name].filter(Boolean).join(" ") || B.email;
1107
+ X.success(`${V} removed as an owner`, {
1107
1108
  action: {
1108
1109
  label: "Undo",
1109
1110
  onClick: () => void c.request(
1110
1111
  Ge(`/pipelines/instance/${t}/${e}/owners`, {
1111
- user: I.user,
1112
- state: I.state || void 0
1112
+ user: B.user,
1113
+ state: B.state || void 0
1113
1114
  })
1114
- ).then(() => xe()).catch((J) => V.error(Ae(J, "Could not add the owner back")))
1115
+ ).then(() => ye()).catch((ue) => X.error(Ae(ue, "Could not add the owner back")))
1115
1116
  }
1116
1117
  });
1117
1118
  },
1118
- onError: (a) => V.error(Ae(a, "Failed to remove owner"))
1119
- }), Y = (a) => {
1120
- var J, he;
1121
- const I = ((J = a.first_name) == null ? void 0 : J[0]) ?? "", Z = ((he = a.last_name) == null ? void 0 : he[0]) ?? "";
1122
- return (`${I}${Z}`.trim() || a.email[0] || "?").toUpperCase();
1123
- }, z = (a) => {
1124
- var I;
1125
- return a ? ((I = r.find((Z) => Z.id === a || Z.key === a)) == null ? void 0 : I.label) ?? a : null;
1119
+ onError: (h) => X.error(Ae(h, "Failed to remove owner"))
1120
+ }), le = (h) => {
1121
+ var ue, be;
1122
+ const B = ((ue = h.first_name) == null ? void 0 : ue[0]) ?? "", V = ((be = h.last_name) == null ? void 0 : be[0]) ?? "";
1123
+ return (`${B}${V}`.trim() || h.email[0] || "?").toUpperCase();
1124
+ }, Q = (h) => {
1125
+ var B;
1126
+ return h ? ((B = r.find((V) => V.id === h || V.key === h)) == null ? void 0 : B.label) ?? h : null;
1126
1127
  };
1127
- return /* @__PURE__ */ i("div", { children: [
1128
- /* @__PURE__ */ i("div", { className: "mb-3 flex items-center justify-between", children: [
1129
- /* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
1128
+ return /* @__PURE__ */ s("div", { children: [
1129
+ /* @__PURE__ */ s("div", { className: "mb-3 flex items-center justify-between", children: [
1130
+ /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
1130
1131
  /* @__PURE__ */ n(Yt, { className: "h-3.5 w-3.5" }),
1131
1132
  "Owners",
1132
- K || $ ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : ue ? null : /* @__PURE__ */ i("span", { className: "text-slate-300", children: [
1133
+ K || M ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : ce ? null : /* @__PURE__ */ s("span", { className: "text-slate-300", children: [
1133
1134
  "(",
1134
- b,
1135
+ g,
1135
1136
  ")"
1136
1137
  ] })
1137
1138
  ] }),
1138
- /* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
1139
- s && /* @__PURE__ */ n(mr, { collection: t, itemId: String(e) }),
1140
- !p && v && /* @__PURE__ */ i(
1139
+ /* @__PURE__ */ s("span", { className: "flex items-center gap-3", children: [
1140
+ a && /* @__PURE__ */ n(mr, { collection: t, itemId: String(e) }),
1141
+ !p && k && /* @__PURE__ */ s(
1141
1142
  "button",
1142
1143
  {
1143
1144
  type: "button",
1144
- onClick: () => x(!0),
1145
+ onClick: () => v(!0),
1145
1146
  className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
1146
1147
  children: [
1147
- /* @__PURE__ */ n(Gn, { className: "h-3 w-3" }),
1148
+ /* @__PURE__ */ n(Hn, { className: "h-3 w-3" }),
1148
1149
  "Add"
1149
1150
  ]
1150
1151
  }
1151
1152
  )
1152
1153
  ] })
1153
1154
  ] }),
1154
- K || $ ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1155
- /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }),
1155
+ K || M ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1156
+ /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }),
1156
1157
  "Resolving owners…"
1157
- ] }) : ue ? /* @__PURE__ */ i("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1158
- o ? "Back with" : "With",
1158
+ ] }) : ce ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1159
+ i ? "Back with" : "With",
1159
1160
  " ",
1160
- /* @__PURE__ */ n(ln, { userId: ue.id, children: /* @__PURE__ */ n(
1161
+ /* @__PURE__ */ n(ln, { userId: ce.id, children: /* @__PURE__ */ n(
1161
1162
  "button",
1162
1163
  {
1163
1164
  type: "button",
1164
- "aria-label": `${ue.name} — profile`,
1165
+ "aria-label": `${ce.name} — profile`,
1165
1166
  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",
1166
- children: ue.name
1167
+ children: ce.name
1167
1168
  }
1168
1169
  ) })
1169
- ] }) : b === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ i("div", { className: "space-y-px", children: [
1170
- X.map((a) => {
1171
- var J, he;
1172
- const I = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, Z = (`${((J = a.first_name) == null ? void 0 : J[0]) ?? ""}${((he = a.last_name) == null ? void 0 : he[0]) ?? ""}`.trim() || a.email[0] || "?").toUpperCase();
1173
- return /* @__PURE__ */ i(
1170
+ ] }) : g === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ s("div", { className: "space-y-px", children: [
1171
+ Y.map((h) => {
1172
+ var ue, be;
1173
+ const B = [h.first_name, h.last_name].filter(Boolean).join(" ") || h.email, V = (`${((ue = h.first_name) == null ? void 0 : ue[0]) ?? ""}${((be = h.last_name) == null ? void 0 : be[0]) ?? ""}`.trim() || h.email[0] || "?").toUpperCase();
1174
+ return /* @__PURE__ */ s(
1174
1175
  "div",
1175
1176
  {
1176
1177
  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",
1177
1178
  children: [
1178
- /* @__PURE__ */ n(Gt, { userId: a.id, name: I, email: a.email, initials: Z }),
1179
+ /* @__PURE__ */ n(Gt, { userId: h.id, name: B, email: h.email, initials: V }),
1179
1180
  (() => {
1180
- const l = u.get(String(a.id).toUpperCase());
1181
+ const l = u.get(String(h.id).toUpperCase());
1181
1182
  return l ? /* @__PURE__ */ n(
1182
1183
  "span",
1183
1184
  {
1184
1185
  "data-owner-unavailable": l.reason,
1185
- className: ge(
1186
+ className: ve(
1186
1187
  "shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",
1187
1188
  l.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"
1188
1189
  ),
1189
- "data-tip": l.delegate ? `${I} is ${Ee[l.reason] ?? l.reason} — ${l.delegate.name} covers` : `${I} is ${Ee[l.reason] ?? l.reason} and can't approve this step`,
1190
+ "data-tip": l.delegate ? `${B} is ${Ee[l.reason] ?? l.reason} — ${l.delegate.name} covers` : `${B} is ${Ee[l.reason] ?? l.reason} and can't approve this step`,
1190
1191
  children: l.delegate ? `${Ee[l.reason] ?? l.reason} · ${l.delegate.name} covers` : Ee[l.reason] ?? l.reason
1191
1192
  }
1192
1193
  ) : null;
1193
1194
  })(),
1194
- a.queue_only ? /* @__PURE__ */ n(
1195
+ h.queue_only ? /* @__PURE__ */ n(
1195
1196
  "span",
1196
1197
  {
1197
1198
  className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
@@ -1201,10 +1202,10 @@ function Er({
1201
1202
  ) : /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
1202
1203
  ]
1203
1204
  },
1204
- `group-${a.id}`
1205
+ `group-${h.id}`
1205
1206
  );
1206
1207
  }),
1207
- (E ?? []).map((a) => /* @__PURE__ */ i(
1208
+ (I ?? []).map((h) => /* @__PURE__ */ s(
1208
1209
  "div",
1209
1210
  {
1210
1211
  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",
@@ -1212,66 +1213,66 @@ function Er({
1212
1213
  /* @__PURE__ */ n(
1213
1214
  Gt,
1214
1215
  {
1215
- userId: a.user,
1216
- name: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email,
1217
- email: a.email,
1218
- initials: Y(a)
1216
+ userId: h.user,
1217
+ name: [h.first_name, h.last_name].filter(Boolean).join(" ") || h.email,
1218
+ email: h.email,
1219
+ initials: le(h)
1219
1220
  }
1220
1221
  ),
1221
1222
  /* @__PURE__ */ n("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" }),
1222
- /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: a.state ? z(a.state) : "all states" }),
1223
+ /* @__PURE__ */ n("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: h.state ? Q(h.state) : "all states" }),
1223
1224
  /* @__PURE__ */ n(
1224
1225
  "button",
1225
1226
  {
1226
1227
  type: "button",
1227
- "aria-label": `Remove ${[a.first_name, a.last_name].filter(Boolean).join(" ") || a.email} as an owner`,
1228
- disabled: D.isPending,
1229
- onClick: () => D.mutate(a),
1228
+ "aria-label": `Remove ${[h.first_name, h.last_name].filter(Boolean).join(" ") || h.email} as an owner`,
1229
+ disabled: P.isPending,
1230
+ onClick: () => P.mutate(h),
1230
1231
  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",
1231
1232
  children: /* @__PURE__ */ n(Jt, { className: "h-3 w-3" })
1232
1233
  }
1233
1234
  )
1234
1235
  ]
1235
1236
  },
1236
- a.id
1237
+ h.id
1237
1238
  ))
1238
1239
  ] }),
1239
- p && /* @__PURE__ */ i("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: [
1240
+ p && /* @__PURE__ */ s("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: [
1240
1241
  /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
1241
- /* @__PURE__ */ n(Lr, { value: k, onChange: R }),
1242
- h ? /* @__PURE__ */ i(St, { open: j, onOpenChange: ne, children: [
1243
- /* @__PURE__ */ n(Ct, { asChild: !0, children: /* @__PURE__ */ i(
1242
+ /* @__PURE__ */ n(Er, { value: N, onChange: A }),
1243
+ b ? /* @__PURE__ */ s(St, { open: j, onOpenChange: ne, children: [
1244
+ /* @__PURE__ */ n(Ct, { asChild: !0, children: /* @__PURE__ */ s(
1244
1245
  "button",
1245
1246
  {
1246
1247
  type: "button",
1247
1248
  className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
1248
1249
  children: [
1249
- /* @__PURE__ */ n("span", { className: "truncate", children: _ ? ((Oe = r.find((a) => a.id === _)) == null ? void 0 : Oe.label) ?? _ : "All states" }),
1250
- /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1250
+ /* @__PURE__ */ n("span", { className: "truncate", children: C ? ((o = r.find((h) => h.id === C)) == null ? void 0 : o.label) ?? C : "All states" }),
1251
+ /* @__PURE__ */ n(Pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1251
1252
  ]
1252
1253
  }
1253
1254
  ) }),
1254
- /* @__PURE__ */ n($t, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((a) => a.id)].map((a) => {
1255
- var J;
1256
- const I = a === "" ? "All states" : ((J = r.find((he) => he.id === a)) == null ? void 0 : J.label) ?? a;
1255
+ /* @__PURE__ */ n($t, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((h) => h.id)].map((h) => {
1256
+ var ue;
1257
+ const B = h === "" ? "All states" : ((ue = r.find((be) => be.id === h)) == null ? void 0 : ue.label) ?? h;
1257
1258
  return /* @__PURE__ */ n(
1258
1259
  "button",
1259
1260
  {
1260
1261
  type: "button",
1261
- className: ge(
1262
+ className: ve(
1262
1263
  "flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1263
- _ === a && "font-medium text-slate-800 dark:text-slate-200"
1264
+ C === h && "font-medium text-slate-800 dark:text-slate-200"
1264
1265
  ),
1265
1266
  onClick: () => {
1266
- U(a), ne(!1);
1267
+ U(h), ne(!1);
1267
1268
  },
1268
- children: I
1269
+ children: B
1269
1270
  },
1270
- a
1271
+ h
1271
1272
  );
1272
1273
  }) })
1273
1274
  ] }) : /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
1274
- /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
1275
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
1275
1276
  /* @__PURE__ */ n(
1276
1277
  pe,
1277
1278
  {
@@ -1280,7 +1281,7 @@ function Er({
1280
1281
  variant: "ghost",
1281
1282
  className: "h-7 text-[12px]",
1282
1283
  onClick: () => {
1283
- x(!1), R(""), U("");
1284
+ v(!1), A(""), U("");
1284
1285
  },
1285
1286
  children: "Cancel"
1286
1287
  }
@@ -1291,28 +1292,28 @@ function Er({
1291
1292
  type: "button",
1292
1293
  size: "sm",
1293
1294
  className: "h-7 text-[12px]",
1294
- disabled: !k || de.isPending,
1295
- onClick: () => de.mutate(),
1296
- children: de.isPending ? /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1295
+ disabled: !N || oe.isPending,
1296
+ onClick: () => oe.mutate(),
1297
+ children: oe.isPending ? /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1297
1298
  }
1298
1299
  )
1299
1300
  ] })
1300
1301
  ] })
1301
1302
  ] });
1302
1303
  }
1303
- function Bn(t, e, r, s) {
1304
+ function Bn(t, e, r, a) {
1304
1305
  if (!t || !(r != null && r.length)) return null;
1305
1306
  const c = new Map(r.map((p) => [String(p.id).toUpperCase(), p])).get(String(t.to_state).toUpperCase()), m = Number(e == null ? void 0 : e.sort);
1306
1307
  if (!c || !Number.isFinite(m) || !(Number(c.sort) > m)) return null;
1307
- const h = gr(String(t.to_state), r, s);
1308
- return h && h.skipped.length > 0 ? h : null;
1308
+ const b = gr(String(t.to_state), r, a);
1309
+ return b && b.skipped.length > 0 ? b : null;
1309
1310
  }
1310
- function Ln({ landing: t }) {
1311
+ function En({ landing: t }) {
1311
1312
  if (!t || t.skipped.length === 0) return null;
1312
1313
  const e = xr(t);
1313
1314
  if (e.length === 1) {
1314
1315
  const r = e[0];
1315
- return /* @__PURE__ */ i(
1316
+ return /* @__PURE__ */ s(
1316
1317
  "p",
1317
1318
  {
1318
1319
  "data-confirm-skips": !0,
@@ -1332,18 +1333,18 @@ function Ln({ landing: t }) {
1332
1333
  }
1333
1334
  );
1334
1335
  }
1335
- return /* @__PURE__ */ i(
1336
+ return /* @__PURE__ */ s(
1336
1337
  "div",
1337
1338
  {
1338
1339
  "data-confirm-skips": !0,
1339
1340
  className: "text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
1340
1341
  children: [
1341
- /* @__PURE__ */ i("p", { children: [
1342
+ /* @__PURE__ */ s("p", { children: [
1342
1343
  "Goes straight to ",
1343
1344
  /* @__PURE__ */ n("span", { className: "font-medium", children: t.state.label }),
1344
1345
  ". Skipped on the way:"
1345
1346
  ] }),
1346
- /* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((r) => /* @__PURE__ */ i("li", { children: [
1347
+ /* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: e.map((r) => /* @__PURE__ */ s("li", { children: [
1347
1348
  /* @__PURE__ */ n("span", { className: "font-medium", children: jt(r.labels) }),
1348
1349
  r.reason ? ` — ${r.reason}` : ""
1349
1350
  ] }, r.labels.join("|"))) })
@@ -1360,67 +1361,67 @@ function Ir({
1360
1361
  collection: t,
1361
1362
  item: e,
1362
1363
  states: r,
1363
- currentStateId: s
1364
+ currentStateId: a
1364
1365
  }) {
1365
- const o = Pe(), [c, m] = Q(!1), { data: h, isLoading: p } = be({
1366
+ const i = Re(), [c, m] = G(!1), { data: b, isLoading: p } = xe({
1366
1367
  queryKey: ["pipeline-all-owners", t, e],
1367
- queryFn: () => o.request(
1368
- we(`/pipelines/instance/${t}/${e}/owners/all`)
1369
- ).then((k) => k.data ?? null),
1368
+ queryFn: () => i.request(
1369
+ ke(`/pipelines/instance/${t}/${e}/owners/all`)
1370
+ ).then((N) => N.data ?? null),
1370
1371
  enabled: c,
1371
1372
  staleTime: 3e4
1372
- }), x = [...r].filter((k) => {
1373
- var R;
1374
- return !h || ((R = h[k.id]) == null ? void 0 : R.on_path) !== !1;
1375
- }).sort((k, R) => k.sort - R.sort);
1376
- return /* @__PURE__ */ i(St, { open: c, onOpenChange: m, children: [
1373
+ }), v = [...r].filter((N) => {
1374
+ var A;
1375
+ return !b || ((A = b[N.id]) == null ? void 0 : A.on_path) !== !1;
1376
+ }).sort((N, A) => N.sort - A.sort);
1377
+ return /* @__PURE__ */ s(St, { open: c, onOpenChange: m, children: [
1377
1378
  /* @__PURE__ */ n(Ct, { asChild: !0, children: /* @__PURE__ */ n(
1378
1379
  "button",
1379
1380
  {
1380
1381
  type: "button",
1381
1382
  title: "View approval chain",
1382
1383
  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",
1383
- onClick: (k) => k.stopPropagation(),
1384
+ onClick: (N) => N.stopPropagation(),
1384
1385
  children: /* @__PURE__ */ n(Yt, { className: "h-3.5 w-3.5" })
1385
1386
  }
1386
1387
  ) }),
1387
- /* @__PURE__ */ i($t, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
1388
- /* @__PURE__ */ i("div", { className: "border-b border-slate-100 px-4 py-3", children: [
1388
+ /* @__PURE__ */ s($t, { align: "end", sideOffset: 6, className: "w-[576px] p-0 overflow-hidden", children: [
1389
+ /* @__PURE__ */ s("div", { className: "border-b border-slate-100 px-4 py-3", children: [
1389
1390
  /* @__PURE__ */ n("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
1390
1391
  /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
1391
1392
  ] }),
1392
- /* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: p ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((k) => /* @__PURE__ */ n(Me, { className: "h-10 w-full" }, k)) }) : h ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: x.map((k) => {
1393
- var ae, F, E, K, f;
1394
- const R = (((ae = h[k.id]) == null ? void 0 : ae.owners) ?? []).map((v) => ({
1395
- id: v.id,
1396
- name: [v.first_name, v.last_name].filter(Boolean).join(" ") || v.email
1397
- })), _ = k.id === s, U = ((F = h[k.id]) == null ? void 0 : F.skipped) === !0 && !_, j = (((E = h[k.id]) == null ? void 0 : E.skip_reasons) ?? []).filter(Boolean), ne = ((K = h[k.id]) == null ? void 0 : K.unavailable) ?? [], re = ((f = h[k.id]) == null ? void 0 : f.blocked) === !0 && !U;
1398
- return /* @__PURE__ */ i(
1393
+ /* @__PURE__ */ n("div", { className: "max-h-[504px] overflow-y-auto", children: p ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((N) => /* @__PURE__ */ n(qe, { className: "h-10 w-full" }, N)) }) : b ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: v.map((N) => {
1394
+ var ae, F, I, K, f;
1395
+ const A = (((ae = b[N.id]) == null ? void 0 : ae.owners) ?? []).map((k) => ({
1396
+ id: k.id,
1397
+ name: [k.first_name, k.last_name].filter(Boolean).join(" ") || k.email
1398
+ })), C = N.id === a, U = ((F = b[N.id]) == null ? void 0 : F.skipped) === !0 && !C, j = (((I = b[N.id]) == null ? void 0 : I.skip_reasons) ?? []).filter(Boolean), ne = ((K = b[N.id]) == null ? void 0 : K.unavailable) ?? [], re = ((f = b[N.id]) == null ? void 0 : f.blocked) === !0 && !U;
1399
+ return /* @__PURE__ */ s(
1399
1400
  "div",
1400
1401
  {
1401
- className: ge(
1402
+ className: ve(
1402
1403
  "flex items-center gap-3 px-4 py-2.5",
1403
1404
  // Hex-with-alpha rather than bg-nvr-cyan/N — the
1404
1405
  // nvr-cyan token is an opaque var() so Tailwind silently
1405
1406
  // drops opacity modifiers on it. Kept very light so the
1406
1407
  // tint doesn't clash with the state badge's own color.
1407
- _ && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1408
+ C && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1408
1409
  U && "opacity-60",
1409
1410
  re && "bg-red-50 dark:bg-red-500/10"
1410
1411
  ),
1411
1412
  "data-chain-blocked": re ? "" : void 0,
1412
1413
  children: [
1413
- /* @__PURE__ */ n(Re, { label: k.label, color: k.color, small: !0 }),
1414
+ /* @__PURE__ */ n(Me, { label: N.label, color: N.color, small: !0 }),
1414
1415
  /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: U ? (
1415
1416
  // Radix tooltip with zero delay — native `title` waits on
1416
1417
  // the OS hover timer, and a truncated reason needs its
1417
1418
  // full text the moment the cursor lands on it.
1418
- /* @__PURE__ */ n(dn, { delayDuration: 0, children: /* @__PURE__ */ i(bt, { children: [
1419
- /* @__PURE__ */ n(gt, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1419
+ /* @__PURE__ */ n(dn, { delayDuration: 0, children: /* @__PURE__ */ s(bt, { children: [
1420
+ /* @__PURE__ */ n(gt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1420
1421
  /* @__PURE__ */ n("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" }),
1421
1422
  j.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: j.join(" · ") })
1422
1423
  ] }) }),
1423
- /* @__PURE__ */ i(
1424
+ /* @__PURE__ */ s(
1424
1425
  xt,
1425
1426
  {
1426
1427
  side: "bottom",
@@ -1428,30 +1429,30 @@ function Ir({
1428
1429
  className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
1429
1430
  children: [
1430
1431
  /* @__PURE__ */ n("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
1431
- j.length > 0 ? j.map((v) => /* @__PURE__ */ n("p", { children: v }, v)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1432
+ j.length > 0 ? j.map((k) => /* @__PURE__ */ n("p", { children: k }, k)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1432
1433
  ]
1433
1434
  }
1434
1435
  )
1435
1436
  ] }) })
1436
- ) : /* @__PURE__ */ i(Se, { children: [
1437
- /* @__PURE__ */ n(dr, { owners: R, max: 10, emptyLabel: "—" }),
1438
- ne.map((v) => /* @__PURE__ */ i(
1437
+ ) : /* @__PURE__ */ s(Se, { children: [
1438
+ /* @__PURE__ */ n(dr, { owners: A, max: 10, emptyLabel: "—" }),
1439
+ ne.map((k) => /* @__PURE__ */ s(
1439
1440
  "span",
1440
1441
  {
1441
- "data-tip": `${v.name} is ${Ee[v.reason] ?? v.reason}${v.delegate ? ` — ${v.delegate.name} covers${v.delegate.expires_at ? ` until ${sr(v.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1442
- className: ge(
1442
+ "data-tip": `${k.name} is ${Ee[k.reason] ?? k.reason}${k.delegate ? ` — ${k.delegate.name} covers${k.delegate.expires_at ? ` until ${sr(k.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1443
+ className: ve(
1443
1444
  "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
1444
- v.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"
1445
+ k.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"
1445
1446
  ),
1446
1447
  children: [
1447
- v.name,
1448
- v.delegate ? /* @__PURE__ */ i(Se, { children: [
1448
+ k.name,
1449
+ k.delegate ? /* @__PURE__ */ s(Se, { children: [
1449
1450
  " → ",
1450
- v.delegate.name,
1451
- v.delegate.expires_at && /* @__PURE__ */ i("span", { className: "opacity-70", children: [
1451
+ k.delegate.name,
1452
+ k.delegate.expires_at && /* @__PURE__ */ s("span", { className: "opacity-70", children: [
1452
1453
  ", until",
1453
1454
  " ",
1454
- new Date(v.delegate.expires_at).toLocaleDateString(
1455
+ new Date(k.delegate.expires_at).toLocaleDateString(
1455
1456
  void 0,
1456
1457
  {
1457
1458
  month: "short",
@@ -1459,37 +1460,37 @@ function Ir({
1459
1460
  }
1460
1461
  )
1461
1462
  ] })
1462
- ] }) : /* @__PURE__ */ i("span", { className: "opacity-80", children: [
1463
+ ] }) : /* @__PURE__ */ s("span", { className: "opacity-80", children: [
1463
1464
  " ",
1464
1465
  "· ",
1465
- Ee[v.reason] ?? v.reason
1466
+ Ee[k.reason] ?? k.reason
1466
1467
  ] })
1467
1468
  ]
1468
1469
  },
1469
- v.id
1470
+ k.id
1470
1471
  )),
1471
1472
  re && /* @__PURE__ */ n("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" })
1472
1473
  ] }) })
1473
1474
  ]
1474
1475
  },
1475
- k.id
1476
+ N.id
1476
1477
  );
1477
1478
  }) }) : /* @__PURE__ */ n("p", { className: "px-4 py-3 text-[12px] text-slate-400", children: "No pipeline configured." }) })
1478
1479
  ] })
1479
1480
  ] });
1480
1481
  }
1481
- function Sa({
1482
+ function Ca({
1482
1483
  collection: t,
1483
1484
  item: e,
1484
1485
  defaultExpanded: r,
1485
- title: s,
1486
- showApprovalChain: o,
1486
+ title: a,
1487
+ showApprovalChain: i,
1487
1488
  hideActionsCollapsed: c,
1488
1489
  hideActionsExpanded: m,
1489
- onBeforeTransition: h,
1490
+ onBeforeTransition: b,
1490
1491
  addendumPending: p,
1491
- addendumView: x,
1492
- asRole: k
1492
+ addendumView: v,
1493
+ asRole: N
1493
1494
  }) {
1494
1495
  return e === "new" ? null : /* @__PURE__ */ n(
1495
1496
  jr,
@@ -1497,67 +1498,67 @@ function Sa({
1497
1498
  collection: t,
1498
1499
  item: e,
1499
1500
  defaultExpanded: r,
1500
- title: s,
1501
- showApprovalChain: o,
1501
+ title: a,
1502
+ showApprovalChain: i,
1502
1503
  hideActionsCollapsed: c,
1503
1504
  hideActionsExpanded: m,
1504
- onBeforeTransition: h,
1505
+ onBeforeTransition: b,
1505
1506
  addendumPending: p,
1506
- addendumView: x,
1507
- asRole: k
1507
+ addendumView: v,
1508
+ asRole: N
1508
1509
  },
1509
1510
  `${t}:${e}`
1510
1511
  );
1511
1512
  }
1512
- function En({
1513
+ function Ln({
1513
1514
  collection: t,
1514
1515
  item: e,
1515
1516
  omitLines: r
1516
1517
  }) {
1517
- const s = Pe(), { data: o } = be({
1518
+ const a = Re(), { data: i } = xe({
1518
1519
  queryKey: Cn(t, e),
1519
- queryFn: () => $n(s, t, e),
1520
+ queryFn: () => $n(a, t, e),
1520
1521
  staleTime: 3e4,
1521
1522
  retry: !1
1522
1523
  });
1523
- if (!o) return null;
1524
- const c = o.changed_by_people ?? o.changed_total, m = new Set((r ?? []).map(Wt)), h = (o.lines ?? []).filter((p) => !m.has(Wt(p)));
1525
- return /* @__PURE__ */ i("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
1526
- /* @__PURE__ */ i("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
1524
+ if (!i) return null;
1525
+ const c = i.changed_by_people ?? i.changed_total, m = new Set((r ?? []).map(Wt)), b = (i.lines ?? []).filter((p) => !m.has(Wt(p)));
1526
+ return /* @__PURE__ */ s("div", { className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[11.5px] dark:border-border dark:bg-card", children: [
1527
+ /* @__PURE__ */ s("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
1527
1528
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
1528
1529
  " ",
1529
1530
  "(",
1530
- qr(o.days_in_state),
1531
+ qr(i.days_in_state),
1531
1532
  "):",
1532
1533
  " ",
1533
- o.changed_total === 0 && o.comments === 0 && o.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ i(Se, { children: [
1534
- c > 0 && /* @__PURE__ */ i("span", { children: [
1534
+ i.changed_total === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ s(Se, { children: [
1535
+ c > 0 && /* @__PURE__ */ s("span", { children: [
1535
1536
  c,
1536
1537
  " field",
1537
1538
  c === 1 ? "" : "s",
1538
1539
  " changed",
1539
- o.edited_by.length > 0 ? ` by ${o.edited_by.join(", ")}` : ""
1540
+ i.edited_by.length > 0 ? ` by ${i.edited_by.join(", ")}` : ""
1540
1541
  ] }),
1541
- c === 0 && o.changed_total > 0 && o.comments === 0 && o.addendums.count === 0 && /* @__PURE__ */ n("span", { children: "only values the record fills in itself changed." }),
1542
- o.comments > 0 && /* @__PURE__ */ i("span", { children: [
1542
+ c === 0 && i.changed_total > 0 && i.comments === 0 && i.addendums.count === 0 && /* @__PURE__ */ n("span", { children: "only values the record fills in itself changed." }),
1543
+ i.comments > 0 && /* @__PURE__ */ s("span", { children: [
1543
1544
  c > 0 ? " · " : "",
1544
- o.comments,
1545
+ i.comments,
1545
1546
  " comment",
1546
- o.comments === 1 ? "" : "s"
1547
+ i.comments === 1 ? "" : "s"
1547
1548
  ] }),
1548
- o.addendums.count > 0 && /* @__PURE__ */ i("span", { children: [
1549
+ i.addendums.count > 0 && /* @__PURE__ */ s("span", { children: [
1549
1550
  " · ",
1550
- o.addendums.count,
1551
+ i.addendums.count,
1551
1552
  " addendum",
1552
- o.addendums.count === 1 ? "" : "s",
1553
- o.addendums.cost_impact !== 0 ? ` (${o.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(o.addendums.cost_impact).toLocaleString()})` : ""
1553
+ i.addendums.count === 1 ? "" : "s",
1554
+ i.addendums.cost_impact !== 0 ? ` (${i.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(i.addendums.cost_impact).toLocaleString()})` : ""
1554
1555
  ] })
1555
1556
  ] })
1556
1557
  ] }),
1557
- o.field_changes.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1 space-y-0.5", children: [
1558
- o.field_changes.slice(0, 5).map((p) => {
1559
- const x = Mr(p.old, p.new);
1560
- return /* @__PURE__ */ i(
1558
+ i.field_changes.length > 0 && /* @__PURE__ */ s("div", { className: "mt-1 space-y-0.5", children: [
1559
+ i.field_changes.slice(0, 5).map((p) => {
1560
+ const v = Mr(p.old, p.new);
1561
+ return /* @__PURE__ */ s(
1561
1562
  "p",
1562
1563
  {
1563
1564
  "data-brief-change": p.field,
@@ -1567,24 +1568,24 @@ function En({
1567
1568
  p.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1568
1569
  ":",
1569
1570
  " ",
1570
- x.old !== null && /* @__PURE__ */ i(Se, { children: [
1571
- /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: x.old }),
1571
+ v.old !== null && /* @__PURE__ */ s(Se, { children: [
1572
+ /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: v.old }),
1572
1573
  /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " → " }),
1573
1574
  /* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
1574
1575
  ] }),
1575
- /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: x.new })
1576
+ /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: v.new })
1576
1577
  ]
1577
1578
  },
1578
1579
  p.field
1579
1580
  );
1580
1581
  }),
1581
- o.field_changes.length > 5 && /* @__PURE__ */ i("p", { className: "text-[10.5px] text-slate-400", children: [
1582
+ i.field_changes.length > 5 && /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-400", children: [
1582
1583
  "+",
1583
- o.field_changes.length - 5,
1584
+ i.field_changes.length - 5,
1584
1585
  " more — see History for the full trail"
1585
1586
  ] })
1586
1587
  ] }),
1587
- h.map((p) => /* @__PURE__ */ i(
1588
+ b.map((p) => /* @__PURE__ */ s(
1588
1589
  "p",
1589
1590
  {
1590
1591
  "data-brief-line": p.label,
@@ -1609,98 +1610,94 @@ function jr({
1609
1610
  collection: t,
1610
1611
  item: e,
1611
1612
  defaultExpanded: r,
1612
- title: s,
1613
- showApprovalChain: o,
1613
+ title: a,
1614
+ showApprovalChain: i,
1614
1615
  hideActionsCollapsed: c,
1615
1616
  hideActionsExpanded: m,
1616
- onBeforeTransition: h,
1617
+ onBeforeTransition: b,
1617
1618
  addendumPending: p,
1618
- addendumView: x,
1619
- asRole: k
1619
+ addendumView: v,
1620
+ asRole: N
1620
1621
  }) {
1621
1622
  var Dt, Ut, Bt;
1622
- const R = Pe(), _ = Ve(), { isAdmin: U } = nn(), [j, ne] = Q(0), re = ce(null);
1623
- _e(() => {
1623
+ const A = Re(), C = Ve(), { isAdmin: U } = nn(), [j, ne] = G(0), re = fe(null);
1624
+ Te(() => {
1624
1625
  if (!U) return;
1625
- const d = (N) => {
1626
- const C = N.detail;
1627
- !C || C.claimed || C.collection !== t || String(C.item) !== String(e) || (C.claimed = !0, $(!0), ne((O) => O + 1), setTimeout(
1626
+ const d = (S) => {
1627
+ const $ = S.detail;
1628
+ !$ || $.claimed || $.collection !== t || String($.item) !== String(e) || ($.claimed = !0, M(!0), ne((D) => D + 1), setTimeout(
1628
1629
  () => {
1629
- var O;
1630
- return (O = re.current) == null ? void 0 : O.scrollIntoView({ block: "center", behavior: "smooth" });
1630
+ var D;
1631
+ return (D = re.current) == null ? void 0 : D.scrollIntoView({ block: "center", behavior: "smooth" });
1631
1632
  },
1632
1633
  80
1633
1634
  ));
1634
1635
  };
1635
- return window.addEventListener(Lt, d), () => window.removeEventListener(Lt, d);
1636
+ return window.addEventListener(Et, d), () => window.removeEventListener(Et, d);
1636
1637
  }, [U, t, e]);
1637
- const [ae, F] = Q(""), [E, K] = Q(null), [f, v] = Q(!1), [g, $] = Q(!1), [T, X] = Q(null), [u, b] = Q(null), [M, ee] = Q(null), [W, ue] = Q([]), xe = Tn(t, String(e));
1638
- on(t, e, "transition", !!E || !!T);
1639
- const de = er(t, e, "transition"), D = ce(!1);
1640
- _e(() => {
1641
- !D.current && r !== void 0 && (D.current = !0, $(r));
1642
- }, [r]);
1643
- const Y = ce(!1), z = (d) => {
1644
- Y.current || (Y.current = !0, b(null), P.mutate(d, {
1645
- onSettled: (N, C) => {
1646
- if (C) {
1647
- Y.current = !1;
1638
+ const [ae, F] = G(""), [I, K] = G(null), [f, k] = G(!1), [x, M] = nr(r, !1), [T, Y] = G(null), [u, g] = G(null), [R, ee] = G(null), [W, ce] = G([]), ye = Tn(t, String(e));
1639
+ on(t, e, "transition", !!I || !!T);
1640
+ const oe = Zn(t, e, "transition"), P = fe(!1), le = (d) => {
1641
+ P.current || (P.current = !0, g(null), w.mutate(d, {
1642
+ onSettled: (S, $) => {
1643
+ if ($) {
1644
+ P.current = !1;
1648
1645
  return;
1649
1646
  }
1650
- Oe().finally(() => {
1651
- Y.current = !1;
1647
+ Fe().finally(() => {
1648
+ P.current = !1;
1652
1649
  });
1653
1650
  }
1654
1651
  }));
1655
- }, ie = async (d, N) => {
1656
- var fe, me;
1657
- if (Y.current || a != null && a.running_move) return;
1658
- if (E === d) {
1652
+ }, Q = async (d, S) => {
1653
+ var he, me;
1654
+ if (P.current || o != null && o.running_move) return;
1655
+ if (I === d) {
1659
1656
  K(null);
1660
1657
  return;
1661
1658
  }
1662
- if (!(N != null && N.cleared) && ((a == null ? void 0 : a.available_transitions) ?? []).some((le) => le.id === d && le.advisory)) {
1663
- K(null), b(null), ee(d), _.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1659
+ if (!(S != null && S.cleared) && ((o == null ? void 0 : o.available_transitions) ?? []).some((ie) => ie.id === d && ie.advisory)) {
1660
+ K(null), g(null), ee(d), C.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1664
1661
  return;
1665
1662
  }
1666
- if (ee(null), h) {
1667
- Y.current = !0;
1668
- let le = !1;
1663
+ if (ee(null), b) {
1664
+ P.current = !0;
1665
+ let ie = !1;
1669
1666
  try {
1670
- le = await h();
1667
+ ie = await b();
1671
1668
  } finally {
1672
- Y.current = !1;
1669
+ P.current = !1;
1673
1670
  }
1674
- if (!le) return;
1671
+ if (!ie) return;
1675
1672
  }
1676
- const C = (G ?? []).find((le) => le.id === d), O = String((C == null ? void 0 : C.comment_mode) ?? "none"), te = qt(C, (a == null ? void 0 : a.states) ?? [], (fe = a == null ? void 0 : a.instance) == null ? void 0 : fe.current_state);
1677
- if (O !== "optional" && O !== "required") {
1678
- if (C && !Xe(C, (a == null ? void 0 : a.states) ?? [], (me = a == null ? void 0 : a.instance) == null ? void 0 : me.current_state)) {
1679
- Y.current = !0;
1680
- let le = [];
1673
+ const $ = (Z ?? []).find((ie) => ie.id === d), D = String(($ == null ? void 0 : $.comment_mode) ?? "none"), te = qt($, (o == null ? void 0 : o.states) ?? [], (he = o == null ? void 0 : o.instance) == null ? void 0 : he.current_state);
1674
+ if (D !== "optional" && D !== "required") {
1675
+ if ($ && !Xe($, (o == null ? void 0 : o.states) ?? [], (me = o == null ? void 0 : o.instance) == null ? void 0 : me.current_state)) {
1676
+ P.current = !0;
1677
+ let ie = [];
1681
1678
  try {
1682
- le = await xe();
1679
+ ie = await ye();
1683
1680
  } finally {
1684
- Y.current = !1;
1681
+ P.current = !1;
1685
1682
  }
1686
- if (le.length > 0 || te) {
1687
- ue(le), K(d);
1683
+ if (ie.length > 0 || te) {
1684
+ ce(ie), K(d);
1688
1685
  return;
1689
1686
  }
1690
1687
  }
1691
1688
  if (te) {
1692
- ue([]), K(d);
1689
+ ce([]), K(d);
1693
1690
  return;
1694
1691
  }
1695
- z({ transition_id: d });
1692
+ le({ transition_id: d });
1696
1693
  return;
1697
1694
  }
1698
- ue([]), K(d);
1699
- }, H = k ? ["pipeline-instance", t, e, k] : ["pipeline-instance", t, e], { settling: qe, settle: Oe } = _n(H), { data: a, isLoading: I } = be({
1700
- queryKey: H,
1701
- queryFn: () => R.request(
1702
- we(
1703
- `/pipelines/instance/${t}/${e}${k ? `?as_role=${encodeURIComponent(k)}` : ""}`
1695
+ ce([]), K(d);
1696
+ }, J = N ? ["pipeline-instance", t, e, N] : ["pipeline-instance", t, e], { settling: se, settle: Fe } = _n(J), { data: o, isLoading: h } = xe({
1697
+ queryKey: J,
1698
+ queryFn: () => A.request(
1699
+ ke(
1700
+ `/pipelines/instance/${t}/${e}${N ? `?as_role=${encodeURIComponent(N)}` : ""}`
1704
1701
  )
1705
1702
  ).then(
1706
1703
  (d) => d.data ?? {
@@ -1715,101 +1712,101 @@ function jr({
1715
1712
  staleTime: 1e4,
1716
1713
  refetchInterval: (d) => mn(d.state.data)
1717
1714
  });
1718
- pn(!!(a != null && a.running_move), () => {
1719
- Ie(_, t, String(e)), je(_, t, String(e)), nt(_, t, String(e));
1715
+ pn(!!(o != null && o.running_move), () => {
1716
+ Le(C, t, String(e)), Ie(C, t, String(e)), nt(C, t, String(e));
1720
1717
  });
1721
- const Z = Sn(
1722
- a ? (a.available_transitions ?? []).map((d) => String(d.id)) : null,
1718
+ const B = Sn(
1719
+ o ? (o.available_transitions ?? []).map((d) => String(d.id)) : null,
1723
1720
  `${t}:${e}`
1724
1721
  );
1725
- _e(
1726
- () => _.getQueryCache().subscribe((d) => {
1722
+ Te(
1723
+ () => C.getQueryCache().subscribe((d) => {
1727
1724
  if (d.type !== "updated" || d.action.type !== "success") return;
1728
- const N = d.query.queryKey;
1729
- Array.isArray(N) && N[0] === "item" && N[1] === t && String(N[2]) === e && _.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1725
+ const S = d.query.queryKey;
1726
+ Array.isArray(S) && S[0] === "item" && S[1] === t && String(S[2]) === e && C.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
1730
1727
  }),
1731
- [_, t, e]
1728
+ [C, t, e]
1732
1729
  );
1733
- const { data: J, isLoading: he } = be({
1730
+ const { data: V, isLoading: ue } = xe({
1734
1731
  queryKey: ["pipeline-all-owners", t, e],
1735
- queryFn: () => R.request(
1736
- we(`/pipelines/instance/${t}/${e}/owners/all`)
1732
+ queryFn: () => A.request(
1733
+ ke(`/pipelines/instance/${t}/${e}/owners/all`)
1737
1734
  ).then((d) => d.data ?? null),
1738
1735
  // Also when a send back is on offer: its target may be a chain step this record skipped.
1739
1736
  // And while a move is being confirmed: the panel names where it really lands.
1740
- enabled: (g || Rn(a) || !!E) && !!(a != null && a.instance),
1737
+ enabled: (x || Rn(o) || !!I) && !!(o != null && o.instance),
1741
1738
  staleTime: 3e4
1742
- }), l = et(() => {
1743
- if (!J) return null;
1744
- const d = Object.entries(J);
1745
- return d.length === 0 || d.every(([, N]) => N.on_path === void 0) ? null : new Set(d.filter(([, N]) => N.on_path !== !1).map(([N]) => N));
1746
- }, [J]), y = et(() => {
1747
- if (!J) return null;
1739
+ }), be = et(() => {
1740
+ if (!V) return null;
1741
+ const d = Object.entries(V);
1742
+ return d.length === 0 || d.every(([, S]) => S.on_path === void 0) ? null : new Set(d.filter(([, S]) => S.on_path !== !1).map(([S]) => S));
1743
+ }, [V]), l = et(() => {
1744
+ if (!V) return null;
1748
1745
  const d = /* @__PURE__ */ new Map();
1749
- for (const [N, C] of Object.entries(J))
1750
- C.skipped && d.set(N, C.skip_reasons ?? []);
1746
+ for (const [S, $] of Object.entries(V))
1747
+ $.skipped && d.set(S, $.skip_reasons ?? []);
1751
1748
  return d;
1752
- }, [J]), w = Qe({
1753
- mutationFn: () => R.request(Ge(`/pipelines/instance/${t}/${e}/start`, {})),
1749
+ }, [V]), y = je({
1750
+ mutationFn: () => A.request(Ge(`/pipelines/instance/${t}/${e}/start`, {})),
1754
1751
  onSuccess: () => {
1755
- _.invalidateQueries({ queryKey: H }), V.success("Pipeline started");
1752
+ C.invalidateQueries({ queryKey: J }), X.success("Pipeline started");
1756
1753
  },
1757
- onError: () => V.error("Failed to start pipeline")
1758
- }), P = Qe({
1754
+ onError: () => X.error("Failed to start pipeline")
1755
+ }), w = je({
1759
1756
  mutationFn: ({
1760
1757
  transition_id: d,
1761
- comment: N,
1762
- reviewed: C,
1763
- lock_ack: O
1764
- }) => R.request(
1758
+ comment: S,
1759
+ reviewed: $,
1760
+ lock_ack: D
1761
+ }) => A.request(
1765
1762
  Ge(`/pipelines/instance/${t}/${e}/transition`, {
1766
1763
  transition_id: d,
1767
- comment: N,
1768
- ...C ? { reviewed: !0 } : {},
1769
- ...O ? { lock_ack: !0 } : {},
1770
- ...hn(a == null ? void 0 : a.available_transitions, d)
1764
+ comment: S,
1765
+ ...$ ? { reviewed: !0 } : {},
1766
+ ...D ? { lock_ack: !0 } : {},
1767
+ ...hn(o == null ? void 0 : o.available_transitions, d)
1771
1768
  })
1772
1769
  ),
1773
1770
  onMutate: (d) => {
1774
- var N;
1771
+ var S;
1775
1772
  return {
1776
- slow: An(
1777
- (N = [...(a == null ? void 0 : a.available_transitions) ?? [], ...(a == null ? void 0 : a.all_transitions) ?? []].find(
1778
- (C) => C.id === d.transition_id
1779
- )) == null ? void 0 : N.label
1773
+ slow: Fn(
1774
+ (S = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
1775
+ ($) => $.id === d.transition_id
1776
+ )) == null ? void 0 : S.label
1780
1777
  )
1781
1778
  };
1782
1779
  },
1783
- onSuccess: (d, N, C) => {
1784
- _.invalidateQueries({ queryKey: H }), t === "nivaro_addendums" && _.invalidateQueries({ queryKey: ["addendums"] }), Ie(_, t, String(e)), je(_, t, String(e)), nt(_, t, String(e)), b(null), F(""), K(null), X(null);
1785
- const O = fn(d);
1786
- O ? V.info(
1787
- `${O.transition_label ?? "The move"} started. You will be told if it does not go through.`,
1788
- C == null ? void 0 : C.slow.done()
1789
- ) : V.success(Fn(a, N.transition_id, d), C == null ? void 0 : C.slow.done());
1780
+ onSuccess: (d, S, $) => {
1781
+ C.invalidateQueries({ queryKey: J }), t === "nivaro_addendums" && C.invalidateQueries({ queryKey: ["addendums"] }), Le(C, t, String(e)), Ie(C, t, String(e)), nt(C, t, String(e)), g(null), F(""), K(null), Y(null);
1782
+ const D = fn(d);
1783
+ D ? X.info(
1784
+ `${D.transition_label ?? "The move"} started. You will be told if it does not go through.`,
1785
+ $ == null ? void 0 : $.slow.done()
1786
+ ) : X.success(An(o, S.transition_id, d), $ == null ? void 0 : $.slow.done());
1790
1787
  },
1791
- onError: (d, N, C) => {
1792
- var le, ze;
1793
- if (C == null || C.slow.fail(), yn(d)) {
1794
- _.invalidateQueries({ queryKey: H });
1788
+ onError: (d, S, $) => {
1789
+ var ie, ze;
1790
+ if ($ == null || $.slow.fail(), yn(d)) {
1791
+ C.invalidateQueries({ queryKey: J });
1795
1792
  return;
1796
1793
  }
1797
1794
  if (at(d) === "TRANSITION_RUNNING") {
1798
- _.invalidateQueries({ queryKey: H }), K(null), X(null), V.info(Ae(d, "This move is already running on this record."));
1795
+ C.invalidateQueries({ queryKey: J }), K(null), Y(null), X.info(Ae(d, "This move is already running on this record."));
1799
1796
  return;
1800
1797
  }
1801
- const O = kn(d);
1802
- if (O) {
1798
+ const D = kn(d);
1799
+ if (D) {
1803
1800
  K(null);
1804
- const ke = ((le = [...(a == null ? void 0 : a.available_transitions) ?? [], ...(a == null ? void 0 : a.all_transitions) ?? []].find(
1805
- (A) => A.id === N.transition_id
1806
- )) == null ? void 0 : le.label) ?? "Move";
1807
- V.warning(O.message, {
1801
+ const Ne = ((ie = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
1802
+ (O) => O.id === S.transition_id
1803
+ )) == null ? void 0 : ie.label) ?? "Move";
1804
+ X.warning(D.message, {
1808
1805
  id: `nvr-locked-move:${t}:${String(e)}`,
1809
1806
  duration: 2e4,
1810
1807
  action: {
1811
- label: `${ke} anyway`,
1812
- onClick: () => z({ ...N, lock_ack: !0 })
1808
+ label: `${Ne} anyway`,
1809
+ onClick: () => le({ ...S, lock_ack: !0 })
1813
1810
  },
1814
1811
  cancel: { label: "Wait", onClick: () => {
1815
1812
  } }
@@ -1818,23 +1815,23 @@ function jr({
1818
1815
  }
1819
1816
  const te = wn(d);
1820
1817
  if (te) {
1821
- X((ke) => ({
1818
+ Y((Ne) => ({
1822
1819
  payload: te,
1823
- transitionId: N.transition_id,
1824
- comment: N.comment,
1825
- revision: ((ke == null ? void 0 : ke.revision) ?? 0) + 1
1820
+ transitionId: S.transition_id,
1821
+ comment: S.comment,
1822
+ revision: ((Ne == null ? void 0 : Ne.revision) ?? 0) + 1
1826
1823
  }));
1827
1824
  return;
1828
1825
  }
1829
- const fe = d == null ? void 0 : d.response;
1830
- b(Nn(d, N));
1826
+ const he = d == null ? void 0 : d.response;
1827
+ g(Nn(d, S));
1831
1828
  const me = an(
1832
1829
  d,
1833
- (ze = [...(a == null ? void 0 : a.available_transitions) ?? [], ...(a == null ? void 0 : a.all_transitions) ?? []].find(
1834
- (ke) => ke.id === N.transition_id
1830
+ (ze = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
1831
+ (Ne) => Ne.id === S.transition_id
1835
1832
  )) == null ? void 0 : ze.label
1836
1833
  );
1837
- V.error((me == null ? void 0 : me.title) ?? Ae(d, "Failed to execute transition"), {
1834
+ X.error((me == null ? void 0 : me.title) ?? Ae(d, "Failed to execute transition"), {
1838
1835
  duration: 12e3,
1839
1836
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
1840
1837
  // A partner's refusal copies what the toast said and the other system's answer as
@@ -1846,140 +1843,140 @@ function jr({
1846
1843
  // #1867: a refusal carries "Why?" — the role, owner or access rule
1847
1844
  // that stopped it, and who can change it.
1848
1845
  ...cn(d) ? {
1849
- action: un(R, {
1846
+ action: un(A, {
1850
1847
  collection: t,
1851
1848
  itemId: String(e),
1852
1849
  action: "transition",
1853
- transitionId: N.transition_id
1850
+ transitionId: S.transition_id
1854
1851
  })
1855
1852
  } : {}
1856
- }), X(null), K(null), Ie(_, t, String(e)), je(_, t, String(e)), (fe == null ? void 0 : fe.status) === 409 && _.invalidateQueries({ queryKey: H });
1853
+ }), Y(null), K(null), Le(C, t, String(e)), Ie(C, t, String(e)), (he == null ? void 0 : he.status) === 409 && C.invalidateQueries({ queryKey: J });
1857
1854
  }
1858
- }), B = ce(ie);
1859
- B.current = ie;
1860
- const oe = ce((a == null ? void 0 : a.available_transitions) ?? []);
1861
- if (oe.current = (a == null ? void 0 : a.available_transitions) ?? [], _e(() => {
1862
- const d = (N) => {
1863
- const C = N.detail;
1864
- if (!C || C.claimed || C.collection !== t || String(C.item) !== String(e)) return;
1865
- C.claimed = !0;
1866
- const O = String(C.transition_id).toUpperCase(), te = oe.current.find((fe) => String(fe.id).toUpperCase() === O);
1855
+ }), L = fe(Q);
1856
+ L.current = Q;
1857
+ const E = fe((o == null ? void 0 : o.available_transitions) ?? []);
1858
+ if (E.current = (o == null ? void 0 : o.available_transitions) ?? [], Te(() => {
1859
+ const d = (S) => {
1860
+ const $ = S.detail;
1861
+ if (!$ || $.claimed || $.collection !== t || String($.item) !== String(e)) return;
1862
+ $.claimed = !0;
1863
+ const D = String($.transition_id).toUpperCase(), te = E.current.find((he) => String(he.id).toUpperCase() === D);
1867
1864
  if (!te) {
1868
- V.error("That step is not available from where the record is now");
1865
+ X.error("That step is not available from where the record is now");
1869
1866
  return;
1870
1867
  }
1871
- B.current(te.id);
1868
+ L.current(te.id);
1872
1869
  };
1873
1870
  return window.addEventListener(tt, d), () => window.removeEventListener(tt, d);
1874
- }, [t, e]), I)
1875
- return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ i("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
1876
- /* @__PURE__ */ n(Me, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
1877
- /* @__PURE__ */ n(Me, { className: "h-4 w-20" }),
1878
- /* @__PURE__ */ n(Me, { className: "h-[22px] w-40 rounded-full" }),
1879
- /* @__PURE__ */ n(Me, { className: "ml-auto h-3.5 w-3.5 rounded" })
1871
+ }, [t, e]), h)
1872
+ return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ s("div", { className: "flex w-full items-center gap-2.5 px-5 py-3.5", children: [
1873
+ /* @__PURE__ */ n(qe, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
1874
+ /* @__PURE__ */ n(qe, { className: "h-4 w-20" }),
1875
+ /* @__PURE__ */ n(qe, { className: "h-[22px] w-40 rounded-full" }),
1876
+ /* @__PURE__ */ n(qe, { className: "ml-auto h-3.5 w-3.5 rounded" })
1880
1877
  ] }) });
1881
- if (!(a != null && a.binding)) return null;
1882
- const { instance: q, available_transitions: G, history: S, states: L } = a, ve = new Map((L ?? []).map((d) => [d.id, d])), Ce = (q == null ? void 0 : q.current_state_obj) ?? null, se = E ? (G ?? []).find((d) => d.id === E) : null, In = se ? ve.get(se.to_state) : null, Ye = Bn(se, Ce, L, J), st = (Ye == null ? void 0 : Ye.state) ?? In, jn = q != null && q.completed_at && G ? G.filter(
1878
+ if (!(o != null && o.binding)) return null;
1879
+ const { instance: q, available_transitions: Z, history: z, states: _ } = o, H = new Map((_ ?? []).map((d) => [d.id, d])), ge = (q == null ? void 0 : q.current_state_obj) ?? null, de = I ? (Z ?? []).find((d) => d.id === I) : null, Qe = de ? H.get(de.to_state) : null, Ye = Bn(de, ge, _, V), st = (Ye == null ? void 0 : Ye.state) ?? Qe, In = q != null && q.completed_at && Z ? Z.filter(
1883
1880
  (d) => d.from_state && String(d.from_state).toUpperCase() === String(q.current_state).toUpperCase()
1884
- ) : null, De = q != null && q.completed_at ? jn ?? [] : Pn(
1885
- G ?? [],
1886
- L ?? [],
1881
+ ) : null, Oe = q != null && q.completed_at ? In ?? [] : Pn(
1882
+ Z ?? [],
1883
+ _ ?? [],
1887
1884
  q == null ? void 0 : q.current_state,
1888
- y
1889
- ), it = De.length > 0, Mt = gn(De), Ke = M ? De.find((d) => d.id === M) : null, $e = (a == null ? void 0 : a.running_move) ?? null, We = $e ? null : (a == null ? void 0 : a.last_move_problem) ?? null, Rt = We ? De.find((d) => vt(d.id, We.transition_id)) : null, Pt = (d, N = !1) => {
1890
- const C = /* @__PURE__ */ new Map();
1891
- for (const O of d) {
1892
- const te = C.get(O.label) ?? [];
1893
- te.push(O), C.set(O.label, te);
1885
+ l
1886
+ ), it = Oe.length > 0, Mt = gn(Oe), Ke = R ? Oe.find((d) => d.id === R) : null, Ce = (o == null ? void 0 : o.running_move) ?? null, We = Ce ? null : (o == null ? void 0 : o.last_move_problem) ?? null, Rt = We ? Oe.find((d) => vt(d.id, We.transition_id)) : null, Pt = (d, S = !1) => {
1887
+ const $ = /* @__PURE__ */ new Map();
1888
+ for (const D of d) {
1889
+ const te = $.get(D.label) ?? [];
1890
+ te.push(D), $.set(D.label, te);
1894
1891
  }
1895
- return Array.from(C.entries()).map(([O, te]) => {
1896
- var ze, ke;
1897
- const fe = ((ze = te[0]) == null ? void 0 : ze.color) ?? null, me = te.some((A) => A.id === E), le = (A) => fe ? A ? { backgroundColor: fe, borderColor: fe } : { borderColor: fe, color: fe } : void 0;
1892
+ return Array.from($.entries()).map(([D, te]) => {
1893
+ var ze, Ne;
1894
+ const he = ((ze = te[0]) == null ? void 0 : ze.color) ?? null, me = te.some((O) => O.id === I), ie = (O) => he ? O ? { backgroundColor: he, borderColor: he } : { borderColor: he, color: he } : void 0;
1898
1895
  if (te.length === 1) {
1899
- const A = te[0], Te = P.isPending && ((ke = P.variables) == null ? void 0 : ke.transition_id) === A.id || vt($e == null ? void 0 : $e.transition_id, A.id), Ue = bn(We, A.id), He = /* @__PURE__ */ i(
1896
+ const O = te[0], $e = w.isPending && ((Ne = w.variables) == null ? void 0 : Ne.transition_id) === O.id || vt(Ce == null ? void 0 : Ce.transition_id, O.id), De = bn(We, O.id), He = /* @__PURE__ */ s(
1900
1897
  pe,
1901
1898
  {
1902
1899
  size: "sm",
1903
- variant: me && !A.advisory ? "default" : "outline",
1904
- className: ge(
1905
- N ? "h-7 text-[11px]" : "text-[12px]",
1900
+ variant: me && !O.advisory ? "default" : "outline",
1901
+ className: ve(
1902
+ S ? "h-7 text-[11px]" : "text-[12px]",
1906
1903
  "gap-1.5 data-[fresh=true]:opacity-60",
1907
- A.advisory && On
1904
+ O.advisory && On
1908
1905
  ),
1909
- style: A.advisory ? void 0 : le(me),
1910
- disabled: P.isPending || qe || !!$e || !!Ue,
1911
- "aria-disabled": Z.dimmed(A.id) || void 0,
1912
- "data-fresh": Z.dimmed(A.id) || void 0,
1913
- ...Z.bind(A.id),
1914
- ...Le(A),
1906
+ style: O.advisory ? void 0 : ie(me),
1907
+ disabled: w.isPending || se || !!Ce || !!De,
1908
+ "aria-disabled": B.dimmed(O.id) || void 0,
1909
+ "data-fresh": B.dimmed(O.id) || void 0,
1910
+ ...B.bind(O.id),
1911
+ ...Be(O),
1915
1912
  onClick: () => {
1916
- Z.press(A.id) && ie(A.id);
1913
+ B.press(O.id) && Q(O.id);
1917
1914
  },
1918
1915
  children: [
1919
- Te ? /* @__PURE__ */ n(ye, { className: "h-3 w-3 animate-spin" }) : A.advisory && /* @__PURE__ */ n(Ne, {}),
1920
- O
1916
+ $e ? /* @__PURE__ */ n(we, { className: "h-3 w-3 animate-spin" }) : O.advisory && /* @__PURE__ */ n(_e, {}),
1917
+ D
1921
1918
  ]
1922
1919
  },
1923
- O
1920
+ D
1924
1921
  );
1925
- return Ue ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": Ue, "data-move-held": !0, children: He }, O) : He;
1922
+ return De ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": De, "data-move-held": !0, children: He }, D) : He;
1926
1923
  }
1927
- return /* @__PURE__ */ i(mt, { children: [
1928
- /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ i(
1924
+ return /* @__PURE__ */ s(mt, { children: [
1925
+ /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ s(
1929
1926
  pe,
1930
1927
  {
1931
1928
  size: "sm",
1932
1929
  variant: me ? "default" : "outline",
1933
- className: `${N ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
1934
- style: le(me),
1935
- disabled: P.isPending || qe || !!$e,
1930
+ className: `${S ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
1931
+ style: ie(me),
1932
+ disabled: w.isPending || se || !!Ce,
1936
1933
  children: [
1937
- te.every((A) => A.advisory) && /* @__PURE__ */ n(Ne, {}),
1938
- O,
1939
- /* @__PURE__ */ n(Fe, { className: "h-3 w-3" })
1934
+ te.every((O) => O.advisory) && /* @__PURE__ */ n(_e, {}),
1935
+ D,
1936
+ /* @__PURE__ */ n(Pe, { className: "h-3 w-3" })
1940
1937
  ]
1941
1938
  }
1942
1939
  ) }),
1943
- /* @__PURE__ */ i(ft, { align: "start", children: [
1940
+ /* @__PURE__ */ s(ft, { align: "start", children: [
1944
1941
  [...te].sort(
1945
- (A, Te) => {
1946
- var Ue, He;
1947
- return (((Ue = ve.get(A.to_state)) == null ? void 0 : Ue.sort) ?? 999) - (((He = ve.get(Te.to_state)) == null ? void 0 : He.sort) ?? 999);
1942
+ (O, $e) => {
1943
+ var De, He;
1944
+ return (((De = H.get(O.to_state)) == null ? void 0 : De.sort) ?? 999) - (((He = H.get($e.to_state)) == null ? void 0 : He.sort) ?? 999);
1948
1945
  }
1949
- ).map((A) => {
1950
- var Te;
1951
- return /* @__PURE__ */ i(
1946
+ ).map((O) => {
1947
+ var $e;
1948
+ return /* @__PURE__ */ s(
1952
1949
  Je,
1953
1950
  {
1954
- onSelect: () => ie(A.id),
1955
- ...Le(A, "menu"),
1951
+ onSelect: () => Q(O.id),
1952
+ ...Be(O, "menu"),
1956
1953
  children: [
1957
- A.color && /* @__PURE__ */ n(
1954
+ O.color && /* @__PURE__ */ n(
1958
1955
  "span",
1959
1956
  {
1960
1957
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
1961
- style: { backgroundColor: A.color }
1958
+ style: { backgroundColor: O.color }
1962
1959
  }
1963
1960
  ),
1964
- ((Te = ve.get(A.to_state)) == null ? void 0 : Te.label) ?? A.to_state,
1965
- A.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" })
1961
+ (($e = H.get(O.to_state)) == null ? void 0 : $e.label) ?? O.to_state,
1962
+ O.advisory && /* @__PURE__ */ n(_e, { className: "ml-auto" })
1966
1963
  ]
1967
1964
  },
1968
- A.id
1965
+ O.id
1969
1966
  );
1970
1967
  }),
1971
1968
  /* @__PURE__ */ n(
1972
1969
  kt,
1973
1970
  {
1974
1971
  moves: te,
1975
- nameOf: (A) => {
1976
- var Te;
1977
- return ((Te = ve.get(A.to_state)) == null ? void 0 : Te.label) ?? A.to_state;
1972
+ nameOf: (O) => {
1973
+ var $e;
1974
+ return (($e = H.get(O.to_state)) == null ? void 0 : $e.label) ?? O.to_state;
1978
1975
  }
1979
1976
  }
1980
1977
  )
1981
1978
  ] })
1982
- ] }, O);
1979
+ ] }, D);
1983
1980
  });
1984
1981
  }, ot = u ? /* @__PURE__ */ n(
1985
1982
  Un,
@@ -1987,34 +1984,34 @@ function jr({
1987
1984
  collection: t,
1988
1985
  item: String(e),
1989
1986
  offer: u,
1990
- onDismiss: () => b(null),
1991
- onFixed: () => z({ transition_id: u.transitionId, comment: u.comment })
1987
+ onDismiss: () => g(null),
1988
+ onFixed: () => le({ transition_id: u.transitionId, comment: u.comment })
1992
1989
  }
1993
- ) : null, Qn = g && !m && !!q && it, Ft = (d) => /* @__PURE__ */ i(Se, { children: [
1994
- Mt.map(({ advisory: N, moves: C }) => /* @__PURE__ */ n(
1990
+ ) : null, jn = x && !m && !!q && it, At = (d) => /* @__PURE__ */ s(Se, { children: [
1991
+ Mt.map(({ advisory: S, moves: $ }) => /* @__PURE__ */ n(
1995
1992
  xn,
1996
1993
  {
1997
1994
  collection: t,
1998
1995
  item: String(e),
1999
- advisory: N,
2000
- armedMove: Ke && C.some((O) => O.id === Ke.id) ? {
1996
+ advisory: S,
1997
+ armedMove: Ke && $.some((D) => D.id === Ke.id) ? {
2001
1998
  id: Ke.id,
2002
1999
  label: Ke.label,
2003
- confirms: Dn(Ke, L ?? [], q == null ? void 0 : q.current_state)
2000
+ confirms: Dn(Ke, _ ?? [], q == null ? void 0 : q.current_state)
2004
2001
  } : null,
2005
- stops: Mt.length > 1 ? [...new Set(C.map((O) => O.label))] : void 0,
2002
+ stops: Mt.length > 1 ? [...new Set($.map((D) => D.label))] : void 0,
2006
2003
  className: d ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0,
2007
2004
  onDismiss: () => ee(null),
2008
- onFixed: (O) => {
2009
- ee(null), _.invalidateQueries({ queryKey: H }), O && ie(O.id, { cleared: !0 });
2005
+ onFixed: (D) => {
2006
+ ee(null), C.invalidateQueries({ queryKey: J }), D && Q(D.id, { cleared: !0 });
2010
2007
  }
2011
2008
  },
2012
- `${N.code}:${N.message}`
2009
+ `${S.code}:${S.message}`
2013
2010
  )),
2014
- $e && /* @__PURE__ */ n(
2011
+ Ce && /* @__PURE__ */ n(
2015
2012
  fr,
2016
2013
  {
2017
- run: $e,
2014
+ run: Ce,
2018
2015
  className: d ? "rounded-lg border border-sky-200/80 px-3 dark:border-sky-500/20" : void 0
2019
2016
  }
2020
2017
  ),
@@ -2022,24 +2019,24 @@ function jr({
2022
2019
  hr,
2023
2020
  {
2024
2021
  problem: We,
2025
- retryDisabled: P.isPending || qe,
2026
- onRetry: Rt ? () => void ie(Rt.id) : void 0,
2022
+ retryDisabled: w.isPending || se,
2023
+ onRetry: Rt ? () => void Q(Rt.id) : void 0,
2027
2024
  className: d ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0
2028
2025
  }
2029
2026
  )
2030
- ] }), At = Ar(S ?? [], q == null ? void 0 : q.current_state, L ?? []), Ot = /* @__PURE__ */ i("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
2031
- /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
2027
+ ] }), Ft = Fr(z ?? [], q == null ? void 0 : q.current_state, _ ?? []), Ot = /* @__PURE__ */ s("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3.5", children: [
2028
+ /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
2032
2029
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
2033
- se && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: se.label }),
2034
- Ce && st && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2035
- /* @__PURE__ */ n(Re, { label: Ce.label, color: Ce.color, small: !0 }),
2030
+ de && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: de.label }),
2031
+ ge && st && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1.5", children: [
2032
+ /* @__PURE__ */ n(Me, { label: ge.label, color: ge.color, small: !0 }),
2036
2033
  /* @__PURE__ */ n(Nt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2037
- /* @__PURE__ */ n(Re, { label: st.label, color: st.color, small: !0 })
2034
+ /* @__PURE__ */ n(Me, { label: st.label, color: st.color, small: !0 })
2038
2035
  ] })
2039
2036
  ] }),
2040
- /* @__PURE__ */ n(Ln, { landing: Ye }),
2041
- /* @__PURE__ */ n(Mn, { collection: t, item: String(e), tx: se }),
2042
- /* @__PURE__ */ n(En, { collection: t, item: e, omitLines: W }),
2037
+ /* @__PURE__ */ n(En, { landing: Ye }),
2038
+ /* @__PURE__ */ n(Mn, { collection: t, item: String(e), tx: de }),
2039
+ /* @__PURE__ */ n(Ln, { collection: t, item: e, omitLines: W }),
2043
2040
  /* @__PURE__ */ n(qn, { lines: W }),
2044
2041
  /* @__PURE__ */ n(
2045
2042
  "input",
@@ -2047,11 +2044,11 @@ function jr({
2047
2044
  type: "text",
2048
2045
  value: ae,
2049
2046
  onChange: (d) => F(d.target.value),
2050
- placeholder: String((se == null ? void 0 : se.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2047
+ placeholder: String((de == null ? void 0 : de.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2051
2048
  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"
2052
2049
  }
2053
2050
  ),
2054
- /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
2051
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
2055
2052
  /* @__PURE__ */ n(
2056
2053
  pe,
2057
2054
  {
@@ -2069,45 +2066,45 @@ function jr({
2069
2066
  type: "button",
2070
2067
  size: "sm",
2071
2068
  className: "h-7 gap-1.5 text-[12px]",
2072
- disabled: P.isPending || !!$e || String((se == null ? void 0 : se.comment_mode) ?? "") === "required" && ae.trim() === "",
2073
- onClick: () => z({
2074
- transition_id: E,
2069
+ disabled: w.isPending || !!Ce || String((de == null ? void 0 : de.comment_mode) ?? "") === "required" && ae.trim() === "",
2070
+ onClick: () => le({
2071
+ transition_id: I,
2075
2072
  comment: ae.trim() || void 0
2076
2073
  }),
2077
- children: P.isPending ? /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(Se, { children: [
2078
- /* @__PURE__ */ n("span", { children: W.length > 0 && se ? `${se.label} anyway` : "Confirm" }),
2074
+ children: w.isPending ? /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Se, { children: [
2075
+ /* @__PURE__ */ n("span", { children: W.length > 0 && de ? `${de.label} anyway` : "Confirm" }),
2079
2076
  /* @__PURE__ */ n(rt, { className: "h-3 w-3" })
2080
2077
  ] })
2081
2078
  }
2082
2079
  )
2083
2080
  ] })
2084
2081
  ] });
2085
- return /* @__PURE__ */ i(Se, { children: [
2086
- /* @__PURE__ */ i(
2082
+ return /* @__PURE__ */ s(Se, { children: [
2083
+ /* @__PURE__ */ s(
2087
2084
  "div",
2088
2085
  {
2089
- className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${x ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
2086
+ className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${v ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
2090
2087
  children: [
2091
- /* @__PURE__ */ i(
2088
+ /* @__PURE__ */ s(
2092
2089
  "div",
2093
2090
  {
2094
2091
  role: "button",
2095
2092
  tabIndex: 0,
2096
- onClick: () => $((d) => !d),
2097
- onKeyDown: (d) => (d.key === "Enter" || d.key === " ") && $((N) => !N),
2093
+ onClick: () => M((d) => !d),
2094
+ onKeyDown: (d) => (d.key === "Enter" || d.key === " ") && M((S) => !S),
2098
2095
  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]",
2099
2096
  children: [
2100
2097
  /* @__PURE__ */ n(dt, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
2101
- /* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: s || "Pipeline" }),
2102
- /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
2103
- x && /* @__PURE__ */ n("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" }),
2104
- Ce && /* @__PURE__ */ n(Re, { label: Ce.label, color: Ce.color }),
2105
- /* @__PURE__ */ n(Pr, { flags: a == null ? void 0 : a.flags }),
2106
- (((Dt = a == null ? void 0 : a.auto_held) == null ? void 0 : Dt.length) ?? 0) > 0 && /* @__PURE__ */ i(
2098
+ /* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: a || "Pipeline" }),
2099
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
2100
+ v && /* @__PURE__ */ n("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" }),
2101
+ ge && /* @__PURE__ */ n(Me, { label: ge.label, color: ge.color }),
2102
+ /* @__PURE__ */ n(Pr, { flags: o == null ? void 0 : o.flags }),
2103
+ (((Dt = o == null ? void 0 : o.auto_held) == null ? void 0 : Dt.length) ?? 0) > 0 && /* @__PURE__ */ s(
2107
2104
  "span",
2108
2105
  {
2109
2106
  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",
2110
- "data-tip": ((a == null ? void 0 : a.auto_held) ?? []).map((d) => `${d.transition_label ?? "Automatic move"}: ${d.error ?? "refused"}`).join(`
2107
+ "data-tip": ((o == null ? void 0 : o.auto_held) ?? []).map((d) => `${d.transition_label ?? "Automatic move"}: ${d.error ?? "refused"}`).join(`
2111
2108
  `),
2112
2109
  "data-pipeline-auto-held-pill": !0,
2113
2110
  children: [
@@ -2116,143 +2113,143 @@ function jr({
2116
2113
  ]
2117
2114
  }
2118
2115
  ),
2119
- p && /* @__PURE__ */ i("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
2116
+ p && /* @__PURE__ */ s("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
2120
2117
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
2121
2118
  "Addendum in review"
2122
2119
  ] }),
2123
- de.length > 0 && /* @__PURE__ */ i(
2120
+ oe.length > 0 && /* @__PURE__ */ s(
2124
2121
  "span",
2125
2122
  {
2126
2123
  className: "flex items-center gap-1 rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:border-sky-500/20 dark:bg-sky-500/10 dark:text-sky-300",
2127
2124
  "data-pipeline-approving": !0,
2128
2125
  children: [
2129
2126
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
2130
- tr(de, "approving")
2127
+ er(oe, "approving")
2131
2128
  ]
2132
2129
  }
2133
2130
  )
2134
2131
  ] }),
2135
- /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-2", onClick: (d) => d.stopPropagation(), children: [
2136
- !g && it && !c && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: Pt(De, !0) }),
2137
- !g && !q && (a == null ? void 0 : a.binding) && /* @__PURE__ */ i(
2132
+ /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", onClick: (d) => d.stopPropagation(), children: [
2133
+ !x && it && !c && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: Pt(Oe, !0) }),
2134
+ !x && !q && (o == null ? void 0 : o.binding) && /* @__PURE__ */ s(
2138
2135
  pe,
2139
2136
  {
2140
2137
  size: "sm",
2141
2138
  variant: "outline",
2142
2139
  className: "h-7 gap-1.5 text-[11px]",
2143
2140
  onClick: (d) => {
2144
- d.stopPropagation(), w.mutate();
2141
+ d.stopPropagation(), y.mutate();
2145
2142
  },
2146
- disabled: w.isPending,
2143
+ disabled: y.isPending,
2147
2144
  children: [
2148
- w.isPending ? /* @__PURE__ */ n(ye, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(dt, { className: "h-3 w-3" }),
2145
+ y.isPending ? /* @__PURE__ */ n(we, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(dt, { className: "h-3 w-3" }),
2149
2146
  "Start"
2150
2147
  ]
2151
2148
  }
2152
2149
  ),
2153
- o && ((a == null ? void 0 : a.binding) || (a == null ? void 0 : a.instance)) && /* @__PURE__ */ n(
2150
+ i && ((o == null ? void 0 : o.binding) || (o == null ? void 0 : o.instance)) && /* @__PURE__ */ n(
2154
2151
  Ir,
2155
2152
  {
2156
2153
  collection: t,
2157
2154
  item: e,
2158
- states: L ?? [],
2159
- currentStateId: ((Ut = a == null ? void 0 : a.instance) == null ? void 0 : Ut.current_state) ?? null
2155
+ states: _ ?? [],
2156
+ currentStateId: ((Ut = o == null ? void 0 : o.instance) == null ? void 0 : Ut.current_state) ?? null
2160
2157
  }
2161
2158
  )
2162
2159
  ] }),
2163
2160
  /* @__PURE__ */ n(
2164
- Fe,
2161
+ Pe,
2165
2162
  {
2166
- className: ge(
2163
+ className: ve(
2167
2164
  "h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
2168
- g && "rotate-180"
2165
+ x && "rotate-180"
2169
2166
  )
2170
2167
  }
2171
2168
  )
2172
2169
  ]
2173
2170
  }
2174
2171
  ),
2175
- !Qn && Ft(!1),
2176
- !g && E && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ot }),
2177
- !g && ot && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: ot }),
2178
- At && !(q != null && q.completed_at) && /* @__PURE__ */ n(Or, { entry: At }),
2179
- g && /* @__PURE__ */ i("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2180
- /* @__PURE__ */ n(Sr, { held: (a == null ? void 0 : a.auto_held) ?? [] }),
2181
- p && /* @__PURE__ */ i("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: [
2172
+ !jn && At(!1),
2173
+ !x && I && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ot }),
2174
+ !x && ot && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: ot }),
2175
+ Ft && !(q != null && q.completed_at) && /* @__PURE__ */ n(Or, { entry: Ft }),
2176
+ x && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2177
+ /* @__PURE__ */ n(Sr, { held: (o == null ? void 0 : o.auto_held) ?? [] }),
2178
+ p && /* @__PURE__ */ s("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: [
2182
2179
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
2183
2180
  /* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
2184
2181
  ] }),
2185
- q ? /* @__PURE__ */ i("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2186
- (L ?? []).length > 1 && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2187
- he ? (
2182
+ q ? /* @__PURE__ */ s("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2183
+ (_ ?? []).length > 1 && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2184
+ ue ? (
2188
2185
  // Path pruning arrives with the owners query — rendering
2189
2186
  // the UNPRUNED track first meant every state briefly
2190
2187
  // showed, then snapped into formation. Hold a same-height
2191
2188
  // placeholder until the real shape is known.
2192
- /* @__PURE__ */ i("div", { className: "flex h-[52px] items-center gap-2", children: [
2193
- [0, 1, 2, 3, 4].map((d) => /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
2194
- /* @__PURE__ */ n(Me, { className: "h-7 w-7 rounded-full" }),
2195
- d < 4 && /* @__PURE__ */ n(Me, { className: "h-0.5 w-10" })
2189
+ /* @__PURE__ */ s("div", { className: "flex h-[52px] items-center gap-2", children: [
2190
+ [0, 1, 2, 3, 4].map((d) => /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
2191
+ /* @__PURE__ */ n(qe, { className: "h-7 w-7 rounded-full" }),
2192
+ d < 4 && /* @__PURE__ */ n(qe, { className: "h-0.5 w-10" })
2196
2193
  ] }, d)),
2197
- /* @__PURE__ */ n(Me, { className: "ml-2 h-3 w-24" })
2194
+ /* @__PURE__ */ n(qe, { className: "ml-2 h-3 w-24" })
2198
2195
  ] })
2199
2196
  ) : /* @__PURE__ */ n(
2200
2197
  Ur,
2201
2198
  {
2202
- states: L,
2203
- allTransitions: (a == null ? void 0 : a.all_transitions) ?? [],
2204
- availableTransitions: G ?? [],
2199
+ states: _,
2200
+ allTransitions: (o == null ? void 0 : o.all_transitions) ?? [],
2201
+ availableTransitions: Z ?? [],
2205
2202
  currentStateId: q.current_state,
2206
- history: S ?? [],
2207
- onPathIds: l,
2208
- skippedStates: y
2203
+ history: z ?? [],
2204
+ onPathIds: be,
2205
+ skippedStates: l
2209
2206
  }
2210
2207
  ),
2211
- (a == null ? void 0 : a.branches) && /* @__PURE__ */ n(br, { data: a.branches }),
2208
+ (o == null ? void 0 : o.branches) && /* @__PURE__ */ n(br, { data: o.branches }),
2212
2209
  /* @__PURE__ */ n(
2213
2210
  Dr,
2214
2211
  {
2215
- history: S ?? [],
2212
+ history: z ?? [],
2216
2213
  completedAt: q.completed_at
2217
2214
  }
2218
2215
  )
2219
2216
  ] }),
2220
- /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2217
+ /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2221
2218
  !q.completed_at && /* @__PURE__ */ n(kr, { collection: t, itemId: String(e) }),
2222
2219
  /* @__PURE__ */ n(
2223
- Er,
2220
+ Lr,
2224
2221
  {
2225
2222
  collection: t,
2226
2223
  item: e,
2227
- states: L ?? [],
2228
- currentStateId: ((Bt = a == null ? void 0 : a.instance) == null ? void 0 : Bt.current_state) ?? null,
2229
- returned: ((a == null ? void 0 : a.history) ?? []).some(
2224
+ states: _ ?? [],
2225
+ currentStateId: ((Bt = o == null ? void 0 : o.instance) == null ? void 0 : Bt.current_state) ?? null,
2226
+ returned: ((o == null ? void 0 : o.history) ?? []).some(
2230
2227
  (d) => {
2231
- var N;
2232
- return !!d.from_state && d.to_state === ((N = a == null ? void 0 : a.instance) == null ? void 0 : N.current_state);
2228
+ var S;
2229
+ return !!d.from_state && d.to_state === ((S = o == null ? void 0 : o.instance) == null ? void 0 : S.current_state);
2233
2230
  }
2234
2231
  )
2235
2232
  }
2236
2233
  )
2237
2234
  ] }),
2238
- it && !m && /* @__PURE__ */ i("div", { className: "space-y-3 px-5 py-4", children: [
2239
- Ft(!0),
2240
- /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: Pt(De) }),
2241
- E && Ot,
2235
+ it && !m && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2236
+ At(!0),
2237
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: Pt(Oe) }),
2238
+ I && Ot,
2242
2239
  ot
2243
2240
  ] }),
2244
- /* @__PURE__ */ i("div", { className: "px-5 py-3", children: [
2245
- /* @__PURE__ */ i(
2241
+ /* @__PURE__ */ s("div", { className: "px-5 py-3", children: [
2242
+ /* @__PURE__ */ s(
2246
2243
  "button",
2247
2244
  {
2248
2245
  type: "button",
2249
2246
  className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
2250
- onClick: () => v((d) => !d),
2247
+ onClick: () => k((d) => !d),
2251
2248
  children: [
2252
2249
  /* @__PURE__ */ n(
2253
- Fe,
2250
+ Pe,
2254
2251
  {
2255
- className: ge(
2252
+ className: ve(
2256
2253
  "h-3.5 w-3.5 transition-transform duration-200",
2257
2254
  f && "rotate-180"
2258
2255
  )
@@ -2260,43 +2257,43 @@ function jr({
2260
2257
  ),
2261
2258
  "Transition history",
2262
2259
  " ",
2263
- /* @__PURE__ */ i("span", { className: "tabular-nums", children: [
2260
+ /* @__PURE__ */ s("span", { className: "tabular-nums", children: [
2264
2261
  "(",
2265
- (S == null ? void 0 : S.length) ?? 0,
2262
+ (z == null ? void 0 : z.length) ?? 0,
2266
2263
  ")"
2267
2264
  ] })
2268
2265
  ]
2269
2266
  }
2270
2267
  ),
2271
- f && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(Br, { history: S ?? [] }) })
2268
+ f && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(Br, { history: z ?? [] }) })
2272
2269
  ] }),
2273
- U && (L ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: re, children: /* @__PURE__ */ n(
2270
+ U && (_ ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: re, children: /* @__PURE__ */ n(
2274
2271
  wr,
2275
2272
  {
2276
2273
  collection: t,
2277
2274
  item: e,
2278
- states: L ?? [],
2275
+ states: _ ?? [],
2279
2276
  currentStateId: q.current_state ?? null,
2280
2277
  openSignal: j,
2281
2278
  onMoved: () => {
2282
- _.invalidateQueries({ queryKey: H }), _.invalidateQueries({
2279
+ C.invalidateQueries({ queryKey: J }), C.invalidateQueries({
2283
2280
  queryKey: ["pipeline-instance", t, e]
2284
2281
  });
2285
2282
  }
2286
2283
  }
2287
2284
  ) })
2288
- ] }) : /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
2285
+ ] }) : /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
2289
2286
  /* @__PURE__ */ n("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
2290
- /* @__PURE__ */ i(
2287
+ /* @__PURE__ */ s(
2291
2288
  pe,
2292
2289
  {
2293
2290
  size: "sm",
2294
2291
  variant: "outline",
2295
2292
  className: "shrink-0 gap-1.5 text-[12px]",
2296
- onClick: () => w.mutate(),
2297
- disabled: w.isPending,
2293
+ onClick: () => y.mutate(),
2294
+ disabled: y.isPending,
2298
2295
  children: [
2299
- w.isPending ? /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(dt, { className: "h-3.5 w-3.5" }),
2296
+ y.isPending ? /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(dt, { className: "h-3.5 w-3.5" }),
2300
2297
  "Start Pipeline"
2301
2298
  ]
2302
2299
  }
@@ -2315,25 +2312,25 @@ function jr({
2315
2312
  onSubmitted: () => (
2316
2313
  // mutateAsync so the dialog can stay busy until the transition
2317
2314
  // settles; the mutation's own onError/onSuccess handle the outcome.
2318
- P.mutateAsync({
2315
+ w.mutateAsync({
2319
2316
  transition_id: T.transitionId,
2320
2317
  comment: T.comment,
2321
2318
  reviewed: !0
2322
2319
  }).catch(() => {
2323
2320
  })
2324
2321
  ),
2325
- executing: P.isPending,
2326
- onClose: () => X(null)
2322
+ executing: w.isPending,
2323
+ onClose: () => Y(null)
2327
2324
  },
2328
2325
  T.revision
2329
2326
  ) })
2330
2327
  ] });
2331
2328
  }
2332
- function Ca({
2329
+ function $a({
2333
2330
  collection: t,
2334
2331
  item: e,
2335
2332
  onBeforeTransition: r,
2336
- wrap: s = !0
2333
+ wrap: a = !0
2337
2334
  }) {
2338
2335
  return e === "new" ? null : /* @__PURE__ */ n(
2339
2336
  Qr,
@@ -2341,7 +2338,7 @@ function Ca({
2341
2338
  collection: t,
2342
2339
  item: e,
2343
2340
  onBeforeTransition: r,
2344
- wrap: s
2341
+ wrap: a
2345
2342
  }
2346
2343
  );
2347
2344
  }
@@ -2349,70 +2346,70 @@ function Qr({
2349
2346
  collection: t,
2350
2347
  item: e,
2351
2348
  onBeforeTransition: r,
2352
- wrap: s = !0
2349
+ wrap: a = !0
2353
2350
  }) {
2354
- const o = Pe(), c = Ve(), [m, h] = Q(""), [p, x] = Q(null), [k, R] = Q(null), [_, U] = Q(null), [j, ne] = Q(null), [re, ae] = Q([]), F = Tn(t, String(e));
2355
- on(t, e, "transition", !!p || !!k);
2356
- const E = ce(null), K = lr(E, !s), f = ce(!1), v = (l) => {
2351
+ const i = Re(), c = Ve(), [m, b] = G(""), [p, v] = G(null), [N, A] = G(null), [C, U] = G(null), [j, ne] = G(null), [re, ae] = G([]), F = Tn(t, String(e));
2352
+ on(t, e, "transition", !!p || !!N);
2353
+ const I = fe(null), K = lr(I, !a), f = fe(!1), k = (l) => {
2357
2354
  f.current || (f.current = !0, U(null), W.mutate(l, {
2358
2355
  onSettled: (y, w) => {
2359
2356
  if (w) {
2360
2357
  f.current = !1;
2361
2358
  return;
2362
2359
  }
2363
- X().finally(() => {
2360
+ Y().finally(() => {
2364
2361
  f.current = !1;
2365
2362
  });
2366
2363
  }
2367
2364
  }));
2368
- }, g = async (l, y) => {
2369
- var oe, q;
2365
+ }, x = async (l, y) => {
2366
+ var q, Z;
2370
2367
  if (f.current || u != null && u.running_move) return;
2371
2368
  if (p === l) {
2372
- x(null);
2369
+ v(null);
2373
2370
  return;
2374
2371
  }
2375
- if (!(y != null && y.cleared) && ((u == null ? void 0 : u.available_transitions) ?? []).some((G) => G.id === l && G.advisory)) {
2376
- x(null), U(null), ne(l), c.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
2372
+ if (!(y != null && y.cleared) && ((u == null ? void 0 : u.available_transitions) ?? []).some((z) => z.id === l && z.advisory)) {
2373
+ v(null), U(null), ne(l), c.invalidateQueries({ queryKey: ["pipeline-instance", t, e] });
2377
2374
  return;
2378
2375
  }
2379
2376
  if (ne(null), r) {
2380
2377
  f.current = !0;
2381
- let G = !1;
2378
+ let z = !1;
2382
2379
  try {
2383
- G = await r();
2380
+ z = await r();
2384
2381
  } finally {
2385
2382
  f.current = !1;
2386
2383
  }
2387
- if (!G) return;
2384
+ if (!z) return;
2388
2385
  }
2389
- const w = (de ?? []).find((G) => G.id === l), P = String((w == null ? void 0 : w.comment_mode) ?? "none"), B = qt(w, (u == null ? void 0 : u.states) ?? [], (oe = u == null ? void 0 : u.instance) == null ? void 0 : oe.current_state);
2390
- if (P !== "optional" && P !== "required") {
2391
- if (w && !Xe(w, (u == null ? void 0 : u.states) ?? [], (q = u == null ? void 0 : u.instance) == null ? void 0 : q.current_state)) {
2386
+ const w = (oe ?? []).find((z) => z.id === l), L = String((w == null ? void 0 : w.comment_mode) ?? "none"), E = qt(w, (u == null ? void 0 : u.states) ?? [], (q = u == null ? void 0 : u.instance) == null ? void 0 : q.current_state);
2387
+ if (L !== "optional" && L !== "required") {
2388
+ if (w && !Xe(w, (u == null ? void 0 : u.states) ?? [], (Z = u == null ? void 0 : u.instance) == null ? void 0 : Z.current_state)) {
2392
2389
  f.current = !0;
2393
- let G = [];
2390
+ let z = [];
2394
2391
  try {
2395
- G = await F();
2392
+ z = await F();
2396
2393
  } finally {
2397
2394
  f.current = !1;
2398
2395
  }
2399
- if (G.length > 0 || B) {
2400
- ae(G), x(l);
2396
+ if (z.length > 0 || E) {
2397
+ ae(z), v(l);
2401
2398
  return;
2402
2399
  }
2403
2400
  }
2404
- if (B) {
2405
- ae([]), x(l);
2401
+ if (E) {
2402
+ ae([]), v(l);
2406
2403
  return;
2407
2404
  }
2408
- v({ transition_id: l });
2405
+ k({ transition_id: l });
2409
2406
  return;
2410
2407
  }
2411
- ae([]), x(l);
2412
- }, $ = ["pipeline-instance", t, e], { settling: T, settle: X } = _n($), { data: u } = be({
2413
- queryKey: $,
2414
- queryFn: () => o.request(
2415
- we(`/pipelines/instance/${t}/${e}`)
2408
+ ae([]), v(l);
2409
+ }, M = ["pipeline-instance", t, e], { settling: T, settle: Y } = _n(M), { data: u } = xe({
2410
+ queryKey: M,
2411
+ queryFn: () => i.request(
2412
+ ke(`/pipelines/instance/${t}/${e}`)
2416
2413
  ).then(
2417
2414
  (l) => l.data ?? {
2418
2415
  instance: null,
@@ -2427,44 +2424,44 @@ function Qr({
2427
2424
  refetchInterval: (l) => mn(l.state.data)
2428
2425
  });
2429
2426
  pn(!!(u != null && u.running_move), () => {
2430
- Ie(c, t, String(e)), je(c, t, String(e)), nt(c, t, String(e));
2427
+ Le(c, t, String(e)), Ie(c, t, String(e)), nt(c, t, String(e));
2431
2428
  });
2432
- const b = Sn(
2429
+ const g = Sn(
2433
2430
  u ? (u.available_transitions ?? []).map((l) => String(l.id)) : null,
2434
2431
  `${t}:${e}`
2435
- ), { data: M } = be({
2432
+ ), { data: R } = xe({
2436
2433
  queryKey: ["pipeline-all-owners", t, e],
2437
- queryFn: () => o.request(
2438
- we(`/pipelines/instance/${t}/${e}/owners/all`)
2434
+ queryFn: () => i.request(
2435
+ ke(`/pipelines/instance/${t}/${e}/owners/all`)
2439
2436
  ).then((l) => l.data ?? null),
2440
2437
  // Also while a move is being confirmed: the panel names where it really lands.
2441
2438
  enabled: Rn(u) || !!p,
2442
2439
  staleTime: 3e4
2443
2440
  }), ee = et(() => {
2444
- if (!M) return null;
2441
+ if (!R) return null;
2445
2442
  const l = /* @__PURE__ */ new Map();
2446
- for (const [y, w] of Object.entries(M))
2443
+ for (const [y, w] of Object.entries(R))
2447
2444
  w.skipped && l.set(y, w.skip_reasons ?? []);
2448
2445
  return l;
2449
- }, [M]), W = Qe({
2446
+ }, [R]), W = je({
2450
2447
  mutationFn: ({
2451
2448
  transition_id: l,
2452
2449
  comment: y,
2453
2450
  reviewed: w,
2454
- lock_ack: P
2455
- }) => o.request(
2451
+ lock_ack: L
2452
+ }) => i.request(
2456
2453
  Ge(`/pipelines/instance/${t}/${e}/transition`, {
2457
2454
  transition_id: l,
2458
2455
  comment: y,
2459
2456
  ...w ? { reviewed: !0 } : {},
2460
- ...P ? { lock_ack: !0 } : {},
2457
+ ...L ? { lock_ack: !0 } : {},
2461
2458
  ...hn(u == null ? void 0 : u.available_transitions, l)
2462
2459
  })
2463
2460
  ),
2464
2461
  onMutate: (l) => {
2465
2462
  var y;
2466
2463
  return {
2467
- slow: An(
2464
+ slow: Fn(
2468
2465
  (y = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
2469
2466
  (w) => w.id === l.transition_id
2470
2467
  )) == null ? void 0 : y.label
@@ -2472,98 +2469,98 @@ function Qr({
2472
2469
  };
2473
2470
  },
2474
2471
  onSuccess: (l, y, w) => {
2475
- c.invalidateQueries({ queryKey: $ }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Ie(c, t, String(e)), je(c, t, String(e)), nt(c, t, String(e)), U(null), h(""), x(null), R(null);
2476
- const P = fn(l);
2477
- P ? V.info(
2478
- `${P.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2472
+ c.invalidateQueries({ queryKey: M }), t === "nivaro_addendums" && c.invalidateQueries({ queryKey: ["addendums"] }), Le(c, t, String(e)), Ie(c, t, String(e)), nt(c, t, String(e)), U(null), b(""), v(null), A(null);
2473
+ const L = fn(l);
2474
+ L ? X.info(
2475
+ `${L.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2479
2476
  w == null ? void 0 : w.slow.done()
2480
- ) : V.success(Fn(u, y.transition_id, l), w == null ? void 0 : w.slow.done());
2477
+ ) : X.success(An(u, y.transition_id, l), w == null ? void 0 : w.slow.done());
2481
2478
  },
2482
2479
  onError: (l, y, w) => {
2483
- var G, S;
2480
+ var z, _;
2484
2481
  if (w == null || w.slow.fail(), yn(l)) {
2485
- c.invalidateQueries({ queryKey: $ });
2482
+ c.invalidateQueries({ queryKey: M });
2486
2483
  return;
2487
2484
  }
2488
2485
  if (at(l) === "TRANSITION_RUNNING") {
2489
- c.invalidateQueries({ queryKey: $ }), x(null), R(null), V.info(Ae(l, "This move is already running on this record."));
2486
+ c.invalidateQueries({ queryKey: M }), v(null), A(null), X.info(Ae(l, "This move is already running on this record."));
2490
2487
  return;
2491
2488
  }
2492
- const P = kn(l);
2493
- if (P) {
2494
- x(null);
2495
- const L = ((G = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
2496
- (ve) => ve.id === y.transition_id
2497
- )) == null ? void 0 : G.label) ?? "Move";
2498
- V.warning(P.message, {
2489
+ const L = kn(l);
2490
+ if (L) {
2491
+ v(null);
2492
+ const H = ((z = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
2493
+ (ge) => ge.id === y.transition_id
2494
+ )) == null ? void 0 : z.label) ?? "Move";
2495
+ X.warning(L.message, {
2499
2496
  id: `nvr-locked-move:${t}:${String(e)}`,
2500
2497
  duration: 2e4,
2501
2498
  action: {
2502
- label: `${L} anyway`,
2503
- onClick: () => v({ ...y, lock_ack: !0 })
2499
+ label: `${H} anyway`,
2500
+ onClick: () => k({ ...y, lock_ack: !0 })
2504
2501
  },
2505
2502
  cancel: { label: "Wait", onClick: () => {
2506
2503
  } }
2507
2504
  });
2508
2505
  return;
2509
2506
  }
2510
- const B = wn(l);
2511
- if (B) {
2512
- R((L) => ({
2513
- payload: B,
2507
+ const E = wn(l);
2508
+ if (E) {
2509
+ A((H) => ({
2510
+ payload: E,
2514
2511
  transitionId: y.transition_id,
2515
2512
  comment: y.comment,
2516
- revision: ((L == null ? void 0 : L.revision) ?? 0) + 1
2513
+ revision: ((H == null ? void 0 : H.revision) ?? 0) + 1
2517
2514
  }));
2518
2515
  return;
2519
2516
  }
2520
- const oe = l == null ? void 0 : l.response;
2517
+ const q = l == null ? void 0 : l.response;
2521
2518
  U(Nn(l, y));
2522
- const q = an(
2519
+ const Z = an(
2523
2520
  l,
2524
- (S = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
2525
- (L) => L.id === y.transition_id
2526
- )) == null ? void 0 : S.label
2521
+ (_ = [...(u == null ? void 0 : u.available_transitions) ?? [], ...(u == null ? void 0 : u.all_transitions) ?? []].find(
2522
+ (H) => H.id === y.transition_id
2523
+ )) == null ? void 0 : _.label
2527
2524
  );
2528
- V.error((q == null ? void 0 : q.title) ?? Ae(l, "Failed to execute transition"), {
2525
+ X.error((Z == null ? void 0 : Z.title) ?? Ae(l, "Failed to execute transition"), {
2529
2526
  duration: 12e3,
2530
2527
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
2531
2528
  // A partner's refusal copies what the toast said and the other system's answer as
2532
2529
  // stored, never the generic reading of a 422.
2533
- ...rn(q ? sn(l, q) : l, {
2530
+ ...rn(Z ? sn(l, Z) : l, {
2534
2531
  action: "Transition"
2535
2532
  }),
2536
- ...q ? { description: q.description } : {},
2533
+ ...Z ? { description: Z.description } : {},
2537
2534
  // #1867: a refusal carries "Why?" — the role, owner or access rule
2538
2535
  // that stopped it, and who can change it.
2539
2536
  ...cn(l) ? {
2540
- action: un(o, {
2537
+ action: un(i, {
2541
2538
  collection: t,
2542
2539
  itemId: String(e),
2543
2540
  action: "transition",
2544
2541
  transitionId: y.transition_id
2545
2542
  })
2546
2543
  } : {}
2547
- }), R(null), x(null), Ie(c, t, String(e)), je(c, t, String(e)), (oe == null ? void 0 : oe.status) === 409 && c.invalidateQueries({ queryKey: $ });
2544
+ }), A(null), v(null), Le(c, t, String(e)), Ie(c, t, String(e)), (q == null ? void 0 : q.status) === 409 && c.invalidateQueries({ queryKey: M });
2548
2545
  }
2549
- }), ue = ce(g);
2550
- ue.current = g;
2551
- const xe = ce((u == null ? void 0 : u.available_transitions) ?? []);
2552
- if (xe.current = (u == null ? void 0 : u.available_transitions) ?? [], _e(() => {
2546
+ }), ce = fe(x);
2547
+ ce.current = x;
2548
+ const ye = fe((u == null ? void 0 : u.available_transitions) ?? []);
2549
+ if (ye.current = (u == null ? void 0 : u.available_transitions) ?? [], Te(() => {
2553
2550
  const l = (y) => {
2554
2551
  const w = y.detail;
2555
2552
  if (!w || w.claimed || w.collection !== t || String(w.item) !== String(e)) return;
2556
2553
  w.claimed = !0;
2557
- const P = String(w.transition_id).toUpperCase(), B = xe.current.find((oe) => String(oe.id).toUpperCase() === P);
2558
- if (!B) {
2559
- V.error("That step is not available from where the record is now");
2554
+ const L = String(w.transition_id).toUpperCase(), E = ye.current.find((q) => String(q.id).toUpperCase() === L);
2555
+ if (!E) {
2556
+ X.error("That step is not available from where the record is now");
2560
2557
  return;
2561
2558
  }
2562
- ue.current(B.id);
2559
+ ce.current(E.id);
2563
2560
  };
2564
2561
  return window.addEventListener(tt, l), () => window.removeEventListener(tt, l);
2565
2562
  }, [t, e]), !(u != null && u.binding) || !(u != null && u.instance)) return null;
2566
- const de = Pn(
2563
+ const oe = Pn(
2567
2564
  (u.available_transitions ?? []).filter(
2568
2565
  (l) => !u.instance.completed_at || l.from_state && String(l.from_state).toUpperCase() === String(u.instance.current_state).toUpperCase()
2569
2566
  ),
@@ -2571,50 +2568,50 @@ function Qr({
2571
2568
  u.instance.current_state,
2572
2569
  u.instance.completed_at ? null : ee
2573
2570
  );
2574
- if (de.length === 0) return null;
2575
- const D = new Map((u.states ?? []).map((l) => [l.id, l])), Y = u.instance.current_state_obj ?? null, z = p ? de.find((l) => l.id === p) : null, ie = j ? de.find((l) => l.id === j) : null, H = u.running_move ?? null, qe = H ? pr(H) : void 0, Oe = z ? D.get(z.to_state) : null, a = Bn(z, Y, u.states ?? [], M), I = (a == null ? void 0 : a.state) ?? Oe, Z = /* @__PURE__ */ new Map();
2576
- for (const l of de) {
2577
- const y = Z.get(l.label) ?? [];
2578
- y.push(l), Z.set(l.label, y);
2571
+ if (oe.length === 0) return null;
2572
+ const P = new Map((u.states ?? []).map((l) => [l.id, l])), le = u.instance.current_state_obj ?? null, Q = p ? oe.find((l) => l.id === p) : null, J = j ? oe.find((l) => l.id === j) : null, se = u.running_move ?? null, Fe = se ? pr(se) : void 0, o = Q ? P.get(Q.to_state) : null, h = Bn(Q, le, u.states ?? [], R), B = (h == null ? void 0 : h.state) ?? o, V = /* @__PURE__ */ new Map();
2573
+ for (const l of oe) {
2574
+ const y = V.get(l.label) ?? [];
2575
+ y.push(l), V.set(l.label, y);
2579
2576
  }
2580
- const J = (l) => [...l].sort(
2577
+ const ue = (l) => [...l].sort(
2581
2578
  (y, w) => {
2582
- var P, B;
2583
- return (((P = D.get(y.to_state)) == null ? void 0 : P.sort) ?? 999) - (((B = D.get(w.to_state)) == null ? void 0 : B.sort) ?? 999);
2579
+ var L, E;
2580
+ return (((L = P.get(y.to_state)) == null ? void 0 : L.sort) ?? 999) - (((E = P.get(w.to_state)) == null ? void 0 : E.sort) ?? 999);
2584
2581
  }
2585
- ), he = (() => {
2586
- var w, P, B;
2587
- const l = (w = E.current) == null ? void 0 : w.getBoundingClientRect();
2582
+ ), be = (() => {
2583
+ var w, L, E;
2584
+ const l = (w = I.current) == null ? void 0 : w.getBoundingClientRect();
2588
2585
  if (!l) return 600;
2589
- const y = (B = (P = E.current) == null ? void 0 : P.closest('[role="dialog"]')) == null ? void 0 : B.getBoundingClientRect();
2586
+ const y = (E = (L = I.current) == null ? void 0 : L.closest('[role="dialog"]')) == null ? void 0 : E.getBoundingClientRect();
2590
2587
  return Math.max(260, Math.min(600, l.right - ((y == null ? void 0 : y.left) ?? 0) - 12));
2591
2588
  })();
2592
- return /* @__PURE__ */ i("div", { ref: E, className: "relative", "data-tip": qe, children: [
2593
- K ? /* @__PURE__ */ i(mt, { children: [
2594
- /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ i(
2589
+ return /* @__PURE__ */ s("div", { ref: I, className: "relative", "data-tip": Fe, children: [
2590
+ K ? /* @__PURE__ */ s(mt, { children: [
2591
+ /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ s(
2595
2592
  pe,
2596
2593
  {
2597
2594
  size: "sm",
2598
2595
  variant: "outline",
2599
2596
  className: "shrink-0 gap-1.5 text-[12px]",
2600
- disabled: W.isPending || T || !!H,
2597
+ disabled: W.isPending || T || !!se,
2601
2598
  "data-transitions-folded": !0,
2602
2599
  children: [
2603
- W.isPending || H ? /* @__PURE__ */ n(ye, { className: "h-3 w-3 animate-spin" }) : de.every((l) => l.advisory) && /* @__PURE__ */ n(Ne, {}),
2600
+ W.isPending || se ? /* @__PURE__ */ n(we, { className: "h-3 w-3 animate-spin" }) : oe.every((l) => l.advisory) && /* @__PURE__ */ n(_e, {}),
2604
2601
  "Actions",
2605
- /* @__PURE__ */ n(Fe, { className: "h-3 w-3" })
2602
+ /* @__PURE__ */ n(Pe, { className: "h-3 w-3" })
2606
2603
  ]
2607
2604
  }
2608
2605
  ) }),
2609
- /* @__PURE__ */ i(ft, { align: "end", className: "min-w-[200px]", children: [
2610
- Array.from(Z.entries()).map(
2611
- ([l, y], w, P) => y.length === 1 ? /* @__PURE__ */ i(It, { children: [
2612
- w > 0 && P[w - 1][1].length > 1 && /* @__PURE__ */ n(ht, {}),
2613
- /* @__PURE__ */ i(
2606
+ /* @__PURE__ */ s(ft, { align: "end", className: "min-w-[200px]", children: [
2607
+ Array.from(V.entries()).map(
2608
+ ([l, y], w, L) => y.length === 1 ? /* @__PURE__ */ s(It, { children: [
2609
+ w > 0 && L[w - 1][1].length > 1 && /* @__PURE__ */ n(ht, {}),
2610
+ /* @__PURE__ */ s(
2614
2611
  Je,
2615
2612
  {
2616
- onSelect: () => g(y[0].id),
2617
- ...Le(y[0], "menu"),
2613
+ onSelect: () => x(y[0].id),
2614
+ ...Be(y[0], "menu"),
2618
2615
  children: [
2619
2616
  y[0].color && /* @__PURE__ */ n(
2620
2617
  "span",
@@ -2624,33 +2621,33 @@ function Qr({
2624
2621
  }
2625
2622
  ),
2626
2623
  l,
2627
- y[0].advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" })
2624
+ y[0].advisory && /* @__PURE__ */ n(_e, { className: "ml-auto" })
2628
2625
  ]
2629
2626
  }
2630
2627
  )
2631
- ] }, l) : /* @__PURE__ */ i(It, { children: [
2628
+ ] }, l) : /* @__PURE__ */ s(It, { children: [
2632
2629
  w > 0 && /* @__PURE__ */ n(ht, {}),
2633
2630
  /* @__PURE__ */ n(ur, { className: "text-[11px] text-muted-foreground", children: l }),
2634
- J(y).map((B) => {
2635
- var oe;
2636
- return /* @__PURE__ */ i(
2631
+ ue(y).map((E) => {
2632
+ var q;
2633
+ return /* @__PURE__ */ s(
2637
2634
  Je,
2638
2635
  {
2639
- onSelect: () => g(B.id),
2640
- ...Le(B, "menu"),
2636
+ onSelect: () => x(E.id),
2637
+ ...Be(E, "menu"),
2641
2638
  children: [
2642
- B.color && /* @__PURE__ */ n(
2639
+ E.color && /* @__PURE__ */ n(
2643
2640
  "span",
2644
2641
  {
2645
2642
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2646
- style: { backgroundColor: B.color }
2643
+ style: { backgroundColor: E.color }
2647
2644
  }
2648
2645
  ),
2649
- ((oe = D.get(B.to_state)) == null ? void 0 : oe.label) ?? B.to_state,
2650
- B.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" })
2646
+ ((q = P.get(E.to_state)) == null ? void 0 : q.label) ?? E.to_state,
2647
+ E.advisory && /* @__PURE__ */ n(_e, { className: "ml-auto" })
2651
2648
  ]
2652
2649
  },
2653
- B.id
2650
+ E.id
2654
2651
  );
2655
2652
  })
2656
2653
  ] }, l)
@@ -2658,10 +2655,10 @@ function Qr({
2658
2655
  /* @__PURE__ */ n(
2659
2656
  kt,
2660
2657
  {
2661
- moves: de,
2658
+ moves: oe,
2662
2659
  nameOf: (l) => {
2663
2660
  var y, w;
2664
- return (((y = Z.get(l.label)) == null ? void 0 : y.length) ?? 0) > 1 ? ((w = D.get(l.to_state)) == null ? void 0 : w.label) ?? l.to_state : l.label;
2661
+ return (((y = V.get(l.label)) == null ? void 0 : y.length) ?? 0) > 1 ? ((w = P.get(l.to_state)) == null ? void 0 : w.label) ?? l.to_state : l.label;
2665
2662
  }
2666
2663
  }
2667
2664
  )
@@ -2669,100 +2666,100 @@ function Qr({
2669
2666
  ] }) : /* @__PURE__ */ n(
2670
2667
  "div",
2671
2668
  {
2672
- className: s ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
2673
- children: Array.from(Z.entries()).map(([l, y]) => {
2674
- var q, G;
2675
- const w = y.some((S) => {
2676
- var L;
2677
- return (((L = S.order_partners) == null ? void 0 : L.length) ?? 0) > 0;
2678
- }), P = w ? null : ((q = y[0]) == null ? void 0 : q.color) ?? null, B = y.some((S) => S.id === p), oe = (S) => P ? S ? { backgroundColor: P, borderColor: P } : { borderColor: P, color: P } : void 0;
2669
+ className: a ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
2670
+ children: Array.from(V.entries()).map(([l, y]) => {
2671
+ var Z, z;
2672
+ const w = y.some((_) => {
2673
+ var H;
2674
+ return (((H = _.order_partners) == null ? void 0 : H.length) ?? 0) > 0;
2675
+ }), L = w ? null : ((Z = y[0]) == null ? void 0 : Z.color) ?? null, E = y.some((_) => _.id === p), q = (_) => L ? _ ? { backgroundColor: L, borderColor: L } : { borderColor: L, color: L } : void 0;
2679
2676
  if (y.length === 1) {
2680
- const S = y[0], L = vt(H == null ? void 0 : H.transition_id, S.id), ve = bn(H ? null : u.last_move_problem, S.id), Ce = W.isPending && ((G = W.variables) == null ? void 0 : G.transition_id) === S.id || L, se = /* @__PURE__ */ i(
2677
+ const _ = y[0], H = vt(se == null ? void 0 : se.transition_id, _.id), ge = bn(se ? null : u.last_move_problem, _.id), de = W.isPending && ((z = W.variables) == null ? void 0 : z.transition_id) === _.id || H, Qe = /* @__PURE__ */ s(
2681
2678
  pe,
2682
2679
  {
2683
2680
  size: "sm",
2684
- variant: B && !S.advisory ? "default" : "outline",
2685
- className: ge(
2681
+ variant: E && !_.advisory ? "default" : "outline",
2682
+ className: ve(
2686
2683
  "gap-1.5 text-[12px] data-[fresh=true]:opacity-60",
2687
- S.advisory && On
2684
+ _.advisory && On
2688
2685
  ),
2689
- style: S.advisory ? void 0 : oe(B),
2690
- disabled: W.isPending || T || !!H || !!ve,
2691
- "data-move-running": L || void 0,
2692
- "aria-disabled": b.dimmed(S.id) || void 0,
2693
- "data-fresh": b.dimmed(S.id) || void 0,
2694
- ...b.bind(S.id),
2695
- ...Le(S),
2686
+ style: _.advisory ? void 0 : q(E),
2687
+ disabled: W.isPending || T || !!se || !!ge,
2688
+ "data-move-running": H || void 0,
2689
+ "aria-disabled": g.dimmed(_.id) || void 0,
2690
+ "data-fresh": g.dimmed(_.id) || void 0,
2691
+ ...g.bind(_.id),
2692
+ ...Be(_),
2696
2693
  onClick: () => {
2697
- b.press(S.id) && g(S.id);
2694
+ g.press(_.id) && x(_.id);
2698
2695
  },
2699
2696
  children: [
2700
- Ce ? /* @__PURE__ */ n(ye, { className: "h-3 w-3 animate-spin" }) : S.advisory ? /* @__PURE__ */ n(Ne, {}) : w && /* @__PURE__ */ n(Xt, { className: "h-3 w-3", "aria-hidden": !0 }),
2697
+ de ? /* @__PURE__ */ n(we, { className: "h-3 w-3 animate-spin" }) : _.advisory ? /* @__PURE__ */ n(_e, {}) : w && /* @__PURE__ */ n(Xt, { className: "h-3 w-3", "aria-hidden": !0 }),
2701
2698
  l
2702
2699
  ]
2703
2700
  },
2704
2701
  l
2705
2702
  );
2706
- return ve ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": ve, "data-move-held": !0, children: se }, l) : S.pushes && S.pushes > 0 ? /* @__PURE__ */ i("span", { className: "relative inline-flex", children: [
2707
- se,
2703
+ return ge ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": ge, "data-move-held": !0, children: Qe }, l) : _.pushes && _.pushes > 0 ? /* @__PURE__ */ s("span", { className: "relative inline-flex", children: [
2704
+ Qe,
2708
2705
  /* @__PURE__ */ n(
2709
2706
  or,
2710
2707
  {
2711
2708
  collection: t,
2712
2709
  itemId: e,
2713
- transitionId: S.id,
2710
+ transitionId: _.id,
2714
2711
  label: l,
2715
2712
  compact: !0
2716
2713
  }
2717
2714
  )
2718
- ] }, l) : se;
2715
+ ] }, l) : Qe;
2719
2716
  }
2720
- return /* @__PURE__ */ i(mt, { children: [
2721
- /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ i(
2717
+ return /* @__PURE__ */ s(mt, { children: [
2718
+ /* @__PURE__ */ n(pt, { asChild: !0, children: /* @__PURE__ */ s(
2722
2719
  pe,
2723
2720
  {
2724
2721
  size: "sm",
2725
- variant: B ? "default" : "outline",
2722
+ variant: E ? "default" : "outline",
2726
2723
  className: "gap-1.5 text-[12px]",
2727
- style: oe(B),
2728
- disabled: W.isPending || T || !!H,
2724
+ style: q(E),
2725
+ disabled: W.isPending || T || !!se,
2729
2726
  children: [
2730
- y.every((S) => S.advisory) && /* @__PURE__ */ n(Ne, {}),
2727
+ y.every((_) => _.advisory) && /* @__PURE__ */ n(_e, {}),
2731
2728
  l,
2732
- /* @__PURE__ */ n(Fe, { className: "h-3 w-3" })
2729
+ /* @__PURE__ */ n(Pe, { className: "h-3 w-3" })
2733
2730
  ]
2734
2731
  }
2735
2732
  ) }),
2736
- /* @__PURE__ */ i(ft, { align: "start", children: [
2737
- J(y).map((S) => {
2738
- var L;
2739
- return /* @__PURE__ */ i(
2733
+ /* @__PURE__ */ s(ft, { align: "start", children: [
2734
+ ue(y).map((_) => {
2735
+ var H;
2736
+ return /* @__PURE__ */ s(
2740
2737
  Je,
2741
2738
  {
2742
- onSelect: () => g(S.id),
2743
- ...Le(S, "menu"),
2739
+ onSelect: () => x(_.id),
2740
+ ...Be(_, "menu"),
2744
2741
  children: [
2745
- S.color && /* @__PURE__ */ n(
2742
+ _.color && /* @__PURE__ */ n(
2746
2743
  "span",
2747
2744
  {
2748
2745
  className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2749
- style: { backgroundColor: S.color }
2746
+ style: { backgroundColor: _.color }
2750
2747
  }
2751
2748
  ),
2752
- ((L = D.get(S.to_state)) == null ? void 0 : L.label) ?? S.to_state,
2753
- S.advisory && /* @__PURE__ */ n(Ne, { className: "ml-auto" })
2749
+ ((H = P.get(_.to_state)) == null ? void 0 : H.label) ?? _.to_state,
2750
+ _.advisory && /* @__PURE__ */ n(_e, { className: "ml-auto" })
2754
2751
  ]
2755
2752
  },
2756
- S.id
2753
+ _.id
2757
2754
  );
2758
2755
  }),
2759
2756
  /* @__PURE__ */ n(
2760
2757
  kt,
2761
2758
  {
2762
2759
  moves: y,
2763
- nameOf: (S) => {
2764
- var L;
2765
- return ((L = D.get(S.to_state)) == null ? void 0 : L.label) ?? S.to_state;
2760
+ nameOf: (_) => {
2761
+ var H;
2762
+ return ((H = P.get(_.to_state)) == null ? void 0 : H.label) ?? _.to_state;
2766
2763
  }
2767
2764
  }
2768
2765
  )
@@ -2771,36 +2768,36 @@ function Qr({
2771
2768
  })
2772
2769
  }
2773
2770
  ),
2774
- p && /* @__PURE__ */ i(
2771
+ p && /* @__PURE__ */ s(
2775
2772
  "div",
2776
2773
  {
2777
2774
  className: "absolute right-0 top-full z-50 mt-1 space-y-3 rounded-lg border border-slate-200 bg-white shadow-lg dark:bg-card dark:border-border p-3.5",
2778
- style: { width: he },
2775
+ style: { width: be },
2779
2776
  children: [
2780
- /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
2777
+ /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
2781
2778
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
2782
- z && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: z.label }),
2783
- Y && I && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1.5", children: [
2784
- /* @__PURE__ */ n(Re, { label: Y.label, color: Y.color, small: !0 }),
2779
+ Q && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: Q.label }),
2780
+ le && B && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1.5", children: [
2781
+ /* @__PURE__ */ n(Me, { label: le.label, color: le.color, small: !0 }),
2785
2782
  /* @__PURE__ */ n(Nt, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2786
- /* @__PURE__ */ n(Re, { label: I.label, color: I.color, small: !0 })
2783
+ /* @__PURE__ */ n(Me, { label: B.label, color: B.color, small: !0 })
2787
2784
  ] })
2788
2785
  ] }),
2789
- /* @__PURE__ */ n(Ln, { landing: a }),
2790
- /* @__PURE__ */ n(Mn, { collection: t, item: String(e), tx: z }),
2791
- /* @__PURE__ */ n(En, { collection: t, item: e, omitLines: re }),
2786
+ /* @__PURE__ */ n(En, { landing: h }),
2787
+ /* @__PURE__ */ n(Mn, { collection: t, item: String(e), tx: Q }),
2788
+ /* @__PURE__ */ n(Ln, { collection: t, item: e, omitLines: re }),
2792
2789
  /* @__PURE__ */ n(qn, { lines: re }),
2793
2790
  /* @__PURE__ */ n(
2794
2791
  "input",
2795
2792
  {
2796
2793
  type: "text",
2797
2794
  value: m,
2798
- onChange: (l) => h(l.target.value),
2799
- placeholder: String((z == null ? void 0 : z.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2795
+ onChange: (l) => b(l.target.value),
2796
+ placeholder: String((Q == null ? void 0 : Q.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2800
2797
  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"
2801
2798
  }
2802
2799
  ),
2803
- /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-2", children: [
2800
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
2804
2801
  /* @__PURE__ */ n(
2805
2802
  pe,
2806
2803
  {
@@ -2808,7 +2805,7 @@ function Qr({
2808
2805
  size: "sm",
2809
2806
  variant: "ghost",
2810
2807
  className: "h-7 text-[12px]",
2811
- onClick: () => x(null),
2808
+ onClick: () => v(null),
2812
2809
  children: "Cancel"
2813
2810
  }
2814
2811
  ),
@@ -2818,13 +2815,13 @@ function Qr({
2818
2815
  type: "button",
2819
2816
  size: "sm",
2820
2817
  className: "h-7 gap-1.5 text-[12px]",
2821
- disabled: W.isPending || !!H || String((z == null ? void 0 : z.comment_mode) ?? "") === "required" && m.trim() === "",
2822
- onClick: () => v({
2818
+ disabled: W.isPending || !!se || String((Q == null ? void 0 : Q.comment_mode) ?? "") === "required" && m.trim() === "",
2819
+ onClick: () => k({
2823
2820
  transition_id: p,
2824
2821
  comment: m.trim() || void 0
2825
2822
  }),
2826
- children: W.isPending ? /* @__PURE__ */ n(ye, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ i(Se, { children: [
2827
- /* @__PURE__ */ n("span", { children: re.length > 0 && z ? `${z.label} anyway` : "Confirm" }),
2823
+ children: W.isPending ? /* @__PURE__ */ n(we, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Se, { children: [
2824
+ /* @__PURE__ */ n("span", { children: re.length > 0 && Q ? `${Q.label} anyway` : "Confirm" }),
2828
2825
  /* @__PURE__ */ n(rt, { className: "h-3 w-3" })
2829
2826
  ] })
2830
2827
  }
@@ -2833,82 +2830,82 @@ function Qr({
2833
2830
  ]
2834
2831
  }
2835
2832
  ),
2836
- (ie == null ? void 0 : ie.advisory) && !p && /* @__PURE__ */ n(
2833
+ (J == null ? void 0 : J.advisory) && !p && /* @__PURE__ */ n(
2837
2834
  xn,
2838
2835
  {
2839
2836
  floating: !0,
2840
2837
  collection: t,
2841
2838
  item: String(e),
2842
- advisory: ie.advisory,
2839
+ advisory: J.advisory,
2843
2840
  armedMove: {
2844
- id: ie.id,
2845
- label: ie.label,
2846
- confirms: Dn(ie, u.states ?? [], u.instance.current_state)
2841
+ id: J.id,
2842
+ label: J.label,
2843
+ confirms: Dn(J, u.states ?? [], u.instance.current_state)
2847
2844
  },
2848
2845
  className: "absolute right-0 top-full z-50 mt-1",
2849
- style: { width: he },
2846
+ style: { width: be },
2850
2847
  onDismiss: () => ne(null),
2851
2848
  onFixed: (l) => {
2852
- ne(null), c.invalidateQueries({ queryKey: $ }), l && g(l.id, { cleared: !0 });
2849
+ ne(null), c.invalidateQueries({ queryKey: M }), l && x(l.id, { cleared: !0 });
2853
2850
  }
2854
2851
  }
2855
2852
  ),
2856
- _ && !p && /* @__PURE__ */ n(
2853
+ C && !p && /* @__PURE__ */ n(
2857
2854
  Un,
2858
2855
  {
2859
2856
  collection: t,
2860
2857
  item: String(e),
2861
- offer: _,
2858
+ offer: C,
2862
2859
  className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
2863
- style: { width: he },
2860
+ style: { width: be },
2864
2861
  onDismiss: () => U(null),
2865
- onFixed: () => v({ transition_id: _.transitionId, comment: _.comment })
2862
+ onFixed: () => k({ transition_id: C.transitionId, comment: C.comment })
2866
2863
  }
2867
2864
  ),
2868
- k && /* @__PURE__ */ n(en, { fallback: null, children: /* @__PURE__ */ n(
2865
+ N && /* @__PURE__ */ n(en, { fallback: null, children: /* @__PURE__ */ n(
2869
2866
  vn,
2870
2867
  {
2871
- payload: k.payload,
2872
- transitionId: k.transitionId,
2873
- isRetry: k.revision > 1,
2868
+ payload: N.payload,
2869
+ transitionId: N.transitionId,
2870
+ isRetry: N.revision > 1,
2874
2871
  onSubmitted: () => (
2875
2872
  // mutateAsync so the dialog can stay busy until the transition
2876
2873
  // settles; the mutation's own onError/onSuccess handle the outcome.
2877
2874
  W.mutateAsync({
2878
- transition_id: k.transitionId,
2879
- comment: k.comment,
2875
+ transition_id: N.transitionId,
2876
+ comment: N.comment,
2880
2877
  reviewed: !0
2881
2878
  }).catch(() => {
2882
2879
  })
2883
2880
  ),
2884
2881
  executing: W.isPending,
2885
- onClose: () => R(null)
2882
+ onClose: () => A(null)
2886
2883
  },
2887
- k.revision
2884
+ N.revision
2888
2885
  ) })
2889
2886
  ] });
2890
2887
  }
2891
2888
  export {
2892
- Be as FRESH_BUTTON_MS,
2889
+ Ue as FRESH_BUTTON_MS,
2893
2890
  Kt as FRESH_HOVER_MAX_MS,
2894
2891
  $r as FreshButtonGuard,
2895
- Sa as PipelinePanel,
2896
- Ca as PipelineTransitionButtons,
2892
+ Ca as PipelinePanel,
2893
+ $a as PipelineTransitionButtons,
2897
2894
  vr as REFUSAL_FIX_ACTIONS,
2898
2895
  Pr as RecordFlagChips,
2899
- Fr as SLOW_MOVE_MS,
2896
+ Ar as SLOW_MOVE_MS,
2900
2897
  qt as asksFirst,
2901
2898
  qr as briefAgeText,
2902
2899
  Mr as briefDiffPair,
2903
2900
  Wt as briefLineKey,
2904
2901
  Tr as briefWarnings,
2905
2902
  yn as isDuplicateTransition,
2906
- Ar as latestSendBack,
2903
+ Fr as latestSendBack,
2907
2904
  kn as lockedMoveOffer,
2908
2905
  at as refusalCode,
2909
2906
  Nn as refusalFixFor,
2910
- An as slowMoveToast,
2907
+ Fn as slowMoveToast,
2911
2908
  wn as transitionRequirementsFromError,
2912
- Fn as transitionToastText,
2909
+ An as transitionToastText,
2913
2910
  Pn as withoutSkippedSendBacks
2914
2911
  };