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