@rpcbase/ui 0.261.0 → 0.263.0
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.
- package/dist/assets/sha256.worker-BEf4_Y9w.js.map +1 -0
- package/dist/components/FilesUploadField/index.d.ts +19 -6
- package/dist/components/FilesUploadField/index.d.ts.map +1 -1
- package/dist/components/FilesUploadField/sha256.d.ts +5 -0
- package/dist/components/FilesUploadField/sha256.d.ts.map +1 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts +4 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts.map +1 -0
- package/dist/components/ImagesField/index.d.ts +4 -2
- package/dist/components/ImagesField/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index298.js +11 -803
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +865 -28
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +26 -510
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +481 -755
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +786 -7428
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +7429 -7
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +6 -12
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +12 -5
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +3 -3
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +5 -469
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +464 -32
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +36 -18
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +17 -28
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +30 -4
- package/dist/index311.js.map +1 -1
- package/dist/index312.js +4 -59
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +59 -9
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +9 -5
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +5 -9
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +9 -12
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +13 -3
- package/dist/index317.js.map +1 -1
- package/dist/index318.js +3 -17
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +14 -23
- package/dist/index319.js.map +1 -1
- package/dist/index320.js +23 -39
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +41 -5
- package/dist/index321.js.map +1 -1
- package/dist/index322.js +5 -25
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +24 -18
- package/dist/index323.js.map +1 -1
- package/dist/index324.js +17 -32
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +34 -5
- package/dist/index325.js.map +1 -1
- package/dist/index326.js +5 -9
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +8 -7
- package/dist/index327.js.map +1 -1
- package/dist/index328.js +8 -9
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +9 -10
- package/dist/index329.js.map +1 -1
- package/dist/index330.js +10 -7
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +7 -75
- package/dist/index331.js.map +1 -1
- package/dist/index332.js +66 -153
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +147 -99
- package/dist/index333.js.map +1 -1
- package/dist/index334.js +113 -13
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +12 -78
- package/dist/index335.js.map +1 -1
- package/dist/index336.js +57 -23
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +45 -12
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +13 -16
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +15 -100
- package/dist/index339.js.map +1 -1
- package/dist/index340.js +95 -50
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +5 -57
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +78 -41
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +58 -100
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +104 -46
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +51 -39
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +42 -142
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +123 -120
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +108 -224
- package/dist/index348.js.map +1 -1
- package/dist/index349.js +174 -158
- package/dist/index349.js.map +1 -1
- package/dist/index350.js +144 -213
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +309 -5
- package/dist/index351.js.map +1 -1
- package/dist/index352.js +5 -6
- package/dist/index352.js.map +1 -1
- package/dist/index353.js +6 -7
- package/dist/index353.js.map +1 -1
- package/dist/index354.js +5 -4
- package/dist/index354.js.map +1 -1
- package/dist/index355.js +4 -4
- package/dist/index355.js.map +1 -1
- package/dist/index356.js +6 -21
- package/dist/index356.js.map +1 -1
- package/dist/index357.js +21 -10
- package/dist/index357.js.map +1 -1
- package/dist/index358.js +10 -128
- package/dist/index358.js.map +1 -1
- package/dist/index359.js +122 -36
- package/dist/index359.js.map +1 -1
- package/dist/index360.js +38 -64
- package/dist/index360.js.map +1 -1
- package/dist/index361.js +66 -115
- package/dist/index361.js.map +1 -1
- package/dist/index362.js +112 -485
- package/dist/index362.js.map +1 -1
- package/dist/index363.js +490 -13
- package/dist/index363.js.map +1 -1
- package/dist/index364.js +13 -4
- package/dist/index364.js.map +1 -1
- package/dist/index365.js +4 -47
- package/dist/index365.js.map +1 -1
- package/dist/index366.js +44 -15
- package/dist/index366.js.map +1 -1
- package/dist/index367.js +19 -5
- package/dist/index367.js.map +1 -1
- package/dist/index368.js +5 -27
- package/dist/index368.js.map +1 -1
- package/dist/index369.js +27 -48
- package/dist/index369.js.map +1 -1
- package/dist/index370.js +46 -27
- package/dist/index370.js.map +1 -1
- package/dist/index371.js +27 -16
- package/dist/index371.js.map +1 -1
- package/dist/index372.js +16 -41
- package/dist/index372.js.map +1 -1
- package/dist/index373.js +42 -14
- package/dist/index373.js.map +1 -1
- package/dist/index374.js +14 -10
- package/dist/index374.js.map +1 -1
- package/dist/index375.js +9 -51
- package/dist/index375.js.map +1 -1
- package/dist/index376.js +53 -43
- package/dist/index376.js.map +1 -1
- package/dist/index377.js +43 -16
- package/dist/index377.js.map +1 -1
- package/dist/index378.js +15 -4
- package/dist/index378.js.map +1 -1
- package/dist/index379.js +4 -4
- package/dist/index379.js.map +1 -1
- package/dist/index380.js +4 -9
- package/dist/index380.js.map +1 -1
- package/dist/index381.js +9 -340
- package/dist/index381.js.map +1 -1
- package/dist/index382.js +339 -4
- package/dist/index382.js.map +1 -1
- package/dist/index383.js +5 -16
- package/dist/index383.js.map +1 -1
- package/dist/index384.js +16 -111
- package/dist/index384.js.map +1 -1
- package/dist/index385.js +109 -19
- package/dist/index385.js.map +1 -1
- package/dist/index386.js +18 -18
- package/dist/index386.js.map +1 -1
- package/dist/index387.js +21 -5
- package/dist/index387.js.map +1 -1
- package/dist/index388.js +5 -20
- package/dist/index388.js.map +1 -1
- package/dist/index389.js +19 -13
- package/dist/index389.js.map +1 -1
- package/dist/index390.js +13 -84
- package/dist/index390.js.map +1 -1
- package/dist/index391.js +84 -7
- package/dist/index391.js.map +1 -1
- package/dist/index392.js +9 -29
- package/dist/index392.js.map +1 -1
- package/dist/index393.js +28 -9
- package/dist/index393.js.map +1 -1
- package/dist/index394.js +9 -5
- package/dist/index394.js.map +1 -1
- package/dist/index395.js +6 -252
- package/dist/index395.js.map +1 -1
- package/dist/index396.js +250 -10
- package/dist/index396.js.map +1 -1
- package/dist/index397.js +11 -10
- package/dist/index397.js.map +1 -1
- package/dist/index398.js +10 -6
- package/dist/index398.js.map +1 -1
- package/dist/index399.js +6 -22
- package/dist/index399.js.map +1 -1
- package/dist/index400.js +21 -21
- package/dist/index400.js.map +1 -1
- package/dist/index401.js +21 -107
- package/dist/index401.js.map +1 -1
- package/dist/index402.js +109 -15
- package/dist/index402.js.map +1 -1
- package/dist/index403.js +15 -12
- package/dist/index403.js.map +1 -1
- package/dist/index404.js +10 -8
- package/dist/index404.js.map +1 -1
- package/dist/index405.js +8 -242
- package/dist/index405.js.map +1 -1
- package/dist/index406.js +238 -25
- package/dist/index406.js.map +1 -1
- package/dist/index407.js +29 -51
- package/dist/index407.js.map +1 -1
- package/dist/index408.js +51 -10
- package/dist/index408.js.map +1 -1
- package/dist/index409.js +11 -128
- package/dist/index409.js.map +1 -1
- package/dist/index410.js +124 -35
- package/dist/index410.js.map +1 -1
- package/dist/index411.js +36 -23
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +26 -11
- package/dist/index412.js.map +1 -1
- package/dist/index413.js +11 -23
- package/dist/index413.js.map +1 -1
- package/dist/index414.js +19 -13
- package/dist/index414.js.map +1 -1
- package/dist/index415.js +14 -13
- package/dist/index415.js.map +1 -1
- package/dist/index416.js +14 -322
- package/dist/index416.js.map +1 -1
- package/dist/index417.js +323 -61
- package/dist/index417.js.map +1 -1
- package/dist/index418.js +63 -4
- package/dist/index418.js.map +1 -1
- package/dist/index419.js +4 -28
- package/dist/index419.js.map +1 -1
- package/dist/index420.js +25 -468
- package/dist/index420.js.map +1 -1
- package/dist/index421.js +452 -250
- package/dist/index421.js.map +1 -1
- package/dist/index422.js +272 -0
- package/dist/index422.js.map +1 -0
- package/package.json +2 -1
package/dist/index420.js
CHANGED
|
@@ -1,474 +1,31 @@
|
|
|
1
1
|
import { cn as e } from "./index12.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let [t, n, r] = e.split("-"), i = Number(t), a = Number(n), o = Number(r);
|
|
22
|
-
if (!Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o)) return "Unknown date";
|
|
23
|
-
let s = new Date(i, a - 1, o);
|
|
24
|
-
if (!Number.isFinite(s.getTime())) return "Unknown date";
|
|
25
|
-
let c = (/* @__PURE__ */ new Date()).getFullYear() !== i;
|
|
26
|
-
return s.toLocaleDateString(void 0, c ? {
|
|
27
|
-
weekday: "short",
|
|
28
|
-
month: "short",
|
|
29
|
-
day: "numeric",
|
|
30
|
-
year: "numeric"
|
|
31
|
-
} : {
|
|
32
|
-
weekday: "short",
|
|
33
|
-
month: "short",
|
|
34
|
-
day: "numeric"
|
|
35
|
-
});
|
|
36
|
-
}, C = (e) => {
|
|
37
|
-
let t = e.data?.link?.trim();
|
|
38
|
-
if (t) return t;
|
|
39
|
-
let n = e.platform?.webpush;
|
|
40
|
-
if (!n || typeof n != "object" || Array.isArray(n)) return "";
|
|
41
|
-
let r = n.fcmOptions;
|
|
42
|
-
if (!r || typeof r != "object" || Array.isArray(r)) return "";
|
|
43
|
-
let i = r.link;
|
|
44
|
-
return typeof i == "string" ? i.trim() : "";
|
|
45
|
-
}, w = (e) => e.data?.linkMode === "merge_current_search" ? "merge_current_search" : "navigate", T = (e) => {
|
|
46
|
-
let t = C(e);
|
|
47
|
-
return t ? {
|
|
48
|
-
link: t,
|
|
49
|
-
mode: w(e)
|
|
50
|
-
} : null;
|
|
51
|
-
}, E = (e) => e ? e.mode === "merge_current_search" ? "Open" : e.link : "", D = (e) => {
|
|
52
|
-
window.history.pushState(window.history.state, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: window.history.state }));
|
|
53
|
-
}, O = (e) => {
|
|
54
|
-
if (e.mode === "merge_current_search") {
|
|
55
|
-
let t = new URL(window.location.href), n = new URL(e.link, t);
|
|
56
|
-
n.searchParams.forEach((e, n) => {
|
|
57
|
-
t.searchParams.set(n, e);
|
|
58
|
-
}), n.hash && (t.hash = n.hash), D(`${t.pathname}${t.search}${t.hash}`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
window.location.href = e.link;
|
|
62
|
-
}, k = (e) => {
|
|
63
|
-
let t = [], n = null;
|
|
64
|
-
for (let r of e) {
|
|
65
|
-
let e = x(r.createdAt);
|
|
66
|
-
e !== n && (n = e, t.push({
|
|
67
|
-
key: e,
|
|
68
|
-
label: S(e),
|
|
69
|
-
items: []
|
|
70
|
-
})), t[t.length - 1].items.push(r);
|
|
71
|
-
}
|
|
72
|
-
return t;
|
|
73
|
-
}, A = () => typeof window > "u" || !("Notification" in window) ? "unsupported" : window.Notification.permission, j = c(null);
|
|
74
|
-
function M({ open: s, onOpenChange: c, className: p, limit: g = 50, defaultUnreadOnly: b = !1, realtimeContext: x }) {
|
|
75
|
-
let S = u(x ?? j), [C, w] = m([]), [T, E] = m(0), [D, O] = m(0), [M, F] = m(!1), [I, L] = m(null), [R, z] = m(b), [B, V] = m(() => A()), [H, U] = m(!1), W = S?.notifications ?? C, G = S?.unreadCount ?? T, K = S?.unseenCount ?? D, ee = S?.loading ?? M, q = S?.error ? S.error instanceof Error ? S.error.message : String(S.error) : I, J = f(() => W.slice(0, g), [g, W]), Y = f(() => J.filter((e) => !e.readAt), [J]), X = f(() => J.filter((e) => !!e.readAt), [J]), Z = f(() => k(Y), [Y]), te = f(() => k(X), [X]), Q = l(async ({ unreadOnly: e, markSeen: t }) => {
|
|
76
|
-
F(!0), L(null);
|
|
77
|
-
try {
|
|
78
|
-
let n = await fetch("/api/rb/notifications", {
|
|
79
|
-
method: "POST",
|
|
80
|
-
headers: { "Content-Type": "application/json" },
|
|
81
|
-
credentials: "include",
|
|
82
|
-
body: JSON.stringify({
|
|
83
|
-
limit: g,
|
|
84
|
-
unreadOnly: e,
|
|
85
|
-
markSeen: t
|
|
86
|
-
})
|
|
87
|
-
}), r = await n.json().catch(() => null);
|
|
88
|
-
if (!n.ok || !r?.ok) {
|
|
89
|
-
L(r?.error || "Unable to load notifications.");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
let i = Array.isArray(r.notifications) ? r.notifications : [];
|
|
93
|
-
w(i), E(Number.isFinite(r.unreadCount) ? Math.max(0, Math.floor(r.unreadCount ?? 0)) : 0), O(Number.isFinite(r.unseenCount) ? Math.max(0, Math.floor(r.unseenCount ?? 0)) : 0);
|
|
94
|
-
} catch {
|
|
95
|
-
L("Unable to load notifications.");
|
|
96
|
-
} finally {
|
|
97
|
-
F(!1);
|
|
98
|
-
}
|
|
99
|
-
}, [g]);
|
|
100
|
-
d(() => {
|
|
101
|
-
if (s) {
|
|
102
|
-
if (S) {
|
|
103
|
-
(async () => {
|
|
104
|
-
try {
|
|
105
|
-
await fetch("/api/rb/notifications", {
|
|
106
|
-
method: "POST",
|
|
107
|
-
headers: { "Content-Type": "application/json" },
|
|
108
|
-
credentials: "include",
|
|
109
|
-
keepalive: !0,
|
|
110
|
-
body: JSON.stringify({
|
|
111
|
-
limit: 1,
|
|
112
|
-
markSeen: !0
|
|
113
|
-
})
|
|
114
|
-
});
|
|
115
|
-
} catch {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
})();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
Q({
|
|
122
|
-
unreadOnly: R,
|
|
123
|
-
markSeen: !0
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}, [
|
|
127
|
-
s,
|
|
128
|
-
S,
|
|
129
|
-
Q,
|
|
130
|
-
R
|
|
131
|
-
]), d(() => {
|
|
132
|
-
s && (S || Q({
|
|
133
|
-
unreadOnly: R,
|
|
134
|
-
markSeen: !1
|
|
135
|
-
}));
|
|
136
|
-
}, [
|
|
137
|
-
s,
|
|
138
|
-
S,
|
|
139
|
-
Q,
|
|
140
|
-
R
|
|
141
|
-
]), d(() => {
|
|
142
|
-
if (!s || (V(A()), typeof navigator > "u" || !navigator.permissions?.query)) return;
|
|
143
|
-
let e = null, t = !1, n = () => {
|
|
144
|
-
V(A());
|
|
145
|
-
};
|
|
146
|
-
try {
|
|
147
|
-
navigator.permissions.query({ name: "notifications" }).then((r) => {
|
|
148
|
-
t || (e = r, n(), r.addEventListener("change", n));
|
|
149
|
-
}).catch(() => {});
|
|
150
|
-
} catch {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
return () => {
|
|
154
|
-
t = !0, e?.removeEventListener("change", n);
|
|
155
|
-
};
|
|
156
|
-
}, [s]);
|
|
157
|
-
let ne = async () => {
|
|
158
|
-
if (typeof window > "u" || !("Notification" in window)) {
|
|
159
|
-
V("unsupported");
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
U(!0);
|
|
163
|
-
try {
|
|
164
|
-
let e = await window.Notification.requestPermission();
|
|
165
|
-
V(e);
|
|
166
|
-
} catch {
|
|
167
|
-
V(A());
|
|
168
|
-
} finally {
|
|
169
|
-
U(!1);
|
|
170
|
-
}
|
|
171
|
-
}, re = async (e) => {
|
|
172
|
-
try {
|
|
173
|
-
let t = await fetch(`/api/rb/notifications/${encodeURIComponent(e)}/read`, {
|
|
174
|
-
method: "POST",
|
|
175
|
-
headers: { "Content-Type": "application/json" },
|
|
176
|
-
credentials: "include",
|
|
177
|
-
keepalive: !0,
|
|
178
|
-
body: "{}"
|
|
179
|
-
}), n = await t.json().catch(() => null);
|
|
180
|
-
if (!t.ok || !n?.ok) return;
|
|
181
|
-
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
182
|
-
if (S) return;
|
|
183
|
-
w((t) => {
|
|
184
|
-
let n = t.find((t) => t.id === e);
|
|
185
|
-
return n && !n.readAt && E((e) => Math.max(0, e - 1)), n && !n.seenAt && O((e) => Math.max(0, e - 1)), t.map((t) => t.id === e && !t.readAt ? {
|
|
186
|
-
...t,
|
|
187
|
-
readAt: r,
|
|
188
|
-
...t.seenAt ? {} : { seenAt: r }
|
|
189
|
-
} : t);
|
|
190
|
-
});
|
|
191
|
-
} catch {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
}, ie = async (e) => {
|
|
195
|
-
try {
|
|
196
|
-
let t = await fetch(`/api/rb/notifications/${encodeURIComponent(e)}/archive`, {
|
|
197
|
-
method: "POST",
|
|
198
|
-
headers: { "Content-Type": "application/json" },
|
|
199
|
-
credentials: "include",
|
|
200
|
-
body: "{}"
|
|
201
|
-
}), n = await t.json().catch(() => null);
|
|
202
|
-
if (!t.ok || !n?.ok || S) return;
|
|
203
|
-
w((t) => {
|
|
204
|
-
let n = t.find((t) => t.id === e);
|
|
205
|
-
return n && !n.readAt && E((e) => Math.max(0, e - 1)), n && !n.seenAt && O((e) => Math.max(0, e - 1)), t.filter((t) => t.id !== e);
|
|
206
|
-
});
|
|
207
|
-
} catch {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
}, $ = () => {
|
|
211
|
-
c(!1);
|
|
212
|
-
};
|
|
213
|
-
return /* @__PURE__ */ v(a, {
|
|
214
|
-
open: s,
|
|
215
|
-
onOpenChange: (e) => {
|
|
216
|
-
if (e) {
|
|
217
|
-
c(!0);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
$();
|
|
221
|
-
},
|
|
222
|
-
children: /* @__PURE__ */ y(i, { children: [/* @__PURE__ */ v(t, {
|
|
223
|
-
className: "fixed inset-0 z-50 bg-black/50",
|
|
224
|
-
onClick: $
|
|
225
|
-
}), /* @__PURE__ */ y(r, {
|
|
226
|
-
className: e("fixed right-0 top-0 z-50 flex h-full w-full max-w-md flex-col border-l bg-background shadow-xl outline-none", p),
|
|
227
|
-
children: [/* @__PURE__ */ y("header", {
|
|
228
|
-
className: "flex items-center justify-between gap-2 border-b px-4 py-3",
|
|
229
|
-
children: [/* @__PURE__ */ y("div", {
|
|
230
|
-
className: "flex min-w-0 flex-col",
|
|
231
|
-
children: [/* @__PURE__ */ v(o, {
|
|
232
|
-
className: "text-sm font-semibold",
|
|
233
|
-
children: "Notifications"
|
|
234
|
-
}), /* @__PURE__ */ v("span", {
|
|
235
|
-
className: "text-xs text-muted-foreground",
|
|
236
|
-
children: G > 0 ? `${G} unread` : K > 0 ? `${K} new` : "All caught up"
|
|
237
|
-
})]
|
|
238
|
-
}), /* @__PURE__ */ y("div", {
|
|
239
|
-
className: "flex items-center gap-2",
|
|
240
|
-
children: [/* @__PURE__ */ v("button", {
|
|
241
|
-
type: "button",
|
|
242
|
-
onClick: () => z((e) => !e),
|
|
243
|
-
className: e("rounded-md border px-2 py-1 text-xs", R ? "bg-accent text-foreground" : "bg-background text-muted-foreground hover:bg-accent"),
|
|
244
|
-
children: R ? "Unread" : "All"
|
|
245
|
-
}), /* @__PURE__ */ v(n, {
|
|
246
|
-
type: "button",
|
|
247
|
-
"aria-label": "Close notifications",
|
|
248
|
-
className: "inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent",
|
|
249
|
-
onClick: $,
|
|
250
|
-
children: /* @__PURE__ */ v(_, { className: "h-4 w-4" })
|
|
251
|
-
})]
|
|
252
|
-
})]
|
|
253
|
-
}), /* @__PURE__ */ y("div", {
|
|
254
|
-
className: "flex-1 overflow-y-auto px-4 pb-3",
|
|
255
|
-
children: [/* @__PURE__ */ v(N, {
|
|
256
|
-
permission: B,
|
|
257
|
-
requesting: H,
|
|
258
|
-
onEnable: ne
|
|
259
|
-
}), ee ? /* @__PURE__ */ v("div", {
|
|
260
|
-
className: "flex items-center justify-center py-10 text-muted-foreground",
|
|
261
|
-
children: /* @__PURE__ */ v(h, { className: "h-4 w-4 animate-spin" })
|
|
262
|
-
}) : q ? /* @__PURE__ */ v("div", {
|
|
263
|
-
className: "py-10 text-center text-sm text-muted-foreground",
|
|
264
|
-
children: q
|
|
265
|
-
}) : J.length === 0 ? /* @__PURE__ */ v("div", {
|
|
266
|
-
className: "py-10 text-center text-sm text-muted-foreground",
|
|
267
|
-
children: "No notifications."
|
|
268
|
-
}) : /* @__PURE__ */ y("div", {
|
|
269
|
-
className: "flex flex-col gap-4",
|
|
270
|
-
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", {
|
|
271
|
-
className: "sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground",
|
|
272
|
-
children: "Unread notifications"
|
|
273
|
-
}), Z.length === 0 ? /* @__PURE__ */ v("div", {
|
|
274
|
-
className: "py-6 text-center text-sm text-muted-foreground",
|
|
275
|
-
children: "No unread notifications."
|
|
276
|
-
}) : Z.map((e) => /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", {
|
|
277
|
-
className: "sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground",
|
|
278
|
-
children: e.label
|
|
279
|
-
}), /* @__PURE__ */ v("div", {
|
|
280
|
-
className: "-mx-4 flex flex-col divide-y divide-border",
|
|
281
|
-
children: e.items.map((e) => /* @__PURE__ */ v(P, {
|
|
282
|
-
notification: e,
|
|
283
|
-
onMarkRead: re,
|
|
284
|
-
onArchive: ie,
|
|
285
|
-
onAction: $
|
|
286
|
-
}, e.id))
|
|
287
|
-
})] }, `unread:${e.key}`))] }), R ? null : /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", {
|
|
288
|
-
className: "sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground",
|
|
289
|
-
children: "Previous notifications"
|
|
290
|
-
}), te.length === 0 ? /* @__PURE__ */ v("div", {
|
|
291
|
-
className: "py-6 text-center text-sm text-muted-foreground",
|
|
292
|
-
children: "No previous notifications."
|
|
293
|
-
}) : te.map((e) => /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", {
|
|
294
|
-
className: "sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground",
|
|
295
|
-
children: e.label
|
|
296
|
-
}), /* @__PURE__ */ v("div", {
|
|
297
|
-
className: "-mx-4 flex flex-col divide-y divide-border",
|
|
298
|
-
children: e.items.map((e) => /* @__PURE__ */ v(P, {
|
|
299
|
-
notification: e,
|
|
300
|
-
onMarkRead: re,
|
|
301
|
-
onArchive: ie,
|
|
302
|
-
onAction: $
|
|
303
|
-
}, e.id))
|
|
304
|
-
})] }, `previous:${e.key}`))] })]
|
|
305
|
-
})]
|
|
306
|
-
})]
|
|
307
|
-
})] })
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
function N(e) {
|
|
311
|
-
let t = s(13), { permission: n, requesting: r, onEnable: i } = e;
|
|
312
|
-
if (n === "granted") return null;
|
|
313
|
-
if (n === "unsupported") {
|
|
314
|
-
let e;
|
|
315
|
-
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ v("div", {
|
|
316
|
-
className: "mt-3 rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground",
|
|
317
|
-
children: "Browser notifications are not supported by this browser."
|
|
318
|
-
}), t[0] = e) : e = t[0], e;
|
|
319
|
-
}
|
|
320
|
-
let a = n === "denied", o = a ? "Browser notifications are blocked." : "Browser notifications are not enabled.", c;
|
|
321
|
-
t[1] === o ? c = t[2] : (c = /* @__PURE__ */ v("div", {
|
|
322
|
-
className: "text-sm font-medium",
|
|
323
|
-
children: o
|
|
324
|
-
}), t[1] = o, t[2] = c);
|
|
325
|
-
let l = a ? "Enable notifications for this site in your browser settings, then click again." : "Enable browser notifications to receive important alerts.", u;
|
|
326
|
-
t[3] === l ? u = t[4] : (u = /* @__PURE__ */ v("div", {
|
|
327
|
-
className: "mt-1 text-xs text-muted-foreground",
|
|
328
|
-
children: l
|
|
329
|
-
}), t[3] = l, t[4] = u);
|
|
330
|
-
let d = r ? "Enabling..." : "Enable browser notifications", f;
|
|
331
|
-
t[5] !== i || t[6] !== r || t[7] !== d ? (f = /* @__PURE__ */ v("button", {
|
|
332
|
-
type: "button",
|
|
333
|
-
className: "mt-3 inline-flex h-8 items-center rounded-md border bg-background px-2.5 text-xs font-medium hover:bg-accent disabled:pointer-events-none disabled:opacity-50",
|
|
334
|
-
disabled: r,
|
|
335
|
-
onClick: i,
|
|
336
|
-
children: d
|
|
337
|
-
}), t[5] = i, t[6] = r, t[7] = d, t[8] = f) : f = t[8];
|
|
338
|
-
let p;
|
|
339
|
-
return t[9] !== c || t[10] !== u || t[11] !== f ? (p = /* @__PURE__ */ y("div", {
|
|
340
|
-
className: "mt-3 rounded-md border bg-muted/40 p-3",
|
|
341
|
-
children: [
|
|
342
|
-
c,
|
|
343
|
-
u,
|
|
344
|
-
f
|
|
345
|
-
]
|
|
346
|
-
}), t[9] = c, t[10] = u, t[11] = f, t[12] = p) : p = t[12], p;
|
|
347
|
-
}
|
|
348
|
-
function P(t) {
|
|
349
|
-
let n = s(49), { notification: r, onMarkRead: i, onArchive: a, onAction: o } = t, [c, l] = m(!1), u = p(null), f = p(null), h = !r.readAt, _, x;
|
|
350
|
-
n[0] === r ? (_ = n[1], x = n[2]) : (_ = T(r), x = E(_), n[0] = r, n[1] = _, n[2] = x);
|
|
351
|
-
let S = x, C;
|
|
352
|
-
if (n[3] !== r.createdAt) {
|
|
353
|
-
bb0: {
|
|
354
|
-
let e = new Date(b(r.createdAt));
|
|
355
|
-
if (!Number.isFinite(e.getTime())) {
|
|
356
|
-
C = "";
|
|
357
|
-
break bb0;
|
|
358
|
-
}
|
|
359
|
-
C = e.toLocaleString();
|
|
360
|
-
}
|
|
361
|
-
n[3] = r.createdAt, n[4] = C;
|
|
362
|
-
} else C = n[4];
|
|
363
|
-
let w = C, D, k;
|
|
364
|
-
n[5] === c ? (D = n[6], k = n[7]) : (D = () => {
|
|
365
|
-
if (!c) return;
|
|
366
|
-
let e = (e) => {
|
|
367
|
-
let t = e.target;
|
|
368
|
-
t instanceof Node && (u.current?.contains(t) || f.current?.contains(t) || l(!1));
|
|
369
|
-
}, t = (e) => {
|
|
370
|
-
e.key === "Escape" && (l(!1), f.current?.focus());
|
|
371
|
-
};
|
|
372
|
-
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
373
|
-
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
374
|
-
};
|
|
375
|
-
}, k = [c], n[5] = c, n[6] = D, n[7] = k), d(D, k);
|
|
376
|
-
let A = h ? "bg-primary/5" : "bg-background", j;
|
|
377
|
-
n[8] === A ? j = n[9] : (j = e("group flex w-full gap-3 px-4 py-3 hover:bg-accent/40", A), n[8] = A, n[9] = j);
|
|
378
|
-
let M;
|
|
379
|
-
n[10] !== _ || n[11] !== h || n[12] !== r.id || n[13] !== o || n[14] !== i ? (M = () => {
|
|
380
|
-
h && i(r.id), _ && (o(), O(_));
|
|
381
|
-
}, n[10] = _, n[11] = h, n[12] = r.id, n[13] = o, n[14] = i, n[15] = M) : M = n[15];
|
|
382
|
-
let N;
|
|
383
|
-
n[16] === r.title ? N = n[17] : (N = /* @__PURE__ */ v("div", {
|
|
384
|
-
className: "truncate text-sm font-semibold",
|
|
385
|
-
children: r.title
|
|
386
|
-
}), n[16] = r.title, n[17] = N);
|
|
387
|
-
let P;
|
|
388
|
-
n[18] === r.body ? P = n[19] : (P = r.body ? /* @__PURE__ */ v("div", {
|
|
389
|
-
className: "mt-0.5 line-clamp-2 text-xs text-muted-foreground",
|
|
390
|
-
children: r.body
|
|
391
|
-
}) : null, n[18] = r.body, n[19] = P);
|
|
392
|
-
let I;
|
|
393
|
-
n[20] !== N || n[21] !== P ? (I = /* @__PURE__ */ y("div", {
|
|
394
|
-
className: "min-w-0",
|
|
395
|
-
children: [N, P]
|
|
396
|
-
}), n[20] = N, n[21] = P, n[22] = I) : I = n[22];
|
|
397
|
-
let L;
|
|
398
|
-
n[23] === S ? L = n[24] : (L = S ? /* @__PURE__ */ v("div", {
|
|
399
|
-
className: "mt-2 truncate text-xs text-primary",
|
|
400
|
-
children: S
|
|
401
|
-
}) : null, n[23] = S, n[24] = L);
|
|
402
|
-
let R;
|
|
403
|
-
n[25] === w ? R = n[26] : (R = w ? /* @__PURE__ */ v("div", {
|
|
404
|
-
className: "mt-2 text-[11px] text-muted-foreground",
|
|
405
|
-
children: w
|
|
406
|
-
}) : null, n[25] = w, n[26] = R);
|
|
407
|
-
let z;
|
|
408
|
-
n[27] !== I || n[28] !== L || n[29] !== R || n[30] !== M ? (z = /* @__PURE__ */ y("button", {
|
|
2
|
+
import { c as t } from "react/compiler-runtime";
|
|
3
|
+
import { Bell as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Notifications/NotificationsButton.tsx
|
|
6
|
+
function a(a) {
|
|
7
|
+
let o = t(12), { unseenCount: s, unreadCount: c, onClick: l, className: u } = a, d = Number.isFinite(s) ? s : c, f;
|
|
8
|
+
o[0] === d ? f = o[1] : (f = Number.isFinite(d) ? Math.max(0, Math.floor(d ?? 0)) : 0, o[0] = d, o[1] = f);
|
|
9
|
+
let p = f, m;
|
|
10
|
+
o[2] === u ? m = o[3] : (m = e("relative inline-flex h-9 w-9 items-center justify-center rounded-md border bg-background text-foreground hover:bg-accent", u), o[2] = u, o[3] = m);
|
|
11
|
+
let h = p > 0 ? `Notifications (${p} new)` : "Notifications", g;
|
|
12
|
+
o[4] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ r(n, { className: "h-4 w-4" }), o[4] = g) : g = o[4];
|
|
13
|
+
let _;
|
|
14
|
+
o[5] === p ? _ = o[6] : (_ = p > 0 ? /* @__PURE__ */ r("span", {
|
|
15
|
+
className: "absolute -right-1 -top-1 inline-flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-4 text-primary-foreground",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: p > 99 ? "99+" : String(p)
|
|
18
|
+
}) : null, o[5] = p, o[6] = _);
|
|
19
|
+
let v;
|
|
20
|
+
return o[7] !== l || o[8] !== m || o[9] !== h || o[10] !== _ ? (v = /* @__PURE__ */ i("button", {
|
|
409
21
|
type: "button",
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
R
|
|
416
|
-
]
|
|
417
|
-
}), n[27] = I, n[28] = L, n[29] = R, n[30] = M, n[31] = z) : z = n[31];
|
|
418
|
-
let B, V;
|
|
419
|
-
n[32] === Symbol.for("react.memo_cache_sentinel") ? (B = () => {
|
|
420
|
-
l(F);
|
|
421
|
-
}, V = /* @__PURE__ */ v(g, { className: "h-4 w-4" }), n[32] = B, n[33] = V) : (B = n[32], V = n[33]);
|
|
422
|
-
let H;
|
|
423
|
-
n[34] === c ? H = n[35] : (H = /* @__PURE__ */ v("button", {
|
|
424
|
-
ref: f,
|
|
425
|
-
type: "button",
|
|
426
|
-
className: "inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent",
|
|
427
|
-
"aria-label": "Notification options",
|
|
428
|
-
"aria-haspopup": "menu",
|
|
429
|
-
"aria-expanded": c,
|
|
430
|
-
onClick: B,
|
|
431
|
-
children: V
|
|
432
|
-
}), n[34] = c, n[35] = H);
|
|
433
|
-
let U;
|
|
434
|
-
n[36] !== h || n[37] !== c || n[38] !== r.id || n[39] !== a || n[40] !== i ? (U = c ? /* @__PURE__ */ y("div", {
|
|
435
|
-
ref: u,
|
|
436
|
-
role: "menu",
|
|
437
|
-
className: e("absolute right-0 top-full z-50 mt-1 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "animate-in fade-in-0 zoom-in-95"),
|
|
438
|
-
children: [/* @__PURE__ */ v("button", {
|
|
439
|
-
type: "button",
|
|
440
|
-
role: "menuitem",
|
|
441
|
-
className: "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus:bg-accent focus:text-accent-foreground",
|
|
442
|
-
onClick: () => {
|
|
443
|
-
l(!1), a(r.id);
|
|
444
|
-
},
|
|
445
|
-
children: "Archive"
|
|
446
|
-
}), /* @__PURE__ */ v("button", {
|
|
447
|
-
type: "button",
|
|
448
|
-
role: "menuitem",
|
|
449
|
-
className: "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
|
|
450
|
-
disabled: !h,
|
|
451
|
-
onClick: () => {
|
|
452
|
-
l(!1), i(r.id);
|
|
453
|
-
},
|
|
454
|
-
children: "Mark as read"
|
|
455
|
-
})]
|
|
456
|
-
}) : null, n[36] = h, n[37] = c, n[38] = r.id, n[39] = a, n[40] = i, n[41] = U) : U = n[41];
|
|
457
|
-
let W;
|
|
458
|
-
n[42] !== H || n[43] !== U ? (W = /* @__PURE__ */ y("div", {
|
|
459
|
-
className: "relative flex items-start",
|
|
460
|
-
children: [H, U]
|
|
461
|
-
}), n[42] = H, n[43] = U, n[44] = W) : W = n[44];
|
|
462
|
-
let G;
|
|
463
|
-
return n[45] !== z || n[46] !== W || n[47] !== j ? (G = /* @__PURE__ */ y("div", {
|
|
464
|
-
className: j,
|
|
465
|
-
children: [z, W]
|
|
466
|
-
}), n[45] = z, n[46] = W, n[47] = j, n[48] = G) : G = n[48], G;
|
|
467
|
-
}
|
|
468
|
-
function F(e) {
|
|
469
|
-
return !e;
|
|
22
|
+
onClick: l,
|
|
23
|
+
className: m,
|
|
24
|
+
"aria-label": h,
|
|
25
|
+
children: [g, _]
|
|
26
|
+
}), o[7] = l, o[8] = m, o[9] = h, o[10] = _, o[11] = v) : v = o[11], v;
|
|
470
27
|
}
|
|
471
28
|
//#endregion
|
|
472
|
-
export {
|
|
29
|
+
export { a as NotificationsButton };
|
|
473
30
|
|
|
474
31
|
//# sourceMappingURL=index420.js.map
|
package/dist/index420.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index420.js","names":["createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","Context","Dialog","DialogPrimitive","Loader2","MoreVertical","X","cn","NotificationItem","NotificationsRealtimeState","ListResponse","ok","error","notifications","unreadCount","unseenCount","DayGroup","key","label","items","BrowserNotificationPermission","NotificationPermission","NotificationActionMode","NotificationAction","link","mode","toMs","iso","ms","Date","parse","Number","isFinite","getDayKey","date","getTime","year","getFullYear","month","String","getMonth","padStart","day","getDate","formatDayLabel","yearRaw","monthRaw","dayRaw","split","now","includeYear","toLocaleDateString","undefined","weekday","getNotificationLink","item","dataLink","data","trim","platformWebpush","platform","webpush","Array","isArray","fcmOptions","getNotificationActionMode","linkMode","getNotificationAction","getNotificationActionLabel","action","pushUrlWithoutReload","url","window","history","pushState","state","dispatchEvent","PopStateEvent","applyNotificationAction","currentUrl","URL","location","href","actionUrl","searchParams","forEach","value","set","hash","pathname","search","groupByDay","groups","currentKey","createdAt","push","length","getBrowserNotificationPermission","Notification","permission","EmptyRealtimeContext","NotificationsDrawer","open","onOpenChange","className","limit","defaultUnreadOnly","realtimeContext","realtime","setItems","setUnreadCount","setUnseenCount","loading","setLoading","setError","unreadOnly","setUnreadOnly","browserNotificationPermission","setBrowserNotificationPermission","browserNotificationPermissionRequesting","setBrowserNotificationPermissionRequesting","mergedItems","mergedUnreadCount","mergedUnseenCount","mergedLoading","mergedError","Error","message","visibleItems","slice","unread","filter","n","readAt","read","Boolean","unreadGroups","readGroups","refresh","markSeen","res","fetch","method","headers","credentials","body","JSON","stringify","json","catch","nextItems","Math","max","floor","keepalive","navigator","permissions","query","permissionStatus","PermissionStatus","disposed","syncPermission","name","PermissionName","then","status","addEventListener","removeEventListener","requestBrowserNotificationPermission","nextPermission","requestPermission","markAsRead","id","encodeURIComponent","nowIso","toISOString","current","target","find","count","seenAt","map","archive","requestClose","handleOpenChange","nextOpen","v","group","BrowserNotificationPermissionNotice","t0","$","_c","requesting","onEnable","t1","Symbol","for","isDenied","t2","t3","t4","t5","t6","t7","NotificationRow","notification","onMarkRead","onArchive","onAction","menuOpen","setMenuOpen","menuRef","menuButtonRef","isUnread","actionLabel","bb0","toLocaleString","createdAtLabel","handlePointerDown","event","Node","contains","handleKeyDown","event_0","focus","document","t8","title","t9","t10","t11","t12","t13","t14","t15","_temp","t16","t17","t18","t19"],"sources":["../src/components/Notifications/NotificationsDrawer.tsx"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type Context } from \"react\"\nimport { Dialog as DialogPrimitive } from \"@base-ui/react/dialog\"\nimport { Loader2, MoreVertical, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { NotificationItem, NotificationsRealtimeState } from \"./types\"\n\n\ntype ListResponse = {\n ok?: boolean\n error?: string\n notifications?: NotificationItem[]\n unreadCount?: number\n unseenCount?: number\n}\n\ntype DayGroup = {\n key: string\n label: string\n items: NotificationItem[]\n}\n\ntype BrowserNotificationPermission = NotificationPermission | \"unsupported\"\ntype NotificationActionMode = \"navigate\" | \"merge_current_search\"\n\ntype NotificationAction = {\n link: string\n mode: NotificationActionMode\n}\n\nconst toMs = (iso: string): number => {\n const ms = Date.parse(iso)\n return Number.isFinite(ms) ? ms : 0\n}\n\nconst getDayKey = (iso: string): string => {\n const date = new Date(toMs(iso))\n if (!Number.isFinite(date.getTime())) return \"unknown\"\n\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, \"0\")\n const day = String(date.getDate()).padStart(2, \"0\")\n\n return `${year}-${month}-${day}`\n}\n\nconst formatDayLabel = (key: string): string => {\n if (key === \"unknown\") return \"Unknown date\"\n const [yearRaw, monthRaw, dayRaw] = key.split(\"-\")\n const year = Number(yearRaw)\n const month = Number(monthRaw)\n const day = Number(dayRaw)\n\n if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)) return \"Unknown date\"\n\n const date = new Date(year, month - 1, day)\n if (!Number.isFinite(date.getTime())) return \"Unknown date\"\n\n const now = new Date()\n const includeYear = now.getFullYear() !== year\n return date.toLocaleDateString(undefined, includeYear\n ? { weekday: \"short\", month: \"short\", day: \"numeric\", year: \"numeric\" }\n : { weekday: \"short\", month: \"short\", day: \"numeric\" })\n}\n\nconst getNotificationLink = (item: NotificationItem): string => {\n const dataLink = item.data?.link?.trim()\n if (dataLink) return dataLink\n\n const platformWebpush = item.platform?.webpush\n if (!platformWebpush || typeof platformWebpush !== \"object\" || Array.isArray(platformWebpush)) return \"\"\n const fcmOptions = (platformWebpush as { fcmOptions?: unknown }).fcmOptions\n if (!fcmOptions || typeof fcmOptions !== \"object\" || Array.isArray(fcmOptions)) return \"\"\n const link = (fcmOptions as { link?: unknown }).link\n return typeof link === \"string\" ? link.trim() : \"\"\n}\n\nconst getNotificationActionMode = (item: NotificationItem): NotificationActionMode => {\n return item.data?.linkMode === \"merge_current_search\" ? \"merge_current_search\" : \"navigate\"\n}\n\nconst getNotificationAction = (item: NotificationItem): NotificationAction | null => {\n const link = getNotificationLink(item)\n if (!link) return null\n return {\n link,\n mode: getNotificationActionMode(item),\n }\n}\n\nconst getNotificationActionLabel = (action: NotificationAction | null): string => {\n if (!action) return \"\"\n return action.mode === \"merge_current_search\" ? \"Open\" : action.link\n}\n\nconst pushUrlWithoutReload = (url: string): void => {\n window.history.pushState(window.history.state, \"\", url)\n window.dispatchEvent(new PopStateEvent(\"popstate\", { state: window.history.state }))\n}\n\nconst applyNotificationAction = (action: NotificationAction): void => {\n if (action.mode === \"merge_current_search\") {\n const currentUrl = new URL(window.location.href)\n const actionUrl = new URL(action.link, currentUrl)\n\n actionUrl.searchParams.forEach((value, key) => {\n currentUrl.searchParams.set(key, value)\n })\n if (actionUrl.hash) {\n currentUrl.hash = actionUrl.hash\n }\n\n pushUrlWithoutReload(`${currentUrl.pathname}${currentUrl.search}${currentUrl.hash}`)\n return\n }\n\n window.location.href = action.link\n}\n\nconst groupByDay = (items: NotificationItem[]): DayGroup[] => {\n const groups: DayGroup[] = []\n let currentKey: string | null = null\n\n for (const item of items) {\n const key = getDayKey(item.createdAt)\n if (key !== currentKey) {\n currentKey = key\n groups.push({ key, label: formatDayLabel(key), items: [] })\n }\n groups[groups.length - 1]!.items.push(item)\n }\n\n return groups\n}\n\nconst getBrowserNotificationPermission = (): BrowserNotificationPermission => {\n if (typeof window === \"undefined\") return \"unsupported\"\n if (!(\"Notification\" in window)) return \"unsupported\"\n return window.Notification.permission\n}\n\nconst EmptyRealtimeContext = createContext<NotificationsRealtimeState | null>(null)\n\nexport function NotificationsDrawer({\n open,\n onOpenChange,\n className,\n limit = 50,\n defaultUnreadOnly = false,\n realtimeContext,\n}: {\n open: boolean\n onOpenChange: (open: boolean) => void\n className?: string\n limit?: number\n defaultUnreadOnly?: boolean\n realtimeContext?: Context<NotificationsRealtimeState | null>\n}) {\n const realtime = useContext(realtimeContext ?? EmptyRealtimeContext)\n\n const [items, setItems] = useState<NotificationItem[]>([])\n const [unreadCount, setUnreadCount] = useState<number>(0)\n const [unseenCount, setUnseenCount] = useState<number>(0)\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [unreadOnly, setUnreadOnly] = useState<boolean>(defaultUnreadOnly)\n const [browserNotificationPermission, setBrowserNotificationPermission] = useState<BrowserNotificationPermission>(() =>\n getBrowserNotificationPermission(),\n )\n const [browserNotificationPermissionRequesting, setBrowserNotificationPermissionRequesting] = useState(false)\n\n const mergedItems = realtime?.notifications ?? items\n const mergedUnreadCount = realtime?.unreadCount ?? unreadCount\n const mergedUnseenCount = realtime?.unseenCount ?? unseenCount\n const mergedLoading = realtime?.loading ?? loading\n const mergedError = realtime?.error\n ? (realtime.error instanceof Error ? realtime.error.message : String(realtime.error))\n : error\n\n const visibleItems = useMemo(() => mergedItems.slice(0, limit), [limit, mergedItems])\n\n const unread = useMemo(() => visibleItems.filter((n) => !n.readAt), [visibleItems])\n const read = useMemo(() => visibleItems.filter((n) => Boolean(n.readAt)), [visibleItems])\n const unreadGroups = useMemo(() => groupByDay(unread), [unread])\n const readGroups = useMemo(() => groupByDay(read), [read])\n\n const refresh = useCallback(async ({ unreadOnly, markSeen }: { unreadOnly: boolean; markSeen: boolean }) => {\n setLoading(true)\n setError(null)\n\n try {\n const res = await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: JSON.stringify({ limit, unreadOnly, markSeen }),\n })\n\n const json = (await res.json().catch(() => null)) as ListResponse | null\n if (!res.ok || !json?.ok) {\n setError(json?.error || \"Unable to load notifications.\")\n return\n }\n\n const nextItems = Array.isArray(json.notifications) ? json.notifications : []\n setItems(nextItems)\n setUnreadCount(Number.isFinite(json.unreadCount) ? Math.max(0, Math.floor(json.unreadCount ?? 0)) : 0)\n setUnseenCount(Number.isFinite(json.unseenCount) ? Math.max(0, Math.floor(json.unseenCount ?? 0)) : 0)\n } catch {\n setError(\"Unable to load notifications.\")\n } finally {\n setLoading(false)\n }\n }, [limit])\n\n useEffect(() => {\n if (!open) return\n if (realtime) {\n void (async () => {\n try {\n await fetch(\"/api/rb/notifications\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: JSON.stringify({ limit: 1, markSeen: true }),\n })\n } catch {\n return\n }\n })()\n return\n }\n void refresh({ unreadOnly, markSeen: true })\n }, [open, realtime, refresh, unreadOnly])\n\n useEffect(() => {\n if (!open) return\n if (realtime) return\n void refresh({ unreadOnly, markSeen: false })\n }, [open, realtime, refresh, unreadOnly])\n\n useEffect(() => {\n if (!open) return\n\n setBrowserNotificationPermission(getBrowserNotificationPermission())\n\n if (typeof navigator === \"undefined\" || !navigator.permissions?.query) return\n\n let permissionStatus: PermissionStatus | null = null\n let disposed = false\n const syncPermission = () => {\n setBrowserNotificationPermission(getBrowserNotificationPermission())\n }\n\n try {\n void navigator.permissions.query({ name: \"notifications\" as PermissionName }).then((status) => {\n if (disposed) return\n permissionStatus = status\n syncPermission()\n status.addEventListener(\"change\", syncPermission)\n }).catch(() => {\n // Notifications are not exposed through the Permissions API in every browser.\n })\n } catch {\n return\n }\n\n return () => {\n disposed = true\n permissionStatus?.removeEventListener(\"change\", syncPermission)\n }\n }, [open])\n\n const requestBrowserNotificationPermission = async () => {\n if (typeof window === \"undefined\" || !(\"Notification\" in window)) {\n setBrowserNotificationPermission(\"unsupported\")\n return\n }\n\n setBrowserNotificationPermissionRequesting(true)\n try {\n const nextPermission = await window.Notification.requestPermission()\n setBrowserNotificationPermission(nextPermission)\n } catch {\n setBrowserNotificationPermission(getBrowserNotificationPermission())\n } finally {\n setBrowserNotificationPermissionRequesting(false)\n }\n }\n\n const markAsRead = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/read`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n keepalive: true,\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n const nowIso = new Date().toISOString()\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.map((n) => (n.id === id && !n.readAt ? { ...n, readAt: nowIso, ...(n.seenAt ? {} : { seenAt: nowIso }) } : n))\n })\n } catch {\n return\n }\n }\n\n const archive = async (id: string) => {\n try {\n const res = await fetch(`/api/rb/notifications/${encodeURIComponent(id)}/archive`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n credentials: \"include\",\n body: \"{}\",\n })\n\n const json = (await res.json().catch(() => null)) as { ok?: boolean } | null\n if (!res.ok || !json?.ok) return\n\n if (realtime) return\n setItems((current) => {\n const target = current.find((n) => n.id === id)\n if (target && !target.readAt) {\n setUnreadCount((count) => Math.max(0, count - 1))\n }\n if (target && !target.seenAt) {\n setUnseenCount((count) => Math.max(0, count - 1))\n }\n return current.filter((n) => n.id !== id)\n })\n } catch {\n return\n }\n }\n\n const requestClose = () => {\n onOpenChange(false)\n }\n\n const handleOpenChange = (nextOpen: boolean) => {\n if (nextOpen) {\n onOpenChange(true)\n return\n }\n\n requestClose()\n }\n\n return (\n <DialogPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Backdrop className=\"fixed inset-0 z-50 bg-black/50\" onClick={requestClose} />\n <DialogPrimitive.Popup\n className={cn(\n \"fixed right-0 top-0 z-50 flex h-full w-full max-w-md flex-col border-l bg-background shadow-xl outline-none\",\n className,\n )}\n >\n <header className=\"flex items-center justify-between gap-2 border-b px-4 py-3\">\n <div className=\"flex min-w-0 flex-col\">\n <DialogPrimitive.Title className=\"text-sm font-semibold\">Notifications</DialogPrimitive.Title>\n <span className=\"text-xs text-muted-foreground\">\n {mergedUnreadCount > 0 ? `${mergedUnreadCount} unread` : mergedUnseenCount > 0 ? `${mergedUnseenCount} new` : \"All caught up\"}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setUnreadOnly((v) => !v)}\n className={cn(\n \"rounded-md border px-2 py-1 text-xs\",\n unreadOnly ? \"bg-accent text-foreground\" : \"bg-background text-muted-foreground hover:bg-accent\",\n )}\n >\n {unreadOnly ? \"Unread\" : \"All\"}\n </button>\n <DialogPrimitive.Close\n type=\"button\"\n aria-label=\"Close notifications\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\"\n onClick={requestClose}\n >\n <X className=\"h-4 w-4\" />\n </DialogPrimitive.Close>\n </div>\n </header>\n\n <div className=\"flex-1 overflow-y-auto px-4 pb-3\">\n <BrowserNotificationPermissionNotice\n permission={browserNotificationPermission}\n requesting={browserNotificationPermissionRequesting}\n onEnable={requestBrowserNotificationPermission}\n />\n {mergedLoading ? (\n <div className=\"flex items-center justify-center py-10 text-muted-foreground\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n ) : mergedError ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">{mergedError}</div>\n ) : visibleItems.length === 0 ? (\n <div className=\"py-10 text-center text-sm text-muted-foreground\">No notifications.</div>\n ) : (\n <div className=\"flex flex-col gap-4\">\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Unread notifications\n </div>\n {unreadGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No unread notifications.</div>\n ) : (\n unreadGroups.map((group) => (\n <div key={`unread:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n onAction={requestClose}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n\n {unreadOnly ? null : (\n <div>\n <div className=\"sticky top-0 z-20 -mx-4 flex h-8 items-center border-b bg-background px-4 text-xs font-semibold text-muted-foreground\">\n Previous notifications\n </div>\n {readGroups.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">No previous notifications.</div>\n ) : (\n readGroups.map((group) => (\n <div key={`previous:${group.key}`}>\n <div className=\"sticky top-8 z-10 -mx-4 flex h-7 items-center bg-background px-4 text-[11px] font-semibold text-muted-foreground\">\n {group.label}\n </div>\n <div className=\"-mx-4 flex flex-col divide-y divide-border\">\n {group.items.map((n) => (\n <NotificationRow\n key={n.id}\n notification={n}\n onMarkRead={markAsRead}\n onArchive={archive}\n onAction={requestClose}\n />\n ))}\n </div>\n </div>\n ))\n )}\n </div>\n )}\n </div>\n )}\n </div>\n </DialogPrimitive.Popup>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n )\n}\n\nfunction BrowserNotificationPermissionNotice({\n permission,\n requesting,\n onEnable,\n}: {\n permission: BrowserNotificationPermission\n requesting: boolean\n onEnable: () => void\n}) {\n if (permission === \"granted\") return null\n\n if (permission === \"unsupported\") {\n return (\n <div className=\"mt-3 rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground\">\n Browser notifications are not supported by this browser.\n </div>\n )\n }\n\n const isDenied = permission === \"denied\"\n\n return (\n <div className=\"mt-3 rounded-md border bg-muted/40 p-3\">\n <div className=\"text-sm font-medium\">\n {isDenied ? \"Browser notifications are blocked.\" : \"Browser notifications are not enabled.\"}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {isDenied\n ? \"Enable notifications for this site in your browser settings, then click again.\"\n : \"Enable browser notifications to receive important alerts.\"}\n </div>\n <button\n type=\"button\"\n className=\"mt-3 inline-flex h-8 items-center rounded-md border bg-background px-2.5 text-xs font-medium hover:bg-accent disabled:pointer-events-none disabled:opacity-50\"\n disabled={requesting}\n onClick={onEnable}\n >\n {requesting ? \"Enabling...\" : \"Enable browser notifications\"}\n </button>\n </div>\n )\n}\n\nfunction NotificationRow({\n notification,\n onMarkRead,\n onArchive,\n onAction,\n}: {\n notification: NotificationItem\n onMarkRead: (id: string) => void\n onArchive: (id: string) => void\n onAction: () => void\n}) {\n const [menuOpen, setMenuOpen] = useState(false)\n const menuRef = useRef<HTMLDivElement | null>(null)\n const menuButtonRef = useRef<HTMLButtonElement | null>(null)\n const isUnread = !notification.readAt\n const action = getNotificationAction(notification)\n const actionLabel = getNotificationActionLabel(action)\n const createdAtLabel = (() => {\n const date = new Date(toMs(notification.createdAt))\n if (!Number.isFinite(date.getTime())) return \"\"\n return date.toLocaleString()\n })()\n\n useEffect(() => {\n if (!menuOpen) return\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target\n if (!(target instanceof Node)) return\n if (menuRef.current?.contains(target) || menuButtonRef.current?.contains(target)) return\n setMenuOpen(false)\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return\n setMenuOpen(false)\n menuButtonRef.current?.focus()\n }\n\n document.addEventListener(\"pointerdown\", handlePointerDown)\n document.addEventListener(\"keydown\", handleKeyDown)\n\n return () => {\n document.removeEventListener(\"pointerdown\", handlePointerDown)\n document.removeEventListener(\"keydown\", handleKeyDown)\n }\n }, [menuOpen])\n\n return (\n <div\n className={cn(\n \"group flex w-full gap-3 px-4 py-3 hover:bg-accent/40\",\n isUnread ? \"bg-primary/5\" : \"bg-background\",\n )}\n >\n <button\n type=\"button\"\n className=\"min-w-0 flex-1 text-left\"\n onClick={() => {\n if (isUnread) {\n void onMarkRead(notification.id)\n }\n if (action) {\n onAction()\n applyNotificationAction(action)\n }\n }}\n >\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold\">{notification.title}</div>\n {notification.body ? (\n <div className=\"mt-0.5 line-clamp-2 text-xs text-muted-foreground\">{notification.body}</div>\n ) : null}\n </div>\n {actionLabel ? <div className=\"mt-2 truncate text-xs text-primary\">{actionLabel}</div> : null}\n {createdAtLabel ? (\n <div className=\"mt-2 text-[11px] text-muted-foreground\">{createdAtLabel}</div>\n ) : null}\n </button>\n <div className=\"relative flex items-start\">\n <button\n ref={menuButtonRef}\n type=\"button\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-accent\"\n aria-label=\"Notification options\"\n aria-haspopup=\"menu\"\n aria-expanded={menuOpen}\n onClick={() => {\n setMenuOpen((open) => !open)\n }}\n >\n <MoreVertical className=\"h-4 w-4\" />\n </button>\n {menuOpen ? (\n <div\n ref={menuRef}\n role=\"menu\"\n className={cn(\n \"absolute right-0 top-full z-50 mt-1 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\",\n \"animate-in fade-in-0 zoom-in-95\",\n )}\n >\n <button\n type=\"button\"\n role=\"menuitem\"\n className=\"relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus:bg-accent focus:text-accent-foreground\"\n onClick={() => {\n setMenuOpen(false)\n onArchive(notification.id)\n }}\n >\n Archive\n </button>\n <button\n type=\"button\"\n role=\"menuitem\"\n className=\"relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none transition-colors hover:bg-accent focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50\"\n disabled={!isUnread}\n onClick={() => {\n setMenuOpen(false)\n onMarkRead(notification.id)\n }}\n >\n Mark as read\n </button>\n </div>\n ) : null}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,IAAMgC,KAAQC,MAAwB;CACp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A,GACT,kBAAA,UAAA;GACO,MAAA;GACA,MAAA;GACK,WAAA;GACA,UAAA,CAACyC;GACF,eAAA;IAEPP,AADAI,EAAY,EAAK,GACjBJ,EAAWD,EAAYjC,EAAG;GAAC;aAE9B;EAEQ,CAAA,CACL;MAhCP,MAiCOkB,EAAA,MAAAuB,GAAAvB,EAAA,MAAAmB,GAAAnB,EAAA,MAAAe,EAAAjC,IAAAkB,EAAA,MAAAiB,GAAAjB,EAAA,MAAAgB,GAAAhB,EAAA,MAAA+C,KAAAA,IAAA/C,EAAA;CAAA,IAAAgD;CAAA,AAAAhD,EAAA,QAAA8C,KAAA9C,EAAA,QAAA+C,KA/CVC,IAAA,kBAAA,OAAA;EAAe,WAAA;YAAf,CACEF,GAaCC,CAkCG;KAAA/C,EAAA,MAAA8C,GAAA9C,EAAA,MAAA+C,GAAA/C,EAAA,MAAAgD,KAAAA,IAAAhD,EAAA;CAAA,IAAAiD;CACF,OADEjD,EAAA,QAAA0C,KAAA1C,EAAA,QAAAgD,KAAAhD,EAAA,QAAAY,KA9ERqC,IAAA,kBAAA,OAAA;EACa,WAAArC;YADb,CAME8B,GAwBAM,CAiDI;KAAAhD,EAAA,MAAA0C,GAAA1C,EAAA,MAAAgD,GAAAhD,EAAA,MAAAY,GAAAZ,EAAA,MAAAiD,KAAAA,IAAAjD,EAAA,KA/ENiD;AA+EM;AAhIV,SAAAJ,EAAArI,GAAA;CAAA,OAwFkC,CAACA;AAAI"}
|
|
1
|
+
{"version":3,"file":"index420.js","names":["Bell","cn","NotificationsButton","t0","$","_c","unseenCount","unreadCount","onClick","className","rawCount","Number","isFinite","t1","Math","max","floor","count","t2","t3","t4","Symbol","for","t5","String","t6"],"sources":["../src/components/Notifications/NotificationsButton.tsx"],"sourcesContent":["import { Bell } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\n\nexport function NotificationsButton({\n unseenCount,\n unreadCount,\n onClick,\n className,\n}: {\n unseenCount?: number\n unreadCount?: number\n onClick?: () => void\n className?: string\n}) {\n const rawCount = Number.isFinite(unseenCount) ? unseenCount : unreadCount\n const count = Number.isFinite(rawCount) ? Math.max(0, Math.floor(rawCount ?? 0)) : 0\n\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={cn(\n \"relative inline-flex h-9 w-9 items-center justify-center rounded-md border bg-background text-foreground hover:bg-accent\",\n className,\n )}\n aria-label={count > 0 ? `Notifications (${count} new)` : \"Notifications\"}\n >\n <Bell className=\"h-4 w-4\" />\n {count > 0 ? (\n <span\n className=\"absolute -right-1 -top-1 inline-flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-4 text-primary-foreground\"\n aria-hidden=\"true\"\n >\n {count > 99 ? \"99+\" : String(count)}\n </span>\n ) : null}\n </button>\n )\n}\n"],"mappings":";;;;;AAKA,SAAOE,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GAA6B,EAAAC,gBAAAC,gBAAAC,YAAAC,iBAAAN,GAWlCO,IAAiBC,OAAMC,SAAUN,CAAuC,IAAvDA,IAAAC,GAAwDM;CAAA,AAAAT,EAAA,OAAAM,IACWG,IAAAT,EAAA,MAAtES,IAAAF,OAAMC,SAAUF,CAAqD,IAAzCI,KAAIC,IAAK,GAAGD,KAAIE,MAAON,KAAA,CAAa,CAAK,IAArE,GAAsEN,EAAA,KAAAM,GAAAN,EAAA,KAAAS;CAApF,IAAAI,IAAcJ,GAAsEK;CAAA,AAAAd,EAAA,OAAAK,IAS/ES,IAAAd,EAAA,MAHUc,IAAAjB,EACT,4HACAQ,CACF,GAACL,EAAA,KAAAK,GAAAL,EAAA,KAAAc;CACW,IAAAC,IAAAF,IAAQ,IAAR,kBAA8BA,EAAK,SAAnC,iBAA4DG;CAAA,AAAAhB,EAAA,OAAAiB,OAAAC,IAAA,2BAAA,KAExEF,IAAA,kBAAC,GAAD,EAAgB,WAAA,UAAS,CAAA,GAAGhB,EAAA,KAAAgB,KAAAA,IAAAhB,EAAA;CAAA,IAA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