@nivaro/react 0.3.40 → 0.3.42

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 (99) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +645 -16
  5. package/dist/index.js +814 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/PickerExcludedRows.js +3 -3
  20. package/dist/shared/components/ProfileView.js +776 -1003
  21. package/dist/shared/components/RecentRecordsRail.js +34 -16
  22. package/dist/shared/components/RecordReadView.js +500 -477
  23. package/dist/shared/components/Skeletons.js +199 -0
  24. package/dist/shared/components/SlowNotice.js +63 -0
  25. package/dist/shared/components/Term.js +23 -0
  26. package/dist/shared/components/WidgetSlot.js +350 -353
  27. package/dist/shared/components/access/PermissionSummary.js +106 -0
  28. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  29. package/dist/shared/components/chat/ChatPanel.js +902 -886
  30. package/dist/shared/components/chat/MemberPaging.js +70 -0
  31. package/dist/shared/components/chat/RoomParts.js +147 -117
  32. package/dist/shared/components/chat/ScreenClip.js +73 -69
  33. package/dist/shared/components/chat/chat-core.js +449 -396
  34. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  35. package/dist/shared/components/help-videos/api.js +2 -5
  36. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  37. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  38. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  39. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  40. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  41. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  42. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  43. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  44. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  45. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  46. package/dist/shared/components/item-edit/RecordGrantTools.js +28 -28
  47. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  48. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  49. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  50. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  51. package/dist/shared/components/item-edit/field-sources.js +33 -0
  52. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  53. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  54. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  55. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  56. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  57. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  58. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  59. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  60. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  61. package/dist/shared/components/layout-editor/settings/settings-registry.js +1 -1
  62. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  63. package/dist/shared/components/list/InlineEdit.js +363 -0
  64. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  65. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  66. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  67. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  68. package/dist/shared/components/notifications/changes-lines.js +24 -0
  69. package/dist/shared/components/notifications/why-lines.js +64 -0
  70. package/dist/shared/components/panels/CommentPanel.js +316 -281
  71. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  72. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  73. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  74. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  75. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  76. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  77. package/dist/shared/components/profile/PersonProfile.js +57 -52
  78. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  79. package/dist/shared/hooks/useSlowReason.js +39 -0
  80. package/dist/shared/lib/activity-sentence.js +670 -0
  81. package/dist/shared/lib/config-sentences.js +418 -0
  82. package/dist/shared/lib/core-glossary.js +229 -0
  83. package/dist/shared/lib/error-hints.js +159 -0
  84. package/dist/shared/lib/error-message.js +105 -0
  85. package/dist/shared/lib/error-toast.js +22 -0
  86. package/dist/shared/lib/field-comments.js +25 -0
  87. package/dist/shared/lib/filter-sentence.js +261 -0
  88. package/dist/shared/lib/glossary.js +55 -48
  89. package/dist/shared/lib/idle-reload.js +138 -0
  90. package/dist/shared/lib/layout-resolve.js +42 -29
  91. package/dist/shared/lib/list-inline-edit.js +190 -0
  92. package/dist/shared/lib/list-link.js +147 -0
  93. package/dist/shared/lib/prefetch.js +259 -106
  94. package/dist/shared/lib/record-ref.js +72 -0
  95. package/dist/shared/lib/reload-holds.js +25 -0
  96. package/dist/shared/lib/safe-error.js +52 -24
  97. package/dist/shared/lib/skeleton-shapes.js +72 -0
  98. package/dist/shared/lib/slow-reason.js +63 -0
  99. package/package.json +1 -1
