@nivaro/react 0.3.114 → 0.3.115

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 (281) 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 +1717 -21
  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 +4088 -3592
  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 +1 -0
  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/PageRenderer.js +636 -599
  39. package/dist/shared/components/PresenceDot.js +21 -0
  40. package/dist/shared/components/ProfileView.js +656 -536
  41. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  42. package/dist/shared/components/RecentRecordsRail.js +51 -48
  43. package/dist/shared/components/RecordCompare.js +241 -150
  44. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  45. package/dist/shared/components/RecordGridEditor.js +350 -311
  46. package/dist/shared/components/RecordHoverCard.js +147 -0
  47. package/dist/shared/components/RecordPeekHost.js +111 -0
  48. package/dist/shared/components/RecordReadView.js +414 -412
  49. package/dist/shared/components/RelativeTime.js +16 -0
  50. package/dist/shared/components/ReportView.js +1396 -1304
  51. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  52. package/dist/shared/components/TabCountHost.js +10 -0
  53. package/dist/shared/components/TickerNumber.js +19 -18
  54. package/dist/shared/components/TipLayer.js +70 -58
  55. package/dist/shared/components/WidgetImageMenu.js +59 -0
  56. package/dist/shared/components/WidgetSlot.js +571 -524
  57. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  58. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  59. package/dist/shared/components/cbv/approval-changed.js +20 -0
  60. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  61. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  62. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  63. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  65. package/dist/shared/components/change-proposals/types.js +4 -0
  66. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  67. package/dist/shared/components/chat/Composer.js +276 -298
  68. package/dist/shared/components/chat/room-due.js +13 -0
  69. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  70. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  71. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  72. package/dist/shared/components/imports/ImportConsole.js +159 -155
  73. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  74. package/dist/shared/components/integrations/SendStatus.js +202 -0
  75. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  76. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  77. package/dist/shared/components/integrations/console/api.js +161 -117
  78. package/dist/shared/components/integrations/console/tone.js +15 -12
  79. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  80. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  81. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  82. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  83. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  84. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  85. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  86. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  87. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  88. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  89. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  90. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  91. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  92. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  93. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  94. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  95. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  96. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  97. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  98. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  99. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  100. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  101. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  102. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  103. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  104. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  105. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  106. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  107. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  108. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  109. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  110. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  111. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  112. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  113. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  114. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  115. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  116. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  117. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  118. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  119. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  120. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  121. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  122. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  123. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  124. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  125. package/dist/shared/components/item-edit/file-live.js +77 -0
  126. package/dist/shared/components/item-edit/file-processing.js +87 -0
  127. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  128. package/dist/shared/components/item-edit/live-related.js +23 -0
  129. package/dist/shared/components/item-edit/live-title.js +66 -0
  130. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  131. package/dist/shared/components/item-edit/removed-line.js +58 -0
  132. package/dist/shared/components/item-edit/render-stability.js +70 -59
  133. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  134. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  135. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  136. package/dist/shared/components/list/InlineEdit.js +504 -208
  137. package/dist/shared/components/list/ListViewers.js +81 -0
  138. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  139. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  140. package/dist/shared/components/merge/merge-values.js +110 -0
  141. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  142. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  143. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  144. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  145. package/dist/shared/components/notifications/bundles.js +21 -19
  146. package/dist/shared/components/notifications/resolved-line.js +25 -0
  147. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  148. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  149. package/dist/shared/components/panels/AlertBanners.js +132 -0
  150. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  151. package/dist/shared/components/panels/BranchLanes.js +82 -54
  152. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  153. package/dist/shared/components/panels/CommentImages.js +219 -0
  154. package/dist/shared/components/panels/CommentPanel.js +649 -530
  155. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  156. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  157. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  158. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  159. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  160. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  161. package/dist/shared/components/panels/SlaClock.js +130 -99
  162. package/dist/shared/components/panels/TaskPanel.js +308 -287
  163. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  164. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  165. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  166. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  167. package/dist/shared/components/profile/AgentNameField.js +141 -0
  168. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  169. package/dist/shared/components/profile/PersonAccess.js +398 -330
  170. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  171. package/dist/shared/components/profile/PersonProfile.js +81 -73
  172. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  173. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  174. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  175. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  176. package/dist/shared/components/queue/QueueWorklist.js +1927 -1635
  177. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  178. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  179. package/dist/shared/components/support/ReportProblem.js +1 -0
  180. package/dist/shared/components/support/ScreenShare.js +554 -0
  181. package/dist/shared/components/support/SupportView.js +160 -129
  182. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  183. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  184. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  185. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  186. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  187. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  188. package/dist/shared/lib/activity-sentence.js +87 -75
  189. package/dist/shared/lib/agent-presence.js +46 -0
  190. package/dist/shared/lib/approval-progress.js +49 -0
  191. package/dist/shared/lib/attention-prefs.js +27 -0
  192. package/dist/shared/lib/cell-locks.js +56 -0
  193. package/dist/shared/lib/co-edit.js +166 -0
  194. package/dist/shared/lib/coedit-registry.js +44 -0
  195. package/dist/shared/lib/comment-awareness.js +124 -0
  196. package/dist/shared/lib/comment-images.js +45 -0
  197. package/dist/shared/lib/config-watch.js +94 -0
  198. package/dist/shared/lib/copy-rules.js +65 -0
  199. package/dist/shared/lib/count-step.js +30 -0
  200. package/dist/shared/lib/deadline-ticker.js +68 -0
  201. package/dist/shared/lib/derived-causes.js +115 -0
  202. package/dist/shared/lib/draft-store.js +114 -85
  203. package/dist/shared/lib/error-hints.js +1 -0
  204. package/dist/shared/lib/field-merge.js +126 -0
  205. package/dist/shared/lib/filter-sentence.js +10 -10
  206. package/dist/shared/lib/focus-mode.js +16 -12
  207. package/dist/shared/lib/grid-cursors.js +77 -0
  208. package/dist/shared/lib/grid-presence.js +182 -0
  209. package/dist/shared/lib/idle-reload.js +100 -73
  210. package/dist/shared/lib/in-step.js +45 -0
  211. package/dist/shared/lib/integration-chip.js +19 -18
  212. package/dist/shared/lib/line-locks.js +141 -0
  213. package/dist/shared/lib/line-split.js +41 -0
  214. package/dist/shared/lib/linked-changes.js +150 -0
  215. package/dist/shared/lib/list-return.js +231 -0
  216. package/dist/shared/lib/list-viewers.js +52 -0
  217. package/dist/shared/lib/live-announcer.js +86 -0
  218. package/dist/shared/lib/live-counts.js +85 -0
  219. package/dist/shared/lib/live-data-changed.js +108 -0
  220. package/dist/shared/lib/live-deltas.js +81 -0
  221. package/dist/shared/lib/live-findings.js +113 -0
  222. package/dist/shared/lib/live-groups.js +122 -0
  223. package/dist/shared/lib/live-link-labels.js +162 -0
  224. package/dist/shared/lib/live-list-flow.js +334 -0
  225. package/dist/shared/lib/live-list.js +143 -129
  226. package/dist/shared/lib/live-moves.js +51 -0
  227. package/dist/shared/lib/live-ops.js +26 -26
  228. package/dist/shared/lib/live-pickers.js +7 -0
  229. package/dist/shared/lib/live-preference.js +184 -0
  230. package/dist/shared/lib/live-queries.js +226 -181
  231. package/dist/shared/lib/live-screen.js +333 -0
  232. package/dist/shared/lib/live-search.js +108 -0
  233. package/dist/shared/lib/live-seen.js +35 -0
  234. package/dist/shared/lib/live-views.js +100 -0
  235. package/dist/shared/lib/live.js +159 -133
  236. package/dist/shared/lib/missed-updates.js +198 -0
  237. package/dist/shared/lib/newer-file.js +56 -0
  238. package/dist/shared/lib/notification-sound.js +42 -20
  239. package/dist/shared/lib/own-writes.js +59 -41
  240. package/dist/shared/lib/picker-badges.js +94 -0
  241. package/dist/shared/lib/presence-signals.js +131 -84
  242. package/dist/shared/lib/realtime.js +49 -24
  243. package/dist/shared/lib/record-gaps.js +85 -0
  244. package/dist/shared/lib/record-outbox.js +369 -222
  245. package/dist/shared/lib/record-peek.js +75 -0
  246. package/dist/shared/lib/record-tabs.js +92 -72
  247. package/dist/shared/lib/relative-ticker.js +42 -0
  248. package/dist/shared/lib/request-gate.js +119 -119
  249. package/dist/shared/lib/rollup-recalc.js +107 -0
  250. package/dist/shared/lib/room-gaps.js +40 -36
  251. package/dist/shared/lib/rum.js +137 -87
  252. package/dist/shared/lib/save-progress.js +20 -0
  253. package/dist/shared/lib/scheduled-countdown.js +67 -0
  254. package/dist/shared/lib/screen-refresh.js +160 -0
  255. package/dist/shared/lib/screen-share.js +234 -0
  256. package/dist/shared/lib/seen-since.js +74 -0
  257. package/dist/shared/lib/selection-watch.js +205 -0
  258. package/dist/shared/lib/send-status.js +132 -0
  259. package/dist/shared/lib/send-view.js +23 -0
  260. package/dist/shared/lib/socket-liveness.js +155 -0
  261. package/dist/shared/lib/socket-realtime.js +168 -140
  262. package/dist/shared/lib/state-census.js +53 -0
  263. package/dist/shared/lib/summary-mode.js +61 -39
  264. package/dist/shared/lib/tab-attention.js +143 -32
  265. package/dist/shared/lib/table-density.js +64 -0
  266. package/dist/shared/lib/track-travel.js +40 -0
  267. package/dist/shared/lib/unseen-changes.js +68 -0
  268. package/dist/shared/lib/upload-file.js +33 -0
  269. package/dist/shared/lib/upload-presence.js +127 -0
  270. package/dist/shared/lib/urgent-chime.js +65 -0
  271. package/dist/shared/lib/use-online-users.js +32 -11
  272. package/dist/shared/lib/user-sync.js +155 -39
  273. package/dist/shared/lib/waiting-count.js +44 -0
  274. package/dist/shared/lib/watch-desktop.js +83 -0
  275. package/dist/shared/lib/watch-list.js +447 -0
  276. package/dist/shared/lib/widget-image-render.js +64 -0
  277. package/dist/shared/lib/widget-image.js +111 -0
  278. package/dist/shared/lib/worker-socket.js +130 -104
  279. package/dist/shared/lib/write-to-screen.js +133 -0
  280. package/package.json +1 -1
  281. package/styles.css +49 -1
