@nivaro/react 0.3.117 → 0.3.119

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 (138) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +136 -14
  4. package/dist/index.js +488 -485
  5. package/dist/shared/components/ActivityEntry.js +130 -125
  6. package/dist/shared/components/AgentPresenceChip.js +36 -26
  7. package/dist/shared/components/CellCopyLayer.js +50 -45
  8. package/dist/shared/components/CollectionBrowserView.js +3757 -3695
  9. package/dist/shared/components/FilePreviewLightbox.js +96 -58
  10. package/dist/shared/components/InStep.js +18 -17
  11. package/dist/shared/components/ItemEditForm.js +4451 -4385
  12. package/dist/shared/components/JobsTray.js +8 -8
  13. package/dist/shared/components/LiveNewMatchesPill.js +21 -14
  14. package/dist/shared/components/LiveOffNote.js +3 -2
  15. package/dist/shared/components/LiveRowMark.js +53 -23
  16. package/dist/shared/components/LiveTraceView.js +162 -123
  17. package/dist/shared/components/MyWorkView.js +320 -299
  18. package/dist/shared/components/NotificationBell.js +14 -14
  19. package/dist/shared/components/OverflowRail.js +1 -1
  20. package/dist/shared/components/PageRenderer.js +120 -116
  21. package/dist/shared/components/ProfileView.js +203 -202
  22. package/dist/shared/components/RealtimeStatusBanner.js +31 -29
  23. package/dist/shared/components/RecordDrilldownSheet.js +7 -7
  24. package/dist/shared/components/RecordHoverCard.js +102 -84
  25. package/dist/shared/components/RecordReadView.js +146 -146
  26. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  27. package/dist/shared/components/TipLayer.js +65 -58
  28. package/dist/shared/components/WidgetImageMenu.js +83 -43
  29. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  31. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  32. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  33. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  34. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  35. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  37. package/dist/shared/components/collections-directory/page-model.js +72 -67
  38. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  39. package/dist/shared/components/integrations/SendStatus.js +65 -59
  40. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  41. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  42. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  43. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +135 -94
  44. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  45. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  46. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  47. package/dist/shared/components/item-edit/FieldComments.js +88 -85
  48. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  49. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  50. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  51. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  52. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  53. package/dist/shared/components/item-edit/HeaderTools.js +245 -141
  54. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  55. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  56. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  57. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  58. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  59. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  60. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  61. package/dist/shared/components/item-edit/RecordHelpChip.js +15 -16
  62. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  63. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  64. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  65. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  66. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  67. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  68. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  69. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  70. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  71. package/dist/shared/components/item-edit/UserChip.js +1 -1
  72. package/dist/shared/components/item-edit/addendum-view.js +6 -0
  73. package/dist/shared/components/item-edit/file-live.js +69 -54
  74. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  75. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  76. package/dist/shared/components/item-edit/removed-line.js +31 -25
  77. package/dist/shared/components/layout-editor/pickers/field-picker.js +151 -130
  78. package/dist/shared/components/list/ListViewers.js +46 -35
  79. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  80. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  81. package/dist/shared/components/panels/AlertBanners.js +82 -72
  82. package/dist/shared/components/panels/BranchLanes.js +22 -22
  83. package/dist/shared/components/panels/CommentImages.js +123 -102
  84. package/dist/shared/components/panels/CommentPanel.js +186 -185
  85. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  86. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  87. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  88. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  89. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  90. package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
  91. package/dist/shared/components/profile/AgentNameField.js +107 -81
  92. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  93. package/dist/shared/components/profile/PersonAccess.js +599 -495
  94. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  95. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  96. package/dist/shared/components/profile/primitives.js +1 -1
  97. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  98. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  99. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  100. package/dist/shared/components/support/AssignRules.js +1733 -0
  101. package/dist/shared/components/support/PersonPick.js +88 -0
  102. package/dist/shared/components/support/RequestList.js +790 -0
  103. package/dist/shared/components/support/ScreenShare.js +158 -152
  104. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  105. package/dist/shared/components/support/SupportView.js +140 -246
  106. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  107. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  108. package/dist/shared/components/support/assign-rules-text.js +171 -0
  109. package/dist/shared/components/support/support-list.js +125 -0
  110. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  111. package/dist/shared/components/ui/checkbox.js +6 -6
  112. package/dist/shared/components/ui/select.js +43 -39
  113. package/dist/shared/components/ui/sheet.js +9 -9
  114. package/dist/shared/components/ui/switch.js +12 -11
  115. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  116. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  117. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  118. package/dist/shared/lib/activity-sentence.js +103 -91
  119. package/dist/shared/lib/agent-presence.js +27 -21
  120. package/dist/shared/lib/approval-progress.js +2 -2
  121. package/dist/shared/lib/copy-rules.js +31 -24
  122. package/dist/shared/lib/derived-causes.js +113 -78
  123. package/dist/shared/lib/grid-cursors.js +26 -26
  124. package/dist/shared/lib/label-flash.js +27 -0
  125. package/dist/shared/lib/list-return.js +137 -125
  126. package/dist/shared/lib/live-deltas.js +40 -34
  127. package/dist/shared/lib/live-groups.js +56 -52
  128. package/dist/shared/lib/live-preference.js +64 -59
  129. package/dist/shared/lib/live-screen.js +223 -192
  130. package/dist/shared/lib/partner-failure.js +11 -11
  131. package/dist/shared/lib/rollup-recalc.js +68 -64
  132. package/dist/shared/lib/screen-refresh.js +74 -68
  133. package/dist/shared/lib/screen-share.js +108 -104
  134. package/dist/shared/lib/send-status.js +77 -61
  135. package/dist/shared/lib/text-diff-window.js +29 -0
  136. package/dist/shared/lib/watch-list.js +210 -209
  137. package/dist/shared/lib/widget-image-render.js +72 -49
  138. package/package.json +1 -1
