@nivaro/react 0.3.113 → 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 (285) 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 +1727 -19
  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 +544 -504
  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/cbv/column-totals.js +75 -67
  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/api.js +161 -117
  79. package/dist/shared/components/integrations/console/tone.js +15 -12
  80. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  81. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  82. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  83. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  84. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  85. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  86. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  87. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  88. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  89. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  90. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  91. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  92. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  93. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  94. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  95. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  96. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  97. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  98. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  99. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  100. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  101. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  102. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  103. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  104. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  105. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  106. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  107. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  108. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  109. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  110. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  111. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  112. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  113. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  114. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  115. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  116. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  117. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  118. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  119. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  120. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  121. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  122. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  123. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  124. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  125. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  126. package/dist/shared/components/item-edit/file-live.js +77 -0
  127. package/dist/shared/components/item-edit/file-processing.js +87 -0
  128. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  129. package/dist/shared/components/item-edit/live-related.js +23 -0
  130. package/dist/shared/components/item-edit/live-title.js +66 -0
  131. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  132. package/dist/shared/components/item-edit/removed-line.js +58 -0
  133. package/dist/shared/components/item-edit/render-stability.js +70 -59
  134. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  135. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  136. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  137. package/dist/shared/components/list/InlineEdit.js +504 -208
  138. package/dist/shared/components/list/ListViewers.js +81 -0
  139. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  140. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  141. package/dist/shared/components/merge/merge-values.js +110 -0
  142. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  143. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  144. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  145. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  146. package/dist/shared/components/notifications/bundles.js +21 -19
  147. package/dist/shared/components/notifications/resolved-line.js +25 -0
  148. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  149. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  150. package/dist/shared/components/panels/AlertBanners.js +132 -0
  151. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  152. package/dist/shared/components/panels/BranchLanes.js +82 -54
  153. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  154. package/dist/shared/components/panels/CommentImages.js +219 -0
  155. package/dist/shared/components/panels/CommentPanel.js +649 -530
  156. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  157. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  158. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  159. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  160. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  161. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  162. package/dist/shared/components/panels/SlaClock.js +130 -99
  163. package/dist/shared/components/panels/TaskPanel.js +308 -287
  164. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  165. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  166. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  167. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  168. package/dist/shared/components/profile/AgentNameField.js +141 -0
  169. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  170. package/dist/shared/components/profile/PersonAccess.js +398 -330
  171. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  172. package/dist/shared/components/profile/PersonProfile.js +81 -73
  173. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  174. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  175. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  176. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  177. package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
  178. package/dist/shared/components/queue/queue-totals.js +92 -0
  179. package/dist/shared/components/queue/worklist-helpers.js +18 -14
  180. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  181. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  182. package/dist/shared/components/support/ReportProblem.js +1 -0
  183. package/dist/shared/components/support/ScreenShare.js +554 -0
  184. package/dist/shared/components/support/SupportView.js +160 -129
  185. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  186. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  187. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  188. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  189. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  190. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  191. package/dist/shared/lib/activity-sentence.js +87 -75
  192. package/dist/shared/lib/agent-presence.js +46 -0
  193. package/dist/shared/lib/approval-progress.js +49 -0
  194. package/dist/shared/lib/attention-prefs.js +27 -0
  195. package/dist/shared/lib/cell-locks.js +56 -0
  196. package/dist/shared/lib/co-edit.js +166 -0
  197. package/dist/shared/lib/coedit-registry.js +44 -0
  198. package/dist/shared/lib/comment-awareness.js +124 -0
  199. package/dist/shared/lib/comment-images.js +45 -0
  200. package/dist/shared/lib/config-watch.js +94 -0
  201. package/dist/shared/lib/copy-rules.js +65 -0
  202. package/dist/shared/lib/count-step.js +30 -0
  203. package/dist/shared/lib/deadline-ticker.js +68 -0
  204. package/dist/shared/lib/derived-causes.js +115 -0
  205. package/dist/shared/lib/draft-store.js +114 -85
  206. package/dist/shared/lib/error-hints.js +1 -0
  207. package/dist/shared/lib/field-merge.js +126 -0
  208. package/dist/shared/lib/filter-sentence.js +10 -10
  209. package/dist/shared/lib/focus-mode.js +16 -12
  210. package/dist/shared/lib/grid-cursors.js +77 -0
  211. package/dist/shared/lib/grid-presence.js +182 -0
  212. package/dist/shared/lib/idle-reload.js +100 -73
  213. package/dist/shared/lib/in-step.js +45 -0
  214. package/dist/shared/lib/integration-chip.js +19 -18
  215. package/dist/shared/lib/line-locks.js +141 -0
  216. package/dist/shared/lib/line-split.js +41 -0
  217. package/dist/shared/lib/linked-changes.js +150 -0
  218. package/dist/shared/lib/list-link.js +56 -50
  219. package/dist/shared/lib/list-return.js +231 -0
  220. package/dist/shared/lib/list-viewers.js +52 -0
  221. package/dist/shared/lib/live-announcer.js +86 -0
  222. package/dist/shared/lib/live-counts.js +85 -0
  223. package/dist/shared/lib/live-data-changed.js +108 -0
  224. package/dist/shared/lib/live-deltas.js +81 -0
  225. package/dist/shared/lib/live-findings.js +113 -0
  226. package/dist/shared/lib/live-groups.js +122 -0
  227. package/dist/shared/lib/live-link-labels.js +162 -0
  228. package/dist/shared/lib/live-list-flow.js +334 -0
  229. package/dist/shared/lib/live-list.js +143 -129
  230. package/dist/shared/lib/live-moves.js +51 -0
  231. package/dist/shared/lib/live-ops.js +26 -26
  232. package/dist/shared/lib/live-pickers.js +7 -0
  233. package/dist/shared/lib/live-preference.js +184 -0
  234. package/dist/shared/lib/live-queries.js +226 -181
  235. package/dist/shared/lib/live-screen.js +333 -0
  236. package/dist/shared/lib/live-search.js +108 -0
  237. package/dist/shared/lib/live-seen.js +35 -0
  238. package/dist/shared/lib/live-views.js +100 -0
  239. package/dist/shared/lib/live.js +159 -133
  240. package/dist/shared/lib/missed-updates.js +198 -0
  241. package/dist/shared/lib/newer-file.js +56 -0
  242. package/dist/shared/lib/notification-sound.js +42 -20
  243. package/dist/shared/lib/own-writes.js +59 -41
  244. package/dist/shared/lib/picker-badges.js +94 -0
  245. package/dist/shared/lib/presence-signals.js +131 -84
  246. package/dist/shared/lib/realtime.js +49 -24
  247. package/dist/shared/lib/record-gaps.js +85 -0
  248. package/dist/shared/lib/record-outbox.js +369 -222
  249. package/dist/shared/lib/record-peek.js +75 -0
  250. package/dist/shared/lib/record-tabs.js +92 -72
  251. package/dist/shared/lib/relative-ticker.js +42 -0
  252. package/dist/shared/lib/request-gate.js +119 -119
  253. package/dist/shared/lib/rollup-recalc.js +107 -0
  254. package/dist/shared/lib/room-gaps.js +40 -36
  255. package/dist/shared/lib/rum.js +137 -87
  256. package/dist/shared/lib/save-progress.js +20 -0
  257. package/dist/shared/lib/scheduled-countdown.js +67 -0
  258. package/dist/shared/lib/screen-refresh.js +160 -0
  259. package/dist/shared/lib/screen-share.js +234 -0
  260. package/dist/shared/lib/seen-since.js +74 -0
  261. package/dist/shared/lib/selection-watch.js +205 -0
  262. package/dist/shared/lib/send-status.js +132 -0
  263. package/dist/shared/lib/send-view.js +23 -0
  264. package/dist/shared/lib/socket-liveness.js +155 -0
  265. package/dist/shared/lib/socket-realtime.js +168 -140
  266. package/dist/shared/lib/state-census.js +53 -0
  267. package/dist/shared/lib/summary-mode.js +61 -39
  268. package/dist/shared/lib/tab-attention.js +143 -32
  269. package/dist/shared/lib/table-density.js +64 -0
  270. package/dist/shared/lib/track-travel.js +40 -0
  271. package/dist/shared/lib/unseen-changes.js +68 -0
  272. package/dist/shared/lib/upload-file.js +33 -0
  273. package/dist/shared/lib/upload-presence.js +127 -0
  274. package/dist/shared/lib/urgent-chime.js +65 -0
  275. package/dist/shared/lib/use-online-users.js +32 -11
  276. package/dist/shared/lib/user-sync.js +155 -39
  277. package/dist/shared/lib/waiting-count.js +44 -0
  278. package/dist/shared/lib/watch-desktop.js +83 -0
  279. package/dist/shared/lib/watch-list.js +447 -0
  280. package/dist/shared/lib/widget-image-render.js +64 -0
  281. package/dist/shared/lib/widget-image.js +111 -0
  282. package/dist/shared/lib/worker-socket.js +130 -104
  283. package/dist/shared/lib/write-to-screen.js +133 -0
  284. package/package.json +1 -1
  285. package/styles.css +49 -1