@@ -1,202 +1,228 @@
1
- import { useContext as _, useRef as h, useEffect as E } from "react";
1
+ import { useContext as _, useRef as h, useEffect as A } from "react";
2
2
  import { ItemEditAuthContext as j } from "../context.js";
3
- import { releaseLiveOwner as T, deliverLive as x } from "./focus-mode.js";
4
- import { isOwnWrite as F } from "./own-writes.js";
5
- import { noteOwnWrite as ee, noteOwnWriteFromCommand as ne } from "./own-writes.js";
6
- import { useOptionalRealtime as C } from "./realtime.js";
7
- const $ = "nvr:live-event";
8
- function U(n, ...o) {
9
- return n.changedFields === null ? !n.aspectsOnly : o.some((e) => {
10
- var t;
11
- return (t = n.changedFields) == null ? void 0 : t.includes(e);
3
+ import { releaseLiveOwner as x, deliverLive as T } from "./focus-mode.js";
4
+ import { liveEventQuiet as F } from "./live-preference.js";
5
+ import { getLiveMode as ne, liveMotionAllowed as re, useLiveBusy as oe, useLivePreference as ie } from "./live-preference.js";
6
+ import { isOwnWrite as M } from "./own-writes.js";
7
+ import { noteOwnWrite as se, noteOwnWriteFromCommand as le } from "./own-writes.js";
8
+ import { useOptionalRealtime as O } from "./realtime.js";
9
+ const S = "nvr:live-event";
10
+ function U(t, ...o) {
11
+ return t.changedFields === null ? !t.aspectsOnly : o.some((e) => {
12
+ var n;
13
+ return (n = t.changedFields) == null ? void 0 : n.includes(e);
12
14
  });
13
15
  }
14
- const P = {
16
+ const G = {
15
17
  state: "$state",
16
18
  addendums: "$addendums",
17
19
  comments: "$comments",
18
20
  tasks: "$tasks",
19
21
  integrations: "$integrations",
22
+ owners: "$owners",
20
23
  /** An edit lock was taken or released (list rows show the lock icon). */
21
- lock: "$lock"
24
+ lock: "$lock",
25
+ /** The files the record carries changed: a file field or file link, a file renamed, replaced
26
+ * or deleted (Files panels and file fields refetch as the viewer). */
27
+ files: "$files",
28
+ /** The SLA clock crossed its warning / breach line with no write (server flip pass). */
29
+ sla: "$sla",
30
+ /** A child or linked record changed — a line, a PO made from it, an invoice matched to it
31
+ * (line grids, related lists and record widgets refetch; coalesced server-side, `'*'` when a
32
+ * burst named more records than the cap). */
33
+ related: "$related",
34
+ /** Someone started or stopped editing a list cell of the record in place (rt6 #15): lists
35
+ * with inline editing re-read who holds which cell. */
36
+ cells: "$cells",
37
+ /** A scheduled change on the record was made, moved, cancelled or applied (rt7 #12). */
38
+ scheduled: "$scheduled",
39
+ /** A banner-enabled threshold alert fired on the record (rt9 #20): banners re-read. */
40
+ alerts: "$alerts",
41
+ /** A support request raised from the record opened, moved or closed (rt9 #19). */
42
+ support: "$support"
22
43
  };
23
- function k(n) {
44
+ function k(t) {
24
45
  for (const o of ["by", "user", "user_id"]) {
25
- const e = n[o];
46
+ const e = t[o];
26
47
  if (typeof e == "string" && e) return e;
27
48
  if (e && typeof e == "object" && typeof e.id == "string")
28
49
  return e.id;
29
50
  }
30
51
  return null;
31
52
  }
32
- function N(n, o) {
33
- const e = k(n);
53
+ function N(t, o) {
54
+ const e = k(t);
34
55
  if (e && o && e.toUpperCase() === o.toUpperCase()) return !0;
35
- const t = typeof n.collection == "string" ? n.collection : "", r = Array.isArray(n.changed_fields) ? n.changed_fields : null;
36
- return t !== "" && n.item != null && F(t, n.item, r);
56
+ const n = typeof t.collection == "string" ? t.collection : "", r = Array.isArray(t.changed_fields) ? t.changed_fields : null;
57
+ return n !== "" && t.item != null && M(n, t.item, r);
37
58
  }
38
- function V(n) {
39
- if (!n.coalesced) return [n];
40
- const { coalesced: o, items: e, many: t, count: r, ...c } = n;
41
- return t || !Array.isArray(e) ? [{ ...c, item: "*", ...typeof r == "number" ? { bulk: r } : {} }] : e.map((i) => ({ ...c, item: i }));
59
+ function Q(t) {
60
+ if (!t.coalesced) return [t];
61
+ const { coalesced: o, items: e, many: n, count: r, ...i } = t;
62
+ return n || !Array.isArray(e) ? [{ ...i, item: "*", ...typeof r == "number" ? { bulk: r } : {} }] : e.map((c) => ({ ...i, item: c }));
42
63
  }
43
- function v(n) {
44
- const o = [...new Set(n.map((r) => String(r.item)))];
45
- let e = /* @__PURE__ */ new Set(), t = n.length > 0;
46
- for (const r of n) {
47
- const c = r.changed_fields;
48
- if (!c || c.length === 0) {
49
- e = null, t = !1;
64
+ function W(t) {
65
+ const o = [...new Set(t.map((r) => String(r.item)))];
66
+ let e = /* @__PURE__ */ new Set(), n = t.length > 0;
67
+ for (const r of t) {
68
+ const i = r.changed_fields;
69
+ if (!i || i.length === 0) {
70
+ e = null, n = !1;
50
71
  continue;
51
72
  }
52
- if (c.every((i) => i.startsWith("$")) || (t = !1), e) for (const i of c) e.add(i);
73
+ if (i.every((c) => c.startsWith("$")) || (n = !1), e) for (const c of i) e.add(c);
53
74
  }
54
- return n.some((r) => r.action === "create" || r.action === "delete") && (t = !1), {
55
- events: n,
75
+ return t.some((r) => r.action === "create" || r.action === "delete") && (n = !1), {
76
+ events: t,
56
77
  ids: o,
57
78
  changedFields: e ? [...e] : null,
58
- aspectsOnly: t,
59
- deleted: n.some((r) => r.action === "delete"),
60
- created: n.some((r) => r.action === "create"),
61
- own: n.length > 0 && n.every((r) => r.own)
79
+ aspectsOnly: n,
80
+ deleted: t.some((r) => r.action === "delete"),
81
+ created: t.some((r) => r.action === "create"),
82
+ own: t.length > 0 && t.every((r) => r.own)
62
83
  };
63
84
  }
64
- function q(n, o, e = {}) {
65
- const t = C(), { userId: r } = _(j), c = h(o);
66
- c.current = o;
67
- const i = h(e);
68
- i.current = e;
69
- const s = h(r);
70
- s.current = r;
71
- const f = h({}), p = (n == null ? [] : Array.isArray(n) ? n : [n]).filter(Boolean).join(","), w = e.enabled !== !1;
72
- E(() => {
73
- if (!t || !p || !w) return;
85
+ function V(t, o, e = {}) {
86
+ const n = O(), { userId: r } = _(j), i = h(o);
87
+ i.current = o;
88
+ const c = h(e);
89
+ c.current = e;
90
+ const l = h(r);
91
+ l.current = r;
92
+ const f = h({}), p = (t == null ? [] : Array.isArray(t) ? t : [t]).filter(Boolean).join(","), w = e.enabled !== !1;
93
+ A(() => {
94
+ if (!n || !p || !w) return;
74
95
  const g = p.split(",");
75
96
  let a = [], y = null;
76
- const O = () => {
97
+ const R = () => {
77
98
  y = null;
78
- const u = a;
79
- a = [], u.length !== 0 && (i.current.focusable ? x(f.current, u, (l) => c.current(v(l))) : c.current(v(u)));
80
- }, A = t.subscribeCollections(g, (u) => {
81
- const l = u;
82
- if (!l || !g.includes(String(l.collection))) return;
83
- const d = i.current;
84
- for (const b of V(l)) {
85
- const R = { ...b, own: N(b, s.current) };
86
- R.own && !d.includeOwn || d.match && !d.match(R) || a.push(R);
99
+ const s = a;
100
+ a = [], s.length !== 0 && (c.current.focusable ? T(f.current, s, (u) => i.current(W(u))) : i.current(W(s)));
101
+ }, v = n.subscribeCollections(g, (s) => {
102
+ const u = s;
103
+ if (!u || !g.includes(String(u.collection))) return;
104
+ const d = c.current;
105
+ for (const L of Q(u)) {
106
+ const $ = { ...L, own: N(L, l.current) };
107
+ $.own && !d.includeOwn || d.match && !d.match($) || a.push($);
87
108
  }
88
109
  if (a.length === 0) return;
89
110
  const m = d.debounceMs ?? 250;
90
- m <= 0 ? O() : y || (y = setTimeout(O, m));
111
+ m <= 0 ? R() : y || (y = setTimeout(R, m));
91
112
  });
92
113
  return () => {
93
- A(), y && clearTimeout(y), T(f.current);
114
+ v(), y && clearTimeout(y), x(f.current);
94
115
  };
95
- }, [t, p, w]);
116
+ }, [n, p, w]);
96
117
  }
97
- function D(n, o, e, t = {}) {
98
- const r = o == null || o === "new" ? null : String(o), c = t.match;
99
- q(n && r ? n : null, e, {
100
- ...t,
101
- match: (i) => (String(i.item) === r || i.item === "*") && (!c || c(i))
118
+ function q(t, o, e, n = {}) {
119
+ const r = o == null || o === "new" ? null : String(o), i = n.match;
120
+ V(t && r ? t : null, e, {
121
+ ...n,
122
+ match: (c) => (String(c.item) === r || c.item === "*") && (!i || i(c))
102
123
  });
103
124
  }
104
- function z(n, o, e, t = {}) {
125
+ function H(t, o, e, n = {}) {
105
126
  const r = h(e);
106
127
  r.current = e;
107
- const c = h(t.client);
108
- c.current = t.client, D(
109
- n,
128
+ const i = h(n.client);
129
+ i.current = n.client, q(
130
+ t,
110
131
  o,
111
- (i) => {
132
+ (c) => {
112
133
  var f;
113
- const s = t.aspects;
114
- if (!(s && s.length > 0 && i.changedFields !== null && !U(i, ...s)))
115
- for (const L of r.current) (f = c.current) == null || f.invalidateQueries({ queryKey: L });
134
+ const l = n.aspects;
135
+ if (!(l && l.length > 0 && c.changedFields !== null && !U(c, ...l)))
136
+ for (const b of r.current) (f = i.current) == null || f.invalidateQueries({ queryKey: b });
116
137
  },
117
- t
138
+ n
118
139
  );
119
140
  }
120
- function K(n, o, e = {}) {
121
- const t = C(), { userId: r } = _(j), c = h(o);
122
- c.current = o;
123
- const i = h(e);
124
- i.current = e;
125
- const s = h(r);
126
- s.current = r;
127
- const f = (Array.isArray(n) ? n : [n]).join(","), L = e.enabled !== !1;
128
- E(() => {
129
- if (!L || !f) return;
141
+ function B(t, o, e = {}) {
142
+ const n = O(), { userId: r } = _(j), i = h(o);
143
+ i.current = o;
144
+ const c = h(e);
145
+ c.current = e;
146
+ const l = h(r);
147
+ l.current = r;
148
+ const f = (Array.isArray(t) ? t : [t]).join(","), b = e.enabled !== !1;
149
+ A(() => {
150
+ if (!b || !f) return;
130
151
  const p = f.split(",");
131
152
  let w = null, g = null, a = null;
132
- const y = (u, l) => {
133
- if (!p.includes(u)) return;
134
- const d = i.current, m = l ?? {};
153
+ const y = (s, u) => {
154
+ if (!p.includes(s) || F(s)) return;
155
+ const d = c.current, m = u ?? {};
135
156
  if (!d.includeOwn && typeof m == "object") {
136
- const W = k(m);
137
- if (W && s.current && W.toUpperCase() === s.current.toUpperCase())
157
+ const C = k(m);
158
+ if (C && l.current && C.toUpperCase() === l.current.toUpperCase())
138
159
  return;
139
160
  }
140
161
  if (d.match && !d.match(m)) return;
141
- let b = u;
162
+ let L = s;
142
163
  try {
143
- b = `${u}|${JSON.stringify(m)}`;
164
+ L = `${s}|${JSON.stringify(m)}`;
144
165
  } catch {
145
166
  }
146
- const R = Date.now();
147
- if (w && w.sig === b && R - w.at < 150) return;
148
- w = { sig: b, at: R };
149
- const S = d.debounceMs ?? 0;
150
- if (S <= 0) {
151
- c.current(m, u);
167
+ const $ = Date.now();
168
+ if (w && w.sig === L && $ - w.at < 150) return;
169
+ w = { sig: L, at: $ };
170
+ const E = d.debounceMs ?? 0;
171
+ if (E <= 0) {
172
+ i.current(m, s);
152
173
  return;
153
174
  }
154
- a = { payload: m, event: u }, g || (g = setTimeout(() => {
155
- g = null, a && c.current(a.payload, a.event), a = null;
156
- }, S));
157
- }, O = p.map((u) => (t == null ? void 0 : t.on(u, (l) => y(u, l))) ?? (() => {
158
- })), A = (u) => {
159
- const l = u.detail;
160
- l != null && l.event && y(l.event, l.payload);
175
+ a = { payload: m, event: s }, g || (g = setTimeout(() => {
176
+ g = null, a && i.current(a.payload, a.event), a = null;
177
+ }, E));
178
+ }, R = p.map((s) => (n == null ? void 0 : n.on(s, (u) => y(s, u))) ?? (() => {
179
+ })), v = (s) => {
180
+ const u = s.detail;
181
+ u != null && u.event && y(u.event, u.payload);
161
182
  };
162
- return window.addEventListener($, A), () => {
163
- for (const u of O) u();
164
- window.removeEventListener($, A), g && clearTimeout(g);
183
+ return window.addEventListener(S, v), () => {
184
+ for (const s of R) s();
185
+ window.removeEventListener(S, v), g && clearTimeout(g);
165
186
  };
166
- }, [t, f, L]);
187
+ }, [n, f, b]);
167
188
  }
168
- function G(n, o, e, t, r = {}) {
169
- const c = e == null || e === "new" ? null : String(e), i = r.match;
170
- K(n, t, {
189
+ function X(t, o, e, n, r = {}) {
190
+ const i = e == null || e === "new" ? null : String(e), c = r.match;
191
+ B(t, n, {
171
192
  ...r,
172
- enabled: r.enabled !== !1 && !!o && !!c,
173
- match: (s) => (s == null ? void 0 : s.collection) === o && String(s == null ? void 0 : s.item) === c && (!i || i(s))
193
+ enabled: r.enabled !== !1 && !!o && !!i,
194
+ match: (l) => (l == null ? void 0 : l.collection) === o && String(l == null ? void 0 : l.item) === i && (!c || c(l))
174
195
  });
175
196
  }
176
- function H(n, o = !0) {
177
- const e = C(), t = !!(e != null && e.joinWatch);
178
- return E(() => {
197
+ function Y(t, o = !0) {
198
+ const e = O(), n = !!(e != null && e.joinWatch);
199
+ return A(() => {
179
200
  if (!(!o || !(e != null && e.joinWatch)))
180
- return e.joinWatch(n);
181
- }, [e, n, o]), t && o;
201
+ return e.joinWatch(t);
202
+ }, [e, t, o]), n && o;
182
203
  }
183
- function X() {
184
- return C() != null;
204
+ function Z() {
205
+ return O() != null;
185
206
  }
186
207
  export {
187
- P as LIVE_ASPECTS,
188
- $ as LIVE_WINDOW_EVENT,
208
+ G as LIVE_ASPECTS,
209
+ S as LIVE_WINDOW_EVENT,
189
210
  U as batchTouches,
190
- V as expandCoalesced,
191
- F as isOwnWrite,
192
- ee as noteOwnWrite,
193
- ne as noteOwnWriteFromCommand,
194
- v as toLiveBatch,
195
- X as useLiveAvailable,
196
- q as useLiveCollection,
197
- K as useLiveEvent,
198
- D as useLiveRecord,
199
- G as useLiveRecordEvent,
200
- z as useLiveRecordQueries,
201
- H as useLiveWatchRoom
211
+ Q as expandCoalesced,
212
+ ne as getLiveMode,
213
+ N as isOwnEvent,
214
+ M as isOwnWrite,
215
+ re as liveMotionAllowed,
216
+ se as noteOwnWrite,
217
+ le as noteOwnWriteFromCommand,
218
+ W as toLiveBatch,
219
+ Z as useLiveAvailable,
220
+ oe as useLiveBusy,
221
+ V as useLiveCollection,
222
+ B as useLiveEvent,
223
+ ie as useLivePreference,
224
+ q as useLiveRecord,
225
+ X as useLiveRecordEvent,
226
+ H as useLiveRecordQueries,
227
+ Y as useLiveWatchRoom
202
228
  };
@@ -0,0 +1,198 @@
1
+ import { useRef as D, useEffect as T } from "react";
2
+ import { lastLiveSeen as P } from "./live-seen.js";
3
+ const p = "nvr-missed-snapshot", N = 200, b = 40, k = 2 * 6e4, v = 5e3, x = 15e3, C = 12, H = 20;
4
+ function M(t) {
5
+ let o = 2166136261;
6
+ for (let e = 0; e < t.length; e++)
7
+ o ^= t.charCodeAt(e), o = Math.imul(o, 16777619);
8
+ return (o >>> 0).toString(16).padStart(8, "0");
9
+ }
10
+ function g(t, o = 0) {
11
+ if (t == null) return null;
12
+ if (typeof t == "number" || typeof t == "boolean" || typeof t == "string") return t;
13
+ if (t instanceof Date) return t.toISOString();
14
+ if (Array.isArray(t)) return o > 2 ? `[${t.length}]` : t.map((e) => g(e, o + 1));
15
+ if (typeof t == "object") {
16
+ const e = t;
17
+ if ("id" in e && (typeof e.id == "string" || typeof e.id == "number")) return `#${e.id}`;
18
+ if (o > 2) return "{…}";
19
+ const s = {};
20
+ for (const r of Object.keys(e).sort()) s[r] = g(e[r], o + 1);
21
+ return s;
22
+ }
23
+ return String(t);
24
+ }
25
+ function I(t) {
26
+ return M(t === "" || t === void 0 || t === null ? "∅" : JSON.stringify(g(t)).slice(0, 8e3));
27
+ }
28
+ function J(t) {
29
+ return (t.fields ?? Object.keys(t.values ?? {})).filter((e) => e !== "id" && !e.startsWith("$")).slice(0, b);
30
+ }
31
+ function L(t, o, e, s = (r, a) => P(r, a)) {
32
+ var a;
33
+ const r = /* @__PURE__ */ new Map();
34
+ for (const n of o) {
35
+ if (!(n != null && n.collection) || n.id == null || !n.values) continue;
36
+ const f = String(n.id), i = `${n.collection}\0${f}`, d = ((a = r.get(i)) == null ? void 0 : a.h) ?? {};
37
+ for (const h of J(n)) d[h] = I(n.values[h]);
38
+ const u = r.get(i);
39
+ if (r.set(i, {
40
+ c: n.collection,
41
+ id: f,
42
+ l: Math.max((u == null ? void 0 : u.l) ?? 0, Number(n.loadedAt) || 0),
43
+ s: s(n.collection, f),
44
+ h: d
45
+ }), r.size >= N) break;
46
+ }
47
+ return { v: 1, path: t, at: e, records: [...r.values()] };
48
+ }
49
+ function j(t, o, e) {
50
+ if (!t) return null;
51
+ try {
52
+ const s = JSON.parse(t);
53
+ return (s == null ? void 0 : s.v) !== 1 || s.path !== o || typeof s.at != "number" || e - s.at > k || e < s.at - 5e3 ? null : Array.isArray(s.records) ? s : null;
54
+ } catch {
55
+ return null;
56
+ }
57
+ }
58
+ function B(t, o) {
59
+ const e = new Map(t.records.map((n) => [`${n.c}\0${n.id}`, n])), s = /* @__PURE__ */ new Set(), r = [];
60
+ let a = 0;
61
+ for (const n of o) {
62
+ if (!(n != null && n.values)) continue;
63
+ const f = `${n.collection}\0${String(n.id)}`, i = e.get(f);
64
+ if (!i || s.has(f) || (s.add(f), a++, i.s != null && i.s >= i.l) || !(i.l > 0) || t.at - i.l < v) continue;
65
+ const d = [];
66
+ for (const [u, h] of Object.entries(i.h))
67
+ u in n.values && I(n.values[u]) !== h && d.push(u);
68
+ d.length !== 0 && r.push({
69
+ collection: n.collection,
70
+ id: String(n.id),
71
+ fields: d.slice(0, b),
72
+ gap_s: Math.max(0, Math.round((t.at - i.l) / 1e3))
73
+ });
74
+ }
75
+ return { compared: a, missed: r };
76
+ }
77
+ function X(t) {
78
+ return (t == null ? void 0 : t.type) === "reload";
79
+ }
80
+ function F(t, o, e = C) {
81
+ return t.filter((s) => o - s < 36e5).length < e;
82
+ }
83
+ const y = /* @__PURE__ */ new Map();
84
+ let G = 1;
85
+ function K(t) {
86
+ const o = G++;
87
+ return y.set(o, t), () => {
88
+ y.delete(o);
89
+ };
90
+ }
91
+ function O() {
92
+ const t = [];
93
+ for (const o of y.values())
94
+ try {
95
+ for (const e of o())
96
+ if (t.push(e), t.length >= N * 2) return t;
97
+ } catch {
98
+ }
99
+ return t;
100
+ }
101
+ function Y(t) {
102
+ const o = D(t);
103
+ o.current = t, T(
104
+ () => K(() => {
105
+ const e = o.current;
106
+ return (typeof e == "function" ? e() : e) ?? [];
107
+ }),
108
+ []
109
+ );
110
+ }
111
+ const E = "nvr-missed-beacons";
112
+ let $ = !1;
113
+ function V(t) {
114
+ var A, _;
115
+ if ($ || typeof window > "u" || typeof sessionStorage > "u") return;
116
+ $ = !0;
117
+ const o = () => `${window.location.pathname}${window.location.search}`, e = Date.now();
118
+ window.addEventListener("pagehide", () => {
119
+ try {
120
+ const c = O();
121
+ if (c.length === 0) {
122
+ sessionStorage.removeItem(p);
123
+ return;
124
+ }
125
+ sessionStorage.setItem(
126
+ p,
127
+ JSON.stringify(L(o(), c, Date.now()))
128
+ );
129
+ } catch {
130
+ }
131
+ });
132
+ let s = null;
133
+ try {
134
+ const c = (_ = (A = performance.getEntriesByType) == null ? void 0 : A.call(performance, "navigation")) == null ? void 0 : _[0], S = sessionStorage.getItem(p);
135
+ sessionStorage.removeItem(p), X(c) && (s = j(S, o(), e));
136
+ } catch {
137
+ s = null;
138
+ }
139
+ if (!s || s.records.length === 0) return;
140
+ const r = s, a = { compared: 0, missed: [] }, n = /* @__PURE__ */ new Set(), f = new Set(r.records.map((c) => `${c.c}\0${c.id}`));
141
+ let i = !1;
142
+ const d = () => {
143
+ if (!i && (i = !0, a.compared !== 0)) {
144
+ try {
145
+ const c = Date.now(), S = JSON.parse(sessionStorage.getItem(E) ?? "[]"), l = Array.isArray(S) ? S.filter((R) => c - R < 36e5) : [];
146
+ if (!F(l, c)) return;
147
+ sessionStorage.setItem(E, JSON.stringify([...l, c]));
148
+ } catch {
149
+ }
150
+ t.send({
151
+ route: t.routePattern(window.location.pathname).slice(0, 300),
152
+ reload_s: Math.max(0, Math.round((e - r.at) / 1e3)),
153
+ went_ago_s: Math.max(0, Math.round((Date.now() - r.at) / 1e3)),
154
+ compared: a.compared,
155
+ missed: a.missed.slice(0, H)
156
+ });
157
+ }
158
+ }, u = () => {
159
+ const c = O().filter(
160
+ (l) => l.loadedAt >= e && !n.has(`${l.collection}\0${String(l.id)}`)
161
+ ), S = B(r, c);
162
+ for (const l of c) n.add(`${l.collection}\0${String(l.id)}`);
163
+ return a.compared += S.compared, a.missed.push(...S.missed), [...f].every((l) => n.has(l));
164
+ }, h = [1500, 3e3, 6e3, 1e4, x];
165
+ let m = 0;
166
+ const w = () => {
167
+ if (i) return;
168
+ if (u() || m >= h.length - 1) {
169
+ d();
170
+ return;
171
+ }
172
+ m++, setTimeout(w, h[m] - h[m - 1]);
173
+ };
174
+ setTimeout(w, h[0]), window.addEventListener("pagehide", () => {
175
+ i || (u(), d());
176
+ });
177
+ }
178
+ export {
179
+ C as BEACONS_PER_HOUR,
180
+ x as COMPARE_FOR_MS,
181
+ v as IN_FLIGHT_MS,
182
+ H as MAX_MISSED_PER_BEACON,
183
+ b as MAX_SNAPSHOT_FIELDS,
184
+ N as MAX_SNAPSHOT_RECORDS,
185
+ p as SNAPSHOT_KEY,
186
+ k as SNAPSHOT_MAX_AGE_MS,
187
+ F as beaconAllowed,
188
+ L as buildSnapshot,
189
+ B as compareSnapshot,
190
+ M as fnv1a,
191
+ I as hashValue,
192
+ X as isReloadNavigation,
193
+ K as registerShownRecords,
194
+ O as shownRecords,
195
+ V as startMissedUpdateDetector,
196
+ j as usableSnapshot,
197
+ Y as useShownRecords
198
+ };
@@ -0,0 +1,56 @@
1
+ import { useState as p, useRef as w, useCallback as v, useEffect as g } from "react";
2
+ import { useOptionalNivaroClient as S } from "../context.js";
3
+ import { get as $ } from "./commands.js";
4
+ import { useLiveRecord as h, LIVE_ASPECTS as C } from "./live.js";
5
+ function _(e, n) {
6
+ if (!e) return { kind: "none" };
7
+ if (!n) return { kind: "gone" };
8
+ const t = (o) => o.filename_download || o.title || "", s = t(n) !== t(e) && t(n) || null, l = (o) => `${o.modified_on ?? ""}|${o.filesize ?? ""}|${o.type ?? ""}`, c = l(n) !== l(e) && !R(e, n);
9
+ return !s && !c ? { kind: "none" } : { kind: "newer", renamed: s, replaced: c, meta: n };
10
+ }
11
+ function R(e, n) {
12
+ const t = (s) => s.filename_download || s.title || "";
13
+ return t(e) !== t(n) && String(e.filesize ?? "") === String(n.filesize ?? "") && e.type === n.type;
14
+ }
15
+ function E(e, n) {
16
+ const t = (n == null ? void 0 : n.modified_on) || (n == null ? void 0 : n.uploaded_on);
17
+ return t ? `${e}${e.includes("?") ? "&" : "?"}v=${encodeURIComponent(String(t))}` : e;
18
+ }
19
+ function U(e, n) {
20
+ const t = S(), [s, l] = p(null), [c, o] = p(null), [d, f] = p({ kind: "none" }), a = w(null);
21
+ a.current = s;
22
+ const r = v(
23
+ () => e && t ? t.request($(`/files/${encodeURIComponent(e)}/meta`)).then((i) => i.data ?? null).catch((i) => {
24
+ var m;
25
+ const u = (i == null ? void 0 : i.status) ?? ((m = i == null ? void 0 : i.response) == null ? void 0 : m.status);
26
+ return u === 404 || u === 403 ? null : void 0;
27
+ }) : Promise.resolve(void 0),
28
+ [t, e]
29
+ );
30
+ g(() => {
31
+ let i = !1;
32
+ return f({ kind: "none" }), l(null), o(null), r().then((u) => {
33
+ !i && u && l(u);
34
+ }), () => {
35
+ i = !0;
36
+ };
37
+ }, [r]), h(
38
+ n == null ? void 0 : n.collection,
39
+ (n == null ? void 0 : n.itemId) ?? null,
40
+ (i) => {
41
+ i.changedFields && !i.changedFields.includes(C.files) || r().then((u) => {
42
+ u !== void 0 && f(_(a.current, u));
43
+ });
44
+ },
45
+ { enabled: !!e && !!n && !!t, debounceMs: 1e3 }
46
+ );
47
+ const k = v(() => {
48
+ d.kind === "newer" && (l(d.meta), o(d.meta), f({ kind: "none" }));
49
+ }, [d]);
50
+ return { current: c, newer: d, showNewer: k };
51
+ }
52
+ export {
53
+ _ as compareFileMeta,
54
+ U as useNewerFile,
55
+ E as versionedUrl
56
+ };