@@ -1,107 +1,111 @@
1
- import { useQueryClient as I } from "@tanstack/react-query";
2
- import { useMemo as L, useState as q, useRef as p, useEffect as T } from "react";
3
- import { parseRollupSources as b } from "../components/item-edit/live-rollups.js";
1
+ import { useQueryClient as z } from "@tanstack/react-query";
2
+ import { useMemo as L, useState as b, useRef as g, useEffect as T } from "react";
3
+ import { parseRollupSources as I } from "../components/item-edit/live-rollups.js";
4
4
  import { useLiveRecordEvent as D } from "./live.js";
5
5
  import { onWriteCommand as K } from "./own-writes.js";
6
- const P = 15e3, N = 350, Q = 1400;
7
- function U(l) {
6
+ const P = 15e3, $ = 350, N = 1400;
7
+ function Q(l) {
8
8
  const u = /* @__PURE__ */ new Map(), f = l ?? [];
9
- for (const o of f)
10
- if (!(o.computed_type !== "rollup" || !o.computed_formula))
11
- for (const n of b(o.computed_formula)) {
12
- const c = u.get(n.related_collection) ?? /* @__PURE__ */ new Set();
13
- c.add(o.field), u.set(n.related_collection, c);
9
+ for (const n of f)
10
+ if (!(n.computed_type !== "rollup" || !n.computed_formula))
11
+ for (const r of I(n.computed_formula)) {
12
+ const c = u.get(r.related_collection) ?? /* @__PURE__ */ new Set();
13
+ c.add(n.field), u.set(r.related_collection, c);
14
+ }
15
+ const d = (n, r) => n.includes(`{{${r}}}`) || new RegExp(`\\bitem\\.${r}\\b`).test(n);
16
+ for (const n of u.values())
17
+ for (let r = !0; r; ) {
18
+ r = !1;
19
+ for (const c of f) {
20
+ if (c.computed_type === "rollup" || n.has(c.field) || !c.computed_formula) continue;
21
+ const m = typeof c.computed_formula == "string" ? c.computed_formula : JSON.stringify(c.computed_formula);
22
+ [...n].some((h) => d(m, h)) && (n.add(c.field), r = !0);
14
23
  }
15
- for (const o of u.values())
16
- for (const n of f) {
17
- if (n.computed_type === "rollup" || o.has(n.field) || !n.computed_formula) continue;
18
- const c = typeof n.computed_formula == "string" ? n.computed_formula : JSON.stringify(n.computed_formula);
19
- [...o].some((m) => c.includes(`{{${m}}}`)) && o.add(n.field);
20
24
  }
21
25
  return u;
22
26
  }
23
- function W(l) {
27
+ function U(l) {
24
28
  const [u, f] = l.split("?");
25
29
  if (!f) return null;
26
- const o = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/[^/?#]+)?$/.exec(u);
27
- if (!o) return null;
28
- const n = new URLSearchParams(f), c = n.get("parent_collection"), m = n.get("parent_id");
29
- return !c || !m ? null : { collection: o[1], parentCollection: c, parentId: m };
30
+ const d = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/[^/?#]+)?$/.exec(u);
31
+ if (!d) return null;
32
+ const n = new URLSearchParams(f), r = n.get("parent_collection"), c = n.get("parent_id");
33
+ return !r || !c ? null : { collection: d[1], parentCollection: r, parentId: c };
30
34
  }
31
35
  const a = /* @__PURE__ */ new Set();
32
36
  function Y(l) {
33
- const { collection: u, fields: f, dataUpdatedAt: o, enabled: n = !0 } = l, c = l.itemId == null || l.itemId === "new" ? null : String(l.itemId), m = I(), h = L(() => U(f), [f]), A = L(() => {
37
+ const { collection: u, fields: f, dataUpdatedAt: d, enabled: n = !0 } = l, r = l.itemId == null || l.itemId === "new" ? null : String(l.itemId), c = z(), m = L(() => Q(f), [f]), h = L(() => {
34
38
  const e = /* @__PURE__ */ new Set();
35
- for (const t of h.values()) for (const s of t) e.add(s);
39
+ for (const t of m.values()) for (const s of t) e.add(s);
36
40
  return e;
37
- }, [h]), [k, y] = q(a), [z, S] = q(a), d = p({
41
+ }, [m]), [q, w] = b(a), [k, y] = b(a), p = g({
38
42
  inflight: 0,
39
43
  serverOpen: !1,
40
44
  /** When the burst's last write / the server's `done` ended: a re-read after it settles. */
41
45
  endedAt: 0,
42
46
  fields: /* @__PURE__ */ new Set()
43
- }), C = p(l.queryKey);
44
- C.current = l.queryKey;
45
- const r = p({}), _ = n && !!c && A.size > 0, x = (e) => {
46
- const t = d.current, s = new Set(t.fields);
47
- t.fields.clear(), t.inflight = 0, t.serverOpen = !1, t.endedAt = 0, r.current.max && clearTimeout(r.current.max), r.current.reread && clearTimeout(r.current.reread), y(a), e && s.size > 0 && (S(s), r.current.landed && clearTimeout(r.current.landed), r.current.landed = setTimeout(() => S(a), Q));
48
- }, R = p(x);
49
- R.current = x;
47
+ }), x = g(l.queryKey);
48
+ x.current = l.queryKey;
49
+ const o = g({}), _ = n && !!r && h.size > 0, C = (e) => {
50
+ const t = p.current, s = new Set(t.fields);
51
+ t.fields.clear(), t.inflight = 0, t.serverOpen = !1, t.endedAt = 0, o.current.max && clearTimeout(o.current.max), o.current.reread && clearTimeout(o.current.reread), w(a), e && s.size > 0 && (y(s), o.current.landed && clearTimeout(o.current.landed), o.current.landed = setTimeout(() => y(a), N));
52
+ }, R = g(C);
53
+ R.current = C;
50
54
  const O = (e) => {
51
- const t = d.current;
55
+ const t = p.current;
52
56
  let s = !1;
53
57
  for (const i of e)
54
- A.has(i) && !t.fields.has(i) && (t.fields.add(i), s = !0);
55
- t.endedAt = 0, r.current.reread && clearTimeout(r.current.reread), s && y(new Set(t.fields)), r.current.max && clearTimeout(r.current.max), r.current.max = setTimeout(() => R.current(!1), P);
56
- }, v = p(O);
57
- v.current = O;
58
+ h.has(i) && !t.fields.has(i) && (t.fields.add(i), s = !0);
59
+ t.endedAt = 0, o.current.reread && clearTimeout(o.current.reread), s && w(new Set(t.fields)), o.current.max && clearTimeout(o.current.max), o.current.max = setTimeout(() => R.current(!1), P);
60
+ }, S = g(O);
61
+ S.current = O;
58
62
  const M = () => {
59
- const e = d.current;
60
- e.fields.size === 0 || e.inflight > 0 || e.serverOpen || (e.endedAt = Date.now(), r.current.reread && clearTimeout(r.current.reread), r.current.reread = setTimeout(() => {
61
- m.invalidateQueries({ queryKey: C.current });
62
- }, N));
63
- }, w = p(M);
64
- return w.current = M, T(() => {
63
+ const e = p.current;
64
+ e.fields.size === 0 || e.inflight > 0 || e.serverOpen || (e.endedAt = Date.now(), o.current.reread && clearTimeout(o.current.reread), o.current.reread = setTimeout(() => {
65
+ c.invalidateQueries({ queryKey: x.current });
66
+ }, $));
67
+ }, v = g(M);
68
+ return v.current = M, T(() => {
65
69
  if (_)
66
70
  return K((e) => {
67
- const t = W(e.path);
68
- if (!t || t.parentCollection !== u || t.parentId !== c) return;
69
- const s = h.get(t.collection);
71
+ const t = U(e.path);
72
+ if (!t || t.parentCollection !== u || t.parentId !== r) return;
73
+ const s = m.get(t.collection);
70
74
  if (!s) return;
71
- const i = d.current;
72
- e.phase === "start" ? (i.inflight++, v.current(s)) : (i.inflight = Math.max(0, i.inflight - 1), w.current());
75
+ const i = p.current;
76
+ e.phase === "start" ? (i.inflight++, S.current(s)) : (i.inflight = Math.max(0, i.inflight - 1), v.current());
73
77
  });
74
- }, [_, u, c, h]), D(
78
+ }, [_, u, r, m]), D(
75
79
  "record:recalc",
76
80
  u,
77
- c,
81
+ r,
78
82
  (e) => {
79
- const t = Array.isArray(e == null ? void 0 : e.fields) ? e.fields.map(String) : [], s = d.current;
83
+ const t = Array.isArray(e == null ? void 0 : e.fields) ? e.fields.map(String) : [], s = p.current;
80
84
  if ((e == null ? void 0 : e.phase) === "start") {
81
- const i = t.filter((g) => A.has(g));
82
- for (const g of h.values())
83
- if (i.some((E) => g.has(E))) for (const E of g) i.push(E);
85
+ const i = t.filter((A) => h.has(A));
86
+ for (const A of m.values())
87
+ if (i.some((E) => A.has(E))) for (const E of A) i.push(E);
84
88
  if (i.length === 0) return;
85
- s.serverOpen = !0, v.current(i);
86
- } else (e == null ? void 0 : e.phase) === "done" && (s.serverOpen = !1, w.current());
89
+ s.serverOpen = !0, S.current(i);
90
+ } else (e == null ? void 0 : e.phase) === "done" && (s.serverOpen = !1, v.current());
87
91
  },
88
92
  { includeOwn: !0, enabled: _ }
89
93
  ), T(() => {
90
- const e = d.current;
91
- e.endedAt > 0 && o >= e.endedAt && R.current(!0);
92
- }, [o]), T(() => {
93
- const e = r.current;
94
+ const e = p.current;
95
+ e.endedAt > 0 && d >= e.endedAt && R.current(!0);
96
+ }, [d]), T(() => {
97
+ const e = o.current;
94
98
  return () => {
95
99
  for (const t of ["reread", "max", "landed"]) e[t] && clearTimeout(e[t]);
96
- d.current = { inflight: 0, serverOpen: !1, endedAt: 0, fields: /* @__PURE__ */ new Set() }, y(a), S(a);
100
+ p.current = { inflight: 0, serverOpen: !1, endedAt: 0, fields: /* @__PURE__ */ new Set() }, w(a), y(a);
97
101
  };
98
- }, [u, c]), { pending: _ ? k : a, landed: _ ? z : a };
102
+ }, [u, r]), { pending: _ ? q : a, landed: _ ? k : a };
99
103
  }
100
104
  export {
101
- Q as RECALC_LANDED_MS,
105
+ N as RECALC_LANDED_MS,
102
106
  P as RECALC_MAX_MS,
103
- N as RECALC_REREAD_MS,
104
- W as childWriteOf,
105
- U as recalcFeeds,
107
+ $ as RECALC_REREAD_MS,
108
+ U as childWriteOf,
109
+ Q as recalcFeeds,
106
110
  Y as useRollupRecalc
107
111
  };
@@ -1,33 +1,33 @@
1
- import { useRef as C, useEffect as T, useSyncExternalStore as _ } from "react";
2
- import { getLiveMode as y } from "./live-preference.js";
3
- import { forgetSettledReads as D } from "./request-gate.js";
4
- const M = 1600, L = 1e3, b = 2e4;
1
+ import { useRef as C, useEffect as T, useSyncExternalStore as P } from "react";
2
+ import { getLiveMode as M } from "./live-preference.js";
3
+ import { forgetSettledReads as y } from "./request-gate.js";
4
+ const D = 1600, L = 6e4, A = 1e3, b = 2e4;
5
5
  let p = null;
6
- const w = /* @__PURE__ */ new Map();
7
- let A = 1, f = null, E = 0, m = null, g = { phase: "idle", at: 0, reason: null };
8
- const R = /* @__PURE__ */ new Set();
6
+ const m = /* @__PURE__ */ new Map();
7
+ let B = 1, f = null, g = 0, S = null, E = { phase: "idle", at: 0, reason: null };
8
+ const w = /* @__PURE__ */ new Set();
9
9
  let i = null;
10
- function S(e) {
11
- g = e;
12
- for (const t of [...R]) t();
10
+ function R(e) {
11
+ E = e;
12
+ for (const t of [...w]) t();
13
13
  }
14
- function j(e) {
14
+ function G(e) {
15
15
  p = e;
16
16
  }
17
- function G() {
17
+ function U() {
18
18
  return p;
19
19
  }
20
- function B(e) {
21
- const t = A++;
22
- return w.set(t, e), () => {
23
- w.delete(t);
20
+ function N(e) {
21
+ const t = B++;
22
+ return m.set(t, e), () => {
23
+ m.delete(t);
24
24
  };
25
25
  }
26
- function U(e, t = !0) {
26
+ function k(e, t = !0) {
27
27
  const n = C(e);
28
28
  n.current = e, T(() => {
29
29
  if (t)
30
- return B(() => n.current());
30
+ return N(() => n.current());
31
31
  }, [t]);
32
32
  }
33
33
  function v(e) {
@@ -36,21 +36,21 @@ function v(e) {
36
36
  }
37
37
  function O(e, t) {
38
38
  return new Promise((n, s) => {
39
- const u = setTimeout(() => s(new Error("timeout")), t);
39
+ const a = setTimeout(() => s(new Error("timeout")), t);
40
40
  Promise.resolve(e).then(
41
41
  (o) => {
42
- clearTimeout(u), n(o);
42
+ clearTimeout(a), n(o);
43
43
  },
44
44
  (o) => {
45
- clearTimeout(u), s(o);
45
+ clearTimeout(a), s(o);
46
46
  }
47
47
  );
48
48
  });
49
49
  }
50
50
  async function q(e, t) {
51
51
  const n = Date.now();
52
- D();
53
- let s = 0, u = 0;
52
+ y();
53
+ let s = 0, a = 0;
54
54
  const o = [];
55
55
  if (e) {
56
56
  for (const r of e.getQueryCache().getAll())
@@ -64,10 +64,10 @@ async function q(e, t) {
64
64
  }), await e.refetchQueries(
65
65
  { predicate: (r) => l.has(r) },
66
66
  { cancelRefetch: !1, throwOnError: !1 }
67
- ), u += o.filter((r) => r.state.status === "error").length;
67
+ ), a += o.filter((r) => r.state.status === "error").length;
68
68
  }
69
- const a = [...w.values()], c = await Promise.allSettled(
70
- a.map((l) => {
69
+ const u = [...m.values()], c = await Promise.allSettled(
70
+ u.map((l) => {
71
71
  try {
72
72
  return O(l(), b);
73
73
  } catch (r) {
@@ -75,50 +75,55 @@ async function q(e, t) {
75
75
  }
76
76
  })
77
77
  );
78
- if (u += c.filter((l) => l.status === "rejected").length, typeof window < "u")
78
+ if (a += c.filter((l) => l.status === "rejected").length, typeof window < "u")
79
79
  try {
80
80
  window.dispatchEvent(new CustomEvent("nvr:screen-refresh", { detail: { reason: t } }));
81
81
  } catch {
82
82
  }
83
- return { queries: s, loaders: a.length, failed: u, ms: Date.now() - n };
83
+ return { queries: s, loaders: u.length, failed: a, ms: Date.now() - n };
84
84
  }
85
- function k(e = {}) {
85
+ function z(e = {}) {
86
86
  const t = e.reason ?? "button";
87
- if (f) return f.then((a) => ({ ...a, coalesced: !0 }));
87
+ if (f) return f.then((u) => ({ ...u, coalesced: !0 }));
88
88
  const n = e.now ?? Date.now, s = t === "button" || t === "palette" || t === "shortcut";
89
- if (!s && y() === "off")
89
+ if (!s && M() === "off")
90
90
  return Promise.resolve({ queries: 0, loaders: 0, failed: 0, ms: 0, coalesced: !0 });
91
- if (!s && m && n() - E < L)
92
- return Promise.resolve({ ...m, coalesced: !0 });
93
- const u = e.qc === void 0 ? p : e.qc;
94
- i && clearTimeout(i), S({ phase: "running", at: n(), reason: t });
95
- const o = q(u, t).catch(() => ({ queries: 0, loaders: 0, failed: 1, ms: 0 })).then((a) => {
91
+ if (!s && S && n() - g < A)
92
+ return Promise.resolve({ ...S, coalesced: !0 });
93
+ const a = e.qc === void 0 ? p : e.qc;
94
+ i && clearTimeout(i), R({ phase: "running", at: n(), reason: t });
95
+ const o = q(a, t).catch(() => ({ queries: 0, loaders: 0, failed: 1, ms: 0 })).then((u) => {
96
96
  var c;
97
- return f = null, E = n(), m = a, S({ phase: a.failed > 0 ? "partial" : "done", at: n(), reason: t }), i = setTimeout(() => {
98
- i = null, g.phase !== "running" && S({ phase: "idle", at: Date.now(), reason: t });
99
- }, M), (c = i.unref) == null || c.call(i), a;
97
+ return f = null, g = n(), S = u, R(
98
+ u.failed > 0 ? { phase: "partial", at: n(), reason: t, failed: u.failed } : { phase: "done", at: n(), reason: t }
99
+ ), i = setTimeout(
100
+ () => {
101
+ i = null, E.phase !== "running" && R({ phase: "idle", at: Date.now(), reason: t });
102
+ },
103
+ u.failed > 0 ? L : D
104
+ ), (c = i.unref) == null || c.call(i), u;
100
105
  });
101
106
  return f = o, o;
102
107
  }
103
- function P() {
104
- return g;
108
+ function _() {
109
+ return E;
105
110
  }
106
- function N(e) {
107
- return R.add(e), () => {
108
- R.delete(e);
111
+ function x(e) {
112
+ return w.add(e), () => {
113
+ w.delete(e);
109
114
  };
110
115
  }
111
- function z() {
112
- return _(N, P, P);
116
+ function J() {
117
+ return P(x, _, _);
113
118
  }
114
- const x = ["refresh", "reload", "update", "data", "fresh", "stale"];
115
- function J(e) {
119
+ const F = ["refresh", "reload", "update", "data", "fresh", "stale"];
120
+ function K(e) {
116
121
  const t = e.trim().toLowerCase();
117
- return t.length < 2 ? !1 : t.split(/\s+/).every((s) => x.some((u) => u.startsWith(s)) || "this page".includes(s));
122
+ return t.length < 2 ? !1 : t.split(/\s+/).every((s) => F.some((a) => a.startsWith(s)) || "this page".includes(s));
118
123
  }
119
124
  let d = 0;
120
125
  const h = /* @__PURE__ */ new Set();
121
- function K() {
126
+ function V() {
122
127
  d++;
123
128
  for (const t of [...h]) t();
124
129
  let e = !1;
@@ -129,32 +134,33 @@ function K() {
129
134
  }
130
135
  };
131
136
  }
132
- function F() {
137
+ function I() {
133
138
  return d > 0;
134
139
  }
135
- function I(e) {
140
+ function H(e) {
136
141
  return h.add(e), () => {
137
142
  h.delete(e);
138
143
  };
139
144
  }
140
- function V() {
141
- return _(I, F, () => !1);
145
+ function X() {
146
+ return P(H, I, () => !1);
142
147
  }
143
148
  export {
144
149
  b as SCREEN_LOADER_TIMEOUT_MS,
145
- M as SCREEN_REFRESH_DONE_MS,
146
- L as SCREEN_REFRESH_MIN_GAP_MS,
147
- F as pageRefreshButtonShown,
148
- k as refreshScreenData,
149
- K as registerPageRefreshButton,
150
- B as registerScreenLoader,
150
+ D as SCREEN_REFRESH_DONE_MS,
151
+ A as SCREEN_REFRESH_MIN_GAP_MS,
152
+ L as SCREEN_REFRESH_PARTIAL_MS,
153
+ I as pageRefreshButtonShown,
154
+ z as refreshScreenData,
155
+ V as registerPageRefreshButton,
156
+ N as registerScreenLoader,
151
157
  v as screenRefreshAllowed,
152
- G as screenRefreshClient,
153
- J as screenRefreshMatches,
154
- P as screenRefreshState,
155
- j as setScreenRefreshClient,
156
- N as subscribeScreenRefresh,
157
- V as usePageRefreshButtonShown,
158
- U as useScreenLoader,
159
- z as useScreenRefreshState
158
+ U as screenRefreshClient,
159
+ K as screenRefreshMatches,
160
+ _ as screenRefreshState,
161
+ G as setScreenRefreshClient,
162
+ x as subscribeScreenRefresh,
163
+ X as usePageRefreshButtonShown,
164
+ k as useScreenLoader,
165
+ J as useScreenRefreshState
160
166
  };