@@ -0,0 +1,115 @@
1
+ import { useQueryClient as M, useQuery as N } from "@tanstack/react-query";
2
+ import { useEffect as C, useSyncExternalStore as w } from "react";
3
+ import { useNivaroClient as v } from "../context.js";
4
+ import { get as D } from "./commands.js";
5
+ import { useLiveRecord as F } from "./live.js";
6
+ const _ = 72 * 36e5, Y = 2 * 6e4, y = (e, n) => [
7
+ "record-derived-causes",
8
+ e,
9
+ n
10
+ ], A = 864e5, E = /^\d{4}-\d{2}-\d{2}$/;
11
+ function g(e) {
12
+ if (e == null || e === "") return null;
13
+ const n = String(e), s = E.test(n) ? Date.parse(`${n}T00:00:00Z`) : Date.parse(n);
14
+ return Number.isNaN(s) ? null : s;
15
+ }
16
+ const a = (e, n) => `${e} ${n}${e === 1 ? "" : "s"}`;
17
+ function L(e) {
18
+ return Math.abs(e).toLocaleString("en-US", { maximumFractionDigits: 2 });
19
+ }
20
+ function h(e, n) {
21
+ const s = String(n ?? "").toLowerCase(), r = /date|time/.test(s);
22
+ if (r) {
23
+ const l = g(e.from), c = g(e.to);
24
+ if (l == null && c != null) return "Filled in";
25
+ if (c == null) return "Cleared";
26
+ if (l != null) {
27
+ const i = c - l;
28
+ if (i === 0) return "Changed";
29
+ const d = i > 0 ? "later" : "earlier", b = Math.round(Math.abs(i) / A);
30
+ if (b >= 1) return `Moved ${a(b, "day")} ${d}`;
31
+ const $ = Math.round(Math.abs(i) / 36e5);
32
+ return $ >= 1 ? `Moved ${a($, "hour")} ${d}` : `Moved ${a(Math.max(1, Math.round(Math.abs(i) / 6e4)), "minute")} ${d}`;
33
+ }
34
+ }
35
+ const t = Number(e.from), u = Number(e.to);
36
+ if ((/int|float|decimal|number|numeric|money|currency|double|real/.test(s) || !r && e.from != null && e.to != null && Number.isFinite(t) && Number.isFinite(u)) && Number.isFinite(u)) {
37
+ if (e.from == null || e.from === "") return "Filled in";
38
+ if (Number.isFinite(t) && u !== t) return `${u > t ? "Up" : "Down"} ${L(u - t)}`;
39
+ }
40
+ return e.to == null || e.to === "" ? "Cleared" : "Changed";
41
+ }
42
+ function q(e) {
43
+ return e.own ? e.label : e.record_label ? `${e.label} on ${e.record_label}` : e.collection_label ? `a ${e.collection_label}’s ${e.label}` : e.label;
44
+ }
45
+ function x(e) {
46
+ const n = [...new Set(e.map(q))];
47
+ return n.length === 0 ? "" : n.length === 1 ? `because ${n[0]} changed` : n.length === 2 ? `because ${n[0]} and ${n[1]} changed` : `because ${n[0]}, ${n[1]} and ${a(n.length - 2, "other")} changed`;
48
+ }
49
+ function k(e, n) {
50
+ const s = x(e.inputs);
51
+ return s ? `${h(e, n)} ${s}` : h(e, n);
52
+ }
53
+ function K(e, n = Date.now()) {
54
+ const s = Date.parse(e.at);
55
+ return !Number.isNaN(s) && n - s < _;
56
+ }
57
+ const o = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set();
58
+ let m = 0;
59
+ const S = (e, n) => `${e}\0${n}`, p = () => {
60
+ m++;
61
+ for (const e of f) e();
62
+ }, O = (e) => (f.add(e), () => {
63
+ f.delete(e);
64
+ });
65
+ function T(e, n) {
66
+ const s = v(), r = n && n !== "new" ? String(n) : null;
67
+ w(
68
+ O,
69
+ () => m,
70
+ () => m
71
+ );
72
+ const t = !!e && !!r && o.has(S(e, r));
73
+ return N({
74
+ queryKey: y(e ?? "", r ?? ""),
75
+ queryFn: () => s.request(D(`/records/${e}/${r}/derived`)).then((u) => Array.isArray(u.data) ? u.data : []).catch(() => []),
76
+ enabled: t,
77
+ staleTime: 6e4,
78
+ retry: !1
79
+ });
80
+ }
81
+ function V(e, n, s) {
82
+ const { data: r } = T(e, n), t = r == null ? void 0 : r.find((u) => u.field === s);
83
+ return t && K(t) ? t : null;
84
+ }
85
+ function Z(e, n) {
86
+ const s = M(), r = n && n !== "new" ? String(n) : null;
87
+ C(() => {
88
+ if (!e || !r) return;
89
+ const t = S(e, r);
90
+ return o.set(t, (o.get(t) ?? 0) + 1), p(), () => {
91
+ const u = (o.get(t) ?? 1) - 1;
92
+ u <= 0 ? o.delete(t) : o.set(t, u), p();
93
+ };
94
+ }, [e, r]), F(
95
+ e,
96
+ r,
97
+ (t) => {
98
+ t.aspectsOnly || t.deleted || !e || !r || s.invalidateQueries({ queryKey: y(e, r) });
99
+ },
100
+ // A rollup or rule re-derives right after the write that caused it: wait it out.
101
+ { includeOwn: !0, debounceMs: 1e3 }
102
+ );
103
+ }
104
+ export {
105
+ Y as CAUSE_FRESH_MS,
106
+ _ as CAUSE_SHOW_MS,
107
+ x as becauseWords,
108
+ k as causeSentence,
109
+ K as causeShown,
110
+ h as changeWords,
111
+ y as derivedCausesKey,
112
+ q as inputWords,
113
+ V as useDerivedCause,
114
+ Z as useDerivedCausesLive
115
+ };
@@ -1,46 +1,72 @@
1
- const d = "nivaro-drafts", a = "drafts";
2
- function m(e) {
3
- if (e.item_id !== "new") return /* @__PURE__ */ new Set();
4
- const t = Object.keys(e.fields ?? {}), n = new Set((e.filled ?? []).filter((r) => t.includes(r)));
5
- return n.size === t.length ? /* @__PURE__ */ new Set() : n;
6
- }
7
- function b(e) {
8
- if (e == null) return null;
9
- const t = JSON.stringify(
10
- e,
11
- (r, i) => i && typeof i == "object" && !Array.isArray(i) ? Object.fromEntries(Object.entries(i).sort(([s], [o]) => s < o ? -1 : s > o ? 1 : 0)) : i
1
+ const y = "nivaro-drafts", l = "drafts";
2
+ const d = "nvr:device-id";
3
+ function m(t, e = 0) {
4
+ return /iPad|Tablet/i.test(t) || /Macintosh/i.test(t) && e > 1 ? "tablet" : /Android/i.test(t) ? /Mobile/i.test(t) ? "phone" : "tablet" : /iPhone|iPod|Mobile/i.test(t) ? "phone" : "computer";
5
+ }
6
+ let c = null;
7
+ function b() {
8
+ if (c) return c;
9
+ let t = "";
10
+ try {
11
+ t = localStorage.getItem(d) ?? "", /^[A-Za-z0-9_-]{6,64}$/.test(t) || (t = Array.from(
12
+ crypto.getRandomValues(new Uint8Array(9)),
13
+ (n) => n.toString(36).padStart(2, "0")
14
+ ).join(""), localStorage.setItem(d, t));
15
+ } catch {
16
+ t = t || `tmp${Math.random().toString(36).slice(2, 12)}`;
17
+ }
18
+ const e = typeof navigator > "u" ? "" : navigator.userAgent;
19
+ return c = {
20
+ id: t,
21
+ label: m(e, typeof navigator > "u" ? 0 : navigator.maxTouchPoints)
22
+ }, c;
23
+ }
24
+ function p(t, e = b()) {
25
+ var n;
26
+ return !!((n = t.device) != null && n.id) && t.device.id !== e.id;
27
+ }
28
+ function w(t) {
29
+ if (t.item_id !== "new") return /* @__PURE__ */ new Set();
30
+ const e = Object.keys(t.fields ?? {}), n = new Set((t.filled ?? []).filter((r) => e.includes(r)));
31
+ return n.size === e.length ? /* @__PURE__ */ new Set() : n;
32
+ }
33
+ function D(t) {
34
+ if (t == null) return null;
35
+ const e = JSON.stringify(
36
+ t,
37
+ (r, i) => i && typeof i == "object" && !Array.isArray(i) ? Object.fromEntries(Object.entries(i).sort(([o], [s]) => o < s ? -1 : o > s ? 1 : 0)) : i
12
38
  );
13
- if (!t || t === "{}" || t === "[]") return null;
39
+ if (!e || e === "{}" || e === "[]") return null;
14
40
  let n = 5381;
15
- for (let r = 0; r < t.length; r++) n = (n << 5) + n + t.charCodeAt(r) | 0;
16
- return `p${(n >>> 0).toString(36)}:${t.length}`;
41
+ for (let r = 0; r < e.length; r++) n = (n << 5) + n + e.charCodeAt(r) | 0;
42
+ return `p${(n >>> 0).toString(36)}:${e.length}`;
17
43
  }
18
- function w(e, t) {
19
- return (e.prefill_sig ?? null) === t;
44
+ function O(t, e) {
45
+ return (t.prefill_sig ?? null) === e;
20
46
  }
21
- function S(e, t, n) {
22
- return `${e}:${t && t !== "new" ? t : "new"}:${n || "anon"}`;
47
+ function _(t, e, n) {
48
+ return `${t}:${e && e !== "new" ? e : "new"}:${n || "anon"}`;
23
49
  }
24
- function g() {
25
- return new Promise((e) => {
50
+ function h() {
51
+ return new Promise((t) => {
26
52
  try {
27
- if (typeof indexedDB > "u") return e(null);
28
- const t = indexedDB.open(d, 1);
29
- t.onupgradeneeded = () => {
30
- const n = t.result;
31
- n.objectStoreNames.contains(a) || n.createObjectStore(a, { keyPath: "key" });
32
- }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
53
+ if (typeof indexedDB > "u") return t(null);
54
+ const e = indexedDB.open(y, 1);
55
+ e.onupgradeneeded = () => {
56
+ const n = e.result;
57
+ n.objectStoreNames.contains(l) || n.createObjectStore(l, { keyPath: "key" });
58
+ }, e.onsuccess = () => t(e.result), e.onerror = () => t(null), e.onblocked = () => t(null);
33
59
  } catch {
34
- e(null);
60
+ t(null);
35
61
  }
36
62
  });
37
63
  }
38
- async function u(e, t) {
39
- const n = await g();
64
+ async function f(t, e) {
65
+ const n = await h();
40
66
  return n ? new Promise((r) => {
41
67
  try {
42
- const i = n.transaction(a, e), s = t(i.objectStore(a));
43
- s.onsuccess = () => r(s.result), s.onerror = () => r(null), i.oncomplete = () => n.close(), i.onerror = () => {
68
+ const i = n.transaction(l, t), o = e(i.objectStore(l));
69
+ o.onsuccess = () => r(o.result), o.onerror = () => r(null), i.oncomplete = () => n.close(), i.onerror = () => {
44
70
  n.close(), r(null);
45
71
  };
46
72
  } catch {
@@ -48,90 +74,93 @@ async function u(e, t) {
48
74
  }
49
75
  }) : null;
50
76
  }
51
- async function O(e) {
52
- return await u("readwrite", (n) => n.put(e)) != null;
77
+ async function j(t) {
78
+ return await f("readwrite", (n) => n.put(t)) != null;
53
79
  }
54
- async function h(e) {
55
- const t = await u("readonly", (n) => n.get(e));
56
- return t && typeof t == "object" && t.key === e ? t : null;
80
+ async function k(t) {
81
+ const e = await f("readonly", (n) => n.get(t));
82
+ return e && typeof e == "object" && e.key === t ? e : null;
57
83
  }
58
- async function _(e) {
59
- await u("readwrite", (t) => t.delete(e));
84
+ async function N(t) {
85
+ await f("readwrite", (e) => e.delete(t));
60
86
  }
61
- const l = "nvr:draft-created:", y = 7 * 864e5;
62
- function p(e, t, n = /* @__PURE__ */ new Date()) {
87
+ const u = "nvr:draft-created:", S = 7 * 864e5;
88
+ function E(t, e, n = /* @__PURE__ */ new Date()) {
63
89
  try {
64
90
  localStorage.setItem(
65
- l + e,
66
- JSON.stringify({ id: t, at: n.toISOString() })
91
+ u + t,
92
+ JSON.stringify({ id: e, at: n.toISOString() })
67
93
  );
68
94
  } catch {
69
95
  }
70
96
  }
71
- function k(e, t, n = /* @__PURE__ */ new Date()) {
97
+ function A(t, e, n = /* @__PURE__ */ new Date()) {
72
98
  try {
73
- const r = localStorage.getItem(l + e);
99
+ const r = localStorage.getItem(u + t);
74
100
  if (!r) return null;
75
101
  const i = JSON.parse(r);
76
102
  if (!i || typeof i.id != "string" || typeof i.at != "string") return null;
77
- const s = Date.parse(i.at);
78
- if (!Number.isFinite(s) || n.getTime() - s > y)
79
- return localStorage.removeItem(l + e), null;
80
- const o = t ? Date.parse(t) : Number.NaN;
81
- return !Number.isFinite(o) || o > s ? null : { id: i.id, at: i.at };
103
+ const o = Date.parse(i.at);
104
+ if (!Number.isFinite(o) || n.getTime() - o > S)
105
+ return localStorage.removeItem(u + t), null;
106
+ const s = e ? Date.parse(e) : Number.NaN;
107
+ return !Number.isFinite(s) || s > o ? null : { id: i.id, at: i.at };
82
108
  } catch {
83
109
  return null;
84
110
  }
85
111
  }
86
- async function D(e, t) {
112
+ async function I(t, e) {
87
113
  const n = {};
88
- for (const [r, i] of Object.entries(e ?? {})) {
89
- const s = r.includes(".") ? r.slice(0, r.indexOf(".")) : r;
90
- for (const o of Object.keys(i ?? {})) {
91
- if (!o || o === "new" || o.startsWith("pending:")) continue;
92
- let c;
114
+ for (const [r, i] of Object.entries(t ?? {})) {
115
+ const o = r.includes(".") ? r.slice(0, r.indexOf(".")) : r;
116
+ for (const s of Object.keys(i ?? {})) {
117
+ if (!s || s === "new" || s.startsWith("pending:")) continue;
118
+ let a;
93
119
  try {
94
- c = await t(s, o);
120
+ a = await e(o, s);
95
121
  } catch {
96
- c = null;
122
+ a = null;
97
123
  }
98
- typeof c == "number" && Number.isFinite(c) && c > 0 && (n[`${s}:${o}`] = c);
124
+ typeof a == "number" && Number.isFinite(a) && a > 0 && (n[`${o}:${s}`] = a);
99
125
  }
100
126
  }
101
127
  return n;
102
128
  }
103
- function j(e) {
104
- const { isDirty: t, forReload: n, staged: r, stagedLines: i } = e;
105
- return t ? "store" : n && r > 0 ? "hold" : i > 0 ? "store" : "drop";
129
+ function P(t) {
130
+ const { isDirty: e, forReload: n, staged: r, stagedLines: i } = t;
131
+ return e ? "store" : n && r > 0 ? "hold" : i > 0 ? "store" : "drop";
106
132
  }
107
- function N(e) {
108
- return Object.keys(e.fields ?? {}).length > 0 || Object.values(e.pending_rows ?? {}).some((t) => t.length > 0) || Object.values(e.pending_edits ?? {}).some((t) => Object.keys(t).length > 0) || Object.values(e.pending_deletes ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_links ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_unlinks ?? {}).some((t) => t.length > 0);
133
+ function $(t) {
134
+ return Object.keys(t.fields ?? {}).length > 0 || Object.values(t.pending_rows ?? {}).some((e) => e.length > 0) || Object.values(t.pending_edits ?? {}).some((e) => Object.keys(e).length > 0) || Object.values(t.pending_deletes ?? {}).some((e) => e.length > 0) || Object.values(t.m2m_links ?? {}).some((e) => e.length > 0) || Object.values(t.m2m_unlinks ?? {}).some((e) => e.length > 0);
109
135
  }
110
- function f(e) {
136
+ function g(t) {
111
137
  return JSON.stringify([
112
- e.fields ?? {},
113
- e.pending_rows ?? {},
114
- e.pending_edits ?? {},
115
- e.pending_deletes ?? {},
116
- e.m2m_links ?? {},
117
- e.m2m_unlinks ?? {}
138
+ t.fields ?? {},
139
+ t.pending_rows ?? {},
140
+ t.pending_edits ?? {},
141
+ t.pending_deletes ?? {},
142
+ t.m2m_links ?? {},
143
+ t.m2m_unlinks ?? {}
118
144
  ]);
119
145
  }
120
- function E(e, t) {
121
- return !(t != null && t.saved_at) || t.key !== e.key ? e : f(t) === f(e) ? { ...e, saved_at: t.saved_at } : e;
146
+ function C(t, e) {
147
+ return !(e != null && e.saved_at) || e.key !== t.key ? t : g(e) === g(t) ? { ...t, saved_at: e.saved_at } : t;
122
148
  }
123
149
  export {
124
- _ as deleteDraft,
125
- k as draftCreatedAs,
126
- m as draftFilledBack,
127
- N as draftHasContent,
128
- S as draftKey,
129
- w as draftMatchesPrefill,
130
- j as draftPersistDecision,
131
- E as keepDraftSavedAt,
132
- D as lineBasesForDraft,
133
- h as loadDraft,
134
- p as markDraftCreated,
135
- b as prefillSignature,
136
- O as saveDraft
150
+ N as deleteDraft,
151
+ m as deviceLabelFor,
152
+ A as draftCreatedAs,
153
+ w as draftFilledBack,
154
+ $ as draftHasContent,
155
+ p as draftIsFromOtherDevice,
156
+ _ as draftKey,
157
+ O as draftMatchesPrefill,
158
+ P as draftPersistDecision,
159
+ C as keepDraftSavedAt,
160
+ I as lineBasesForDraft,
161
+ k as loadDraft,
162
+ E as markDraftCreated,
163
+ D as prefillSignature,
164
+ j as saveDraft,
165
+ b as thisDraftDevice
137
166
  };
@@ -85,6 +85,7 @@ const h = {
85
85
  MCP_CONNECTION_RATE_LIMITED: "This connection sent too many requests. Wait a minute.",
86
86
  AI_RATE_LIMITED: "Too many AI requests in a short time. Wait a minute, then try again.",
87
87
  AI_DAILY_TOKENS: "You have used today's AI allowance. Try again tomorrow, or ask an administrator to raise it.",
88
+ AI_ALLOWANCE_USED: "The AI allowance for this period is used up. An administrator can raise it on the Account page.",
88
89
  BATCH_LIMIT: "Select fewer records, then run it again in smaller batches.",
89
90
  BULK_ROWS_LIMIT: "Select fewer records, then run it again in smaller batches.",
90
91
  BATCH_READ_LIMIT: "Ask for fewer records at once.",
@@ -0,0 +1,126 @@
1
+ const E = /* @__PURE__ */ new Set(["textarea", "markdown", "code", "input-multiline"]), I = /* @__PURE__ */ new Set([
2
+ "wysiwyg",
3
+ "rich_text",
4
+ "rich-text-html",
5
+ "input-rich-text-html",
6
+ "input-rich-text-md"
7
+ ]), j = /<(p|div|ul|ol|li|h[1-6]|br)\b/i, _ = /* @__PURE__ */ new Set([
8
+ "tags",
9
+ "select-multiple-dropdown",
10
+ "select-multiple-checkbox",
11
+ "select-multiple-checkbox-tree",
12
+ "checkboxes"
13
+ ]), d = (t) => typeof t == "string" || typeof t == "number" || typeof t == "boolean";
14
+ function x(t) {
15
+ if (t == null || t === "") return [];
16
+ if (Array.isArray(t)) return t.every(d) ? t : null;
17
+ if (typeof t == "string") {
18
+ const e = t.trim();
19
+ if (e.startsWith("["))
20
+ try {
21
+ const n = JSON.parse(e);
22
+ return Array.isArray(n) && n.every(d) ? n : null;
23
+ } catch {
24
+ return null;
25
+ }
26
+ return e.split(",").map((n) => n.trim()).filter(Boolean);
27
+ }
28
+ return null;
29
+ }
30
+ function b(t, e) {
31
+ return Array.isArray(e) ? t : typeof e == "string" && !e.trim().startsWith("[") && e.trim() !== "" ? t.join(",") : t.length > 0 ? JSON.stringify(t) : null;
32
+ }
33
+ function J(t, e, n) {
34
+ const s = String((t == null ? void 0 : t.interface) ?? ""), r = String((t == null ? void 0 : t.type) ?? "");
35
+ return I.has(s) ? "rich" : E.has(s) ? "text" : _.has(s) || r === "csv" ? x(e) && x(n) ? "set" : "none" : (r === "json" || Array.isArray(e)) && Array.isArray(e) && Array.isArray(n) ? e.every(d) && n.every(d) ? "set" : "none" : !s && typeof e == "string" && typeof n == "string" && j.test(e) && j.test(n) ? "rich" : (r === "text" || r === "string") && typeof e == "string" && typeof n == "string" && (/\n/.test(e) || /\n/.test(n)) ? "text" : "none";
36
+ }
37
+ const A = (t) => typeof t == "string" ? `s:${t}` : `${typeof t}:${String(t)}`;
38
+ function C(t, e, n) {
39
+ const s = x(t), r = x(e) ?? [], h = x(n) ?? [], u = (i, g) => i.some((a) => A(a) === A(g)), f = [], l = /* @__PURE__ */ new Set();
40
+ for (const i of [...h, ...r, ...s ?? []])
41
+ l.has(A(i)) || (l.add(A(i)), f.push(i));
42
+ return f.map((i) => {
43
+ const g = u(r, i), a = u(h, i), S = s ? u(s, i) : null;
44
+ let m = null, w = null;
45
+ return S === !0 ? !g && a ? m = "mine" : g && !a && (m = "theirs") : S === !1 && (w = g && a ? "both" : g ? "mine" : a ? "theirs" : null), { value: i, inMine: g, inTheirs: a, removedBy: m, addedBy: w, keep: m ? !1 : g || a };
46
+ }).filter((i) => i.inMine || i.inTheirs);
47
+ }
48
+ function F(t, e) {
49
+ return t.filter((n) => (e == null ? void 0 : e.get(K(n.value))) ?? n.keep).map((n) => n.value);
50
+ }
51
+ const K = (t) => A(t);
52
+ function B(t, e) {
53
+ const n = t == null ? "" : String(t);
54
+ return n === "" ? [] : e ? n.split(new RegExp("(?<=<\\/(?:p|li|h[1-6]|div|blockquote|pre|ul|ol|table|tr)>)", "i")).filter((s) => s !== "") : n.split(`
55
+ `);
56
+ }
57
+ function L(t, e) {
58
+ return e ? t.join("") : t.join(`
59
+ `);
60
+ }
61
+ function O(t, e) {
62
+ const n = t.length, s = e.length, r = Array.from({ length: n + 1 }, () => new Array(s + 1).fill(0));
63
+ for (let l = n - 1; l >= 0; l--)
64
+ for (let i = s - 1; i >= 0; i--)
65
+ r[l][i] = t[l] === e[i] ? r[l + 1][i + 1] + 1 : Math.max(r[l + 1][i], r[l][i + 1]);
66
+ const h = [];
67
+ let u = 0, f = 0;
68
+ for (; u < n && f < s; )
69
+ t[u] === e[f] ? (h.push([u, f]), u++, f++) : r[u + 1][f] >= r[u][f + 1] ? u++ : f++;
70
+ return h;
71
+ }
72
+ const k = 600;
73
+ function H(t, e, n, s) {
74
+ const r = B(e, s), h = B(n, s), u = t === void 0 ? null : B(t, s), f = u ? new Set(u) : null, l = (o) => !!f && o.every((c) => f.has(c)), i = (o, c) => {
75
+ let p = "both", y = !0;
76
+ return f && (o.length === 0 ? (p = l(c) ? "mine" : "theirs", y = !1) : c.length === 0 ? (p = l(o) ? "theirs" : "mine", y = !1) : l(o) && !l(c) ? (p = "theirs", y = !1) : l(c) && !l(o) ? (p = "mine", y = !1) : l(o) && l(c) && (p = "theirs", y = !1)), { same: !1, mine: o, theirs: c, conflict: y, pick: p };
77
+ };
78
+ if (r.length > k || h.length > k) return [i(r, h)];
79
+ const g = O(r, h), a = [];
80
+ let S = 0, m = 0;
81
+ const w = (o) => {
82
+ const c = a[a.length - 1];
83
+ c != null && c.same ? (c.mine.push(o), c.theirs.push(o)) : a.push({ same: !0, mine: [o], theirs: [o], conflict: !1, pick: "mine" });
84
+ };
85
+ for (const [o, c] of [...g, [r.length, h.length]]) {
86
+ if (o > S || c > m) {
87
+ const p = r.slice(S, o), y = h.slice(m, c);
88
+ p.length === y.length && p.length > 1 ? p.forEach((M, T) => a.push(i([M], [y[T]]))) : a.push(i(p, y));
89
+ }
90
+ o < r.length && c < h.length && w(r[o]), S = o + 1, m = c + 1;
91
+ }
92
+ return a;
93
+ }
94
+ function $(t, e, n) {
95
+ const s = [];
96
+ return t.forEach((r, h) => {
97
+ if (r.same) {
98
+ s.push(...r.mine);
99
+ return;
100
+ }
101
+ const u = e.get(h) ?? r.pick;
102
+ u === "mine" ? s.push(...r.mine) : u === "theirs" ? s.push(...r.theirs) : s.push(...r.mine, ...r.theirs.filter((f) => !r.mine.includes(f)));
103
+ }), L(s, n);
104
+ }
105
+ function N(t, e, n, s) {
106
+ if (t === "set") return b(F(C(e, n, s)), n);
107
+ if (t === "text" || t === "rich") {
108
+ const r = t === "rich";
109
+ return $(H(e, n, s, r), /* @__PURE__ */ new Map(), r);
110
+ }
111
+ return n;
112
+ }
113
+ export {
114
+ k as MAX_DIFF_BLOCKS,
115
+ N as autoMerge,
116
+ H as diffTextBlocks,
117
+ J as fieldMergeKind,
118
+ L as joinBlocks,
119
+ C as mergeSetValues,
120
+ F as mergedSet,
121
+ $ as mergedText,
122
+ K as setItemKey,
123
+ x as setItems,
124
+ b as setValueLike,
125
+ B as splitBlocks
126
+ };
@@ -105,11 +105,11 @@ function x(e) {
105
105
  const f = e.shown;
106
106
  if (typeof f == "number" && Number.isFinite(f) && f >= 0) {
107
107
  const $ = e.approx ? "about " : "", o = e.of;
108
- a += typeof o == "number" && Number.isFinite(o) && o > f ? ` — ${$}${y(f)} of ${y(o)}` : ` — ${$}${y(f)}`;
108
+ a += typeof o == "number" && Number.isFinite(o) && o > f ? ` — ${$}${y(f)} of ${e.ofApprox ? "about " : ""}${y(o)}` : ` — ${$}${y(f)}`;
109
109
  }
110
110
  return `${a}.`;
111
111
  }
112
- const p = /^\d{4}-\d{2}-\d{2}/;
112
+ const k = /^\d{4}-\d{2}-\d{2}/;
113
113
  function q(e) {
114
114
  const { field: t, valueLabels: i } = e;
115
115
  let r = e.op, s = e.value, d = !1;
@@ -135,29 +135,29 @@ function q(e) {
135
135
  const l = /^(\d+)d$/.exec(o);
136
136
  return l ? { kind: "date", field: t, op: "last_days", days: Number(l[1]), not: u } : null;
137
137
  }
138
- const n = s == null ? "" : String(s), a = e.kind === "date" || p.test(n) && e.kind !== "text", f = e.kind === "number" || e.kind === "currency";
138
+ const n = s == null ? "" : String(s), a = e.kind === "date" || k.test(n) && e.kind !== "text", f = e.kind === "number" || e.kind === "currency";
139
139
  if (r === "_between") {
140
140
  const [o, l] = n.split("..");
141
141
  if (a)
142
142
  return { kind: "date", field: t, op: "between", from: o || void 0, to: l || void 0, not: u };
143
- const k = Number(o), g = Number(l);
144
- return Number.isFinite(k) && Number.isFinite(g) && o !== "" && l !== "" ? {
143
+ const p = Number(o), g = Number(l);
144
+ return Number.isFinite(p) && Number.isFinite(g) && o !== "" && l !== "" ? {
145
145
  kind: "compare",
146
146
  field: t,
147
147
  op: "between",
148
- a: k,
148
+ a: p,
149
149
  b: g,
150
150
  currency: e.kind === "currency"
151
151
  } : null;
152
152
  }
153
- if (a && p.test(n)) {
153
+ if (a && k.test(n)) {
154
154
  const o = n.slice(0, 10), l = {
155
155
  _eq: "on",
156
156
  _lt: "before",
157
157
  _gt: "after",
158
158
  _lte: "onbefore",
159
159
  _gte: "onafter"
160
- }, k = {
160
+ }, p = {
161
161
  _eq: "on",
162
162
  _lt: "onafter",
163
163
  _gt: "onbefore",
@@ -165,7 +165,7 @@ function q(e) {
165
165
  _gte: "before"
166
166
  };
167
167
  if (r === "_neq") return { kind: "date", field: t, op: "on", from: o, not: !u };
168
- const g = (u ? k : l)[r];
168
+ const g = (u ? p : l)[r];
169
169
  if (g) return { kind: "date", field: t, op: g, from: o, not: u && r === "_eq" };
170
170
  }
171
171
  const c = {
@@ -238,7 +238,7 @@ function v(e) {
238
238
  return a > 0 && Number.isFinite(m) ? { kind: "compare", field: t, op: f, a: m, currency: e.currency } : null;
239
239
  }
240
240
  const d = /^(on|before|after|onbefore|onafter|between|r):(.+)$/.exec(s);
241
- if (d && (e.type === "date" || p.test(d[2]))) {
241
+ if (d && (e.type === "date" || k.test(d[2]))) {
242
242
  const n = d[1] === "r" ? "between" : d[1];
243
243
  if (n === "between") {
244
244
  const [a, f] = d[2].split("..");
@@ -12,14 +12,14 @@ function M() {
12
12
  const e = JSON.parse(t);
13
13
  return {
14
14
  on: e.on === !0,
15
- minutes: h(e.minutes)
15
+ minutes: d(e.minutes)
16
16
  };
17
17
  }
18
18
  } catch {
19
19
  }
20
20
  return { on: !1, minutes: m };
21
21
  }
22
- function h(t) {
22
+ function d(t) {
23
23
  const e = Number(t);
24
24
  return Number.isFinite(e) ? Math.min(30, Math.max(1, Math.round(e))) : m;
25
25
  }
@@ -27,7 +27,7 @@ function c() {
27
27
  f = { on: n.on, minutes: n.minutes, held: i };
28
28
  for (const t of l) t();
29
29
  }
30
- function d() {
30
+ function h() {
31
31
  r || o.size === 0 || !n.on || (r = setTimeout(() => {
32
32
  r = null, p();
33
33
  }, n.minutes * 6e4));
@@ -43,31 +43,34 @@ function p() {
43
43
  }
44
44
  }
45
45
  function v(t, e) {
46
- const u = { on: t, minutes: e == null ? n.minutes : h(e) }, s = n.on && !u.on;
46
+ const u = { on: t, minutes: e == null ? n.minutes : d(e) }, s = n.on && !u.on;
47
47
  n = u;
48
48
  try {
49
49
  localStorage.setItem(a, JSON.stringify(n));
50
50
  } catch {
51
51
  }
52
- s ? p() : (c(), d());
52
+ s ? p() : (c(), h());
53
53
  }
54
- function N(t, e, u) {
54
+ function N() {
55
+ return n.on;
56
+ }
57
+ function b(t, e, u) {
55
58
  if (e.length === 0) return;
56
59
  if (!n.on) {
57
60
  u(e);
58
61
  return;
59
62
  }
60
63
  const s = o.get(t);
61
- s ? (s.events.push(...e), s.apply = u) : o.set(t, { events: [...e], apply: u }), i += e.length, c(), d();
64
+ s ? (s.events.push(...e), s.apply = u) : o.set(t, { events: [...e], apply: u }), i += e.length, c(), h();
62
65
  }
63
- function b(t) {
66
+ function x(t) {
64
67
  const e = o.get(t);
65
68
  e && (o.delete(t), i = Math.max(0, i - e.events.length), c());
66
69
  }
67
70
  function S(t) {
68
71
  return l.add(t), () => l.delete(t);
69
72
  }
70
- function x() {
73
+ function F() {
71
74
  return g(
72
75
  S,
73
76
  () => f,
@@ -76,8 +79,9 @@ function x() {
76
79
  }
77
80
  export {
78
81
  p as applyHeldLiveNow,
79
- N as deliverLive,
80
- b as releaseLiveOwner,
82
+ b as deliverLive,
83
+ N as isFocusModeOn,
84
+ x as releaseLiveOwner,
81
85
  v as setFocusMode,
82
- x as useFocusMode
86
+ F as useFocusMode
83
87
  };