@nivaro/react 0.3.114 → 0.3.116

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