@nivaro/react 0.3.134 → 0.3.136

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,67 +1,71 @@
1
- var fr = Object.defineProperty;
2
- var hr = (e, t, r) => t in e ? fr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Nt = (e, t, r) => hr(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as n, jsxs as s, Fragment as Te } from "react/jsx-runtime";
5
- import { useQueryClient as Ze, useQuery as $e, useMutation as Je } from "@tanstack/react-query";
6
- import { ArrowRight as Et, Loader2 as Ae, Check as vt, GitBranch as St, AlertTriangle as dn, ChevronDown as Ge, Send as cn, Users as mn, Undo2 as gr, Minus as br, UserPlus as xr, X as vr, Zap as un, Clock as wr } from "lucide-react";
7
- import { useState as J, useRef as he, useEffect as Ee, useMemo as gt, Suspense as pn, useCallback as fn, lazy as yr, Fragment as kr } from "react";
1
+ var br = Object.defineProperty;
2
+ var xr = (e, t, r) => t in e ? br(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Tt = (e, t, r) => xr(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as n, jsxs as s, Fragment as qe } from "react/jsx-runtime";
5
+ import { useQueryClient as et, useQuery as Pe, useMutation as Ze } from "@tanstack/react-query";
6
+ import { ArrowRight as Ut, Loader2 as Fe, Check as yt, GitBranch as Mt, AlertTriangle as mn, ChevronDown as Ye, Send as un, Users as pn, Undo2 as vr, Minus as wr, UserPlus as yr, X as kr, Zap as fn, Clock as _r } from "lucide-react";
7
+ import { useState as X, useRef as we, useEffect as Ee, useMemo as xt, Suspense as hn, useCallback as gn, lazy as Nr, Fragment as Sr } from "react";
8
8
  import { toast as ee } from "sonner";
9
- import { useNivaroClient as We, useItemEditAuth as hn } from "../../context.js";
10
- import { chainStepText as _r } from "../../lib/approval-progress.js";
11
- import { get as Fe, post as st, del as Nr } from "../../lib/commands.js";
12
- import { errorToastOptions as gn, toastError as Sr } from "../../lib/error-toast.js";
13
- import { enteredAtFromHistory as Cr } from "../../lib/in-step.js";
14
- import { useLiveMoves as bn } from "../../lib/live-moves.js";
15
- import { useLiveFade as $r } from "../../lib/live-screen.js";
16
- import { partnerMoveFailure as xn, partnerMoveReading as vn } from "../../lib/move-failure.js";
17
- import { OPEN_MOVE_STATE_EVENT as Jt } from "../../lib/move-state.js";
18
- import { useRecordSignalWhile as wn, useRecordSignalPeers as Tr, signalSentence as Mr } from "../../lib/presence-signals.js";
19
- import { RUN_TRANSITION_EVENT as bt } from "../../lib/run-transition.js";
20
- import { userErrorMessage as je } from "../../lib/safe-error.js";
21
- import { serverNow as qr } from "../../lib/server-clock.js";
22
- import { useTrackTravel as Pr, travelPlan as Rr } from "../../lib/track-travel.js";
23
- import { useStartsOpen as Ar } from "../../lib/use-starts-open.js";
24
- import { cn as ne, titleCase as Fr, toLocalDateString as Or, formatDateTime as Ct, humanHours as Dr } from "../../lib/utils.js";
25
- import { StepForLine as Er } from "../InStep.js";
26
- import { PushReadinessChip as Br } from "../integrations/RecordIntegrationPreview.js";
27
- import { SendStatusLines as Lr } from "../integrations/SendStatus.js";
28
- import { useHeaderFold as Ur } from "../item-edit/HeaderTools.js";
29
- import { invalidateRecordInsights as Xe, invalidateRecordData as Ye } from "../item-edit/RecordInsights.js";
30
- import { UserChip as yn } from "../item-edit/UserChip.js";
31
- import { OwnerAvatars as Ir } from "../queue/OwnerAvatars.js";
32
- import { RelativeTime as Bt } from "../RelativeTime.js";
33
- import { UserAvatar as jr } from "../UserAvatar.js";
34
- import { Button as fe } from "../ui/button.js";
35
- import { DropdownMenu as qt, DropdownMenuTrigger as Pt, DropdownMenuContent as Rt, DropdownMenuGroup as Zt, DropdownMenuSeparator as At, DropdownMenuItem as dt, DropdownMenuLabel as Wr } from "../ui/dropdown-menu.js";
36
- import { Popover as kn, PopoverTrigger as _n, PopoverContent as Nn } from "../ui/popover.js";
9
+ import { useNivaroClient as Ke, useItemEditAuth as bn } from "../../context.js";
10
+ import { chainStepText as Cr } from "../../lib/approval-progress.js";
11
+ import { get as De, post as it, del as $r } from "../../lib/commands.js";
12
+ import { errorToastOptions as xn, toastError as Tr } from "../../lib/error-toast.js";
13
+ import { enteredAtFromHistory as Mr } from "../../lib/in-step.js";
14
+ import { useLiveMoves as vn } from "../../lib/live-moves.js";
15
+ import { useLiveFade as Pr } from "../../lib/live-screen.js";
16
+ import { partnerMoveFailure as wn, partnerMoveReading as yn } from "../../lib/move-failure.js";
17
+ import { OPEN_MOVE_STATE_EVENT as tn } from "../../lib/move-state.js";
18
+ import { withoutMoveLabel as qr } from "../../lib/partner-failure.js";
19
+ import { useRecordSignalWhile as kn, useRecordSignalPeers as Rr, signalSentence as Or } from "../../lib/presence-signals.js";
20
+ import { RUN_TRANSITION_EVENT as vt } from "../../lib/run-transition.js";
21
+ import { userErrorMessage as We } from "../../lib/safe-error.js";
22
+ import { plainSendReason as Ar } from "../../lib/send-status.js";
23
+ import { useTrackTravel as Fr, travelPlan as Dr } from "../../lib/track-travel.js";
24
+ import { useStartsOpen as Br } from "../../lib/use-starts-open.js";
25
+ import { cn as re, titleCase as Er, toLocalDateString as Lr, formatDateTime as Pt, humanHours as Ur } from "../../lib/utils.js";
26
+ import { StepForLine as Ir } from "../InStep.js";
27
+ import { PushReadinessChip as jr } from "../integrations/RecordIntegrationPreview.js";
28
+ import { useRecordSendStatus as Wr, SendStatusLines as Kr } from "../integrations/SendStatus.js";
29
+ import { useHeaderFold as Qr } from "../item-edit/HeaderTools.js";
30
+ import { invalidateRecordInsights as Xe, invalidateRecordData as Je } from "../item-edit/RecordInsights.js";
31
+ import { UserChip as _n } from "../item-edit/UserChip.js";
32
+ import { OwnerAvatars as zr } from "../queue/OwnerAvatars.js";
33
+ import { RelativeTime as It } from "../RelativeTime.js";
34
+ import { UserAvatar as Hr } from "../UserAvatar.js";
35
+ import { Button as ve } from "../ui/button.js";
36
+ import { DropdownMenu as At, DropdownMenuTrigger as Ft, DropdownMenuContent as Dt, DropdownMenuGroup as nn, DropdownMenuSeparator as Bt, DropdownMenuItem as ct, DropdownMenuLabel as Vr } from "../ui/dropdown-menu.js";
37
+ import { Popover as Nn, PopoverTrigger as Sn, PopoverContent as Cn } from "../ui/popover.js";
37
38
  import { Skeleton as Ue } from "../ui/skeleton.js";
38
- import { TooltipProvider as Sn, Tooltip as ct, TooltipTrigger as mt, TooltipContent as ut } from "../ui/tooltip.js";
39
- import { ViewAsPersonButton as $t } from "../ViewAsPersonButton.js";
40
- import { isAccessRefusal as Cn, deniedToastAction as $n, WhyOwnersButton as Kr } from "./AccessInsights.js";
41
- import { AsyncUserPicker as Qr } from "./AsyncUserPicker.js";
42
- import { runningMovePoll as Tn, useRunEnded as Mn, startedInBackground as qn, pendingOptIn as Pn, sameMoveId as Ft, runningMoveTip as zr, unansweredHoldTip as Rn, RunningMoveNotice as Hr, MoveProblemNotice as Vr } from "./BackgroundMove.js";
43
- import { withBlockedMoves as An, BlockedMenuMark as pt, blockedMenuItemProps as ft, isBlockedMove as Fn, BlockedMoveButton as On, blockedGroupTip as Dn } from "./BlockedMove.js";
44
- import { BranchLanes as Gr } from "./BranchLanes.js";
45
- import { landingState as Xr, landingSkipGroups as Yr, joinLabels as en } from "./landing-state.js";
46
- import { distinctAdvisories as En, MoveAdvisoryNotice as Bn, REFUSAL_FIX_ACTIONS as Jr, useRecordFixAction as Zr } from "./MoveAdvisory.js";
47
- import { MoveToStatePanel as ea } from "./MoveToStatePanel.js";
48
- import { OWNER_OPENED_HEAD as ta, OwnerOpenedLine as na } from "./OwnerOpenedLine.js";
49
- import { SignOffSummaryLines as ra, useStepTiming as Ln, TimingLegend as aa, timingWords as Un, firstTouchText as In, waitingFill as sa, workingFill as ia } from "./PipelineInsight.js";
50
- import { ResubmissionBrief as tn, resubValueText as oa } from "./ResubmissionDiff.js";
51
- import { SlaClockLine as la } from "./SlaClock.js";
52
- import { standInIds as da, StandInReasonLines as ca } from "./StandInReason.js";
53
- import { useUnseenMoveCheck as jn, UnseenChangesNotice as Wn } from "./unseen-move-check.js";
54
- const Kn = yr(
39
+ import { TooltipProvider as $n, Tooltip as mt, TooltipTrigger as ut, TooltipContent as pt } from "../ui/tooltip.js";
40
+ import { ViewAsPersonButton as qt } from "../ViewAsPersonButton.js";
41
+ import { isAccessRefusal as Tn, deniedToastAction as Mn, WhyOwnersButton as Gr } from "./AccessInsights.js";
42
+ import { AsyncUserPicker as Yr } from "./AsyncUserPicker.js";
43
+ import { runningMovePoll as Pn, useRunEnded as qn, startedInBackground as Rn, pendingOptIn as On, sameMoveId as at, runningMoveTip as Xr, unansweredHoldTip as An, RunningMoveNotice as Jr, MoveProblemNotice as Zr } from "./BackgroundMove.js";
44
+ import { withBlockedMoves as Fn, BlockedMenuMark as ft, blockedMenuItemProps as ht, isBlockedMove as gt, BlockedMoveButton as Dn, blockedGroupTip as Bn } from "./BlockedMove.js";
45
+ import { BranchLanes as ea } from "./BranchLanes.js";
46
+ import { useIntegrationsOpenable as ta, openRecordIntegrations as na } from "./integrations-opener.js";
47
+ import { landingState as ra, landingSkipGroups as aa, joinLabels as rn } from "./landing-state.js";
48
+ import { distinctAdvisories as En, MoveAdvisoryNotice as Ln, REFUSAL_FIX_ACTIONS as sa, useRecordFixAction as ia } from "./MoveAdvisory.js";
49
+ import { MoveToStatePanel as oa } from "./MoveToStatePanel.js";
50
+ import { OWNER_OPENED_HEAD as la, OwnerOpenedLine as da } from "./OwnerOpenedLine.js";
51
+ import { PipelineEventNotice as ca } from "./PipelineEventNotice.js";
52
+ import { SignOffSummaryLines as ma, useStepTiming as Un, TimingLegend as ua, timingWords as In, firstTouchText as jn, waitingFill as pa, workingFill as fa } from "./PipelineInsight.js";
53
+ import { composePipelineNotices as ha, isPlainProblem as ga } from "./pipeline-notices.js";
54
+ import { ResubmissionBrief as an, resubValueText as ba } from "./ResubmissionDiff.js";
55
+ import { SlaClockLine as xa } from "./SlaClock.js";
56
+ import { standInIds as va, StandInReasonLines as wa } from "./StandInReason.js";
57
+ import { useUnseenMoveCheck as Wn, UnseenChangesNotice as Kn } from "./unseen-move-check.js";
58
+ const Qn = Nr(
55
59
  () => import("./TransitionRequirementsDialog.js").then((e) => ({
56
60
  default: e.TransitionRequirementsDialog
57
61
  }))
58
62
  );
59
- function Lt(e, t) {
63
+ function jt(e, t) {
60
64
  var i;
61
65
  const r = e || "System", a = (i = t.acting_admin) != null && i.name && e ? `${t.acting_admin.name} as ${r}` : r;
62
66
  return t.on_behalf_of_name ? `${a}, for ${t.on_behalf_of_name}` : a;
63
67
  }
64
- function ma(e) {
68
+ function ya(e) {
65
69
  if (e.transition) return null;
66
70
  const t = (e.comment ?? "").trim();
67
71
  if (!t.startsWith("{")) return null;
@@ -75,115 +79,69 @@ function ma(e) {
75
79
  }
76
80
  return null;
77
81
  }
78
- function at(e) {
82
+ function st(e) {
79
83
  return !(e.first_name || e.last_name || e.user_email);
80
84
  }
81
- function ht(e) {
85
+ function bt(e) {
82
86
  const t = (e.comment ?? "").trim().toLowerCase();
83
87
  return e.origin === "import" || t.startsWith("import:") ? "Imported" : e.origin === "integration" ? "By an integration" : /-state-sync$/.test(t) || t.startsWith("legacy-") ? "Synced from another system" : t === "state-merge" || t === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
84
88
  }
85
- function Ot(e) {
89
+ function Et(e) {
86
90
  if (e.transition_text) return e.transition_text;
87
91
  if (e.transition_label) return `Rule: ${e.transition_label}`;
88
92
  const t = (e.comment ?? "").trim(), r = /^auto: (.+)$/i.exec(t);
89
93
  return r ? `Rule: ${r[1]}` : /-state-sync$/i.test(t) ? "The state was copied in from the system that owned this record" : /^instance-migration/i.test(t) ? "Moved when the pipeline was reshaped" : /^state-merge/i.test(t) ? "Moved when two states were merged" : null;
90
94
  }
91
- const nn = {
92
- validation: "the partner refused what we sent",
93
- not_found: "the partner could not find what we referred to",
94
- auth: "the partner refused our credentials",
95
- transient: "the partner could not be reached",
96
- rate_limited: "the partner asked us to slow down",
97
- unknown: "the partner refused it"
98
- };
99
- function ua(e) {
100
- const t = Math.ceil((new Date(e).getTime() - qr()) / 6e4);
101
- return !Number.isFinite(t) || t <= 0 ? "on the next check" : t < 60 ? `in ${t} min` : `in ${Math.round(t / 60)}h`;
102
- }
103
- function pa({ held: e }) {
104
- return e.length === 0 ? null : /* @__PURE__ */ n(
105
- "div",
106
- {
107
- 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",
108
- "data-pipeline-auto-held": !0,
109
- children: e.map((t) => {
110
- const r = t.transition_label ?? "An automatic move", a = nn[t.error_class ?? "unknown"] ?? nn.unknown;
111
- return /* @__PURE__ */ s("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
112
- /* @__PURE__ */ s("p", { className: "font-medium", children: [
113
- "Needs a person: ",
114
- r,
115
- " stopped retrying — ",
116
- a,
117
- "."
118
- ] }),
119
- t.error && /* @__PURE__ */ n(
120
- "p",
121
- {
122
- className: "mt-0.5 line-clamp-2 break-words text-[11px] text-amber-700/90 dark:text-amber-300/80",
123
- "data-tip": t.error,
124
- children: t.error
125
- }
126
- ),
127
- /* @__PURE__ */ s("p", { className: "mt-1 text-[11px] text-amber-700 dark:text-amber-400", children: [
128
- t.retry_at ? `It tries the same push again ${ua(t.retry_at)}. ` : "It will not send the same push again on its own. ",
129
- "Fix the record so what it sends changes, retry the push, or move the record by hand.",
130
- t.attempts > 1 ? ` ${t.attempts} attempts so far.` : ""
131
- ] })
132
- ] }, t.transition_id);
133
- })
134
- }
135
- );
136
- }
137
- function Qn(e) {
95
+ function zn(e) {
138
96
  var r;
139
97
  const t = e == null ? void 0 : e.response;
140
98
  return ((t == null ? void 0 : t.code) ?? ((r = t == null ? void 0 : t.data) == null ? void 0 : r.code)) === "TRANSITION_DUPLICATE";
141
99
  }
142
- function zn(e) {
100
+ function Hn(e) {
143
101
  var r;
144
102
  const t = e;
145
103
  return (t == null ? void 0 : t.status) === 422 && ((r = t.response) == null ? void 0 : r.error) === "TRANSITION_REQUIREMENTS" ? t.response.requirements ?? [] : null;
146
104
  }
147
- function wt(e) {
105
+ function kt(e) {
148
106
  var a;
149
107
  const t = e == null ? void 0 : e.response, r = (t == null ? void 0 : t.code) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.code);
150
108
  return typeof r == "string" ? r : null;
151
109
  }
152
- function Hn(e) {
153
- if (wt(e) !== "RECORD_LOCKED") return null;
110
+ function Vn(e) {
111
+ if (kt(e) !== "RECORD_LOCKED") return null;
154
112
  const t = e == null ? void 0 : e.response, r = t != null && t.data && typeof t.data == "object" ? t.data : t;
155
113
  if ((r == null ? void 0 : r.move_anyway) !== !0) return null;
156
114
  const a = typeof r.locked_by_name == "string" ? r.locked_by_name : null;
157
115
  return { message: typeof r.error == "string" && r.error.trim() ? r.error : `${a ?? "Someone else"} is editing this record right now.`, holder: a };
158
116
  }
159
- function Vn(e, t) {
160
- var v, b, y;
161
- const r = wt(e), a = e == null ? void 0 : e.response, i = ((v = a == null ? void 0 : a.fix) == null ? void 0 : v.action) ?? ((y = (b = a == null ? void 0 : a.data) == null ? void 0 : b.fix) == null ? void 0 : y.action), m = typeof i == "string" && i.trim() || (r ? Jr[r] : void 0);
162
- return !r || !m ? null : { code: r, actionKey: m, transitionId: t.transition_id, comment: t.comment };
117
+ function Gn(e, t) {
118
+ var x, b, w;
119
+ const r = kt(e), a = e == null ? void 0 : e.response, i = ((x = a == null ? void 0 : a.fix) == null ? void 0 : x.action) ?? ((w = (b = a == null ? void 0 : a.data) == null ? void 0 : b.fix) == null ? void 0 : w.action), u = typeof i == "string" && i.trim() || (r ? sa[r] : void 0);
120
+ return !r || !u ? null : { code: r, actionKey: u, transitionId: t.transition_id, comment: t.comment };
163
121
  }
164
- const fa = 600;
165
- function Gn(e) {
166
- const t = Ze(), [r, a] = J(!1), i = he(!0);
122
+ const ka = 600;
123
+ function Yn(e) {
124
+ const t = et(), [r, a] = X(!1), i = we(!0);
167
125
  Ee(() => (i.current = !0, () => {
168
126
  i.current = !1;
169
127
  }), []);
170
- const m = he(e);
171
- m.current = e;
172
- const v = fn(async () => {
128
+ const u = we(e);
129
+ u.current = e;
130
+ const x = gn(async () => {
173
131
  a(!0);
174
132
  try {
175
- await t.refetchQueries({ queryKey: [...m.current], type: "active" });
133
+ await t.refetchQueries({ queryKey: [...u.current], type: "active" });
176
134
  } catch {
177
135
  }
178
- await new Promise((b) => setTimeout(b, fa)), i.current && a(!1);
136
+ await new Promise((b) => setTimeout(b, ka)), i.current && a(!1);
179
137
  }, [t]);
180
- return { settling: r, settle: v };
138
+ return { settling: r, settle: x };
181
139
  }
182
- const ze = 1500, rn = 4e3;
183
- class ha {
140
+ const He = 1500, sn = 4e3;
141
+ class _a {
184
142
  constructor() {
185
- Nt(this, "seen", null);
186
- Nt(this, "fresh", /* @__PURE__ */ new Map());
143
+ Tt(this, "seen", null);
144
+ Tt(this, "fresh", /* @__PURE__ */ new Map());
187
145
  }
188
146
  /** Feed the ids on offer now. */
189
147
  observe(t, r) {
@@ -197,7 +155,7 @@ class ha {
197
155
  /** The pointer is on the button. */
198
156
  enter(t, r) {
199
157
  const a = this.fresh.get(String(t).toUpperCase());
200
- a && !a.left && r - a.at < ze && (a.hovered = !0);
158
+ a && !a.left && r - a.at < He && (a.hovered = !0);
201
159
  }
202
160
  /** The pointer left the button. */
203
161
  leave(t) {
@@ -207,21 +165,21 @@ class ha {
207
165
  /** Still inert (no state change)? */
208
166
  inert(t, r) {
209
167
  const a = this.fresh.get(String(t).toUpperCase());
210
- return !a || r - a.at >= rn ? !1 : r - a.at < ze || a.hovered && !a.left;
168
+ return !a || r - a.at >= sn ? !1 : r - a.at < He || a.hovered && !a.left;
211
169
  }
212
170
  /** A press: true = let it through. A press inside the window counts as the pointer being there. */
213
171
  press(t, r) {
214
172
  const a = String(t).toUpperCase(), i = this.fresh.get(a);
215
- return i ? r - i.at < ze ? (i.hovered = !0, i.left = !1, !1) : i.hovered && !i.left && r - i.at < rn ? !1 : (this.fresh.delete(a), !0) : !0;
173
+ return i ? r - i.at < He ? (i.hovered = !0, i.left = !1, !1) : i.hovered && !i.left && r - i.at < sn ? !1 : (this.fresh.delete(a), !0) : !0;
216
174
  }
217
175
  /** Inside its time window (drawn dimmed)? */
218
176
  timed(t, r) {
219
177
  const a = this.fresh.get(String(t).toUpperCase());
220
- return !!a && r - a.at < ze;
178
+ return !!a && r - a.at < He;
221
179
  }
222
180
  /** Any button still inside its time window? */
223
181
  hasTimed(t) {
224
- for (const r of this.fresh.values()) if (t - r.at < ze) return !0;
182
+ for (const r of this.fresh.values()) if (t - r.at < He) return !0;
225
183
  return !1;
226
184
  }
227
185
  reset() {
@@ -229,18 +187,18 @@ class ha {
229
187
  }
230
188
  }
231
189
  function Xn(e, t) {
232
- const r = he(null);
233
- r.current || (r.current = new ha());
234
- const a = r.current, i = he(t);
190
+ const r = we(null);
191
+ r.current || (r.current = new _a());
192
+ const a = r.current, i = we(t);
235
193
  i.current !== t && (i.current = t, a.reset());
236
- const [, m] = J(0), v = e ? e.join(",") : null;
237
- return gt(() => {
194
+ const [, u] = X(0), x = e ? e.join(",") : null;
195
+ return xt(() => {
238
196
  e && a.observe(e, Date.now());
239
- }, [a, v]), Ee(() => {
197
+ }, [a, x]), Ee(() => {
240
198
  if (!a.hasTimed(Date.now())) return;
241
- const b = setTimeout(() => m((y) => y + 1), ze + 20);
199
+ const b = setTimeout(() => u((w) => w + 1), He + 20);
242
200
  return () => clearTimeout(b);
243
- }, [a, v]), {
201
+ }, [a, x]), {
244
202
  dimmed: (b) => a.timed(b, Date.now()),
245
203
  press: (b) => a.press(b, Date.now()),
246
204
  bind: (b) => ({
@@ -250,58 +208,58 @@ function Xn(e, t) {
250
208
  })
251
209
  };
252
210
  }
253
- function Yn(e, t) {
211
+ function Jn(e, t) {
254
212
  return ["approval-brief", e, String(t)];
255
213
  }
256
- function Jn(e, t, r) {
214
+ function Zn(e, t, r) {
257
215
  return e.request(
258
- Fe(`/pipelines/instance/${t}/${r}/approval-brief`)
216
+ De(`/pipelines/instance/${t}/${r}/approval-brief`)
259
217
  ).then((a) => a.data);
260
218
  }
261
- function ga(e) {
219
+ function Na(e) {
262
220
  return (e ?? []).filter((t) => t.tone === "warn" || t.tone === "danger");
263
221
  }
264
- function an(e) {
222
+ function on(e) {
265
223
  return `${(e.label ?? "").trim().toLowerCase()}|${(e.text ?? "").trim().toLowerCase()}`;
266
224
  }
267
- function ba(e) {
225
+ function Sa(e) {
268
226
  const t = Math.max(0, Math.floor(Number(e) || 0));
269
227
  return t === 0 ? "today" : t === 1 ? "1 day ago" : `${t} days ago`;
270
228
  }
271
- function xa(e, t, r = 40) {
272
- const a = (T) => T == null || T === "" ? "" : String(T), i = a(e), m = a(t), v = (T) => T === "" ? "(empty)" : T;
273
- if (e === void 0) return { old: null, new: Tt(v(m), 0, r) };
274
- if (i.length <= r && m.length <= r) return { old: v(i), new: v(m) };
229
+ function Ca(e, t, r = 40) {
230
+ const a = (M) => M == null || M === "" ? "" : String(M), i = a(e), u = a(t), x = (M) => M === "" ? "(empty)" : M;
231
+ if (e === void 0) return { old: null, new: Rt(x(u), 0, r) };
232
+ if (i.length <= r && u.length <= r) return { old: x(i), new: x(u) };
275
233
  let b = 0;
276
- for (; b < i.length && b < m.length && i[b] === m[b]; ) b++;
277
- const y = b > r / 2 ? b - Math.floor(r / 3) : 0;
278
- return { old: Tt(v(i), y, r), new: Tt(v(m), y, r) };
234
+ for (; b < i.length && b < u.length && i[b] === u[b]; ) b++;
235
+ const w = b > r / 2 ? b - Math.floor(r / 3) : 0;
236
+ return { old: Rt(x(i), w, r), new: Rt(x(u), w, r) };
279
237
  }
280
- function Tt(e, t, r) {
238
+ function Rt(e, t, r) {
281
239
  const a = Math.min(t, Math.max(0, e.length - r)), i = e.slice(a, a + r);
282
240
  return `${a > 0 ? "…" : ""}${i}${a + r < e.length ? "…" : ""}`;
283
241
  }
284
- const va = 4e3;
285
- function Zn(e, t) {
286
- const r = We(), a = Ze();
287
- return fn(async () => {
242
+ const $a = 4e3;
243
+ function er(e, t) {
244
+ const r = Ke(), a = et();
245
+ return gn(async () => {
288
246
  try {
289
247
  const i = await Promise.race([
290
248
  a.fetchQuery({
291
- queryKey: Yn(e, t),
292
- queryFn: () => Jn(r, e, t),
249
+ queryKey: Jn(e, t),
250
+ queryFn: () => Zn(r, e, t),
293
251
  staleTime: 0,
294
252
  retry: !1
295
253
  }),
296
- new Promise((m) => setTimeout(() => m(null), va))
254
+ new Promise((u) => setTimeout(() => u(null), $a))
297
255
  ]);
298
- return ga(i == null ? void 0 : i.lines);
256
+ return Na(i == null ? void 0 : i.lines);
299
257
  } catch {
300
258
  return [];
301
259
  }
302
260
  }, [r, a, e, t]);
303
261
  }
304
- function er({ lines: e }) {
262
+ function tr({ lines: e }) {
305
263
  return e.length === 0 ? null : /* @__PURE__ */ s(
306
264
  "div",
307
265
  {
@@ -317,22 +275,22 @@ function er({ lines: e }) {
317
275
  }
318
276
  );
319
277
  }
320
- function it(e, t, r) {
278
+ function ot(e, t, r) {
321
279
  if (!r) return !1;
322
280
  const a = t.find(
323
- (m) => String(m.id).toUpperCase() === String(r).toUpperCase()
324
- ), i = t.find((m) => String(m.id).toUpperCase() === String(e.to_state).toUpperCase());
281
+ (u) => String(u.id).toUpperCase() === String(r).toUpperCase()
282
+ ), i = t.find((u) => String(u.id).toUpperCase() === String(e.to_state).toUpperCase());
325
283
  return !!a && !!i && i.sort < a.sort;
326
284
  }
327
- function Ut(e, t, r) {
285
+ function Wt(e, t, r) {
328
286
  var i;
329
287
  if (!e) return !1;
330
288
  if ((((i = e.order_partners) == null ? void 0 : i.length) ?? 0) > 0) return !0;
331
- if (it(e, t, r)) return !1;
332
- const a = t.find((m) => String(m.id).toUpperCase() === String(e.to_state).toUpperCase());
289
+ if (ot(e, t, r)) return !1;
290
+ const a = t.find((u) => String(u.id).toUpperCase() === String(e.to_state).toUpperCase());
333
291
  return !!(a != null && a.is_terminal) && !/(^|_)cancel/i.test(String(a.key ?? ""));
334
292
  }
335
- const sn = {
293
+ const ln = {
336
294
  red: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
337
295
  amber: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
338
296
  yellow: "border-yellow-200 bg-yellow-50 text-yellow-800 dark:border-yellow-500/30 dark:bg-yellow-500/10 dark:text-yellow-300",
@@ -340,14 +298,14 @@ const sn = {
340
298
  blue: "border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
341
299
  purple: "border-violet-200 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300"
342
300
  };
343
- function wa({ flags: e }) {
344
- return !e || e.length === 0 ? null : /* @__PURE__ */ n(Te, { children: e.map((t) => /* @__PURE__ */ s(
301
+ function Ta({ flags: e }) {
302
+ return !e || e.length === 0 ? null : /* @__PURE__ */ n(qe, { children: e.map((t) => /* @__PURE__ */ s(
345
303
  "span",
346
304
  {
347
305
  "data-record-flag": t.name,
348
- className: ne(
306
+ className: re(
349
307
  "inline-flex shrink-0 items-center gap-1 self-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",
350
- sn[t.color] ?? sn.amber
308
+ ln[t.color] ?? ln.amber
351
309
  ),
352
310
  children: [
353
311
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-current", "aria-hidden": !0 }),
@@ -357,67 +315,67 @@ function wa({ flags: e }) {
357
315
  t.name
358
316
  )) });
359
317
  }
360
- function on(e) {
318
+ function dn(e) {
361
319
  return e.replace(/\s+IIP$/i, "");
362
320
  }
363
- function tr({
321
+ function nr({
364
322
  collection: e,
365
323
  item: t,
366
324
  tx: r
367
325
  }) {
368
- const a = We(), i = (r == null ? void 0 : r.order_partners) ?? [], { data: m } = $e({
326
+ const a = Ke(), i = (r == null ? void 0 : r.order_partners) ?? [], { data: u } = Pe({
369
327
  queryKey: ["push-preflight", e, t, "t", (r == null ? void 0 : r.id) ?? ""],
370
328
  queryFn: () => a.request(
371
- Fe(`/integration-preview/${e}/${encodeURIComponent(t)}/preflight`, {
329
+ De(`/integration-preview/${e}/${encodeURIComponent(t)}/preflight`, {
372
330
  transition_id: (r == null ? void 0 : r.id) ?? ""
373
331
  })
374
- ).then((y) => y.data),
332
+ ).then((w) => w.data),
375
333
  enabled: i.length > 0 && !!(r != null && r.id),
376
334
  staleTime: 2e4
377
335
  });
378
336
  if (i.length === 0) return null;
379
- const v = m != null && m.pushes ? m.pushes.filter((y) => y.status === "would_push" && i.includes(y.api_name)).map((y) => on(y.api_name)) : null, b = [...new Set(v ?? i.map(on))];
337
+ const x = u != null && u.pushes ? u.pushes.filter((w) => w.status === "would_push" && i.includes(w.api_name)).map((w) => dn(w.api_name)) : null, b = [...new Set(x ?? i.map(dn))];
380
338
  return /* @__PURE__ */ s(
381
339
  "p",
382
340
  {
383
341
  "data-order-send-note": !0,
384
342
  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",
385
343
  children: [
386
- /* @__PURE__ */ n(cn, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
387
- v && v.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.`
344
+ /* @__PURE__ */ n(un, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
345
+ x && x.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.`
388
346
  ]
389
347
  }
390
348
  );
391
349
  }
392
- function nr(e) {
350
+ function rr(e) {
393
351
  return e != null && e.instance ? (e.available_transitions ?? []).some(
394
352
  (t) => {
395
353
  var r;
396
- return it(t, e.states ?? [], (r = e.instance) == null ? void 0 : r.current_state);
354
+ return ot(t, e.states ?? [], (r = e.instance) == null ? void 0 : r.current_state);
397
355
  }
398
356
  ) : !1;
399
357
  }
400
- function rr(e, t, r, a) {
358
+ function ar(e, t, r, a) {
401
359
  if (!a || a.size === 0) return e;
402
- const i = new Set([...a.keys()].map((m) => String(m).toUpperCase()));
360
+ const i = new Set([...a.keys()].map((u) => String(u).toUpperCase()));
403
361
  return e.filter(
404
- (m) => !(!m.to_previous && i.has(String(m.to_state).toUpperCase()) && it(m, t, r))
362
+ (u) => !(!u.to_previous && i.has(String(u.to_state).toUpperCase()) && ot(u, t, r))
405
363
  );
406
364
  }
407
- function ar(e, t, r) {
408
- var y, T, h, P, N, _;
365
+ function sr(e, t, r) {
366
+ var w, M, h, R, _, k;
409
367
  const a = [...(e == null ? void 0 : e.available_transitions) ?? [], ...(e == null ? void 0 : e.all_transitions) ?? []].find(
410
- (S) => S.id === t
411
- ), i = r == null ? void 0 : r.data, m = ((y = i == null ? void 0 : i.new_state) == null ? void 0 : y.id) ?? ((T = i == null ? void 0 : i.instance) == null ? void 0 : T.current_state) ?? null, v = ((h = i == null ? void 0 : i.new_state) == null ? void 0 : h.label) ?? (a ? (N = (P = e == null ? void 0 : e.states) == null ? void 0 : P.find((S) => S.id === a.to_state)) == null ? void 0 : N.label : void 0) ?? null, b = ((_ = e == null ? void 0 : e.instance) == null ? void 0 : _.current_state) ?? null;
412
- return b && m && String(b) === String(m) ? "Nothing moved" : a != null && a.label && v ? `${a.label} — now ${v}` : v ? `Moved to ${v}` : a != null && a.label ? `${a.label} done` : "Transition executed";
368
+ (N) => N.id === t
369
+ ), i = r == null ? void 0 : r.data, u = ((w = i == null ? void 0 : i.new_state) == null ? void 0 : w.id) ?? ((M = i == null ? void 0 : i.instance) == null ? void 0 : M.current_state) ?? null, x = ((h = i == null ? void 0 : i.new_state) == null ? void 0 : h.label) ?? (a ? (_ = (R = e == null ? void 0 : e.states) == null ? void 0 : R.find((N) => N.id === a.to_state)) == null ? void 0 : _.label : void 0) ?? null, b = ((k = e == null ? void 0 : e.instance) == null ? void 0 : k.current_state) ?? null;
370
+ return b && u && String(b) === String(u) ? "Nothing moved" : a != null && a.label && x ? `${a.label} — now ${x}` : x ? `Moved to ${x}` : a != null && a.label ? `${a.label} done` : "Transition executed";
413
371
  }
414
- const ya = 1200;
415
- function sr(e) {
372
+ const Ma = 1200;
373
+ function ir(e) {
416
374
  const t = `nvr-move-${Math.random().toString(36).slice(2)}`;
417
375
  let r = !1;
418
376
  const a = setTimeout(() => {
419
377
  r = !0, ee.loading(`${(e == null ? void 0 : e.trim()) || "Moving"}…`, { id: t });
420
- }, ya);
378
+ }, Ma);
421
379
  return {
422
380
  /** Options for the result toast: replaces the loading one when shown. */
423
381
  done: () => (clearTimeout(a), r ? { id: t, duration: 7e3 } : {}),
@@ -427,57 +385,57 @@ function sr(e) {
427
385
  }
428
386
  };
429
387
  }
430
- function xt(e, t, r) {
388
+ function wt(e, t, r) {
431
389
  for (const a of [
432
390
  "pipeline-owners-resolved",
433
391
  "pipeline-instance-owners",
434
392
  "pipeline-all-owners",
435
- ta
393
+ la
436
394
  ])
437
395
  e.invalidateQueries({ queryKey: [a, t, r] });
438
396
  }
439
- function ka(e, t, r) {
397
+ function Pa(e, t, r) {
440
398
  var b;
441
399
  if (!t) return null;
442
- const a = new Map(r.map((y) => [String(y.id).toUpperCase(), y.sort])), i = [...e].sort(
443
- (y, T) => new Date(T.timestamp).getTime() - new Date(y.timestamp).getTime()
400
+ const a = new Map(r.map((w) => [String(w.id).toUpperCase(), w.sort])), i = [...e].sort(
401
+ (w, M) => new Date(M.timestamp).getTime() - new Date(w.timestamp).getTime()
444
402
  )[0];
445
403
  if (!(i != null && i.from_state) || String(i.to_state).toUpperCase() !== String(t).toUpperCase() || !((b = i.comment) != null && b.trim()) || i.origin && i.origin !== "person") return null;
446
- const m = a.get(String(i.from_state).toUpperCase()), v = a.get(String(i.to_state).toUpperCase());
447
- return m == null || v == null || v >= m ? null : i;
404
+ const u = a.get(String(i.from_state).toUpperCase()), x = a.get(String(i.to_state).toUpperCase());
405
+ return u == null || x == null || x >= u ? null : i;
448
406
  }
449
- function Re({ className: e }) {
407
+ function Ae({ className: e }) {
450
408
  return /* @__PURE__ */ n(
451
- dn,
409
+ mn,
452
410
  {
453
411
  "aria-hidden": !0,
454
412
  "data-move-blocked-mark": !0,
455
- className: ne("h-3 w-3 shrink-0 text-amber-600 dark:text-amber-400", e)
413
+ className: re("h-3 w-3 shrink-0 text-amber-600 dark:text-amber-400", e)
456
414
  }
457
415
  );
458
416
  }
459
- function He(e, t = "button") {
417
+ function Ve(e, t = "button") {
460
418
  return e.advisory ? {
461
419
  "data-move-blocked": e.advisory.code,
462
420
  "aria-description": e.advisory.message,
463
421
  ...t === "button" ? { "data-tip": e.advisory.message } : {}
464
422
  } : {};
465
423
  }
466
- const ir = "border-amber-300 text-slate-700 dark:border-amber-500/40 dark:text-slate-200";
467
- function Dt({
424
+ const or = "border-amber-300 text-slate-700 dark:border-amber-500/40 dark:text-slate-200";
425
+ function Lt({
468
426
  moves: e,
469
427
  nameOf: t
470
428
  }) {
471
429
  const r = En(e);
472
- return r.map(({ advisory: a, moves: i }) => /* @__PURE__ */ s(kr, { children: [
473
- /* @__PURE__ */ n(At, {}),
430
+ return r.map(({ advisory: a, moves: i }) => /* @__PURE__ */ s(Sr, { children: [
431
+ /* @__PURE__ */ n(Bt, {}),
474
432
  /* @__PURE__ */ s(
475
433
  "div",
476
434
  {
477
435
  "data-move-blocked-note": a.code,
478
436
  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",
479
437
  children: [
480
- /* @__PURE__ */ n(Re, { className: "mt-0.5" }),
438
+ /* @__PURE__ */ n(Ae, { className: "mt-0.5" }),
481
439
  /* @__PURE__ */ s("span", { className: "min-w-0", children: [
482
440
  a.message,
483
441
  r.length > 1 && /* @__PURE__ */ s("span", { className: "mt-0.5 block text-amber-800/80 dark:text-amber-300/80", children: [
@@ -490,11 +448,11 @@ function Dt({
490
448
  )
491
449
  ] }, `${a.code}:${a.message}`));
492
450
  }
493
- function or(e, t, r) {
451
+ function lr(e, t, r) {
494
452
  const a = String(e.comment_mode ?? "none");
495
- return a === "optional" || a === "required" || Ut(e, t, r);
453
+ return a === "optional" || a === "required" || Wt(e, t, r);
496
454
  }
497
- function _a({ entry: e }) {
455
+ function qa({ entry: e }) {
498
456
  const t = [e.first_name, e.last_name].filter(Boolean).join(" ") || e.user_email || "Someone";
499
457
  return /* @__PURE__ */ s(
500
458
  "div",
@@ -503,7 +461,7 @@ function _a({ entry: e }) {
503
461
  "data-send-back-notice": !0,
504
462
  children: [
505
463
  /* @__PURE__ */ n(
506
- gr,
464
+ vr,
507
465
  {
508
466
  "aria-hidden": !0,
509
467
  className: "mt-[3px] h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
@@ -513,54 +471,54 @@ function _a({ entry: e }) {
513
471
  /* @__PURE__ */ n("p", { className: "whitespace-pre-line break-words text-[13px] leading-snug text-slate-800 dark:text-slate-100", children: e.comment }),
514
472
  /* @__PURE__ */ s("p", { className: "mt-0.5 text-[11.5px] text-amber-800/80 dark:text-amber-300/80", children: [
515
473
  "Sent back by ",
516
- Lt(t, e),
474
+ jt(t, e),
517
475
  " · ",
518
- /* @__PURE__ */ n(Bt, { value: e.timestamp })
476
+ /* @__PURE__ */ n(It, { value: e.timestamp })
519
477
  ] })
520
478
  ] })
521
479
  ]
522
480
  }
523
481
  );
524
482
  }
525
- function lr({
483
+ function dr({
526
484
  collection: e,
527
485
  item: t,
528
486
  offer: r,
529
487
  onFixed: a,
530
488
  onDismiss: i,
531
- className: m,
532
- style: v
489
+ className: u,
490
+ style: x
533
491
  }) {
534
- const [b, y] = J(""), { action: T, isLoading: h, run: P } = Zr(e, t, r.actionKey), N = Je({
535
- mutationFn: () => P(b),
492
+ const [b, w] = X(""), { action: M, isLoading: h, run: R } = ia(e, t, r.actionKey), _ = Ze({
493
+ mutationFn: () => R(b),
536
494
  onSuccess: () => {
537
- ee.success(`${(T == null ? void 0 : T.label) ?? "Done"} — trying again`), a();
495
+ ee.success(`${(M == null ? void 0 : M.label) ?? "Done"} — trying again`), a();
538
496
  },
539
- onError: (S) => Sr(S, `${(T == null ? void 0 : T.label) ?? "The fix"} failed`)
497
+ onError: (N) => Tr(N, `${(M == null ? void 0 : M.label) ?? "The fix"} failed`)
540
498
  });
541
- if (h || !T) return null;
542
- const _ = !N.isPending && (!T.require_reason || b.trim().length > 0);
499
+ if (h || !M) return null;
500
+ const k = !_.isPending && (!M.require_reason || b.trim().length > 0);
543
501
  return /* @__PURE__ */ s(
544
502
  "div",
545
503
  {
546
- className: ne(
504
+ className: re(
547
505
  "space-y-2 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-amber-950",
548
- m
506
+ u
549
507
  ),
550
- style: v,
508
+ style: x,
551
509
  "data-refusal-fix": r.code,
552
510
  children: [
553
511
  /* @__PURE__ */ s("p", { className: "text-[12px] text-amber-950 dark:text-amber-100", children: [
554
512
  "You can fix this here: ",
555
- T.label,
513
+ M.label,
556
514
  ", then the move is tried again."
557
515
  ] }),
558
- T.require_reason && /* @__PURE__ */ n(
516
+ M.require_reason && /* @__PURE__ */ n(
559
517
  "input",
560
518
  {
561
519
  type: "text",
562
520
  value: b,
563
- onChange: (S) => y(S.target.value),
521
+ onChange: (N) => w(N.target.value),
564
522
  placeholder: "Reason (required)",
565
523
  "aria-label": "Reason",
566
524
  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"
@@ -568,7 +526,7 @@ function lr({
568
526
  ),
569
527
  /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
570
528
  /* @__PURE__ */ n(
571
- fe,
529
+ ve,
572
530
  {
573
531
  type: "button",
574
532
  size: "sm",
@@ -579,16 +537,16 @@ function lr({
579
537
  }
580
538
  ),
581
539
  /* @__PURE__ */ s(
582
- fe,
540
+ ve,
583
541
  {
584
542
  type: "button",
585
543
  size: "sm",
586
544
  className: "h-7 gap-1.5 text-[12px]",
587
- disabled: !_,
588
- onClick: () => N.mutate(),
545
+ disabled: !k,
546
+ onClick: () => _.mutate(),
589
547
  children: [
590
- N.isPending && /* @__PURE__ */ n(Ae, { className: "h-3 w-3 animate-spin" }),
591
- T.label,
548
+ _.isPending && /* @__PURE__ */ n(Fe, { className: "h-3 w-3 animate-spin" }),
549
+ M.label,
592
550
  ", then try again"
593
551
  ]
594
552
  }
@@ -598,22 +556,22 @@ function lr({
598
556
  }
599
557
  );
600
558
  }
601
- function Na(e) {
559
+ function Ra(e) {
602
560
  const t = /^#?([0-9a-f]{6})$/i.exec(String(e ?? "").trim());
603
561
  if (!t) return !0;
604
- const r = Number.parseInt(t[1], 16), [a, i, m] = [r >> 16 & 255, r >> 8 & 255, r & 255];
605
- return Math.max(a, i, m) - Math.min(a, i, m) < 48;
562
+ const r = Number.parseInt(t[1], 16), [a, i, u] = [r >> 16 & 255, r >> 8 & 255, r & 255];
563
+ return Math.max(a, i, u) - Math.min(a, i, u) < 48;
606
564
  }
607
565
  function Ie({
608
566
  label: e,
609
567
  color: t,
610
568
  small: r
611
569
  }) {
612
- const a = r ? "px-2 py-0.5 text-[11px]" : "px-2.5 py-1 text-[12px]", i = Na(t);
570
+ const a = r ? "px-2 py-0.5 text-[11px]" : "px-2.5 py-1 text-[12px]", i = Ra(t);
613
571
  return /* @__PURE__ */ n(
614
572
  "span",
615
573
  {
616
- className: ne(
574
+ className: re(
617
575
  // One line always: a wrapped rounded-full pill becomes an oval. A long step name
618
576
  // truncates and the tip carries all of it.
619
577
  "nvr-state-pulse inline-flex min-w-0 max-w-full items-center gap-1.5 whitespace-nowrap rounded-full border font-medium transition-colors duration-300",
@@ -632,57 +590,57 @@ function Ie({
632
590
  e
633
591
  );
634
592
  }
635
- function Mt(e) {
593
+ function Ot(e) {
636
594
  const t = Math.floor(e / 6e4);
637
- return t < 60 ? `${Math.max(1, t)}m` : Dr(e / 36e5);
595
+ return t < 60 ? `${Math.max(1, t)}m` : Ur(e / 36e5);
638
596
  }
639
- function Sa({
597
+ function Oa({
640
598
  history: e,
641
599
  completedAt: t,
642
600
  collection: r,
643
601
  item: a
644
602
  }) {
645
- const i = Ln(
603
+ const i = Un(
646
604
  r ?? "",
647
605
  a ?? "",
648
- dr(e, t),
606
+ cr(e, t),
649
607
  !!r && !!a && e.length > 1
650
- ), m = [...e].sort(
651
- (h, P) => new Date(h.timestamp).getTime() - new Date(P.timestamp).getTime()
608
+ ), u = [...e].sort(
609
+ (h, R) => new Date(h.timestamp).getTime() - new Date(R.timestamp).getTime()
652
610
  );
653
- if (m.length === 0) return null;
654
- const v = t ? new Date(t).getTime() : Date.now(), b = m.map((h, P) => {
655
- const N = new Date(h.timestamp).getTime(), _ = P + 1 < m.length ? new Date(m[P + 1].timestamp).getTime() : v;
611
+ if (u.length === 0) return null;
612
+ const x = t ? new Date(t).getTime() : Date.now(), b = u.map((h, R) => {
613
+ const _ = new Date(h.timestamp).getTime(), k = R + 1 < u.length ? new Date(u[R + 1].timestamp).getTime() : x;
656
614
  return {
657
615
  key: h.id,
658
616
  label: h.to_state_label,
659
617
  color: h.to_state_color,
660
- ms: Math.max(0, _ - N),
661
- current: P === m.length - 1 && !t,
618
+ ms: Math.max(0, k - _),
619
+ current: R === u.length - 1 && !t,
662
620
  timing: (i == null ? void 0 : i.get(Number(h.id))) ?? null
663
621
  };
664
622
  }).filter((h) => h.ms > 0 || h.current);
665
623
  if (b.length < 2) return null;
666
- const y = b.reduce((h, P) => h + P.ms, 0);
667
- if (y <= 0) return null;
668
- const T = b.some((h) => h.timing);
669
- return /* @__PURE__ */ s("div", { "data-state-timeline": !0, "data-step-timing": T ? "split" : void 0, children: [
624
+ const w = b.reduce((h, R) => h + R.ms, 0);
625
+ if (w <= 0) return null;
626
+ const M = b.some((h) => h.timing);
627
+ return /* @__PURE__ */ s("div", { "data-state-timeline": !0, "data-step-timing": M ? "split" : void 0, children: [
670
628
  /* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between gap-3", children: [
671
629
  /* @__PURE__ */ n("p", { className: "shrink-0 whitespace-nowrap text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
672
630
  /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3 text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
673
- T && /* @__PURE__ */ n("span", { className: "max-sm:hidden", children: /* @__PURE__ */ n(aa, {}) }),
631
+ M && /* @__PURE__ */ n("span", { className: "max-sm:hidden", children: /* @__PURE__ */ n(ua, {}) }),
674
632
  /* @__PURE__ */ s("span", { className: "whitespace-nowrap", children: [
675
- Mt(y),
633
+ Ot(w),
676
634
  " total",
677
635
  t ? "" : " · so far"
678
636
  ] })
679
637
  ] })
680
638
  ] }),
681
639
  /* @__PURE__ */ n("div", { className: "flex h-4 w-full overflow-hidden rounded", children: b.map((h) => {
682
- const P = h.ms / y * 100, N = h.timing, _ = N ? N.waiting_ms + N.working_ms : 0, S = N && _ > 0 ? N.waiting_ms / _ * 100 : 0, q = [
683
- `${h.label} — ${Mt(h.ms)}${h.current ? " (current)" : ""}`,
684
- N ? Un(N) : null,
685
- N ? In(N) : null
640
+ const R = h.ms / w * 100, _ = h.timing, k = _ ? _.waiting_ms + _.working_ms : 0, N = _ && k > 0 ? _.waiting_ms / k * 100 : 0, q = [
641
+ `${h.label} — ${Ot(h.ms)}${h.current ? " (current)" : ""}`,
642
+ _ ? In(_) : null,
643
+ _ ? jn(_) : null
686
644
  ].filter(Boolean).join(" · ");
687
645
  return /* @__PURE__ */ s(
688
646
  "div",
@@ -691,16 +649,16 @@ function Sa({
691
649
  "data-step-visit": h.key,
692
650
  className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
693
651
  style: {
694
- width: `${P}%`,
695
- backgroundColor: N ? void 0 : h.color ? `${h.color}55` : "rgba(100,116,139,.25)"
652
+ width: `${R}%`,
653
+ backgroundColor: _ ? void 0 : h.color ? `${h.color}55` : "rgba(100,116,139,.25)"
696
654
  },
697
655
  children: [
698
- N && /* @__PURE__ */ s("span", { className: "absolute inset-0 flex", "aria-hidden": !0, children: [
656
+ _ && /* @__PURE__ */ s("span", { className: "absolute inset-0 flex", "aria-hidden": !0, children: [
699
657
  /* @__PURE__ */ n(
700
658
  "span",
701
659
  {
702
660
  className: "h-full",
703
- style: { width: `${S}%`, background: sa(h.color) },
661
+ style: { width: `${N}%`, background: pa(h.color) },
704
662
  "data-step-waiting": !0
705
663
  }
706
664
  ),
@@ -708,15 +666,15 @@ function Sa({
708
666
  "span",
709
667
  {
710
668
  className: "h-full flex-1",
711
- style: { background: ia(h.color) },
669
+ style: { background: fa(h.color) },
712
670
  "data-step-working": !0
713
671
  }
714
672
  )
715
673
  ] }),
716
- P >= 14 && /* @__PURE__ */ s("span", { className: "relative truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
674
+ R >= 14 && /* @__PURE__ */ s("span", { className: "relative truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
717
675
  h.label,
718
676
  " · ",
719
- Mt(h.ms)
677
+ Ot(h.ms)
720
678
  ] }),
721
679
  h.current && /* @__PURE__ */ n(
722
680
  "span",
@@ -732,132 +690,132 @@ function Sa({
732
690
  }) })
733
691
  ] });
734
692
  }
735
- function dr(e, t) {
693
+ function cr(e, t) {
736
694
  return `${e.reduce((a, i) => Math.max(a, Number(i.id) || 0), 0)}:${e.length}:${t ?? ""}`;
737
695
  }
738
- function Ca({
696
+ function Aa({
739
697
  states: e,
740
698
  allTransitions: t,
741
699
  availableTransitions: r,
742
700
  currentStateId: a,
743
701
  history: i,
744
- onPathIds: m,
745
- skippedStates: v,
702
+ onPathIds: u,
703
+ skippedStates: x,
746
704
  travel: b,
747
- onShowHistory: y
705
+ onShowHistory: w
748
706
  }) {
749
- var G;
750
- const T = he(null);
707
+ var Y;
708
+ const M = we(null);
751
709
  Ee(() => {
752
- const p = T.current;
710
+ const p = M.current;
753
711
  if (!p || p.scrollWidth <= p.clientWidth) return;
754
712
  const $ = p.querySelector("[data-track-current]");
755
713
  if (!$) return;
756
- const w = $.closest("[data-track-step]"), g = (w == null ? void 0 : w.previousElementSibling) ?? w;
714
+ const v = $.closest("[data-track-step]"), g = (v == null ? void 0 : v.previousElementSibling) ?? v;
757
715
  if (!g) return;
758
716
  const C = p.getBoundingClientRect();
759
717
  p.scrollLeft += g.getBoundingClientRect().left - C.left - 2;
760
718
  }, [a]);
761
- const [h, P] = J({
719
+ const [h, R] = X({
762
720
  left: !1,
763
721
  right: !1
764
722
  });
765
723
  Ee(() => {
766
- const p = T.current;
724
+ const p = M.current;
767
725
  if (!p) return;
768
726
  const $ = () => {
769
727
  const g = p.scrollLeft > 2, C = p.scrollLeft + p.clientWidth < p.scrollWidth - 2;
770
- P((K) => K.left === g && K.right === C ? K : { left: g, right: C });
728
+ R((Q) => Q.left === g && Q.right === C ? Q : { left: g, right: C });
771
729
  };
772
730
  $(), p.addEventListener("scroll", $, { passive: !0 });
773
- const w = typeof ResizeObserver < "u" ? new ResizeObserver($) : null;
774
- return w == null || w.observe(p), () => {
775
- p.removeEventListener("scroll", $), w == null || w.disconnect();
731
+ const v = typeof ResizeObserver < "u" ? new ResizeObserver($) : null;
732
+ return v == null || v.observe(p), () => {
733
+ p.removeEventListener("scroll", $), v == null || v.disconnect();
776
734
  };
777
735
  }, []);
778
- const N = new Set(i.map((p) => p.to_state)), _ = e.find((p) => p.is_initial);
779
- _ && _.id !== a && N.add(_.id);
780
- const S = (G = i[0]) == null ? void 0 : G.from_state;
781
- S && S !== a && N.add(S);
736
+ const _ = new Set(i.map((p) => p.to_state)), k = e.find((p) => p.is_initial);
737
+ k && k.id !== a && _.add(k.id);
738
+ const N = (Y = i[0]) == null ? void 0 : Y.from_state;
739
+ N && N !== a && _.add(N);
782
740
  const q = (() => {
783
- if (m)
784
- return e.filter((o) => m.has(o.id) || N.has(o.id) || o.id === a).filter((o) => {
785
- const R = o.stage_visibility ?? "always";
786
- return R === "hide" ? !1 : R === "hide_unless_active" ? N.has(o.id) || o.id === a : !0;
787
- }).sort((o, R) => o.sort - R.sort);
741
+ if (u)
742
+ return e.filter((o) => u.has(o.id) || _.has(o.id) || o.id === a).filter((o) => {
743
+ const O = o.stage_visibility ?? "always";
744
+ return O === "hide" ? !1 : O === "hide_unless_active" ? _.has(o.id) || o.id === a : !0;
745
+ }).sort((o, O) => o.sort - O.sort);
788
746
  if (t.length === 0) {
789
- const o = /* @__PURE__ */ new Set([...N]);
790
- return a && o.add(a), e.filter((R) => o.has(R.id)).sort((R, L) => R.sort - L.sort);
747
+ const o = /* @__PURE__ */ new Set([..._]);
748
+ return a && o.add(a), e.filter((O) => o.has(O.id)).sort((O, U) => O.sort - U.sort);
791
749
  }
792
750
  const p = new Set(
793
751
  i.filter((o) => o.from_state).map((o) => `${o.from_state}:${o.to_state}`)
794
- ), $ = new Set(i.map((o) => o.from_state).filter(Boolean)), w = t.filter((o) => o.from_state !== null), g = /* @__PURE__ */ new Map();
795
- for (const o of w) {
796
- const R = o.from_state;
797
- if ($.has(R) && !p.has(`${R}:${o.to_state}`)) continue;
798
- const L = g.get(R) ?? [];
799
- L.push(o.to_state), g.set(R, L);
752
+ ), $ = new Set(i.map((o) => o.from_state).filter(Boolean)), v = t.filter((o) => o.from_state !== null), g = /* @__PURE__ */ new Map();
753
+ for (const o of v) {
754
+ const O = o.from_state;
755
+ if ($.has(O) && !p.has(`${O}:${o.to_state}`)) continue;
756
+ const U = g.get(O) ?? [];
757
+ U.push(o.to_state), g.set(O, U);
800
758
  }
801
759
  if (a) {
802
- const o = w.filter((R) => R.from_state === a).map((R) => R.to_state);
760
+ const o = v.filter((O) => O.from_state === a).map((O) => O.to_state);
803
761
  g.set(a, [
804
- .../* @__PURE__ */ new Set([...r.map((R) => R.to_state), ...o])
762
+ .../* @__PURE__ */ new Set([...r.map((O) => O.to_state), ...o])
805
763
  ]);
806
764
  }
807
- const C = /* @__PURE__ */ new Set(), K = e.filter((o) => o.is_initial).map((o) => o.id);
808
- for (; K.length; ) {
809
- const o = K.shift();
765
+ const C = /* @__PURE__ */ new Set(), Q = e.filter((o) => o.is_initial).map((o) => o.id);
766
+ for (; Q.length; ) {
767
+ const o = Q.shift();
810
768
  if (!C.has(o)) {
811
769
  C.add(o);
812
- for (const R of g.get(o) ?? []) C.has(R) || K.push(R);
770
+ for (const O of g.get(o) ?? []) C.has(O) || Q.push(O);
813
771
  }
814
772
  }
815
- const be = /* @__PURE__ */ new Set([...C, ...N]);
816
- return a && be.add(a), e.filter((o) => be.has(o.id)).filter((o) => {
817
- const R = o.stage_visibility ?? "always";
818
- return R === "hide" ? !1 : R === "hide_unless_active" ? N.has(o.id) || o.id === a : !0;
819
- }).sort((o, R) => o.sort - R.sort);
773
+ const ke = /* @__PURE__ */ new Set([...C, ..._]);
774
+ return a && ke.add(a), e.filter((o) => ke.has(o.id)).filter((o) => {
775
+ const O = o.stage_visibility ?? "always";
776
+ return O === "hide" ? !1 : O === "hide_unless_active" ? _.has(o.id) || o.id === a : !0;
777
+ }).sort((o, O) => o.sort - O.sort);
820
778
  })();
821
779
  if (q.length < 2) return null;
822
- const V = q.findIndex((p) => p.id === a), B = Rr(
780
+ const V = q.findIndex((p) => p.id === a), L = Dr(
823
781
  q.map((p) => p.id),
824
782
  b ?? null
825
- ), re = new Map(q.map((p, $) => [p.id, $])), ie = new Map(e.map((p) => [p.id, p.label]));
826
- function de(p, $) {
827
- const w = re.get(p);
828
- return w == null ? [] : [...i].filter((g) => {
783
+ ), ae = new Map(q.map((p, $) => [p.id, $])), oe = new Map(e.map((p) => [p.id, p.label]));
784
+ function pe(p, $) {
785
+ const v = ae.get(p);
786
+ return v == null ? [] : [...i].filter((g) => {
829
787
  if (!g.from_state) return !1;
830
- const C = re.get(g.from_state), K = re.get(g.to_state);
831
- return C == null || K == null ? !1 : C === w && K > w || K < C && C - 1 === w;
788
+ const C = ae.get(g.from_state), Q = ae.get(g.to_state);
789
+ return C == null || Q == null ? !1 : C === v && Q > v || Q < C && C - 1 === v;
832
790
  }).sort((g, C) => new Date(g.timestamp).getTime() - new Date(C.timestamp).getTime());
833
791
  }
834
- function Z(p) {
835
- var $, w, g, C;
836
- return at(p) ? /* @__PURE__ */ n(un, { className: "inline h-2.5 w-2.5", "aria-label": ht(p) }) : (((($ = p.first_name) == null ? void 0 : $[0]) ?? "") + (((w = p.last_name) == null ? void 0 : w[0]) ?? "")).toUpperCase() || ((C = (g = p.user_email) == null ? void 0 : g[0]) == null ? void 0 : C.toUpperCase()) || "?";
792
+ function J(p) {
793
+ var $, v, g, C;
794
+ return st(p) ? /* @__PURE__ */ n(fn, { className: "inline h-2.5 w-2.5", "aria-label": bt(p) }) : (((($ = p.first_name) == null ? void 0 : $[0]) ?? "") + (((v = p.last_name) == null ? void 0 : v[0]) ?? "")).toUpperCase() || ((C = (g = p.user_email) == null ? void 0 : g[0]) == null ? void 0 : C.toUpperCase()) || "?";
837
795
  }
838
- function I(p) {
839
- return Lt([p.first_name, p.last_name].filter(Boolean).join(" ") || p.user_email, p);
796
+ function j(p) {
797
+ return jt([p.first_name, p.last_name].filter(Boolean).join(" ") || p.user_email, p);
840
798
  }
841
- const ge = /* @__PURE__ */ new Map();
799
+ const ye = /* @__PURE__ */ new Map();
842
800
  for (const p of [...i].sort(
843
- ($, w) => new Date($.timestamp).getTime() - new Date(w.timestamp).getTime()
801
+ ($, v) => new Date($.timestamp).getTime() - new Date(v.timestamp).getTime()
844
802
  )) {
845
803
  if (!p.from_state) continue;
846
- const $ = re.get(p.from_state), w = re.get(p.to_state);
847
- if (!($ == null || w == null || w <= $ + 1))
848
- for (let g = $ + 1; g < w; g++) {
804
+ const $ = ae.get(p.from_state), v = ae.get(p.to_state);
805
+ if (!($ == null || v == null || v <= $ + 1))
806
+ for (let g = $ + 1; g < v; g++) {
849
807
  const C = q[g].id;
850
- !N.has(C) && !ge.has(C) && ge.set(C, p);
808
+ !_.has(C) && !ye.has(C) && ye.set(C, p);
851
809
  }
852
810
  }
853
- function _e(p) {
854
- const $ = ie.get(p.from_state ?? "") ?? "the previous step", w = ie.get(p.to_state) ?? "the next step", g = at(p) ? "it moved automatically" : `${I(p)} moved it`;
855
- return `Passed over on ${Ct(p.timestamp)} — ${g} straight from ${$} to ${w}`;
811
+ function Se(p) {
812
+ const $ = oe.get(p.from_state ?? "") ?? "the previous step", v = oe.get(p.to_state) ?? "the next step", g = st(p) ? "it moved automatically" : `${j(p)} moved it`;
813
+ return `Passed over on ${Pt(p.timestamp)} — ${g} straight from ${$} to ${v}`;
856
814
  }
857
- return /* @__PURE__ */ n(Sn, { delayDuration: 200, children: /* @__PURE__ */ n(
815
+ return /* @__PURE__ */ n($n, { delayDuration: 200, children: /* @__PURE__ */ n(
858
816
  "div",
859
817
  {
860
- ref: T,
818
+ ref: M,
861
819
  className: "overflow-x-auto pt-1.5 pb-1 [scrollbar-width:thin]",
862
820
  "data-state-track": !0,
863
821
  "data-track-more-left": h.left || void 0,
@@ -872,43 +830,43 @@ function Ca({
872
830
  className: "flex w-full items-start px-2",
873
831
  style: { minWidth: `${q.length * 116 - 40 + 16}px` },
874
832
  children: q.map((p, $) => {
875
- const w = p.id === a, g = N.has(p.id), C = g && !w && (V < 0 || $ < V), K = g && !w && !C, be = !g && !w ? ge.get(p.id) : void 0, o = !g && !w ? v == null ? void 0 : v.get(p.id) : void 0, R = be || o ? [...be ? [_e(be)] : [], ...o ?? []] : void 0, L = R !== void 0, Me = p.color ?? "#94a3b8", te = $ === q.length - 1, Ce = te ? null : q[$ + 1], ce = Ce ? de(p.id, Ce.id) : [];
833
+ const v = p.id === a, g = _.has(p.id), C = g && !v && (V < 0 || $ < V), Q = g && !v && !C, ke = !g && !v ? ye.get(p.id) : void 0, o = !g && !v ? x == null ? void 0 : x.get(p.id) : void 0, O = ke || o ? [...ke ? [Se(ke)] : [], ...o ?? []] : void 0, U = O !== void 0, Re = p.color ?? "#94a3b8", ne = $ === q.length - 1, Te = ne ? null : q[$ + 1], fe = Te ? pe(p.id, Te.id) : [];
876
834
  return /* @__PURE__ */ s("div", { className: "flex flex-1 items-start", "data-track-step": !0, children: [
877
835
  /* @__PURE__ */ s("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
878
836
  /* @__PURE__ */ n(
879
837
  "div",
880
838
  {
881
- "data-track-current": w || void 0,
882
- "data-track-arrive": B && B.arriveIndex === $ ? "" : void 0,
883
- className: ne(
839
+ "data-track-current": v || void 0,
840
+ "data-track-arrive": L && L.arriveIndex === $ ? "" : void 0,
841
+ className: re(
884
842
  "flex h-7 w-7 shrink-0 items-center justify-center rounded-full",
885
- (w || C) && "nvr-fill-sweep",
886
- B && B.arriveIndex === $ && "nvr-track-arrive",
843
+ (v || C) && "nvr-fill-sweep",
844
+ L && L.arriveIndex === $ && "nvr-track-arrive",
887
845
  // Steps still to come stay muted in both themes: the
888
846
  // current step is always the strongest node on the track.
889
- !w && !C && (L ? "border-[1.5px] border-dashed border-slate-300 bg-transparent dark:border-slate-600" : "border-[1.5px] border-slate-200 bg-slate-100 dark:border-slate-700 dark:bg-slate-800")
847
+ !v && !C && (U ? "border-[1.5px] border-dashed border-slate-300 bg-transparent dark:border-slate-600" : "border-[1.5px] border-slate-200 bg-slate-100 dark:border-slate-700 dark:bg-slate-800")
890
848
  ),
891
- "data-tip": K ? `Passed before the record was sent back — it needs this step again.${p.description ? ` ${p.description}` : ""}` : p.description || void 0,
892
- "data-track-again": K || void 0,
849
+ "data-tip": Q ? `Passed before the record was sent back — it needs this step again.${p.description ? ` ${p.description}` : ""}` : p.description || void 0,
850
+ "data-track-again": Q || void 0,
893
851
  style: {
894
- ...B && B.arriveIndex === $ ? { "--nvr-track-arrive": `${B.arriveDelay}ms` } : null,
895
- backgroundColor: w || C ? Me : void 0,
852
+ ...L && L.arriveIndex === $ ? { "--nvr-track-arrive": `${L.arriveDelay}ms` } : null,
853
+ backgroundColor: v || C ? Re : void 0,
896
854
  // The gap ring is the surface colour, not white — a white
897
855
  // halo was the brightest thing on a dark page.
898
- boxShadow: w ? `0 0 0 3px hsl(var(--card, 0 0% 100%)), 0 0 0 5px ${Me}` : void 0
856
+ boxShadow: v ? `0 0 0 3px hsl(var(--card, 0 0% 100%)), 0 0 0 5px ${Re}` : void 0
899
857
  },
900
- children: C ? /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : w ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : L ? /* @__PURE__ */ n(
901
- br,
858
+ children: C ? /* @__PURE__ */ n(yt, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : v ? /* @__PURE__ */ n("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : U ? /* @__PURE__ */ n(
859
+ wr,
902
860
  {
903
861
  className: "h-3 w-3 text-slate-400 dark:text-slate-500",
904
862
  strokeWidth: 2.5
905
863
  }
906
864
  ) : /* @__PURE__ */ n("div", { className: "h-2 w-2 rounded-full bg-slate-300 dark:bg-slate-600" })
907
865
  },
908
- `${w ? "cur" : C ? "done" : L ? "skip" : "todo"}${B && B.arriveIndex === $ ? `:t${b == null ? void 0 : b.n}` : ""}`
866
+ `${v ? "cur" : C ? "done" : U ? "skip" : "todo"}${L && L.arriveIndex === $ ? `:t${b == null ? void 0 : b.n}` : ""}`
909
867
  ),
910
- L ? /* @__PURE__ */ s(ct, { children: [
911
- /* @__PURE__ */ n(mt, { asChild: !0, children: /* @__PURE__ */ n(
868
+ U ? /* @__PURE__ */ s(mt, { children: [
869
+ /* @__PURE__ */ n(ut, { asChild: !0, children: /* @__PURE__ */ n(
912
870
  "span",
913
871
  {
914
872
  className: "w-full cursor-help break-words text-center leading-snug",
@@ -923,35 +881,35 @@ function Ca({
923
881
  children: p.label
924
882
  }
925
883
  ) }),
926
- /* @__PURE__ */ s(ut, { className: "max-w-[260px]", children: [
884
+ /* @__PURE__ */ s(pt, { className: "max-w-[260px]", children: [
927
885
  /* @__PURE__ */ n("p", { className: "text-[11px] font-medium", children: "Skipped for this record" }),
928
- R.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: R.map((D) => /* @__PURE__ */ n("li", { children: D }, D)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
886
+ O.length > 0 ? /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 text-[11px] opacity-90", children: O.map((D) => /* @__PURE__ */ n("li", { children: D }, D)) }) : /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] opacity-90", children: "Its skip conditions are met." })
929
887
  ] })
930
888
  ] }) : /* @__PURE__ */ n(
931
889
  "span",
932
890
  {
933
- className: ne(
891
+ className: re(
934
892
  "w-full break-words text-center leading-snug",
935
- !w && !C && "text-slate-500 dark:text-slate-400",
893
+ !v && !C && "text-slate-500 dark:text-slate-400",
936
894
  C && "text-slate-600 dark:text-slate-300"
937
895
  ),
938
896
  style: {
939
897
  fontSize: "11px",
940
- color: w ? Me : void 0,
941
- fontWeight: w ? 600 : C ? 500 : 400,
898
+ color: v ? Re : void 0,
899
+ fontWeight: v ? 600 : C ? 500 : 400,
942
900
  wordBreak: "break-word"
943
901
  },
944
902
  children: p.label
945
903
  }
946
904
  )
947
905
  ] }),
948
- !te && /* @__PURE__ */ s("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
906
+ !ne && /* @__PURE__ */ s("div", { className: "mt-[13px] flex w-10 shrink-0 flex-col items-center gap-1.5", children: [
949
907
  (() => {
950
- const D = C ? `${Me}55` : "currentColor", Q = B == null ? void 0 : B.segments.get($);
908
+ const D = C ? `${Re}55` : "currentColor", z = L == null ? void 0 : L.segments.get($);
951
909
  return /* @__PURE__ */ s(
952
910
  "div",
953
911
  {
954
- className: ne(
912
+ className: re(
955
913
  "flex w-full shrink-0 items-center",
956
914
  // Arbitrary hex: a host re-pointing bare slate tokens must not
957
915
  // turn the arrow after the current step white in dark.
@@ -961,21 +919,21 @@ function Ca({
961
919
  /* @__PURE__ */ n(
962
920
  "div",
963
921
  {
964
- className: ne(
922
+ className: re(
965
923
  "h-0.5 flex-1 rounded-l-sm",
966
- Q != null && "nvr-track-travel"
924
+ z != null && "nvr-track-travel"
967
925
  ),
968
- "data-track-travel": Q != null ? "" : void 0,
926
+ "data-track-travel": z != null ? "" : void 0,
969
927
  style: {
970
928
  backgroundColor: D,
971
- ...Q != null && B ? {
972
- "--nvr-track-seg": `${B.seg}ms`,
973
- animationDelay: `${Q}ms`,
974
- transformOrigin: B.backward ? "right" : "left"
929
+ ...z != null && L ? {
930
+ "--nvr-track-seg": `${L.seg}ms`,
931
+ animationDelay: `${z}ms`,
932
+ transformOrigin: L.backward ? "right" : "left"
975
933
  } : null
976
934
  }
977
935
  },
978
- Q != null ? `t${b == null ? void 0 : b.n}` : "line"
936
+ z != null ? `t${b == null ? void 0 : b.n}` : "line"
979
937
  ),
980
938
  /* @__PURE__ */ n(
981
939
  "div",
@@ -993,75 +951,75 @@ function Ca({
993
951
  }
994
952
  );
995
953
  })(),
996
- ce.slice(-1).map((D) => {
997
- const Q = D.from_state !== p.id, oe = Math.abs(
998
- (re.get(D.to_state) ?? 0) - (re.get(D.from_state ?? "") ?? 0)
999
- ) > 1 ? ie.get(D.to_state) ?? "" : null;
1000
- return /* @__PURE__ */ s(ct, { children: [
1001
- /* @__PURE__ */ n(mt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
954
+ fe.slice(-1).map((D) => {
955
+ const z = D.from_state !== p.id, le = Math.abs(
956
+ (ae.get(D.to_state) ?? 0) - (ae.get(D.from_state ?? "") ?? 0)
957
+ ) > 1 ? oe.get(D.to_state) ?? "" : null;
958
+ return /* @__PURE__ */ s(mt, { children: [
959
+ /* @__PURE__ */ n(ut, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
1002
960
  /* @__PURE__ */ s(
1003
961
  "span",
1004
962
  {
1005
963
  className: "text-center font-mono text-[9px] font-semibold leading-none",
1006
- style: { color: Q ? "#d97706" : "#475569" },
964
+ style: { color: z ? "#d97706" : "#475569" },
1007
965
  children: [
1008
- Q && "↩ ",
1009
- Z(D)
966
+ z && "↩ ",
967
+ J(D)
1010
968
  ]
1011
969
  }
1012
970
  ),
1013
- /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: /* @__PURE__ */ n(Bt, { value: D.timestamp }) })
971
+ /* @__PURE__ */ n("span", { className: "text-[8.5px] leading-none text-slate-400", children: /* @__PURE__ */ n(It, { value: D.timestamp }) })
1014
972
  ] }) }),
1015
- /* @__PURE__ */ s(ut, { side: "top", className: "space-y-0.5 text-[12px]", children: [
1016
- at(D) ? /* @__PURE__ */ s(Te, { children: [
973
+ /* @__PURE__ */ s(pt, { side: "top", className: "space-y-0.5 text-[12px]", children: [
974
+ st(D) ? /* @__PURE__ */ s(qe, { children: [
1017
975
  /* @__PURE__ */ s("p", { className: "font-medium", children: [
1018
- Q ? "↩ Sent back · " : "",
1019
- ht(D)
976
+ z ? "↩ Sent back · " : "",
977
+ bt(D)
1020
978
  ] }),
1021
- Ot(D) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: Ot(D) })
979
+ Et(D) && /* @__PURE__ */ n("p", { className: "max-w-[280px] text-muted-foreground", children: Et(D) })
1022
980
  ] }) : /* @__PURE__ */ s("p", { className: "font-medium", children: [
1023
- Q ? "↩ Sent back by" : "Approved by",
981
+ z ? "↩ Sent back by" : "Approved by",
1024
982
  " ",
1025
- I(D)
983
+ j(D)
1026
984
  ] }),
1027
- oe && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: [
985
+ le && /* @__PURE__ */ s("p", { className: "text-muted-foreground", children: [
1028
986
  "→ straight to ",
1029
- oe
987
+ le
1030
988
  ] }),
1031
- /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Ct(D.timestamp) })
989
+ /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Pt(D.timestamp) })
1032
990
  ] })
1033
991
  ] }, D.id);
1034
992
  }),
1035
- ce.length > 1 && /* @__PURE__ */ s(ct, { children: [
1036
- /* @__PURE__ */ n(mt, { asChild: !0, children: /* @__PURE__ */ s(
993
+ fe.length > 1 && /* @__PURE__ */ s(mt, { children: [
994
+ /* @__PURE__ */ n(ut, { asChild: !0, children: /* @__PURE__ */ s(
1037
995
  "button",
1038
996
  {
1039
997
  type: "button",
1040
- onClick: y,
1041
- "data-track-more-moves": ce.length - 1,
1042
- "aria-label": `${ce.length - 1} earlier ${ce.length - 1 === 1 ? "move" : "moves"} here — open the transition history`,
998
+ onClick: w,
999
+ "data-track-more-moves": fe.length - 1,
1000
+ "aria-label": `${fe.length - 1} earlier ${fe.length - 1 === 1 ? "move" : "moves"} here — open the transition history`,
1043
1001
  className: "rounded px-1 text-[9px] font-semibold leading-[14px] tabular-nums text-slate-500 hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-200",
1044
1002
  children: [
1045
1003
  "+",
1046
- ce.length - 1
1004
+ fe.length - 1
1047
1005
  ]
1048
1006
  }
1049
1007
  ) }),
1050
- /* @__PURE__ */ s(ut, { side: "bottom", className: "max-w-[260px] text-[12px]", children: [
1008
+ /* @__PURE__ */ s(pt, { side: "bottom", className: "max-w-[260px] text-[12px]", children: [
1051
1009
  /* @__PURE__ */ n("p", { className: "font-medium", children: "Earlier moves here" }),
1052
- /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5", children: ce.slice(0, -1).reverse().slice(0, 6).map((D) => /* @__PURE__ */ s("li", { className: "text-muted-foreground", children: [
1010
+ /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5", children: fe.slice(0, -1).reverse().slice(0, 6).map((D) => /* @__PURE__ */ s("li", { className: "text-muted-foreground", children: [
1053
1011
  D.from_state !== p.id ? "↩ " : "",
1054
- at(D) ? ht(D) : I(D),
1012
+ st(D) ? bt(D) : j(D),
1055
1013
  " ·",
1056
1014
  " ",
1057
- Ct(D.timestamp)
1015
+ Pt(D.timestamp)
1058
1016
  ] }, D.id)) }),
1059
- ce.length - 1 > 6 && /* @__PURE__ */ s("p", { className: "mt-1 text-muted-foreground", children: [
1017
+ fe.length - 1 > 6 && /* @__PURE__ */ s("p", { className: "mt-1 text-muted-foreground", children: [
1060
1018
  "and ",
1061
- ce.length - 7,
1019
+ fe.length - 7,
1062
1020
  " more"
1063
1021
  ] }),
1064
- y && /* @__PURE__ */ n("p", { className: "mt-1 text-muted-foreground", children: "Click for the full history." })
1022
+ w && /* @__PURE__ */ n("p", { className: "mt-1 text-muted-foreground", children: "Click for the full history." })
1065
1023
  ] })
1066
1024
  ] })
1067
1025
  ] })
@@ -1072,87 +1030,87 @@ function Ca({
1072
1030
  }
1073
1031
  ) });
1074
1032
  }
1075
- function $a({
1033
+ function Fa({
1076
1034
  history: e,
1077
1035
  collection: t,
1078
1036
  item: r,
1079
1037
  completedAt: a = null
1080
1038
  }) {
1081
- const i = Ln(
1039
+ const i = Un(
1082
1040
  t ?? "",
1083
1041
  r ?? "",
1084
- dr(e, a),
1042
+ cr(e, a),
1085
1043
  !!t && !!r && e.length > 0
1086
1044
  );
1087
- return e.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: e.map((m) => {
1088
- var N;
1089
- const v = at(m), b = v ? ht(m) : Lt([m.first_name, m.last_name].filter(Boolean).join(" ") || m.user_email, m), y = ma(m), T = m.comment && !v && !y ? m.comment : null, h = y ?? (v ? Ot(m) : null), P = (i == null ? void 0 : i.get(Number(m.id))) ?? null;
1045
+ return e.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ n("div", { className: "space-y-3", children: e.map((u) => {
1046
+ var _;
1047
+ const x = st(u), b = x ? bt(u) : jt([u.first_name, u.last_name].filter(Boolean).join(" ") || u.user_email, u), w = ya(u), M = u.comment && !x && !w ? u.comment : null, h = w ?? (x ? Et(u) : null), R = (i == null ? void 0 : i.get(Number(u.id))) ?? null;
1090
1048
  return /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
1091
1049
  /* @__PURE__ */ n("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
1092
1050
  /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
1093
1051
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
1094
- m.from_state_label ? /* @__PURE__ */ n(Ie, { label: m.from_state_label, color: m.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
1095
- /* @__PURE__ */ n(Et, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1096
- /* @__PURE__ */ n(Ie, { label: m.to_state_label, color: m.to_state_color, small: !0 })
1052
+ u.from_state_label ? /* @__PURE__ */ n(Ie, { label: u.from_state_label, color: u.from_state_color, small: !0 }) : /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
1053
+ /* @__PURE__ */ n(Ut, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1054
+ /* @__PURE__ */ n(Ie, { label: u.to_state_label, color: u.to_state_color, small: !0 })
1097
1055
  ] }),
1098
- T && /* @__PURE__ */ s("p", { className: "mt-1 text-slate-500 italic", children: [
1056
+ M && /* @__PURE__ */ s("p", { className: "mt-1 text-slate-500 italic", children: [
1099
1057
  '"',
1100
- T,
1058
+ M,
1101
1059
  '"'
1102
1060
  ] }),
1103
1061
  /* @__PURE__ */ s(
1104
1062
  "p",
1105
1063
  {
1106
1064
  className: "mt-0.5 text-slate-400",
1107
- "data-history-on-behalf": m.on_behalf_of_name ? m.on_behalf_of ?? "" : void 0,
1108
- "data-history-acting-admin": ((N = m.acting_admin) == null ? void 0 : N.id) || void 0,
1065
+ "data-history-on-behalf": u.on_behalf_of_name ? u.on_behalf_of ?? "" : void 0,
1066
+ "data-history-acting-admin": ((_ = u.acting_admin) == null ? void 0 : _.id) || void 0,
1109
1067
  children: [
1110
- v && /* @__PURE__ */ n(un, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
1068
+ x && /* @__PURE__ */ n(fn, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
1111
1069
  b,
1112
1070
  h ? ` · ${h}` : "",
1113
1071
  " · ",
1114
- /* @__PURE__ */ n(Bt, { value: m.timestamp })
1072
+ /* @__PURE__ */ n(It, { value: u.timestamp })
1115
1073
  ]
1116
1074
  }
1117
1075
  ),
1118
- P && /* @__PURE__ */ s(
1076
+ R && /* @__PURE__ */ s(
1119
1077
  "p",
1120
1078
  {
1121
1079
  className: "mt-0.5 flex items-center gap-1 text-[11px] text-slate-500 dark:text-slate-400",
1122
- "data-history-timing": m.id,
1123
- "data-tip": In(P) ?? void 0,
1080
+ "data-history-timing": u.id,
1081
+ "data-tip": jn(R) ?? void 0,
1124
1082
  children: [
1125
- /* @__PURE__ */ n(wr, { className: "h-3 w-3 shrink-0 text-slate-400", "aria-hidden": !0 }),
1083
+ /* @__PURE__ */ n(_r, { className: "h-3 w-3 shrink-0 text-slate-400", "aria-hidden": !0 }),
1126
1084
  "In ",
1127
- m.to_state_label,
1085
+ u.to_state_label,
1128
1086
  ": ",
1129
- Un(P)
1087
+ In(R)
1130
1088
  ]
1131
1089
  }
1132
1090
  )
1133
1091
  ] })
1134
- ] }, m.id);
1092
+ ] }, u.id);
1135
1093
  }) });
1136
1094
  }
1137
- function ln({
1095
+ function cn({
1138
1096
  userId: e,
1139
1097
  name: t,
1140
1098
  email: r,
1141
1099
  initials: a,
1142
1100
  className: i
1143
1101
  }) {
1144
- return /* @__PURE__ */ n(yn, { userId: e, children: /* @__PURE__ */ s(
1102
+ return /* @__PURE__ */ n(_n, { userId: e, children: /* @__PURE__ */ s(
1145
1103
  "button",
1146
1104
  {
1147
1105
  type: "button",
1148
1106
  "aria-label": `${t} — profile`,
1149
- className: ne(
1107
+ className: re(
1150
1108
  "group/owner flex min-w-0 flex-1 items-center gap-2.5 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
1151
1109
  i
1152
1110
  ),
1153
1111
  children: [
1154
1112
  /* @__PURE__ */ n(
1155
- jr,
1113
+ Hr,
1156
1114
  {
1157
1115
  userId: e,
1158
1116
  alt: t,
@@ -1168,222 +1126,222 @@ function ln({
1168
1126
  }
1169
1127
  ) });
1170
1128
  }
1171
- function Ta({
1129
+ function Da({
1172
1130
  collection: e,
1173
1131
  item: t,
1174
1132
  states: r,
1175
1133
  currentStateId: a,
1176
1134
  returned: i = !1,
1177
- standInReason: m = null
1135
+ standInReason: u = null
1178
1136
  }) {
1179
- var l, Ke, Ne, xe, qe;
1180
- const v = We(), b = Ze(), { isAdmin: y, userId: T } = hn(), [h, P] = J(!1), [N, _] = J(""), [S, q] = J(""), [V, B] = J(!1), re = ["pipeline-instance-owners", e, t], ie = ["pipeline-owners-can-add", e, t], de = () => v.request(
1181
- Fe(`/pipelines/instance/${e}/${t}/owners`)
1182
- ).then((c) => {
1183
- var j;
1184
- return b.setQueryData(ie, ((j = c.meta) == null ? void 0 : j.can_add) ?? null), c;
1185
- }), { data: Z, isLoading: I } = $e({
1186
- queryKey: re,
1187
- queryFn: () => de().then((c) => c.data)
1188
- }), { data: ge } = $e({
1189
- queryKey: ie,
1190
- queryFn: () => de().then((c) => {
1191
- var j;
1192
- return ((j = c.meta) == null ? void 0 : j.can_add) ?? null;
1137
+ var l, Qe, Ce, Ne, Oe;
1138
+ const x = Ke(), b = et(), { isAdmin: w, userId: M } = bn(), [h, R] = X(!1), [_, k] = X(""), [N, q] = X(""), [V, L] = X(!1), ae = ["pipeline-instance-owners", e, t], oe = ["pipeline-owners-can-add", e, t], pe = () => x.request(
1139
+ De(`/pipelines/instance/${e}/${t}/owners`)
1140
+ ).then((m) => {
1141
+ var W;
1142
+ return b.setQueryData(oe, ((W = m.meta) == null ? void 0 : W.can_add) ?? null), m;
1143
+ }), { data: J, isLoading: j } = Pe({
1144
+ queryKey: ae,
1145
+ queryFn: () => pe().then((m) => m.data)
1146
+ }), { data: ye } = Pe({
1147
+ queryKey: oe,
1148
+ queryFn: () => pe().then((m) => {
1149
+ var W;
1150
+ return ((W = m.meta) == null ? void 0 : W.can_add) ?? null;
1193
1151
  }),
1194
- enabled: !I,
1152
+ enabled: !j,
1195
1153
  staleTime: 3e4
1196
- }), _e = typeof ge == "boolean" ? ge : y, { data: G, isLoading: p } = $e({
1154
+ }), Se = typeof ye == "boolean" ? ye : w, { data: Y, isLoading: p } = Pe({
1197
1155
  queryKey: ["pipeline-all-owners", e, t],
1198
- queryFn: () => v.request(
1199
- Fe(`/pipelines/instance/${e}/${t}/owners/all`)
1200
- ).then((c) => c.data ?? null),
1156
+ queryFn: () => x.request(
1157
+ De(`/pipelines/instance/${e}/${t}/owners/all`)
1158
+ ).then((m) => m.data ?? null),
1201
1159
  enabled: !!a,
1202
1160
  staleTime: 3e4
1203
- }), $ = new Set((Z ?? []).map((c) => c.user)), w = a ? (((l = G == null ? void 0 : G[a]) == null ? void 0 : l.owners) ?? []).filter((c) => !$.has(c.id)) : [], g = new Map(
1204
- (a ? ((Ke = G == null ? void 0 : G[a]) == null ? void 0 : Ke.unavailable) ?? [] : []).map((c) => [
1205
- String(c.id).toUpperCase(),
1206
- c
1161
+ }), $ = new Set((J ?? []).map((m) => m.user)), v = a ? (((l = Y == null ? void 0 : Y[a]) == null ? void 0 : l.owners) ?? []).filter((m) => !$.has(m.id)) : [], g = new Map(
1162
+ (a ? ((Qe = Y == null ? void 0 : Y[a]) == null ? void 0 : Qe.unavailable) ?? [] : []).map((m) => [
1163
+ String(m.id).toUpperCase(),
1164
+ m
1207
1165
  ])
1208
- ), C = w.length + ((Z == null ? void 0 : Z.length) ?? 0), K = !!((Ne = r.find((c) => c.id === a)) != null && Ne.is_initial), be = !I && !p, { data: o } = $e({
1166
+ ), C = v.length + ((J == null ? void 0 : J.length) ?? 0), Q = !!((Ce = r.find((m) => m.id === a)) != null && Ce.is_initial), ke = !j && !p, { data: o } = Pe({
1209
1167
  queryKey: ["pipeline-record-creator", e, t],
1210
- queryFn: () => v.request(
1211
- Fe(`/pipelines/instance/${e}/${t}/creator`)
1212
- ).then((c) => c.data ?? null),
1213
- enabled: K && be && C === 0,
1168
+ queryFn: () => x.request(
1169
+ De(`/pipelines/instance/${e}/${t}/creator`)
1170
+ ).then((m) => m.data ?? null),
1171
+ enabled: Q && ke && C === 0,
1214
1172
  staleTime: 6e4
1215
- }), R = K && C === 0 && (o != null && o.name) ? o : null, L = r.find((c) => c.id === a), Me = (Z ?? []).some(
1216
- (c) => !c.state || c.state === a || c.state === (L == null ? void 0 : L.key)
1217
- ), te = !!L && w.length > 0 && w.every((c) => c.queue_only) && !Me, Ce = m && m.state.id.toUpperCase() === String(a).toUpperCase() ? m : null, ce = da(Ce), D = !!T && [
1218
- ...a ? (((xe = G == null ? void 0 : G[a]) == null ? void 0 : xe.owners) ?? []).map((c) => c.id) : [],
1219
- ...(Z ?? []).filter((c) => !c.state || c.state === a || c.state === (L == null ? void 0 : L.key)).map((c) => c.user)
1220
- ].some((c) => String(c).toUpperCase() === T.toUpperCase()), Q = !!a && be && C > 0 && !R && !(L != null && L.is_terminal) && !D, oe = () => {
1221
- b.invalidateQueries({ queryKey: re }), b.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1222
- }, me = Je({
1223
- mutationFn: () => v.request(
1224
- st(`/pipelines/instance/${e}/${t}/owners`, {
1225
- user: N,
1226
- state: S || void 0
1173
+ }), O = Q && C === 0 && (o != null && o.name) ? o : null, U = r.find((m) => m.id === a), Re = (J ?? []).some(
1174
+ (m) => !m.state || m.state === a || m.state === (U == null ? void 0 : U.key)
1175
+ ), ne = !!U && v.length > 0 && v.every((m) => m.queue_only) && !Re, Te = u && u.state.id.toUpperCase() === String(a).toUpperCase() ? u : null, fe = va(Te), D = !!M && [
1176
+ ...a ? (((Ne = Y == null ? void 0 : Y[a]) == null ? void 0 : Ne.owners) ?? []).map((m) => m.id) : [],
1177
+ ...(J ?? []).filter((m) => !m.state || m.state === a || m.state === (U == null ? void 0 : U.key)).map((m) => m.user)
1178
+ ].some((m) => String(m).toUpperCase() === M.toUpperCase()), z = !!a && ke && C > 0 && !O && !(U != null && U.is_terminal) && !D, le = () => {
1179
+ b.invalidateQueries({ queryKey: ae }), b.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1180
+ }, be = Ze({
1181
+ mutationFn: () => x.request(
1182
+ it(`/pipelines/instance/${e}/${t}/owners`, {
1183
+ user: _,
1184
+ state: N || void 0
1227
1185
  })
1228
1186
  ),
1229
1187
  onSuccess: () => {
1230
- oe(), _(""), q(""), P(!1), ee.success("Owner added");
1188
+ le(), k(""), q(""), R(!1), ee.success("Owner added");
1231
1189
  },
1232
1190
  // The server's reason (a 403 says why), not a bare status phrase.
1233
- onError: (c) => ee.error(je(c, "Failed to add owner"))
1234
- }), z = Je({
1235
- mutationFn: (c) => v.request(Nr(`/pipelines/instance-owners/${c.id}`)),
1236
- onSuccess: (c, j) => {
1237
- oe();
1238
- const le = [j.first_name, j.last_name].filter(Boolean).join(" ") || j.email;
1239
- ee.success(`${le} removed as an owner`, {
1191
+ onError: (m) => ee.error(We(m, "Failed to add owner"))
1192
+ }), H = Ze({
1193
+ mutationFn: (m) => x.request($r(`/pipelines/instance-owners/${m.id}`)),
1194
+ onSuccess: (m, W) => {
1195
+ le();
1196
+ const de = [W.first_name, W.last_name].filter(Boolean).join(" ") || W.email;
1197
+ ee.success(`${de} removed as an owner`, {
1240
1198
  action: {
1241
1199
  label: "Undo",
1242
- onClick: () => void v.request(
1243
- st(`/pipelines/instance/${e}/${t}/owners`, {
1244
- user: j.user,
1245
- state: j.state || void 0
1200
+ onClick: () => void x.request(
1201
+ it(`/pipelines/instance/${e}/${t}/owners`, {
1202
+ user: W.user,
1203
+ state: W.state || void 0
1246
1204
  })
1247
- ).then(() => oe()).catch((X) => ee.error(je(X, "Could not add the owner back")))
1205
+ ).then(() => le()).catch((G) => ee.error(We(G, "Could not add the owner back")))
1248
1206
  }
1249
1207
  });
1250
1208
  },
1251
- onError: (c) => ee.error(je(c, "Failed to remove owner"))
1252
- }), ke = (c) => {
1253
- var X, d;
1254
- const j = ((X = c.first_name) == null ? void 0 : X[0]) ?? "", le = ((d = c.last_name) == null ? void 0 : d[0]) ?? "";
1255
- return (`${j}${le}`.trim() || c.email[0] || "?").toUpperCase();
1256
- }, ue = (c) => {
1257
- var j;
1258
- return c ? ((j = r.find((le) => le.id === c || le.key === c)) == null ? void 0 : j.label) ?? c : null;
1209
+ onError: (m) => ee.error(We(m, "Failed to remove owner"))
1210
+ }), _e = (m) => {
1211
+ var G, d;
1212
+ const W = ((G = m.first_name) == null ? void 0 : G[0]) ?? "", de = ((d = m.last_name) == null ? void 0 : d[0]) ?? "";
1213
+ return (`${W}${de}`.trim() || m.email[0] || "?").toUpperCase();
1214
+ }, xe = (m) => {
1215
+ var W;
1216
+ return m ? ((W = r.find((de) => de.id === m || de.key === m)) == null ? void 0 : W.label) ?? m : null;
1259
1217
  };
1260
1218
  return /* @__PURE__ */ s("div", { children: [
1261
1219
  /* @__PURE__ */ s("div", { className: "mb-3 flex items-center justify-between", children: [
1262
1220
  /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
1263
- /* @__PURE__ */ n(mn, { className: "h-3.5 w-3.5" }),
1221
+ /* @__PURE__ */ n(pn, { className: "h-3.5 w-3.5" }),
1264
1222
  "Owners",
1265
- I || p ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : R ? null : /* @__PURE__ */ s("span", { className: "text-slate-300", children: [
1223
+ j || p ? /* @__PURE__ */ n("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : O ? null : /* @__PURE__ */ s("span", { className: "text-slate-300", children: [
1266
1224
  "(",
1267
1225
  C,
1268
1226
  ")"
1269
1227
  ] })
1270
1228
  ] }),
1271
1229
  /* @__PURE__ */ s("span", { className: "flex items-center gap-3", children: [
1272
- a && /* @__PURE__ */ n(Kr, { collection: e, itemId: String(t) }),
1273
- !h && _e && /* @__PURE__ */ s(
1230
+ a && /* @__PURE__ */ n(Gr, { collection: e, itemId: String(t) }),
1231
+ !h && Se && /* @__PURE__ */ s(
1274
1232
  "button",
1275
1233
  {
1276
1234
  type: "button",
1277
- onClick: () => P(!0),
1235
+ onClick: () => R(!0),
1278
1236
  className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
1279
1237
  children: [
1280
- /* @__PURE__ */ n(xr, { className: "h-3 w-3" }),
1238
+ /* @__PURE__ */ n(yr, { className: "h-3 w-3" }),
1281
1239
  "Add"
1282
1240
  ]
1283
1241
  }
1284
1242
  )
1285
1243
  ] })
1286
1244
  ] }),
1287
- I || p ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1288
- /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 animate-spin" }),
1245
+ j || p ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
1246
+ /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 animate-spin" }),
1289
1247
  "Resolving owners…"
1290
- ] }) : R ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1248
+ ] }) : O ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
1291
1249
  i ? "Back with" : "With",
1292
1250
  " ",
1293
- /* @__PURE__ */ n(yn, { userId: R.id, children: /* @__PURE__ */ n(
1251
+ /* @__PURE__ */ n(_n, { userId: O.id, children: /* @__PURE__ */ n(
1294
1252
  "button",
1295
1253
  {
1296
1254
  type: "button",
1297
- "aria-label": `${R.name} — profile`,
1255
+ "aria-label": `${O.name} — profile`,
1298
1256
  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",
1299
- children: R.name
1257
+ children: O.name
1300
1258
  }
1301
1259
  ) }),
1302
1260
  /* @__PURE__ */ n(
1303
- $t,
1261
+ qt,
1304
1262
  {
1305
- person: { id: String(R.id), name: R.name ?? "" },
1263
+ person: { id: String(O.id), name: O.name ?? "" },
1306
1264
  className: "ml-1 inline-flex align-middle"
1307
1265
  }
1308
1266
  )
1309
1267
  ] }) : C === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ s("div", { className: "space-y-px", children: [
1310
- w.map((c) => {
1311
- var X, d;
1312
- const j = [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email, le = (`${((X = c.first_name) == null ? void 0 : X[0]) ?? ""}${((d = c.last_name) == null ? void 0 : d[0]) ?? ""}`.trim() || c.email[0] || "?").toUpperCase();
1268
+ v.map((m) => {
1269
+ var G, d;
1270
+ const W = [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email, de = (`${((G = m.first_name) == null ? void 0 : G[0]) ?? ""}${((d = m.last_name) == null ? void 0 : d[0]) ?? ""}`.trim() || m.email[0] || "?").toUpperCase();
1313
1271
  return /* @__PURE__ */ s(
1314
1272
  "div",
1315
1273
  {
1316
1274
  className: "group/row -mx-2 flex flex-wrap items-center gap-x-2.5 gap-y-1 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1317
1275
  children: [
1318
1276
  /* @__PURE__ */ n(
1319
- ln,
1277
+ cn,
1320
1278
  {
1321
- userId: c.id,
1322
- name: j,
1323
- email: c.email,
1324
- initials: le,
1279
+ userId: m.id,
1280
+ name: W,
1281
+ email: m.email,
1282
+ initials: de,
1325
1283
  className: "basis-[60%]"
1326
1284
  }
1327
1285
  ),
1328
1286
  /* @__PURE__ */ n(
1329
- $t,
1287
+ qt,
1330
1288
  {
1331
- person: { id: String(c.id), name: j, firstName: c.first_name },
1289
+ person: { id: String(m.id), name: W, firstName: m.first_name },
1332
1290
  className: "opacity-0 focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100"
1333
1291
  }
1334
1292
  ),
1335
1293
  /* @__PURE__ */ s("span", { className: "ml-auto flex min-w-0 max-w-full flex-wrap items-center justify-end gap-1", children: [
1336
1294
  (() => {
1337
- const f = g.get(String(c.id).toUpperCase());
1295
+ const f = g.get(String(m.id).toUpperCase());
1338
1296
  return f ? /* @__PURE__ */ n(
1339
1297
  "span",
1340
1298
  {
1341
1299
  "data-owner-unavailable": f.reason,
1342
- className: ne(
1300
+ className: re(
1343
1301
  "shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",
1344
1302
  f.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"
1345
1303
  ),
1346
- "data-tip": f.delegate ? `${j} is ${Ve[f.reason] ?? f.reason} — ${f.delegate.name} covers` : `${j} is ${Ve[f.reason] ?? f.reason} and can't approve this step`,
1347
- children: f.delegate ? `${Ve[f.reason] ?? f.reason} · ${f.delegate.name} covers` : Ve[f.reason] ?? f.reason
1304
+ "data-tip": f.delegate ? `${W} is ${Ge[f.reason] ?? f.reason} — ${f.delegate.name} covers` : `${W} is ${Ge[f.reason] ?? f.reason} and can't approve this step`,
1305
+ children: f.delegate ? `${Ge[f.reason] ?? f.reason} · ${f.delegate.name} covers` : Ge[f.reason] ?? f.reason
1348
1306
  }
1349
1307
  ) : null;
1350
1308
  })(),
1351
- c.queue_only ? /* @__PURE__ */ n(
1309
+ m.queue_only ? /* @__PURE__ */ n(
1352
1310
  "span",
1353
1311
  {
1354
1312
  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",
1355
1313
  "data-tip": "The record is in their queue, but only the step’s owners can move it",
1356
- children: te && ce.has(String(c.id).toUpperCase()) ? "stand-in" : "in their queue"
1314
+ children: ne && fe.has(String(m.id).toUpperCase()) ? "stand-in" : "in their queue"
1357
1315
  }
1358
1316
  ) : /* @__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" })
1359
1317
  ] })
1360
1318
  ]
1361
1319
  },
1362
- `group-${c.id}`
1320
+ `group-${m.id}`
1363
1321
  );
1364
1322
  }),
1365
- (Z ?? []).map((c) => /* @__PURE__ */ s(
1323
+ (J ?? []).map((m) => /* @__PURE__ */ s(
1366
1324
  "div",
1367
1325
  {
1368
1326
  className: "group -mx-2 flex flex-wrap items-center gap-x-2.5 gap-y-1 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
1369
1327
  children: [
1370
1328
  /* @__PURE__ */ n(
1371
- ln,
1329
+ cn,
1372
1330
  {
1373
- userId: c.user,
1374
- name: [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email,
1375
- email: c.email,
1376
- initials: ke(c),
1331
+ userId: m.user,
1332
+ name: [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email,
1333
+ email: m.email,
1334
+ initials: _e(m),
1377
1335
  className: "basis-[60%]"
1378
1336
  }
1379
1337
  ),
1380
1338
  /* @__PURE__ */ n(
1381
- $t,
1339
+ qt,
1382
1340
  {
1383
1341
  person: {
1384
- id: String(c.user),
1385
- name: [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email,
1386
- firstName: c.first_name
1342
+ id: String(m.user),
1343
+ name: [m.first_name, m.last_name].filter(Boolean).join(" ") || m.email,
1344
+ firstName: m.first_name
1387
1345
  },
1388
1346
  className: "opacity-0 focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100"
1389
1347
  }
@@ -1392,25 +1350,25 @@ function Ta({
1392
1350
  "button",
1393
1351
  {
1394
1352
  type: "button",
1395
- "aria-label": `Remove ${[c.first_name, c.last_name].filter(Boolean).join(" ") || c.email} as an owner`,
1396
- disabled: z.isPending,
1397
- onClick: () => z.mutate(c),
1353
+ "aria-label": `Remove ${[m.first_name, m.last_name].filter(Boolean).join(" ") || m.email} as an owner`,
1354
+ disabled: H.isPending,
1355
+ onClick: () => H.mutate(m),
1398
1356
  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",
1399
- children: /* @__PURE__ */ n(vr, { className: "h-3 w-3" })
1357
+ children: /* @__PURE__ */ n(kr, { className: "h-3 w-3" })
1400
1358
  }
1401
1359
  ),
1402
1360
  /* @__PURE__ */ s("span", { className: "ml-auto flex min-w-0 max-w-full flex-wrap items-center justify-end gap-1", children: [
1403
1361
  /* @__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" }),
1404
- /* @__PURE__ */ n("span", { className: "min-w-0 max-w-full truncate rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500 dark:bg-slate-800 dark:text-slate-400", children: c.state ? ue(c.state) : "all states" })
1362
+ /* @__PURE__ */ n("span", { className: "min-w-0 max-w-full truncate rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500 dark:bg-slate-800 dark:text-slate-400", children: m.state ? xe(m.state) : "all states" })
1405
1363
  ] })
1406
1364
  ]
1407
1365
  },
1408
- c.id
1366
+ m.id
1409
1367
  ))
1410
1368
  ] }),
1411
- te && !I && !p && (Ce ? (
1369
+ ne && !j && !p && (Te ? (
1412
1370
  // Why nobody is assigned + why this person stands in (Rob 2026-11-14).
1413
- /* @__PURE__ */ n(ca, { reason: Ce, className: "mt-2" })
1371
+ /* @__PURE__ */ n(wa, { reason: Te, className: "mt-2" })
1414
1372
  ) : /* @__PURE__ */ s(
1415
1373
  "p",
1416
1374
  {
@@ -1418,13 +1376,13 @@ function Ta({
1418
1376
  className: "mt-1.5 text-[11px] leading-snug text-slate-500 dark:text-slate-400",
1419
1377
  children: [
1420
1378
  "Shown as a stand-in — no one is assigned to ",
1421
- L == null ? void 0 : L.label,
1379
+ U == null ? void 0 : U.label,
1422
1380
  "."
1423
1381
  ]
1424
1382
  }
1425
1383
  )),
1426
- Q && a && /* @__PURE__ */ n(
1427
- na,
1384
+ z && a && /* @__PURE__ */ n(
1385
+ da,
1428
1386
  {
1429
1387
  collection: e,
1430
1388
  item: String(t),
@@ -1434,78 +1392,78 @@ function Ta({
1434
1392
  ),
1435
1393
  h && /* @__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: [
1436
1394
  /* @__PURE__ */ n("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
1437
- /* @__PURE__ */ n(Qr, { value: N, onChange: _ }),
1438
- y ? /* @__PURE__ */ s(kn, { open: V, onOpenChange: B, children: [
1439
- /* @__PURE__ */ n(_n, { asChild: !0, children: /* @__PURE__ */ s(
1395
+ /* @__PURE__ */ n(Yr, { value: _, onChange: k }),
1396
+ w ? /* @__PURE__ */ s(Nn, { open: V, onOpenChange: L, children: [
1397
+ /* @__PURE__ */ n(Sn, { asChild: !0, children: /* @__PURE__ */ s(
1440
1398
  "button",
1441
1399
  {
1442
1400
  type: "button",
1443
1401
  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",
1444
1402
  children: [
1445
- /* @__PURE__ */ n("span", { className: "truncate", children: S ? ((qe = r.find((c) => c.id === S)) == null ? void 0 : qe.label) ?? S : "All states" }),
1446
- /* @__PURE__ */ n(Ge, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1403
+ /* @__PURE__ */ n("span", { className: "truncate", children: N ? ((Oe = r.find((m) => m.id === N)) == null ? void 0 : Oe.label) ?? N : "All states" }),
1404
+ /* @__PURE__ */ n(Ye, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
1447
1405
  ]
1448
1406
  }
1449
1407
  ) }),
1450
- /* @__PURE__ */ n(Nn, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((c) => c.id)].map((c) => {
1451
- var X;
1452
- const j = c === "" ? "All states" : ((X = r.find((d) => d.id === c)) == null ? void 0 : X.label) ?? c;
1408
+ /* @__PURE__ */ n(Cn, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...r.map((m) => m.id)].map((m) => {
1409
+ var G;
1410
+ const W = m === "" ? "All states" : ((G = r.find((d) => d.id === m)) == null ? void 0 : G.label) ?? m;
1453
1411
  return /* @__PURE__ */ n(
1454
1412
  "button",
1455
1413
  {
1456
1414
  type: "button",
1457
- className: ne(
1415
+ className: re(
1458
1416
  "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",
1459
- S === c && "font-medium text-slate-800 dark:text-slate-200"
1417
+ N === m && "font-medium text-slate-800 dark:text-slate-200"
1460
1418
  ),
1461
1419
  onClick: () => {
1462
- q(c), B(!1);
1420
+ q(m), L(!1);
1463
1421
  },
1464
- children: j
1422
+ children: W
1465
1423
  },
1466
- c
1424
+ m
1467
1425
  );
1468
1426
  }) })
1469
1427
  ] }) : /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
1470
1428
  /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2 pt-0.5", children: [
1471
1429
  /* @__PURE__ */ n(
1472
- fe,
1430
+ ve,
1473
1431
  {
1474
1432
  type: "button",
1475
1433
  size: "sm",
1476
1434
  variant: "ghost",
1477
1435
  className: "h-7 text-[12px]",
1478
1436
  onClick: () => {
1479
- P(!1), _(""), q("");
1437
+ R(!1), k(""), q("");
1480
1438
  },
1481
1439
  children: "Cancel"
1482
1440
  }
1483
1441
  ),
1484
1442
  /* @__PURE__ */ n(
1485
- fe,
1443
+ ve,
1486
1444
  {
1487
1445
  type: "button",
1488
1446
  size: "sm",
1489
1447
  className: "h-7 text-[12px]",
1490
- disabled: !N || me.isPending,
1491
- onClick: () => me.mutate(),
1492
- children: me.isPending ? /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1448
+ disabled: !_ || be.isPending,
1449
+ onClick: () => be.mutate(),
1450
+ children: be.isPending ? /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 animate-spin" }) : "Add"
1493
1451
  }
1494
1452
  )
1495
1453
  ] })
1496
1454
  ] })
1497
1455
  ] });
1498
1456
  }
1499
- function cr(e, t, r, a) {
1457
+ function mr(e, t, r, a) {
1500
1458
  if (!e || !(r != null && r.length)) return null;
1501
- const m = new Map(r.map((y) => [String(y.id).toUpperCase(), y])).get(String(e.to_state).toUpperCase()), v = Number(t == null ? void 0 : t.sort);
1502
- if (!m || !Number.isFinite(v) || !(Number(m.sort) > v)) return null;
1503
- const b = Xr(String(e.to_state), r, a);
1459
+ const u = new Map(r.map((w) => [String(w.id).toUpperCase(), w])).get(String(e.to_state).toUpperCase()), x = Number(t == null ? void 0 : t.sort);
1460
+ if (!u || !Number.isFinite(x) || !(Number(u.sort) > x)) return null;
1461
+ const b = ra(String(e.to_state), r, a);
1504
1462
  return b && b.skipped.length > 0 ? b : null;
1505
1463
  }
1506
- function mr({ landing: e }) {
1464
+ function ur({ landing: e }) {
1507
1465
  if (!e || e.skipped.length === 0) return null;
1508
- const t = Yr(e);
1466
+ const t = aa(e);
1509
1467
  if (t.length === 1) {
1510
1468
  const r = t[0];
1511
1469
  return /* @__PURE__ */ s(
@@ -1518,7 +1476,7 @@ function mr({ landing: e }) {
1518
1476
  /* @__PURE__ */ n("span", { className: "font-medium", children: e.state.label }),
1519
1477
  " —",
1520
1478
  " ",
1521
- en(r.labels),
1479
+ rn(r.labels),
1522
1480
  " ",
1523
1481
  r.labels.length === 1 ? "is" : "are",
1524
1482
  " skipped",
@@ -1540,53 +1498,53 @@ function mr({ landing: e }) {
1540
1498
  ". Skipped on the way:"
1541
1499
  ] }),
1542
1500
  /* @__PURE__ */ n("ul", { className: "mt-0.5 list-disc space-y-0.5 pl-4", children: t.map((r) => /* @__PURE__ */ s("li", { children: [
1543
- /* @__PURE__ */ n("span", { className: "font-medium", children: en(r.labels) }),
1501
+ /* @__PURE__ */ n("span", { className: "font-medium", children: rn(r.labels) }),
1544
1502
  r.reason ? ` — ${r.reason}` : ""
1545
1503
  ] }, r.labels.join("|"))) })
1546
1504
  ]
1547
1505
  }
1548
1506
  );
1549
1507
  }
1550
- const Ve = {
1508
+ const Ge = {
1551
1509
  out: "out of office",
1552
1510
  suspended: "suspended",
1553
1511
  redacted: "redacted"
1554
1512
  };
1555
- function Ma({
1513
+ function Ba({
1556
1514
  collection: e,
1557
1515
  item: t,
1558
1516
  states: r,
1559
1517
  currentStateId: a,
1560
1518
  history: i
1561
1519
  }) {
1562
- const m = We(), v = Ze(), [b, y] = J(!1), T = he(a);
1520
+ const u = Ke(), x = et(), [b, w] = X(!1), M = we(a);
1563
1521
  Ee(() => {
1564
- T.current !== a && (T.current = a, v.invalidateQueries({ queryKey: ["pipeline-all-owners", e, t] }));
1565
- }, [a, e, t, v]);
1566
- const { data: h, isLoading: P, dataUpdatedAt: N } = $e({
1522
+ M.current !== a && (M.current = a, x.invalidateQueries({ queryKey: ["pipeline-all-owners", e, t] }));
1523
+ }, [a, e, t, x]);
1524
+ const { data: h, isLoading: R, dataUpdatedAt: _ } = Pe({
1567
1525
  queryKey: ["pipeline-all-owners", e, t],
1568
- queryFn: () => m.request(
1569
- Fe(`/pipelines/instance/${e}/${t}/owners/all`)
1526
+ queryFn: () => u.request(
1527
+ De(`/pipelines/instance/${e}/${t}/owners/all`)
1570
1528
  ).then((q) => q.data ?? null),
1571
1529
  enabled: b,
1572
1530
  staleTime: 3e4
1573
- }), _ = [...r].filter((q) => {
1531
+ }), k = [...r].filter((q) => {
1574
1532
  var V;
1575
1533
  return !h || ((V = h[q.id]) == null ? void 0 : V.on_path) !== !1;
1576
- }).sort((q, V) => q.sort - V.sort), S = $r(`${a ?? ""}:${(i == null ? void 0 : i.length) ?? 0}:${N}`);
1577
- return /* @__PURE__ */ s(kn, { open: b, onOpenChange: y, children: [
1578
- /* @__PURE__ */ n(_n, { asChild: !0, children: /* @__PURE__ */ n(
1534
+ }).sort((q, V) => q.sort - V.sort), N = Pr(`${a ?? ""}:${(i == null ? void 0 : i.length) ?? 0}:${_}`);
1535
+ return /* @__PURE__ */ s(Nn, { open: b, onOpenChange: w, children: [
1536
+ /* @__PURE__ */ n(Sn, { asChild: !0, children: /* @__PURE__ */ n(
1579
1537
  "button",
1580
1538
  {
1581
1539
  type: "button",
1582
1540
  title: "View approval chain",
1583
1541
  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",
1584
1542
  onClick: (q) => q.stopPropagation(),
1585
- children: /* @__PURE__ */ n(mn, { className: "h-3.5 w-3.5" })
1543
+ children: /* @__PURE__ */ n(pn, { className: "h-3.5 w-3.5" })
1586
1544
  }
1587
1545
  ) }),
1588
1546
  /* @__PURE__ */ s(
1589
- Nn,
1547
+ Cn,
1590
1548
  {
1591
1549
  align: "end",
1592
1550
  sideOffset: 6,
@@ -1597,36 +1555,36 @@ function Ma({
1597
1555
  /* @__PURE__ */ n("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-100", children: "Approval Chain" }),
1598
1556
  /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500 mt-0.5 dark:text-slate-400", children: "Owners per pipeline state" })
1599
1557
  ] }),
1600
- /* @__PURE__ */ n("div", { className: "max-h-[min(504px,calc(var(--radix-popover-content-available-height,504px)-64px))] overflow-y-auto overscroll-contain", children: P ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((q) => /* @__PURE__ */ n(Ue, { className: "h-10 w-full" }, q)) }) : h ? /* @__PURE__ */ n("div", { ref: S, className: "divide-y divide-slate-100 dark:divide-border/60", children: _.map((q) => {
1601
- var ge, _e, G, p, $, w;
1602
- const V = (((ge = h[q.id]) == null ? void 0 : ge.owners) ?? []).map((g) => ({
1558
+ /* @__PURE__ */ n("div", { className: "max-h-[min(504px,calc(var(--radix-popover-content-available-height,504px)-64px))] overflow-y-auto overscroll-contain", children: R ? /* @__PURE__ */ n("div", { className: "space-y-px p-3", children: [1, 2, 3].map((q) => /* @__PURE__ */ n(Ue, { className: "h-10 w-full" }, q)) }) : h ? /* @__PURE__ */ n("div", { ref: N, className: "divide-y divide-slate-100 dark:divide-border/60", children: k.map((q) => {
1559
+ var ye, Se, Y, p, $, v;
1560
+ const V = (((ye = h[q.id]) == null ? void 0 : ye.owners) ?? []).map((g) => ({
1603
1561
  id: g.id,
1604
1562
  name: [g.first_name, g.last_name].filter(Boolean).join(" ") || g.email
1605
- })), B = _r({
1563
+ })), L = Cr({
1606
1564
  stateId: q.id,
1607
1565
  currentStateId: a,
1608
1566
  history: i ?? [],
1609
1567
  // Only people who can act on the step (a queue-only name cannot approve).
1610
- owners: (((_e = h[q.id]) == null ? void 0 : _e.owners) ?? []).filter((g) => !g.queue_only).map((g) => [g.first_name, g.last_name].filter(Boolean).join(" ") || g.email)
1611
- }), re = q.id === a, ie = ((G = h[q.id]) == null ? void 0 : G.skipped) === !0 && !re, de = (((p = h[q.id]) == null ? void 0 : p.skip_reasons) ?? []).filter(Boolean), Z = (($ = h[q.id]) == null ? void 0 : $.unavailable) ?? [], I = ((w = h[q.id]) == null ? void 0 : w.blocked) === !0 && !ie;
1568
+ owners: (((Se = h[q.id]) == null ? void 0 : Se.owners) ?? []).filter((g) => !g.queue_only).map((g) => [g.first_name, g.last_name].filter(Boolean).join(" ") || g.email)
1569
+ }), ae = q.id === a, oe = ((Y = h[q.id]) == null ? void 0 : Y.skipped) === !0 && !ae, pe = (((p = h[q.id]) == null ? void 0 : p.skip_reasons) ?? []).filter(Boolean), J = (($ = h[q.id]) == null ? void 0 : $.unavailable) ?? [], j = ((v = h[q.id]) == null ? void 0 : v.blocked) === !0 && !oe;
1612
1570
  return /* @__PURE__ */ s(
1613
1571
  "div",
1614
1572
  {
1615
- className: ne(
1573
+ className: re(
1616
1574
  "flex items-center gap-3 px-4 py-2.5",
1617
1575
  // Hex-with-alpha rather than bg-nvr-cyan/N — the
1618
1576
  // nvr-cyan token is an opaque var() so Tailwind silently
1619
1577
  // drops opacity modifiers on it. Kept very light so the
1620
1578
  // tint doesn't clash with the state badge's own color.
1621
- re && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1622
- ie && "opacity-60",
1623
- I && "bg-red-50 dark:bg-red-500/10"
1579
+ ae && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
1580
+ oe && "opacity-60",
1581
+ j && "bg-red-50 dark:bg-red-500/10"
1624
1582
  ),
1625
- "data-chain-blocked": I ? "" : void 0,
1626
- "data-chain-step": B == null ? void 0 : B.kind,
1583
+ "data-chain-blocked": j ? "" : void 0,
1584
+ "data-chain-step": L == null ? void 0 : L.kind,
1627
1585
  children: [
1628
- /* @__PURE__ */ n("span", { className: "flex w-3.5 shrink-0 justify-center", children: (B == null ? void 0 : B.kind) === "done" && /* @__PURE__ */ n(
1629
- vt,
1586
+ /* @__PURE__ */ n("span", { className: "flex w-3.5 shrink-0 justify-center", children: (L == null ? void 0 : L.kind) === "done" && /* @__PURE__ */ n(
1587
+ yt,
1630
1588
  {
1631
1589
  "aria-label": "Done",
1632
1590
  className: "h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400",
@@ -1635,55 +1593,55 @@ function Ma({
1635
1593
  ) }),
1636
1594
  /* @__PURE__ */ s("div", { className: "flex min-w-0 shrink-0 flex-col items-start gap-0.5", children: [
1637
1595
  /* @__PURE__ */ n(Ie, { label: q.label, color: q.color, small: !0 }),
1638
- B && !ie && /* @__PURE__ */ n(
1596
+ L && !oe && /* @__PURE__ */ n(
1639
1597
  "span",
1640
1598
  {
1641
1599
  "data-chain-step-progress": !0,
1642
- className: ne(
1600
+ className: re(
1643
1601
  "text-[11px] leading-snug",
1644
1602
  // A step with no owners gives its note the owners' room.
1645
1603
  V.length === 0 ? "max-w-[340px]" : "max-w-[220px]",
1646
- B.kind === "waiting" ? "text-sky-700 dark:text-sky-300" : "text-slate-500 dark:text-slate-400"
1604
+ L.kind === "waiting" ? "text-sky-700 dark:text-sky-300" : "text-slate-500 dark:text-slate-400"
1647
1605
  ),
1648
- children: B.text.replace(/ (AM|PM)\b/g, " $1")
1606
+ children: L.text.replace(/ (AM|PM)\b/g, " $1")
1649
1607
  }
1650
1608
  )
1651
1609
  ] }),
1652
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: ie ? (
1610
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5", children: oe ? (
1653
1611
  // Radix tooltip with zero delay — native `title` waits on
1654
1612
  // the OS hover timer, and a truncated reason needs its
1655
1613
  // full text the moment the cursor lands on it.
1656
- /* @__PURE__ */ n(Sn, { delayDuration: 0, children: /* @__PURE__ */ s(ct, { children: [
1657
- /* @__PURE__ */ n(mt, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1614
+ /* @__PURE__ */ n($n, { delayDuration: 0, children: /* @__PURE__ */ s(mt, { children: [
1615
+ /* @__PURE__ */ n(ut, { asChild: !0, children: /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
1658
1616
  /* @__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" }),
1659
- de.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: de.join(" · ") })
1617
+ pe.length > 0 && /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: pe.join(" · ") })
1660
1618
  ] }) }),
1661
1619
  /* @__PURE__ */ s(
1662
- ut,
1620
+ pt,
1663
1621
  {
1664
1622
  side: "bottom",
1665
1623
  align: "start",
1666
1624
  className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
1667
1625
  children: [
1668
1626
  /* @__PURE__ */ n("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
1669
- de.length > 0 ? de.map((g) => /* @__PURE__ */ n("p", { children: g }, g)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1627
+ pe.length > 0 ? pe.map((g) => /* @__PURE__ */ n("p", { children: g }, g)) : /* @__PURE__ */ n("p", { children: "Skip criteria currently match" })
1670
1628
  ]
1671
1629
  }
1672
1630
  )
1673
1631
  ] }) })
1674
- ) : /* @__PURE__ */ s(Te, { children: [
1675
- /* @__PURE__ */ n(Ir, { owners: V, max: 10, emptyLabel: "—" }),
1676
- Z.map((g) => /* @__PURE__ */ s(
1632
+ ) : /* @__PURE__ */ s(qe, { children: [
1633
+ /* @__PURE__ */ n(zr, { owners: V, max: 10, emptyLabel: "—" }),
1634
+ J.map((g) => /* @__PURE__ */ s(
1677
1635
  "span",
1678
1636
  {
1679
- "data-tip": `${g.name} is ${Ve[g.reason] ?? g.reason}${g.delegate ? ` — ${g.delegate.name} covers${g.delegate.expires_at ? ` until ${Or(g.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1680
- className: ne(
1637
+ "data-tip": `${g.name} is ${Ge[g.reason] ?? g.reason}${g.delegate ? ` — ${g.delegate.name} covers${g.delegate.expires_at ? ` until ${Lr(g.delegate.expires_at)}` : ""}` : " and nobody is covering"}`,
1638
+ className: re(
1681
1639
  "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
1682
1640
  g.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"
1683
1641
  ),
1684
1642
  children: [
1685
1643
  g.name,
1686
- g.delegate ? /* @__PURE__ */ s(Te, { children: [
1644
+ g.delegate ? /* @__PURE__ */ s(qe, { children: [
1687
1645
  " → ",
1688
1646
  g.delegate.name,
1689
1647
  g.delegate.expires_at && /* @__PURE__ */ s("span", { className: "opacity-70", children: [
@@ -1700,13 +1658,13 @@ function Ma({
1700
1658
  ] }) : /* @__PURE__ */ s("span", { className: "opacity-80", children: [
1701
1659
  " ",
1702
1660
  "· ",
1703
- Ve[g.reason] ?? g.reason
1661
+ Ge[g.reason] ?? g.reason
1704
1662
  ] })
1705
1663
  ]
1706
1664
  },
1707
1665
  g.id
1708
1666
  )),
1709
- I && /* @__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" })
1667
+ j && /* @__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" })
1710
1668
  ] }) })
1711
1669
  ]
1712
1670
  },
@@ -1718,66 +1676,66 @@ function Ma({
1718
1676
  )
1719
1677
  ] });
1720
1678
  }
1721
- function Ms({
1679
+ function Is({
1722
1680
  collection: e,
1723
1681
  item: t,
1724
1682
  defaultExpanded: r,
1725
1683
  title: a,
1726
1684
  showApprovalChain: i,
1727
- hideActionsCollapsed: m,
1728
- hideActionsExpanded: v,
1685
+ hideActionsCollapsed: u,
1686
+ hideActionsExpanded: x,
1729
1687
  onBeforeTransition: b,
1730
- addendumPending: y,
1731
- addendumView: T,
1688
+ addendumPending: w,
1689
+ addendumView: M,
1732
1690
  asRole: h,
1733
- asUser: P
1691
+ asUser: R
1734
1692
  }) {
1735
1693
  return t === "new" ? null : /* @__PURE__ */ n(
1736
- qa,
1694
+ Ea,
1737
1695
  {
1738
1696
  collection: e,
1739
1697
  item: t,
1740
1698
  defaultExpanded: r,
1741
1699
  title: a,
1742
1700
  showApprovalChain: i,
1743
- hideActionsCollapsed: m,
1744
- hideActionsExpanded: v,
1701
+ hideActionsCollapsed: u,
1702
+ hideActionsExpanded: x,
1745
1703
  onBeforeTransition: b,
1746
- addendumPending: y,
1747
- addendumView: T,
1704
+ addendumPending: w,
1705
+ addendumView: M,
1748
1706
  asRole: h,
1749
- asUser: P
1707
+ asUser: R
1750
1708
  },
1751
1709
  `${e}:${t}`
1752
1710
  );
1753
1711
  }
1754
- function ur({
1712
+ function pr({
1755
1713
  collection: e,
1756
1714
  item: t,
1757
1715
  omitLines: r
1758
1716
  }) {
1759
- const a = We(), { data: i } = $e({
1760
- queryKey: Yn(e, t),
1761
- queryFn: () => Jn(a, e, t),
1717
+ const a = Ke(), { data: i } = Pe({
1718
+ queryKey: Jn(e, t),
1719
+ queryFn: () => Zn(a, e, t),
1762
1720
  staleTime: 3e4,
1763
1721
  retry: !1
1764
1722
  });
1765
- if (!i) return /* @__PURE__ */ n(tn, { collection: e, item: t });
1766
- const m = i.field_changes.map((_) => {
1767
- const S = (V) => V == null || V === "" ? V : oa(String(V), _), q = xa(_.old === void 0 ? void 0 : S(_.old), S(_.new));
1768
- return { f: _, pair: q, noop: q.old !== null && q.old === q.new };
1769
- }), v = m.filter((_) => !_.noop), b = m.filter((_) => _.noop && !_.f.auto).length, y = m.length - v.length, T = Math.max(0, i.changed_total - y), h = Math.max(0, (i.changed_by_people ?? i.changed_total) - b), P = new Set((r ?? []).map(an)), N = (i.lines ?? []).filter((_) => !P.has(an(_)));
1770
- return /* @__PURE__ */ s(Te, { children: [
1771
- /* @__PURE__ */ n(tn, { collection: e, item: t }),
1723
+ if (!i) return /* @__PURE__ */ n(an, { collection: e, item: t });
1724
+ const u = i.field_changes.map((k) => {
1725
+ const N = (V) => V == null || V === "" ? V : ba(String(V), k), q = Ca(k.old === void 0 ? void 0 : N(k.old), N(k.new));
1726
+ return { f: k, pair: q, noop: q.old !== null && q.old === q.new };
1727
+ }), x = u.filter((k) => !k.noop), b = u.filter((k) => k.noop && !k.f.auto).length, w = u.length - x.length, M = Math.max(0, i.changed_total - w), h = Math.max(0, (i.changed_by_people ?? i.changed_total) - b), R = new Set((r ?? []).map(on)), _ = (i.lines ?? []).filter((k) => !R.has(on(k)));
1728
+ return /* @__PURE__ */ s(qe, { children: [
1729
+ /* @__PURE__ */ n(an, { collection: e, item: t }),
1772
1730
  /* @__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: [
1773
1731
  /* @__PURE__ */ s("p", { className: "text-slate-500 dark:text-muted-foreground", children: [
1774
1732
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
1775
1733
  " ",
1776
1734
  "(",
1777
- ba(i.days_in_state),
1735
+ Sa(i.days_in_state),
1778
1736
  "):",
1779
1737
  " ",
1780
- T === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ s(Te, { children: [
1738
+ M === 0 && i.comments === 0 && i.addendums.count === 0 ? /* @__PURE__ */ n("span", { children: "no changes to this record." }) : /* @__PURE__ */ s(qe, { children: [
1781
1739
  h > 0 && /* @__PURE__ */ s("span", { children: [
1782
1740
  h,
1783
1741
  " field",
@@ -1785,7 +1743,7 @@ function ur({
1785
1743
  " changed",
1786
1744
  i.edited_by.length > 0 ? ` by ${i.edited_by.join(", ")}` : ""
1787
1745
  ] }),
1788
- h === 0 && T > 0 && i.comments === 0 && i.addendums.count === 0 && /* @__PURE__ */ n("span", { children: "only values the record fills in itself changed." }),
1746
+ h === 0 && M > 0 && i.comments === 0 && i.addendums.count === 0 && /* @__PURE__ */ n("span", { children: "only values the record fills in itself changed." }),
1789
1747
  i.comments > 0 && /* @__PURE__ */ s("span", { children: [
1790
1748
  h > 0 ? " · " : "",
1791
1749
  i.comments,
@@ -1801,174 +1759,174 @@ function ur({
1801
1759
  ] })
1802
1760
  ] })
1803
1761
  ] }),
1804
- v.length > 0 && /* @__PURE__ */ s("div", { className: "mt-1 space-y-0.5", children: [
1805
- v.slice(0, 5).map(({ f: _, pair: S }) => /* @__PURE__ */ s(
1762
+ x.length > 0 && /* @__PURE__ */ s("div", { className: "mt-1 space-y-0.5", children: [
1763
+ x.slice(0, 5).map(({ f: k, pair: N }) => /* @__PURE__ */ s(
1806
1764
  "p",
1807
1765
  {
1808
- "data-brief-change": _.field,
1766
+ "data-brief-change": k.field,
1809
1767
  className: "text-[11px] text-slate-500 dark:text-muted-foreground",
1810
1768
  children: [
1811
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: _.label || Fr(_.field) }),
1812
- _.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1769
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: k.label || Er(k.field) }),
1770
+ k.auto ? /* @__PURE__ */ n("span", { children: " (updated automatically)" }) : null,
1813
1771
  ":",
1814
1772
  " ",
1815
- S.old !== null && /* @__PURE__ */ s(Te, { children: [
1816
- S.old === "(empty)" ? (
1773
+ N.old !== null && /* @__PURE__ */ s(qe, { children: [
1774
+ N.old === "(empty)" ? (
1817
1775
  // Nothing was there: said quietly, as in the resubmission diff.
1818
1776
  /* @__PURE__ */ n("span", { className: "italic", children: "empty" })
1819
- ) : /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: S.old }),
1777
+ ) : /* @__PURE__ */ n("span", { className: "text-red-600 line-through dark:text-red-400", children: N.old }),
1820
1778
  /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " → " }),
1821
1779
  /* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
1822
1780
  ] }),
1823
- /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: S.new })
1781
+ /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: N.new })
1824
1782
  ]
1825
1783
  },
1826
- _.field
1784
+ k.field
1827
1785
  )),
1828
- v.length > 5 && /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-400", children: [
1786
+ x.length > 5 && /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-400", children: [
1829
1787
  "+",
1830
- v.length - 5,
1788
+ x.length - 5,
1831
1789
  " more — see History for the full trail"
1832
1790
  ] })
1833
1791
  ] }),
1834
- N.map((_) => /* @__PURE__ */ s(
1792
+ _.map((k) => /* @__PURE__ */ s(
1835
1793
  "p",
1836
1794
  {
1837
- "data-brief-line": _.label,
1795
+ "data-brief-line": k.label,
1838
1796
  className: "mt-1 text-slate-500 dark:text-muted-foreground",
1839
1797
  children: [
1840
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: _.label }),
1798
+ /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: k.label }),
1841
1799
  " ",
1842
1800
  /* @__PURE__ */ n(
1843
1801
  "span",
1844
1802
  {
1845
- className: _.tone === "danger" ? "text-red-700 dark:text-red-300" : _.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
1846
- children: _.text
1803
+ className: k.tone === "danger" ? "text-red-700 dark:text-red-300" : k.tone === "warn" ? "text-amber-700 dark:text-amber-300" : "",
1804
+ children: k.text
1847
1805
  }
1848
1806
  )
1849
1807
  ]
1850
1808
  },
1851
- `${_.label}:${_.text}`
1809
+ `${k.label}:${k.text}`
1852
1810
  ))
1853
1811
  ] })
1854
1812
  ] });
1855
1813
  }
1856
- function qa({
1814
+ function Ea({
1857
1815
  collection: e,
1858
1816
  item: t,
1859
1817
  defaultExpanded: r,
1860
1818
  title: a,
1861
1819
  showApprovalChain: i,
1862
- hideActionsCollapsed: m,
1863
- hideActionsExpanded: v,
1820
+ hideActionsCollapsed: u,
1821
+ hideActionsExpanded: x,
1864
1822
  onBeforeTransition: b,
1865
- addendumPending: y,
1866
- addendumView: T,
1823
+ addendumPending: w,
1824
+ addendumView: M,
1867
1825
  asRole: h,
1868
- asUser: P
1826
+ asUser: R
1869
1827
  }) {
1870
- var Ht, Vt, Gt, Xt;
1871
- const N = !!h || !!P, _ = We(), S = Ze(), { isAdmin: q } = hn(), [V, B] = J(0), re = he(null);
1828
+ var Yt, Xt, Jt, Zt;
1829
+ const _ = !!h || !!R, k = Ke(), N = et(), { isAdmin: q } = bn(), [V, L] = X(0), ae = we(null);
1872
1830
  Ee(() => {
1873
1831
  if (!q) return;
1874
- const u = (A) => {
1875
- const F = A.detail;
1876
- !F || F.claimed || F.collection !== e || String(F.item) !== String(t) || (F.claimed = !0, $(!0), B((U) => U + 1), setTimeout(
1832
+ const c = (y) => {
1833
+ const A = y.detail;
1834
+ !A || A.claimed || A.collection !== e || String(A.item) !== String(t) || (A.claimed = !0, $(!0), L((F) => F + 1), setTimeout(
1877
1835
  () => {
1878
- var U;
1879
- return (U = re.current) == null ? void 0 : U.scrollIntoView({ block: "center", behavior: "smooth" });
1836
+ var F;
1837
+ return (F = ae.current) == null ? void 0 : F.scrollIntoView({ block: "center", behavior: "smooth" });
1880
1838
  },
1881
1839
  80
1882
1840
  ));
1883
1841
  };
1884
- return window.addEventListener(Jt, u), () => window.removeEventListener(Jt, u);
1842
+ return window.addEventListener(tn, c), () => window.removeEventListener(tn, c);
1885
1843
  }, [q, e, t]);
1886
- const [ie, de] = J(""), [Z, I] = J(null), [ge, _e] = J(!1), G = he(null), [p, $] = Ar(r, !1), [w, g] = J(null), [C, K] = J(null), [be, o] = J(null), [R, L] = J([]), Me = Zn(e, String(t)), [te, Ce] = J([]), ce = jn(e, String(t));
1887
- wn(e, t, "transition", !!Z || !!w), bn(e, t, { hold: !!Z || !!w });
1888
- const D = Tr(e, t, "transition"), Q = he(!1), oe = (u) => {
1889
- Q.current || N || (Q.current = !0, K(null), X.mutate(u, {
1890
- onSettled: (A, F) => {
1891
- if (F) {
1892
- Q.current = !1;
1844
+ const [oe, pe] = X(""), [J, j] = X(null), [ye, Se] = X(!1), Y = we(null), [p, $] = Br(r, !1), [v, g] = X(null), [C, Q] = X(null), [ke, o] = X(null), [O, U] = X([]), Re = er(e, String(t)), [ne, Te] = X([]), fe = Wn(e, String(t));
1845
+ kn(e, t, "transition", !!J || !!v), vn(e, t, { hold: !!J || !!v });
1846
+ const D = Rr(e, t, "transition"), z = we(!1), le = (c) => {
1847
+ z.current || _ || (z.current = !0, Q(null), G.mutate(c, {
1848
+ onSettled: (y, A) => {
1849
+ if (A) {
1850
+ z.current = !1;
1893
1851
  return;
1894
1852
  }
1895
- ue().finally(() => {
1896
- Q.current = !1;
1853
+ xe().finally(() => {
1854
+ z.current = !1;
1897
1855
  });
1898
1856
  }
1899
1857
  }));
1900
- }, me = async (u, A) => {
1901
- var ye, pe;
1902
- if (Q.current) return;
1903
- if (N) {
1858
+ }, be = async (c, y) => {
1859
+ var ge, me;
1860
+ if (z.current) return;
1861
+ if (_) {
1904
1862
  ee.info(
1905
1863
  l != null && l.as_user ? `Previewing as ${l.as_user.name}: moves are not made from a preview.` : "Previewing as a role: moves are not made from a preview."
1906
1864
  );
1907
1865
  return;
1908
1866
  }
1909
1867
  if (l != null && l.running_move) return;
1910
- if (Z === u) {
1911
- I(null);
1868
+ if (J === c) {
1869
+ j(null);
1912
1870
  return;
1913
1871
  }
1914
- if (!(A != null && A.cleared) && ((l == null ? void 0 : l.available_transitions) ?? []).some((ae) => ae.id === u && ae.advisory)) {
1915
- I(null), K(null), o(u), S.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1872
+ if (!(y != null && y.cleared) && ((l == null ? void 0 : l.available_transitions) ?? []).some((Z) => Z.id === c && Z.advisory)) {
1873
+ j(null), Q(null), o(c), N.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1916
1874
  return;
1917
1875
  }
1918
1876
  if (o(null), b) {
1919
- Q.current = !0;
1920
- let ae = !1;
1877
+ z.current = !0;
1878
+ let Z = !1;
1921
1879
  try {
1922
- ae = await b();
1880
+ Z = await b();
1923
1881
  } finally {
1924
- Q.current = !1;
1882
+ z.current = !1;
1925
1883
  }
1926
- if (!ae) return;
1884
+ if (!Z) return;
1927
1885
  }
1928
1886
  {
1929
- Q.current = !0;
1930
- let ae = [];
1887
+ z.current = !0;
1888
+ let Z = [];
1931
1889
  try {
1932
- ae = await ce.check();
1890
+ Z = await fe.check();
1933
1891
  } finally {
1934
- Q.current = !1;
1892
+ z.current = !1;
1935
1893
  }
1936
- if (Ce(ae), ae.length > 0) {
1937
- L([]), I(u);
1894
+ if (Te(Z), Z.length > 0) {
1895
+ U([]), j(c);
1938
1896
  return;
1939
1897
  }
1940
1898
  }
1941
- const F = (O ?? []).find((ae) => ae.id === u), U = String((F == null ? void 0 : F.comment_mode) ?? "none"), H = Ut(F, (l == null ? void 0 : l.states) ?? [], (ye = l == null ? void 0 : l.instance) == null ? void 0 : ye.current_state);
1942
- if (U !== "optional" && U !== "required") {
1943
- if (F && !it(F, (l == null ? void 0 : l.states) ?? [], (pe = l == null ? void 0 : l.instance) == null ? void 0 : pe.current_state)) {
1944
- Q.current = !0;
1945
- let ae = [];
1899
+ const A = (ie ?? []).find((Z) => Z.id === c), F = String((A == null ? void 0 : A.comment_mode) ?? "none"), te = Wt(A, (l == null ? void 0 : l.states) ?? [], (ge = l == null ? void 0 : l.instance) == null ? void 0 : ge.current_state);
1900
+ if (F !== "optional" && F !== "required") {
1901
+ if (A && !ot(A, (l == null ? void 0 : l.states) ?? [], (me = l == null ? void 0 : l.instance) == null ? void 0 : me.current_state)) {
1902
+ z.current = !0;
1903
+ let Z = [];
1946
1904
  try {
1947
- ae = await Me();
1905
+ Z = await Re();
1948
1906
  } finally {
1949
- Q.current = !1;
1907
+ z.current = !1;
1950
1908
  }
1951
- if (ae.length > 0 || H) {
1952
- L(ae), I(u);
1909
+ if (Z.length > 0 || te) {
1910
+ U(Z), j(c);
1953
1911
  return;
1954
1912
  }
1955
1913
  }
1956
- if (H) {
1957
- L([]), I(u);
1914
+ if (te) {
1915
+ U([]), j(c);
1958
1916
  return;
1959
1917
  }
1960
- oe({ transition_id: u });
1918
+ le({ transition_id: c });
1961
1919
  return;
1962
1920
  }
1963
- L([]), I(u);
1964
- }, z = P ? ["pipeline-instance", e, t, "as-user", P] : h ? ["pipeline-instance", e, t, h] : ["pipeline-instance", e, t], { settling: ke, settle: ue } = Gn(z), { data: l, isLoading: Ke } = $e({
1965
- queryKey: z,
1966
- queryFn: () => _.request(
1967
- Fe(
1968
- `/pipelines/instance/${e}/${t}${P ? `?as_user=${encodeURIComponent(P)}` : h ? `?as_role=${encodeURIComponent(h)}` : ""}`
1921
+ U([]), j(c);
1922
+ }, H = R ? ["pipeline-instance", e, t, "as-user", R] : h ? ["pipeline-instance", e, t, h] : ["pipeline-instance", e, t], { settling: _e, settle: xe } = Yn(H), { data: l, isLoading: Qe } = Pe({
1923
+ queryKey: H,
1924
+ queryFn: () => k.request(
1925
+ De(
1926
+ `/pipelines/instance/${e}/${t}${R ? `?as_user=${encodeURIComponent(R)}` : h ? `?as_role=${encodeURIComponent(h)}` : ""}`
1969
1927
  )
1970
1928
  ).then(
1971
- (u) => u.data ?? {
1929
+ (c) => c.data ?? {
1972
1930
  instance: null,
1973
1931
  states: [],
1974
1932
  available_transitions: [],
@@ -1978,167 +1936,167 @@ function qa({
1978
1936
  }
1979
1937
  ),
1980
1938
  staleTime: 1e4,
1981
- refetchInterval: (u) => Tn(u.state.data)
1939
+ refetchInterval: (c) => Pn(c.state.data)
1982
1940
  });
1983
- Mn(!!(l != null && l.running_move), () => {
1984
- Xe(S, e, String(t)), Ye(S, e, String(t)), xt(S, e, String(t));
1941
+ qn(!!(l != null && l.running_move), () => {
1942
+ Xe(N, e, String(t)), Je(N, e, String(t)), wt(N, e, String(t));
1985
1943
  });
1986
- const Ne = Xn(
1987
- l ? (l.available_transitions ?? []).map((u) => String(u.id)) : null,
1944
+ const Ce = Xn(
1945
+ l ? (l.available_transitions ?? []).map((c) => String(c.id)) : null,
1988
1946
  `${e}:${t}`
1989
1947
  );
1990
1948
  Ee(
1991
- () => S.getQueryCache().subscribe((u) => {
1992
- if (u.type !== "updated" || u.action.type !== "success") return;
1993
- const A = u.query.queryKey;
1994
- Array.isArray(A) && A[0] === "item" && A[1] === e && String(A[2]) === t && S.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1949
+ () => N.getQueryCache().subscribe((c) => {
1950
+ if (c.type !== "updated" || c.action.type !== "success") return;
1951
+ const y = c.query.queryKey;
1952
+ Array.isArray(y) && y[0] === "item" && y[1] === e && String(y[2]) === t && N.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
1995
1953
  }),
1996
- [S, e, t]
1954
+ [N, e, t]
1997
1955
  );
1998
- const { data: xe, isLoading: qe } = $e({
1956
+ const { data: Ne, isLoading: Oe } = Pe({
1999
1957
  queryKey: ["pipeline-all-owners", e, t],
2000
- queryFn: () => _.request(
2001
- Fe(`/pipelines/instance/${e}/${t}/owners/all`)
2002
- ).then((u) => u.data ?? null),
1958
+ queryFn: () => k.request(
1959
+ De(`/pipelines/instance/${e}/${t}/owners/all`)
1960
+ ).then((c) => c.data ?? null),
2003
1961
  // Also when a send back is on offer: its target may be a chain step this record skipped.
2004
1962
  // And while a move is being confirmed: the panel names where it really lands.
2005
- enabled: (p || nr(l) || !!Z) && !!(l != null && l.instance),
1963
+ enabled: (p || rr(l) || !!J) && !!(l != null && l.instance),
2006
1964
  staleTime: 3e4
2007
- }), c = gt(() => {
2008
- if (!xe) return null;
2009
- const u = Object.entries(xe);
2010
- return u.length === 0 || u.every(([, A]) => A.on_path === void 0) ? null : new Set(u.filter(([, A]) => A.on_path !== !1).map(([A]) => A));
2011
- }, [xe]), j = gt(() => {
2012
- if (!xe) return null;
2013
- const u = /* @__PURE__ */ new Map();
2014
- for (const [A, F] of Object.entries(xe))
2015
- F.skipped && u.set(A, F.skip_reasons ?? []);
2016
- return u;
2017
- }, [xe]), le = Je({
2018
- mutationFn: () => _.request(st(`/pipelines/instance/${e}/${t}/start`, {})),
1965
+ }), m = xt(() => {
1966
+ if (!Ne) return null;
1967
+ const c = Object.entries(Ne);
1968
+ return c.length === 0 || c.every(([, y]) => y.on_path === void 0) ? null : new Set(c.filter(([, y]) => y.on_path !== !1).map(([y]) => y));
1969
+ }, [Ne]), W = xt(() => {
1970
+ if (!Ne) return null;
1971
+ const c = /* @__PURE__ */ new Map();
1972
+ for (const [y, A] of Object.entries(Ne))
1973
+ A.skipped && c.set(y, A.skip_reasons ?? []);
1974
+ return c;
1975
+ }, [Ne]), de = Ze({
1976
+ mutationFn: () => k.request(it(`/pipelines/instance/${e}/${t}/start`, {})),
2019
1977
  onSuccess: () => {
2020
- S.invalidateQueries({ queryKey: z }), ee.success("Pipeline started");
1978
+ N.invalidateQueries({ queryKey: H }), ee.success("Pipeline started");
2021
1979
  },
2022
1980
  onError: () => ee.error("Failed to start pipeline")
2023
- }), X = Je({
1981
+ }), G = Ze({
2024
1982
  mutationFn: ({
2025
- transition_id: u,
2026
- comment: A,
2027
- reviewed: F,
2028
- lock_ack: U
2029
- }) => N ? Promise.reject(new Error("Moves are not made from a preview")) : _.request(
2030
- st(`/pipelines/instance/${e}/${t}/transition`, {
2031
- transition_id: u,
2032
- comment: A,
2033
- ...F ? { reviewed: !0 } : {},
2034
- ...U ? { lock_ack: !0 } : {},
2035
- ...Pn(l == null ? void 0 : l.available_transitions, u)
1983
+ transition_id: c,
1984
+ comment: y,
1985
+ reviewed: A,
1986
+ lock_ack: F
1987
+ }) => _ ? Promise.reject(new Error("Moves are not made from a preview")) : k.request(
1988
+ it(`/pipelines/instance/${e}/${t}/transition`, {
1989
+ transition_id: c,
1990
+ comment: y,
1991
+ ...A ? { reviewed: !0 } : {},
1992
+ ...F ? { lock_ack: !0 } : {},
1993
+ ...On(l == null ? void 0 : l.available_transitions, c)
2036
1994
  })
2037
1995
  ),
2038
- onMutate: (u) => {
2039
- var A;
1996
+ onMutate: (c) => {
1997
+ var y;
2040
1998
  return {
2041
- slow: sr(
2042
- (A = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2043
- (F) => F.id === u.transition_id
2044
- )) == null ? void 0 : A.label
1999
+ slow: ir(
2000
+ (y = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2001
+ (A) => A.id === c.transition_id
2002
+ )) == null ? void 0 : y.label
2045
2003
  )
2046
2004
  };
2047
2005
  },
2048
- onSuccess: (u, A, F) => {
2049
- S.invalidateQueries({ queryKey: z }), e === "nivaro_addendums" && S.invalidateQueries({ queryKey: ["addendums"] }), Xe(S, e, String(t)), Ye(S, e, String(t)), xt(S, e, String(t)), K(null), de(""), I(null), g(null);
2050
- const U = qn(u);
2051
- U ? ee.info(
2052
- `${U.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2053
- F == null ? void 0 : F.slow.done()
2054
- ) : ee.success(ar(l, A.transition_id, u), F == null ? void 0 : F.slow.done());
2006
+ onSuccess: (c, y, A) => {
2007
+ N.invalidateQueries({ queryKey: H }), e === "nivaro_addendums" && N.invalidateQueries({ queryKey: ["addendums"] }), Xe(N, e, String(t)), Je(N, e, String(t)), wt(N, e, String(t)), Q(null), pe(""), j(null), g(null);
2008
+ const F = Rn(c);
2009
+ F ? ee.info(
2010
+ `${F.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2011
+ A == null ? void 0 : A.slow.done()
2012
+ ) : ee.success(sr(l, y.transition_id, c), A == null ? void 0 : A.slow.done());
2055
2013
  },
2056
- onError: (u, A, F) => {
2057
- var ae, Le;
2058
- if (F == null || F.slow.fail(), Qn(u)) {
2059
- S.invalidateQueries({ queryKey: z });
2014
+ onError: (c, y, A) => {
2015
+ var Z, Me;
2016
+ if (A == null || A.slow.fail(), zn(c)) {
2017
+ N.invalidateQueries({ queryKey: H });
2060
2018
  return;
2061
2019
  }
2062
- if (wt(u) === "TRANSITION_RUNNING") {
2063
- S.invalidateQueries({ queryKey: z }), I(null), g(null), ee.info(je(u, "This move is already running on this record."));
2020
+ if (kt(c) === "TRANSITION_RUNNING") {
2021
+ N.invalidateQueries({ queryKey: H }), j(null), g(null), ee.info(We(c, "This move is already running on this record."));
2064
2022
  return;
2065
2023
  }
2066
- const U = Hn(u);
2067
- if (U) {
2068
- I(null);
2069
- const Pe = ((ae = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2070
- (lt) => lt.id === A.transition_id
2071
- )) == null ? void 0 : ae.label) ?? "Move";
2072
- ee.warning(U.message, {
2024
+ const F = Vn(c);
2025
+ if (F) {
2026
+ j(null);
2027
+ const ue = ((Z = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2028
+ (je) => je.id === y.transition_id
2029
+ )) == null ? void 0 : Z.label) ?? "Move";
2030
+ ee.warning(F.message, {
2073
2031
  id: `nvr-locked-move:${e}:${String(t)}`,
2074
2032
  duration: 2e4,
2075
2033
  action: {
2076
- label: `${Pe} anyway`,
2077
- onClick: () => oe({ ...A, lock_ack: !0 })
2034
+ label: `${ue} anyway`,
2035
+ onClick: () => le({ ...y, lock_ack: !0 })
2078
2036
  },
2079
2037
  cancel: { label: "Wait", onClick: () => {
2080
2038
  } }
2081
2039
  });
2082
2040
  return;
2083
2041
  }
2084
- const H = zn(u);
2085
- if (H) {
2086
- g((Pe) => ({
2087
- payload: H,
2088
- transitionId: A.transition_id,
2089
- comment: A.comment,
2090
- revision: ((Pe == null ? void 0 : Pe.revision) ?? 0) + 1
2042
+ const te = Hn(c);
2043
+ if (te) {
2044
+ g((ue) => ({
2045
+ payload: te,
2046
+ transitionId: y.transition_id,
2047
+ comment: y.comment,
2048
+ revision: ((ue == null ? void 0 : ue.revision) ?? 0) + 1
2091
2049
  }));
2092
2050
  return;
2093
2051
  }
2094
- const ye = u == null ? void 0 : u.response;
2095
- K(Vn(u, A));
2096
- const pe = xn(
2097
- u,
2098
- (Le = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2099
- (Pe) => Pe.id === A.transition_id
2100
- )) == null ? void 0 : Le.label
2052
+ const ge = c == null ? void 0 : c.response;
2053
+ Q(Gn(c, y));
2054
+ const me = wn(
2055
+ c,
2056
+ (Me = [...(l == null ? void 0 : l.available_transitions) ?? [], ...(l == null ? void 0 : l.all_transitions) ?? []].find(
2057
+ (ue) => ue.id === y.transition_id
2058
+ )) == null ? void 0 : Me.label
2101
2059
  );
2102
- ee.error((pe == null ? void 0 : pe.title) ?? je(u, "Failed to execute transition"), {
2060
+ ee.error((me == null ? void 0 : me.title) ?? We(c, "Failed to execute transition"), {
2103
2061
  duration: 12e3,
2104
2062
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
2105
2063
  // A partner's refusal copies what the toast said and the other system's answer as
2106
2064
  // stored, never the generic reading of a 422.
2107
- ...gn(pe ? vn(u, pe) : u, {
2065
+ ...xn(me ? yn(c, me) : c, {
2108
2066
  action: "Transition"
2109
2067
  }),
2110
- ...pe ? { description: pe.description } : {},
2068
+ ...me ? { description: me.description } : {},
2111
2069
  // #1867: a refusal carries "Why?" — the role, owner or access rule
2112
2070
  // that stopped it, and who can change it.
2113
- ...Cn(u) ? {
2114
- action: $n(_, {
2071
+ ...Tn(c) ? {
2072
+ action: Mn(k, {
2115
2073
  collection: e,
2116
2074
  itemId: String(t),
2117
2075
  action: "transition",
2118
- transitionId: A.transition_id
2076
+ transitionId: y.transition_id
2119
2077
  })
2120
2078
  } : {}
2121
- }), g(null), I(null), Xe(S, e, String(t)), Ye(S, e, String(t)), (ye == null ? void 0 : ye.status) === 409 && S.invalidateQueries({ queryKey: z });
2079
+ }), g(null), j(null), Xe(N, e, String(t)), Je(N, e, String(t)), (ge == null ? void 0 : ge.status) === 409 && N.invalidateQueries({ queryKey: H });
2122
2080
  }
2123
- }), d = he(me);
2124
- d.current = me;
2125
- const f = he((l == null ? void 0 : l.available_transitions) ?? []);
2081
+ }), d = we(be);
2082
+ d.current = be;
2083
+ const f = we((l == null ? void 0 : l.available_transitions) ?? []);
2126
2084
  f.current = (l == null ? void 0 : l.available_transitions) ?? [], Ee(() => {
2127
- const u = (A) => {
2128
- const F = A.detail;
2129
- if (!F || F.claimed || N || F.collection !== e || String(F.item) !== String(t)) return;
2130
- F.claimed = !0;
2131
- const U = String(F.transition_id).toUpperCase(), H = f.current.find((ye) => String(ye.id).toUpperCase() === U);
2132
- if (!H) {
2085
+ const c = (y) => {
2086
+ const A = y.detail;
2087
+ if (!A || A.claimed || _ || A.collection !== e || String(A.item) !== String(t)) return;
2088
+ A.claimed = !0;
2089
+ const F = String(A.transition_id).toUpperCase(), te = f.current.find((ge) => String(ge.id).toUpperCase() === F);
2090
+ if (!te) {
2133
2091
  ee.error("That step is not available from where the record is now");
2134
2092
  return;
2135
2093
  }
2136
- d.current(H.id);
2094
+ d.current(te.id);
2137
2095
  };
2138
- return window.addEventListener(bt, u), () => window.removeEventListener(bt, u);
2139
- }, [e, t, N]);
2140
- const M = Pr(e, t, ((Ht = l == null ? void 0 : l.instance) == null ? void 0 : Ht.current_state) ?? null);
2141
- if (Ke)
2096
+ return window.addEventListener(vt, c), () => window.removeEventListener(vt, c);
2097
+ }, [e, t, _]);
2098
+ const P = Fr(e, t, ((Yt = l == null ? void 0 : l.instance) == null ? void 0 : Yt.current_state) ?? null), { data: I } = Wr(e, l != null && l.instance ? String(t) : ""), E = ta(e, t);
2099
+ if (Qe)
2142
2100
  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: [
2143
2101
  /* @__PURE__ */ n(Ue, { className: "h-3.5 w-3.5 shrink-0 rounded" }),
2144
2102
  /* @__PURE__ */ n(Ue, { className: "h-4 w-20" }),
@@ -2146,292 +2104,320 @@ function qa({
2146
2104
  /* @__PURE__ */ n(Ue, { className: "ml-auto h-3.5 w-3.5 rounded" })
2147
2105
  ] }) });
2148
2106
  if (!(l != null && l.binding)) return null;
2149
- const { instance: x, available_transitions: O, history: se, states: Y } = l, W = new Map((Y ?? []).map((u) => [u.id, u])), ve = (x == null ? void 0 : x.current_state_obj) ?? null, k = Z ? (O ?? []).find((u) => u.id === Z) : null, we = k ? W.get(k.to_state) : null, Be = cr(k, ve, Y, xe), et = (Be == null ? void 0 : Be.state) ?? we, tt = x != null && x.completed_at && O ? O.filter(
2150
- (u) => u.from_state && String(u.from_state).toUpperCase() === String(x.current_state).toUpperCase()
2151
- ) : null, ot = x != null && x.completed_at ? tt ?? [] : rr(
2152
- O ?? [],
2153
- Y ?? [],
2154
- x == null ? void 0 : x.current_state,
2155
- j
2156
- ), yt = An(ot, l.blocked_transitions), kt = yt.length > 0, It = En(ot), nt = be ? ot.find((u) => u.id === be) : null, Oe = (l == null ? void 0 : l.running_move) ?? null, De = Oe ? null : (l == null ? void 0 : l.last_move_problem) ?? null, jt = De ? ot.find((u) => Ft(u.id, De.transition_id)) : null, Wt = (u, A = !1) => {
2157
- const F = /* @__PURE__ */ new Map();
2158
- for (const U of u) {
2159
- const H = F.get(U.label) ?? [];
2160
- H.push(U), F.set(U.label, H);
2107
+ const { instance: T, available_transitions: ie, history: K, states: he } = l, S = new Map((he ?? []).map((c) => [c.id, c])), se = (T == null ? void 0 : T.current_state_obj) ?? null, ce = J ? (ie ?? []).find((c) => c.id === J) : null, _t = ce ? S.get(ce.to_state) : null, Le = mr(ce, se, he, Ne), Nt = (Le == null ? void 0 : Le.state) ?? _t, fr = T != null && T.completed_at && ie ? ie.filter(
2108
+ (c) => c.from_state && String(c.from_state).toUpperCase() === String(T.current_state).toUpperCase()
2109
+ ) : null, tt = T != null && T.completed_at ? fr ?? [] : ar(
2110
+ ie ?? [],
2111
+ he ?? [],
2112
+ T == null ? void 0 : T.current_state,
2113
+ W
2114
+ ), lt = Fn(tt, l.blocked_transitions), St = lt.length > 0, Kt = En(tt), nt = ke ? tt.find((c) => c.id === ke) : null, Be = (l == null ? void 0 : l.running_move) ?? null, dt = Be ? null : (l == null ? void 0 : l.last_move_problem) ?? null, hr = dt ? tt.find((c) => at(c.id, dt.transition_id)) : null, Ct = ha({
2115
+ problem: dt,
2116
+ held: l == null ? void 0 : l.auto_held,
2117
+ sends: I
2118
+ }), Qt = E ? (c) => na(e, t, c) : null, zt = (c, y = !1) => {
2119
+ const A = /* @__PURE__ */ new Map();
2120
+ for (const F of c) {
2121
+ const te = A.get(F.label) ?? [];
2122
+ te.push(F), A.set(F.label, te);
2161
2123
  }
2162
- return Array.from(F.entries()).map(([U, H]) => {
2163
- var Pe, lt, Yt;
2164
- const ye = ((Pe = H[0]) == null ? void 0 : Pe.color) ?? null, pe = H.some((E) => E.id === Z), ae = (E) => ye ? E ? { backgroundColor: ye, borderColor: ye } : { borderColor: ye, color: ye } : void 0, Le = [...H].sort(
2165
- (E, Se) => {
2166
- var Qe, rt;
2167
- return (((Qe = W.get(E.to_state)) == null ? void 0 : Qe.sort) ?? 999) - (((rt = W.get(Se.to_state)) == null ? void 0 : rt.sort) ?? 999);
2124
+ return Array.from(A.entries()).map(([F, te]) => {
2125
+ var ue, je, en;
2126
+ const ge = ((ue = te[0]) == null ? void 0 : ue.color) ?? null, me = te.some((B) => B.id === J), Z = (B) => ge ? B ? { backgroundColor: ge, borderColor: ge } : { borderColor: ge, color: ge } : void 0, Me = [...te].sort(
2127
+ (B, $e) => {
2128
+ var ze, rt;
2129
+ return (((ze = S.get(B.to_state)) == null ? void 0 : ze.sort) ?? 999) - (((rt = S.get($e.to_state)) == null ? void 0 : rt.sort) ?? 999);
2168
2130
  }
2169
2131
  );
2170
- if (H.every(Fn))
2132
+ if (te.every(gt))
2171
2133
  return /* @__PURE__ */ n(
2172
- On,
2134
+ Dn,
2173
2135
  {
2174
- label: U,
2175
- small: A,
2176
- code: (lt = Le[0].blocked) == null ? void 0 : lt.code,
2177
- reason: Dn(
2178
- Le,
2179
- (E) => {
2180
- var Se;
2181
- return ((Se = W.get(Le[E].to_state)) == null ? void 0 : Se.label) ?? Le[E].to_state;
2136
+ label: F,
2137
+ small: y,
2138
+ code: (je = Me[0].blocked) == null ? void 0 : je.code,
2139
+ reason: Bn(
2140
+ Me,
2141
+ (B) => {
2142
+ var $e;
2143
+ return (($e = S.get(Me[B].to_state)) == null ? void 0 : $e.label) ?? Me[B].to_state;
2182
2144
  }
2183
2145
  )
2184
2146
  },
2185
- U
2147
+ F
2186
2148
  );
2187
- if (H.length === 1) {
2188
- const E = H[0], Se = X.isPending && ((Yt = X.variables) == null ? void 0 : Yt.transition_id) === E.id || Ft(Oe == null ? void 0 : Oe.transition_id, E.id), Qe = Rn(De, E.id), rt = /* @__PURE__ */ s(
2189
- fe,
2149
+ if (te.length === 1) {
2150
+ const B = te[0], $e = G.isPending && ((en = G.variables) == null ? void 0 : en.transition_id) === B.id || at(Be == null ? void 0 : Be.transition_id, B.id), ze = An(dt, B.id), rt = /* @__PURE__ */ s(
2151
+ ve,
2190
2152
  {
2191
2153
  size: "sm",
2192
- variant: pe && !E.advisory ? "default" : "outline",
2193
- className: ne(
2194
- A ? "h-7 text-[11px]" : "text-[12px]",
2154
+ variant: me && !B.advisory ? "default" : "outline",
2155
+ className: re(
2156
+ y ? "h-7 text-[11px]" : "text-[12px]",
2195
2157
  "gap-1.5 data-[fresh=true]:opacity-60",
2196
- E.advisory && ir
2158
+ B.advisory && or
2197
2159
  ),
2198
- style: E.advisory ? void 0 : ae(pe),
2199
- disabled: X.isPending || ke || !!Oe || !!Qe,
2200
- "aria-disabled": Ne.dimmed(E.id) || void 0,
2201
- "data-fresh": Ne.dimmed(E.id) || void 0,
2202
- ...Ne.bind(E.id),
2203
- ...He(E),
2160
+ style: B.advisory ? void 0 : Z(me),
2161
+ disabled: G.isPending || _e || !!Be || !!ze,
2162
+ "aria-disabled": Ce.dimmed(B.id) || void 0,
2163
+ "data-fresh": Ce.dimmed(B.id) || void 0,
2164
+ ...Ce.bind(B.id),
2165
+ ...Ve(B),
2204
2166
  onClick: () => {
2205
- Ne.press(E.id) && me(E.id);
2167
+ Ce.press(B.id) && be(B.id);
2206
2168
  },
2207
2169
  children: [
2208
- Se ? /* @__PURE__ */ n(Ae, { className: "h-3 w-3 animate-spin" }) : E.advisory && /* @__PURE__ */ n(Re, {}),
2209
- U
2170
+ $e ? /* @__PURE__ */ n(Fe, { className: "h-3 w-3 animate-spin" }) : B.advisory && /* @__PURE__ */ n(Ae, {}),
2171
+ F
2210
2172
  ]
2211
2173
  },
2212
- U
2174
+ F
2213
2175
  );
2214
- return Qe ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": Qe, "data-move-held": !0, children: rt }, U) : rt;
2176
+ return ze ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": ze, "data-move-held": !0, children: rt }, F) : rt;
2215
2177
  }
2216
- return /* @__PURE__ */ s(qt, { children: [
2217
- /* @__PURE__ */ n(Pt, { asChild: !0, children: /* @__PURE__ */ s(
2218
- fe,
2178
+ return /* @__PURE__ */ s(At, { children: [
2179
+ /* @__PURE__ */ n(Ft, { asChild: !0, children: /* @__PURE__ */ s(
2180
+ ve,
2219
2181
  {
2220
2182
  size: "sm",
2221
- variant: pe ? "default" : "outline",
2222
- className: `${A ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
2223
- style: ae(pe),
2224
- disabled: X.isPending || ke || !!Oe,
2183
+ variant: me ? "default" : "outline",
2184
+ className: `${y ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
2185
+ style: Z(me),
2186
+ disabled: G.isPending || _e || !!Be,
2225
2187
  children: [
2226
- H.every((E) => E.advisory) && /* @__PURE__ */ n(Re, {}),
2227
- U,
2228
- /* @__PURE__ */ n(Ge, { className: "h-3 w-3" })
2188
+ te.every((B) => B.advisory) && /* @__PURE__ */ n(Ae, {}),
2189
+ F,
2190
+ /* @__PURE__ */ n(Ye, { className: "h-3 w-3" })
2229
2191
  ]
2230
2192
  }
2231
2193
  ) }),
2232
- /* @__PURE__ */ s(Rt, { align: "start", children: [
2233
- Le.map((E) => {
2234
- var Se;
2194
+ /* @__PURE__ */ s(Dt, { align: "start", children: [
2195
+ Me.map((B) => {
2196
+ var $e;
2235
2197
  return /* @__PURE__ */ s(
2236
- dt,
2198
+ ct,
2237
2199
  {
2238
- onSelect: () => me(E.id),
2239
- ...He(E, "menu"),
2240
- ...ft(E),
2200
+ onSelect: () => be(B.id),
2201
+ ...Ve(B, "menu"),
2202
+ ...ht(B),
2241
2203
  children: [
2242
- E.color && /* @__PURE__ */ n(
2204
+ B.color && /* @__PURE__ */ n(
2243
2205
  "span",
2244
2206
  {
2245
- className: ne(
2207
+ className: re(
2246
2208
  "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
2247
- E.blocked && "opacity-40"
2209
+ B.blocked && "opacity-40"
2248
2210
  ),
2249
- style: { backgroundColor: E.color }
2211
+ style: { backgroundColor: B.color }
2250
2212
  }
2251
2213
  ),
2252
- ((Se = W.get(E.to_state)) == null ? void 0 : Se.label) ?? E.to_state,
2253
- E.advisory && /* @__PURE__ */ n(Re, { className: "ml-auto" }),
2254
- E.blocked && /* @__PURE__ */ n(pt, {})
2214
+ (($e = S.get(B.to_state)) == null ? void 0 : $e.label) ?? B.to_state,
2215
+ B.advisory && /* @__PURE__ */ n(Ae, { className: "ml-auto" }),
2216
+ B.blocked && /* @__PURE__ */ n(ft, {})
2255
2217
  ]
2256
2218
  },
2257
- E.id
2219
+ B.id
2258
2220
  );
2259
2221
  }),
2260
2222
  /* @__PURE__ */ n(
2261
- Dt,
2223
+ Lt,
2262
2224
  {
2263
- moves: H,
2264
- nameOf: (E) => {
2265
- var Se;
2266
- return ((Se = W.get(E.to_state)) == null ? void 0 : Se.label) ?? E.to_state;
2225
+ moves: te,
2226
+ nameOf: (B) => {
2227
+ var $e;
2228
+ return (($e = S.get(B.to_state)) == null ? void 0 : $e.label) ?? B.to_state;
2267
2229
  }
2268
2230
  }
2269
2231
  )
2270
2232
  ] })
2271
- ] }, U);
2233
+ ] }, F);
2272
2234
  });
2273
- }, _t = C ? /* @__PURE__ */ n(
2274
- lr,
2235
+ }, $t = C ? /* @__PURE__ */ n(
2236
+ dr,
2275
2237
  {
2276
2238
  collection: e,
2277
2239
  item: String(t),
2278
2240
  offer: C,
2279
- onDismiss: () => K(null),
2280
- onFixed: () => oe({ transition_id: C.transitionId, comment: C.comment })
2241
+ onDismiss: () => Q(null),
2242
+ onFixed: () => le({ transition_id: C.transitionId, comment: C.comment })
2281
2243
  }
2282
- ) : null, pr = p && !v && !!x && kt, Kt = (u) => {
2283
- var A;
2284
- return /* @__PURE__ */ s(Te, { children: [
2285
- It.map(({ advisory: F, moves: U }) => /* @__PURE__ */ n(
2286
- Bn,
2287
- {
2288
- collection: e,
2289
- item: String(t),
2290
- advisory: F,
2291
- armedMove: nt && U.some((H) => H.id === nt.id) ? {
2292
- id: nt.id,
2293
- label: nt.label,
2294
- confirms: or(nt, Y ?? [], x == null ? void 0 : x.current_state)
2295
- } : null,
2296
- stops: It.length > 1 ? [...new Set(U.map((H) => H.label))] : void 0,
2297
- className: u ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0,
2298
- onDismiss: () => o(null),
2299
- onFixed: (H) => {
2300
- o(null), S.invalidateQueries({ queryKey: z }), H && me(H.id, { cleared: !0 });
2301
- }
2302
- },
2303
- `${F.code}:${F.message}`
2304
- )),
2305
- Oe && /* @__PURE__ */ n(
2306
- Hr,
2307
- {
2308
- run: Oe,
2309
- className: u ? "rounded-lg border border-sky-200/80 px-3 dark:border-sky-500/20" : void 0
2310
- }
2311
- ),
2312
- De && /* @__PURE__ */ n(
2313
- Vr,
2314
- {
2315
- problem: De,
2316
- retryDisabled: X.isPending || ke,
2317
- onRetry: jt ? () => void me(jt.id) : void 0,
2318
- className: u ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0
2244
+ ) : null, gr = p && !x && !!T && St, Ht = (c) => /* @__PURE__ */ s(qe, { children: [
2245
+ Kt.map(({ advisory: y, moves: A }) => /* @__PURE__ */ n(
2246
+ Ln,
2247
+ {
2248
+ collection: e,
2249
+ item: String(t),
2250
+ advisory: y,
2251
+ armedMove: nt && A.some((F) => F.id === nt.id) ? {
2252
+ id: nt.id,
2253
+ label: nt.label,
2254
+ confirms: lr(nt, he ?? [], T == null ? void 0 : T.current_state)
2255
+ } : null,
2256
+ stops: Kt.length > 1 ? [...new Set(A.map((F) => F.label))] : void 0,
2257
+ className: c ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0,
2258
+ onDismiss: () => o(null),
2259
+ onFixed: (F) => {
2260
+ o(null), N.invalidateQueries({ queryKey: H }), F && be(F.id, { cleared: !0 });
2319
2261
  }
2320
- ),
2321
- x && /* @__PURE__ */ n(
2322
- Lr,
2262
+ },
2263
+ `${y.code}:${y.message}`
2264
+ )),
2265
+ Be && /* @__PURE__ */ n(
2266
+ Jr,
2267
+ {
2268
+ run: Be,
2269
+ className: c ? "rounded-lg border border-sky-200/80 px-3 dark:border-sky-500/20" : void 0
2270
+ }
2271
+ ),
2272
+ Ct.events.map((y) => {
2273
+ var me, Z, Me;
2274
+ const A = c ? "rounded-lg border border-amber-200/80 px-3 dark:border-amber-500/20" : void 0, F = y.problem ? hr : tt.find((ue) => {
2275
+ var je;
2276
+ return at(ue.id, (je = y.held) == null ? void 0 : je.transition_id);
2277
+ }), te = F && !gt(F) ? () => void be(F.id) : void 0;
2278
+ if (y.problem && ga(y))
2279
+ return /* @__PURE__ */ n(
2280
+ Zr,
2281
+ {
2282
+ problem: y.problem,
2283
+ retryDisabled: G.isPending || _e,
2284
+ onRetry: te,
2285
+ className: A
2286
+ },
2287
+ `problem:${y.problem.id}`
2288
+ );
2289
+ const ge = ((me = y.problem) == null ? void 0 : me.transition_id) ?? ((Z = y.held) == null ? void 0 : Z.transition_id) ?? null;
2290
+ return /* @__PURE__ */ n(
2291
+ ca,
2323
2292
  {
2324
- collection: e,
2325
- item: t,
2326
- skipIds: ((A = De == null ? void 0 : De.unanswered) == null ? void 0 : A.submission_id) != null ? [De.unanswered.submission_id] : void 0,
2327
- className: u ? "rounded-lg border px-3" : void 0
2328
- }
2329
- )
2330
- ] });
2331
- }, Qt = ka(se ?? [], x == null ? void 0 : x.current_state, Y ?? []), zt = /* @__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: [
2293
+ event: y,
2294
+ onRetry: te,
2295
+ retryDisabled: G.isPending || _e,
2296
+ onOpenIntegrations: Qt && (y.send || y.held) ? () => {
2297
+ var ue;
2298
+ return Qt(((ue = y.send) == null ? void 0 : ue.id) ?? null);
2299
+ } : void 0,
2300
+ canMoveByHand: lt.some((ue) => !gt(ue) && !at(ue.id, ge)),
2301
+ className: A
2302
+ },
2303
+ y.problem ? `problem:${y.problem.id}` : `held:${(Me = y.held) == null ? void 0 : Me.transition_id}`
2304
+ );
2305
+ }),
2306
+ T && /* @__PURE__ */ n(
2307
+ Kr,
2308
+ {
2309
+ collection: e,
2310
+ item: t,
2311
+ skipIds: Ct.spokenSendIds.length ? Ct.spokenSendIds : void 0,
2312
+ className: c ? "rounded-lg border px-3" : void 0
2313
+ }
2314
+ )
2315
+ ] }), Vt = Pa(K ?? [], T == null ? void 0 : T.current_state, he ?? []), Gt = /* @__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: [
2332
2316
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
2333
2317
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
2334
- k && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: k.label }),
2335
- ve && et && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 sm:ml-auto", children: [
2336
- /* @__PURE__ */ n(Ie, { label: ve.label, color: ve.color, small: !0 }),
2337
- /* @__PURE__ */ n(Et, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2338
- /* @__PURE__ */ n(Ie, { label: et.label, color: et.color, small: !0 })
2318
+ ce && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: ce.label }),
2319
+ se && Nt && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 sm:ml-auto", children: [
2320
+ /* @__PURE__ */ n(Ie, { label: se.label, color: se.color, small: !0 }),
2321
+ /* @__PURE__ */ n(Ut, { className: "h-3 w-3 shrink-0 text-slate-300" }),
2322
+ /* @__PURE__ */ n(Ie, { label: Nt.label, color: Nt.color, small: !0 })
2339
2323
  ] })
2340
2324
  ] }),
2341
- /* @__PURE__ */ n(mr, { landing: Be }),
2342
- /* @__PURE__ */ n(tr, { collection: e, item: String(t), tx: k }),
2343
- /* @__PURE__ */ n(ur, { collection: e, item: t, omitLines: R }),
2344
- /* @__PURE__ */ n(er, { lines: R }),
2345
- /* @__PURE__ */ n(Wn, { changes: te }),
2325
+ /* @__PURE__ */ n(ur, { landing: Le }),
2326
+ /* @__PURE__ */ n(nr, { collection: e, item: String(t), tx: ce }),
2327
+ /* @__PURE__ */ n(pr, { collection: e, item: t, omitLines: O }),
2328
+ /* @__PURE__ */ n(tr, { lines: O }),
2329
+ /* @__PURE__ */ n(Kn, { changes: ne }),
2346
2330
  /* @__PURE__ */ n(
2347
2331
  "input",
2348
2332
  {
2349
2333
  type: "text",
2350
- value: ie,
2351
- onChange: (u) => de(u.target.value),
2352
- placeholder: String((k == null ? void 0 : k.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2334
+ value: oe,
2335
+ onChange: (c) => pe(c.target.value),
2336
+ placeholder: String((ce == null ? void 0 : ce.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
2353
2337
  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"
2354
2338
  }
2355
2339
  ),
2356
2340
  /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
2357
2341
  /* @__PURE__ */ n(
2358
- fe,
2342
+ ve,
2359
2343
  {
2360
2344
  type: "button",
2361
2345
  size: "sm",
2362
2346
  variant: "ghost",
2363
2347
  className: "h-7 text-[12px]",
2364
2348
  onClick: () => {
2365
- te.length > 0 && ce.review(), I(null);
2349
+ ne.length > 0 && fe.review(), j(null);
2366
2350
  },
2367
- children: te.length > 0 ? "Review" : "Cancel"
2351
+ children: ne.length > 0 ? "Review" : "Cancel"
2368
2352
  }
2369
2353
  ),
2370
2354
  /* @__PURE__ */ n(
2371
- fe,
2355
+ ve,
2372
2356
  {
2373
2357
  type: "button",
2374
2358
  size: "sm",
2375
2359
  className: "h-7 gap-1.5 text-[12px]",
2376
- disabled: X.isPending || !!Oe || String((k == null ? void 0 : k.comment_mode) ?? "") === "required" && ie.trim() === "",
2377
- onClick: () => oe({
2378
- transition_id: Z,
2379
- comment: ie.trim() || void 0
2360
+ disabled: G.isPending || !!Be || String((ce == null ? void 0 : ce.comment_mode) ?? "") === "required" && oe.trim() === "",
2361
+ onClick: () => le({
2362
+ transition_id: J,
2363
+ comment: oe.trim() || void 0
2380
2364
  }),
2381
- children: X.isPending ? /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Te, { children: [
2382
- /* @__PURE__ */ n("span", { children: te.length > 0 ? "Continue" : R.length > 0 && k ? `${k.label} anyway` : "Confirm" }),
2383
- /* @__PURE__ */ n(vt, { className: "h-3 w-3" })
2365
+ children: G.isPending ? /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(qe, { children: [
2366
+ /* @__PURE__ */ n("span", { children: ne.length > 0 ? "Continue" : O.length > 0 && ce ? `${ce.label} anyway` : "Confirm" }),
2367
+ /* @__PURE__ */ n(yt, { className: "h-3 w-3" })
2384
2368
  ] })
2385
2369
  }
2386
2370
  )
2387
2371
  ] })
2388
2372
  ] });
2389
- return /* @__PURE__ */ s(Te, { children: [
2373
+ return /* @__PURE__ */ s(qe, { children: [
2390
2374
  /* @__PURE__ */ s(
2391
2375
  "div",
2392
2376
  {
2393
- className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${T ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
2377
+ className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${M ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
2394
2378
  children: [
2395
2379
  /* @__PURE__ */ s(
2396
2380
  "div",
2397
2381
  {
2398
- onClick: () => $((u) => !u),
2382
+ onClick: () => $((c) => !c),
2399
2383
  className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 max-sm:flex-wrap max-sm:gap-y-2 dark:hover:bg-white/[0.02]",
2400
2384
  children: [
2401
- /* @__PURE__ */ n(St, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
2385
+ /* @__PURE__ */ n(Mt, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
2402
2386
  /* @__PURE__ */ n("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: a || "Pipeline" }),
2403
2387
  /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 sm:flex-1 max-sm:order-last max-sm:w-full max-sm:pl-6", children: [
2404
- T && /* @__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" }),
2405
- ve && /* @__PURE__ */ s("span", { className: "inline-flex min-w-0 max-w-full flex-wrap items-center gap-x-1.5 gap-y-1", children: [
2406
- /* @__PURE__ */ n(Ie, { label: ve.label, color: ve.color }),
2407
- !(x != null && x.completed_at) && /* @__PURE__ */ n(
2408
- Er,
2388
+ M && /* @__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" }),
2389
+ se && /* @__PURE__ */ s("span", { className: "inline-flex min-w-0 max-w-full flex-wrap items-center gap-x-1.5 gap-y-1", children: [
2390
+ /* @__PURE__ */ n(Ie, { label: se.label, color: se.color }),
2391
+ !(T != null && T.completed_at) && /* @__PURE__ */ n(
2392
+ Ir,
2409
2393
  {
2410
2394
  className: "shrink-0",
2411
- stepLabel: ve.label,
2412
- enteredAt: Cr(
2413
- x == null ? void 0 : x.current_state,
2414
- se,
2415
- (x == null ? void 0 : x.started_at) ?? null
2395
+ stepLabel: se.label,
2396
+ enteredAt: Mr(
2397
+ T == null ? void 0 : T.current_state,
2398
+ K,
2399
+ (T == null ? void 0 : T.started_at) ?? null
2416
2400
  )
2417
2401
  }
2418
2402
  )
2419
2403
  ] }),
2420
- /* @__PURE__ */ n(wa, { flags: l == null ? void 0 : l.flags }),
2421
- (((Vt = l == null ? void 0 : l.auto_held) == null ? void 0 : Vt.length) ?? 0) > 0 && /* @__PURE__ */ s(
2404
+ /* @__PURE__ */ n(Ta, { flags: l == null ? void 0 : l.flags }),
2405
+ (((Xt = l == null ? void 0 : l.auto_held) == null ? void 0 : Xt.length) ?? 0) > 0 && /* @__PURE__ */ s(
2422
2406
  "span",
2423
2407
  {
2424
2408
  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",
2425
- "data-tip": ((l == null ? void 0 : l.auto_held) ?? []).map((u) => `${u.transition_label ?? "Automatic move"}: ${u.error ?? "refused"}`).join(`
2409
+ "data-tip": ((l == null ? void 0 : l.auto_held) ?? []).map(
2410
+ (c) => `${c.transition_label ?? "Automatic move"}: ${Ar(qr(c.error, c.transition_label)) || "refused"}`
2411
+ ).join(`
2426
2412
  `),
2427
2413
  "data-pipeline-auto-held-pill": !0,
2428
2414
  children: [
2429
- /* @__PURE__ */ n(dn, { className: "h-3 w-3 shrink-0" }),
2415
+ /* @__PURE__ */ n(mn, { className: "h-3 w-3 shrink-0" }),
2430
2416
  "Needs a person"
2431
2417
  ]
2432
2418
  }
2433
2419
  ),
2434
- y && /* @__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: [
2420
+ w && /* @__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: [
2435
2421
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
2436
2422
  "Addendum in review"
2437
2423
  ] }),
@@ -2442,36 +2428,36 @@ function qa({
2442
2428
  "data-pipeline-approving": !0,
2443
2429
  children: [
2444
2430
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
2445
- Mr(D, "approving")
2431
+ Or(D, "approving")
2446
2432
  ]
2447
2433
  }
2448
2434
  )
2449
2435
  ] }),
2450
- /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", onClick: (u) => u.stopPropagation(), children: [
2451
- !p && kt && !m && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: Wt(yt, !0) }),
2452
- !p && !x && (l == null ? void 0 : l.binding) && /* @__PURE__ */ s(
2453
- fe,
2436
+ /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", onClick: (c) => c.stopPropagation(), children: [
2437
+ !p && St && !u && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: zt(lt, !0) }),
2438
+ !p && !T && (l == null ? void 0 : l.binding) && /* @__PURE__ */ s(
2439
+ ve,
2454
2440
  {
2455
2441
  size: "sm",
2456
2442
  variant: "outline",
2457
2443
  className: "h-7 gap-1.5 text-[11px]",
2458
- onClick: (u) => {
2459
- u.stopPropagation(), le.mutate();
2444
+ onClick: (c) => {
2445
+ c.stopPropagation(), de.mutate();
2460
2446
  },
2461
- disabled: le.isPending,
2447
+ disabled: de.isPending,
2462
2448
  children: [
2463
- le.isPending ? /* @__PURE__ */ n(Ae, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(St, { className: "h-3 w-3" }),
2449
+ de.isPending ? /* @__PURE__ */ n(Fe, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(Mt, { className: "h-3 w-3" }),
2464
2450
  "Start"
2465
2451
  ]
2466
2452
  }
2467
2453
  ),
2468
2454
  i && ((l == null ? void 0 : l.binding) || (l == null ? void 0 : l.instance)) && /* @__PURE__ */ n(
2469
- Ma,
2455
+ Ba,
2470
2456
  {
2471
2457
  collection: e,
2472
2458
  item: t,
2473
- states: Y ?? [],
2474
- currentStateId: ((Gt = l == null ? void 0 : l.instance) == null ? void 0 : Gt.current_state) ?? null,
2459
+ states: he ?? [],
2460
+ currentStateId: ((Jt = l == null ? void 0 : l.instance) == null ? void 0 : Jt.current_state) ?? null,
2475
2461
  history: (l == null ? void 0 : l.history) ?? []
2476
2462
  }
2477
2463
  )
@@ -2482,14 +2468,14 @@ function qa({
2482
2468
  type: "button",
2483
2469
  "aria-expanded": p,
2484
2470
  "aria-label": `${p ? "Collapse" : "Expand"} ${a || "Pipeline"}`,
2485
- onClick: (u) => {
2486
- u.stopPropagation(), $((A) => !A);
2471
+ onClick: (c) => {
2472
+ c.stopPropagation(), $((y) => !y);
2487
2473
  },
2488
2474
  className: "shrink-0 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan max-sm:ml-auto",
2489
2475
  children: /* @__PURE__ */ n(
2490
- Ge,
2476
+ Ye,
2491
2477
  {
2492
- className: ne(
2478
+ className: re(
2493
2479
  "block h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
2494
2480
  p && "rotate-180"
2495
2481
  )
@@ -2500,46 +2486,45 @@ function qa({
2500
2486
  ]
2501
2487
  }
2502
2488
  ),
2503
- !pr && Kt(!1),
2504
- !p && Z && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: zt }),
2505
- !p && _t && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: _t }),
2506
- Qt && !(x != null && x.completed_at) && /* @__PURE__ */ n(_a, { entry: Qt }),
2489
+ !gr && Ht(!1),
2490
+ !p && J && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Gt }),
2491
+ !p && $t && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: $t }),
2492
+ Vt && !(T != null && T.completed_at) && /* @__PURE__ */ n(qa, { entry: Vt }),
2507
2493
  p && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
2508
- /* @__PURE__ */ n(pa, { held: (l == null ? void 0 : l.auto_held) ?? [] }),
2509
- y && /* @__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: [
2494
+ w && /* @__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: [
2510
2495
  /* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
2511
2496
  /* @__PURE__ */ n("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
2512
2497
  ] }),
2513
- x ? /* @__PURE__ */ s("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2514
- (Y ?? []).length > 1 && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2515
- qe ? (
2498
+ T ? /* @__PURE__ */ s("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
2499
+ (he ?? []).length > 1 && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2500
+ Oe ? (
2516
2501
  // Path pruning arrives with the owners query — rendering
2517
2502
  // the UNPRUNED track first meant every state briefly
2518
2503
  // showed, then snapped into formation. Hold a same-height
2519
2504
  // placeholder until the real shape is known.
2520
2505
  /* @__PURE__ */ s("div", { className: "flex h-[52px] items-center gap-2", children: [
2521
- [0, 1, 2, 3, 4].map((u) => /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
2506
+ [0, 1, 2, 3, 4].map((c) => /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
2522
2507
  /* @__PURE__ */ n(Ue, { className: "h-7 w-7 rounded-full" }),
2523
- u < 4 && /* @__PURE__ */ n(Ue, { className: "h-0.5 w-10" })
2524
- ] }, u)),
2508
+ c < 4 && /* @__PURE__ */ n(Ue, { className: "h-0.5 w-10" })
2509
+ ] }, c)),
2525
2510
  /* @__PURE__ */ n(Ue, { className: "ml-2 h-3 w-24" })
2526
2511
  ] })
2527
2512
  ) : /* @__PURE__ */ n(
2528
- Ca,
2513
+ Aa,
2529
2514
  {
2530
- states: Y,
2515
+ states: he,
2531
2516
  allTransitions: (l == null ? void 0 : l.all_transitions) ?? [],
2532
- availableTransitions: O ?? [],
2533
- currentStateId: x.current_state,
2534
- history: se ?? [],
2535
- onPathIds: c,
2536
- skippedStates: j,
2537
- travel: M,
2517
+ availableTransitions: ie ?? [],
2518
+ currentStateId: T.current_state,
2519
+ history: K ?? [],
2520
+ onPathIds: m,
2521
+ skippedStates: W,
2522
+ travel: P,
2538
2523
  onShowHistory: () => {
2539
- _e(!0), requestAnimationFrame(
2524
+ Se(!0), requestAnimationFrame(
2540
2525
  () => {
2541
- var u;
2542
- return (u = G.current) == null ? void 0 : u.scrollIntoView({
2526
+ var c;
2527
+ return (c = Y.current) == null ? void 0 : c.scrollIntoView({
2543
2528
  block: "nearest",
2544
2529
  behavior: "smooth"
2545
2530
  });
@@ -2548,57 +2533,57 @@ function qa({
2548
2533
  }
2549
2534
  }
2550
2535
  ),
2551
- (l == null ? void 0 : l.branches) && /* @__PURE__ */ n(Gr, { data: l.branches }),
2536
+ (l == null ? void 0 : l.branches) && /* @__PURE__ */ n(ea, { data: l.branches }),
2552
2537
  /* @__PURE__ */ n(
2553
- Sa,
2538
+ Oa,
2554
2539
  {
2555
- history: se ?? [],
2556
- completedAt: x.completed_at,
2540
+ history: K ?? [],
2541
+ completedAt: T.completed_at,
2557
2542
  collection: e,
2558
2543
  item: String(t)
2559
2544
  }
2560
2545
  )
2561
2546
  ] }),
2562
2547
  /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2563
- !x.completed_at && /* @__PURE__ */ n(la, { collection: e, itemId: String(t) }),
2564
- !x.completed_at && /* @__PURE__ */ n(ra, { summaries: l == null ? void 0 : l.sign_offs }),
2548
+ !T.completed_at && /* @__PURE__ */ n(xa, { collection: e, itemId: String(t) }),
2549
+ !T.completed_at && /* @__PURE__ */ n(ma, { summaries: l == null ? void 0 : l.sign_offs }),
2565
2550
  /* @__PURE__ */ n(
2566
- Ta,
2551
+ Da,
2567
2552
  {
2568
2553
  collection: e,
2569
2554
  item: t,
2570
- states: Y ?? [],
2571
- currentStateId: ((Xt = l == null ? void 0 : l.instance) == null ? void 0 : Xt.current_state) ?? null,
2555
+ states: he ?? [],
2556
+ currentStateId: ((Zt = l == null ? void 0 : l.instance) == null ? void 0 : Zt.current_state) ?? null,
2572
2557
  returned: ((l == null ? void 0 : l.history) ?? []).some(
2573
- (u) => {
2574
- var A;
2575
- return !!u.from_state && u.to_state === ((A = l == null ? void 0 : l.instance) == null ? void 0 : A.current_state);
2558
+ (c) => {
2559
+ var y;
2560
+ return !!c.from_state && c.to_state === ((y = l == null ? void 0 : l.instance) == null ? void 0 : y.current_state);
2576
2561
  }
2577
2562
  ),
2578
2563
  standInReason: (l == null ? void 0 : l.stand_in_reason) ?? null
2579
2564
  }
2580
2565
  )
2581
2566
  ] }),
2582
- kt && !v && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2583
- Kt(!0),
2584
- /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: Wt(yt) }),
2585
- Z && zt,
2586
- _t
2567
+ St && !x && /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-4", children: [
2568
+ Ht(!0),
2569
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap justify-end gap-2", children: zt(lt) }),
2570
+ J && Gt,
2571
+ $t
2587
2572
  ] }),
2588
- /* @__PURE__ */ s("div", { className: "px-5 py-3", ref: G, children: [
2573
+ /* @__PURE__ */ s("div", { className: "px-5 py-3", ref: Y, children: [
2589
2574
  /* @__PURE__ */ s(
2590
2575
  "button",
2591
2576
  {
2592
2577
  type: "button",
2593
2578
  className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
2594
- onClick: () => _e((u) => !u),
2579
+ onClick: () => Se((c) => !c),
2595
2580
  children: [
2596
2581
  /* @__PURE__ */ n(
2597
- Ge,
2582
+ Ye,
2598
2583
  {
2599
- className: ne(
2584
+ className: re(
2600
2585
  "h-3.5 w-3.5 transition-transform duration-200",
2601
- ge && "rotate-180"
2586
+ ye && "rotate-180"
2602
2587
  )
2603
2588
  }
2604
2589
  ),
@@ -2606,32 +2591,32 @@ function qa({
2606
2591
  " ",
2607
2592
  /* @__PURE__ */ s("span", { className: "tabular-nums", children: [
2608
2593
  "(",
2609
- (se == null ? void 0 : se.length) ?? 0,
2594
+ (K == null ? void 0 : K.length) ?? 0,
2610
2595
  ")"
2611
2596
  ] })
2612
2597
  ]
2613
2598
  }
2614
2599
  ),
2615
- ge && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(
2616
- $a,
2600
+ ye && /* @__PURE__ */ n("div", { className: "mt-3", children: /* @__PURE__ */ n(
2601
+ Fa,
2617
2602
  {
2618
- history: se ?? [],
2603
+ history: K ?? [],
2619
2604
  collection: e,
2620
2605
  item: String(t),
2621
- completedAt: x.completed_at
2606
+ completedAt: T.completed_at
2622
2607
  }
2623
2608
  ) })
2624
2609
  ] }),
2625
- q && (Y ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: re, children: /* @__PURE__ */ n(
2626
- ea,
2610
+ q && (he ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "px-5 py-3", ref: ae, children: /* @__PURE__ */ n(
2611
+ oa,
2627
2612
  {
2628
2613
  collection: e,
2629
2614
  item: t,
2630
- states: Y ?? [],
2631
- currentStateId: x.current_state ?? null,
2615
+ states: he ?? [],
2616
+ currentStateId: T.current_state ?? null,
2632
2617
  openSignal: V,
2633
2618
  onMoved: () => {
2634
- S.invalidateQueries({ queryKey: z }), S.invalidateQueries({
2619
+ N.invalidateQueries({ queryKey: H }), N.invalidateQueries({
2635
2620
  queryKey: ["pipeline-instance", e, t]
2636
2621
  });
2637
2622
  }
@@ -2640,15 +2625,15 @@ function qa({
2640
2625
  ] }) : /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
2641
2626
  /* @__PURE__ */ n("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
2642
2627
  /* @__PURE__ */ s(
2643
- fe,
2628
+ ve,
2644
2629
  {
2645
2630
  size: "sm",
2646
2631
  variant: "outline",
2647
2632
  className: "shrink-0 gap-1.5 text-[12px]",
2648
- onClick: () => le.mutate(),
2649
- disabled: le.isPending,
2633
+ onClick: () => de.mutate(),
2634
+ disabled: de.isPending,
2650
2635
  children: [
2651
- le.isPending ? /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(St, { className: "h-3.5 w-3.5" }),
2636
+ de.isPending ? /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(Mt, { className: "h-3.5 w-3.5" }),
2652
2637
  "Start Pipeline"
2653
2638
  ]
2654
2639
  }
@@ -2658,140 +2643,140 @@ function qa({
2658
2643
  ]
2659
2644
  }
2660
2645
  ),
2661
- w && /* @__PURE__ */ n(pn, { fallback: null, children: /* @__PURE__ */ n(
2662
- Kn,
2646
+ v && /* @__PURE__ */ n(hn, { fallback: null, children: /* @__PURE__ */ n(
2647
+ Qn,
2663
2648
  {
2664
- payload: w.payload,
2665
- transitionId: w.transitionId,
2666
- isRetry: w.revision > 1,
2649
+ payload: v.payload,
2650
+ transitionId: v.transitionId,
2651
+ isRetry: v.revision > 1,
2667
2652
  onSubmitted: () => (
2668
2653
  // mutateAsync so the dialog can stay busy until the transition
2669
2654
  // settles; the mutation's own onError/onSuccess handle the outcome.
2670
- X.mutateAsync({
2671
- transition_id: w.transitionId,
2672
- comment: w.comment,
2655
+ G.mutateAsync({
2656
+ transition_id: v.transitionId,
2657
+ comment: v.comment,
2673
2658
  reviewed: !0
2674
2659
  }).catch(() => {
2675
2660
  })
2676
2661
  ),
2677
- executing: X.isPending,
2662
+ executing: G.isPending,
2678
2663
  onClose: () => g(null)
2679
2664
  },
2680
- w.revision
2665
+ v.revision
2681
2666
  ) })
2682
2667
  ] });
2683
2668
  }
2684
- function qs({
2669
+ function js({
2685
2670
  collection: e,
2686
2671
  item: t,
2687
2672
  onBeforeTransition: r,
2688
2673
  wrap: a = !0,
2689
2674
  asRole: i,
2690
- asUser: m
2675
+ asUser: u
2691
2676
  }) {
2692
2677
  return t === "new" ? null : /* @__PURE__ */ n(
2693
- Pa,
2678
+ La,
2694
2679
  {
2695
2680
  collection: e,
2696
2681
  item: t,
2697
2682
  onBeforeTransition: r,
2698
2683
  wrap: a,
2699
2684
  asRole: i,
2700
- asUser: m
2685
+ asUser: u
2701
2686
  }
2702
2687
  );
2703
2688
  }
2704
- function Pa({
2689
+ function La({
2705
2690
  collection: e,
2706
2691
  item: t,
2707
2692
  onBeforeTransition: r,
2708
2693
  wrap: a = !0,
2709
2694
  asRole: i,
2710
- asUser: m
2695
+ asUser: u
2711
2696
  }) {
2712
- const v = !!i || !!m, b = We(), y = Ze(), [T, h] = J(""), [P, N] = J(null), [_, S] = J(null), [q, V] = J(null), [B, re] = J(null), [ie, de] = J([]), Z = Zn(e, String(t)), [I, ge] = J([]), _e = jn(e, String(t));
2713
- wn(e, t, "transition", !!P || !!_), bn(e, t, { hold: !!P || !!_ });
2714
- const G = he(null), p = Ur(G, !a), $ = he(!1), w = (d) => {
2715
- $.current || v || ($.current = !0, V(null), te.mutate(d, {
2716
- onSettled: (f, M) => {
2717
- if (M) {
2697
+ const x = !!i || !!u, b = Ke(), w = et(), [M, h] = X(""), [R, _] = X(null), [k, N] = X(null), [q, V] = X(null), [L, ae] = X(null), [oe, pe] = X([]), J = er(e, String(t)), [j, ye] = X([]), Se = Wn(e, String(t));
2698
+ kn(e, t, "transition", !!R || !!k), vn(e, t, { hold: !!R || !!k });
2699
+ const Y = we(null), p = Qr(Y, !a), $ = we(!1), v = (d) => {
2700
+ $.current || x || ($.current = !0, V(null), ne.mutate(d, {
2701
+ onSettled: (f, P) => {
2702
+ if (P) {
2718
2703
  $.current = !1;
2719
2704
  return;
2720
2705
  }
2721
- be().finally(() => {
2706
+ ke().finally(() => {
2722
2707
  $.current = !1;
2723
2708
  });
2724
2709
  }
2725
2710
  }));
2726
2711
  }, g = async (d, f) => {
2727
- var se, Y;
2712
+ var T, ie;
2728
2713
  if ($.current) return;
2729
- if (v) {
2714
+ if (x) {
2730
2715
  ee.info(
2731
2716
  o != null && o.as_user ? `Previewing as ${o.as_user.name}: moves are not made from a preview.` : "Previewing as a role: moves are not made from a preview."
2732
2717
  );
2733
2718
  return;
2734
2719
  }
2735
2720
  if (o != null && o.running_move) return;
2736
- if (P === d) {
2737
- N(null);
2721
+ if (R === d) {
2722
+ _(null);
2738
2723
  return;
2739
2724
  }
2740
- if (!(f != null && f.cleared) && ((o == null ? void 0 : o.available_transitions) ?? []).some((W) => W.id === d && W.advisory)) {
2741
- N(null), V(null), re(d), y.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
2725
+ if (!(f != null && f.cleared) && ((o == null ? void 0 : o.available_transitions) ?? []).some((K) => K.id === d && K.advisory)) {
2726
+ _(null), V(null), ae(d), w.invalidateQueries({ queryKey: ["pipeline-instance", e, t] });
2742
2727
  return;
2743
2728
  }
2744
- if (re(null), r) {
2729
+ if (ae(null), r) {
2745
2730
  $.current = !0;
2746
- let W = !1;
2731
+ let K = !1;
2747
2732
  try {
2748
- W = await r();
2733
+ K = await r();
2749
2734
  } finally {
2750
2735
  $.current = !1;
2751
2736
  }
2752
- if (!W) return;
2737
+ if (!K) return;
2753
2738
  }
2754
2739
  {
2755
2740
  $.current = !0;
2756
- let W = [];
2741
+ let K = [];
2757
2742
  try {
2758
- W = await _e.check();
2743
+ K = await Se.check();
2759
2744
  } finally {
2760
2745
  $.current = !1;
2761
2746
  }
2762
- if (ge(W), W.length > 0) {
2763
- de([]), N(d);
2747
+ if (ye(K), K.length > 0) {
2748
+ pe([]), _(d);
2764
2749
  return;
2765
2750
  }
2766
2751
  }
2767
- const M = (D ?? []).find((W) => W.id === d), x = String((M == null ? void 0 : M.comment_mode) ?? "none"), O = Ut(M, (o == null ? void 0 : o.states) ?? [], (se = o == null ? void 0 : o.instance) == null ? void 0 : se.current_state);
2768
- if (x !== "optional" && x !== "required") {
2769
- if (M && !it(M, (o == null ? void 0 : o.states) ?? [], (Y = o == null ? void 0 : o.instance) == null ? void 0 : Y.current_state)) {
2752
+ const P = (D ?? []).find((K) => K.id === d), I = String((P == null ? void 0 : P.comment_mode) ?? "none"), E = Wt(P, (o == null ? void 0 : o.states) ?? [], (T = o == null ? void 0 : o.instance) == null ? void 0 : T.current_state);
2753
+ if (I !== "optional" && I !== "required") {
2754
+ if (P && !ot(P, (o == null ? void 0 : o.states) ?? [], (ie = o == null ? void 0 : o.instance) == null ? void 0 : ie.current_state)) {
2770
2755
  $.current = !0;
2771
- let W = [];
2756
+ let K = [];
2772
2757
  try {
2773
- W = await Z();
2758
+ K = await J();
2774
2759
  } finally {
2775
2760
  $.current = !1;
2776
2761
  }
2777
- if (W.length > 0 || O) {
2778
- de(W), N(d);
2762
+ if (K.length > 0 || E) {
2763
+ pe(K), _(d);
2779
2764
  return;
2780
2765
  }
2781
2766
  }
2782
- if (O) {
2783
- de([]), N(d);
2767
+ if (E) {
2768
+ pe([]), _(d);
2784
2769
  return;
2785
2770
  }
2786
- w({ transition_id: d });
2771
+ v({ transition_id: d });
2787
2772
  return;
2788
2773
  }
2789
- de([]), N(d);
2790
- }, C = m ? ["pipeline-instance", e, t, "as-user", m] : i ? ["pipeline-instance", e, t, i] : ["pipeline-instance", e, t], { settling: K, settle: be } = Gn(C), { data: o } = $e({
2774
+ pe([]), _(d);
2775
+ }, C = u ? ["pipeline-instance", e, t, "as-user", u] : i ? ["pipeline-instance", e, t, i] : ["pipeline-instance", e, t], { settling: Q, settle: ke } = Yn(C), { data: o } = Pe({
2791
2776
  queryKey: C,
2792
2777
  queryFn: () => b.request(
2793
- Fe(
2794
- `/pipelines/instance/${e}/${t}${m ? `?as_user=${encodeURIComponent(m)}` : i ? `?as_role=${encodeURIComponent(i)}` : ""}`
2778
+ De(
2779
+ `/pipelines/instance/${e}/${t}${u ? `?as_user=${encodeURIComponent(u)}` : i ? `?as_role=${encodeURIComponent(i)}` : ""}`
2795
2780
  )
2796
2781
  ).then(
2797
2782
  (d) => d.data ?? {
@@ -2804,210 +2789,210 @@ function Pa({
2804
2789
  }
2805
2790
  ),
2806
2791
  staleTime: 1e4,
2807
- refetchInterval: (d) => Tn(d.state.data)
2792
+ refetchInterval: (d) => Pn(d.state.data)
2808
2793
  });
2809
- Mn(!!(o != null && o.running_move), () => {
2810
- Xe(y, e, String(t)), Ye(y, e, String(t)), xt(y, e, String(t));
2794
+ qn(!!(o != null && o.running_move), () => {
2795
+ Xe(w, e, String(t)), Je(w, e, String(t)), wt(w, e, String(t));
2811
2796
  });
2812
- const R = Xn(
2797
+ const O = Xn(
2813
2798
  o ? (o.available_transitions ?? []).map((d) => String(d.id)) : null,
2814
2799
  `${e}:${t}`
2815
- ), { data: L } = $e({
2800
+ ), { data: U } = Pe({
2816
2801
  queryKey: ["pipeline-all-owners", e, t],
2817
2802
  queryFn: () => b.request(
2818
- Fe(`/pipelines/instance/${e}/${t}/owners/all`)
2803
+ De(`/pipelines/instance/${e}/${t}/owners/all`)
2819
2804
  ).then((d) => d.data ?? null),
2820
2805
  // Also while a move is being confirmed: the panel names where it really lands.
2821
- enabled: nr(o) || !!P,
2806
+ enabled: rr(o) || !!R,
2822
2807
  staleTime: 3e4
2823
- }), Me = gt(() => {
2824
- if (!L) return null;
2808
+ }), Re = xt(() => {
2809
+ if (!U) return null;
2825
2810
  const d = /* @__PURE__ */ new Map();
2826
- for (const [f, M] of Object.entries(L))
2827
- M.skipped && d.set(f, M.skip_reasons ?? []);
2811
+ for (const [f, P] of Object.entries(U))
2812
+ P.skipped && d.set(f, P.skip_reasons ?? []);
2828
2813
  return d;
2829
- }, [L]), te = Je({
2814
+ }, [U]), ne = Ze({
2830
2815
  mutationFn: ({
2831
2816
  transition_id: d,
2832
2817
  comment: f,
2833
- reviewed: M,
2834
- lock_ack: x
2835
- }) => v ? Promise.reject(new Error("Moves are not made from a preview")) : b.request(
2836
- st(`/pipelines/instance/${e}/${t}/transition`, {
2818
+ reviewed: P,
2819
+ lock_ack: I
2820
+ }) => x ? Promise.reject(new Error("Moves are not made from a preview")) : b.request(
2821
+ it(`/pipelines/instance/${e}/${t}/transition`, {
2837
2822
  transition_id: d,
2838
2823
  comment: f,
2839
- ...M ? { reviewed: !0 } : {},
2840
- ...x ? { lock_ack: !0 } : {},
2841
- ...Pn(o == null ? void 0 : o.available_transitions, d)
2824
+ ...P ? { reviewed: !0 } : {},
2825
+ ...I ? { lock_ack: !0 } : {},
2826
+ ...On(o == null ? void 0 : o.available_transitions, d)
2842
2827
  })
2843
2828
  ),
2844
2829
  onMutate: (d) => {
2845
2830
  var f;
2846
2831
  return {
2847
- slow: sr(
2832
+ slow: ir(
2848
2833
  (f = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2849
- (M) => M.id === d.transition_id
2834
+ (P) => P.id === d.transition_id
2850
2835
  )) == null ? void 0 : f.label
2851
2836
  )
2852
2837
  };
2853
2838
  },
2854
- onSuccess: (d, f, M) => {
2855
- y.invalidateQueries({ queryKey: C }), e === "nivaro_addendums" && y.invalidateQueries({ queryKey: ["addendums"] }), Xe(y, e, String(t)), Ye(y, e, String(t)), xt(y, e, String(t)), V(null), h(""), N(null), S(null);
2856
- const x = qn(d);
2857
- x ? ee.info(
2858
- `${x.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2859
- M == null ? void 0 : M.slow.done()
2860
- ) : ee.success(ar(o, f.transition_id, d), M == null ? void 0 : M.slow.done());
2839
+ onSuccess: (d, f, P) => {
2840
+ w.invalidateQueries({ queryKey: C }), e === "nivaro_addendums" && w.invalidateQueries({ queryKey: ["addendums"] }), Xe(w, e, String(t)), Je(w, e, String(t)), wt(w, e, String(t)), V(null), h(""), _(null), N(null);
2841
+ const I = Rn(d);
2842
+ I ? ee.info(
2843
+ `${I.transition_label ?? "The move"} started. You will be told if it does not go through.`,
2844
+ P == null ? void 0 : P.slow.done()
2845
+ ) : ee.success(sr(o, f.transition_id, d), P == null ? void 0 : P.slow.done());
2861
2846
  },
2862
- onError: (d, f, M) => {
2863
- var W, ve;
2864
- if (M == null || M.slow.fail(), Qn(d)) {
2865
- y.invalidateQueries({ queryKey: C });
2847
+ onError: (d, f, P) => {
2848
+ var K, he;
2849
+ if (P == null || P.slow.fail(), zn(d)) {
2850
+ w.invalidateQueries({ queryKey: C });
2866
2851
  return;
2867
2852
  }
2868
- if (wt(d) === "TRANSITION_RUNNING") {
2869
- y.invalidateQueries({ queryKey: C }), N(null), S(null), ee.info(je(d, "This move is already running on this record."));
2853
+ if (kt(d) === "TRANSITION_RUNNING") {
2854
+ w.invalidateQueries({ queryKey: C }), _(null), N(null), ee.info(We(d, "This move is already running on this record."));
2870
2855
  return;
2871
2856
  }
2872
- const x = Hn(d);
2873
- if (x) {
2874
- N(null);
2875
- const k = ((W = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2876
- (we) => we.id === f.transition_id
2877
- )) == null ? void 0 : W.label) ?? "Move";
2878
- ee.warning(x.message, {
2857
+ const I = Vn(d);
2858
+ if (I) {
2859
+ _(null);
2860
+ const S = ((K = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2861
+ (se) => se.id === f.transition_id
2862
+ )) == null ? void 0 : K.label) ?? "Move";
2863
+ ee.warning(I.message, {
2879
2864
  id: `nvr-locked-move:${e}:${String(t)}`,
2880
2865
  duration: 2e4,
2881
2866
  action: {
2882
- label: `${k} anyway`,
2883
- onClick: () => w({ ...f, lock_ack: !0 })
2867
+ label: `${S} anyway`,
2868
+ onClick: () => v({ ...f, lock_ack: !0 })
2884
2869
  },
2885
2870
  cancel: { label: "Wait", onClick: () => {
2886
2871
  } }
2887
2872
  });
2888
2873
  return;
2889
2874
  }
2890
- const O = zn(d);
2891
- if (O) {
2892
- S((k) => ({
2893
- payload: O,
2875
+ const E = Hn(d);
2876
+ if (E) {
2877
+ N((S) => ({
2878
+ payload: E,
2894
2879
  transitionId: f.transition_id,
2895
2880
  comment: f.comment,
2896
- revision: ((k == null ? void 0 : k.revision) ?? 0) + 1
2881
+ revision: ((S == null ? void 0 : S.revision) ?? 0) + 1
2897
2882
  }));
2898
2883
  return;
2899
2884
  }
2900
- const se = d == null ? void 0 : d.response;
2901
- V(Vn(d, f));
2902
- const Y = xn(
2885
+ const T = d == null ? void 0 : d.response;
2886
+ V(Gn(d, f));
2887
+ const ie = wn(
2903
2888
  d,
2904
- (ve = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2905
- (k) => k.id === f.transition_id
2906
- )) == null ? void 0 : ve.label
2889
+ (he = [...(o == null ? void 0 : o.available_transitions) ?? [], ...(o == null ? void 0 : o.all_transitions) ?? []].find(
2890
+ (S) => S.id === f.transition_id
2891
+ )) == null ? void 0 : he.label
2907
2892
  );
2908
- ee.error((Y == null ? void 0 : Y.title) ?? je(d, "Failed to execute transition"), {
2893
+ ee.error((ie == null ? void 0 : ie.title) ?? We(d, "Failed to execute transition"), {
2909
2894
  duration: 12e3,
2910
2895
  // What to do next + Copy details (lib/error-toast.ts); "Why?" below wins the action slot.
2911
2896
  // A partner's refusal copies what the toast said and the other system's answer as
2912
2897
  // stored, never the generic reading of a 422.
2913
- ...gn(Y ? vn(d, Y) : d, {
2898
+ ...xn(ie ? yn(d, ie) : d, {
2914
2899
  action: "Transition"
2915
2900
  }),
2916
- ...Y ? { description: Y.description } : {},
2901
+ ...ie ? { description: ie.description } : {},
2917
2902
  // #1867: a refusal carries "Why?" — the role, owner or access rule
2918
2903
  // that stopped it, and who can change it.
2919
- ...Cn(d) ? {
2920
- action: $n(b, {
2904
+ ...Tn(d) ? {
2905
+ action: Mn(b, {
2921
2906
  collection: e,
2922
2907
  itemId: String(t),
2923
2908
  action: "transition",
2924
2909
  transitionId: f.transition_id
2925
2910
  })
2926
2911
  } : {}
2927
- }), S(null), N(null), Xe(y, e, String(t)), Ye(y, e, String(t)), (se == null ? void 0 : se.status) === 409 && y.invalidateQueries({ queryKey: C });
2912
+ }), N(null), _(null), Xe(w, e, String(t)), Je(w, e, String(t)), (T == null ? void 0 : T.status) === 409 && w.invalidateQueries({ queryKey: C });
2928
2913
  }
2929
- }), Ce = he(g);
2930
- Ce.current = g;
2931
- const ce = he((o == null ? void 0 : o.available_transitions) ?? []);
2932
- if (ce.current = (o == null ? void 0 : o.available_transitions) ?? [], Ee(() => {
2914
+ }), Te = we(g);
2915
+ Te.current = g;
2916
+ const fe = we((o == null ? void 0 : o.available_transitions) ?? []);
2917
+ if (fe.current = (o == null ? void 0 : o.available_transitions) ?? [], Ee(() => {
2933
2918
  const d = (f) => {
2934
- const M = f.detail;
2935
- if (!M || M.claimed || v || M.collection !== e || String(M.item) !== String(t)) return;
2936
- M.claimed = !0;
2937
- const x = String(M.transition_id).toUpperCase(), O = ce.current.find((se) => String(se.id).toUpperCase() === x);
2938
- if (!O) {
2919
+ const P = f.detail;
2920
+ if (!P || P.claimed || x || P.collection !== e || String(P.item) !== String(t)) return;
2921
+ P.claimed = !0;
2922
+ const I = String(P.transition_id).toUpperCase(), E = fe.current.find((T) => String(T.id).toUpperCase() === I);
2923
+ if (!E) {
2939
2924
  ee.error("That step is not available from where the record is now");
2940
2925
  return;
2941
2926
  }
2942
- Ce.current(O.id);
2927
+ Te.current(E.id);
2943
2928
  };
2944
- return window.addEventListener(bt, d), () => window.removeEventListener(bt, d);
2945
- }, [e, t, v]), !(o != null && o.binding) || !(o != null && o.instance)) return null;
2946
- const D = rr(
2929
+ return window.addEventListener(vt, d), () => window.removeEventListener(vt, d);
2930
+ }, [e, t, x]), !(o != null && o.binding) || !(o != null && o.instance)) return null;
2931
+ const D = ar(
2947
2932
  (o.available_transitions ?? []).filter(
2948
2933
  (d) => !o.instance.completed_at || d.from_state && String(d.from_state).toUpperCase() === String(o.instance.current_state).toUpperCase()
2949
2934
  ),
2950
2935
  o.states ?? [],
2951
2936
  o.instance.current_state,
2952
- o.instance.completed_at ? null : Me
2953
- ), Q = An(D, o.blocked_transitions);
2954
- if (Q.length === 0) return null;
2955
- const oe = new Map((o.states ?? []).map((d) => [d.id, d])), me = o.instance.current_state_obj ?? null, z = P ? D.find((d) => d.id === P) : null, ke = B ? D.find((d) => d.id === B) : null, ue = o.running_move ?? null, l = ue ? zr(ue) : void 0, Ke = z ? oe.get(z.to_state) : null, Ne = cr(z, me, o.states ?? [], L), xe = (Ne == null ? void 0 : Ne.state) ?? Ke, qe = /* @__PURE__ */ new Map();
2956
- for (const d of Q) {
2957
- const f = qe.get(d.label) ?? [];
2958
- f.push(d), qe.set(d.label, f);
2937
+ o.instance.completed_at ? null : Re
2938
+ ), z = Fn(D, o.blocked_transitions);
2939
+ if (z.length === 0) return null;
2940
+ const le = new Map((o.states ?? []).map((d) => [d.id, d])), be = o.instance.current_state_obj ?? null, H = R ? D.find((d) => d.id === R) : null, _e = L ? D.find((d) => d.id === L) : null, xe = o.running_move ?? null, l = xe ? Xr(xe) : void 0, Qe = H ? le.get(H.to_state) : null, Ce = mr(H, be, o.states ?? [], U), Ne = (Ce == null ? void 0 : Ce.state) ?? Qe, Oe = /* @__PURE__ */ new Map();
2941
+ for (const d of z) {
2942
+ const f = Oe.get(d.label) ?? [];
2943
+ f.push(d), Oe.set(d.label, f);
2959
2944
  }
2960
- const c = (d) => [...d].sort(
2961
- (f, M) => {
2962
- var x, O;
2963
- return (((x = oe.get(f.to_state)) == null ? void 0 : x.sort) ?? 999) - (((O = oe.get(M.to_state)) == null ? void 0 : O.sort) ?? 999);
2945
+ const m = (d) => [...d].sort(
2946
+ (f, P) => {
2947
+ var I, E;
2948
+ return (((I = le.get(f.to_state)) == null ? void 0 : I.sort) ?? 999) - (((E = le.get(P.to_state)) == null ? void 0 : E.sort) ?? 999);
2964
2949
  }
2965
- ), j = (d) => {
2950
+ ), W = (d) => {
2966
2951
  var f;
2967
- return ((f = oe.get(d.to_state)) == null ? void 0 : f.label) ?? d.to_state;
2968
- }, le = (() => {
2969
- var M, x, O;
2970
- const d = (M = G.current) == null ? void 0 : M.getBoundingClientRect();
2952
+ return ((f = le.get(d.to_state)) == null ? void 0 : f.label) ?? d.to_state;
2953
+ }, de = (() => {
2954
+ var P, I, E;
2955
+ const d = (P = Y.current) == null ? void 0 : P.getBoundingClientRect();
2971
2956
  if (!d) return 600;
2972
- const f = (O = (x = G.current) == null ? void 0 : x.closest('[role="dialog"]')) == null ? void 0 : O.getBoundingClientRect();
2957
+ const f = (E = (I = Y.current) == null ? void 0 : I.closest('[role="dialog"]')) == null ? void 0 : E.getBoundingClientRect();
2973
2958
  return Math.max(260, Math.min(600, d.right - ((f == null ? void 0 : f.left) ?? 0) - 12));
2974
- })(), X = (() => {
2975
- var x, O;
2976
- const d = typeof window < "u" ? window.innerWidth : 1024, f = (x = G.current) == null ? void 0 : x.getBoundingClientRect(), M = !!((O = G.current) != null && O.closest('[role="dialog"]'));
2977
- return !f || d >= 480 || M ? { width: le } : { width: d - 32, right: f.right - (d - 16) };
2959
+ })(), G = (() => {
2960
+ var I, E;
2961
+ const d = typeof window < "u" ? window.innerWidth : 1024, f = (I = Y.current) == null ? void 0 : I.getBoundingClientRect(), P = !!((E = Y.current) != null && E.closest('[role="dialog"]'));
2962
+ return !f || d >= 480 || P ? { width: de } : { width: d - 32, right: f.right - (d - 16) };
2978
2963
  })();
2979
- return /* @__PURE__ */ s("div", { ref: G, className: "relative", "data-tip": l, children: [
2980
- p ? /* @__PURE__ */ s(qt, { children: [
2981
- /* @__PURE__ */ n(Pt, { asChild: !0, children: /* @__PURE__ */ s(
2982
- fe,
2964
+ return /* @__PURE__ */ s("div", { ref: Y, className: "relative", "data-tip": l, children: [
2965
+ p ? /* @__PURE__ */ s(At, { children: [
2966
+ /* @__PURE__ */ n(Ft, { asChild: !0, children: /* @__PURE__ */ s(
2967
+ ve,
2983
2968
  {
2984
2969
  size: "sm",
2985
2970
  variant: "outline",
2986
2971
  className: "shrink-0 gap-1.5 text-[12px]",
2987
- disabled: te.isPending || K || !!ue,
2972
+ disabled: ne.isPending || Q || !!xe,
2988
2973
  "data-transitions-folded": !0,
2989
2974
  children: [
2990
- te.isPending || ue ? /* @__PURE__ */ n(Ae, { className: "h-3 w-3 animate-spin" }) : D.length > 0 && D.every((d) => d.advisory) && /* @__PURE__ */ n(Re, {}),
2975
+ ne.isPending || xe ? /* @__PURE__ */ n(Fe, { className: "h-3 w-3 animate-spin" }) : D.length > 0 && D.every((d) => d.advisory) && /* @__PURE__ */ n(Ae, {}),
2991
2976
  "Actions",
2992
- /* @__PURE__ */ n(Ge, { className: "h-3 w-3" })
2977
+ /* @__PURE__ */ n(Ye, { className: "h-3 w-3" })
2993
2978
  ]
2994
2979
  }
2995
2980
  ) }),
2996
- /* @__PURE__ */ s(Rt, { align: "end", className: "min-w-[200px]", children: [
2997
- Array.from(qe.entries()).map(
2998
- ([d, f], M, x) => f.length === 1 ? /* @__PURE__ */ s(Zt, { children: [
2999
- M > 0 && x[M - 1][1].length > 1 && /* @__PURE__ */ n(At, {}),
2981
+ /* @__PURE__ */ s(Dt, { align: "end", className: "min-w-[200px]", children: [
2982
+ Array.from(Oe.entries()).map(
2983
+ ([d, f], P, I) => f.length === 1 ? /* @__PURE__ */ s(nn, { children: [
2984
+ P > 0 && I[P - 1][1].length > 1 && /* @__PURE__ */ n(Bt, {}),
3000
2985
  /* @__PURE__ */ s(
3001
- dt,
2986
+ ct,
3002
2987
  {
3003
2988
  onSelect: () => g(f[0].id),
3004
- ...He(f[0], "menu"),
3005
- ...ft(f[0]),
2989
+ ...Ve(f[0], "menu"),
2990
+ ...ht(f[0]),
3006
2991
  children: [
3007
2992
  f[0].color && /* @__PURE__ */ n(
3008
2993
  "span",
3009
2994
  {
3010
- className: ne(
2995
+ className: re(
3011
2996
  "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
3012
2997
  f[0].blocked && "opacity-40"
3013
2998
  ),
@@ -3015,47 +3000,47 @@ function Pa({
3015
3000
  }
3016
3001
  ),
3017
3002
  d,
3018
- f[0].advisory && /* @__PURE__ */ n(Re, { className: "ml-auto" }),
3019
- f[0].blocked && /* @__PURE__ */ n(pt, {})
3003
+ f[0].advisory && /* @__PURE__ */ n(Ae, { className: "ml-auto" }),
3004
+ f[0].blocked && /* @__PURE__ */ n(ft, {})
3020
3005
  ]
3021
3006
  }
3022
3007
  )
3023
- ] }, d) : /* @__PURE__ */ s(Zt, { children: [
3024
- M > 0 && /* @__PURE__ */ n(At, {}),
3025
- /* @__PURE__ */ n(Wr, { className: "text-[11px] text-muted-foreground", children: d }),
3026
- c(f).map((O) => /* @__PURE__ */ s(
3027
- dt,
3008
+ ] }, d) : /* @__PURE__ */ s(nn, { children: [
3009
+ P > 0 && /* @__PURE__ */ n(Bt, {}),
3010
+ /* @__PURE__ */ n(Vr, { className: "text-[11px] text-muted-foreground", children: d }),
3011
+ m(f).map((E) => /* @__PURE__ */ s(
3012
+ ct,
3028
3013
  {
3029
- onSelect: () => g(O.id),
3030
- ...He(O, "menu"),
3031
- ...ft(O),
3014
+ onSelect: () => g(E.id),
3015
+ ...Ve(E, "menu"),
3016
+ ...ht(E),
3032
3017
  children: [
3033
- O.color && /* @__PURE__ */ n(
3018
+ E.color && /* @__PURE__ */ n(
3034
3019
  "span",
3035
3020
  {
3036
- className: ne(
3021
+ className: re(
3037
3022
  "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
3038
- O.blocked && "opacity-40"
3023
+ E.blocked && "opacity-40"
3039
3024
  ),
3040
- style: { backgroundColor: O.color }
3025
+ style: { backgroundColor: E.color }
3041
3026
  }
3042
3027
  ),
3043
- j(O),
3044
- O.advisory && /* @__PURE__ */ n(Re, { className: "ml-auto" }),
3045
- O.blocked && /* @__PURE__ */ n(pt, {})
3028
+ W(E),
3029
+ E.advisory && /* @__PURE__ */ n(Ae, { className: "ml-auto" }),
3030
+ E.blocked && /* @__PURE__ */ n(ft, {})
3046
3031
  ]
3047
3032
  },
3048
- O.id
3033
+ E.id
3049
3034
  ))
3050
3035
  ] }, d)
3051
3036
  ),
3052
3037
  /* @__PURE__ */ n(
3053
- Dt,
3038
+ Lt,
3054
3039
  {
3055
3040
  moves: D,
3056
3041
  nameOf: (d) => {
3057
- var f, M;
3058
- return (((f = qe.get(d.label)) == null ? void 0 : f.length) ?? 0) > 1 ? ((M = oe.get(d.to_state)) == null ? void 0 : M.label) ?? d.to_state : d.label;
3042
+ var f, P;
3043
+ return (((f = Oe.get(d.label)) == null ? void 0 : f.length) ?? 0) > 1 ? ((P = le.get(d.to_state)) == null ? void 0 : P.label) ?? d.to_state : d.label;
3059
3044
  }
3060
3045
  }
3061
3046
  )
@@ -3064,113 +3049,113 @@ function Pa({
3064
3049
  "div",
3065
3050
  {
3066
3051
  className: a ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
3067
- children: Array.from(qe.entries()).map(([d, f]) => {
3068
- var Y, W, ve;
3069
- const M = f.some((k) => {
3070
- var we;
3071
- return (((we = k.order_partners) == null ? void 0 : we.length) ?? 0) > 0;
3072
- }), x = M ? null : ((Y = f[0]) == null ? void 0 : Y.color) ?? null, O = f.some((k) => k.id === P), se = (k) => x ? k ? { backgroundColor: x, borderColor: x } : { borderColor: x, color: x } : void 0;
3073
- if (f.every(Fn)) {
3074
- const k = c(f);
3052
+ children: Array.from(Oe.entries()).map(([d, f]) => {
3053
+ var ie, K, he;
3054
+ const P = f.some((S) => {
3055
+ var se;
3056
+ return (((se = S.order_partners) == null ? void 0 : se.length) ?? 0) > 0;
3057
+ }), I = P ? null : ((ie = f[0]) == null ? void 0 : ie.color) ?? null, E = f.some((S) => S.id === R), T = (S) => I ? S ? { backgroundColor: I, borderColor: I } : { borderColor: I, color: I } : void 0;
3058
+ if (f.every(gt)) {
3059
+ const S = m(f);
3075
3060
  return /* @__PURE__ */ n(
3076
- On,
3061
+ Dn,
3077
3062
  {
3078
3063
  label: d,
3079
- code: (W = k[0].blocked) == null ? void 0 : W.code,
3080
- reason: Dn(k, (we) => j(k[we]))
3064
+ code: (K = S[0].blocked) == null ? void 0 : K.code,
3065
+ reason: Bn(S, (se) => W(S[se]))
3081
3066
  },
3082
3067
  d
3083
3068
  );
3084
3069
  }
3085
3070
  if (f.length === 1) {
3086
- const k = f[0], we = Ft(ue == null ? void 0 : ue.transition_id, k.id), Be = Rn(ue ? null : o.last_move_problem, k.id), et = te.isPending && ((ve = te.variables) == null ? void 0 : ve.transition_id) === k.id || we, tt = /* @__PURE__ */ s(
3087
- fe,
3071
+ const S = f[0], se = at(xe == null ? void 0 : xe.transition_id, S.id), ce = An(xe ? null : o.last_move_problem, S.id), _t = ne.isPending && ((he = ne.variables) == null ? void 0 : he.transition_id) === S.id || se, Le = /* @__PURE__ */ s(
3072
+ ve,
3088
3073
  {
3089
3074
  size: "sm",
3090
- variant: O && !k.advisory ? "default" : "outline",
3091
- className: ne(
3075
+ variant: E && !S.advisory ? "default" : "outline",
3076
+ className: re(
3092
3077
  "gap-1.5 text-[12px] data-[fresh=true]:opacity-60",
3093
- k.advisory && ir
3078
+ S.advisory && or
3094
3079
  ),
3095
- style: k.advisory ? void 0 : se(O),
3096
- disabled: te.isPending || K || !!ue || !!Be,
3097
- "data-move-running": we || void 0,
3098
- "aria-disabled": R.dimmed(k.id) || void 0,
3099
- "data-fresh": R.dimmed(k.id) || void 0,
3100
- ...R.bind(k.id),
3101
- ...He(k),
3080
+ style: S.advisory ? void 0 : T(E),
3081
+ disabled: ne.isPending || Q || !!xe || !!ce,
3082
+ "data-move-running": se || void 0,
3083
+ "aria-disabled": O.dimmed(S.id) || void 0,
3084
+ "data-fresh": O.dimmed(S.id) || void 0,
3085
+ ...O.bind(S.id),
3086
+ ...Ve(S),
3102
3087
  onClick: () => {
3103
- R.press(k.id) && g(k.id);
3088
+ O.press(S.id) && g(S.id);
3104
3089
  },
3105
3090
  children: [
3106
- et ? /* @__PURE__ */ n(Ae, { className: "h-3 w-3 animate-spin" }) : k.advisory ? /* @__PURE__ */ n(Re, {}) : M && /* @__PURE__ */ n(cn, { className: "h-3 w-3", "aria-hidden": !0 }),
3091
+ _t ? /* @__PURE__ */ n(Fe, { className: "h-3 w-3 animate-spin" }) : S.advisory ? /* @__PURE__ */ n(Ae, {}) : P && /* @__PURE__ */ n(un, { className: "h-3 w-3", "aria-hidden": !0 }),
3107
3092
  d
3108
3093
  ]
3109
3094
  },
3110
3095
  d
3111
3096
  );
3112
- return Be ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": Be, "data-move-held": !0, children: tt }, d) : k.pushes && k.pushes > 0 ? /* @__PURE__ */ s("span", { className: "relative inline-flex", children: [
3113
- tt,
3097
+ return ce ? /* @__PURE__ */ n("span", { className: "inline-flex", "data-tip": ce, "data-move-held": !0, children: Le }, d) : S.pushes && S.pushes > 0 ? /* @__PURE__ */ s("span", { className: "relative inline-flex", children: [
3098
+ Le,
3114
3099
  /* @__PURE__ */ n(
3115
- Br,
3100
+ jr,
3116
3101
  {
3117
3102
  collection: e,
3118
3103
  itemId: t,
3119
- transitionId: k.id,
3104
+ transitionId: S.id,
3120
3105
  label: d,
3121
3106
  compact: !0
3122
3107
  }
3123
3108
  )
3124
- ] }, d) : tt;
3109
+ ] }, d) : Le;
3125
3110
  }
3126
- return /* @__PURE__ */ s(qt, { children: [
3127
- /* @__PURE__ */ n(Pt, { asChild: !0, children: /* @__PURE__ */ s(
3128
- fe,
3111
+ return /* @__PURE__ */ s(At, { children: [
3112
+ /* @__PURE__ */ n(Ft, { asChild: !0, children: /* @__PURE__ */ s(
3113
+ ve,
3129
3114
  {
3130
3115
  size: "sm",
3131
- variant: O ? "default" : "outline",
3116
+ variant: E ? "default" : "outline",
3132
3117
  className: "gap-1.5 text-[12px]",
3133
- style: se(O),
3134
- disabled: te.isPending || K || !!ue,
3118
+ style: T(E),
3119
+ disabled: ne.isPending || Q || !!xe,
3135
3120
  children: [
3136
- f.every((k) => k.advisory) && /* @__PURE__ */ n(Re, {}),
3121
+ f.every((S) => S.advisory) && /* @__PURE__ */ n(Ae, {}),
3137
3122
  d,
3138
- /* @__PURE__ */ n(Ge, { className: "h-3 w-3" })
3123
+ /* @__PURE__ */ n(Ye, { className: "h-3 w-3" })
3139
3124
  ]
3140
3125
  }
3141
3126
  ) }),
3142
- /* @__PURE__ */ s(Rt, { align: "start", children: [
3143
- c(f).map((k) => /* @__PURE__ */ s(
3144
- dt,
3127
+ /* @__PURE__ */ s(Dt, { align: "start", children: [
3128
+ m(f).map((S) => /* @__PURE__ */ s(
3129
+ ct,
3145
3130
  {
3146
- onSelect: () => g(k.id),
3147
- ...He(k, "menu"),
3148
- ...ft(k),
3131
+ onSelect: () => g(S.id),
3132
+ ...Ve(S, "menu"),
3133
+ ...ht(S),
3149
3134
  children: [
3150
- k.color && /* @__PURE__ */ n(
3135
+ S.color && /* @__PURE__ */ n(
3151
3136
  "span",
3152
3137
  {
3153
- className: ne(
3138
+ className: re(
3154
3139
  "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
3155
- k.blocked && "opacity-40"
3140
+ S.blocked && "opacity-40"
3156
3141
  ),
3157
- style: { backgroundColor: k.color }
3142
+ style: { backgroundColor: S.color }
3158
3143
  }
3159
3144
  ),
3160
- j(k),
3161
- k.advisory && /* @__PURE__ */ n(Re, { className: "ml-auto" }),
3162
- k.blocked && /* @__PURE__ */ n(pt, {})
3145
+ W(S),
3146
+ S.advisory && /* @__PURE__ */ n(Ae, { className: "ml-auto" }),
3147
+ S.blocked && /* @__PURE__ */ n(ft, {})
3163
3148
  ]
3164
3149
  },
3165
- k.id
3150
+ S.id
3166
3151
  )),
3167
3152
  /* @__PURE__ */ n(
3168
- Dt,
3153
+ Lt,
3169
3154
  {
3170
3155
  moves: f,
3171
- nameOf: (k) => {
3172
- var we;
3173
- return ((we = oe.get(k.to_state)) == null ? void 0 : we.label) ?? k.to_state;
3156
+ nameOf: (S) => {
3157
+ var se;
3158
+ return ((se = le.get(S.to_state)) == null ? void 0 : se.label) ?? S.to_state;
3174
3159
  }
3175
3160
  }
3176
3161
  )
@@ -3179,64 +3164,64 @@ function Pa({
3179
3164
  })
3180
3165
  }
3181
3166
  ),
3182
- P && /* @__PURE__ */ s(
3167
+ R && /* @__PURE__ */ s(
3183
3168
  "div",
3184
3169
  {
3185
3170
  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",
3186
- style: X,
3171
+ style: G,
3187
3172
  children: [
3188
3173
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2", children: [
3189
3174
  /* @__PURE__ */ n("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
3190
- z && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: z.label }),
3191
- me && xe && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 sm:ml-auto", children: [
3192
- /* @__PURE__ */ n(Ie, { label: me.label, color: me.color, small: !0 }),
3193
- /* @__PURE__ */ n(Et, { className: "h-3 w-3 shrink-0 text-slate-300" }),
3194
- /* @__PURE__ */ n(Ie, { label: xe.label, color: xe.color, small: !0 })
3175
+ H && /* @__PURE__ */ n("span", { className: "text-[12px] font-medium text-slate-700", children: H.label }),
3176
+ be && Ne && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 sm:ml-auto", children: [
3177
+ /* @__PURE__ */ n(Ie, { label: be.label, color: be.color, small: !0 }),
3178
+ /* @__PURE__ */ n(Ut, { className: "h-3 w-3 shrink-0 text-slate-300" }),
3179
+ /* @__PURE__ */ n(Ie, { label: Ne.label, color: Ne.color, small: !0 })
3195
3180
  ] })
3196
3181
  ] }),
3197
- /* @__PURE__ */ n(mr, { landing: Ne }),
3198
- /* @__PURE__ */ n(tr, { collection: e, item: String(t), tx: z }),
3199
- /* @__PURE__ */ n(ur, { collection: e, item: t, omitLines: ie }),
3200
- /* @__PURE__ */ n(er, { lines: ie }),
3201
- /* @__PURE__ */ n(Wn, { changes: I }),
3182
+ /* @__PURE__ */ n(ur, { landing: Ce }),
3183
+ /* @__PURE__ */ n(nr, { collection: e, item: String(t), tx: H }),
3184
+ /* @__PURE__ */ n(pr, { collection: e, item: t, omitLines: oe }),
3185
+ /* @__PURE__ */ n(tr, { lines: oe }),
3186
+ /* @__PURE__ */ n(Kn, { changes: j }),
3202
3187
  /* @__PURE__ */ n(
3203
3188
  "input",
3204
3189
  {
3205
3190
  type: "text",
3206
- value: T,
3191
+ value: M,
3207
3192
  onChange: (d) => h(d.target.value),
3208
- placeholder: String((z == null ? void 0 : z.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
3193
+ placeholder: String((H == null ? void 0 : H.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
3209
3194
  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"
3210
3195
  }
3211
3196
  ),
3212
3197
  /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
3213
3198
  /* @__PURE__ */ n(
3214
- fe,
3199
+ ve,
3215
3200
  {
3216
3201
  type: "button",
3217
3202
  size: "sm",
3218
3203
  variant: "ghost",
3219
3204
  className: "h-7 text-[12px]",
3220
3205
  onClick: () => {
3221
- I.length > 0 && _e.review(), N(null);
3206
+ j.length > 0 && Se.review(), _(null);
3222
3207
  },
3223
- children: I.length > 0 ? "Review" : "Cancel"
3208
+ children: j.length > 0 ? "Review" : "Cancel"
3224
3209
  }
3225
3210
  ),
3226
3211
  /* @__PURE__ */ n(
3227
- fe,
3212
+ ve,
3228
3213
  {
3229
3214
  type: "button",
3230
3215
  size: "sm",
3231
3216
  className: "h-7 gap-1.5 text-[12px]",
3232
- disabled: te.isPending || !!ue || String((z == null ? void 0 : z.comment_mode) ?? "") === "required" && T.trim() === "",
3233
- onClick: () => w({
3234
- transition_id: P,
3235
- comment: T.trim() || void 0
3217
+ disabled: ne.isPending || !!xe || String((H == null ? void 0 : H.comment_mode) ?? "") === "required" && M.trim() === "",
3218
+ onClick: () => v({
3219
+ transition_id: R,
3220
+ comment: M.trim() || void 0
3236
3221
  }),
3237
- children: te.isPending ? /* @__PURE__ */ n(Ae, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(Te, { children: [
3238
- /* @__PURE__ */ n("span", { children: I.length > 0 ? "Continue" : ie.length > 0 && z ? `${z.label} anyway` : "Confirm" }),
3239
- /* @__PURE__ */ n(vt, { className: "h-3 w-3" })
3222
+ children: ne.isPending ? /* @__PURE__ */ n(Fe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ s(qe, { children: [
3223
+ /* @__PURE__ */ n("span", { children: j.length > 0 ? "Continue" : oe.length > 0 && H ? `${H.label} anyway` : "Confirm" }),
3224
+ /* @__PURE__ */ n(yt, { className: "h-3 w-3" })
3240
3225
  ] })
3241
3226
  }
3242
3227
  )
@@ -3244,83 +3229,83 @@ function Pa({
3244
3229
  ]
3245
3230
  }
3246
3231
  ),
3247
- (ke == null ? void 0 : ke.advisory) && !P && /* @__PURE__ */ n(
3248
- Bn,
3232
+ (_e == null ? void 0 : _e.advisory) && !R && /* @__PURE__ */ n(
3233
+ Ln,
3249
3234
  {
3250
3235
  floating: !0,
3251
3236
  collection: e,
3252
3237
  item: String(t),
3253
- advisory: ke.advisory,
3238
+ advisory: _e.advisory,
3254
3239
  armedMove: {
3255
- id: ke.id,
3256
- label: ke.label,
3257
- confirms: or(ke, o.states ?? [], o.instance.current_state)
3240
+ id: _e.id,
3241
+ label: _e.label,
3242
+ confirms: lr(_e, o.states ?? [], o.instance.current_state)
3258
3243
  },
3259
3244
  className: "absolute right-0 top-full z-50 mt-1",
3260
- style: X,
3261
- onDismiss: () => re(null),
3245
+ style: G,
3246
+ onDismiss: () => ae(null),
3262
3247
  onFixed: (d) => {
3263
- re(null), y.invalidateQueries({ queryKey: C }), d && g(d.id, { cleared: !0 });
3248
+ ae(null), w.invalidateQueries({ queryKey: C }), d && g(d.id, { cleared: !0 });
3264
3249
  }
3265
3250
  }
3266
3251
  ),
3267
- q && !P && /* @__PURE__ */ n(
3268
- lr,
3252
+ q && !R && /* @__PURE__ */ n(
3253
+ dr,
3269
3254
  {
3270
3255
  collection: e,
3271
3256
  item: String(t),
3272
3257
  offer: q,
3273
3258
  className: "absolute right-0 top-full z-50 mt-1 shadow-lg",
3274
- style: X,
3259
+ style: G,
3275
3260
  onDismiss: () => V(null),
3276
- onFixed: () => w({ transition_id: q.transitionId, comment: q.comment })
3261
+ onFixed: () => v({ transition_id: q.transitionId, comment: q.comment })
3277
3262
  }
3278
3263
  ),
3279
- _ && /* @__PURE__ */ n(pn, { fallback: null, children: /* @__PURE__ */ n(
3280
- Kn,
3264
+ k && /* @__PURE__ */ n(hn, { fallback: null, children: /* @__PURE__ */ n(
3265
+ Qn,
3281
3266
  {
3282
- payload: _.payload,
3283
- transitionId: _.transitionId,
3284
- isRetry: _.revision > 1,
3267
+ payload: k.payload,
3268
+ transitionId: k.transitionId,
3269
+ isRetry: k.revision > 1,
3285
3270
  onSubmitted: () => (
3286
3271
  // mutateAsync so the dialog can stay busy until the transition
3287
3272
  // settles; the mutation's own onError/onSuccess handle the outcome.
3288
- te.mutateAsync({
3289
- transition_id: _.transitionId,
3290
- comment: _.comment,
3273
+ ne.mutateAsync({
3274
+ transition_id: k.transitionId,
3275
+ comment: k.comment,
3291
3276
  reviewed: !0
3292
3277
  }).catch(() => {
3293
3278
  })
3294
3279
  ),
3295
- executing: te.isPending,
3296
- onClose: () => S(null)
3280
+ executing: ne.isPending,
3281
+ onClose: () => N(null)
3297
3282
  },
3298
- _.revision
3283
+ k.revision
3299
3284
  ) })
3300
3285
  ] });
3301
3286
  }
3302
3287
  export {
3303
- ze as FRESH_BUTTON_MS,
3304
- rn as FRESH_HOVER_MAX_MS,
3305
- ha as FreshButtonGuard,
3306
- Ms as PipelinePanel,
3307
- qs as PipelineTransitionButtons,
3308
- Jr as REFUSAL_FIX_ACTIONS,
3309
- wa as RecordFlagChips,
3310
- ya as SLOW_MOVE_MS,
3311
- Ut as asksFirst,
3312
- ba as briefAgeText,
3313
- xa as briefDiffPair,
3314
- an as briefLineKey,
3315
- ga as briefWarnings,
3316
- Qn as isDuplicateTransition,
3317
- ka as latestSendBack,
3318
- Hn as lockedMoveOffer,
3319
- Na as muted,
3320
- wt as refusalCode,
3321
- Vn as refusalFixFor,
3322
- sr as slowMoveToast,
3323
- zn as transitionRequirementsFromError,
3324
- ar as transitionToastText,
3325
- rr as withoutSkippedSendBacks
3288
+ He as FRESH_BUTTON_MS,
3289
+ sn as FRESH_HOVER_MAX_MS,
3290
+ _a as FreshButtonGuard,
3291
+ Is as PipelinePanel,
3292
+ js as PipelineTransitionButtons,
3293
+ sa as REFUSAL_FIX_ACTIONS,
3294
+ Ta as RecordFlagChips,
3295
+ Ma as SLOW_MOVE_MS,
3296
+ Wt as asksFirst,
3297
+ Sa as briefAgeText,
3298
+ Ca as briefDiffPair,
3299
+ on as briefLineKey,
3300
+ Na as briefWarnings,
3301
+ zn as isDuplicateTransition,
3302
+ Pa as latestSendBack,
3303
+ Vn as lockedMoveOffer,
3304
+ Ra as muted,
3305
+ kt as refusalCode,
3306
+ Gn as refusalFixFor,
3307
+ ir as slowMoveToast,
3308
+ Hn as transitionRequirementsFromError,
3309
+ sr as transitionToastText,
3310
+ ar as withoutSkippedSendBacks
3326
3311
  };