@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,30 +1,35 @@
1
- import { jsxs as a, jsx as t, Fragment as z } from "react/jsx-runtime";
2
- import { useQuery as P, useMutation as j, useQueryClient as ae } from "@tanstack/react-query";
3
- import { Undo2 as Ne, Loader2 as ne, Check as be, ShieldCheck as we, ShieldAlert as he, SlidersHorizontal as Se, RefreshCw as te, BookUser as Ce, MonitorSmartphone as $e, EyeOff as _e, Eye as qe, Copy as Re, Trash2 as Le, KeyRound as Ae } from "lucide-react";
4
- import { useMemo as xe, useState as K, useRef as W, useEffect as de } from "react";
5
- import { toast as L } from "sonner";
6
- import { useNivaroClient as E } from "../../context.js";
7
- import { get as F, patch as Te, put as De, post as se, del as ge } from "../../lib/commands.js";
8
- import { toastError as Ke } from "../../lib/error-toast.js";
9
- import { formatRelative as Pe, cn as A, formatNumber as I } from "../../lib/utils.js";
1
+ import { jsxs as a, jsx as t, Fragment as I } from "react/jsx-runtime";
2
+ import { useQuery as K, useMutation as Q, useQueryClient as ae } from "@tanstack/react-query";
3
+ import { Undo2 as Ce, Loader2 as ne, Check as ge, ShieldCheck as _e, ShieldAlert as xe, SlidersHorizontal as $e, RefreshCw as te, BookUser as qe, MonitorSmartphone as Re, EyeOff as Le, Eye as Te, Copy as Ae, Trash2 as De, KeyRound as Ee, Smartphone as Ke, Monitor as Pe, LogOut as Fe } from "lucide-react";
4
+ import { useMemo as fe, useState as E, useRef as W, useEffect as de } from "react";
5
+ import { toast as A } from "sonner";
6
+ import { useNivaroClient as F } from "../../context.js";
7
+ import { get as P, patch as Oe, put as Me, post as se, del as ye } from "../../lib/commands.js";
8
+ import { toastError as ve } from "../../lib/error-toast.js";
9
+ import { useLiveOps as Qe, useFreshIds as je } from "../../lib/live-ops.js";
10
+ import { useLivePreference as Ue } from "../../lib/live-preference.js";
11
+ import { formatRelative as Be, cn as T, formatDateTime as Ie, formatNumber as B } from "../../lib/utils.js";
12
+ import { ErrorNotice as ze } from "../ErrorNotice.js";
13
+ import { useOverflowTip as ce } from "../TipLayer.js";
10
14
  import { SimpleSelect as Z } from "../ui/SimpleSelect.js";