@@ -0,0 +1,147 @@
1
+ const _ = "lv";
2
+ const m = 7e3;
3
+ function A(t) {
4
+ const e = new TextEncoder().encode(t);
5
+ let r = "";
6
+ for (const i of e) r += String.fromCharCode(i);
7
+ return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
8
+ }
9
+ function g(t) {
10
+ try {
11
+ const e = t.replace(/-/g, "+").replace(/_/g, "/"), r = atob(e + "=".repeat((4 - e.length % 4) % 4)), i = Uint8Array.from(r, (s) => s.charCodeAt(0));
12
+ return new TextDecoder().decode(i);
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+ function L(t) {
18
+ const e = {};
19
+ for (const [r, i] of Object.entries(t))
20
+ i == null || i === "" || Array.isArray(i) && i.length === 0 || typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (e[r] = i);
21
+ return e;
22
+ }
23
+ function h(t, e) {
24
+ return A(JSON.stringify({ v: 1, k: t, s: L(e) }));
25
+ }
26
+ function b(t, e) {
27
+ if (!t) return null;
28
+ const r = g(t);
29
+ if (!r) return null;
30
+ try {
31
+ const i = JSON.parse(r);
32
+ return (i == null ? void 0 : i.v) !== 1 || i.k !== e || !i.s || typeof i.s != "object" || Array.isArray(i.s) ? null : i.s;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ function S(t, e, r) {
38
+ const i = new URL(t);
39
+ return i.searchParams.set("lv", h(e, r)), i.toString();
40
+ }
41
+ function I(t) {
42
+ return typeof window > "u" ? null : b(new URLSearchParams(window.location.search).get("lv"), t);
43
+ }
44
+ function v() {
45
+ if (typeof window > "u") return;
46
+ const t = new URLSearchParams(window.location.search);
47
+ if (!t.has("lv")) return;
48
+ t.delete("lv");
49
+ const e = t.toString();
50
+ window.history.replaceState(
51
+ window.history.state,
52
+ "",
53
+ `${window.location.pathname}${e ? `?${e}` : ""}${window.location.hash}`
54
+ );
55
+ }
56
+ async function N(t, e) {
57
+ if (typeof window > "u") return "failed";
58
+ const r = S(window.location.href, t, e);
59
+ if (r.length > 7e3) return "too-long";
60
+ try {
61
+ return await navigator.clipboard.writeText(r), "copied";
62
+ } catch {
63
+ return "failed";
64
+ }
65
+ }
66
+ const l = (t) => !!t && typeof t == "object" && !Array.isArray(t), u = (t) => typeof t == "string" ? t : void 0, d = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string") : void 0, k = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string" || typeof e == "number") : [], p = (t, e) => {
67
+ const r = Number(t);
68
+ return Number.isInteger(r) && r > 0 ? Math.min(r, e) : void 0;
69
+ };
70
+ function O(t) {
71
+ if (!t) return null;
72
+ const e = {}, r = u(t.q);
73
+ r && (e.q = r.slice(0, 500)), Array.isArray(t.f) && (e.f = t.f.filter(
74
+ (n) => l(n) && Array.isArray(n.path) && typeof n.op == "string"
75
+ ).slice(0, 50).map((n, o) => ({
76
+ ...n,
77
+ id: typeof n.id == "string" && n.id ? n.id : `lv-${o}`,
78
+ pathLabels: Array.isArray(n.pathLabels) ? n.pathLabels : n.path,
79
+ fieldType: typeof n.fieldType == "string" ? n.fieldType : "string",
80
+ value: n.value ?? ""
81
+ })));
82
+ const i = u(t.s);
83
+ if (i && /^-?[\w.$]+$/.test(i) && (e.s = i), Array.isArray(t.c) && (e.c = t.c.filter(
84
+ (n) => typeof n == "string" || l(n) && typeof n.key == "string"
85
+ ).slice(0, 100)), l(t.qf)) {
86
+ const n = {};
87
+ for (const [o, f] of Object.entries(t.qf)) {
88
+ const y = k(f);
89
+ y.length && (n[o] = y.slice(0, 500));
90
+ }
91
+ e.qf = n;
92
+ }
93
+ if (l(t.cf)) {
94
+ const n = {};
95
+ for (const [o, f] of Object.entries(t.cf))
96
+ l(f) && typeof f.kind == "string" && (n[o] = f);
97
+ e.cf = n;
98
+ }
99
+ Array.isArray(t.lc) && (e.lc = t.lc.filter(
100
+ (n) => l(n) && Array.isArray(n.path) && typeof n.op == "string"
101
+ ).slice(0, 50)), Array.isArray(t.ex) && (e.ex = t.ex.filter((n) => l(n) && Array.isArray(n.path)).slice(0, 50));
102
+ const s = u(t.g);
103
+ s && /^[\w.$]+$/.test(s) && (e.g = s);
104
+ const a = p(t.ps, 200);
105
+ a && (e.ps = a);
106
+ const c = p(t.p, 1e5);
107
+ return c && (e.p = c), t.a === !0 && (e.a = !0), e;
108
+ }
109
+ function R(t) {
110
+ if (!t) return null;
111
+ const e = {};
112
+ if ((t.scope === "mine" || t.scope === "unowned" || t.scope === "all" || t.scope === "claimed") && (e.scope = t.scope), l(t.filters)) {
113
+ const c = {};
114
+ for (const [n, o] of Object.entries(t.filters))
115
+ if (typeof o == "string") c[n] = o.slice(0, 500);
116
+ else {
117
+ const f = d(o);
118
+ f != null && f.length && (c[n] = f.slice(0, 500));
119
+ }
120
+ e.filters = c;
121
+ }
122
+ const r = u(t.sort);
123
+ r && /^-?[\w.$]+$/.test(r) && (e.sort = r);
124
+ const i = u(t.group_by);
125
+ i && (e.group_by = i), (t.view === "table" || t.view === "kanban" || t.view === "workload") && (e.view = t.view);
126
+ const s = d(t.columns);
127
+ if (s != null && s.length && (e.columns = s.slice(0, 100)), l(t.pins)) {
128
+ const c = {};
129
+ for (const [n, o] of Object.entries(t.pins)) (o === "left" || o === "right") && (c[n] = o);
130
+ Object.keys(c).length && (e.pins = c);
131
+ }
132
+ const a = p(t.page, 1e5);
133
+ return a && (e.page = a), e;
134
+ }
135
+ export {
136
+ m as LIST_LINK_MAX_CHARS,
137
+ _ as LIST_LINK_PARAM,
138
+ N as copyListLink,
139
+ b as decodeListLink,
140
+ v as dropListLinkParam,
141
+ h as encodeListLink,
142
+ S as listLinkUrl,
143
+ L as pruneListLinkState,
144
+ I as readListLinkFromLocation,
145
+ O as sanitizeCbvLinkState,
146
+ R as sanitizeQueueLinkState
147
+ };
@@ -1,149 +1,302 @@
1
- import { useRef as E, useEffect as T } from "react";
2
- import { get as v } from "./commands.js";
3
- const q = 30, w = 150, R = 3e4;
4
- let d = [];
5
- function L(e = Date.now(), t = q) {
6
- return d = d.filter((r) => e - r < 6e4), d.length >= t ? !1 : (d.push(e), !0);
7
- }
8
- function b() {
9
- if (typeof navigator > "u") return !1;
10
- const e = navigator.connection;
11
- return !!(e != null && e.saveData);
12
- }
13
- function I(e, t) {
1
+ import { withSignal as L } from "@nivaro/sdk";
2
+ import { useQueryClient as O } from "@tanstack/react-query";
3
+ import { useRef as K, useEffect as k, useMemo as U } from "react";
4
+ import { useOptionalNivaroClient as H } from "../context.js";
5
+ import { get as T } from "./commands.js";
6
+ const x = 30, A = 80, G = 2, z = 6, M = 3e4;
7
+ let v = [];
8
+ function B(e = Date.now(), r = x) {
9
+ return v = v.filter((t) => e - t < 6e4), v.length >= r ? !1 : (v.push(e), !0);
10
+ }
11
+ function J(e) {
12
+ return e ? e.saveData ? !1 : e.effectiveType !== "slow-2g" && e.effectiveType !== "2g" : !0;
13
+ }
14
+ function W() {
15
+ return typeof navigator > "u" ? !1 : !J(navigator.connection);
16
+ }
17
+ function X(e = G, r = z) {
18
+ const t = [], n = /* @__PURE__ */ new Map(), i = () => {
19
+ for (; n.size < e && t.length > 0; ) {
20
+ const u = t.shift();
21
+ n.set(u.id, u), Promise.resolve().then(u.run).catch(() => {
22
+ }).finally(() => {
23
+ n.get(u.id) === u && n.delete(u.id), i();
24
+ });
25
+ }
26
+ };
27
+ return {
28
+ add(u) {
29
+ if (n.has(u.id) || t.some((s) => s.id === u.id)) return !1;
30
+ for (t.push(u); t.length > r; ) t.shift();
31
+ return i(), !0;
32
+ },
33
+ has(u) {
34
+ return n.has(u) || t.some((s) => s.id === u);
35
+ },
36
+ cancelGroup(u) {
37
+ var s;
38
+ for (let c = t.length - 1; c >= 0; c--) t[c].group === u && t.splice(c, 1);
39
+ for (const c of n.values())
40
+ if (c.group === u)
41
+ try {
42
+ (s = c.cancel) == null || s.call(c);
43
+ } catch {
44
+ }
45
+ },
46
+ get inFlight() {
47
+ return n.size;
48
+ },
49
+ get queued() {
50
+ return t.length;
51
+ }
52
+ };
53
+ }
54
+ const g = X();
55
+ function V(e, r) {
56
+ setTimeout(() => {
57
+ const t = e.getQueryCache().find({ queryKey: r, exact: !0 });
58
+ !t || t.getObserversCount() > 0 || t.state.fetchStatus !== "fetching" || e.cancelQueries({ queryKey: r, exact: !0 });
59
+ }, 120);
60
+ }
61
+ function Y(e, r) {
14
62
  return {
15
- item: ["item", e, String(t)],
16
- layout: ["active-layout", e, null, String(t)]
63
+ item: ["item", e, String(r)],
64
+ layout: ["active-layout", e, null, String(r)]
17
65
  };
18
66
  }
19
- function S(e, t, r) {
20
- const n = e.getQueryState(t);
21
- return n ? n.fetchStatus === "fetching" ? !0 : n.dataUpdatedAt > 0 && r - n.dataUpdatedAt < R : !1;
67
+ function F(e, r, t) {
68
+ const n = e.getQueryState(r);
69
+ return n ? n.fetchStatus === "fetching" ? !0 : n.dataUpdatedAt > 0 && t - n.dataUpdatedAt < M : !1;
22
70
  }
23
- function h(e, t, r, n = Date.now()) {
24
- return b() || S(e, t, n) || !L(n) ? !1 : (e.prefetchQuery({ queryKey: t, queryFn: r, staleTime: R }), !0);
71
+ function y(e, r, t, n = Date.now(), i) {
72
+ if (W() || F(e, r, n)) return !1;
73
+ const u = JSON.stringify(r);
74
+ return g.has(u) || !B(n) ? !1 : g.add({
75
+ id: u,
76
+ group: i ?? null,
77
+ run: () => (
78
+ // Fresh by now (the page itself fetched it while this waited) = nothing to do.
79
+ F(e, r, Date.now()) ? Promise.resolve() : e.prefetchQuery({
80
+ queryKey: r,
81
+ queryFn: ({ signal: s }) => t(s),
82
+ staleTime: M
83
+ })
84
+ ),
85
+ cancel: () => V(e, r)
86
+ });
25
87
  }
26
- function P(e, t, r, n, u = {}) {
27
- if (!r || n == null || n === "" || n === "new") return 0;
28
- const c = I(r, n);
29
- let f = 0;
30
- return h(
88
+ function N(e, r, t, n, i = {}) {
89
+ if (!t || n == null || n === "" || n === "new") return 0;
90
+ const u = Y(t, n), s = i.group ?? `record:${t}:${n}`;
91
+ let c = 0;
92
+ return y(
31
93
  e,
32
- c.item,
33
- () => t.request(v(`/items/${r}/${n}`)).then((s) => s.data)
34
- ) && f++, u.layout !== !1 && h(
94
+ u.item,
95
+ (l) => r.request(
96
+ L(T(`/items/${t}/${n}`), l)
97
+ ).then((f) => f.data),
98
+ Date.now(),
99
+ s
100
+ ) && c++, i.layout !== !1 && y(
35
101
  e,
36
- c.layout,
37
- () => t.request(
38
- v("/collection-layouts/active", { collection: r, item: String(n) })
39
- ).then((s) => s.data ?? null)
40
- ) && f++, f;
102
+ u.layout,
103
+ (l) => r.request(
104
+ L(T("/collection-layouts/active", { collection: t, item: String(n) }), l)
105
+ ).then((f) => f.data ?? null),
106
+ Date.now(),
107
+ s
108
+ ) && c++, c;
41
109
  }
42
- function _(e, t = 2e3) {
110
+ function Z(e) {
111
+ return { meta: ["cbv-collection-meta", e] };
112
+ }
113
+ function Q(e, r, t, n = {}) {
114
+ if (!t || /^(nivaro|directus)_/i.test(t)) return 0;
115
+ const i = Z(t);
116
+ return y(
117
+ e,
118
+ i.meta,
119
+ (u) => r.request(L(T(`/collections/${t}`), u)).then((s) => s.data),
120
+ Date.now(),
121
+ n.group ?? `list:${t}`
122
+ ) ? 1 : 0;
123
+ }
124
+ function j(e, r = 2e3) {
43
125
  if (typeof window > "u") return () => {
44
126
  };
45
- const r = window;
46
- if (r.requestIdleCallback) {
47
- const u = r.requestIdleCallback(e, { timeout: t });
127
+ const t = window;
128
+ if (t.requestIdleCallback) {
129
+ const i = t.requestIdleCallback(e, { timeout: r });
48
130
  return () => {
49
- var c;
50
- return (c = r.cancelIdleCallback) == null ? void 0 : c.call(r, u);
131
+ var u;
132
+ return (u = t.cancelIdleCallback) == null ? void 0 : u.call(t, i);
51
133
  };
52
134
  }
53
135
  const n = setTimeout(e, 300);
54
136
  return () => clearTimeout(n);
55
137
  }
56
- function D(e) {
57
- const t = E(e);
58
- t.current = e;
59
- const r = JSON.stringify(e.queryKey);
60
- T(() => {
138
+ function ce(e) {
139
+ const r = K(e);
140
+ r.current = e;
141
+ const t = JSON.stringify(e.queryKey);
142
+ k(() => {
61
143
  if (e.enabled)
62
- return _(() => {
63
- const n = t.current;
64
- h(n.qc, n.queryKey, n.queryFn);
144
+ return j(() => {
145
+ const n = r.current;
146
+ y(n.qc, n.queryKey, n.queryFn);
65
147
  });
66
- }, [e.enabled, r]);
148
+ }, [e.enabled, t]);
67
149
  }
68
- function k(e, t) {
69
- const r = e.getAttribute("href");
70
- if (!r || r.startsWith("#") || e.hasAttribute("download") || e.target && e.target !== "_self") return null;
150
+ function ee(e, r) {
151
+ const t = e.getAttribute("href");
152
+ if (!t || t.startsWith("#") || e.hasAttribute("download") || e.target && e.target !== "_self") return null;
71
153
  try {
72
- const n = new URL(r, t);
73
- return n.origin !== t ? null : n.pathname + n.search;
154
+ const n = new URL(t, r);
155
+ return n.origin !== r ? null : n.pathname + n.search;
74
156
  } catch {
75
157
  return null;
76
158
  }
77
159
  }
78
- function p(e) {
160
+ function te(e) {
79
161
  if (typeof document > "u") return () => {
80
162
  };
81
- const t = e.root ?? document, r = window.location.origin;
82
- let n = null, u = null;
83
- const c = () => {
84
- n && clearTimeout(n), n = null, u = null;
85
- }, f = (l) => {
86
- var i, g;
87
- const o = k(l, r);
163
+ const r = e.root ?? document, t = window.location.origin;
164
+ let n = null, i = null, u = null;
165
+ const s = () => {
166
+ n && clearTimeout(n), n = null;
167
+ }, c = () => {
168
+ s(), i = null, u && g.cancelGroup(u), u = null;
169
+ }, l = (a) => {
170
+ var C, D, b;
171
+ const o = ee(a, t);
88
172
  if (!o) return;
89
173
  try {
90
- (i = e.preloadRoute) == null || i.call(e, o);
174
+ (C = e.preloadRoute) == null || C.call(e, o);
91
175
  } catch {
92
176
  }
93
- const a = (g = e.matchRecord) == null ? void 0 : g.call(e, o.split("?")[0]);
94
- a && e.client && P(e.qc, e.client, a.collection, a.id);
95
- }, s = (l) => {
96
- var a, i;
97
- const o = (i = (a = l.target) == null ? void 0 : a.closest) == null ? void 0 : i.call(a, "a[href]");
98
- !o || o === u || (c(), u = o, n = setTimeout(() => {
99
- n = null, f(o);
100
- }, w));
101
- }, m = (l) => {
102
- const o = l.relatedTarget;
103
- u && o && u.contains(o) || c();
104
- }, y = (l) => {
105
- var a, i;
106
- const o = (i = (a = l.target) == null ? void 0 : a.closest) == null ? void 0 : i.call(a, "a[href]");
107
- o && f(o);
177
+ if (!e.client) return;
178
+ const d = o.split("?")[0], m = `link:${d}`, w = (D = e.matchRecord) == null ? void 0 : D.call(e, d);
179
+ if (w) {
180
+ N(e.qc, e.client, w.collection, w.id, { group: m }) > 0 && (u = m);
181
+ return;
182
+ }
183
+ const _ = (b = e.matchList) == null ? void 0 : b.call(e, d);
184
+ _ && Q(e.qc, e.client, _, { group: m }) > 0 && (u = m);
185
+ }, f = (a) => {
186
+ var o, d;
187
+ return (d = (o = a.target) == null ? void 0 : o.closest) == null ? void 0 : d.call(o, "a[href]");
188
+ }, P = (a) => {
189
+ const o = f(a);
190
+ !o || o === i || (c(), i = o, n = setTimeout(() => {
191
+ n = null, l(o);
192
+ }, A));
193
+ }, q = (a) => {
194
+ const o = a.relatedTarget;
195
+ i && o && i.contains(o) || c();
196
+ }, E = () => {
197
+ u = null;
198
+ }, R = (a) => {
199
+ const o = a.key;
200
+ (o === "Enter" || o === " ") && E();
201
+ }, S = (a) => {
202
+ const o = f(a);
203
+ o && (c(), l(o));
204
+ }, I = (a) => {
205
+ f(a) && c();
108
206
  };
109
- return t.addEventListener("pointerover", s, { passive: !0 }), t.addEventListener("pointerout", m, { passive: !0 }), t.addEventListener("focusin", y), () => {
110
- c(), t.removeEventListener("pointerover", s), t.removeEventListener("pointerout", m), t.removeEventListener("focusin", y);
207
+ return r.addEventListener("pointerover", P, { passive: !0 }), r.addEventListener("pointerout", q, { passive: !0 }), r.addEventListener("pointerdown", E, { passive: !0, capture: !0 }), r.addEventListener("keydown", R, { capture: !0 }), r.addEventListener("focusin", S), r.addEventListener("focusout", I), () => {
208
+ s(), r.removeEventListener("pointerover", P), r.removeEventListener("pointerout", q), r.removeEventListener("pointerdown", E, { capture: !0 }), r.removeEventListener("keydown", R, { capture: !0 }), r.removeEventListener("focusin", S), r.removeEventListener("focusout", I);
111
209
  };
112
210
  }
113
- function K(e) {
114
- const t = E(e);
115
- t.current = e;
116
- const r = e.enabled !== !1;
117
- T(() => {
118
- if (r)
119
- return p({
120
- qc: t.current.qc,
211
+ function se(e) {
212
+ const r = K(e);
213
+ r.current = e;
214
+ const t = e.enabled !== !1;
215
+ k(() => {
216
+ if (t)
217
+ return te({
218
+ qc: r.current.qc,
121
219
  get client() {
122
- return t.current.client;
220
+ return r.current.client;
123
221
  },
124
222
  matchRecord: (n) => {
125
- var u, c;
126
- return ((c = (u = t.current).matchRecord) == null ? void 0 : c.call(u, n)) ?? null;
223
+ var i, u;
224
+ return ((u = (i = r.current).matchRecord) == null ? void 0 : u.call(i, n)) ?? null;
225
+ },
226
+ matchList: (n) => {
227
+ var i, u;
228
+ return ((u = (i = r.current).matchList) == null ? void 0 : u.call(i, n)) ?? null;
127
229
  },
128
230
  preloadRoute: (n) => {
129
- var u, c;
130
- return (c = (u = t.current).preloadRoute) == null ? void 0 : c.call(u, n);
231
+ var i, u;
232
+ return (u = (i = r.current).preloadRoute) == null ? void 0 : u.call(i, n);
131
233
  },
132
- root: t.current.root
234
+ root: r.current.root
133
235
  });
134
- }, [r]);
236
+ }, [t]);
237
+ }
238
+ const h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
239
+ function $(e, r) {
240
+ const t = () => {
241
+ const i = h.get(e);
242
+ i && clearTimeout(i), h.set(
243
+ e,
244
+ setTimeout(() => {
245
+ h.delete(e), r() && p.add(e);
246
+ }, A)
247
+ );
248
+ }, n = () => {
249
+ const i = h.get(e);
250
+ i && clearTimeout(i), h.delete(e), p.delete(e) && g.cancelGroup(e);
251
+ };
252
+ return {
253
+ onPointerEnter: t,
254
+ onPointerLeave: n,
255
+ onPointerDown: () => {
256
+ p.delete(e);
257
+ },
258
+ onFocus: t,
259
+ onBlur: n
260
+ };
261
+ }
262
+ function ae() {
263
+ const e = O(), r = H();
264
+ return U(
265
+ () => ({
266
+ record: (t, n) => {
267
+ if (!r || !t || n == null || n === "" || n === "new") return {};
268
+ const i = `record:${t}:${n}`;
269
+ return $(i, () => N(e, r, t, n, { group: i }));
270
+ },
271
+ list: (t) => {
272
+ if (!r || !t) return {};
273
+ const n = `list:${t}`;
274
+ return $(n, () => Q(e, r, t, { group: n }));
275
+ }
276
+ }),
277
+ [e, r]
278
+ );
135
279
  }
136
280
  export {
137
- w as INTENT_DWELL_MS,
138
- q as PREFETCH_PER_MINUTE,
139
- R as PREFETCH_STALE_MS,
140
- p as installIntentPrefetch,
141
- k as linkPath,
142
- h as prefetchKey,
143
- P as prefetchRecord,
144
- I as recordQueryKeys,
145
- L as takePrefetchToken,
146
- D as useIdleNextPage,
147
- K as useIntentPrefetch,
148
- _ as whenIdle
281
+ A as INTENT_DWELL_MS,
282
+ G as MAX_PREFETCH_IN_FLIGHT,
283
+ z as MAX_PREFETCH_QUEUED,
284
+ x as PREFETCH_PER_MINUTE,
285
+ M as PREFETCH_STALE_MS,
286
+ J as connectionAllowsPrefetch,
287
+ X as createPrefetchLimiter,
288
+ te as installIntentPrefetch,
289
+ $ as intentProps,
290
+ ee as linkPath,
291
+ Z as listQueryKeys,
292
+ Q as prefetchCollectionList,
293
+ y as prefetchKey,
294
+ g as prefetchLimiter,
295
+ N as prefetchRecord,
296
+ Y as recordQueryKeys,
297
+ B as takePrefetchToken,
298
+ ce as useIdleNextPage,
299
+ se as useIntentPrefetch,
300
+ ae as usePrefetchIntent,
301
+ j as whenIdle
149
302
  };
@@ -0,0 +1,72 @@
1
+ import { get as a } from "./commands.js";
2
+ const s = /^[A-Za-z_][A-Za-z0-9_]*$/;
3
+ function c(n) {
4
+ const t = n == null ? void 0 : n.friendly_id_field;
5
+ return typeof t == "string" && t !== "id" && s.test(t) ? t : null;
6
+ }
7
+ function o(n) {
8
+ if (n == null || typeof n == "object") return null;
9
+ const t = String(n).trim();
10
+ return t === "" ? null : t;
11
+ }
12
+ function d(n, t) {
13
+ const e = c(n);
14
+ return e && t ? o(t[e]) : null;
15
+ }
16
+ function y(n) {
17
+ const t = n == null ? void 0 : n.url_alias_fields;
18
+ let e = t;
19
+ if (typeof t == "string")
20
+ try {
21
+ e = JSON.parse(t);
22
+ } catch {
23
+ e = [];
24
+ }
25
+ return Array.isArray(e) ? e.filter((i) => typeof i == "string" && s.test(i)) : [];
26
+ }
27
+ function p(n, t) {
28
+ if (!t) return null;
29
+ const e = y(n);
30
+ let i;
31
+ if (e.length > 0) {
32
+ const r = e.map((l) => o(t[l]));
33
+ if (r.some((l) => l == null)) return null;
34
+ i = r.join("-");
35
+ } else
36
+ i = d(n, t);
37
+ return !i || /^\d+$/.test(i) || /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(i) || i === "new" || i.includes("/") ? null : i;
38
+ }
39
+ async function h(n, t, e, i, r) {
40
+ var u;
41
+ const l = p(e, i);
42
+ if (!l) return String(r);
43
+ try {
44
+ const f = await n.request(
45
+ a(`/items/${t}/by-slug/${encodeURIComponent(l)}`, { fields: "id" })
46
+ );
47
+ return String(((u = f == null ? void 0 : f.data) == null ? void 0 : u.id) ?? "") === String(r) ? l : String(r);
48
+ } catch {
49
+ return String(r);
50
+ }
51
+ }
52
+ async function w(n) {
53
+ const t = typeof navigator < "u" ? navigator.clipboard : void 0;
54
+ if (!t) return;
55
+ const e = globalThis.ClipboardItem;
56
+ if (e && typeof t.write == "function")
57
+ try {
58
+ await t.write([
59
+ new e({ "text/plain": n.then((i) => new Blob([i], { type: "text/plain" })) })
60
+ ]);
61
+ return;
62
+ } catch {
63
+ }
64
+ await t.writeText(await n);
65
+ }
66
+ export {
67
+ p as aliasSegmentOf,
68
+ w as copyWhenReady,
69
+ c as friendlyIdFieldOf,
70
+ d as friendlyIdOf,
71
+ h as shareableRecordId
72
+ };
@@ -0,0 +1,25 @@
1
+ const o = /* @__PURE__ */ new Map();
2
+ let s = 0;
3
+ function n(t, l = () => !0) {
4
+ const e = ++s;
5
+ return o.set(e, { label: t, active: l }), () => {
6
+ o.delete(e);
7
+ };
8
+ }
9
+ function a() {
10
+ const t = [];
11
+ for (const l of o.values()) {
12
+ let e = !1;
13
+ try {
14
+ e = l.active();
15
+ } catch {
16
+ e = !1;
17
+ }
18
+ e && !t.includes(l.label) && t.push(l.label);
19
+ }
20
+ return t;
21
+ }
22
+ export {
23
+ n as registerReloadHold,
24
+ a as reloadHoldLabels
25
+ };