fansunited-frontend-components 0.0.99 → 1.0.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/Betslip.js +2 -2
- package/ChanceGame.js +496 -505
- package/ClassicQuizPlay.js +2 -2
- package/CollectLead.js +405 -1163
- package/CompetitionStatistics.js +2 -2
- package/CompetitorCard.js +445 -425
- package/Discussion.js +2 -2
- package/EitherOrPlay.js +2 -2
- package/EventCard.js +648 -593
- package/EventGamePlay.js +2 -2
- package/Leaderboard.js +142 -132
- package/List.js +675 -713
- package/MatchQuizPlay.js +2 -2
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +2 -2
- package/PickThePair.js +925 -1824
- package/PlayerOfTheMatch.js +2106 -2223
- package/PollVote.js +2 -2
- package/Predictor.js +4209 -18629
- package/Standings.js +497 -486
- package/TopX.js +3223 -16958
- package/chunks/{ChanceGameEmbedVariant-DM9eLG5s.js → ChanceGameEmbedVariant-z8XYzgDW.js} +1 -1
- package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
- package/chunks/index-BNl8scz6.js +4 -0
- package/chunks/index-CSa2JU4m.js +4 -0
- package/chunks/index-CVRI82Gb.js +4 -0
- package/chunks/index-Cd1dg0KI.js +4 -0
- package/chunks/index-Cei2fzi7.js +4 -0
- package/chunks/index-Cxb4wEJU.js +4 -0
- package/chunks/index-w1LGN5dz.js +4 -0
- package/chunks/main-07vzblS8.js +2091 -0
- package/chunks/main-C7X4dM_P.js +4827 -0
- package/chunks/main-D_QDfmAw.js +6417 -0
- package/chunks/{main-CzfWaEQP.js → main-DdL0UekL.js} +1931 -2025
- package/chunks/main-DmBfwyb4.js +2992 -0
- package/chunks/main-LEE8n2cG.js +3117 -0
- package/chunks/{main-DxvBjXsd.js → main-P2WNvBZE.js} +473 -444
- package/chunks/{main-DiBlJBNb.js → main-gV165E-A.js} +629 -657
- package/chunks/predictionsHelpers-fwXaMadu.js +10063 -0
- package/chunks/{withVersionStamp-BsLyhvNA.js → withVersionStamp-CPDfSE5H.js} +1 -1
- package/package.json +2 -6
- package/withVersionStamp.d.ts.map +1 -1
- package/chunks/CheckCircle-I1FktW5Y.js +0 -13
- package/chunks/Person-CXRqyF4E.js +0 -11
- package/chunks/PickOneOfX-DET4ZhjV.js +0 -3117
- package/chunks/Search-CIXthh0D.js +0 -17
- package/chunks/TimerOutlined-D-WA_vpE.js +0 -8
- package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +0 -136
- package/chunks/chevrons-right-HWKW2c4I.js +0 -45
- package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
- package/chunks/index-BENM3N_w.js +0 -4
- package/chunks/index-BRxAV693.js +0 -4
- package/chunks/index-BXYTsvIX.js +0 -4
- package/chunks/index-C0ilols1.js +0 -4
- package/chunks/index-D7VhczXH.js +0 -4
- package/chunks/index-DKwvdw9t.js +0 -4
- package/chunks/index-DZN-AITW.js +0 -4
- package/chunks/main-B2sDRFF4.js +0 -2184
- package/chunks/main-DFNl3g_U.js +0 -4910
- package/chunks/main-DLwnvntz.js +0 -4020
- package/chunks/main-S8_NDSiY.js +0 -3209
- package/chunks/main-lBgr8Liq.js +0 -6571
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { InlineSpinner as vt, Modal as
|
|
3
|
-
import Ie, { useState as
|
|
4
|
-
import { useDisableCache as
|
|
1
|
+
import { jsxs as b, jsx as n, Fragment as Re } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { InlineSpinner as bt, useTextareaAutosize as xt, autosizeShadowStyle as vt, Modal as lt, Avatar as St, Notification as dt, useSelect as wt, Spinner as Oe, WidgetPortal as Ct } from "fansunited-frontend-core/ui/emotion";
|
|
3
|
+
import Ie, { useState as I, useEffect as he, useRef as V, useCallback as Ce, useLayoutEffect as kt, useId as Rt } from "react";
|
|
4
|
+
import { useDisableCache as It, useColors as Et, bidiIsolateAuto as Dt, useIsRtl as Bt, useConstantContext as Ke, ConstantsContext as Ue, toIntlLocale as ut } from "fansunited-frontend-core";
|
|
5
5
|
import { css as o } from "@emotion/react";
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { ThumbUpIcon as
|
|
8
|
-
import { createPortal as
|
|
9
|
-
const
|
|
10
|
-
const [i, s] =
|
|
6
|
+
import { useTranslation as be } from "react-i18next";
|
|
7
|
+
import { ThumbUpIcon as Pt, ThumbDownIcon as Tt, FavoriteIcon as At, SentimentSatisfiedIcon as Mt, FavoriteBorderIcon as Lt, EmojiEmotionsIcon as zt, SentimentVeryDissatisfiedIcon as Ft, MoodBadIcon as $t, ReplyIcon as Xt, MoreVertIcon as Ht, DeleteIcon as Ot, FlagIcon as Nt, CloseIcon as Wt, PersonIcon as Kt, RemoveCircleOutlineIcon as Ut, BlockIcon as Vt, KeyboardArrowDownIcon as _t, UnfoldIcon as jt } from "fansunited-frontend-core/ui/icons";
|
|
8
|
+
import { createPortal as Yt } from "react-dom";
|
|
9
|
+
const Gt = (t, r) => {
|
|
10
|
+
const [i, s] = I(null), [u, a] = I(!0), [m, d] = I(null), [l, c] = I(!1);
|
|
11
11
|
return he(() => {
|
|
12
12
|
r && (async () => {
|
|
13
13
|
try {
|
|
14
14
|
a(!0);
|
|
15
|
-
const
|
|
16
|
-
s(
|
|
17
|
-
} catch (
|
|
18
|
-
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ?
|
|
15
|
+
const f = await t.discussions.getById(r);
|
|
16
|
+
s(f), d(null), c(!1);
|
|
17
|
+
} catch (f) {
|
|
18
|
+
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? f.error.code === 404 : f.data.error.code === 404) ? (c(!0), d(null), s(null)) : (d(m), s(null), c(!1));
|
|
19
19
|
} finally {
|
|
20
20
|
a(!1);
|
|
21
21
|
}
|
|
22
22
|
})();
|
|
23
|
-
}, [t, r]), { discussion: i, setDiscussion: s, isLoading:
|
|
24
|
-
},
|
|
25
|
-
const c = a <= 0, [
|
|
23
|
+
}, [t, r]), { discussion: i, setDiscussion: s, isLoading: u, error: m, isNotFound: l };
|
|
24
|
+
}, Jt = 5e3, qt = 5, Qt = (t, r, i = null, s = "", u = "LATEST", a = 20, m, d = !1, l = 0) => {
|
|
25
|
+
const c = a <= 0, [y, f] = I([]), [k, x] = I(!c), [g, E] = I(!1), [T, v] = I(null), [p, D] = I(u), [M, R] = I(
|
|
26
26
|
null
|
|
27
|
-
), [
|
|
28
|
-
async (
|
|
29
|
-
var
|
|
30
|
-
|
|
27
|
+
), [F, J] = I(!1), [K, _] = I(() => /* @__PURE__ */ new Set()), q = V(0), B = Ce(
|
|
28
|
+
async (C, S, w = !1) => {
|
|
29
|
+
var A, N;
|
|
30
|
+
w || (q.current += 1, _(/* @__PURE__ */ new Set()));
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
sort:
|
|
32
|
+
x(!0);
|
|
33
|
+
const H = await t.discussions.getPosts(r, {
|
|
34
|
+
sort: C,
|
|
35
35
|
limit: a,
|
|
36
|
-
startAfter:
|
|
36
|
+
startAfter: S,
|
|
37
37
|
skipDeleted: !0,
|
|
38
38
|
skipModerated: !d
|
|
39
|
-
}), ae =
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
((N =
|
|
44
|
-
), J(
|
|
45
|
-
} catch (
|
|
46
|
-
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ?
|
|
39
|
+
}), ae = H.data;
|
|
40
|
+
f(w ? ($) => [...$, ...ae] : ae);
|
|
41
|
+
const h = !!((A = H.meta.pagination) != null && A.nextPageStartsAfter) && ae.length === a;
|
|
42
|
+
R(
|
|
43
|
+
((N = H.meta.pagination) == null ? void 0 : N.nextPageStartsAfter) || null
|
|
44
|
+
), J(h), v(null);
|
|
45
|
+
} catch (H) {
|
|
46
|
+
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? H.error.code === 404 : H.data.error.code === 404) ? (f([]), J(!1), R(null), v(null)) : v(T);
|
|
47
47
|
} finally {
|
|
48
|
-
|
|
48
|
+
x(!1);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the query inputs; the setError(error) no-op is deliberate
|
|
51
52
|
[t, r, a, d]
|
|
52
53
|
);
|
|
53
54
|
he(() => {
|
|
54
55
|
if (c) {
|
|
55
|
-
|
|
56
|
+
f([]), J(!1), x(!1);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
r &&
|
|
59
|
-
}, [r,
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, oe =
|
|
63
|
-
oe.current =
|
|
64
|
-
const ne =
|
|
65
|
-
ne.current =
|
|
66
|
-
const pe =
|
|
67
|
-
ne.current && !oe.current &&
|
|
68
|
-
}, [
|
|
69
|
-
|
|
70
|
-
const de =
|
|
71
|
-
de.current =
|
|
72
|
-
const re =
|
|
59
|
+
r && B(p);
|
|
60
|
+
}, [r, p, B, c]);
|
|
61
|
+
const j = (C) => {
|
|
62
|
+
D(C), R(null);
|
|
63
|
+
}, oe = V(k);
|
|
64
|
+
oe.current = k;
|
|
65
|
+
const ne = V(M);
|
|
66
|
+
ne.current = M;
|
|
67
|
+
const pe = Ce(() => {
|
|
68
|
+
ne.current && !oe.current && B(p, ne.current, !0);
|
|
69
|
+
}, [B, p]), Q = V(y);
|
|
70
|
+
Q.current = y;
|
|
71
|
+
const de = V(F);
|
|
72
|
+
de.current = F;
|
|
73
|
+
const re = V(m);
|
|
73
74
|
re.current = m;
|
|
74
|
-
const ie =
|
|
75
|
-
var
|
|
75
|
+
const ie = V(!1), Z = Ce(async () => {
|
|
76
|
+
var H, ae;
|
|
76
77
|
if (oe.current || ie.current) return;
|
|
77
|
-
const
|
|
78
|
+
const C = p === "LATEST" || !de.current;
|
|
78
79
|
ie.current = !0;
|
|
79
|
-
const
|
|
80
|
+
const S = q.current, w = Q.current, A = new Map(w.map((h) => [h.id, h])), N = (h) => !A.has(h.id);
|
|
80
81
|
try {
|
|
81
|
-
const
|
|
82
|
+
const h = [], $ = /* @__PURE__ */ new Map();
|
|
82
83
|
let ee;
|
|
83
|
-
for (let
|
|
84
|
+
for (let W = 0; W < qt; W++) {
|
|
84
85
|
const Y = await t.discussions.getPosts(r, {
|
|
85
86
|
sort: "LATEST",
|
|
86
87
|
limit: a,
|
|
@@ -89,16 +90,16 @@ const _t = (t, r) => {
|
|
|
89
90
|
// Always included, so a shown post that got moderated can be detected
|
|
90
91
|
skipModerated: !1
|
|
91
92
|
}), G = Y.data;
|
|
92
|
-
G.forEach((
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
}), ee = ((
|
|
93
|
+
G.forEach((fe) => {
|
|
94
|
+
const je = A.get(fe.id);
|
|
95
|
+
je ? fe.moderated && !je.moderated && $.set(fe.id, fe) : (d || !fe.moderated) && h.push(fe);
|
|
96
|
+
}), ee = ((H = Y.meta.pagination) == null ? void 0 : H.nextPageStartsAfter) || void 0;
|
|
96
97
|
const xe = G.length === a && G.every(N);
|
|
97
|
-
if (!
|
|
98
|
+
if (!C || !w.length || !xe || !ee) break;
|
|
98
99
|
}
|
|
99
|
-
if (
|
|
100
|
-
(
|
|
101
|
-
const G =
|
|
100
|
+
if (S !== q.current || ($.size && f(
|
|
101
|
+
(W) => d ? W.map((Y) => {
|
|
102
|
+
const G = $.get(Y.id);
|
|
102
103
|
return G ? {
|
|
103
104
|
...Y,
|
|
104
105
|
moderated: !0,
|
|
@@ -106,17 +107,17 @@ const _t = (t, r) => {
|
|
|
106
107
|
moderatedBy: G.moderatedBy,
|
|
107
108
|
moderatedReason: G.moderatedReason
|
|
108
109
|
} : Y;
|
|
109
|
-
}) :
|
|
110
|
-
), !
|
|
111
|
-
const ke = new Set(
|
|
110
|
+
}) : W.filter((Y) => !$.has(Y.id))
|
|
111
|
+
), !C)) return;
|
|
112
|
+
const ke = new Set(Q.current.map((W) => W.id)), ce = h.filter((W) => !ke.has(W.id));
|
|
112
113
|
if (!ce.length) return;
|
|
113
|
-
|
|
114
|
-
const Y = new Set(
|
|
115
|
-
return
|
|
116
|
-
(xe,
|
|
117
|
-
) : [...
|
|
118
|
-
}) : await
|
|
119
|
-
const Y = new Set(
|
|
114
|
+
w.length ? f((W) => {
|
|
115
|
+
const Y = new Set(W.map((xe) => xe.id)), G = ce.filter((xe) => !Y.has(xe.id));
|
|
116
|
+
return p === "LATEST" ? [...G, ...W].sort(
|
|
117
|
+
(xe, fe) => Date.parse(fe.createdAt) - Date.parse(xe.createdAt)
|
|
118
|
+
) : [...W, ...G.reverse()];
|
|
119
|
+
}) : await B(p), _((W) => {
|
|
120
|
+
const Y = new Set(W);
|
|
120
121
|
return ce.forEach((G) => Y.add(G.id)), Y;
|
|
121
122
|
}), (ae = re.current) == null || ae.call(re, ce.length);
|
|
122
123
|
} catch {
|
|
@@ -128,45 +129,45 @@ const _t = (t, r) => {
|
|
|
128
129
|
r,
|
|
129
130
|
a,
|
|
130
131
|
d,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
]), se = l > 0 ? Math.max(l,
|
|
132
|
+
p,
|
|
133
|
+
B
|
|
134
|
+
]), se = l > 0 ? Math.max(l, Jt) : 0;
|
|
134
135
|
he(() => {
|
|
135
136
|
if (!se || c || !r) return;
|
|
136
|
-
const
|
|
137
|
-
document.visibilityState !== "hidden" &&
|
|
138
|
-
},
|
|
139
|
-
document.visibilityState === "visible" &&
|
|
140
|
-
},
|
|
141
|
-
return document.addEventListener("visibilitychange",
|
|
142
|
-
clearInterval(
|
|
137
|
+
const C = () => {
|
|
138
|
+
document.visibilityState !== "hidden" && Z();
|
|
139
|
+
}, S = () => {
|
|
140
|
+
document.visibilityState === "visible" && Z();
|
|
141
|
+
}, w = setInterval(C, se);
|
|
142
|
+
return document.addEventListener("visibilitychange", S), () => {
|
|
143
|
+
clearInterval(w), document.removeEventListener("visibilitychange", S);
|
|
143
144
|
};
|
|
144
|
-
}, [se, c, r,
|
|
145
|
-
const P =
|
|
146
|
-
|
|
147
|
-
if (!
|
|
148
|
-
const
|
|
149
|
-
return
|
|
145
|
+
}, [se, c, r, Z]);
|
|
146
|
+
const P = Ce((C) => {
|
|
147
|
+
_((S) => {
|
|
148
|
+
if (!S.has(C)) return S;
|
|
149
|
+
const w = new Set(S);
|
|
150
|
+
return w.delete(C), w;
|
|
150
151
|
});
|
|
151
152
|
}, []);
|
|
152
153
|
return {
|
|
153
|
-
posts:
|
|
154
|
+
posts: y,
|
|
154
155
|
postsHidden: c,
|
|
155
|
-
isLoading:
|
|
156
|
+
isLoading: k,
|
|
156
157
|
isSubmitting: g,
|
|
157
|
-
error:
|
|
158
|
-
currentSort:
|
|
159
|
-
hasMore:
|
|
160
|
-
newPostIds:
|
|
158
|
+
error: T,
|
|
159
|
+
currentSort: p,
|
|
160
|
+
hasMore: F,
|
|
161
|
+
newPostIds: K,
|
|
161
162
|
markPostSeen: P,
|
|
162
|
-
handleSortChange:
|
|
163
|
+
handleSortChange: j,
|
|
163
164
|
handleLoadMore: pe,
|
|
164
|
-
handleCreatePost: async (
|
|
165
|
+
handleCreatePost: async (C, S) => {
|
|
165
166
|
try {
|
|
166
|
-
|
|
167
|
-
let
|
|
168
|
-
content:
|
|
169
|
-
replyId:
|
|
167
|
+
E(!0);
|
|
168
|
+
let A = await t.discussions.createPost(r, {
|
|
169
|
+
content: C,
|
|
170
|
+
replyId: S || null,
|
|
170
171
|
userNickname: null,
|
|
171
172
|
discussionLabel: i,
|
|
172
173
|
discussionUrl: s,
|
|
@@ -178,79 +179,79 @@ const _t = (t, r) => {
|
|
|
178
179
|
});
|
|
179
180
|
try {
|
|
180
181
|
const N = await t.profile.getOwn().getInfo();
|
|
181
|
-
|
|
182
|
+
A = { ...A, userModel: N };
|
|
182
183
|
} catch {
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
+
S ? f(
|
|
185
186
|
(N) => N.map(
|
|
186
|
-
(
|
|
187
|
+
(H) => H.id === S ? { ...H, repliesCount: (H.repliesCount || 0) + 1 } : H
|
|
187
188
|
)
|
|
188
|
-
) : c ||
|
|
189
|
-
} catch (
|
|
189
|
+
) : c || f((N) => [A, ...N]), m == null || m(1), v(null);
|
|
190
|
+
} catch (w) {
|
|
190
191
|
throw v(
|
|
191
|
-
|
|
192
|
-
),
|
|
192
|
+
w
|
|
193
|
+
), w;
|
|
193
194
|
} finally {
|
|
194
|
-
|
|
195
|
+
E(!1);
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
|
-
handleReact: async (
|
|
198
|
+
handleReact: async (C, S) => {
|
|
198
199
|
try {
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
(
|
|
202
|
-
), v(null),
|
|
203
|
-
} catch (
|
|
204
|
-
throw console.error("Error reacting to post:",
|
|
205
|
-
|
|
206
|
-
),
|
|
200
|
+
const w = await t.discussions.react(C, S);
|
|
201
|
+
return f(
|
|
202
|
+
(A) => A.map((N) => N.id === C ? w : N)
|
|
203
|
+
), v(null), w;
|
|
204
|
+
} catch (w) {
|
|
205
|
+
throw console.error("Error reacting to post:", w), v(
|
|
206
|
+
w
|
|
207
|
+
), w;
|
|
207
208
|
}
|
|
208
209
|
},
|
|
209
|
-
handleDeletePost: async (
|
|
210
|
+
handleDeletePost: async (C, S) => {
|
|
210
211
|
try {
|
|
211
|
-
await t.discussions.deletePost(
|
|
212
|
-
(
|
|
213
|
-
(
|
|
212
|
+
await t.discussions.deletePost(C), f((w) => w.filter((A) => A.id !== C)), S && f(
|
|
213
|
+
(w) => w.map(
|
|
214
|
+
(A) => A.id === S ? { ...A, repliesCount: Math.max(0, (A.repliesCount || 0) - 1) } : A
|
|
214
215
|
)
|
|
215
216
|
), m == null || m(-1), v(null);
|
|
216
|
-
} catch (
|
|
217
|
+
} catch (w) {
|
|
217
218
|
throw v(
|
|
218
|
-
|
|
219
|
-
),
|
|
219
|
+
w
|
|
220
|
+
), w;
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
|
-
handleReportPost: async (
|
|
223
|
+
handleReportPost: async (C, S, w) => {
|
|
223
224
|
try {
|
|
224
|
-
await t.discussions.reportPost(
|
|
225
|
-
} catch (
|
|
225
|
+
await t.discussions.reportPost(C, S, w), v(null);
|
|
226
|
+
} catch (A) {
|
|
226
227
|
throw v(
|
|
227
|
-
|
|
228
|
-
),
|
|
228
|
+
A
|
|
229
|
+
), A;
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
|
-
},
|
|
233
|
+
}, Zt = async (t) => {
|
|
233
234
|
var r;
|
|
234
235
|
try {
|
|
235
|
-
const s = (r = t.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(),
|
|
236
|
-
if (!
|
|
236
|
+
const s = (r = t.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(), u = s == null ? void 0 : s.split(".")[1];
|
|
237
|
+
if (!u) return null;
|
|
237
238
|
const { sub: a } = JSON.parse(
|
|
238
|
-
atob(
|
|
239
|
+
atob(u.replace(/-/g, "+").replace(/_/g, "/"))
|
|
239
240
|
);
|
|
240
241
|
return typeof a == "string" && a ? a : null;
|
|
241
242
|
} catch {
|
|
242
243
|
return null;
|
|
243
244
|
}
|
|
244
|
-
},
|
|
245
|
+
}, eo = (t, r) => {
|
|
245
246
|
var d;
|
|
246
|
-
const [i, s] =
|
|
247
|
+
const [i, s] = I(null), u = It(), a = Ce(
|
|
247
248
|
async (l) => {
|
|
248
249
|
if (!r) {
|
|
249
250
|
s(null);
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
252
253
|
try {
|
|
253
|
-
const c = await
|
|
254
|
+
const c = await Zt(t);
|
|
254
255
|
if (!c) return;
|
|
255
256
|
s(await t.discussions.getUserBan(c, l));
|
|
256
257
|
} catch (c) {
|
|
@@ -260,11 +261,11 @@ const _t = (t, r) => {
|
|
|
260
261
|
[t, r]
|
|
261
262
|
);
|
|
262
263
|
he(() => {
|
|
263
|
-
a(
|
|
264
|
-
}, [a,
|
|
265
|
-
const m =
|
|
264
|
+
a(u);
|
|
265
|
+
}, [a, u]);
|
|
266
|
+
const m = Ce(() => a(!0), [a]);
|
|
266
267
|
return { ban: i, isBanned: !!((d = i == null ? void 0 : i.activeBan) != null && d.banned), refresh: m };
|
|
267
|
-
},
|
|
268
|
+
}, pt = (t) => {
|
|
268
269
|
var r, i, s;
|
|
269
270
|
return (((r = t == null ? void 0 : t.error) == null ? void 0 : r.status) ?? ((s = (i = t == null ? void 0 : t.data) == null ? void 0 : i.error) == null ? void 0 : s.status)) === "ban";
|
|
270
271
|
}, e = {
|
|
@@ -279,8 +280,8 @@ const _t = (t, r) => {
|
|
|
279
280
|
danger: "var(--fu-ucrc-danger-plain-color)",
|
|
280
281
|
dangerSoft: "var(--fu-ucrc-danger-soft-bg)",
|
|
281
282
|
// Joy's own defaults, where a Joy component painted something the client theme doesn't set.
|
|
282
|
-
|
|
283
|
-
icon: "var(--fu-ucrc-
|
|
283
|
+
paletteTextPrimary: "var(--fu-ucrc-palette-text-primary)",
|
|
284
|
+
icon: "var(--fu-ucrc-palette-text-icon)",
|
|
284
285
|
focus: "var(--fu-ucrc-focus-visible)",
|
|
285
286
|
fontPrimary: "var(--fu-ucrc-font-primary)",
|
|
286
287
|
fontBody: "var(--fu-ucrc-font-body)",
|
|
@@ -301,8 +302,8 @@ const _t = (t, r) => {
|
|
|
301
302
|
text14: "var(--fu-ucrc-dsc-text-14)",
|
|
302
303
|
danger1f: "var(--fu-ucrc-dsc-danger-1f)",
|
|
303
304
|
danger33: "var(--fu-ucrc-dsc-danger-33)"
|
|
304
|
-
},
|
|
305
|
-
const t =
|
|
305
|
+
}, Ve = () => {
|
|
306
|
+
const t = Et(), r = t.palette.primary.plainColor, i = t.palette.danger.plainColor, s = t.textPrimary;
|
|
306
307
|
return Ie.useMemo(
|
|
307
308
|
() => ({
|
|
308
309
|
"--fu-ucrc-dsc-primary-14": `${r}14`,
|
|
@@ -315,14 +316,14 @@ const _t = (t, r) => {
|
|
|
315
316
|
[r, i, s]
|
|
316
317
|
);
|
|
317
318
|
}, ve = (t, r, i) => o({ margin: 0, fontFamily: e.fontBody, fontSize: t, fontWeight: r, lineHeight: i }), z = {
|
|
318
|
-
h3: o(ve("1.5em", 600, 1.33334), { letterSpacing: "-0.025em", color: e.
|
|
319
|
-
titleLg: o(ve("1.25em", 600, 1.33334), { color: e.
|
|
320
|
-
titleMd: o(ve("1em", 500, 1.5), { color: e.
|
|
319
|
+
h3: o(ve("1.5em", 600, 1.33334), { letterSpacing: "-0.025em", color: e.paletteTextPrimary }),
|
|
320
|
+
titleLg: o(ve("1.25em", 600, 1.33334), { color: e.paletteTextPrimary }),
|
|
321
|
+
titleMd: o(ve("1em", 500, 1.5), { color: e.paletteTextPrimary }),
|
|
321
322
|
titleSm: ve("0.875em", 500, 1.42858),
|
|
322
323
|
bodyMd: ve("1em", 400, 1.5),
|
|
323
324
|
bodySm: ve("0.875em", 400, 1.5),
|
|
324
325
|
bodyXs: ve("0.75em", 500, 1.5)
|
|
325
|
-
},
|
|
326
|
+
}, _e = o({
|
|
326
327
|
boxSizing: "border-box",
|
|
327
328
|
position: "relative",
|
|
328
329
|
display: "inline-flex",
|
|
@@ -341,32 +342,32 @@ const _t = (t, r) => {
|
|
|
341
342
|
userSelect: "none",
|
|
342
343
|
"&:focus-visible": { outline: `2px solid ${e.focus}`, outlineOffset: "2px" },
|
|
343
344
|
"&:disabled": { pointerEvents: "none", cursor: "default" }
|
|
344
|
-
}),
|
|
345
|
+
}), to = o(_e, {
|
|
345
346
|
fontFamily: e.fontPrimary,
|
|
346
347
|
color: e.onPrimary,
|
|
347
348
|
backgroundColor: e.primary,
|
|
348
349
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-solid-active-bg)" },
|
|
349
350
|
"&:hover": { backgroundColor: e.primary, opacity: 0.9 },
|
|
350
351
|
"&:disabled": { opacity: 0.4 }
|
|
351
|
-
}),
|
|
352
|
+
}), Ye = o(_e, {
|
|
352
353
|
fontFamily: e.fontPrimary,
|
|
353
354
|
color: e.text,
|
|
354
355
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-plain-active-bg)" },
|
|
355
356
|
"&:hover": { backgroundColor: e.text14 },
|
|
356
357
|
"&:disabled": { color: "var(--fu-ucrc-neutral-plain-disabled-color)" }
|
|
357
|
-
}),
|
|
358
|
+
}), Ge = o(_e, {
|
|
358
359
|
border: `1px solid ${e.primary}`,
|
|
359
360
|
color: e.primary,
|
|
360
361
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-outlined-active-bg)" },
|
|
361
362
|
"&:hover": { backgroundColor: e.primary14, borderColor: e.primary },
|
|
362
363
|
"&:disabled": { opacity: 0.4 }
|
|
363
364
|
}), Pe = {
|
|
364
|
-
solid:
|
|
365
|
-
plain:
|
|
366
|
-
outlined:
|
|
367
|
-
signIn: o(
|
|
365
|
+
solid: to,
|
|
366
|
+
plain: Ye,
|
|
367
|
+
outlined: Ge,
|
|
368
|
+
signIn: o(Ge, { width: "100%", paddingBlock: e.spaceSm, fontFamily: e.fontPrimary }),
|
|
368
369
|
// Joy's small plain button, as the post's Reply action.
|
|
369
|
-
reply: o(
|
|
370
|
+
reply: o(Ye, {
|
|
370
371
|
minHeight: "auto",
|
|
371
372
|
marginInlineStart: e.spaceXs,
|
|
372
373
|
paddingBlock: e.space2xs,
|
|
@@ -376,11 +377,11 @@ const _t = (t, r) => {
|
|
|
376
377
|
}),
|
|
377
378
|
decorator: o({ display: "inherit", marginInlineEnd: "calc(0.375em / 0.8125)" }),
|
|
378
379
|
loading: o({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
|
|
379
|
-
}, ue = ({ look: t, loading: r, startDecorator: i, disabled: s, children:
|
|
380
|
+
}, ue = ({ look: t, loading: r, startDecorator: i, disabled: s, children: u, ...a }) => /* @__PURE__ */ b("button", { type: "button", css: Pe[t], disabled: s || r, ...a, children: [
|
|
380
381
|
i && /* @__PURE__ */ n("span", { css: Pe.decorator, children: i }),
|
|
381
|
-
|
|
382
|
-
r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(
|
|
383
|
-
] }),
|
|
382
|
+
u,
|
|
383
|
+
r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(bt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
|
|
384
|
+
] }), Te = {
|
|
384
385
|
// Joy's outlined Textarea with the widget's overrides.
|
|
385
386
|
root: o({
|
|
386
387
|
boxSizing: "border-box",
|
|
@@ -423,122 +424,92 @@ const _t = (t, r) => {
|
|
|
423
424
|
font: "inherit",
|
|
424
425
|
"&::placeholder": { color: "inherit", opacity: 0.64 }
|
|
425
426
|
})
|
|
426
|
-
},
|
|
427
|
-
visibility: "hidden",
|
|
428
|
-
position: "absolute",
|
|
429
|
-
overflow: "hidden",
|
|
430
|
-
height: 0,
|
|
431
|
-
top: 0,
|
|
432
|
-
left: 0,
|
|
433
|
-
transform: "translateZ(0)",
|
|
434
|
-
paddingTop: 0,
|
|
435
|
-
paddingBottom: 0
|
|
436
|
-
}, De = (t) => parseInt(t, 10) || 0, gt = ({
|
|
427
|
+
}, mt = ({
|
|
437
428
|
value: t,
|
|
438
429
|
onChange: r,
|
|
439
430
|
placeholder: i,
|
|
440
431
|
minRows: s,
|
|
441
|
-
maxRows:
|
|
432
|
+
maxRows: u,
|
|
442
433
|
disabled: a,
|
|
443
434
|
marginBottom: m
|
|
444
435
|
}) => {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
if (!u || !y) return;
|
|
448
|
-
const b = getComputedStyle(u);
|
|
449
|
-
if (b.width === "0px") return;
|
|
450
|
-
y.style.width = b.width, y.value = u.value || i || "x", y.value.slice(-1) === `
|
|
451
|
-
` && (y.value += " ");
|
|
452
|
-
const g = y.scrollHeight;
|
|
453
|
-
y.value = "x";
|
|
454
|
-
const k = y.scrollHeight, I = Math.max(Math.min(Math.max(s * k, g), p * k), k), v = I + (b.boxSizing === "border-box" ? De(b.paddingTop) + De(b.paddingBottom) + De(b.borderTopWidth) + De(b.borderBottomWidth) : 0);
|
|
455
|
-
v !== 0 && (c.current !== v && (c.current = v, u.style.height = `${v}px`), u.style.overflow = Math.abs(I - g) <= 1 ? "hidden" : "");
|
|
456
|
-
}, [s, p, i]);
|
|
457
|
-
return Ne(() => {
|
|
458
|
-
h();
|
|
459
|
-
}), Ne(() => {
|
|
460
|
-
const u = d.current;
|
|
461
|
-
if (!u) return;
|
|
462
|
-
const y = new ResizeObserver(() => h());
|
|
463
|
-
return y.observe(u), window.addEventListener("resize", h), () => {
|
|
464
|
-
y.disconnect(), window.removeEventListener("resize", h);
|
|
465
|
-
};
|
|
466
|
-
}, [h]), /* @__PURE__ */ S("div", { css: Me.root, "data-disabled": a || void 0, style: { marginBottom: m }, children: [
|
|
436
|
+
const { inputRef: d, shadowRef: l } = xt(s, u, i);
|
|
437
|
+
return /* @__PURE__ */ b("div", { css: Te.root, "data-disabled": a || void 0, style: { marginBottom: m }, children: [
|
|
467
438
|
/* @__PURE__ */ n(
|
|
468
439
|
"textarea",
|
|
469
440
|
{
|
|
470
441
|
ref: d,
|
|
471
|
-
css:
|
|
442
|
+
css: Te.textarea,
|
|
472
443
|
rows: s,
|
|
473
444
|
value: t,
|
|
474
445
|
placeholder: i,
|
|
475
446
|
disabled: a,
|
|
476
|
-
onChange: (
|
|
447
|
+
onChange: (c) => r(c.target.value)
|
|
477
448
|
}
|
|
478
449
|
),
|
|
479
|
-
/* @__PURE__ */ n("textarea", { ref: l, css:
|
|
450
|
+
/* @__PURE__ */ n("textarea", { ref: l, css: Te.textarea, "aria-hidden": !0, readOnly: !0, tabIndex: -1, style: vt })
|
|
480
451
|
] });
|
|
481
|
-
},
|
|
452
|
+
}, De = {
|
|
482
453
|
form: o({ marginBottom: e.spaceLg }),
|
|
483
454
|
replyingTo: o(z.bodySm, { marginBottom: e.spaceXs, color: e.textSecondary }),
|
|
484
455
|
actions: o({ display: "flex", gap: e.spaceXs, justifyContent: "flex-end" })
|
|
485
|
-
},
|
|
456
|
+
}, ft = ({
|
|
486
457
|
onSubmit: t,
|
|
487
458
|
userIsLoggedIn: r,
|
|
488
459
|
onSignInClick: i,
|
|
489
460
|
placeholder: s,
|
|
490
|
-
isSubmitting:
|
|
461
|
+
isSubmitting: u,
|
|
491
462
|
replyTo: a,
|
|
492
463
|
onCancel: m,
|
|
493
464
|
disabled: d = !1
|
|
494
465
|
}) => {
|
|
495
|
-
const { t: l } =
|
|
496
|
-
if (
|
|
466
|
+
const { t: l } = be(), [c, y] = I(""), f = async (k) => {
|
|
467
|
+
if (k.preventDefault(), !(!c.trim() || d))
|
|
497
468
|
try {
|
|
498
|
-
await t(c),
|
|
499
|
-
} catch (
|
|
500
|
-
console.error("Failed to submit comment:",
|
|
469
|
+
await t(c), y("");
|
|
470
|
+
} catch (x) {
|
|
471
|
+
console.error("Failed to submit comment:", x);
|
|
501
472
|
}
|
|
502
473
|
};
|
|
503
|
-
return r ? /* @__PURE__ */
|
|
504
|
-
a && /* @__PURE__ */ n("p", { css:
|
|
505
|
-
name: a
|
|
474
|
+
return r ? /* @__PURE__ */ b("form", { onSubmit: f, css: De.form, children: [
|
|
475
|
+
a && /* @__PURE__ */ n("p", { css: De.replyingTo, children: l("discussion.replyingTo", "Replying to {{name}}", {
|
|
476
|
+
name: Dt(a)
|
|
506
477
|
}) }),
|
|
507
478
|
/* @__PURE__ */ n(
|
|
508
|
-
|
|
479
|
+
mt,
|
|
509
480
|
{
|
|
510
481
|
placeholder: s || l("discussion.writeComment", "Write a comment..."),
|
|
511
482
|
value: c,
|
|
512
|
-
onChange:
|
|
483
|
+
onChange: y,
|
|
513
484
|
minRows: 3,
|
|
514
485
|
maxRows: 8,
|
|
515
|
-
disabled:
|
|
486
|
+
disabled: u || d,
|
|
516
487
|
marginBottom: e.spaceSm
|
|
517
488
|
}
|
|
518
489
|
),
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
m && /* @__PURE__ */ n(ue, { look: "plain", onClick: m, disabled:
|
|
490
|
+
/* @__PURE__ */ b("div", { css: De.actions, children: [
|
|
491
|
+
m && /* @__PURE__ */ n(ue, { look: "plain", onClick: m, disabled: u, children: l("common.cancel", "Cancel") }),
|
|
521
492
|
/* @__PURE__ */ n(
|
|
522
493
|
ue,
|
|
523
494
|
{
|
|
524
495
|
look: "solid",
|
|
525
496
|
type: "submit",
|
|
526
|
-
disabled: !c.trim() ||
|
|
527
|
-
loading:
|
|
497
|
+
disabled: !c.trim() || u || d,
|
|
498
|
+
loading: u,
|
|
528
499
|
children: a ? l("discussion.reply", "Reply") : l("discussion.post", "Post")
|
|
529
500
|
}
|
|
530
501
|
)
|
|
531
502
|
] })
|
|
532
|
-
] }) : /* @__PURE__ */ n("div", { css:
|
|
533
|
-
}, ge = { size: "1em", color: e.icon },
|
|
534
|
-
LIKE: /* @__PURE__ */ n(
|
|
535
|
-
DISLIKE: /* @__PURE__ */ n(
|
|
536
|
-
LOVE: /* @__PURE__ */ n(
|
|
537
|
-
LAUGH: /* @__PURE__ */ n(
|
|
538
|
-
CARE: /* @__PURE__ */ n(
|
|
539
|
-
WOW: /* @__PURE__ */ n(
|
|
540
|
-
SAD: /* @__PURE__ */ n(
|
|
541
|
-
ANGRY: /* @__PURE__ */ n(
|
|
503
|
+
] }) : /* @__PURE__ */ n("div", { css: De.form, children: /* @__PURE__ */ n(ue, { look: "signIn", onClick: i, children: l("discussion.signInToPost", "Sign in to post") }) });
|
|
504
|
+
}, ge = { size: "1em", color: e.icon }, oo = {
|
|
505
|
+
LIKE: /* @__PURE__ */ n(Pt, { ...ge }),
|
|
506
|
+
DISLIKE: /* @__PURE__ */ n(Tt, { ...ge }),
|
|
507
|
+
LOVE: /* @__PURE__ */ n(At, { ...ge }),
|
|
508
|
+
LAUGH: /* @__PURE__ */ n(Mt, { ...ge }),
|
|
509
|
+
CARE: /* @__PURE__ */ n(Lt, { ...ge }),
|
|
510
|
+
WOW: /* @__PURE__ */ n(zt, { ...ge }),
|
|
511
|
+
SAD: /* @__PURE__ */ n(Ft, { ...ge }),
|
|
512
|
+
ANGRY: /* @__PURE__ */ n($t, { ...ge })
|
|
542
513
|
}, Ae = o({
|
|
543
514
|
display: "inline-flex",
|
|
544
515
|
alignItems: "center",
|
|
@@ -548,49 +519,49 @@ const _t = (t, r) => {
|
|
|
548
519
|
borderRadius: "18px",
|
|
549
520
|
backgroundColor: "transparent",
|
|
550
521
|
color: e.textSecondary
|
|
551
|
-
}),
|
|
522
|
+
}), Me = o(z.bodySm, { fontWeight: 500, color: e.text }), Se = {
|
|
552
523
|
idle: Ae,
|
|
553
524
|
primary: o(Ae, { backgroundColor: "var(--fu-ucrc-neutral-soft-bg)", color: e.primary }),
|
|
554
525
|
danger: o(Ae, { backgroundColor: "var(--fu-ucrc-neutral-soft-bg)", color: e.danger })
|
|
555
|
-
},
|
|
526
|
+
}, Le = {
|
|
556
527
|
cursor: "pointer",
|
|
557
528
|
"&:hover": { backgroundColor: "var(--fu-ucrc-neutral-soft-hover-bg)" }
|
|
558
|
-
},
|
|
529
|
+
}, ze = { opacity: 0.5 }, Fe = {
|
|
559
530
|
pill: {
|
|
560
531
|
enabled: {
|
|
561
|
-
idle: o(
|
|
562
|
-
primary: o(
|
|
563
|
-
danger: o(
|
|
532
|
+
idle: o(Se.idle, Le),
|
|
533
|
+
primary: o(Se.primary, Le),
|
|
534
|
+
danger: o(Se.danger, Le)
|
|
564
535
|
},
|
|
565
536
|
disabled: {
|
|
566
|
-
idle: o(
|
|
567
|
-
primary: o(
|
|
568
|
-
danger: o(
|
|
537
|
+
idle: o(Se.idle, ze),
|
|
538
|
+
primary: o(Se.primary, ze),
|
|
539
|
+
danger: o(Se.danger, ze)
|
|
569
540
|
}
|
|
570
541
|
},
|
|
571
542
|
icon: o({ display: "flex", alignItems: "center", fontSize: "1.25em", color: "inherit" }),
|
|
572
|
-
count: { idle:
|
|
573
|
-
},
|
|
543
|
+
count: { idle: Me, primary: o(Me, { color: e.primary }), danger: o(Me, { color: e.danger }) }
|
|
544
|
+
}, Je = ({
|
|
574
545
|
reaction: t,
|
|
575
546
|
count: r,
|
|
576
547
|
isActive: i,
|
|
577
548
|
onClick: s,
|
|
578
|
-
disabled:
|
|
549
|
+
disabled: u
|
|
579
550
|
}) => {
|
|
580
551
|
const a = (d) => d >= 1e6 ? (d / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : d >= 1e3 ? (d / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : d.toString(), m = i ? t === "LOVE" || t === "ANGRY" ? "danger" : "primary" : "idle";
|
|
581
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ b(
|
|
582
553
|
"div",
|
|
583
554
|
{
|
|
584
|
-
css: Fe.pill[
|
|
585
|
-
onClick:
|
|
555
|
+
css: Fe.pill[u ? "disabled" : "enabled"][m],
|
|
556
|
+
onClick: u ? void 0 : s,
|
|
586
557
|
children: [
|
|
587
|
-
/* @__PURE__ */ n("div", { css: Fe.icon, children:
|
|
558
|
+
/* @__PURE__ */ n("div", { css: Fe.icon, children: oo[t] }),
|
|
588
559
|
r > 0 && /* @__PURE__ */ n("p", { css: Fe.count[m], children: a(r) })
|
|
589
560
|
]
|
|
590
561
|
}
|
|
591
562
|
);
|
|
592
|
-
},
|
|
593
|
-
const [i, s] =
|
|
563
|
+
}, gt = (t, r) => {
|
|
564
|
+
const [i, s] = I(null);
|
|
594
565
|
return he(() => {
|
|
595
566
|
(async () => {
|
|
596
567
|
if (r)
|
|
@@ -602,7 +573,7 @@ const _t = (t, r) => {
|
|
|
602
573
|
}
|
|
603
574
|
})();
|
|
604
575
|
}, [r, t]), i;
|
|
605
|
-
},
|
|
576
|
+
}, qe = {
|
|
606
577
|
row: o({
|
|
607
578
|
display: "flex",
|
|
608
579
|
gap: e.spaceXs,
|
|
@@ -612,52 +583,52 @@ const _t = (t, r) => {
|
|
|
612
583
|
}),
|
|
613
584
|
// Joy set --Icon-color to the text colour on this button; disabled, it follows the label.
|
|
614
585
|
replyIcon: o({ color: e.text, "button:disabled &": { color: "currentColor" } })
|
|
615
|
-
},
|
|
586
|
+
}, no = ({
|
|
616
587
|
post: t,
|
|
617
588
|
sdk: r,
|
|
618
589
|
userIsLoggedIn: i,
|
|
619
590
|
onSignInClick: s,
|
|
620
|
-
onReact:
|
|
591
|
+
onReact: u,
|
|
621
592
|
showReactions: a = !0,
|
|
622
593
|
showReplyButton: m = !0,
|
|
623
594
|
onReplyClick: d,
|
|
624
595
|
isBanned: l = !1
|
|
625
596
|
}) => {
|
|
626
|
-
var g,
|
|
627
|
-
const { t: c } =
|
|
628
|
-
if (!
|
|
597
|
+
var g, E, T, v;
|
|
598
|
+
const { t: c } = be(), y = gt(r, i), k = (() => {
|
|
599
|
+
if (!y || !t.reactions)
|
|
629
600
|
return null;
|
|
630
|
-
for (const
|
|
631
|
-
if (
|
|
632
|
-
return
|
|
601
|
+
for (const p of t.reactions)
|
|
602
|
+
if (p.userIds.includes(y))
|
|
603
|
+
return p.type;
|
|
633
604
|
return null;
|
|
634
|
-
})(),
|
|
605
|
+
})(), x = (p) => {
|
|
635
606
|
if (!i) {
|
|
636
607
|
s == null || s();
|
|
637
608
|
return;
|
|
638
609
|
}
|
|
639
|
-
|
|
610
|
+
u(t.id, p).catch(() => {
|
|
640
611
|
});
|
|
641
612
|
};
|
|
642
|
-
return /* @__PURE__ */
|
|
643
|
-
a && /* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ b("div", { css: qe.row, children: [
|
|
614
|
+
a && /* @__PURE__ */ b(Re, { children: [
|
|
644
615
|
/* @__PURE__ */ n(
|
|
645
|
-
|
|
616
|
+
Je,
|
|
646
617
|
{
|
|
647
618
|
reaction: "LIKE",
|
|
648
|
-
count: ((
|
|
649
|
-
isActive:
|
|
650
|
-
onClick: () =>
|
|
619
|
+
count: ((E = (g = t.reactions) == null ? void 0 : g.find((p) => p.type === "LIKE")) == null ? void 0 : E.reactionCount) || 0,
|
|
620
|
+
isActive: k === "LIKE",
|
|
621
|
+
onClick: () => x("LIKE"),
|
|
651
622
|
disabled: !i || l
|
|
652
623
|
}
|
|
653
624
|
),
|
|
654
625
|
/* @__PURE__ */ n(
|
|
655
|
-
|
|
626
|
+
Je,
|
|
656
627
|
{
|
|
657
628
|
reaction: "DISLIKE",
|
|
658
|
-
count: ((v = (
|
|
659
|
-
isActive:
|
|
660
|
-
onClick: () =>
|
|
629
|
+
count: ((v = (T = t.reactions) == null ? void 0 : T.find((p) => p.type === "DISLIKE")) == null ? void 0 : v.reactionCount) || 0,
|
|
630
|
+
isActive: k === "DISLIKE",
|
|
631
|
+
onClick: () => x("DISLIKE"),
|
|
661
632
|
disabled: !i || l
|
|
662
633
|
}
|
|
663
634
|
)
|
|
@@ -668,29 +639,29 @@ const _t = (t, r) => {
|
|
|
668
639
|
look: "reply",
|
|
669
640
|
onClick: d,
|
|
670
641
|
disabled: l,
|
|
671
|
-
startDecorator: /* @__PURE__ */ n(
|
|
642
|
+
startDecorator: /* @__PURE__ */ n(Xt, { size: "1em", css: qe.replyIcon, style: { marginLeft: "calc(0.375em / -1.625)" } }),
|
|
672
643
|
children: c("discussion.reply", "Reply")
|
|
673
644
|
}
|
|
674
645
|
)
|
|
675
646
|
] });
|
|
676
|
-
},
|
|
677
|
-
const
|
|
678
|
-
return
|
|
647
|
+
}, $e = 4, Qe = { visibility: "hidden" }, ht = (t, r, i, s) => {
|
|
648
|
+
const u = Bt(), [a, m] = I(Qe);
|
|
649
|
+
return kt(() => {
|
|
679
650
|
if (!t) {
|
|
680
|
-
m(
|
|
651
|
+
m(Qe);
|
|
681
652
|
return;
|
|
682
653
|
}
|
|
683
654
|
const d = () => {
|
|
684
|
-
var
|
|
685
|
-
const l = (
|
|
655
|
+
var E;
|
|
656
|
+
const l = (E = r.current) == null ? void 0 : E.getBoundingClientRect(), c = i.current;
|
|
686
657
|
if (!l || !c) return;
|
|
687
658
|
s === "start" && (c.style.width = `${l.width}px`);
|
|
688
|
-
const { width:
|
|
689
|
-
let
|
|
690
|
-
|
|
691
|
-
let g = l.bottom +
|
|
692
|
-
g +
|
|
693
|
-
left: Math.round(
|
|
659
|
+
const { width: y, height: f } = c.getBoundingClientRect(), k = document.documentElement;
|
|
660
|
+
let x = s === "center" ? l.left + l.width / 2 - y / 2 : u ? l.right - y : l.left;
|
|
661
|
+
x = Math.max(0, Math.min(x, k.clientWidth - y));
|
|
662
|
+
let g = l.bottom + $e;
|
|
663
|
+
g + f > k.clientHeight && l.top - $e - f >= 0 && (g = l.top - $e - f), m({
|
|
664
|
+
left: Math.round(x),
|
|
694
665
|
top: Math.round(g),
|
|
695
666
|
width: s === "start" ? l.width : void 0
|
|
696
667
|
});
|
|
@@ -698,7 +669,7 @@ const _t = (t, r) => {
|
|
|
698
669
|
return d(), window.addEventListener("resize", d), window.addEventListener("scroll", d, { capture: !0, passive: !0 }), () => {
|
|
699
670
|
window.removeEventListener("resize", d), window.removeEventListener("scroll", d, { capture: !0 });
|
|
700
671
|
};
|
|
701
|
-
}, [t, s,
|
|
672
|
+
}, [t, s, u, r, i]), a;
|
|
702
673
|
}, Xe = {
|
|
703
674
|
// Joy's small plain IconButton; its radius variable never resolved, so it's square.
|
|
704
675
|
trigger: o({
|
|
@@ -766,93 +737,93 @@ const _t = (t, r) => {
|
|
|
766
737
|
"&:hover, &:focus-visible": { backgroundColor: e.surfaceVariant },
|
|
767
738
|
"&[aria-disabled='true']": { pointerEvents: "none", cursor: "default" }
|
|
768
739
|
})
|
|
769
|
-
},
|
|
740
|
+
}, Ze = { marginInlineEnd: e.spaceXs }, ro = ({
|
|
770
741
|
isOwnPost: t,
|
|
771
742
|
canReport: r,
|
|
772
743
|
onDelete: i,
|
|
773
744
|
onReport: s,
|
|
774
|
-
disabled:
|
|
745
|
+
disabled: u = !1
|
|
775
746
|
}) => {
|
|
776
|
-
const { t: a } =
|
|
747
|
+
const { t: a } = be(), { shadowRootElement: m } = Ke(Ue), d = Rt(), [l, c] = Ie.useState(!1), y = V(null), f = V(null), k = ht(l, y, f, "center");
|
|
777
748
|
if (Ie.useEffect(() => {
|
|
778
749
|
if (!l) return;
|
|
779
|
-
const
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
document.addEventListener("click",
|
|
750
|
+
const p = (M) => {
|
|
751
|
+
const R = M.composedPath();
|
|
752
|
+
y.current && R.includes(y.current) || f.current && R.includes(f.current) || c(!1);
|
|
753
|
+
}, D = setTimeout(() => {
|
|
754
|
+
document.addEventListener("click", p, !0);
|
|
784
755
|
}, 0);
|
|
785
756
|
return () => {
|
|
786
|
-
clearTimeout(
|
|
757
|
+
clearTimeout(D), document.removeEventListener("click", p, !0);
|
|
787
758
|
};
|
|
788
759
|
}, [l]), !t && !r) return null;
|
|
789
|
-
const
|
|
790
|
-
var
|
|
791
|
-
return [...((
|
|
760
|
+
const x = () => {
|
|
761
|
+
var p;
|
|
762
|
+
return [...((p = f.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []];
|
|
792
763
|
}, g = () => {
|
|
793
|
-
var
|
|
794
|
-
c(!1), (
|
|
795
|
-
},
|
|
796
|
-
var
|
|
797
|
-
c(!1), (
|
|
798
|
-
},
|
|
799
|
-
const
|
|
800
|
-
var
|
|
801
|
-
return (
|
|
802
|
-
},
|
|
803
|
-
ArrowDown: () =>
|
|
804
|
-
ArrowUp: () =>
|
|
805
|
-
Home: () =>
|
|
806
|
-
End: () =>
|
|
764
|
+
var p;
|
|
765
|
+
c(!1), (p = y.current) == null || p.focus();
|
|
766
|
+
}, E = (p) => {
|
|
767
|
+
var D;
|
|
768
|
+
c(!1), (D = y.current) == null || D.focus(), p();
|
|
769
|
+
}, T = (p) => {
|
|
770
|
+
const D = x(), M = D.indexOf(p.target), R = (J) => {
|
|
771
|
+
var K;
|
|
772
|
+
return (K = D[(J + D.length) % D.length]) == null ? void 0 : K.focus();
|
|
773
|
+
}, F = {
|
|
774
|
+
ArrowDown: () => R(M + 1),
|
|
775
|
+
ArrowUp: () => R(M - 1),
|
|
776
|
+
Home: () => R(0),
|
|
777
|
+
End: () => R(D.length - 1),
|
|
807
778
|
Escape: g
|
|
808
779
|
};
|
|
809
|
-
|
|
810
|
-
}, v = (
|
|
780
|
+
F[p.key] ? (p.preventDefault(), F[p.key]()) : p.key === "Tab" && c(!1);
|
|
781
|
+
}, v = (p, D, M, R) => /* @__PURE__ */ b(
|
|
811
782
|
"li",
|
|
812
783
|
{
|
|
813
784
|
role: "menuitem",
|
|
814
785
|
tabIndex: -1,
|
|
815
|
-
"aria-disabled":
|
|
786
|
+
"aria-disabled": u,
|
|
816
787
|
css: Xe.item,
|
|
817
|
-
onClick: () =>
|
|
818
|
-
onKeyDown: (
|
|
819
|
-
|
|
788
|
+
onClick: () => E(R),
|
|
789
|
+
onKeyDown: (F) => {
|
|
790
|
+
F.key !== "Enter" && F.key !== " " || (F.preventDefault(), u || E(R));
|
|
820
791
|
},
|
|
821
792
|
children: [
|
|
822
|
-
|
|
823
|
-
|
|
793
|
+
D,
|
|
794
|
+
M
|
|
824
795
|
]
|
|
825
796
|
},
|
|
826
|
-
|
|
797
|
+
p
|
|
827
798
|
);
|
|
828
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ b(Re, { children: [
|
|
829
800
|
/* @__PURE__ */ n(
|
|
830
801
|
"button",
|
|
831
802
|
{
|
|
832
|
-
ref:
|
|
803
|
+
ref: y,
|
|
833
804
|
type: "button",
|
|
834
805
|
"aria-haspopup": "menu",
|
|
835
806
|
"aria-expanded": l,
|
|
836
807
|
"aria-controls": l ? d : void 0,
|
|
837
808
|
css: Xe.trigger,
|
|
838
|
-
onClick: (
|
|
839
|
-
c(!l), !l &&
|
|
840
|
-
var
|
|
841
|
-
return (
|
|
809
|
+
onClick: (p) => {
|
|
810
|
+
c(!l), !l && p.detail === 0 && requestAnimationFrame(() => {
|
|
811
|
+
var D;
|
|
812
|
+
return (D = x()[0]) == null ? void 0 : D.focus();
|
|
842
813
|
});
|
|
843
814
|
},
|
|
844
|
-
children: /* @__PURE__ */ n(
|
|
815
|
+
children: /* @__PURE__ */ n(Ht, { size: "1.25em" })
|
|
845
816
|
}
|
|
846
817
|
),
|
|
847
|
-
l && m &&
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
t && v("delete", /* @__PURE__ */ n(
|
|
850
|
-
r && v("report", /* @__PURE__ */ n(
|
|
818
|
+
l && m && Yt(
|
|
819
|
+
/* @__PURE__ */ b("ul", { ref: f, id: d, role: "menu", css: Xe.menu, style: k, onKeyDown: T, children: [
|
|
820
|
+
t && v("delete", /* @__PURE__ */ n(Ot, { size: "1em", color: e.icon, style: Ze }), a("discussion.delete.action", "Delete"), i),
|
|
821
|
+
r && v("report", /* @__PURE__ */ n(Nt, { size: "1em", color: e.icon, style: Ze }), a("discussion.report.action", "Report"), s)
|
|
851
822
|
] }),
|
|
852
823
|
m
|
|
853
824
|
)
|
|
854
825
|
] });
|
|
855
|
-
},
|
|
826
|
+
}, et = "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))", tt = o({
|
|
856
827
|
position: "absolute",
|
|
857
828
|
top: "50%",
|
|
858
829
|
left: "50%",
|
|
@@ -867,35 +838,35 @@ const _t = (t, r) => {
|
|
|
867
838
|
border: "1px solid var(--fu-ucrc-neutral-outlined-border)",
|
|
868
839
|
borderRadius: e.radiusMd,
|
|
869
840
|
outline: 0,
|
|
870
|
-
boxShadow: `var(--fu-ucrc-shadow-ring), 0px 2px 8px -2px ${
|
|
841
|
+
boxShadow: `var(--fu-ucrc-shadow-ring), 0px 2px 8px -2px ${et}, 0px 6px 12px -2px ${et}`,
|
|
871
842
|
backgroundColor: e.surface,
|
|
872
843
|
color: e.text,
|
|
873
844
|
fontFamily: e.fontBody,
|
|
874
845
|
fontSize: "1em",
|
|
875
846
|
fontWeight: 400,
|
|
876
847
|
lineHeight: 1.5
|
|
877
|
-
}),
|
|
878
|
-
delete: o(
|
|
879
|
-
report: o(
|
|
848
|
+
}), ye = {
|
|
849
|
+
delete: o(tt, { maxWidth: "400px" }),
|
|
850
|
+
report: o(tt, { maxWidth: "440px" }),
|
|
880
851
|
title: o(z.titleLg, { fontFamily: e.fontPrimary }),
|
|
881
852
|
description: o(z.bodySm, { color: e.textSecondary }),
|
|
882
853
|
actions: o({ display: "flex", gap: e.spaceXs, justifyContent: "flex-end" })
|
|
883
|
-
},
|
|
884
|
-
title: o(
|
|
885
|
-
description: o(
|
|
886
|
-
},
|
|
854
|
+
}, ot = {
|
|
855
|
+
title: o(ye.title, { marginBottom: e.spaceXs }),
|
|
856
|
+
description: o(ye.description, { marginBottom: e.spaceLg })
|
|
857
|
+
}, io = ({
|
|
887
858
|
open: t,
|
|
888
859
|
onClose: r,
|
|
889
860
|
onConfirm: i,
|
|
890
861
|
onError: s
|
|
891
862
|
}) => {
|
|
892
|
-
const { t:
|
|
863
|
+
const { t: u } = be(), a = Ve(), m = Ie.useId(), [d, l] = I(!1), c = async () => {
|
|
893
864
|
l(!0);
|
|
894
865
|
try {
|
|
895
866
|
await i(), r();
|
|
896
867
|
} catch {
|
|
897
868
|
s(
|
|
898
|
-
|
|
869
|
+
u(
|
|
899
870
|
"discussion.delete.error",
|
|
900
871
|
"Failed to delete comment. Please try again."
|
|
901
872
|
)
|
|
@@ -904,18 +875,18 @@ const _t = (t, r) => {
|
|
|
904
875
|
l(!1);
|
|
905
876
|
}
|
|
906
877
|
};
|
|
907
|
-
return /* @__PURE__ */ n(
|
|
908
|
-
/* @__PURE__ */ n("p", { id: m, css:
|
|
909
|
-
/* @__PURE__ */ n("p", { css:
|
|
878
|
+
return /* @__PURE__ */ n(lt, { open: t, onClose: r, children: /* @__PURE__ */ b("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": m, tabIndex: -1, css: ye.delete, style: a, children: [
|
|
879
|
+
/* @__PURE__ */ n("p", { id: m, css: ot.title, children: u("discussion.delete.title", "Delete comment") }),
|
|
880
|
+
/* @__PURE__ */ n("p", { css: ot.description, children: u(
|
|
910
881
|
"discussion.delete.description",
|
|
911
882
|
"Are you sure you want to delete this comment? This action cannot be undone."
|
|
912
883
|
) }),
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */ n(ue, { look: "plain", onClick: r, children:
|
|
915
|
-
/* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children:
|
|
884
|
+
/* @__PURE__ */ b("div", { css: ye.actions, children: [
|
|
885
|
+
/* @__PURE__ */ n(ue, { look: "plain", onClick: r, children: u("common.cancel", "Cancel") }),
|
|
886
|
+
/* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children: u("discussion.delete.action", "Delete") })
|
|
916
887
|
] })
|
|
917
888
|
] }) });
|
|
918
|
-
},
|
|
889
|
+
}, nt = o({
|
|
919
890
|
boxSizing: "border-box",
|
|
920
891
|
display: "inline-flex",
|
|
921
892
|
justifyContent: "center",
|
|
@@ -930,7 +901,7 @@ const _t = (t, r) => {
|
|
|
930
901
|
color: "var(--fu-ucrc-neutral-outlined-color)",
|
|
931
902
|
"&:active": { backgroundColor: "var(--fu-ucrc-neutral-outlined-active-bg)" },
|
|
932
903
|
"&:hover": { backgroundColor: e.surface, borderColor: e.border }
|
|
933
|
-
}),
|
|
904
|
+
}), rt = o({
|
|
934
905
|
width: "0.625em",
|
|
935
906
|
height: "0.625em",
|
|
936
907
|
borderRadius: "inherit",
|
|
@@ -938,8 +909,8 @@ const _t = (t, r) => {
|
|
|
938
909
|
backgroundColor: "currentColor",
|
|
939
910
|
transform: "scale(0)"
|
|
940
911
|
}), le = {
|
|
941
|
-
title: o(
|
|
942
|
-
description: o(
|
|
912
|
+
title: o(ye.title, { marginBottom: e.spaceMd }),
|
|
913
|
+
description: o(ye.description, { marginBottom: e.spaceMd }),
|
|
943
914
|
// Joy's ModalClose: an 8px inset, 2rem square.
|
|
944
915
|
close: o({
|
|
945
916
|
position: "absolute",
|
|
@@ -988,14 +959,14 @@ const _t = (t, r) => {
|
|
|
988
959
|
"& + &": { marginBlockStart: "0.875em" }
|
|
989
960
|
}),
|
|
990
961
|
circle: {
|
|
991
|
-
unchecked:
|
|
992
|
-
checked: o(
|
|
962
|
+
unchecked: nt,
|
|
963
|
+
checked: o(nt, {
|
|
993
964
|
color: "var(--fu-ucrc-primary-outlined-color)",
|
|
994
965
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-outlined-active-bg)" },
|
|
995
966
|
"&:hover": { backgroundColor: e.surface, borderColor: e.border }
|
|
996
967
|
})
|
|
997
968
|
},
|
|
998
|
-
dot: { unchecked:
|
|
969
|
+
dot: { unchecked: rt, checked: o(rt, { transform: "none" }) },
|
|
999
970
|
action: o({
|
|
1000
971
|
position: "absolute",
|
|
1001
972
|
inset: "-1px",
|
|
@@ -1012,7 +983,7 @@ const _t = (t, r) => {
|
|
|
1012
983
|
cursor: "pointer"
|
|
1013
984
|
}),
|
|
1014
985
|
label: o({ flex: 1, minWidth: 0 })
|
|
1015
|
-
},
|
|
986
|
+
}, so = [
|
|
1016
987
|
{ value: "SPAM", labelKey: "discussion.report.spam", fallback: "Spam" },
|
|
1017
988
|
{
|
|
1018
989
|
value: "NOT_ON_THE_SUBJECT",
|
|
@@ -1037,21 +1008,21 @@ const _t = (t, r) => {
|
|
|
1037
1008
|
},
|
|
1038
1009
|
{ value: "INSULT", labelKey: "discussion.report.insult", fallback: "Insult" },
|
|
1039
1010
|
{ value: "OTHER", labelKey: "discussion.report.other", fallback: "Other" }
|
|
1040
|
-
],
|
|
1011
|
+
], ao = ({
|
|
1041
1012
|
open: t,
|
|
1042
1013
|
onClose: r,
|
|
1043
1014
|
onSubmit: i,
|
|
1044
1015
|
onSuccess: s,
|
|
1045
|
-
onError:
|
|
1016
|
+
onError: u
|
|
1046
1017
|
}) => {
|
|
1047
|
-
const { t: a } =
|
|
1048
|
-
r(), c(""),
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1018
|
+
const { t: a } = be(), m = Ve(), d = Ie.useId(), [l, c] = I(""), [y, f] = I(""), [k, x] = I(!1), g = () => {
|
|
1019
|
+
r(), c(""), f("");
|
|
1020
|
+
}, E = async () => {
|
|
1021
|
+
x(!0);
|
|
1051
1022
|
try {
|
|
1052
1023
|
await i(
|
|
1053
1024
|
l,
|
|
1054
|
-
l === "OTHER" ?
|
|
1025
|
+
l === "OTHER" ? y : void 0
|
|
1055
1026
|
), s(
|
|
1056
1027
|
a(
|
|
1057
1028
|
"discussion.report.success",
|
|
@@ -1059,86 +1030,86 @@ const _t = (t, r) => {
|
|
|
1059
1030
|
)
|
|
1060
1031
|
), g();
|
|
1061
1032
|
} catch {
|
|
1062
|
-
|
|
1033
|
+
u(
|
|
1063
1034
|
a(
|
|
1064
1035
|
"discussion.report.error",
|
|
1065
1036
|
"Failed to report post. Please try again."
|
|
1066
1037
|
)
|
|
1067
1038
|
);
|
|
1068
1039
|
} finally {
|
|
1069
|
-
|
|
1040
|
+
x(!1);
|
|
1070
1041
|
}
|
|
1071
1042
|
};
|
|
1072
|
-
return /* @__PURE__ */ n(
|
|
1073
|
-
/* @__PURE__ */ n("button", { type: "button", "aria-label": a("common.rules.close", "Close"), css: le.close, onClick: g, children: /* @__PURE__ */ n(
|
|
1043
|
+
return /* @__PURE__ */ n(lt, { open: t, onClose: g, children: /* @__PURE__ */ b("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": `${d}title`, tabIndex: -1, css: ye.report, style: m, children: [
|
|
1044
|
+
/* @__PURE__ */ n("button", { type: "button", "aria-label": a("common.rules.close", "Close"), css: le.close, onClick: g, children: /* @__PURE__ */ n(Wt, { size: "calc(2em / 1.5)" }) }),
|
|
1074
1045
|
/* @__PURE__ */ n("p", { id: `${d}title`, css: le.title, children: a("discussion.report.title", "Report post") }),
|
|
1075
1046
|
/* @__PURE__ */ n("p", { css: le.description, children: a(
|
|
1076
1047
|
"discussion.report.description",
|
|
1077
1048
|
"Why are you reporting this post?"
|
|
1078
1049
|
) }),
|
|
1079
|
-
/* @__PURE__ */ n("div", { role: "radiogroup", css: le.group, children:
|
|
1080
|
-
const v = l ===
|
|
1081
|
-
return /* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */ n("span", { css: le.dot[
|
|
1050
|
+
/* @__PURE__ */ n("div", { role: "radiogroup", css: le.group, children: so.map((T) => {
|
|
1051
|
+
const v = l === T.value, p = v ? "checked" : "unchecked";
|
|
1052
|
+
return /* @__PURE__ */ b("span", { css: le.radio, children: [
|
|
1053
|
+
/* @__PURE__ */ b("span", { css: le.circle[p], children: [
|
|
1054
|
+
/* @__PURE__ */ n("span", { css: le.dot[p] }),
|
|
1084
1055
|
/* @__PURE__ */ n("span", { css: le.action, children: /* @__PURE__ */ n(
|
|
1085
1056
|
"input",
|
|
1086
1057
|
{
|
|
1087
|
-
id: `${d}${
|
|
1058
|
+
id: `${d}${T.value}`,
|
|
1088
1059
|
type: "radio",
|
|
1089
1060
|
name: `${d}reason`,
|
|
1090
|
-
value:
|
|
1061
|
+
value: T.value,
|
|
1091
1062
|
checked: v,
|
|
1092
|
-
onChange: (
|
|
1063
|
+
onChange: (D) => c(D.target.value),
|
|
1093
1064
|
css: le.input
|
|
1094
1065
|
}
|
|
1095
1066
|
) })
|
|
1096
1067
|
] }),
|
|
1097
|
-
/* @__PURE__ */ n("label", { htmlFor: `${d}${
|
|
1098
|
-
] },
|
|
1068
|
+
/* @__PURE__ */ n("label", { htmlFor: `${d}${T.value}`, css: le.label, children: a(T.labelKey, T.fallback) })
|
|
1069
|
+
] }, T.value);
|
|
1099
1070
|
}) }),
|
|
1100
1071
|
l === "OTHER" && /* @__PURE__ */ n(
|
|
1101
|
-
|
|
1072
|
+
mt,
|
|
1102
1073
|
{
|
|
1103
1074
|
placeholder: a(
|
|
1104
1075
|
"discussion.report.detailsPlaceholder",
|
|
1105
1076
|
"Please provide more details..."
|
|
1106
1077
|
),
|
|
1107
|
-
value:
|
|
1108
|
-
onChange:
|
|
1078
|
+
value: y,
|
|
1079
|
+
onChange: f,
|
|
1109
1080
|
minRows: 2,
|
|
1110
1081
|
maxRows: 4,
|
|
1111
1082
|
marginBottom: e.spaceMd
|
|
1112
1083
|
}
|
|
1113
1084
|
),
|
|
1114
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ b("div", { css: ye.actions, children: [
|
|
1115
1086
|
/* @__PURE__ */ n(ue, { look: "plain", onClick: g, children: a("common.cancel", "Cancel") }),
|
|
1116
1087
|
/* @__PURE__ */ n(
|
|
1117
1088
|
ue,
|
|
1118
1089
|
{
|
|
1119
1090
|
look: "solid",
|
|
1120
1091
|
disabled: !l,
|
|
1121
|
-
loading:
|
|
1122
|
-
onClick:
|
|
1092
|
+
loading: k,
|
|
1093
|
+
onClick: E,
|
|
1123
1094
|
children: a("discussion.report.action", "Report")
|
|
1124
1095
|
}
|
|
1125
1096
|
)
|
|
1126
1097
|
] })
|
|
1127
1098
|
] }) });
|
|
1128
|
-
},
|
|
1099
|
+
}, co = (t, r, i) => {
|
|
1129
1100
|
const s = new Date(t), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), m = Math.floor(a / 6e4), d = Math.floor(a / 36e5), l = Math.floor(a / 864e5);
|
|
1130
|
-
return m < 1 ? r("discussion.justNow", "Just now") : m < 60 ? r("discussion.minutesAgo", "{{count}}m ago", { count: m }) : d < 24 ? r("discussion.hoursAgo", "{{count}}h ago", { count: d }) : l < 7 ? r("discussion.daysAgo", "{{count}}d ago", { count: l }) : s.toLocaleDateString(
|
|
1131
|
-
},
|
|
1101
|
+
return m < 1 ? r("discussion.justNow", "Just now") : m < 60 ? r("discussion.minutesAgo", "{{count}}m ago", { count: m }) : d < 24 ? r("discussion.hoursAgo", "{{count}}h ago", { count: d }) : l < 7 ? r("discussion.daysAgo", "{{count}}d ago", { count: l }) : s.toLocaleDateString(ut(i));
|
|
1102
|
+
}, Ne = o({ marginBottom: e.spaceMd }), We = o(Ne, {
|
|
1132
1103
|
paddingInline: e.spaceSm,
|
|
1133
1104
|
paddingBlock: e.spaceXs,
|
|
1134
1105
|
borderInlineStart: "3px solid transparent",
|
|
1135
1106
|
borderRadius: e.radiusXs,
|
|
1136
1107
|
backgroundColor: "transparent",
|
|
1137
1108
|
transition: "background-color 0.6s ease, border-color 0.6s ease"
|
|
1138
|
-
}),
|
|
1139
|
-
post: { top:
|
|
1140
|
-
highlightable: { top:
|
|
1141
|
-
highlighted: { top:
|
|
1109
|
+
}), it = o(We, { borderInlineStartColor: e.primary, backgroundColor: e.primary1a }), lo = { width: "64%", height: "64%" }, uo = { marginTop: "2px" }, O = {
|
|
1110
|
+
post: { top: Ne, reply: o(Ne, { marginLeft: e.spaceXl }) },
|
|
1111
|
+
highlightable: { top: We, reply: o(We, { marginLeft: e.spaceXl }) },
|
|
1112
|
+
highlighted: { top: it, reply: o(it, { marginLeft: e.spaceXl }) },
|
|
1142
1113
|
row: o({ display: "flex", gap: e.spaceSm }),
|
|
1143
1114
|
// Joy's small soft Avatar: 2rem square, in its own 0.875em font.
|
|
1144
1115
|
avatar: o({
|
|
@@ -1154,7 +1125,7 @@ const _t = (t, r) => {
|
|
|
1154
1125
|
}),
|
|
1155
1126
|
body: o({ flex: 1, minWidth: 0 }),
|
|
1156
1127
|
header: o({ display: "flex", alignItems: "center", gap: e.spaceXs, marginBottom: e.space2xs }),
|
|
1157
|
-
name: o(z.titleSm, { color: e.text }),
|
|
1128
|
+
name: o(z.titleSm, { color: e.text, unicodeBidi: "plaintext" }),
|
|
1158
1129
|
time: o(z.bodyXs, { color: e.textSecondary }),
|
|
1159
1130
|
badge: o(z.bodyXs, {
|
|
1160
1131
|
fontWeight: 600,
|
|
@@ -1175,8 +1146,9 @@ const _t = (t, r) => {
|
|
|
1175
1146
|
borderLeft: `3px solid ${e.border}`,
|
|
1176
1147
|
backgroundColor: e.surfaceVariant
|
|
1177
1148
|
}),
|
|
1178
|
-
moderatedText: o(z.bodySm, { fontStyle: "italic", color: e.textSecondary }),
|
|
1179
|
-
|
|
1149
|
+
moderatedText: o(z.bodySm, { fontStyle: "italic", color: e.textSecondary, unicodeBidi: "plaintext" }),
|
|
1150
|
+
// User text: each line takes its own direction.
|
|
1151
|
+
content: o(z.bodySm, { marginBottom: e.spaceXs, whiteSpace: "pre-wrap", color: e.textBody, unicodeBidi: "plaintext" }),
|
|
1180
1152
|
repliesRow: o({ marginBottom: e.spaceXs }),
|
|
1181
1153
|
repliesToggle: o(z.bodySm, {
|
|
1182
1154
|
display: "flex",
|
|
@@ -1188,202 +1160,202 @@ const _t = (t, r) => {
|
|
|
1188
1160
|
"&:hover": { textDecoration: "underline", textUnderlineOffset: "2px" }
|
|
1189
1161
|
}),
|
|
1190
1162
|
nested: o({ marginTop: e.spaceMd })
|
|
1191
|
-
},
|
|
1163
|
+
}, po = 8e3, yt = ({
|
|
1192
1164
|
post: t,
|
|
1193
1165
|
sdk: r,
|
|
1194
1166
|
userIsLoggedIn: i,
|
|
1195
1167
|
onSignInClick: s,
|
|
1196
|
-
showReactions:
|
|
1168
|
+
showReactions: u = !0,
|
|
1197
1169
|
showReplies: a = !0,
|
|
1198
1170
|
showReportPost: m = !0,
|
|
1199
1171
|
onReply: d,
|
|
1200
1172
|
onReact: l,
|
|
1201
1173
|
onDelete: c,
|
|
1202
|
-
onReport:
|
|
1203
|
-
isSubmitting:
|
|
1204
|
-
showModeratedPosts:
|
|
1205
|
-
isBanned:
|
|
1174
|
+
onReport: y,
|
|
1175
|
+
isSubmitting: f,
|
|
1176
|
+
showModeratedPosts: k = !1,
|
|
1177
|
+
isBanned: x = !1,
|
|
1206
1178
|
highlightable: g = !1,
|
|
1207
|
-
isNew:
|
|
1208
|
-
onNewSeen:
|
|
1179
|
+
isNew: E = !1,
|
|
1180
|
+
onNewSeen: T,
|
|
1209
1181
|
depth: v = 0,
|
|
1210
|
-
parentPostId:
|
|
1211
|
-
onReplyCreated:
|
|
1212
|
-
onDeleteSuccess:
|
|
1182
|
+
parentPostId: p,
|
|
1183
|
+
onReplyCreated: D,
|
|
1184
|
+
onDeleteSuccess: M
|
|
1213
1185
|
}) => {
|
|
1214
|
-
var
|
|
1215
|
-
const { t:
|
|
1186
|
+
var A, N, H, ae;
|
|
1187
|
+
const { t: R } = be(), { language: F } = Ke(Ue), J = gt(r, i), [K, _] = I(!1), [q, B] = I([]), [j, oe] = I(!1), [ne, pe] = I(!1), [Q, de] = I(!1), [re, ie] = I({ open: !1, variant: "success", title: "", message: "" }), Z = V(null);
|
|
1216
1188
|
he(() => {
|
|
1217
|
-
if (!
|
|
1218
|
-
let
|
|
1219
|
-
const
|
|
1189
|
+
if (!E || !T || !Z.current) return;
|
|
1190
|
+
let h;
|
|
1191
|
+
const $ = new IntersectionObserver(
|
|
1220
1192
|
([ee]) => {
|
|
1221
|
-
ee.isIntersecting && (
|
|
1193
|
+
ee.isIntersecting && ($.disconnect(), h = setTimeout(() => T(t.id), po));
|
|
1222
1194
|
},
|
|
1223
1195
|
{ threshold: 0.5 }
|
|
1224
1196
|
);
|
|
1225
|
-
return
|
|
1226
|
-
|
|
1197
|
+
return $.observe(Z.current), () => {
|
|
1198
|
+
$.disconnect(), clearTimeout(h);
|
|
1227
1199
|
};
|
|
1228
|
-
}, [
|
|
1229
|
-
const se = !!(i && J && t.userId === J), P = !!t.moderated,
|
|
1200
|
+
}, [E, T, t.id]);
|
|
1201
|
+
const se = !!(i && J && t.userId === J), P = !!t.moderated, U = async (h) => {
|
|
1230
1202
|
var ce;
|
|
1231
|
-
const
|
|
1232
|
-
await d(
|
|
1233
|
-
},
|
|
1203
|
+
const $ = v === 1 && p || t.id, ee = ((ce = t.userModel) == null ? void 0 : ce.name) || t.anonymousNickname || R("discussion.anonymous", "Anonymous"), ke = v === 1 ? `@${ee} ${h}` : h;
|
|
1204
|
+
await d($, ke), _(!1), v === 1 && D ? D() : v === 0 && (oe(!0), X());
|
|
1205
|
+
}, X = async () => {
|
|
1234
1206
|
if (!(!a || v >= 2))
|
|
1235
1207
|
try {
|
|
1236
|
-
const
|
|
1208
|
+
const h = await r.discussions.getPostReplies(t.id, {
|
|
1237
1209
|
limit: 25,
|
|
1238
1210
|
skipDeleted: !0,
|
|
1239
|
-
skipModerated: !
|
|
1211
|
+
skipModerated: !k
|
|
1240
1212
|
});
|
|
1241
|
-
|
|
1242
|
-
} catch (
|
|
1243
|
-
console.error("Failed to load replies:",
|
|
1213
|
+
B(h.data);
|
|
1214
|
+
} catch (h) {
|
|
1215
|
+
console.error("Failed to load replies:", h);
|
|
1244
1216
|
}
|
|
1245
1217
|
};
|
|
1246
1218
|
he(() => {
|
|
1247
|
-
|
|
1248
|
-
}, [
|
|
1249
|
-
const Ee = async (
|
|
1250
|
-
await c(
|
|
1251
|
-
},
|
|
1252
|
-
const ee = await l(
|
|
1253
|
-
ee && q.length > 0 &&
|
|
1254
|
-
(ke) => ke.map((ce) => ce.id ===
|
|
1219
|
+
j && q.length === 0 && X();
|
|
1220
|
+
}, [j]);
|
|
1221
|
+
const Ee = async (h) => {
|
|
1222
|
+
await c(h, t.id), B(($) => $.filter((ee) => ee.id !== h));
|
|
1223
|
+
}, me = async (h, $) => {
|
|
1224
|
+
const ee = await l(h, $);
|
|
1225
|
+
ee && q.length > 0 && B(
|
|
1226
|
+
(ke) => ke.map((ce) => ce.id === h ? ee : ce)
|
|
1255
1227
|
);
|
|
1256
|
-
},
|
|
1257
|
-
ie({ open: !0, variant:
|
|
1258
|
-
},
|
|
1259
|
-
return /* @__PURE__ */
|
|
1228
|
+
}, C = (h, $) => {
|
|
1229
|
+
ie({ open: !0, variant: $, title: "", message: h });
|
|
1230
|
+
}, S = v > 0 ? "reply" : "top", w = ((A = t.userModel) == null ? void 0 : A.name) || t.anonymousNickname || "User";
|
|
1231
|
+
return /* @__PURE__ */ b(
|
|
1260
1232
|
"div",
|
|
1261
1233
|
{
|
|
1262
|
-
css: g ?
|
|
1234
|
+
css: g ? E ? O.highlighted[S] : O.highlightable[S] : O.post[S],
|
|
1263
1235
|
children: [
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */ n(St, { src: (N = t.userModel) == null ? void 0 : N.avatar, alt:
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */ n("p", { css: O.name, children: ((
|
|
1269
|
-
/* @__PURE__ */ n("span", { css: O.time, children:
|
|
1270
|
-
|
|
1236
|
+
/* @__PURE__ */ b("div", { css: O.row, children: [
|
|
1237
|
+
/* @__PURE__ */ n(St, { src: (N = t.userModel) == null ? void 0 : N.avatar, alt: w, css: O.avatar, children: /* @__PURE__ */ n(Kt, { color: e.icon, style: lo }) }),
|
|
1238
|
+
/* @__PURE__ */ b("div", { css: O.body, children: [
|
|
1239
|
+
/* @__PURE__ */ b("div", { ref: Z, css: O.header, children: [
|
|
1240
|
+
/* @__PURE__ */ n("p", { css: O.name, children: ((H = t.userModel) == null ? void 0 : H.name) || t.anonymousNickname || R("discussion.anonymous", "Anonymous") }),
|
|
1241
|
+
/* @__PURE__ */ n("span", { css: O.time, children: co(t.createdAt, R, F) }),
|
|
1242
|
+
E && /* @__PURE__ */ n("span", { css: O.badge, children: R("discussion.newPost", "New") }),
|
|
1271
1243
|
/* @__PURE__ */ n(
|
|
1272
|
-
|
|
1244
|
+
ro,
|
|
1273
1245
|
{
|
|
1274
1246
|
isOwnPost: se,
|
|
1275
1247
|
canReport: !!(m && i && !se) && !P,
|
|
1276
1248
|
onDelete: () => pe(!0),
|
|
1277
1249
|
onReport: () => de(!0),
|
|
1278
|
-
disabled:
|
|
1250
|
+
disabled: x
|
|
1279
1251
|
}
|
|
1280
1252
|
)
|
|
1281
1253
|
] }),
|
|
1282
|
-
P &&
|
|
1283
|
-
/* @__PURE__ */ n(
|
|
1284
|
-
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason ||
|
|
1254
|
+
P && k ? /* @__PURE__ */ b("div", { css: O.moderated, children: [
|
|
1255
|
+
/* @__PURE__ */ n(Ut, { size: "0.9375em", color: e.textSecondary, style: uo }),
|
|
1256
|
+
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason || R(
|
|
1285
1257
|
"discussion.moderatedPost",
|
|
1286
1258
|
"This comment has been moderated"
|
|
1287
1259
|
) })
|
|
1288
1260
|
] }) : /* @__PURE__ */ n("p", { css: O.content, children: t.content }),
|
|
1289
1261
|
!P && /* @__PURE__ */ n(
|
|
1290
|
-
|
|
1262
|
+
no,
|
|
1291
1263
|
{
|
|
1292
1264
|
post: t,
|
|
1293
1265
|
sdk: r,
|
|
1294
1266
|
userIsLoggedIn: i,
|
|
1295
1267
|
onSignInClick: s,
|
|
1296
1268
|
onReact: l,
|
|
1297
|
-
showReactions:
|
|
1269
|
+
showReactions: u,
|
|
1298
1270
|
showReplyButton: a && v < 2,
|
|
1299
|
-
onReplyClick: () =>
|
|
1300
|
-
isBanned:
|
|
1271
|
+
onReplyClick: () => _(!K),
|
|
1272
|
+
isBanned: x
|
|
1301
1273
|
}
|
|
1302
1274
|
),
|
|
1303
|
-
a && t.repliesCount > 0 && /* @__PURE__ */ n("div", { css: O.repliesRow, children: /* @__PURE__ */
|
|
1275
|
+
a && t.repliesCount > 0 && /* @__PURE__ */ n("div", { css: O.repliesRow, children: /* @__PURE__ */ b(
|
|
1304
1276
|
"p",
|
|
1305
1277
|
{
|
|
1306
1278
|
css: O.repliesToggle,
|
|
1307
|
-
onClick: () => oe(!
|
|
1279
|
+
onClick: () => oe(!j),
|
|
1308
1280
|
children: [
|
|
1309
|
-
|
|
1281
|
+
j ? R("discussion.hideReplies", "Hide replies") : R("discussion.repliesCount", "{{count}} replies", {
|
|
1310
1282
|
count: t.repliesCount
|
|
1311
1283
|
}),
|
|
1312
|
-
!
|
|
1284
|
+
!j && " ▼"
|
|
1313
1285
|
]
|
|
1314
1286
|
}
|
|
1315
1287
|
) }),
|
|
1316
|
-
|
|
1317
|
-
|
|
1288
|
+
K && !P && /* @__PURE__ */ n("div", { css: O.nested, children: /* @__PURE__ */ n(
|
|
1289
|
+
ft,
|
|
1318
1290
|
{
|
|
1319
|
-
onSubmit:
|
|
1291
|
+
onSubmit: U,
|
|
1320
1292
|
userIsLoggedIn: i,
|
|
1321
1293
|
onSignInClick: s,
|
|
1322
|
-
placeholder:
|
|
1323
|
-
isSubmitting:
|
|
1294
|
+
placeholder: R("discussion.writeReply", "Write a reply..."),
|
|
1295
|
+
isSubmitting: f,
|
|
1324
1296
|
replyTo: ((ae = t.userModel) == null ? void 0 : ae.name) || t.anonymousNickname,
|
|
1325
|
-
onCancel: () =>
|
|
1326
|
-
disabled:
|
|
1297
|
+
onCancel: () => _(!1),
|
|
1298
|
+
disabled: x
|
|
1327
1299
|
}
|
|
1328
1300
|
) }),
|
|
1329
|
-
|
|
1330
|
-
|
|
1301
|
+
j && q.length > 0 && /* @__PURE__ */ n("div", { css: O.nested, children: q.map((h) => /* @__PURE__ */ n(
|
|
1302
|
+
yt,
|
|
1331
1303
|
{
|
|
1332
|
-
post:
|
|
1304
|
+
post: h,
|
|
1333
1305
|
sdk: r,
|
|
1334
1306
|
userIsLoggedIn: i,
|
|
1335
1307
|
onSignInClick: s,
|
|
1336
|
-
showReactions:
|
|
1308
|
+
showReactions: u,
|
|
1337
1309
|
showReplies: a,
|
|
1338
1310
|
showReportPost: m,
|
|
1339
1311
|
onReply: d,
|
|
1340
|
-
onReact:
|
|
1312
|
+
onReact: me,
|
|
1341
1313
|
onDelete: Ee,
|
|
1342
|
-
onReport:
|
|
1343
|
-
isSubmitting:
|
|
1344
|
-
showModeratedPosts:
|
|
1345
|
-
isBanned:
|
|
1314
|
+
onReport: y,
|
|
1315
|
+
isSubmitting: f,
|
|
1316
|
+
showModeratedPosts: k,
|
|
1317
|
+
isBanned: x,
|
|
1346
1318
|
depth: v + 1,
|
|
1347
|
-
parentPostId: v === 0 ? t.id :
|
|
1348
|
-
onReplyCreated: v === 0 ?
|
|
1349
|
-
onDeleteSuccess:
|
|
1319
|
+
parentPostId: v === 0 ? t.id : p,
|
|
1320
|
+
onReplyCreated: v === 0 ? X : void 0,
|
|
1321
|
+
onDeleteSuccess: M
|
|
1350
1322
|
},
|
|
1351
|
-
|
|
1323
|
+
h.id
|
|
1352
1324
|
)) })
|
|
1353
1325
|
] })
|
|
1354
1326
|
] }),
|
|
1355
1327
|
/* @__PURE__ */ n(
|
|
1356
|
-
|
|
1328
|
+
io,
|
|
1357
1329
|
{
|
|
1358
1330
|
open: ne,
|
|
1359
1331
|
onClose: () => pe(!1),
|
|
1360
1332
|
onConfirm: async () => {
|
|
1361
|
-
await c(t.id),
|
|
1333
|
+
await c(t.id), M == null || M();
|
|
1362
1334
|
},
|
|
1363
|
-
onError: (
|
|
1335
|
+
onError: (h) => C(h, "error")
|
|
1364
1336
|
}
|
|
1365
1337
|
),
|
|
1366
1338
|
/* @__PURE__ */ n(
|
|
1367
|
-
|
|
1339
|
+
ao,
|
|
1368
1340
|
{
|
|
1369
|
-
open:
|
|
1341
|
+
open: Q,
|
|
1370
1342
|
onClose: () => de(!1),
|
|
1371
|
-
onSubmit: (
|
|
1372
|
-
onSuccess: (
|
|
1373
|
-
onError: (
|
|
1343
|
+
onSubmit: (h, $) => y(t.id, h, $),
|
|
1344
|
+
onSuccess: (h) => C(h, "success"),
|
|
1345
|
+
onError: (h) => C(h, "error")
|
|
1374
1346
|
}
|
|
1375
1347
|
),
|
|
1376
1348
|
/* @__PURE__ */ n(
|
|
1377
|
-
|
|
1349
|
+
dt,
|
|
1378
1350
|
{
|
|
1379
1351
|
notification: re,
|
|
1380
|
-
onClose: () => ie((
|
|
1352
|
+
onClose: () => ie((h) => ({ ...h, open: !1 }))
|
|
1381
1353
|
}
|
|
1382
1354
|
)
|
|
1383
1355
|
]
|
|
1384
1356
|
}
|
|
1385
1357
|
);
|
|
1386
|
-
},
|
|
1358
|
+
}, He = 864e5, st = -1, Be = o(z.bodyMd, { fontSize: "0.8125em", color: e.textSecondary }), at = o({ transition: "transform 0.2s" }), L = {
|
|
1387
1359
|
root: o({
|
|
1388
1360
|
fontSize: "1em",
|
|
1389
1361
|
marginBottom: e.spaceSm,
|
|
@@ -1417,7 +1389,7 @@ const _t = (t, r) => {
|
|
|
1417
1389
|
paddingInline: e.spaceXs,
|
|
1418
1390
|
paddingBlock: "0.125em"
|
|
1419
1391
|
}),
|
|
1420
|
-
meta:
|
|
1392
|
+
meta: Be,
|
|
1421
1393
|
reasonBox: o({
|
|
1422
1394
|
marginTop: e.spaceSm,
|
|
1423
1395
|
paddingInline: e.spaceSm,
|
|
@@ -1443,98 +1415,98 @@ const _t = (t, r) => {
|
|
|
1443
1415
|
backgroundColor: "transparent",
|
|
1444
1416
|
cursor: "pointer"
|
|
1445
1417
|
}),
|
|
1446
|
-
chevron: { closed:
|
|
1418
|
+
chevron: { closed: at, open: o(at, { transform: "rotate(180deg)" }) },
|
|
1447
1419
|
list: o({ listStyle: "none", margin: 0, padding: 0, marginTop: e.spaceXs }),
|
|
1448
1420
|
entry: o({ paddingBlock: e.spaceXs, borderTop: `1px solid ${e.danger33}` }),
|
|
1449
|
-
entryDates: o(
|
|
1450
|
-
entryReason: o(
|
|
1451
|
-
entryLifted: o(
|
|
1421
|
+
entryDates: o(Be, { fontWeight: 600, color: e.text }),
|
|
1422
|
+
entryReason: o(Be, { unicodeBidi: "plaintext" }),
|
|
1423
|
+
entryLifted: o(Be, { fontStyle: "italic" }),
|
|
1452
1424
|
isolate: o({ unicodeBidi: "isolate" })
|
|
1453
|
-
},
|
|
1425
|
+
}, mo = ({
|
|
1454
1426
|
ban: t,
|
|
1455
1427
|
showBanHistory: r = !1
|
|
1456
1428
|
}) => {
|
|
1457
|
-
const { t: i } =
|
|
1429
|
+
const { t: i } = be(), { language: s } = Ke(Ue), [u, a] = I(!1), m = ut(s), d = (g) => new Date(g).toLocaleDateString(m, { dateStyle: "medium" }), l = (g) => new Date(g).toLocaleString(m, {
|
|
1458
1430
|
dateStyle: "medium",
|
|
1459
1431
|
timeStyle: "short"
|
|
1460
|
-
}), { activeBan: c } = t,
|
|
1461
|
-
new Date(c.bannedAt).getTime() + c.bannedPeriodInDays *
|
|
1462
|
-
),
|
|
1432
|
+
}), { activeBan: c } = t, y = c.bannedPeriodInDays === st, f = new Date(
|
|
1433
|
+
new Date(c.bannedAt).getTime() + c.bannedPeriodInDays * He
|
|
1434
|
+
), k = Math.max(
|
|
1463
1435
|
1,
|
|
1464
|
-
Math.ceil((
|
|
1465
|
-
),
|
|
1436
|
+
Math.ceil((f.getTime() - Date.now()) / He)
|
|
1437
|
+
), x = (t.history || []).filter(
|
|
1466
1438
|
(g) => g.bannedAt !== c.bannedAt
|
|
1467
1439
|
);
|
|
1468
|
-
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(
|
|
1470
|
-
/* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */ b("div", { css: L.row, children: [
|
|
1441
|
+
/* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(Vt, { size: "1.25em", color: e.icon }) }),
|
|
1442
|
+
/* @__PURE__ */ b("div", { css: L.body, children: [
|
|
1471
1443
|
/* @__PURE__ */ n("p", { css: L.title, children: i("discussion.ban.title", "You've been banned from commenting") }),
|
|
1472
|
-
/* @__PURE__ */ n("p", { css: L.description, children:
|
|
1444
|
+
/* @__PURE__ */ n("p", { css: L.description, children: y ? i(
|
|
1473
1445
|
"discussion.ban.descriptionPermanent",
|
|
1474
1446
|
"You can still read the discussion, but you can no longer post, reply or react."
|
|
1475
1447
|
) : i(
|
|
1476
1448
|
"discussion.ban.description",
|
|
1477
1449
|
"You can still read the discussion, but you can't post, reply or react until the ban ends."
|
|
1478
1450
|
) }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */ n("span", { css: L.pill, children:
|
|
1481
|
-
count:
|
|
1451
|
+
/* @__PURE__ */ b("div", { css: L.pills, children: [
|
|
1452
|
+
/* @__PURE__ */ n("span", { css: L.pill, children: y ? i("discussion.ban.permanent", "Permanent ban") : i("discussion.ban.daysLeft", "{{count}} days left", {
|
|
1453
|
+
count: k
|
|
1482
1454
|
}) }),
|
|
1483
1455
|
/* @__PURE__ */ n("span", { css: L.meta, children: i("discussion.ban.since", "Since {{date}}", {
|
|
1484
1456
|
date: d(c.bannedAt)
|
|
1485
1457
|
}) }),
|
|
1486
|
-
!
|
|
1458
|
+
!y && /* @__PURE__ */ b("span", { css: L.meta, children: [
|
|
1487
1459
|
"·",
|
|
1488
1460
|
" ",
|
|
1489
1461
|
i("discussion.ban.until", "Until {{date}}", {
|
|
1490
|
-
date: l(
|
|
1462
|
+
date: l(f)
|
|
1491
1463
|
})
|
|
1492
1464
|
] })
|
|
1493
1465
|
] }),
|
|
1494
|
-
c.bannedReason && /* @__PURE__ */
|
|
1466
|
+
c.bannedReason && /* @__PURE__ */ b("div", { css: L.reasonBox, children: [
|
|
1495
1467
|
/* @__PURE__ */ n("span", { css: L.reasonLabel, children: i("discussion.ban.reason", "Reason") }),
|
|
1496
1468
|
/* @__PURE__ */ n("p", { css: L.reason, children: c.bannedReason })
|
|
1497
1469
|
] }),
|
|
1498
|
-
r &&
|
|
1499
|
-
/* @__PURE__ */
|
|
1470
|
+
r && x.length > 0 && /* @__PURE__ */ b("div", { css: L.history, children: [
|
|
1471
|
+
/* @__PURE__ */ b(
|
|
1500
1472
|
"button",
|
|
1501
1473
|
{
|
|
1502
1474
|
type: "button",
|
|
1503
|
-
"aria-expanded":
|
|
1475
|
+
"aria-expanded": u,
|
|
1504
1476
|
onClick: () => a((g) => !g),
|
|
1505
1477
|
css: L.toggle,
|
|
1506
1478
|
children: [
|
|
1507
1479
|
i("discussion.ban.previousBans", "Previous bans ({{count}})", {
|
|
1508
|
-
count:
|
|
1480
|
+
count: x.length
|
|
1509
1481
|
}),
|
|
1510
1482
|
/* @__PURE__ */ n(
|
|
1511
|
-
|
|
1483
|
+
_t,
|
|
1512
1484
|
{
|
|
1513
1485
|
size: "1.25em",
|
|
1514
1486
|
color: e.icon,
|
|
1515
|
-
css:
|
|
1487
|
+
css: u ? L.chevron.open : L.chevron.closed
|
|
1516
1488
|
}
|
|
1517
1489
|
)
|
|
1518
1490
|
]
|
|
1519
1491
|
}
|
|
1520
1492
|
),
|
|
1521
|
-
|
|
1522
|
-
const
|
|
1523
|
-
new Date(g.bannedAt).getTime() + g.bannedPeriodInDays *
|
|
1493
|
+
u && /* @__PURE__ */ n("ul", { css: L.list, children: x.map((g) => {
|
|
1494
|
+
const E = g.unbannedAt ?? (g.bannedPeriodInDays > 0 ? new Date(
|
|
1495
|
+
new Date(g.bannedAt).getTime() + g.bannedPeriodInDays * He
|
|
1524
1496
|
) : null);
|
|
1525
|
-
return /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1497
|
+
return /* @__PURE__ */ b("li", { css: L.entry, children: [
|
|
1498
|
+
/* @__PURE__ */ b("p", { css: L.entryDates, children: [
|
|
1527
1499
|
d(g.bannedAt),
|
|
1528
|
-
|
|
1529
|
-
g.bannedPeriodInDays ===
|
|
1500
|
+
E && ` – ${d(E)}`,
|
|
1501
|
+
g.bannedPeriodInDays === st && ` · ${i("discussion.ban.permanent", "Permanent ban")}`,
|
|
1530
1502
|
g.bannedPeriodInDays > 0 && ` · ${i("discussion.ban.days", "{{count}} days", { count: g.bannedPeriodInDays })}`
|
|
1531
1503
|
] }),
|
|
1532
1504
|
g.bannedReason && /* @__PURE__ */ n("p", { css: L.entryReason, children: g.bannedReason }),
|
|
1533
|
-
g.unbannedAt && /* @__PURE__ */
|
|
1505
|
+
g.unbannedAt && /* @__PURE__ */ b("p", { css: L.entryLifted, children: [
|
|
1534
1506
|
i("discussion.ban.lifted", "Lifted on {{date}}", {
|
|
1535
1507
|
date: d(g.unbannedAt)
|
|
1536
1508
|
}),
|
|
1537
|
-
g.unbannedReason && /* @__PURE__ */
|
|
1509
|
+
g.unbannedReason && /* @__PURE__ */ b(Re, { children: [
|
|
1538
1510
|
": ",
|
|
1539
1511
|
/* @__PURE__ */ n("span", { css: L.isolate, children: g.unbannedReason })
|
|
1540
1512
|
] })
|
|
@@ -1547,7 +1519,7 @@ const _t = (t, r) => {
|
|
|
1547
1519
|
}, fo = (t) => {
|
|
1548
1520
|
var r, i, s;
|
|
1549
1521
|
return (((r = t == null ? void 0 : t.error) == null ? void 0 : r.code) ?? ((s = (i = t == null ? void 0 : t.data) == null ? void 0 : i.error) == null ? void 0 : s.code) ?? (t == null ? void 0 : t.status)) === 429;
|
|
1550
|
-
},
|
|
1522
|
+
}, ct = { display: "flex", alignItems: "center", marginInlineStart: "0.5em", marginInlineEnd: "-2px" }, we = {
|
|
1551
1523
|
root: o({
|
|
1552
1524
|
boxSizing: "border-box",
|
|
1553
1525
|
position: "relative",
|
|
@@ -1596,8 +1568,8 @@ const _t = (t, r) => {
|
|
|
1596
1568
|
cursor: "pointer"
|
|
1597
1569
|
}),
|
|
1598
1570
|
// Joy's icon grey on the svg only; open, it takes the field's colour.
|
|
1599
|
-
indicatorClosed: o({ ...
|
|
1600
|
-
indicatorOpen: o(
|
|
1571
|
+
indicatorClosed: o({ ...ct, "& svg": { color: e.icon } }),
|
|
1572
|
+
indicatorOpen: o(ct),
|
|
1601
1573
|
list: o({
|
|
1602
1574
|
position: "fixed",
|
|
1603
1575
|
zIndex: 1300,
|
|
@@ -1637,26 +1609,26 @@ const _t = (t, r) => {
|
|
|
1637
1609
|
cursor: "pointer",
|
|
1638
1610
|
"&:hover, &[aria-selected='true']": { backgroundColor: e.surfaceVariant }
|
|
1639
1611
|
})
|
|
1640
|
-
},
|
|
1612
|
+
}, go = ({ value: t, options: r, onChange: i }) => {
|
|
1641
1613
|
var l;
|
|
1642
1614
|
const s = wt(
|
|
1643
1615
|
r.map((c) => c.value),
|
|
1644
1616
|
t,
|
|
1645
1617
|
(c) => i(c)
|
|
1646
|
-
),
|
|
1647
|
-
var
|
|
1648
|
-
const
|
|
1649
|
-
(
|
|
1618
|
+
), u = V(null), a = V(null), m = ht(s.open, s.rootRef, a, "start"), d = (c) => {
|
|
1619
|
+
var f, k, x;
|
|
1620
|
+
const y = c.target;
|
|
1621
|
+
(f = u.current) != null && f.contains(y) || (k = a.current) != null && k.contains(y) || ((x = u.current) == null || x.focus(), s.triggerProps.onClick());
|
|
1650
1622
|
};
|
|
1651
|
-
return /* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */ n("button", { ref:
|
|
1653
|
-
/* @__PURE__ */ n("span", { css: s.open ?
|
|
1654
|
-
s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css:
|
|
1623
|
+
return /* @__PURE__ */ b("div", { ref: s.rootRef, css: we.root, onClick: d, children: [
|
|
1624
|
+
/* @__PURE__ */ n("button", { ref: u, ...s.triggerProps, css: we.button, children: (l = r.find((c) => c.value === t)) == null ? void 0 : l.label }),
|
|
1625
|
+
/* @__PURE__ */ n("span", { css: s.open ? we.indicatorOpen : we.indicatorClosed, children: /* @__PURE__ */ n(jt, {}) }),
|
|
1626
|
+
s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css: we.list, style: m, children: r.map((c, y) => /* @__PURE__ */ n("li", { ...s.optionProps(y), css: we.option, children: c.label }, c.value)) })
|
|
1655
1627
|
] });
|
|
1656
1628
|
}, te = {
|
|
1657
1629
|
root: o({ marginInline: "auto", maxHeight: "100%", overflowY: "auto", backgroundColor: e.surface }),
|
|
1658
1630
|
header: o({ marginBottom: e.spaceLg }),
|
|
1659
|
-
title: o(z.h3, { marginBottom: e.spaceXs }),
|
|
1631
|
+
title: o(z.h3, { marginBottom: e.spaceXs, unicodeBidi: "plaintext" }),
|
|
1660
1632
|
count: o(z.bodySm, { color: e.textSecondary }),
|
|
1661
1633
|
divider: o({
|
|
1662
1634
|
position: "relative",
|
|
@@ -1680,267 +1652,267 @@ const _t = (t, r) => {
|
|
|
1680
1652
|
sentinel: o({ height: "1px" }),
|
|
1681
1653
|
moreSpinner: o({ paddingBlock: e.spaceMd }),
|
|
1682
1654
|
loadMore: o({ display: "flex", justifyContent: "center", marginTop: e.spaceLg })
|
|
1683
|
-
},
|
|
1655
|
+
}, ho = ({
|
|
1684
1656
|
discussion: t,
|
|
1685
1657
|
posts: r,
|
|
1686
1658
|
postsHidden: i = !1,
|
|
1687
1659
|
sdk: s,
|
|
1688
|
-
userIsLoggedIn:
|
|
1660
|
+
userIsLoggedIn: u,
|
|
1689
1661
|
onSignInClick: a,
|
|
1690
1662
|
showReactions: m,
|
|
1691
1663
|
showReplies: d,
|
|
1692
1664
|
showReportPost: l,
|
|
1693
1665
|
currentSort: c,
|
|
1694
|
-
onSortChange:
|
|
1695
|
-
onCreatePost:
|
|
1696
|
-
onReact:
|
|
1697
|
-
onDeletePost:
|
|
1666
|
+
onSortChange: y,
|
|
1667
|
+
onCreatePost: f,
|
|
1668
|
+
onReact: k,
|
|
1669
|
+
onDeletePost: x,
|
|
1698
1670
|
onReportPost: g,
|
|
1699
|
-
onLoadMore:
|
|
1700
|
-
hasMore:
|
|
1671
|
+
onLoadMore: E,
|
|
1672
|
+
hasMore: T,
|
|
1701
1673
|
liveRefresh: v = !1,
|
|
1702
|
-
newPostIds:
|
|
1703
|
-
onNewPostSeen:
|
|
1704
|
-
isLoading:
|
|
1705
|
-
isSubmitting:
|
|
1706
|
-
infiniteScroll:
|
|
1674
|
+
newPostIds: p,
|
|
1675
|
+
onNewPostSeen: D,
|
|
1676
|
+
isLoading: M,
|
|
1677
|
+
isSubmitting: R,
|
|
1678
|
+
infiniteScroll: F = !1,
|
|
1707
1679
|
showModeratedPosts: J = !1,
|
|
1708
|
-
ban:
|
|
1709
|
-
isBanned:
|
|
1680
|
+
ban: K,
|
|
1681
|
+
isBanned: _ = !1,
|
|
1710
1682
|
showBanHistory: q = !1
|
|
1711
1683
|
}) => {
|
|
1712
|
-
const { t:
|
|
1684
|
+
const { t: B } = be(), j = Ve(), oe = V(null), ne = V(null);
|
|
1713
1685
|
he(() => {
|
|
1714
|
-
if (
|
|
1686
|
+
if (!F || !ne.current) return;
|
|
1715
1687
|
const P = new IntersectionObserver(
|
|
1716
|
-
(
|
|
1717
|
-
|
|
1688
|
+
(U) => {
|
|
1689
|
+
U[0].isIntersecting && T && !M && E();
|
|
1718
1690
|
},
|
|
1719
1691
|
{ root: oe.current, threshold: 0.1 }
|
|
1720
1692
|
);
|
|
1721
1693
|
return P.observe(ne.current), () => P.disconnect();
|
|
1722
|
-
}, [
|
|
1723
|
-
const [pe,
|
|
1724
|
-
|
|
1694
|
+
}, [F, T, M, E]);
|
|
1695
|
+
const [pe, Q] = I({ open: !1, variant: "success", title: "", message: "" }), de = () => {
|
|
1696
|
+
Q({
|
|
1725
1697
|
open: !0,
|
|
1726
1698
|
variant: "success",
|
|
1727
1699
|
title: "",
|
|
1728
|
-
message:
|
|
1700
|
+
message: B("discussion.delete.success", "Comment deleted successfully.")
|
|
1729
1701
|
});
|
|
1730
|
-
}, re = (P,
|
|
1731
|
-
|
|
1702
|
+
}, re = (P, U) => {
|
|
1703
|
+
pt(P) || Q({
|
|
1732
1704
|
open: !0,
|
|
1733
1705
|
variant: "error",
|
|
1734
1706
|
title: "",
|
|
1735
|
-
message: fo(P) ?
|
|
1707
|
+
message: fo(P) ? B(
|
|
1736
1708
|
"discussion.rateLimited",
|
|
1737
1709
|
"You're doing that too often. Please wait a moment and try again."
|
|
1738
|
-
) :
|
|
1710
|
+
) : U
|
|
1739
1711
|
});
|
|
1740
|
-
}, ie = async (P,
|
|
1712
|
+
}, ie = async (P, U) => {
|
|
1741
1713
|
try {
|
|
1742
|
-
return await
|
|
1743
|
-
} catch (
|
|
1714
|
+
return await k(P, U);
|
|
1715
|
+
} catch (X) {
|
|
1744
1716
|
throw re(
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
),
|
|
1717
|
+
X,
|
|
1718
|
+
B("discussion.reactError", "Failed to add reaction. Please try again.")
|
|
1719
|
+
), X;
|
|
1748
1720
|
}
|
|
1749
|
-
},
|
|
1721
|
+
}, Z = async (P, U) => {
|
|
1750
1722
|
try {
|
|
1751
|
-
await
|
|
1752
|
-
} catch (
|
|
1723
|
+
await f(P, U);
|
|
1724
|
+
} catch (X) {
|
|
1753
1725
|
throw re(
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
),
|
|
1726
|
+
X,
|
|
1727
|
+
B("discussion.postError", "Failed to post comment. Please try again.")
|
|
1728
|
+
), X;
|
|
1757
1729
|
}
|
|
1758
|
-
|
|
1730
|
+
Q({
|
|
1759
1731
|
open: !0,
|
|
1760
1732
|
variant: "success",
|
|
1761
1733
|
title: "",
|
|
1762
|
-
message:
|
|
1734
|
+
message: B("discussion.postSuccess", "Comment posted successfully.")
|
|
1763
1735
|
});
|
|
1764
1736
|
}, se = [
|
|
1765
|
-
{ value: "LATEST", label:
|
|
1766
|
-
{ value: "OLDEST", label:
|
|
1767
|
-
{ value: "POPULAR", label:
|
|
1737
|
+
{ value: "LATEST", label: B("discussion.sort.latest", "Latest") },
|
|
1738
|
+
{ value: "OLDEST", label: B("discussion.sort.oldest", "Oldest") },
|
|
1739
|
+
{ value: "POPULAR", label: B("discussion.sort.popular", "Popular") },
|
|
1768
1740
|
{
|
|
1769
1741
|
value: "INTERACTED",
|
|
1770
|
-
label:
|
|
1742
|
+
label: B("discussion.sort.interacted", "Most Interacted")
|
|
1771
1743
|
}
|
|
1772
1744
|
];
|
|
1773
|
-
return /* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */ n("h3", { css: te.title, children: t.label ||
|
|
1776
|
-
!i && /* @__PURE__ */ n("p", { css: te.count, children:
|
|
1745
|
+
return /* @__PURE__ */ b("div", { ref: oe, css: te.root, style: j, children: [
|
|
1746
|
+
/* @__PURE__ */ b("div", { css: te.header, children: [
|
|
1747
|
+
/* @__PURE__ */ n("h3", { css: te.title, children: t.label || B("discussion.title", "Discussion") }),
|
|
1748
|
+
!i && /* @__PURE__ */ n("p", { css: te.count, children: B("discussion.postsCount", "{{count}} posts", {
|
|
1777
1749
|
count: t.postsCount || 0
|
|
1778
1750
|
}) })
|
|
1779
1751
|
] }),
|
|
1780
|
-
|
|
1752
|
+
_ && K && /* @__PURE__ */ n(mo, { ban: K, showBanHistory: q }),
|
|
1781
1753
|
/* @__PURE__ */ n(
|
|
1782
|
-
|
|
1754
|
+
ft,
|
|
1783
1755
|
{
|
|
1784
|
-
onSubmit: (P) =>
|
|
1785
|
-
userIsLoggedIn:
|
|
1756
|
+
onSubmit: (P) => Z(P),
|
|
1757
|
+
userIsLoggedIn: u,
|
|
1786
1758
|
onSignInClick: a,
|
|
1787
|
-
isSubmitting:
|
|
1788
|
-
disabled:
|
|
1759
|
+
isSubmitting: R,
|
|
1760
|
+
disabled: _
|
|
1789
1761
|
}
|
|
1790
1762
|
),
|
|
1791
|
-
!i && /* @__PURE__ */
|
|
1763
|
+
!i && /* @__PURE__ */ b(Re, { children: [
|
|
1792
1764
|
/* @__PURE__ */ n("hr", { css: te.divider }),
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */ n("p", { css: z.titleMd, children:
|
|
1795
|
-
/* @__PURE__ */ n(
|
|
1765
|
+
/* @__PURE__ */ b("div", { css: te.sortRow, children: [
|
|
1766
|
+
/* @__PURE__ */ n("p", { css: z.titleMd, children: B("discussion.comments", "Comments") }),
|
|
1767
|
+
/* @__PURE__ */ n(go, { value: c, options: se, onChange: y })
|
|
1796
1768
|
] }),
|
|
1797
|
-
|
|
1769
|
+
M && r.length === 0 ? /* @__PURE__ */ n("div", { css: te.listSpinner, children: /* @__PURE__ */ n(Oe, { marginBlock: "32px" }) }) : r.length === 0 ? /* @__PURE__ */ n("div", { css: te.empty, children: /* @__PURE__ */ n("p", { css: te.emptyText, children: B(
|
|
1798
1770
|
"discussion.noPosts",
|
|
1799
1771
|
"No comments yet. Be the first to comment!"
|
|
1800
|
-
) }) }) : /* @__PURE__ */
|
|
1772
|
+
) }) }) : /* @__PURE__ */ b(Re, { children: [
|
|
1801
1773
|
/* @__PURE__ */ n("div", { children: r.map((P) => /* @__PURE__ */ n(
|
|
1802
|
-
|
|
1774
|
+
yt,
|
|
1803
1775
|
{
|
|
1804
1776
|
post: P,
|
|
1805
1777
|
sdk: s,
|
|
1806
|
-
userIsLoggedIn:
|
|
1778
|
+
userIsLoggedIn: u,
|
|
1807
1779
|
onSignInClick: a,
|
|
1808
1780
|
showReactions: m,
|
|
1809
1781
|
showReplies: d,
|
|
1810
1782
|
showReportPost: l,
|
|
1811
|
-
onReply: (
|
|
1783
|
+
onReply: (U, X) => Z(X, U),
|
|
1812
1784
|
onReact: ie,
|
|
1813
|
-
onDelete:
|
|
1785
|
+
onDelete: x,
|
|
1814
1786
|
onReport: g,
|
|
1815
|
-
isSubmitting:
|
|
1787
|
+
isSubmitting: R,
|
|
1816
1788
|
showModeratedPosts: J,
|
|
1817
|
-
isBanned:
|
|
1789
|
+
isBanned: _,
|
|
1818
1790
|
highlightable: v,
|
|
1819
|
-
isNew:
|
|
1820
|
-
onNewSeen:
|
|
1791
|
+
isNew: p == null ? void 0 : p.has(P.id),
|
|
1792
|
+
onNewSeen: D,
|
|
1821
1793
|
onDeleteSuccess: de
|
|
1822
1794
|
},
|
|
1823
1795
|
P.id
|
|
1824
1796
|
)) }),
|
|
1825
|
-
|
|
1797
|
+
F && /* @__PURE__ */ n("div", { ref: ne, css: te.sentinel })
|
|
1826
1798
|
] }),
|
|
1827
|
-
|
|
1828
|
-
|
|
1799
|
+
F && M && r.length > 0 && /* @__PURE__ */ n("div", { css: te.moreSpinner, children: /* @__PURE__ */ n(Oe, { marginBlock: "16px" }) }),
|
|
1800
|
+
!F && T && /* @__PURE__ */ n("div", { css: te.loadMore, children: /* @__PURE__ */ n(ue, { look: "outlined", onClick: E, loading: M, children: B("discussion.loadMore", "Load More") }) })
|
|
1829
1801
|
] }),
|
|
1830
1802
|
/* @__PURE__ */ n(
|
|
1831
|
-
|
|
1803
|
+
dt,
|
|
1832
1804
|
{
|
|
1833
1805
|
notification: pe,
|
|
1834
|
-
onClose: () =>
|
|
1806
|
+
onClose: () => Q((P) => ({ ...P, open: !1 }))
|
|
1835
1807
|
}
|
|
1836
1808
|
)
|
|
1837
1809
|
] });
|
|
1838
|
-
},
|
|
1810
|
+
}, yo = (t) => {
|
|
1839
1811
|
const {
|
|
1840
1812
|
entityId: r,
|
|
1841
1813
|
sdk: i,
|
|
1842
1814
|
discussionLabel: s,
|
|
1843
|
-
discussionUrl:
|
|
1815
|
+
discussionUrl: u = "",
|
|
1844
1816
|
defaultSort: a = "LATEST",
|
|
1845
1817
|
postsPerPage: m = 20,
|
|
1846
1818
|
showReactions: d = !0,
|
|
1847
1819
|
showReplies: l = !0,
|
|
1848
1820
|
showReportPost: c = !0,
|
|
1849
|
-
infiniteScroll:
|
|
1850
|
-
showModeratedPosts:
|
|
1851
|
-
userIsLoggedIn:
|
|
1852
|
-
showBanHistory:
|
|
1821
|
+
infiniteScroll: y = !1,
|
|
1822
|
+
showModeratedPosts: f = !1,
|
|
1823
|
+
userIsLoggedIn: k = !1,
|
|
1824
|
+
showBanHistory: x = !1,
|
|
1853
1825
|
refreshInterval: g = 0,
|
|
1854
|
-
onSignInClick:
|
|
1855
|
-
} = t, { ban:
|
|
1856
|
-
discussion:
|
|
1857
|
-
setDiscussion:
|
|
1858
|
-
isLoading:
|
|
1859
|
-
error:
|
|
1826
|
+
onSignInClick: E
|
|
1827
|
+
} = t, { ban: T, isBanned: v, refresh: p } = eo(i, k), {
|
|
1828
|
+
discussion: D,
|
|
1829
|
+
setDiscussion: M,
|
|
1830
|
+
isLoading: R,
|
|
1831
|
+
error: F,
|
|
1860
1832
|
isNotFound: J
|
|
1861
|
-
} =
|
|
1833
|
+
} = Gt(i, r), K = () => ({
|
|
1862
1834
|
id: r,
|
|
1863
1835
|
label: "",
|
|
1864
1836
|
postsCount: 0,
|
|
1865
1837
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1866
1838
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1867
|
-
}),
|
|
1868
|
-
|
|
1869
|
-
const
|
|
1870
|
-
return { ...
|
|
1839
|
+
}), _ = (me) => {
|
|
1840
|
+
M((C) => {
|
|
1841
|
+
const S = C ?? K();
|
|
1842
|
+
return { ...S, postsCount: Math.max(0, S.postsCount + me) };
|
|
1871
1843
|
});
|
|
1872
1844
|
}, {
|
|
1873
1845
|
posts: q,
|
|
1874
|
-
postsHidden:
|
|
1875
|
-
isLoading:
|
|
1846
|
+
postsHidden: B,
|
|
1847
|
+
isLoading: j,
|
|
1876
1848
|
isSubmitting: oe,
|
|
1877
1849
|
currentSort: ne,
|
|
1878
1850
|
hasMore: pe,
|
|
1879
|
-
newPostIds:
|
|
1851
|
+
newPostIds: Q,
|
|
1880
1852
|
markPostSeen: de,
|
|
1881
1853
|
handleSortChange: re,
|
|
1882
1854
|
handleLoadMore: ie,
|
|
1883
|
-
handleCreatePost:
|
|
1855
|
+
handleCreatePost: Z,
|
|
1884
1856
|
handleReact: se,
|
|
1885
1857
|
handleDeletePost: P,
|
|
1886
|
-
handleReportPost:
|
|
1887
|
-
} =
|
|
1858
|
+
handleReportPost: U
|
|
1859
|
+
} = Qt(
|
|
1888
1860
|
i,
|
|
1889
1861
|
r,
|
|
1890
1862
|
s || null,
|
|
1891
|
-
|
|
1863
|
+
u,
|
|
1892
1864
|
a,
|
|
1893
1865
|
m,
|
|
1894
|
-
|
|
1895
|
-
|
|
1866
|
+
_,
|
|
1867
|
+
f,
|
|
1896
1868
|
g
|
|
1897
|
-
),
|
|
1869
|
+
), X = (me) => async (...C) => {
|
|
1898
1870
|
try {
|
|
1899
|
-
return await
|
|
1900
|
-
} catch (
|
|
1901
|
-
throw
|
|
1871
|
+
return await me(...C);
|
|
1872
|
+
} catch (S) {
|
|
1873
|
+
throw pt(S) && p(), S;
|
|
1902
1874
|
}
|
|
1903
1875
|
};
|
|
1904
|
-
if (
|
|
1905
|
-
return /* @__PURE__ */ n(
|
|
1906
|
-
if (
|
|
1876
|
+
if (R || !D && !J && j)
|
|
1877
|
+
return /* @__PURE__ */ n(Oe, { marginBlock: "160px" });
|
|
1878
|
+
if (F)
|
|
1907
1879
|
return /* @__PURE__ */ n("div", { style: { padding: "20px", textAlign: "center" }, children: /* @__PURE__ */ n("p", { children: "Failed to load discussion. Please try again later." }) });
|
|
1908
|
-
const Ee = async (
|
|
1909
|
-
await
|
|
1880
|
+
const Ee = async (me, C) => {
|
|
1881
|
+
await Z(me, C), s && M((S) => ({ ...S ?? K(), label: s }));
|
|
1910
1882
|
};
|
|
1911
1883
|
return /* @__PURE__ */ n(
|
|
1912
|
-
|
|
1884
|
+
ho,
|
|
1913
1885
|
{
|
|
1914
|
-
discussion:
|
|
1886
|
+
discussion: D ?? K(),
|
|
1915
1887
|
posts: q,
|
|
1916
|
-
postsHidden:
|
|
1888
|
+
postsHidden: B,
|
|
1917
1889
|
sdk: i,
|
|
1918
|
-
userIsLoggedIn:
|
|
1919
|
-
onSignInClick:
|
|
1890
|
+
userIsLoggedIn: k,
|
|
1891
|
+
onSignInClick: E,
|
|
1920
1892
|
showReactions: d,
|
|
1921
1893
|
showReplies: l,
|
|
1922
1894
|
showReportPost: c,
|
|
1923
1895
|
currentSort: ne,
|
|
1924
1896
|
onSortChange: re,
|
|
1925
|
-
onCreatePost:
|
|
1926
|
-
onReact:
|
|
1927
|
-
onDeletePost:
|
|
1928
|
-
onReportPost:
|
|
1897
|
+
onCreatePost: X(Ee),
|
|
1898
|
+
onReact: X(se),
|
|
1899
|
+
onDeletePost: X(P),
|
|
1900
|
+
onReportPost: X(U),
|
|
1929
1901
|
onLoadMore: ie,
|
|
1930
1902
|
hasMore: pe,
|
|
1931
1903
|
liveRefresh: g > 0,
|
|
1932
|
-
newPostIds:
|
|
1904
|
+
newPostIds: Q,
|
|
1933
1905
|
onNewPostSeen: de,
|
|
1934
|
-
isLoading:
|
|
1906
|
+
isLoading: j,
|
|
1935
1907
|
isSubmitting: oe,
|
|
1936
|
-
infiniteScroll:
|
|
1937
|
-
showModeratedPosts:
|
|
1938
|
-
ban:
|
|
1908
|
+
infiniteScroll: y,
|
|
1909
|
+
showModeratedPosts: f,
|
|
1910
|
+
ban: T,
|
|
1939
1911
|
isBanned: v,
|
|
1940
|
-
showBanHistory:
|
|
1912
|
+
showBanHistory: x
|
|
1941
1913
|
}
|
|
1942
1914
|
);
|
|
1943
|
-
},
|
|
1915
|
+
}, Io = (t) => /* @__PURE__ */ n(
|
|
1944
1916
|
Ct,
|
|
1945
1917
|
{
|
|
1946
1918
|
packageName: "discussion",
|
|
@@ -1948,9 +1920,9 @@ const _t = (t, r) => {
|
|
|
1948
1920
|
themeOptions: t.themeOptions,
|
|
1949
1921
|
disableCache: t.disableCache,
|
|
1950
1922
|
fillHeight: !0,
|
|
1951
|
-
children: /* @__PURE__ */ n(
|
|
1923
|
+
children: /* @__PURE__ */ n(yo, { ...t })
|
|
1952
1924
|
}
|
|
1953
1925
|
);
|
|
1954
1926
|
export {
|
|
1955
|
-
|
|
1927
|
+
Io as M
|
|
1956
1928
|
};
|