11
- import { SectionCard as J, EmptyLine as fe, ConfirmButton as Y } from "./primitives.js";
12
- import { useInvalidatePerson as ie, errorText as M } from "./types.js";
13
- const Fe = [
15
+ import { Skeleton as me } from "../ui/skeleton.js";
16
+ import { SectionCard as J, EmptyLine as ke, ConfirmButton as Y } from "./primitives.js";
17
+ import { useInvalidatePerson as ie, errorText as z } from "./types.js";
18
+ const Je = [
14
19
  { value: "", label: "Person" },
15
20
  { value: "integration", label: "Integration — an external system writes as it" },
16
21
  { value: "service", label: "Service login" },
17
22
  { value: "bot", label: "Bot" },
18
23
  { value: "placeholder", label: "Placeholder — kept so old references resolve" }
19
24
  ];
20
- function tt({ profile: e }) {
21
- const n = E(), d = ie(e.id), { data: i = [] } = P({
25
+ function ft({ profile: e }) {
26
+ const n = F(), d = ie(e.id), { data: i = [] } = K({
22
27
  queryKey: ["nvr-roles"],
23
28
  queryFn: () => n.request(
24
- F("/roles")
29
+ P("/roles")
25
30
  ).then((m) => m.data),
26
31
  staleTime: 5 * 6e4
27
- }), u = xe(
32
+ }), o = fe(
28
33
  () => {
29
34
  var m;
30
35
  return {
@@ -34,38 +39,38 @@ function tt({ profile: e }) {
34
39
  };
35
40
  },
36
41
  [e]
37
- ), [c, x] = K(null), p = c ?? u, N = JSON.stringify(p) !== JSON.stringify(u), o = j({
42
+ ), [b, h] = E(null), p = b ?? o, k = JSON.stringify(p) !== JSON.stringify(o), l = Q({
38
43
  mutationFn: () => n.request(
39
- Te(`/users/${e.id}`, {
44
+ Oe(`/users/${e.id}`, {
40
45
  role: p.role || null,
41
46
  status: p.status,
42
47
  account_kind: p.account_kind || null
43
48
  })
44
49
  ),
45
50
  onSuccess: () => {
46
- x(null), d(), L.success("Access saved");
51
+ h(null), d(), A.success("Access saved");
47
52
  },
48
- onError: (m) => L.error(M(m, "Could not save access"))
49
- }), g = [
53
+ onError: (m) => A.error(z(m, "Could not save access"))
54
+ }), c = [
50
55
  { value: "", label: "No role" },
51
56
  ...i.map((m) => ({ value: m.id, label: m.admin_access ? `${m.name} · admin` : m.name }))
52
57
  ];
53
58
  return /* @__PURE__ */ t(
54
59
  J,
55
60
  {
56
- icon: /* @__PURE__ */ t(we, { className: "h-4 w-4" }),
61
+ icon: /* @__PURE__ */ t(_e, { className: "h-4 w-4" }),
57
62
  title: "Access",
58
63
  hint: "Role decides what they can do; status decides whether they can sign in",
59
64
  testId: "access",
60
- actions: N && /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5", children: [
65
+ actions: k && /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5", children: [
61
66
  /* @__PURE__ */ a(
62
67
  "button",
63
68
  {
64
69
  type: "button",
65
- onClick: () => x(null),
70
+ onClick: () => h(null),
66
71
  className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[11.5px] font-medium text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200",
67
72
  children: [
68
- /* @__PURE__ */ t(Ne, { className: "h-3 w-3" }),
73
+ /* @__PURE__ */ t(Ce, { className: "h-3 w-3" }),
69
74
  " Reset"
70
75
  ]
71
76
  }
@@ -74,12 +79,12 @@ function tt({ profile: e }) {
74
79
  "button",
75
80
  {
76
81
  type: "button",
77
- disabled: o.isPending,
78
- onClick: () => o.mutate(),
82
+ disabled: l.isPending,
83
+ onClick: () => l.mutate(),
79
84
  "data-person-access-save": !0,
80
85
  className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2.5 text-[11.5px] font-semibold text-white transition-opacity disabled:opacity-50",
81
86
  children: [
82
- o.isPending ? /* @__PURE__ */ t(ne, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
87
+ l.isPending ? /* @__PURE__ */ t(ne, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
83
88
  " ",
84
89
  "Save"
85
90
  ]
@@ -94,8 +99,8 @@ function tt({ profile: e }) {
94
99
  {
95
100
  ariaLabel: "Role",
96
101
  value: p.role,
97
- onChange: (m) => x({ ...p, role: m }),
98
- options: g,
102
+ onChange: (m) => h({ ...p, role: m }),
103
+ options: c,
99
104
  className: "h-8 text-[12.5px]"
100
105
  }
101
106
  )
@@ -107,7 +112,7 @@ function tt({ profile: e }) {
107
112
  {
108
113
  ariaLabel: "Status",
109
114
  value: p.status,
110
- onChange: (m) => x({ ...p, status: m }),
115
+ onChange: (m) => h({ ...p, status: m }),
111
116
  options: [
112
117
  { value: "active", label: "Active" },
113
118
  { value: "inactive", label: "Inactive" },
@@ -124,8 +129,8 @@ function tt({ profile: e }) {
124
129
  {
125
130
  ariaLabel: "Account type",
126
131
  value: p.account_kind,
127
- onChange: (m) => x({ ...p, account_kind: m }),
128
- options: Fe,
132
+ onChange: (m) => h({ ...p, account_kind: m }),
133
+ options: Je,
129
134
  className: "h-8 text-[12.5px]"
130
135
  }
131
136
  ),
@@ -135,7 +140,7 @@ function tt({ profile: e }) {
135
140
  }
136
141
  );
137
142
  }
138
- const Ee = {
143
+ const Ge = {
139
144
  directory: "Directory sync",
140
145
  retention: "Retention policy",
141
146
  offboarding: "Offboarding",
@@ -144,11 +149,11 @@ const Ee = {
144
149
  "legacy-redaction": "Legacy redaction job",
145
150
  unknown: "Unknown"
146
151
  };
147
- function rt({ profile: e }) {
148
- var u;
149
- const n = E(), d = e.status === "suspended" || !!((u = e.admin) != null && u.is_redacted), { data: i } = P({
152
+ function yt({ profile: e }) {
153
+ var o;
154
+ const n = F(), d = e.status === "suspended" || !!((o = e.admin) != null && o.is_redacted), { data: i } = K({
150
155
  queryKey: ["nvr-user-suspension", e.id],
151
- queryFn: () => n.request(F(`/users/${e.id}/suspension`)).then((c) => c.data).catch(() => null),
156
+ queryFn: () => n.request(P(`/users/${e.id}/suspension`)).then((b) => b.data).catch(() => null),
152
157
  enabled: d,
153
158
  staleTime: 6e4
154
159
  });
@@ -160,7 +165,7 @@ function rt({ profile: e }) {
160
165
  children: [
161
166
  /* @__PURE__ */ a("p", { className: "font-medium", children: [
162
167
  "Cannot sign in — ",
163
- Ee[i.source] ?? i.source,
168
+ Ge[i.source] ?? i.source,
164
169
  i.at ? ` · ${new Date(i.at).toLocaleString()}` : "",
165
170
  i.by ? ` · by ${i.by.name}` : ""
166
171
  ] }),
@@ -171,137 +176,137 @@ function rt({ profile: e }) {
171
176
  );
172
177
  }
173
178
  const oe = (e, n) => e.map((d) => ({ id: d.id, label: String(d[n] ?? d.id) }));
174
- function ye(e) {
175
- const n = E(), d = e.display_field ?? "name", { data: i = [] } = P({
179
+ function Ne(e) {
180
+ const n = F(), d = e.display_field ?? "name", { data: i = [] } = K({
176
181
  queryKey: ["nvr-scope-options", e.name],
177
182
  queryFn: () => n.request(
178
- F(`/items/${e.target_collection}`, {
183
+ P(`/items/${e.target_collection}`, {
179
184
  fields: `id,${d}`,
180
185
  limit: 200,
181
186
  ...e.options_sort ? { sort: e.options_sort } : {}
182
187
  })
183
- ).then((u) => oe(u.data ?? [], d))
188
+ ).then((o) => oe(o.data ?? [], d))
184
189
  });
185
190
  return i;
186
191
  }
187
- function ke(e, n, d = []) {
188
- const i = E(), u = e.display_field ?? "name", c = ye(e), x = new Map(c.map((o) => [String(o.id), o.label]));
189
- for (const o of d) x.set(String(o.id), o.label);
190
- const p = n.filter((o) => !x.has(String(o))), { data: N = [] } = P({
192
+ function we(e, n, d = []) {
193
+ const i = F(), o = e.display_field ?? "name", b = Ne(e), h = new Map(b.map((l) => [String(l.id), l.label]));
194
+ for (const l of d) h.set(String(l.id), l.label);
195
+ const p = n.filter((l) => !h.has(String(l))), { data: k = [] } = K({
191
196
  queryKey: ["nvr-scope-selected-labels", e.name, p.map(String).sort().join(",")],
192
197
  queryFn: () => i.request(
193
- F(`/items/${e.target_collection}`, {
194
- fields: `id,${u}`,
198
+ P(`/items/${e.target_collection}`, {
199
+ fields: `id,${o}`,
195
200
  limit: 100,
196
201
  filter: JSON.stringify({ id: { _in: p } })
197
202
  })
198
- ).then((o) => oe(o.data ?? [], u)),
203
+ ).then((l) => oe(l.data ?? [], o)),
199
204
  enabled: p.length > 0
200
205
  });
201
- for (const o of N) x.set(String(o.id), o.label);
202
- return x;
206
+ for (const l of k) h.set(String(l.id), l.label);
207
+ return h;
203
208
  }
204
- function ce({
209
+ function ue({
205
210
  dimension: e,
206
211
  selected: n,
207
212
  accent: d,
208
213
  disabled: i,
209
- staged: u,
210
- removing: c,
211
- onToggle: x
214
+ staged: o,
215
+ removing: b,
216
+ onToggle: h
212
217
  }) {
213
- const p = E(), N = e.display_field ?? "name", [o, g] = K(""), m = new Set((u ?? []).map(String)), D = new Set((c ?? []).map(String)), _ = ye(e), q = _.length > 24, { data: v = [], isFetching: y } = P({
214
- queryKey: ["nvr-scope-search", e.name, o],
218
+ const p = F(), k = e.display_field ?? "name", [l, c] = E(""), m = new Set((o ?? []).map(String)), q = new Set((b ?? []).map(String)), $ = Ne(e), R = $.length > 24, { data: N = [], isFetching: y } = K({
219
+ queryKey: ["nvr-scope-search", e.name, l],
215
220
  queryFn: () => p.request(
216
- F(`/items/${e.target_collection}`, {
217
- fields: `id,${N}`,
221
+ P(`/items/${e.target_collection}`, {
222
+ fields: `id,${k}`,
218
223
  limit: 30,
219
- filter: JSON.stringify({ [N]: { _contains: o } }),
224
+ filter: JSON.stringify({ [k]: { _contains: l } }),
220
225
  ...e.options_sort ? { sort: e.options_sort } : {}
221
226
  })
222
- ).then((b) => oe(b.data ?? [], N)),
223
- enabled: q && o.trim().length > 0,
224
- placeholderData: (b) => b
225
- }), s = ke(e, n, v), w = new Set(n.map(String)), S = (b) => x(
226
- w.has(String(b)) ? n.filter((R) => String(R) !== String(b)) : [...n, b]
227
+ ).then((g) => oe(g.data ?? [], k)),
228
+ enabled: R && l.trim().length > 0,
229
+ placeholderData: (g) => g
230
+ }), s = we(e, n, N), w = new Set(n.map(String)), S = (g) => h(
231
+ w.has(String(g)) ? n.filter((L) => String(L) !== String(g)) : [...n, g]
227
232
  ), C = d === "amber" ? "border-amber-400 bg-amber-50 font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400" : "border-nvr-cyan bg-accent font-medium text-nvr-navy dark:text-nvr-cyan";
228
- return q ? /* @__PURE__ */ a("div", { className: "max-w-xl", children: [
229
- n.length > 0 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap gap-1", children: n.map((b) => /* @__PURE__ */ a(
233
+ return R ? /* @__PURE__ */ a("div", { className: "max-w-xl", children: [
234
+ n.length > 0 && /* @__PURE__ */ t("div", { className: "mb-1.5 flex flex-wrap gap-1", children: n.map((g) => /* @__PURE__ */ a(
230
235
  "span",
231
236
  {
232
- className: A(
237
+ className: T(
233
238
  "inline-flex items-center gap-1 rounded-full border py-0.5 pl-2.5 pr-1 text-[11.5px]",
234
239
  C,
235
- m.has(String(b)) && "border-dashed"
240
+ m.has(String(g)) && "border-dashed"
236
241
  ),
237
242
  children: [
238
- s.get(String(b)) ?? String(b),
243
+ s.get(String(g)) ?? String(g),
239
244
  /* @__PURE__ */ t(
240
245
  "button",
241
246
  {
242
247
  type: "button",
243
248
  disabled: i,
244
- onClick: () => S(b),
245
- "aria-label": `Remove ${s.get(String(b)) ?? b}`,
249
+ onClick: () => S(g),
250
+ "aria-label": `Remove ${s.get(String(g)) ?? g}`,
246
251
  className: "rounded-full px-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
247
252
  children: "×"
248
253
  }
249
254
  )
250
255
  ]
251
256
  },
252
- String(b)
257
+ String(g)
253
258
  )) }),
254
259
  /* @__PURE__ */ t(
255
260
  "input",
256
261
  {
257
- value: o,
258
- onChange: (b) => g(b.target.value),
262
+ value: l,
263
+ onChange: (g) => c(g.target.value),
259
264
  disabled: i,
260
265
  placeholder: `Search ${e.label.toLowerCase()} to add…`,
261
266
  className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12px] outline-none focus:border-nvr-cyan dark:border-border dark:bg-card"
262
267
  }
263
268
  ),
264
- o.trim().length > 0 && /* @__PURE__ */ a("div", { className: "mt-1 max-h-44 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: [
265
- v.map((b) => {
266
- const R = w.has(String(b.id));
269
+ l.trim().length > 0 && /* @__PURE__ */ a("div", { className: "mt-1 max-h-44 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: [
270
+ N.map((g) => {
271
+ const L = w.has(String(g.id));
267
272
  return /* @__PURE__ */ a(
268
273
  "button",
269
274
  {
270
275
  type: "button",
271
276
  disabled: i,
272
- onClick: () => S(b.id),
273
- className: A(
277
+ onClick: () => S(g.id),
278
+ className: T(
274
279
  "flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-muted",
275
- R ? "font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-600 dark:text-slate-300"
280
+ L ? "font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-600 dark:text-slate-300"
276
281
  ),
277
282
  children: [
278
- /* @__PURE__ */ t("span", { className: "truncate", children: b.label }),
279
- /* @__PURE__ */ t("span", { className: "pl-2 text-[11px] text-slate-400", children: R ? "Remove" : "Add" })
283
+ /* @__PURE__ */ t("span", { className: "truncate", children: g.label }),
284
+ /* @__PURE__ */ t("span", { className: "pl-2 text-[11px] text-slate-400", children: L ? "Remove" : "Add" })
280
285
  ]
281
286
  },
282
- String(b.id)
287
+ String(g.id)
283
288
  );
284
289
  }),
285
- v.length === 0 && /* @__PURE__ */ t("p", { className: "px-2.5 py-2 text-[11.5px] text-slate-400", children: y ? "Searching…" : "No matches." })
290
+ N.length === 0 && /* @__PURE__ */ t("p", { className: "px-2.5 py-2 text-[11.5px] text-slate-400", children: y ? "Searching…" : "No matches." })
286
291
  ] })
287
- ] }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: _.map((b) => {
288
- const R = w.has(String(b.id));
292
+ ] }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: $.map((g) => {
293
+ const L = w.has(String(g.id));
289
294
  return /* @__PURE__ */ t(
290
295
  "button",
291
296
  {
292
297
  type: "button",
293
- "aria-pressed": R,
298
+ "aria-pressed": L,
294
299
  disabled: i,
295
- onClick: () => S(b.id),
296
- className: A(
300
+ onClick: () => S(g.id),
301
+ className: T(
297
302
  // No colour transition: a press shows its new state at once.
298
303
  "rounded-full border px-2.5 py-0.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:cursor-wait",
299
- R ? C : D.has(String(b.id)) ? "border-dashed border-amber-400 text-amber-800 line-through decoration-amber-500/70 dark:border-amber-500/60 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-400 dark:hover:border-slate-500",
300
- R && m.has(String(b.id)) && "border-dashed"
304
+ L ? C : q.has(String(g.id)) ? "border-dashed border-amber-400 text-amber-800 line-through decoration-amber-500/70 dark:border-amber-500/60 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-400 dark:hover:border-slate-500",
305
+ L && m.has(String(g.id)) && "border-dashed"
301
306
  ),
302
- children: b.label
307
+ children: g.label
303
308
  },
304
- String(b.id)
309
+ String(g.id)
305
310
  );
306
311
  }) });
307
312
  }
@@ -309,107 +314,107 @@ const X = (e, n) => {
309
314
  if (e.length !== n.length) return !1;
310
315
  const d = new Set(e.map(String));
311
316
  return n.every((i) => d.has(String(i)));
312
- }, Oe = (e, n) => `${e}:${n.map(String).sort().join(",")}`, re = (e) => e.replace(/_/g, " ").replace(/^\w/, (n) => n.toUpperCase()), me = (e) => /s$/i.test(e) ? e : `${e}s`;
317
+ }, He = (e, n) => `${e}:${n.map(String).sort().join(",")}`, re = (e) => e.replace(/_/g, " ").replace(/^\w/, (n) => n.toUpperCase()), pe = (e) => /s$/i.test(e) ? e : `${e}s`;
313
318
  function ee(e) {
314
319
  return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e.at(-1)}`;
315
320
  }
316
- function at({
321
+ function vt({
317
322
  userId: e,
318
323
  previewDelayMs: n = 400
319
324
  }) {
320
- const d = E(), i = ae(), u = xe(() => ["nvr-user-scopes", e], [e]), { data: c } = P({
321
- queryKey: u,
322
- queryFn: () => d.request(F(`/user-scopes/${e}`)).then((r) => r.data)
323
- }), [x, p] = K({}), [N, o] = K({}), g = W({}), m = W({}), D = W({});
325
+ const d = F(), i = ae(), o = fe(() => ["nvr-user-scopes", e], [e]), { data: b } = K({
326
+ queryKey: o,
327
+ queryFn: () => d.request(P(`/user-scopes/${e}`)).then((r) => r.data)
328
+ }), [h, p] = E({}), [k, l] = E({}), c = W({}), m = W({}), q = W({});
324
329
  de(() => {
325
- const r = D.current;
330
+ const r = q.current;
326
331
  return () => {
327
- for (const l of Object.values(r)) clearTimeout(l);
332
+ for (const u of Object.values(r)) clearTimeout(u);
328
333
  };
329
334
  }, []);
330
- const _ = (r, l) => {
331
- clearTimeout(D.current[r]), o((k) => {
332
- const { [r]: f, ...$ } = k;
333
- return l ? { ...$, [r]: l } : $;
334
- }), l === "saved" && (D.current[r] = setTimeout(() => _(r, null), 2400));
335
- }, q = (r) => i.setQueryData(u, (l) => {
336
- if (!l) return l;
337
- const k = r.mode === "restrict" ? "restricted" : "defaults";
338
- return { ...l, [k]: { ...l[k], [r.dimension]: r.values } };
339
- }), v = j({
335
+ const $ = (r, u) => {
336
+ clearTimeout(q.current[r]), l((v) => {
337
+ const { [r]: f, ..._ } = v;
338
+ return u ? { ..._, [r]: u } : _;
339
+ }), u === "saved" && (q.current[r] = setTimeout(() => $(r, null), 2400));
340
+ }, R = (r) => i.setQueryData(o, (u) => {
341
+ if (!u) return u;
342
+ const v = r.mode === "restrict" ? "restricted" : "defaults";
343
+ return { ...u, [v]: { ...u[v], [r.dimension]: r.values } };
344
+ }), N = Q({
340
345
  // One person's scope saves go out one after another, in click order.
341
346
  scope: { id: `nvr-user-scopes:${e}` },
342
- mutationFn: (r) => d.request(De(`/user-scopes/${e}`, r)),
347
+ mutationFn: (r) => d.request(Me(`/user-scopes/${e}`, r)),
343
348
  onMutate: (r) => {
344
- var $, B;
345
- const l = `${r.dimension}:${r.mode}`, k = r.mode === "restrict" ? "restricted" : "defaults", f = ((B = ($ = i.getQueryData(u)) == null ? void 0 : $[k]) == null ? void 0 : B[r.dimension]) ?? [];
346
- return m.current[l] = (m.current[l] ?? 0) + 1, delete g.current[l], p((Q) => ({ ...Q, [l]: r.values })), _(l, "saving"), i.cancelQueries({ queryKey: u }), q(r), { before: f };
349
+ var _, U;
350
+ const u = `${r.dimension}:${r.mode}`, v = r.mode === "restrict" ? "restricted" : "defaults", f = ((U = (_ = i.getQueryData(o)) == null ? void 0 : _[v]) == null ? void 0 : U[r.dimension]) ?? [];
351
+ return m.current[u] = (m.current[u] ?? 0) + 1, delete c.current[u], p((M) => ({ ...M, [u]: r.values })), $(u, "saving"), i.cancelQueries({ queryKey: o }), R(r), { before: f };
347
352
  },
348
- onSuccess: (r, l) => q(l),
349
- onError: (r, l, k) => {
350
- var Q, le;
351
- const f = `${l.dimension}:${l.mode}`, $ = l.mode === "restrict" ? "restricted" : "defaults", B = ((le = (Q = i.getQueryData(u)) == null ? void 0 : Q[$]) == null ? void 0 : le[l.dimension]) ?? [];
352
- k && X(B, l.values) && q({ ...l, values: k.before }), p((V) => {
353
- if (!V[f] || !X(V[f], l.values)) return V;
354
- const { [f]: Ue, ...ve } = V;
355
- return ve;
356
- }), g.current[f] = l, Ke(
353
+ onSuccess: (r, u) => R(u),
354
+ onError: (r, u, v) => {
355
+ var M, le;
356
+ const f = `${u.dimension}:${u.mode}`, _ = u.mode === "restrict" ? "restricted" : "defaults", U = ((le = (M = i.getQueryData(o)) == null ? void 0 : M[_]) == null ? void 0 : le[u.dimension]) ?? [];
357
+ v && X(U, u.values) && R({ ...u, values: v.before }), p((V) => {
358
+ if (!V[f] || !X(V[f], u.values)) return V;
359
+ const { [f]: et, ...Se } = V;
360
+ return Se;
361
+ }), c.current[f] = u, ve(
357
362
  r,
358
- l.mode === "restrict" ? "Could not apply the restriction" : "Could not save the default",
359
- { retry: () => v.mutate(l) }
363
+ u.mode === "restrict" ? "Could not apply the restriction" : "Could not save the default",
364
+ { retry: () => N.mutate(u) }
360
365
  );
361
366
  },
362
- onSettled: (r, l, k) => {
363
- const f = `${k.dimension}:${k.mode}`;
364
- m.current[f] = Math.max(0, (m.current[f] ?? 1) - 1), l || p(($) => {
365
- if (!$[f] || !X($[f], k.values)) return $;
366
- const { [f]: B, ...Q } = $;
367
- return Q;
368
- }), m.current[f] === 0 && _(f, l ? "failed" : "saved"), i.invalidateQueries({ queryKey: u }), i.invalidateQueries({ queryKey: ["nvr-person-profile", e] }), i.invalidateQueries({ queryKey: ["nvr-my-scopes"] }), i.invalidateQueries({ queryKey: ["nvr-profile-scopes"] });
367
+ onSettled: (r, u, v) => {
368
+ const f = `${v.dimension}:${v.mode}`;
369
+ m.current[f] = Math.max(0, (m.current[f] ?? 1) - 1), u || p((_) => {
370
+ if (!_[f] || !X(_[f], v.values)) return _;
371
+ const { [f]: U, ...M } = _;
372
+ return M;
373
+ }), m.current[f] === 0 && $(f, u ? "failed" : "saved"), i.invalidateQueries({ queryKey: o }), i.invalidateQueries({ queryKey: ["nvr-person-profile", e] }), i.invalidateQueries({ queryKey: ["nvr-my-scopes"] }), i.invalidateQueries({ queryKey: ["nvr-profile-scopes"] });
369
374
  }
370
- }), y = (r, l) => x[`${r}:${l}`] ?? (l === "restrict" ? c == null ? void 0 : c.restricted[r] : c == null ? void 0 : c.defaults[r]) ?? [], [s, w] = K(null), [S, C] = K(null), [b, R] = K(0), O = W(0), T = s ? Oe(s.dimension, s.values) : null;
375
+ }), y = (r, u) => h[`${r}:${u}`] ?? (u === "restrict" ? b == null ? void 0 : b.restricted[r] : b == null ? void 0 : b.defaults[r]) ?? [], [s, w] = E(null), [S, C] = E(null), [g, L] = E(0), O = W(0), D = s ? He(s.dimension, s.values) : null;
371
376
  de(() => {
372
- if (!s || !T) return;
373
- const r = ++O.current, l = setTimeout(() => {
377
+ if (!s || !D) return;
378
+ const r = ++O.current, u = setTimeout(() => {
374
379
  d.request(
375
380
  se(`/user-scopes/${e}/impact`, {
376
381
  dimension: s.dimension,
377
382
  values: s.values
378
383
  })
379
384
  ).then(
380
- (k) => {
381
- r === O.current && C({ key: T, answer: k.data, error: null });
385
+ (v) => {
386
+ r === O.current && C({ key: D, answer: v.data, error: null });
382
387
  },
383
- (k) => {
384
- r === O.current && C({ key: T, answer: null, error: k });
388
+ (v) => {
389
+ r === O.current && C({ key: D, answer: null, error: v });
385
390
  }
386
391
  );
387
392
  }, n);
388
- return () => clearTimeout(l);
389
- }, [T, b, d, e, n]);
390
- const G = (r, l) => {
391
- if (X(l, y(r, "restrict"))) {
393
+ return () => clearTimeout(u);
394
+ }, [D, g, d, e, n]);
395
+ const G = (r, u) => {
396
+ if (X(u, y(r, "restrict"))) {
392
397
  O.current++, w(null), C(null);
393
398
  return;
394
399
  }
395
- s && s.dimension !== r && C(null), w({ dimension: r, values: l });
396
- }, U = () => {
400
+ s && s.dimension !== r && C(null), w({ dimension: r, values: u });
401
+ }, j = () => {
397
402
  O.current++, w(null), C(null);
398
403
  }, H = () => {
399
- s && (v.mutate({ dimension: s.dimension, mode: "restrict", values: s.values }), U());
400
- }, h = (r) => {
401
- const l = g.current[r];
402
- l && v.mutate(l);
404
+ s && (N.mutate({ dimension: s.dimension, mode: "restrict", values: s.values }), j());
405
+ }, x = (r) => {
406
+ const u = c.current[r];
407
+ u && N.mutate(u);
403
408
  };
404
- return !c || c.dimensions.length === 0 ? null : /* @__PURE__ */ t(
409
+ return !b || b.dimensions.length === 0 ? null : /* @__PURE__ */ t(
405
410
  J,
406
411
  {
407
- icon: /* @__PURE__ */ t(Se, { className: "h-4 w-4" }),
412
+ icon: /* @__PURE__ */ t($e, { className: "h-4 w-4" }),
408
413
  title: "Scopes",
409
414
  hint: "Defaults pre-fill their filters; restrictions limit what they can see",
410
415
  testId: "scopes",
411
- children: /* @__PURE__ */ t("div", { className: "space-y-5", children: c.dimensions.map((r) => {
412
- const l = x[`${r.name}:restrict`] != null, k = (s == null ? void 0 : s.dimension) === r.name;
416
+ children: /* @__PURE__ */ t("div", { className: "space-y-5", children: b.dimensions.map((r) => {
417
+ const u = h[`${r.name}:restrict`] != null, v = (s == null ? void 0 : s.dimension) === r.name;
413
418
  return /* @__PURE__ */ a("div", { children: [
414
419
  /* @__PURE__ */ t("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: r.label }),
415
420
  /* @__PURE__ */ a("div", { className: "mt-1.5 space-y-2.5", children: [
@@ -418,68 +423,68 @@ function at({
418
423
  "Defaults",
419
424
  /* @__PURE__ */ t("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: "pre-filled in their filters" }),
420
425
  /* @__PURE__ */ t(
421
- ue,
426
+ be,
422
427
  {
423
428
  slot: `${r.name}:default`,
424
- status: N[`${r.name}:default`],
425
- onRetry: h
429
+ status: k[`${r.name}:default`],
430
+ onRetry: x
426
431
  }
427
432
  )
428
433
  ] }),
429
434
  /* @__PURE__ */ t(
430
- ce,
435
+ ue,
431
436
  {
432
437
  dimension: r,
433
438
  selected: y(r.name, "default"),
434
439
  accent: "cyan",
435
- onToggle: (f) => v.mutate({ dimension: r.name, mode: "default", values: f })
440
+ onToggle: (f) => N.mutate({ dimension: r.name, mode: "default", values: f })
436
441
  }
437
442
  )
438
443
  ] }),
439
444
  /* @__PURE__ */ a("div", { "data-scope-restrict": r.name, children: [
440
445
  /* @__PURE__ */ a("p", { className: "mb-1 flex min-h-4 items-center gap-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300", children: [
441
- /* @__PURE__ */ t(he, { className: "h-3 w-3 text-amber-500", "aria-hidden": !0 }),
446
+ /* @__PURE__ */ t(xe, { className: "h-3 w-3 text-amber-500", "aria-hidden": !0 }),
442
447
  "Restricted to",
443
- y(r.name, "restrict").length === 0 && !k ? /* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
448
+ y(r.name, "restrict").length === 0 && !v ? /* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
444
449
  "none — sees every ",
445
450
  r.label.toLowerCase()
446
451
  ] }) : /* @__PURE__ */ t("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: "enforced on every read" }),
447
452
  /* @__PURE__ */ t(
448
- ue,
453
+ be,
449
454
  {
450
455
  slot: `${r.name}:restrict`,
451
- status: N[`${r.name}:restrict`],
452
- onRetry: h
456
+ status: k[`${r.name}:restrict`],
457
+ onRetry: x
453
458
  }
454
459
  )
455
460
  ] }),
456
461
  /* @__PURE__ */ t(
457
- ce,
462
+ ue,
458
463
  {
459
464
  dimension: r,
460
- selected: k && s ? s.values : y(r.name, "restrict"),
465
+ selected: v && s ? s.values : y(r.name, "restrict"),
461
466
  accent: "amber",
462
- disabled: l,
463
- staged: k && s ? s.values.filter(
464
- (f) => !y(r.name, "restrict").some(($) => String($) === String(f))
467
+ disabled: u,
468
+ staged: v && s ? s.values.filter(
469
+ (f) => !y(r.name, "restrict").some((_) => String(_) === String(f))
465
470
  ) : void 0,
466
- removing: k && s ? y(r.name, "restrict").filter(
467
- (f) => !s.values.some(($) => String($) === String(f))
471
+ removing: v && s ? y(r.name, "restrict").filter(
472
+ (f) => !s.values.some((_) => String(_) === String(f))
468
473
  ) : void 0,
469
474
  onToggle: (f) => G(r.name, f)
470
475
  }
471
476
  ),
472
- k && s && /* @__PURE__ */ t(
473
- Qe,
477
+ v && s && /* @__PURE__ */ t(
478
+ Ve,
474
479
  {
475
480
  dimension: r,
476
481
  saved: y(r.name, "restrict"),
477
482
  values: s.values,
478
- result: (S == null ? void 0 : S.key) === T ? S : null,
479
- stale: S && S.key !== T ? S.answer : null,
483
+ result: (S == null ? void 0 : S.key) === D ? S : null,
484
+ stale: S && S.key !== D ? S.answer : null,
480
485
  onApply: H,
481
- onCancel: U,
482
- onRetry: () => R((f) => f + 1)
486
+ onCancel: j,
487
+ onRetry: () => L((f) => f + 1)
483
488
  }
484
489
  )
485
490
  ] })
@@ -489,7 +494,7 @@ function at({
489
494
  }
490
495
  );
491
496
  }
492
- function ue({
497
+ function be({
493
498
  slot: e,
494
499
  status: n,
495
500
  onRetry: d
@@ -499,22 +504,22 @@ function ue({
499
504
  {
500
505
  "data-scope-status": e,
501
506
  "aria-live": "polite",
502
- className: A(
507
+ className: T(
503
508
  "inline-flex items-center gap-1 font-normal",
504
509
  n === "saved" && "text-emerald-700 dark:text-emerald-400",
505
510
  n === "failed" && "font-medium text-red-700 dark:text-red-400",
506
511
  n === "saving" && "text-slate-600 dark:text-slate-300"
507
512
  ),
508
513
  children: [
509
- n === "saving" && /* @__PURE__ */ a(z, { children: [
514
+ n === "saving" && /* @__PURE__ */ a(I, { children: [
510
515
  /* @__PURE__ */ t(ne, { className: "h-3 w-3 animate-spin motion-reduce:animate-none", "aria-hidden": !0 }),
511
516
  "Saving…"
512
517
  ] }),
513
- n === "saved" && /* @__PURE__ */ a(z, { children: [
514
- /* @__PURE__ */ t(be, { className: "h-3 w-3", "aria-hidden": !0 }),
518
+ n === "saved" && /* @__PURE__ */ a(I, { children: [
519
+ /* @__PURE__ */ t(ge, { className: "h-3 w-3", "aria-hidden": !0 }),
515
520
  "Saved"
516
521
  ] }),
517
- n === "failed" && /* @__PURE__ */ a(z, { children: [
522
+ n === "failed" && /* @__PURE__ */ a(I, { children: [
518
523
  "Not saved",
519
524
  /* @__PURE__ */ t(
520
525
  "button",
@@ -530,21 +535,21 @@ function ue({
530
535
  }
531
536
  );
532
537
  }
533
- function Qe({
538
+ function Ve({
534
539
  dimension: e,
535
540
  saved: n,
536
541
  values: d,
537
542
  result: i,
538
- stale: u,
539
- onApply: c,
540
- onCancel: x,
543
+ stale: o,
544
+ onApply: b,
545
+ onCancel: h,
541
546
  onRetry: p
542
547
  }) {
543
- var U, H;
544
- const N = ke(e, [...n, ...d]), o = (h) => N.get(String(h)) ?? `#${h}`, g = e.label.toLowerCase(), m = new Set(n.map(String)), D = new Set(d.map(String)), _ = d.filter((h) => !m.has(String(h))).map(o), q = n.filter((h) => !D.has(String(h))).map(o), v = (i == null ? void 0 : i.answer) ?? u, y = i ? i.error ? "error" : "ready" : u ? "updating" : "loading", s = (v == null ? void 0 : v.impact) ?? [], w = s.filter((h) => h.proposed === 0 && h.total > 0), S = d.length === 0, C = (h, r = 5) => h.length <= r ? ee(h) : `${h.slice(0, r - 1).join(", ")} and ${h.length - (r - 1)} more`, b = S ? `Remove the ${g} restriction` : n.length === 0 ? `Limit them to ${C(d.map(o))}` : [
545
- _.length > 0 ? `Also let them see ${C(_)}` : null,
546
- q.length > 0 ? `${_.length > 0 ? "stop" : "Stop"} them seeing ${C(q)}` : null
547
- ].filter(Boolean).join("; "), R = S ? `They will see records in every ${g}.` : `After this they only see records in ${C(d.map(o))}.`, O = y === "updating" ? "opacity-40" : "", T = w.map((h) => h.label ?? re(h.collection)), G = T.length <= 2 ? `they lose all ${ee(T)}` : `they lose ${T.length} record types`;
548
+ var j, H;
549
+ const k = we(e, [...n, ...d]), l = (x) => k.get(String(x)) ?? `#${x}`, c = e.label.toLowerCase(), m = new Set(n.map(String)), q = new Set(d.map(String)), $ = d.filter((x) => !m.has(String(x))).map(l), R = n.filter((x) => !q.has(String(x))).map(l), N = (i == null ? void 0 : i.answer) ?? o, y = i ? i.error ? "error" : "ready" : o ? "updating" : "loading", s = (N == null ? void 0 : N.impact) ?? [], w = s.filter((x) => x.proposed === 0 && x.total > 0), S = d.length === 0, C = (x, r = 5) => x.length <= r ? ee(x) : `${x.slice(0, r - 1).join(", ")} and ${x.length - (r - 1)} more`, g = S ? `Remove the ${c} restriction` : n.length === 0 ? `Limit them to ${C(d.map(l))}` : [
550
+ $.length > 0 ? `Also let them see ${C($)}` : null,
551
+ R.length > 0 ? `${$.length > 0 ? "stop" : "Stop"} them seeing ${C(R)}` : null
552
+ ].filter(Boolean).join("; "), L = S ? `They will see records in every ${c}.` : `After this they only see records in ${C(d.map(l))}.`, O = y === "updating" ? "opacity-40" : "", D = w.map((x) => x.label ?? re(x.collection)), G = D.length <= 2 ? `they lose all ${ee(D)}` : `they lose ${D.length} record types`;
548
553
  return /* @__PURE__ */ a(
549
554
  "div",
550
555
  {
@@ -553,8 +558,8 @@ function Qe({
553
558
  children: [
554
559
  /* @__PURE__ */ a("div", { className: "flex items-start gap-3 px-3 pt-2.5", children: [
555
560
  /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
556
- /* @__PURE__ */ t("p", { className: "font-semibold", children: b }),
557
- /* @__PURE__ */ t("p", { className: "mt-0.5 text-amber-900 dark:text-amber-200", children: R })
561
+ /* @__PURE__ */ t("p", { className: "font-semibold", children: g }),
562
+ /* @__PURE__ */ t("p", { className: "mt-0.5 text-amber-900 dark:text-amber-200", children: L })
558
563
  ] }),
559
564
  (y === "loading" || y === "updating") && /* @__PURE__ */ a("span", { className: "mt-0.5 inline-flex shrink-0 items-center gap-1 text-[11px] text-amber-900 dark:text-amber-200", children: [
560
565
  /* @__PURE__ */ t(ne, { className: "h-3 w-3 animate-spin motion-reduce:animate-none", "aria-hidden": !0 }),
@@ -564,45 +569,45 @@ function Qe({
564
569
  w.length > 0 && /* @__PURE__ */ a(
565
570
  "p",
566
571
  {
567
- className: A(
572
+ className: T(
568
573
  "mx-3 mt-2 flex items-start gap-1.5 font-semibold text-red-700 dark:text-red-300",
569
574
  O
570
575
  ),
571
576
  "data-scope-blind": !0,
572
577
  children: [
573
- /* @__PURE__ */ t(he, { className: "mt-px h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
578
+ /* @__PURE__ */ t(xe, { className: "mt-px h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
574
579
  "They would see nothing in ",
575
- ee(w.map((h) => h.label ?? re(h.collection))),
580
+ ee(w.map((x) => x.label ?? re(x.collection))),
576
581
  "."
577
582
  ]
578
583
  }
579
584
  ),
580
585
  y === "error" ? /* @__PURE__ */ t("div", { className: "mx-3 mt-2 text-amber-900 dark:text-amber-200", children: /* @__PURE__ */ a("p", { children: [
581
586
  "Couldn’t count what changes. Count again, or check the ",
582
- me(g),
587
+ pe(c),
583
588
  " above before applying."
584
589
  ] }) }) : s.length > 0 ? /* @__PURE__ */ t(
585
590
  "ul",
586
591
  {
587
- className: A(
592
+ className: T(
588
593
  "mx-3 mt-2 w-fit max-w-[calc(100%-1.5rem)] border-t border-amber-200 dark:border-amber-500/20",
589
594
  O
590
595
  ),
591
596
  "aria-busy": y === "updating",
592
- children: s.map((h) => /* @__PURE__ */ t(je, { row: h }, h.collection))
597
+ children: s.map((x) => /* @__PURE__ */ t(We, { row: x }, x.collection))
593
598
  }
594
- ) : y === "loading" ? /* @__PURE__ */ t("div", { className: "mx-3 mt-2 space-y-1.5", "aria-hidden": !0, children: [0, 1, 2].map((h) => /* @__PURE__ */ t("div", { className: "h-4 max-w-md rounded bg-amber-200/60 dark:bg-amber-400/10" }, h)) }) : /* @__PURE__ */ a("p", { className: "mx-3 mt-2", children: [
599
+ ) : y === "loading" ? /* @__PURE__ */ t("div", { className: "mx-3 mt-2 space-y-1.5", "aria-hidden": !0, children: [0, 1, 2].map((x) => /* @__PURE__ */ t("div", { className: "h-4 max-w-md rounded bg-amber-200/60 dark:bg-amber-400/10" }, x)) }) : /* @__PURE__ */ a("p", { className: "mx-3 mt-2", children: [
595
600
  "No records route to ",
596
- me(g),
601
+ pe(c),
597
602
  ", so nothing they see changes."
598
603
  ] }),
599
- (((U = v == null ? void 0 : v.partial) == null ? void 0 : U.length) ?? 0) > 0 && /* @__PURE__ */ a("p", { className: "mx-3 mt-1.5 text-[11px] text-amber-900 dark:text-amber-200", children: [
604
+ (((j = N == null ? void 0 : N.partial) == null ? void 0 : j.length) ?? 0) > 0 && /* @__PURE__ */ a("p", { className: "mx-3 mt-1.5 text-[11px] text-amber-900 dark:text-amber-200", children: [
600
605
  "Not counted in time: ",
601
- (H = v == null ? void 0 : v.partial) == null ? void 0 : H.map((h) => h.label).join(", "),
606
+ (H = N == null ? void 0 : N.partial) == null ? void 0 : H.map((x) => x.label).join(", "),
602
607
  "."
603
608
  ] }),
604
609
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2 px-3 pb-2.5 pt-2.5", children: [
605
- y === "error" ? /* @__PURE__ */ a(z, { children: [
610
+ y === "error" ? /* @__PURE__ */ a(I, { children: [
606
611
  /* @__PURE__ */ t(
607
612
  "button",
608
613
  {
@@ -617,7 +622,7 @@ function Qe({
617
622
  {
618
623
  type: "button",
619
624
  "data-scope-apply": !0,
620
- onClick: c,
625
+ onClick: b,
621
626
  className: "inline-flex h-7 items-center rounded-md border border-amber-400 px-3 text-[11.5px] font-medium text-amber-900 hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/40 dark:border-amber-500/50 dark:text-amber-200 dark:hover:bg-amber-400/10",
622
627
  children: "Apply without counts"
623
628
  }
@@ -625,7 +630,7 @@ function Qe({
625
630
  ] }) : w.length > 0 && y === "ready" ? /* @__PURE__ */ t("span", { "data-scope-apply-danger": !0, children: /* @__PURE__ */ a(
626
631
  Y,
627
632
  {
628
- onConfirm: c,
633
+ onConfirm: b,
629
634
  confirmLabel: `Press again — ${G}`,
630
635
  className: "inline-flex h-7 items-center rounded-md bg-red-600 px-3 text-[11.5px] font-medium text-white hover:bg-red-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500/50 focus-visible:ring-offset-1 dark:bg-red-700 dark:hover:bg-red-600",
631
636
  armedClassName: "bg-red-700 dark:bg-red-800",
@@ -640,7 +645,7 @@ function Qe({
640
645
  type: "button",
641
646
  "data-scope-apply": !0,
642
647
  disabled: !i,
643
- onClick: c,
648
+ onClick: b,
644
649
  className: "inline-flex h-7 items-center rounded-md bg-amber-700 px-3 text-[11.5px] font-medium text-[#fff] hover:bg-amber-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/50 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:bg-amber-700/45 dark:bg-amber-400 dark:text-[#1c1003] dark:hover:bg-amber-300 dark:disabled:bg-amber-400/40",
645
650
  children: S ? "Remove restriction" : "Apply restriction"
646
651
  }
@@ -649,7 +654,7 @@ function Qe({
649
654
  "button",
650
655
  {
651
656
  type: "button",
652
- onClick: x,
657
+ onClick: h,
653
658
  className: "inline-flex h-7 items-center rounded-md px-2 text-[11.5px] text-amber-900 hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/40 dark:text-amber-200 dark:hover:bg-amber-400/10",
654
659
  children: "Cancel"
655
660
  }
@@ -660,8 +665,8 @@ function Qe({
660
665
  }
661
666
  );
662
667
  }
663
- function pe({ items: e }) {
664
- return /* @__PURE__ */ t(z, { children: e.map((n, d) => /* @__PURE__ */ a("span", { children: [
668
+ function he({ items: e }) {
669
+ return /* @__PURE__ */ t(I, { children: e.map((n, d) => /* @__PURE__ */ a("span", { children: [
665
670
  d > 0 && ", ",
666
671
  /^\d+$/.test(n.label) ? /* @__PURE__ */ a("span", { className: "font-mono text-[10.5px]", children: [
667
672
  "#",
@@ -669,9 +674,9 @@ function pe({ items: e }) {
669
674
  ] }) : n.label
670
675
  ] }, n.id)) });
671
676
  }
672
- function je({ row: e }) {
673
- var x, p, N, o;
674
- const n = e.label ?? re(e.collection), d = e.gained ?? 0, i = e.lost ?? 0, u = e.proposed - e.current, c = (g, m) => g > m ? ` and ${I(g - m)} more` : "";
677
+ function We({ row: e }) {
678
+ var h, p, k, l;
679
+ const n = e.label ?? re(e.collection), d = e.gained ?? 0, i = e.lost ?? 0, o = e.proposed - e.current, b = (c, m) => c > m ? ` and ${B(c - m)} more` : "";
675
680
  return /* @__PURE__ */ a(
676
681
  "li",
677
682
  {
@@ -680,43 +685,43 @@ function je({ row: e }) {
680
685
  children: [
681
686
  /* @__PURE__ */ t("span", { className: "min-w-0 truncate font-medium", children: n }),
682
687
  /* @__PURE__ */ a("span", { className: "text-right tabular-nums", children: [
683
- e.proposed === 0 && e.total > 0 ? /* @__PURE__ */ t("span", { className: "font-semibold text-red-700 dark:text-red-300", children: "none" }) : I(e.proposed),
688
+ e.proposed === 0 && e.total > 0 ? /* @__PURE__ */ t("span", { className: "font-semibold text-red-700 dark:text-red-300", children: "none" }) : B(e.proposed),
684
689
  /* @__PURE__ */ a("span", { className: "text-amber-900 dark:text-amber-200", children: [
685
690
  " of ",
686
- I(e.total)
691
+ B(e.total)
687
692
  ] })
688
693
  ] }),
689
694
  /* @__PURE__ */ t(
690
695
  "span",
691
696
  {
692
- className: A(
697
+ className: T(
693
698
  "text-right text-[11.5px] tabular-nums",
694
- u > 0 ? "font-semibold text-emerald-700 dark:text-emerald-400" : u < 0 ? "font-semibold text-red-700 dark:text-red-400" : "text-amber-900 dark:text-amber-200"
699
+ o > 0 ? "font-semibold text-emerald-700 dark:text-emerald-400" : o < 0 ? "font-semibold text-red-700 dark:text-red-400" : "text-amber-900 dark:text-amber-200"
695
700
  ),
696
- children: u > 0 ? `+${I(u)}` : u < 0 ? `−${I(-u)}` : "no change"
701
+ children: o > 0 ? `+${B(o)}` : o < 0 ? `−${B(-o)}` : "no change"
697
702
  }
698
703
  ),
699
- d > 0 && (((x = e.gained_sample) == null ? void 0 : x.length) ?? 0) > 0 && /* @__PURE__ */ a(
704
+ d > 0 && (((h = e.gained_sample) == null ? void 0 : h.length) ?? 0) > 0 && /* @__PURE__ */ a(
700
705
  "p",
701
706
  {
702
707
  className: "col-span-3 mt-0.5 truncate text-[11px] text-amber-900 dark:text-amber-200",
703
708
  "data-scope-impact-gained": d,
704
709
  children: [
705
710
  "Newly visible: ",
706
- /* @__PURE__ */ t(pe, { items: e.gained_sample ?? [] }),
707
- c(d, ((p = e.gained_sample) == null ? void 0 : p.length) ?? 0)
711
+ /* @__PURE__ */ t(he, { items: e.gained_sample ?? [] }),
712
+ b(d, ((p = e.gained_sample) == null ? void 0 : p.length) ?? 0)
708
713
  ]
709
714
  }
710
715
  ),
711
- i > 0 && (((N = e.lost_sample) == null ? void 0 : N.length) ?? 0) > 0 && /* @__PURE__ */ a(
716
+ i > 0 && (((k = e.lost_sample) == null ? void 0 : k.length) ?? 0) > 0 && /* @__PURE__ */ a(
712
717
  "p",
713
718
  {
714
719
  className: "col-span-3 mt-0.5 truncate text-[11px] text-amber-900 dark:text-amber-200",
715
720
  "data-scope-impact-lost": i,
716
721
  children: [
717
722
  "No longer visible: ",
718
- /* @__PURE__ */ t(pe, { items: e.lost_sample ?? [] }),
719
- c(i, ((o = e.lost_sample) == null ? void 0 : o.length) ?? 0)
723
+ /* @__PURE__ */ t(he, { items: e.lost_sample ?? [] }),
724
+ b(i, ((l = e.lost_sample) == null ? void 0 : l.length) ?? 0)
720
725
  ]
721
726
  }
722
727
  )
@@ -724,7 +729,7 @@ function je({ row: e }) {
724
729
  }
725
730
  );
726
731
  }
727
- const Me = [
732
+ const Xe = [
728
733
  { key: "first_name", label: "First name" },
729
734
  { key: "last_name", label: "Last name" },
730
735
  { key: "title", label: "Title" },
@@ -738,51 +743,51 @@ const Me = [
738
743
  { key: "employee_id", label: "Employee id" },
739
744
  { key: "preferred_language", label: "Language" }
740
745
  ];
741
- function nt({ profile: e }) {
742
- var _, q, v, y;
743
- const n = E(), d = ae(), i = ie(e.id), u = P({
746
+ function kt({ profile: e }) {
747
+ var $, R, N, y;
748
+ const n = F(), d = ae(), i = ie(e.id), o = K({
744
749
  queryKey: ["nvr-directory-status"],
745
- queryFn: () => n.request(F("/directory/status")).then((s) => s.data),
750
+ queryFn: () => n.request(P("/directory/status")).then((s) => s.data),
746
751
  staleTime: 5 * 6e4
747
- }), c = P({
752
+ }), b = K({
748
753
  queryKey: ["nvr-directory-entry", e.email],
749
- queryFn: () => n.request(F(`/directory/users/${encodeURIComponent(e.email)}`)).then((s) => s.data).catch((s) => {
754
+ queryFn: () => n.request(P(`/directory/users/${encodeURIComponent(e.email)}`)).then((s) => s.data).catch((s) => {
750
755
  if ((s == null ? void 0 : s.status) === 404) return null;
751
756
  throw s;
752
757
  }),
753
- enabled: !!((_ = u.data) != null && _.granted && e.email),
758
+ enabled: !!(($ = o.data) != null && $.granted && e.email),
754
759
  staleTime: 6e4
755
- }), x = j({
760
+ }), h = Q({
756
761
  mutationFn: () => n.request(se(`/directory/sync/${e.id}`)).then((s) => s.data),
757
762
  onSuccess: ({ summary: s }) => {
758
- i(), d.invalidateQueries({ queryKey: ["nvr-directory-entry", e.email] }), s.active > 0 ? L.success("Still with the company — profile synced from the directory") : L.warning(
763
+ i(), d.invalidateQueries({ queryKey: ["nvr-directory-entry", e.email] }), s.active > 0 ? A.success("Still with the company — profile synced from the directory") : A.warning(
759
764
  `${s.missing > 0 ? "Not in the directory" : "Disabled in Azure"}${s.suspended > 0 ? " — suspended" : ""}`
760
765
  );
761
766
  },
762
- onError: (s) => L.error(M(s, "Directory sync failed"))
767
+ onError: (s) => A.error(z(s, "Directory sync failed"))
763
768
  });
764
- if (u.isLoading || !((q = u.data) != null && q.configured)) return null;
765
- const p = e, N = (s) => {
769
+ if (o.isLoading || !((R = o.data) != null && R.configured)) return null;
770
+ const p = e, k = (s) => {
766
771
  var w;
767
772
  return p[s] ?? ((w = e.admin) == null ? void 0 : w[s]) ?? null;
768
- }, o = c.data, g = ((v = e.admin) == null ? void 0 : v.directory_status) ?? null, m = g === "active" ? "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-200" : g === "disabled" || g === "missing" ? "border-red-200 bg-red-50 text-red-800 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-200" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-border dark:bg-muted dark:text-muted-foreground", D = g === "active" ? "Still with the company" : g === "disabled" ? "Account disabled in Azure — no longer with the company" : g === "missing" ? "Not in the Microsoft directory — no longer with the company" : "Not checked against the directory yet";
773
+ }, l = b.data, c = ((N = e.admin) == null ? void 0 : N.directory_status) ?? null, m = c === "active" ? "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-200" : c === "disabled" || c === "missing" ? "border-red-200 bg-red-50 text-red-800 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-200" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-border dark:bg-muted dark:text-muted-foreground", q = c === "active" ? "Still with the company" : c === "disabled" ? "Account disabled in Azure — no longer with the company" : c === "missing" ? "Not in the Microsoft directory — no longer with the company" : "Not checked against the directory yet";
769
774
  return /* @__PURE__ */ a(
770
775
  J,
771
776
  {
772
- icon: /* @__PURE__ */ t(Ce, { className: "h-4 w-4" }),
777
+ icon: /* @__PURE__ */ t(qe, { className: "h-4 w-4" }),
773
778
  title: "Microsoft directory",
774
779
  hint: "Pulling writes every field the directory has a value for; blanks never clear",
775
780
  testId: "directory",
776
- actions: u.data.granted && /* @__PURE__ */ a(
781
+ actions: o.data.granted && /* @__PURE__ */ a(
777
782
  "button",
778
783
  {
779
784
  type: "button",
780
- onClick: () => x.mutate(),
781
- disabled: x.isPending,
785
+ onClick: () => h.mutate(),
786
+ disabled: h.isPending,
782
787
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
783
788
  children: [
784
- /* @__PURE__ */ t(te, { className: A("h-3 w-3", x.isPending && "animate-spin") }),
785
- x.isPending ? "Checking…" : "Sync from directory"
789
+ /* @__PURE__ */ t(te, { className: T("h-3 w-3", h.isPending && "animate-spin") }),
790
+ h.isPending ? "Checking…" : "Sync from directory"
786
791
  ]
787
792
  }
788
793
  ),
@@ -790,38 +795,38 @@ function nt({ profile: e }) {
790
795
  /* @__PURE__ */ a(
791
796
  "div",
792
797
  {
793
- className: A("rounded-md border px-3 py-2 text-[12.5px]", m),
794
- "data-directory-verdict": g ?? "unchecked",
798
+ className: T("rounded-md border px-3 py-2 text-[12.5px]", m),
799
+ "data-directory-verdict": c ?? "unchecked",
795
800
  children: [
796
- /* @__PURE__ */ t("span", { className: "font-medium", children: D }),
801
+ /* @__PURE__ */ t("span", { className: "font-medium", children: q }),
797
802
  ((y = e.admin) == null ? void 0 : y.directory_checked_at) && /* @__PURE__ */ a("span", { className: "ml-2 text-[11px] opacity-70", children: [
798
803
  "checked ",
799
- Pe(e.admin.directory_checked_at)
804
+ Be(e.admin.directory_checked_at)
800
805
  ] }),
801
- (g === "disabled" || g === "missing") && /* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] opacity-80", children: "Hand off what they still own under Admin tools. Redaction stays a separate step." })
806
+ (c === "disabled" || c === "missing") && /* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] opacity-80", children: "Hand off what they still own under Admin tools. Redaction stays a separate step." })
802
807
  ]
803
808
  }
804
809
  ),
805
- u.data.granted ? c.isLoading ? /* @__PURE__ */ t("p", { className: "mt-3 text-[12px] text-slate-400", children: "Looking up the directory…" }) : c.isError ? /* @__PURE__ */ t("p", { className: "mt-3 text-[12px] text-red-600 dark:text-red-400", children: M(c.error, "The directory lookup failed.") }) : o ? /* @__PURE__ */ a("div", { className: "mt-3 space-y-3", children: [
810
+ o.data.granted ? b.isLoading ? /* @__PURE__ */ t("p", { className: "mt-3 text-[12px] text-slate-400", children: "Looking up the directory…" }) : b.isError ? /* @__PURE__ */ t("p", { className: "mt-3 text-[12px] text-red-600 dark:text-red-400", children: z(b.error, "The directory lookup failed.") }) : l ? /* @__PURE__ */ a("div", { className: "mt-3 space-y-3", children: [
806
811
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2 text-[12px]", children: [
807
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-800 dark:text-foreground", children: o.display_name ?? `${o.first_name ?? ""} ${o.last_name ?? ""}`.trim() }),
808
- o.upn && o.upn.toLowerCase() !== e.email.toLowerCase() && /* @__PURE__ */ a("span", { className: "text-slate-400", children: [
812
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-800 dark:text-foreground", children: l.display_name ?? `${l.first_name ?? ""} ${l.last_name ?? ""}`.trim() }),
813
+ l.upn && l.upn.toLowerCase() !== e.email.toLowerCase() && /* @__PURE__ */ a("span", { className: "text-slate-400", children: [
809
814
  "UPN ",
810
- o.upn
815
+ l.upn
811
816
  ] }),
812
- o.account_enabled === !1 && /* @__PURE__ */ t("span", { className: "rounded-full bg-red-50 px-2 py-0.5 text-[11px] font-medium text-red-700 dark:bg-red-400/10 dark:text-red-300", children: "Disabled in Azure" }),
813
- o.manager && /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
817
+ l.account_enabled === !1 && /* @__PURE__ */ t("span", { className: "rounded-full bg-red-50 px-2 py-0.5 text-[11px] font-medium text-red-700 dark:bg-red-400/10 dark:text-red-300", children: "Disabled in Azure" }),
818
+ l.manager && /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
814
819
  "Reports to",
815
820
  " ",
816
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-foreground", children: o.manager.display_name ?? o.manager.email })
821
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-foreground", children: l.manager.display_name ?? l.manager.email })
817
822
  ] })
818
823
  ] }),
819
- /* @__PURE__ */ t("dl", { className: "grid gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border sm:grid-cols-2 lg:grid-cols-3", children: Me.filter((s) => s.key in o).map((s) => {
820
- const w = o[s.key] ?? null, S = N(s.key), C = !!w && w !== S;
824
+ /* @__PURE__ */ t("dl", { className: "grid gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border sm:grid-cols-2 lg:grid-cols-3", children: Xe.filter((s) => s.key in l).map((s) => {
825
+ const w = l[s.key] ?? null, S = k(s.key), C = !!w && w !== S;
821
826
  return /* @__PURE__ */ a(
822
827
  "div",
823
828
  {
824
- className: A(
829
+ className: T(
825
830
  "bg-white px-3 py-2 dark:bg-card",
826
831
  C && "bg-amber-50/60 dark:bg-amber-400/10"
827
832
  ),
@@ -843,45 +848,45 @@ function nt({ profile: e }) {
843
848
  "."
844
849
  ] }) : /* @__PURE__ */ a("div", { className: "mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-900 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-200", children: [
845
850
  /* @__PURE__ */ t("p", { className: "font-medium", children: "Directory access is not granted yet." }),
846
- /* @__PURE__ */ t("p", { className: "mt-0.5", children: u.data.reason ?? "The app token cannot read other users. Grant User.Read.All as an application permission with admin consent." })
851
+ /* @__PURE__ */ t("p", { className: "mt-0.5", children: o.data.reason ?? "The app token cannot read other users. Grant User.Read.All as an application permission with admin consent." })
847
852
  ] })
848
853
  ]
849
854
  }
850
855
  );
851
856
  }
852
- function st({ profile: e }) {
853
- var g;
854
- const n = E(), d = ie(e.id), [i, u] = K(null), [c, x] = K(!1), p = j({
857
+ function Nt({ profile: e }) {
858
+ var c;
859
+ const n = F(), d = ie(e.id), [i, o] = E(null), [b, h] = E(!1), p = Q({
855
860
  mutationFn: () => n.request(se(`/users/${e.id}/token`)).then((m) => m.data.token),
856
861
  onSuccess: (m) => {
857
- u(m), x(!0), d(), L.success("Token generated — copy it now, it is shown once");
862
+ o(m), h(!0), d(), A.success("Token generated — copy it now, it is shown once");
858
863
  },
859
- onError: (m) => L.error(M(m, "Could not generate a token"))
860
- }), N = j({
861
- mutationFn: () => n.request(ge(`/users/${e.id}/token`)),
864
+ onError: (m) => A.error(z(m, "Could not generate a token"))
865
+ }), k = Q({
866
+ mutationFn: () => n.request(ye(`/users/${e.id}/token`)),
862
867
  onSuccess: () => {
863
- u(null), x(!1), d(), L.success("Token revoked");
868
+ o(null), h(!1), d(), A.success("Token revoked");
864
869
  },
865
- onError: (m) => L.error(M(m, "Could not revoke the token"))
866
- }), o = !!((g = e.admin) != null && g.has_static_token) || !!i;
870
+ onError: (m) => A.error(z(m, "Could not revoke the token"))
871
+ }), l = !!((c = e.admin) != null && c.has_static_token) || !!i;
867
872
  return /* @__PURE__ */ t(
868
873
  J,
869
874
  {
870
- icon: /* @__PURE__ */ t(Ae, { className: "h-4 w-4" }),
875
+ icon: /* @__PURE__ */ t(Ee, { className: "h-4 w-4" }),
871
876
  title: "API token",
872
877
  hint: "Static bearer token for scripts and the SDK",
873
878
  testId: "api-token",
874
- children: o ? /* @__PURE__ */ a("div", { className: "space-y-3", children: [
879
+ children: l ? /* @__PURE__ */ a("div", { className: "space-y-3", children: [
875
880
  i ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
876
- /* @__PURE__ */ t("code", { className: "flex-1 break-all rounded-md border border-slate-200 bg-slate-50 px-3 py-2 font-mono text-[12px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200", children: c ? i : "•".repeat(24) }),
881
+ /* @__PURE__ */ t("code", { className: "flex-1 break-all rounded-md border border-slate-200 bg-slate-50 px-3 py-2 font-mono text-[12px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200", children: b ? i : "•".repeat(24) }),
877
882
  /* @__PURE__ */ t(
878
883
  "button",
879
884
  {
880
885
  type: "button",
881
- onClick: () => x((m) => !m),
882
- "aria-label": c ? "Hide token" : "Reveal token",
886
+ onClick: () => h((m) => !m),
887
+ "aria-label": b ? "Hide token" : "Reveal token",
883
888
  className: "rounded-md border border-slate-200 p-2 text-slate-500 hover:bg-slate-50 dark:border-border dark:hover:bg-muted",
884
- children: c ? /* @__PURE__ */ t(_e, { className: "h-4 w-4" }) : /* @__PURE__ */ t(qe, { className: "h-4 w-4" })
889
+ children: b ? /* @__PURE__ */ t(Le, { className: "h-4 w-4" }) : /* @__PURE__ */ t(Te, { className: "h-4 w-4" })
885
890
  }
886
891
  ),
887
892
  /* @__PURE__ */ t(
@@ -889,11 +894,11 @@ function st({ profile: e }) {
889
894
  {
890
895
  type: "button",
891
896
  onClick: () => {
892
- navigator.clipboard.writeText(i), L.success("Copied");
897
+ navigator.clipboard.writeText(i), A.success("Copied");
893
898
  },
894
899
  "aria-label": "Copy token",
895
900
  className: "rounded-md border border-slate-200 p-2 text-slate-500 hover:bg-slate-50 dark:border-border dark:hover:bg-muted",
896
- children: /* @__PURE__ */ t(Re, { className: "h-4 w-4" })
901
+ children: /* @__PURE__ */ t(Ae, { className: "h-4 w-4" })
897
902
  }
898
903
  )
899
904
  ] }) : /* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-600 dark:text-slate-300", children: "A token is set. The value is never shown again — regenerate to issue a new one." }),
@@ -915,20 +920,20 @@ function st({ profile: e }) {
915
920
  /* @__PURE__ */ a(
916
921
  Y,
917
922
  {
918
- onConfirm: () => N.mutate(),
919
- disabled: N.isPending,
923
+ onConfirm: () => k.mutate(),
924
+ disabled: k.isPending,
920
925
  confirmLabel: "Revoke — scripts using it stop working?",
921
926
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-red-600 transition-colors hover:bg-red-50 disabled:opacity-50 dark:border-border dark:text-red-400 dark:hover:bg-red-500/10",
922
927
  armedClassName: "border-red-300",
923
928
  children: [
924
- /* @__PURE__ */ t(Le, { className: "h-3 w-3" }),
929
+ /* @__PURE__ */ t(De, { className: "h-3 w-3" }),
925
930
  " Revoke"
926
931
  ]
927
932
  }
928
933
  )
929
934
  ] })
930
935
  ] }) : /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-3", children: [
931
- /* @__PURE__ */ t(fe, { children: "No token issued." }),
936
+ /* @__PURE__ */ t(ke, { children: "No token issued." }),
932
937
  /* @__PURE__ */ a(
933
938
  "button",
934
939
  {
@@ -937,7 +942,7 @@ function st({ profile: e }) {
937
942
  disabled: p.isPending,
938
943
  className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
939
944
  children: [
940
- /* @__PURE__ */ t(te, { className: A("h-3 w-3", p.isPending && "animate-spin") }),
945
+ /* @__PURE__ */ t(te, { className: T("h-3 w-3", p.isPending && "animate-spin") }),
941
946
  p.isPending ? "Generating…" : "Generate token"
942
947
  ]
943
948
  }
@@ -946,62 +951,125 @@ function st({ profile: e }) {
946
951
  }
947
952
  );
948
953
  }
949
- function it({ userId: e }) {
950
- const n = E(), d = ae(), { data: i = [] } = P({
951
- queryKey: ["nvr-user-sessions", e],
952
- queryFn: () => n.request(
953
- F("/security/sessions", { user_id: e })
954
- ).then((c) => c.data).catch(() => []),
954
+ function Ye(e) {
955
+ if (!Number.isFinite(e) || e <= 0) return "Ending now";
956
+ if (e < 3600) return `Ends in ${Math.max(1, Math.round(e / 60))} min`;
957
+ const n = Math.round(e / 3600);
958
+ return n >= 48 ? `Ends in ${Math.round(n / 24)} days` : `Ends in ${n}h`;
959
+ }
960
+ function wt({ userId: e }) {
961
+ const n = F(), d = ae(), i = ["nvr-user-sessions", e], o = K({
962
+ queryKey: i,
963
+ queryFn: () => n.request(P("/security/sessions", { user_id: e })).then((c) => c.data ?? []),
955
964
  staleTime: 3e4
956
- }), u = j({
957
- mutationFn: (c) => n.request(ge(`/security/sessions/${c}`)),
958
- onSuccess: () => {
959
- d.invalidateQueries({ queryKey: ["nvr-user-sessions", e] }), L.success("Session revoked");
965
+ }), b = e.toUpperCase();
966
+ Qe(
967
+ "sessions",
968
+ () => {
969
+ d.invalidateQueries({ queryKey: ["nvr-user-sessions", e] }), d.invalidateQueries({ queryKey: ["nvr-signed-in-devices", e] });
960
970
  },
961
- onError: (c) => L.error(M(c, "Could not revoke"))
962
- });
971
+ {
972
+ debounceMs: 800,
973
+ match: (c) => c.all === !0 || String(c.user_id ?? "").toUpperCase() === b
974
+ }
975
+ );
976
+ const h = Q({
977
+ mutationFn: (c) => n.request(ye(`/security/sessions/${c}`)),
978
+ onSuccess: (c, m) => {
979
+ d.setQueryData(i, (q) => q == null ? void 0 : q.filter(($) => $.sid_prefix !== m)), A.success("That browser is signed out");
980
+ },
981
+ onError: (c) => ve(c, "Could not sign that browser out")
982
+ }), p = o.data ?? [], k = je(p.map((c) => c.sid_prefix)), { quiet: l } = Ue();
963
983
  return /* @__PURE__ */ t(
964
984
  J,
965
985
  {
966
- icon: /* @__PURE__ */ t($e, { className: "h-4 w-4" }),
967
- title: `Live sessions · ${i.length}`,
968
- hint: "Revoking one signs that browser out on its next request",
986
+ icon: /* @__PURE__ */ t(Re, { className: "h-4 w-4" }),
987
+ title: o.isSuccess ? `Signed-in browsers · ${p.length}` : "Signed-in browsers",
988
+ hint: "Signing a browser out ends it on its next request",
969
989
  testId: "sessions",
970
- children: i.length === 0 ? /* @__PURE__ */ t(fe, { children: "No live sessions." }) : /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: i.map((c) => /* @__PURE__ */ a(
971
- "li",
990
+ children: o.isLoading ? /* @__PURE__ */ a("div", { className: "space-y-3", "aria-hidden": !0, children: [
991
+ /* @__PURE__ */ t(me, { className: "h-9 w-full" }),
992
+ /* @__PURE__ */ t(me, { className: "h-9 w-2/3" })
993
+ ] }) : o.isError ? /* @__PURE__ */ t(ze, { error: o.error, what: "signed-in browsers", onRetry: () => o.refetch() }) : p.length === 0 ? /* @__PURE__ */ t(ke, { children: "Not signed in on any browser." }) : /* @__PURE__ */ t("ul", { "data-sessions-list": !0, className: "-my-2 divide-y divide-slate-100 dark:divide-border/60", children: p.map((c) => /* @__PURE__ */ t(
994
+ Ze,
972
995
  {
973
- className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300",
974
- children: [
975
- /* @__PURE__ */ a("span", { className: "font-mono text-slate-400", children: [
976
- c.sid_prefix,
977
- "…"
978
- ] }),
979
- /* @__PURE__ */ a("span", { className: "text-[11px] text-slate-400", children: [
980
- "expires in ",
981
- Math.max(1, Math.round(c.ttl_seconds / 3600)),
982
- "h"
983
- ] }),
984
- /* @__PURE__ */ t(
985
- Y,
986
- {
987
- onConfirm: () => u.mutate(c.sid_prefix),
988
- confirmLabel: "Sign them out?",
989
- className: "ml-auto text-[11px] text-red-500 underline decoration-dotted hover:text-red-600",
990
- children: "Revoke"
991
- }
992
- )
993
- ]
996
+ session: c,
997
+ fresh: !l && k.has(c.sid_prefix),
998
+ pending: h.isPending && h.variables === c.sid_prefix,
999
+ onRevoke: () => h.mutate(c.sid_prefix)
994
1000
  },
995
1001
  c.sid_prefix
996
1002
  )) })
997
1003
  }
998
1004
  );
999
1005
  }
1006
+ function Ze({
1007
+ session: e,
1008
+ fresh: n,
1009
+ pending: d,
1010
+ onRevoke: i
1011
+ }) {
1012
+ const o = e.device || "Browser", b = [
1013
+ e.ip,
1014
+ e.signed_in_at ? `Signed in ${Ie(e.signed_in_at)}` : "Signed in before this was recorded",
1015
+ Ye(e.ttl_seconds)
1016
+ ].filter(Boolean).join(" · "), h = ce(o), p = ce(b);
1017
+ return /* @__PURE__ */ a(
1018
+ "li",
1019
+ {
1020
+ "data-session-row": !0,
1021
+ "data-fresh": n || void 0,
1022
+ className: T(
1023
+ "-mx-2 flex items-center gap-3 rounded-md px-2 py-2.5 transition-colors duration-700 motion-reduce:transition-none",
1024
+ n && "bg-nvr-cyan/10"
1025
+ ),
1026
+ children: [
1027
+ /* @__PURE__ */ t("span", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-300", children: / on (iOS|Android)$/.test(o) ? /* @__PURE__ */ t(Ke, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ t(Pe, { className: "h-4 w-4", "aria-hidden": !0 }) }),
1028
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
1029
+ /* @__PURE__ */ t(
1030
+ "span",
1031
+ {
1032
+ ref: h,
1033
+ "data-session-device": !0,
1034
+ className: "block truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100",
1035
+ children: o
1036
+ }
1037
+ ),
1038
+ /* @__PURE__ */ t(
1039
+ "p",
1040
+ {
1041
+ ref: p,
1042
+ "data-session-meta": !0,
1043
+ className: "mt-0.5 truncate text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400",
1044
+ children: b
1045
+ }
1046
+ )
1047
+ ] }),
1048
+ /* @__PURE__ */ t("span", { "data-session-sign-out": !0, className: "contents", children: /* @__PURE__ */ a(
1049
+ Y,
1050
+ {
1051
+ title: `Sign out ${o}`,
1052
+ onConfirm: i,
1053
+ confirmLabel: "Sign it out?",
1054
+ disabled: d,
1055
+ className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:border-red-300 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:opacity-40 dark:border-border dark:text-slate-300 dark:hover:border-red-500/40 dark:hover:text-red-400",
1056
+ armedClassName: "border-red-300 font-semibold text-red-600 dark:border-red-500/40 dark:text-red-400",
1057
+ children: [
1058
+ /* @__PURE__ */ t(Fe, { className: "h-3 w-3", "aria-hidden": !0 }),
1059
+ d ? "Signing out…" : "Sign out"
1060
+ ]
1061
+ }
1062
+ ) })
1063
+ ]
1064
+ }
1065
+ );
1066
+ }
1000
1067
  export {
1001
- tt as AccessCard,
1002
- st as ApiTokenCard,
1003
- it as SessionsCard,
1004
- rt as SuspensionBanner,
1005
- nt as UserDirectoryCard,
1006
- at as UserScopesCard
1068
+ ft as AccessCard,
1069
+ Nt as ApiTokenCard,
1070
+ wt as SessionsCard,
1071
+ yt as SuspensionBanner,
1072
+ kt as UserDirectoryCard,
1073
+ vt as UserScopesCard,
1074
+ Ye as sessionEndsIn
1007
1075
  };