@nivaro/react 0.3.111 → 0.3.112

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