fansunited-frontend-components 0.0.97 → 0.0.99
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 +958 -1464
- package/ClassicQuizPlay.js +2 -2
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +2042 -2215
- package/CompetitorCard.js +4281 -4919
- package/Discussion.js +2 -2
- package/EitherOrPlay.js +2 -2
- package/EventCard.js +6010 -7547
- package/EventGamePlay.js +2 -2
- package/Leaderboard.js +546 -849
- package/List.js +227 -218
- package/MatchQuizPlay.js +2 -2
- package/Odds.js +50 -42
- package/PersonalityQuizPlay.js +2 -2
- package/PickThePair.js +2 -2
- package/PlayerOfTheMatch.js +285 -269
- package/PollVote.js +2 -2
- package/Predictor.js +80 -127
- package/README.md +1 -1
- package/Standings.js +991 -1324
- package/TopX.js +1120 -1167
- package/chunks/{ChanceGameEmbedVariant-CVys-3Zh.js → ChanceGameEmbedVariant-DM9eLG5s.js} +2 -2
- package/chunks/CheckCircle-I1FktW5Y.js +13 -0
- package/chunks/OddsSkeleton-DP5Yfqpr.js +522 -0
- package/chunks/Person-CXRqyF4E.js +11 -0
- package/chunks/PickOneOfX-DET4ZhjV.js +3117 -0
- package/chunks/Search-CIXthh0D.js +17 -0
- package/chunks/TimerOutlined-D-WA_vpE.js +8 -0
- package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +136 -0
- package/chunks/{chevrons-right-CXSpQt9w.js → chevrons-right-HWKW2c4I.js} +24 -4
- package/chunks/index-BENM3N_w.js +4 -0
- package/chunks/index-BRxAV693.js +4 -0
- package/chunks/index-BXYTsvIX.js +4 -0
- package/chunks/index-C0ilols1.js +4 -0
- package/chunks/index-D7VhczXH.js +4 -0
- package/chunks/index-DKwvdw9t.js +4 -0
- package/chunks/index-DZN-AITW.js +4 -0
- package/chunks/main-B2sDRFF4.js +2184 -0
- package/chunks/main-CzfWaEQP.js +4869 -0
- package/chunks/main-DFNl3g_U.js +4910 -0
- package/chunks/{main-65WcUqAl.js → main-DLwnvntz.js} +600 -593
- package/chunks/main-DiBlJBNb.js +1956 -0
- package/chunks/main-DxvBjXsd.js +1775 -0
- package/chunks/main-S8_NDSiY.js +3209 -0
- package/chunks/main-lBgr8Liq.js +6571 -0
- package/chunks/{withVersionStamp-BkiEu_79.js → withVersionStamp-BsLyhvNA.js} +1 -1
- package/package.json +2 -2
- package/chunks/OddsSkeleton-ClJE2xhR.js +0 -26
- package/chunks/OddsStrip-BnSp5TXa.js +0 -383
- package/chunks/PickOneOfX-DaJtkbCw.js +0 -4206
- package/chunks/chevron-left-CxfCSZcr.js +0 -13
- package/chunks/chevron-right-BEQMacFn.js +0 -13
- package/chunks/index-Aq5MbUB9.js +0 -4
- package/chunks/index-BBQm_8LD.js +0 -4
- package/chunks/index-BC_sWWgc.js +0 -4
- package/chunks/index-DXKDJ1Vp.js +0 -4
- package/chunks/index-DjT5NrbA.js +0 -4
- package/chunks/index-DvLRehH6.js +0 -4
- package/chunks/index-aIMaxR-p.js +0 -4
- package/chunks/main-52Wff7qC.js +0 -11441
- package/chunks/main-B58mi9jx.js +0 -5622
- package/chunks/main-BIdXUTZS.js +0 -7308
- package/chunks/main-DD-NEzC7.js +0 -8241
- package/chunks/main-DUnfJPzY.js +0 -3608
- package/chunks/main-DpCBqqg_.js +0 -1950
- package/chunks/main-Drznt1ak.js +0 -1790
- package/chunks/users-wbJRbqW8.js +0 -16
- package/chunks/x-CK4GYo7T.js +0 -14
package/chunks/main-DpCBqqg_.js
DELETED
|
@@ -1,1950 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as v, Fragment as Se } from "react/jsx-runtime";
|
|
2
|
-
import { useDisableCache as Oe, useColors as le, useCornerRadius as pe, useFontFamily as Re, useSpacingScale as ce, useConstantContext as ve, ConstantsContext as Ce, toIntlLocale as Te, Notification as Ie, Spinner as Pe, getLanguageDirection as Ke, initializeI18n as We, applyDirectionToMount as He, widgetCacheKey as Ue, createWidgetCache as Ve, ContainerProvider as _e, ThemeProvider as je, ConstantsProvider as Ye } from "fansunited-frontend-core";
|
|
3
|
-
import X, { useState as T, useEffect as fe, useRef as oe, useCallback as ge } from "react";
|
|
4
|
-
import { Box as C, Button as ie, Typography as z, Textarea as Me, IconButton as Ge, Menu as Je, MenuItem as De, Modal as Fe, ModalDialog as $e, ModalClose as Xe, RadioGroup as qe, Radio as Qe, Avatar as Ze, Divider as et, Select as tt, Option as ot } from "@mui/joy";
|
|
5
|
-
import { useTranslation as he } from "react-i18next";
|
|
6
|
-
import { ThumbUp as nt, ThumbDown as rt, Favorite as st, SentimentSatisfied as at, FavoriteBorder as it, EmojiEmotions as lt, SentimentVeryDissatisfied as ct, MoodBad as dt, Reply as ut, MoreVert as mt, Delete as ft, Flag as pt, RemoveCircleOutline as ht, Block as yt, KeyboardArrowDown as xt } from "@mui/icons-material";
|
|
7
|
-
import { CacheProvider as bt } from "@emotion/react";
|
|
8
|
-
import { createPortal as gt } from "react-dom";
|
|
9
|
-
const St = (e, r) => {
|
|
10
|
-
const [s, u] = T(null), [m, n] = T(!0), [i, o] = T(null), [l, a] = T(!1);
|
|
11
|
-
return fe(() => {
|
|
12
|
-
r && (async () => {
|
|
13
|
-
try {
|
|
14
|
-
n(!0);
|
|
15
|
-
const c = await e.discussions.getById(r);
|
|
16
|
-
u(c), o(null), a(!1);
|
|
17
|
-
} catch (c) {
|
|
18
|
-
(e.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? c.error.code === 404 : c.data.error.code === 404) ? (a(!0), o(null), u(null)) : (o(i), u(null), a(!1));
|
|
19
|
-
} finally {
|
|
20
|
-
n(!1);
|
|
21
|
-
}
|
|
22
|
-
})();
|
|
23
|
-
}, [e, r]), { discussion: s, setDiscussion: u, isLoading: m, error: i, isNotFound: l };
|
|
24
|
-
}, Rt = 5e3, vt = 5, Ct = (e, r, s = null, u = "", m = "LATEST", n = 20, i, o = !1, l = 0) => {
|
|
25
|
-
const a = n <= 0, [f, c] = T([]), [y, x] = T(!a), [R, b] = T(!1), [D, g] = T(null), [w, F] = T(m), [L, d] = T(
|
|
26
|
-
null
|
|
27
|
-
), [I, ne] = T(!1), [k, j] = T(() => /* @__PURE__ */ new Set()), M = oe(0), A = ge(
|
|
28
|
-
async (p, S, h = !1) => {
|
|
29
|
-
var B, K;
|
|
30
|
-
h || (M.current += 1, j(/* @__PURE__ */ new Set()));
|
|
31
|
-
try {
|
|
32
|
-
x(!0);
|
|
33
|
-
const W = await e.discussions.getPosts(r, {
|
|
34
|
-
sort: p,
|
|
35
|
-
limit: n,
|
|
36
|
-
startAfter: S,
|
|
37
|
-
skipDeleted: !0,
|
|
38
|
-
skipModerated: !o
|
|
39
|
-
}), te = W.data;
|
|
40
|
-
c(h ? (ae) => [...ae, ...te] : te);
|
|
41
|
-
const J = !!((B = W.meta.pagination) != null && B.nextPageStartsAfter) && te.length === n;
|
|
42
|
-
d(
|
|
43
|
-
((K = W.meta.pagination) == null ? void 0 : K.nextPageStartsAfter) || null
|
|
44
|
-
), ne(J), g(null);
|
|
45
|
-
} catch (W) {
|
|
46
|
-
(e.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? W.error.code === 404 : W.data.error.code === 404) ? (c([]), ne(!1), d(null), g(null)) : g(D);
|
|
47
|
-
} finally {
|
|
48
|
-
x(!1);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
[e, r, n, o]
|
|
52
|
-
);
|
|
53
|
-
fe(() => {
|
|
54
|
-
if (a) {
|
|
55
|
-
c([]), ne(!1), x(!1);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
r && A(w);
|
|
59
|
-
}, [r, w, A, a]);
|
|
60
|
-
const de = (p) => {
|
|
61
|
-
F(p), d(null);
|
|
62
|
-
}, Y = oe(y);
|
|
63
|
-
Y.current = y;
|
|
64
|
-
const P = oe(L);
|
|
65
|
-
P.current = L;
|
|
66
|
-
const U = ge(() => {
|
|
67
|
-
P.current && !Y.current && A(w, P.current, !0);
|
|
68
|
-
}, [A, w]), V = oe(f);
|
|
69
|
-
V.current = f;
|
|
70
|
-
const q = oe(I);
|
|
71
|
-
q.current = I;
|
|
72
|
-
const ee = oe(i);
|
|
73
|
-
ee.current = i;
|
|
74
|
-
const G = oe(!1), re = ge(async () => {
|
|
75
|
-
var W, te;
|
|
76
|
-
if (Y.current || G.current) return;
|
|
77
|
-
const p = w === "LATEST" || !q.current;
|
|
78
|
-
G.current = !0;
|
|
79
|
-
const S = M.current, h = V.current, B = new Map(h.map((J) => [J.id, J])), K = (J) => !B.has(J.id);
|
|
80
|
-
try {
|
|
81
|
-
const J = [], ae = /* @__PURE__ */ new Map();
|
|
82
|
-
let be;
|
|
83
|
-
for (let $ = 0; $ < vt; $++) {
|
|
84
|
-
const H = await e.discussions.getPosts(r, {
|
|
85
|
-
sort: "LATEST",
|
|
86
|
-
limit: n,
|
|
87
|
-
startAfter: be,
|
|
88
|
-
skipDeleted: !0,
|
|
89
|
-
// Always included, so a shown post that got moderated can be detected
|
|
90
|
-
skipModerated: !1
|
|
91
|
-
}), N = H.data;
|
|
92
|
-
N.forEach((me) => {
|
|
93
|
-
const Ee = B.get(me.id);
|
|
94
|
-
Ee ? me.moderated && !Ee.moderated && ae.set(me.id, me) : (o || !me.moderated) && J.push(me);
|
|
95
|
-
}), be = ((W = H.meta.pagination) == null ? void 0 : W.nextPageStartsAfter) || void 0;
|
|
96
|
-
const xe = N.length === n && N.every(K);
|
|
97
|
-
if (!p || !h.length || !xe || !be) break;
|
|
98
|
-
}
|
|
99
|
-
if (S !== M.current || (ae.size && c(
|
|
100
|
-
($) => o ? $.map((H) => {
|
|
101
|
-
const N = ae.get(H.id);
|
|
102
|
-
return N ? {
|
|
103
|
-
...H,
|
|
104
|
-
moderated: !0,
|
|
105
|
-
moderatedAt: N.moderatedAt,
|
|
106
|
-
moderatedBy: N.moderatedBy,
|
|
107
|
-
moderatedReason: N.moderatedReason
|
|
108
|
-
} : H;
|
|
109
|
-
}) : $.filter((H) => !ae.has(H.id))
|
|
110
|
-
), !p)) return;
|
|
111
|
-
const E = new Set(V.current.map(($) => $.id)), O = J.filter(($) => !E.has($.id));
|
|
112
|
-
if (!O.length) return;
|
|
113
|
-
h.length ? c(($) => {
|
|
114
|
-
const H = new Set($.map((xe) => xe.id)), N = O.filter((xe) => !H.has(xe.id));
|
|
115
|
-
return w === "LATEST" ? [...N, ...$].sort(
|
|
116
|
-
(xe, me) => Date.parse(me.createdAt) - Date.parse(xe.createdAt)
|
|
117
|
-
) : [...$, ...N.reverse()];
|
|
118
|
-
}) : await A(w), j(($) => {
|
|
119
|
-
const H = new Set($);
|
|
120
|
-
return O.forEach((N) => H.add(N.id)), H;
|
|
121
|
-
}), (te = ee.current) == null || te.call(ee, O.length);
|
|
122
|
-
} catch {
|
|
123
|
-
} finally {
|
|
124
|
-
G.current = !1;
|
|
125
|
-
}
|
|
126
|
-
}, [
|
|
127
|
-
e,
|
|
128
|
-
r,
|
|
129
|
-
n,
|
|
130
|
-
o,
|
|
131
|
-
w,
|
|
132
|
-
A
|
|
133
|
-
]), Q = l > 0 ? Math.max(l, Rt) : 0;
|
|
134
|
-
fe(() => {
|
|
135
|
-
if (!Q || a || !r) return;
|
|
136
|
-
const p = () => {
|
|
137
|
-
document.visibilityState !== "hidden" && re();
|
|
138
|
-
}, S = () => {
|
|
139
|
-
document.visibilityState === "visible" && re();
|
|
140
|
-
}, h = setInterval(p, Q);
|
|
141
|
-
return document.addEventListener("visibilitychange", S), () => {
|
|
142
|
-
clearInterval(h), document.removeEventListener("visibilitychange", S);
|
|
143
|
-
};
|
|
144
|
-
}, [Q, a, r, re]);
|
|
145
|
-
const ye = ge((p) => {
|
|
146
|
-
j((S) => {
|
|
147
|
-
if (!S.has(p)) return S;
|
|
148
|
-
const h = new Set(S);
|
|
149
|
-
return h.delete(p), h;
|
|
150
|
-
});
|
|
151
|
-
}, []);
|
|
152
|
-
return {
|
|
153
|
-
posts: f,
|
|
154
|
-
postsHidden: a,
|
|
155
|
-
isLoading: y,
|
|
156
|
-
isSubmitting: R,
|
|
157
|
-
error: D,
|
|
158
|
-
currentSort: w,
|
|
159
|
-
hasMore: I,
|
|
160
|
-
newPostIds: k,
|
|
161
|
-
markPostSeen: ye,
|
|
162
|
-
handleSortChange: de,
|
|
163
|
-
handleLoadMore: U,
|
|
164
|
-
handleCreatePost: async (p, S) => {
|
|
165
|
-
try {
|
|
166
|
-
b(!0);
|
|
167
|
-
let B = await e.discussions.createPost(r, {
|
|
168
|
-
content: p,
|
|
169
|
-
replyId: S || null,
|
|
170
|
-
userNickname: null,
|
|
171
|
-
discussionLabel: s,
|
|
172
|
-
discussionUrl: u,
|
|
173
|
-
context: {
|
|
174
|
-
content: null,
|
|
175
|
-
tags: [],
|
|
176
|
-
campaign: null
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
try {
|
|
180
|
-
const K = await e.profile.getOwn().getInfo();
|
|
181
|
-
B = { ...B, userModel: K };
|
|
182
|
-
} catch {
|
|
183
|
-
}
|
|
184
|
-
S ? c(
|
|
185
|
-
(K) => K.map(
|
|
186
|
-
(W) => W.id === S ? { ...W, repliesCount: (W.repliesCount || 0) + 1 } : W
|
|
187
|
-
)
|
|
188
|
-
) : a || c((K) => [B, ...K]), i == null || i(1), g(null);
|
|
189
|
-
} catch (h) {
|
|
190
|
-
throw g(
|
|
191
|
-
h
|
|
192
|
-
), h;
|
|
193
|
-
} finally {
|
|
194
|
-
b(!1);
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
handleReact: async (p, S) => {
|
|
198
|
-
try {
|
|
199
|
-
const h = await e.discussions.react(p, S);
|
|
200
|
-
return c(
|
|
201
|
-
(B) => B.map((K) => K.id === p ? h : K)
|
|
202
|
-
), g(null), h;
|
|
203
|
-
} catch (h) {
|
|
204
|
-
throw console.error("Error reacting to post:", h), g(
|
|
205
|
-
h
|
|
206
|
-
), h;
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
handleDeletePost: async (p, S) => {
|
|
210
|
-
try {
|
|
211
|
-
await e.discussions.deletePost(p), c((h) => h.filter((B) => B.id !== p)), S && c(
|
|
212
|
-
(h) => h.map(
|
|
213
|
-
(B) => B.id === S ? { ...B, repliesCount: Math.max(0, (B.repliesCount || 0) - 1) } : B
|
|
214
|
-
)
|
|
215
|
-
), i == null || i(-1), g(null);
|
|
216
|
-
} catch (h) {
|
|
217
|
-
throw g(
|
|
218
|
-
h
|
|
219
|
-
), h;
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
handleReportPost: async (p, S, h) => {
|
|
223
|
-
try {
|
|
224
|
-
await e.discussions.reportPost(p, S, h), g(null);
|
|
225
|
-
} catch (B) {
|
|
226
|
-
throw g(
|
|
227
|
-
B
|
|
228
|
-
), B;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
}, wt = async (e) => {
|
|
233
|
-
var r;
|
|
234
|
-
try {
|
|
235
|
-
const u = (r = e.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(), m = u == null ? void 0 : u.split(".")[1];
|
|
236
|
-
if (!m) return null;
|
|
237
|
-
const { sub: n } = JSON.parse(
|
|
238
|
-
atob(m.replace(/-/g, "+").replace(/_/g, "/"))
|
|
239
|
-
);
|
|
240
|
-
return typeof n == "string" && n ? n : null;
|
|
241
|
-
} catch {
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
}, Pt = (e, r) => {
|
|
245
|
-
var o;
|
|
246
|
-
const [s, u] = T(null), m = Oe(), n = ge(
|
|
247
|
-
async (l) => {
|
|
248
|
-
if (!r) {
|
|
249
|
-
u(null);
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
try {
|
|
253
|
-
const a = await wt(e);
|
|
254
|
-
if (!a) return;
|
|
255
|
-
u(await e.discussions.getUserBan(a, l));
|
|
256
|
-
} catch (a) {
|
|
257
|
-
console.error("Failed to get user ban:", a);
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
[e, r]
|
|
261
|
-
);
|
|
262
|
-
fe(() => {
|
|
263
|
-
n(m);
|
|
264
|
-
}, [n, m]);
|
|
265
|
-
const i = ge(() => n(!0), [n]);
|
|
266
|
-
return { ban: s, isBanned: !!((o = s == null ? void 0 : s.activeBan) != null && o.banned), refresh: i };
|
|
267
|
-
}, Le = (e) => {
|
|
268
|
-
var r, s, u;
|
|
269
|
-
return (((r = e == null ? void 0 : e.error) == null ? void 0 : r.status) ?? ((u = (s = e == null ? void 0 : e.data) == null ? void 0 : s.error) == null ? void 0 : u.status)) === "ban";
|
|
270
|
-
}, Be = ({
|
|
271
|
-
onSubmit: e,
|
|
272
|
-
userIsLoggedIn: r,
|
|
273
|
-
onSignInClick: s,
|
|
274
|
-
placeholder: u,
|
|
275
|
-
isSubmitting: m,
|
|
276
|
-
replyTo: n,
|
|
277
|
-
onCancel: i,
|
|
278
|
-
disabled: o = !1
|
|
279
|
-
}) => {
|
|
280
|
-
const { t: l } = he(), [a, f] = T(""), c = le(), y = pe(), x = Re(), R = ce(), b = c.palette.primary.plainColor, D = c.palette.primary.onPrimary, g = async (w) => {
|
|
281
|
-
if (w.preventDefault(), !(!a.trim() || o))
|
|
282
|
-
try {
|
|
283
|
-
await e(a), f("");
|
|
284
|
-
} catch (F) {
|
|
285
|
-
console.error("Failed to submit comment:", F);
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
return r ? /* @__PURE__ */ v(C, { component: "form", onSubmit: g, sx: { mb: R.lg }, children: [
|
|
289
|
-
n && /* @__PURE__ */ t(z, { level: "body-sm", sx: { fontSize: "0.875em", mb: R.xs, color: c.textSecondary }, children: l("discussion.replyingTo", "Replying to {{name}}", {
|
|
290
|
-
name: n
|
|
291
|
-
}) }),
|
|
292
|
-
/* @__PURE__ */ t(
|
|
293
|
-
Me,
|
|
294
|
-
{
|
|
295
|
-
placeholder: u || l("discussion.writeComment", "Write a comment..."),
|
|
296
|
-
value: a,
|
|
297
|
-
onChange: (w) => f(w.target.value),
|
|
298
|
-
minRows: 3,
|
|
299
|
-
maxRows: 8,
|
|
300
|
-
disabled: m || o,
|
|
301
|
-
sx: {
|
|
302
|
-
fontSize: "1em",
|
|
303
|
-
mb: R.sm,
|
|
304
|
-
bgcolor: c.surfaceVariant,
|
|
305
|
-
color: c.textPrimary,
|
|
306
|
-
border: `1px solid ${c.outlineEnabledBorder}`,
|
|
307
|
-
borderRadius: y.sm,
|
|
308
|
-
boxShadow: "none",
|
|
309
|
-
"&::before": { display: "none" },
|
|
310
|
-
"&::placeholder": { color: c.textSecondary, opacity: 0.6 },
|
|
311
|
-
"&:focus-within": {
|
|
312
|
-
border: `1px solid ${b}`,
|
|
313
|
-
boxShadow: "none",
|
|
314
|
-
outline: "none"
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
),
|
|
319
|
-
/* @__PURE__ */ v(C, { sx: { display: "flex", gap: R.xs, justifyContent: "flex-end" }, children: [
|
|
320
|
-
i && /* @__PURE__ */ t(
|
|
321
|
-
ie,
|
|
322
|
-
{
|
|
323
|
-
variant: "plain",
|
|
324
|
-
onClick: i,
|
|
325
|
-
disabled: m,
|
|
326
|
-
sx: {
|
|
327
|
-
fontSize: "1em",
|
|
328
|
-
fontFamily: x.primary,
|
|
329
|
-
color: c.textPrimary,
|
|
330
|
-
borderRadius: y.sm,
|
|
331
|
-
"&:hover": {
|
|
332
|
-
bgcolor: `${c.textPrimary}14`
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
children: l("common.cancel", "Cancel")
|
|
336
|
-
}
|
|
337
|
-
),
|
|
338
|
-
/* @__PURE__ */ t(
|
|
339
|
-
ie,
|
|
340
|
-
{
|
|
341
|
-
type: "submit",
|
|
342
|
-
variant: "solid",
|
|
343
|
-
disabled: !a.trim() || m || o,
|
|
344
|
-
loading: m,
|
|
345
|
-
sx: {
|
|
346
|
-
fontSize: "1em",
|
|
347
|
-
fontFamily: x.primary,
|
|
348
|
-
bgcolor: b,
|
|
349
|
-
color: D,
|
|
350
|
-
borderRadius: y.sm,
|
|
351
|
-
"&:hover": {
|
|
352
|
-
bgcolor: b,
|
|
353
|
-
opacity: 0.9
|
|
354
|
-
},
|
|
355
|
-
"&:disabled": {
|
|
356
|
-
bgcolor: b,
|
|
357
|
-
color: D,
|
|
358
|
-
opacity: 0.4
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
children: n ? l("discussion.reply", "Reply") : l("discussion.post", "Post")
|
|
362
|
-
}
|
|
363
|
-
)
|
|
364
|
-
] })
|
|
365
|
-
] }) : /* @__PURE__ */ t(C, { sx: { mb: R.lg }, children: /* @__PURE__ */ t(
|
|
366
|
-
ie,
|
|
367
|
-
{
|
|
368
|
-
fullWidth: !0,
|
|
369
|
-
variant: "outlined",
|
|
370
|
-
onClick: s,
|
|
371
|
-
sx: {
|
|
372
|
-
fontSize: "1em",
|
|
373
|
-
py: R.sm,
|
|
374
|
-
fontFamily: x.primary,
|
|
375
|
-
borderColor: b,
|
|
376
|
-
color: b,
|
|
377
|
-
borderRadius: y.sm,
|
|
378
|
-
"&:hover": {
|
|
379
|
-
bgcolor: `${b}14`,
|
|
380
|
-
borderColor: b
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
children: l("discussion.signInToPost", "Sign in to post")
|
|
384
|
-
}
|
|
385
|
-
) });
|
|
386
|
-
}, Et = {
|
|
387
|
-
LIKE: /* @__PURE__ */ t(nt, { fontSize: "small" }),
|
|
388
|
-
DISLIKE: /* @__PURE__ */ t(rt, { fontSize: "small" }),
|
|
389
|
-
LOVE: /* @__PURE__ */ t(st, { fontSize: "small" }),
|
|
390
|
-
LAUGH: /* @__PURE__ */ t(at, { fontSize: "small" }),
|
|
391
|
-
CARE: /* @__PURE__ */ t(it, { fontSize: "small" }),
|
|
392
|
-
WOW: /* @__PURE__ */ t(lt, { fontSize: "small" }),
|
|
393
|
-
SAD: /* @__PURE__ */ t(ct, { fontSize: "small" }),
|
|
394
|
-
ANGRY: /* @__PURE__ */ t(dt, { fontSize: "small" })
|
|
395
|
-
}, Ae = ({
|
|
396
|
-
reaction: e,
|
|
397
|
-
count: r,
|
|
398
|
-
isActive: s,
|
|
399
|
-
onClick: u,
|
|
400
|
-
disabled: m
|
|
401
|
-
}) => {
|
|
402
|
-
const n = le(), i = ce(), o = (a) => a >= 1e6 ? (a / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : a >= 1e3 ? (a / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : a.toString(), l = () => {
|
|
403
|
-
if (!s) return n.textSecondary;
|
|
404
|
-
switch (e) {
|
|
405
|
-
case "LIKE":
|
|
406
|
-
return n.palette.primary.plainColor;
|
|
407
|
-
case "DISLIKE":
|
|
408
|
-
return n.palette.primary.plainColor;
|
|
409
|
-
case "LOVE":
|
|
410
|
-
return n.palette.danger.plainColor;
|
|
411
|
-
case "ANGRY":
|
|
412
|
-
return n.palette.danger.plainColor;
|
|
413
|
-
default:
|
|
414
|
-
return n.palette.primary.plainColor;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
return /* @__PURE__ */ v(
|
|
418
|
-
C,
|
|
419
|
-
{
|
|
420
|
-
sx: {
|
|
421
|
-
display: "inline-flex",
|
|
422
|
-
alignItems: "center",
|
|
423
|
-
gap: i["2xs"],
|
|
424
|
-
px: i.sm,
|
|
425
|
-
py: i["2xs"],
|
|
426
|
-
borderRadius: "18px",
|
|
427
|
-
backgroundColor: s ? `${n.palette.neutral.softBg}` : "transparent",
|
|
428
|
-
color: l(),
|
|
429
|
-
"&:hover": {
|
|
430
|
-
backgroundColor: `${n.palette.neutral.softHoverBg}`
|
|
431
|
-
},
|
|
432
|
-
cursor: m ? "not-allowed" : "pointer",
|
|
433
|
-
opacity: m ? 0.5 : 1
|
|
434
|
-
},
|
|
435
|
-
onClick: m ? void 0 : u,
|
|
436
|
-
children: [
|
|
437
|
-
/* @__PURE__ */ t(
|
|
438
|
-
C,
|
|
439
|
-
{
|
|
440
|
-
sx: {
|
|
441
|
-
display: "flex",
|
|
442
|
-
alignItems: "center",
|
|
443
|
-
fontSize: "1.25em",
|
|
444
|
-
color: "inherit"
|
|
445
|
-
},
|
|
446
|
-
children: Et[e]
|
|
447
|
-
}
|
|
448
|
-
),
|
|
449
|
-
r > 0 && /* @__PURE__ */ t(
|
|
450
|
-
z,
|
|
451
|
-
{
|
|
452
|
-
level: "body-sm",
|
|
453
|
-
sx: {
|
|
454
|
-
fontSize: "0.875em",
|
|
455
|
-
color: s ? l() : n.textPrimary,
|
|
456
|
-
fontWeight: 500
|
|
457
|
-
},
|
|
458
|
-
children: o(r)
|
|
459
|
-
}
|
|
460
|
-
)
|
|
461
|
-
]
|
|
462
|
-
}
|
|
463
|
-
);
|
|
464
|
-
}, ke = (e, r) => {
|
|
465
|
-
const [s, u] = T(null);
|
|
466
|
-
return fe(() => {
|
|
467
|
-
(async () => {
|
|
468
|
-
if (r)
|
|
469
|
-
try {
|
|
470
|
-
const n = await e.profile.getOwn().getInfo();
|
|
471
|
-
u(n.id);
|
|
472
|
-
} catch (n) {
|
|
473
|
-
console.error("Failed to get current user ID:", n);
|
|
474
|
-
}
|
|
475
|
-
})();
|
|
476
|
-
}, [r, e]), s;
|
|
477
|
-
}, Dt = ({
|
|
478
|
-
post: e,
|
|
479
|
-
sdk: r,
|
|
480
|
-
userIsLoggedIn: s,
|
|
481
|
-
onSignInClick: u,
|
|
482
|
-
onReact: m,
|
|
483
|
-
showReactions: n = !0,
|
|
484
|
-
showReplyButton: i = !0,
|
|
485
|
-
onReplyClick: o,
|
|
486
|
-
isBanned: l = !1
|
|
487
|
-
}) => {
|
|
488
|
-
var w, F, L, d;
|
|
489
|
-
const { t: a } = he(), f = le(), c = pe(), y = Re(), x = ce(), R = ke(r, s), D = (() => {
|
|
490
|
-
if (!R || !e.reactions)
|
|
491
|
-
return null;
|
|
492
|
-
for (const I of e.reactions)
|
|
493
|
-
if (I.userIds.includes(R))
|
|
494
|
-
return I.type;
|
|
495
|
-
return null;
|
|
496
|
-
})(), g = (I) => {
|
|
497
|
-
if (!s) {
|
|
498
|
-
u == null || u();
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
m(e.id, I).catch(() => {
|
|
502
|
-
});
|
|
503
|
-
};
|
|
504
|
-
return /* @__PURE__ */ v(
|
|
505
|
-
C,
|
|
506
|
-
{
|
|
507
|
-
sx: {
|
|
508
|
-
display: "flex",
|
|
509
|
-
gap: x.xs,
|
|
510
|
-
alignItems: "center",
|
|
511
|
-
flexWrap: "wrap",
|
|
512
|
-
mb: x.xs
|
|
513
|
-
},
|
|
514
|
-
children: [
|
|
515
|
-
n && /* @__PURE__ */ v(Se, { children: [
|
|
516
|
-
/* @__PURE__ */ t(
|
|
517
|
-
Ae,
|
|
518
|
-
{
|
|
519
|
-
reaction: "LIKE",
|
|
520
|
-
count: ((F = (w = e.reactions) == null ? void 0 : w.find((I) => I.type === "LIKE")) == null ? void 0 : F.reactionCount) || 0,
|
|
521
|
-
isActive: D === "LIKE",
|
|
522
|
-
onClick: () => g("LIKE"),
|
|
523
|
-
disabled: !s || l
|
|
524
|
-
}
|
|
525
|
-
),
|
|
526
|
-
/* @__PURE__ */ t(
|
|
527
|
-
Ae,
|
|
528
|
-
{
|
|
529
|
-
reaction: "DISLIKE",
|
|
530
|
-
count: ((d = (L = e.reactions) == null ? void 0 : L.find((I) => I.type === "DISLIKE")) == null ? void 0 : d.reactionCount) || 0,
|
|
531
|
-
isActive: D === "DISLIKE",
|
|
532
|
-
onClick: () => g("DISLIKE"),
|
|
533
|
-
disabled: !s || l
|
|
534
|
-
}
|
|
535
|
-
)
|
|
536
|
-
] }),
|
|
537
|
-
i && /* @__PURE__ */ t(
|
|
538
|
-
ie,
|
|
539
|
-
{
|
|
540
|
-
size: "sm",
|
|
541
|
-
variant: "plain",
|
|
542
|
-
onClick: o,
|
|
543
|
-
disabled: l,
|
|
544
|
-
startDecorator: /* @__PURE__ */ t(ut, { fontSize: "small" }),
|
|
545
|
-
sx: {
|
|
546
|
-
ml: x.xs,
|
|
547
|
-
fontFamily: y.primary,
|
|
548
|
-
color: f.textPrimary,
|
|
549
|
-
fontWeight: 600,
|
|
550
|
-
fontSize: "0.8125em",
|
|
551
|
-
borderRadius: c.sm,
|
|
552
|
-
px: x.xs,
|
|
553
|
-
py: x["2xs"],
|
|
554
|
-
minHeight: "unset",
|
|
555
|
-
"--Icon-color": f.textPrimary,
|
|
556
|
-
"&:hover": {
|
|
557
|
-
bgcolor: `${f.textPrimary}14`
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
children: a("discussion.reply", "Reply")
|
|
561
|
-
}
|
|
562
|
-
)
|
|
563
|
-
]
|
|
564
|
-
}
|
|
565
|
-
);
|
|
566
|
-
}, At = ({
|
|
567
|
-
isOwnPost: e,
|
|
568
|
-
canReport: r,
|
|
569
|
-
onDelete: s,
|
|
570
|
-
onReport: u,
|
|
571
|
-
disabled: m = !1
|
|
572
|
-
}) => {
|
|
573
|
-
const { t: n } = he(), { shadowRootElement: i } = ve(Ce), o = pe(), l = le(), a = ce(), [f, c] = X.useState(null), y = X.useRef(null);
|
|
574
|
-
if (X.useEffect(() => {
|
|
575
|
-
if (!f) return;
|
|
576
|
-
const b = (g) => {
|
|
577
|
-
const w = g.composedPath();
|
|
578
|
-
f && w.includes(f) || y.current && w.includes(y.current) || c(null);
|
|
579
|
-
}, D = setTimeout(() => {
|
|
580
|
-
document.addEventListener("click", b, !0);
|
|
581
|
-
}, 0);
|
|
582
|
-
return () => {
|
|
583
|
-
clearTimeout(D), document.removeEventListener("click", b, !0);
|
|
584
|
-
};
|
|
585
|
-
}, [f]), !e && !r) return null;
|
|
586
|
-
const x = {
|
|
587
|
-
zIndex: 1300,
|
|
588
|
-
bgcolor: l.surface,
|
|
589
|
-
border: `1px solid ${l.outlineEnabledBorder}`,
|
|
590
|
-
borderRadius: o.sm,
|
|
591
|
-
boxShadow: "none"
|
|
592
|
-
}, R = {
|
|
593
|
-
color: `${l.textPrimary} !important`,
|
|
594
|
-
bgcolor: `${l.surface} !important`,
|
|
595
|
-
"&:hover": {
|
|
596
|
-
bgcolor: `${l.surfaceVariant} !important`,
|
|
597
|
-
color: `${l.textPrimary} !important`
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
return /* @__PURE__ */ v(Se, { children: [
|
|
601
|
-
/* @__PURE__ */ t(
|
|
602
|
-
Ge,
|
|
603
|
-
{
|
|
604
|
-
size: "sm",
|
|
605
|
-
variant: "plain",
|
|
606
|
-
onClick: (b) => c(f ? null : b.currentTarget),
|
|
607
|
-
sx: {
|
|
608
|
-
fontSize: "1em",
|
|
609
|
-
ml: "auto",
|
|
610
|
-
color: l.textPrimary,
|
|
611
|
-
"&:hover": {
|
|
612
|
-
bgcolor: `${l.textPrimary}14`
|
|
613
|
-
}
|
|
614
|
-
},
|
|
615
|
-
children: /* @__PURE__ */ t(mt, { fontSize: "small" })
|
|
616
|
-
}
|
|
617
|
-
),
|
|
618
|
-
/* @__PURE__ */ v(
|
|
619
|
-
Je,
|
|
620
|
-
{
|
|
621
|
-
ref: y,
|
|
622
|
-
anchorEl: f,
|
|
623
|
-
open: !!f,
|
|
624
|
-
onClose: () => c(null),
|
|
625
|
-
container: i,
|
|
626
|
-
sx: x,
|
|
627
|
-
children: [
|
|
628
|
-
e && /* @__PURE__ */ v(
|
|
629
|
-
De,
|
|
630
|
-
{
|
|
631
|
-
onClick: () => {
|
|
632
|
-
c(null), s();
|
|
633
|
-
},
|
|
634
|
-
disabled: m,
|
|
635
|
-
sx: R,
|
|
636
|
-
children: [
|
|
637
|
-
/* @__PURE__ */ t(ft, { fontSize: "small", sx: { mr: a.xs } }),
|
|
638
|
-
n("discussion.delete.action", "Delete")
|
|
639
|
-
]
|
|
640
|
-
}
|
|
641
|
-
),
|
|
642
|
-
r && /* @__PURE__ */ v(
|
|
643
|
-
De,
|
|
644
|
-
{
|
|
645
|
-
onClick: () => {
|
|
646
|
-
c(null), u();
|
|
647
|
-
},
|
|
648
|
-
disabled: m,
|
|
649
|
-
sx: R,
|
|
650
|
-
children: [
|
|
651
|
-
/* @__PURE__ */ t(pt, { fontSize: "small", sx: { mr: a.xs } }),
|
|
652
|
-
n("discussion.report.action", "Report")
|
|
653
|
-
]
|
|
654
|
-
}
|
|
655
|
-
)
|
|
656
|
-
]
|
|
657
|
-
}
|
|
658
|
-
)
|
|
659
|
-
] });
|
|
660
|
-
}, zt = ({
|
|
661
|
-
open: e,
|
|
662
|
-
onClose: r,
|
|
663
|
-
onConfirm: s,
|
|
664
|
-
onError: u,
|
|
665
|
-
container: m
|
|
666
|
-
}) => {
|
|
667
|
-
const { t: n } = he(), i = le(), o = pe(), l = Re(), a = ce(), f = i.palette.primary.plainColor, c = i.palette.primary.onPrimary, [y, x] = T(!1), R = async () => {
|
|
668
|
-
x(!0);
|
|
669
|
-
try {
|
|
670
|
-
await s(), r();
|
|
671
|
-
} catch {
|
|
672
|
-
u(
|
|
673
|
-
n(
|
|
674
|
-
"discussion.delete.error",
|
|
675
|
-
"Failed to delete comment. Please try again."
|
|
676
|
-
)
|
|
677
|
-
);
|
|
678
|
-
} finally {
|
|
679
|
-
x(!1);
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
return /* @__PURE__ */ t(Fe, { open: e, onClose: r, container: m, children: /* @__PURE__ */ v(
|
|
683
|
-
$e,
|
|
684
|
-
{
|
|
685
|
-
sx: {
|
|
686
|
-
fontSize: "1em",
|
|
687
|
-
bgcolor: i.surface,
|
|
688
|
-
color: i.textPrimary,
|
|
689
|
-
borderRadius: o.md,
|
|
690
|
-
p: a.lg,
|
|
691
|
-
minWidth: 320,
|
|
692
|
-
maxWidth: 400
|
|
693
|
-
},
|
|
694
|
-
children: [
|
|
695
|
-
/* @__PURE__ */ t(
|
|
696
|
-
z,
|
|
697
|
-
{
|
|
698
|
-
level: "title-lg",
|
|
699
|
-
sx: { fontSize: "1.25em", mb: a.xs, fontFamily: l.primary },
|
|
700
|
-
children: n("discussion.delete.title", "Delete comment")
|
|
701
|
-
}
|
|
702
|
-
),
|
|
703
|
-
/* @__PURE__ */ t(z, { level: "body-sm", sx: { fontSize: "0.875em", mb: a.lg, color: i.textSecondary }, children: n(
|
|
704
|
-
"discussion.delete.description",
|
|
705
|
-
"Are you sure you want to delete this comment? This action cannot be undone."
|
|
706
|
-
) }),
|
|
707
|
-
/* @__PURE__ */ v(C, { sx: { display: "flex", gap: a.xs, justifyContent: "flex-end" }, children: [
|
|
708
|
-
/* @__PURE__ */ t(
|
|
709
|
-
ie,
|
|
710
|
-
{
|
|
711
|
-
variant: "plain",
|
|
712
|
-
onClick: r,
|
|
713
|
-
sx: {
|
|
714
|
-
fontSize: "1em",
|
|
715
|
-
fontFamily: l.primary,
|
|
716
|
-
color: i.textPrimary,
|
|
717
|
-
borderRadius: o.sm,
|
|
718
|
-
"&:hover": { bgcolor: `${i.textPrimary}14` }
|
|
719
|
-
},
|
|
720
|
-
children: n("common.cancel", "Cancel")
|
|
721
|
-
}
|
|
722
|
-
),
|
|
723
|
-
/* @__PURE__ */ t(
|
|
724
|
-
ie,
|
|
725
|
-
{
|
|
726
|
-
variant: "solid",
|
|
727
|
-
loading: y,
|
|
728
|
-
disabled: y,
|
|
729
|
-
onClick: R,
|
|
730
|
-
sx: {
|
|
731
|
-
fontSize: "1em",
|
|
732
|
-
fontFamily: l.primary,
|
|
733
|
-
bgcolor: f,
|
|
734
|
-
color: c,
|
|
735
|
-
borderRadius: o.sm,
|
|
736
|
-
"&:hover": {
|
|
737
|
-
bgcolor: f,
|
|
738
|
-
opacity: 0.9
|
|
739
|
-
},
|
|
740
|
-
"&:disabled": {
|
|
741
|
-
bgcolor: f,
|
|
742
|
-
color: c,
|
|
743
|
-
opacity: 0.4
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
children: n("discussion.delete.action", "Delete")
|
|
747
|
-
}
|
|
748
|
-
)
|
|
749
|
-
] })
|
|
750
|
-
]
|
|
751
|
-
}
|
|
752
|
-
) });
|
|
753
|
-
}, Tt = [
|
|
754
|
-
{ value: "SPAM", labelKey: "discussion.report.spam", fallback: "Spam" },
|
|
755
|
-
{
|
|
756
|
-
value: "NOT_ON_THE_SUBJECT",
|
|
757
|
-
labelKey: "discussion.report.offTopic",
|
|
758
|
-
fallback: "Off topic"
|
|
759
|
-
},
|
|
760
|
-
{ value: "AD", labelKey: "discussion.report.ad", fallback: "Advertisement" },
|
|
761
|
-
{
|
|
762
|
-
value: "COPYRIGHT",
|
|
763
|
-
labelKey: "discussion.report.copyright",
|
|
764
|
-
fallback: "Copyright violation"
|
|
765
|
-
},
|
|
766
|
-
{
|
|
767
|
-
value: "EXPLICIT_SEXUAL_CONTENT",
|
|
768
|
-
labelKey: "discussion.report.explicit",
|
|
769
|
-
fallback: "Explicit sexual content"
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
value: "HATEFUL_SPEECH",
|
|
773
|
-
labelKey: "discussion.report.hateful",
|
|
774
|
-
fallback: "Hateful speech"
|
|
775
|
-
},
|
|
776
|
-
{ value: "INSULT", labelKey: "discussion.report.insult", fallback: "Insult" },
|
|
777
|
-
{ value: "OTHER", labelKey: "discussion.report.other", fallback: "Other" }
|
|
778
|
-
], It = ({
|
|
779
|
-
open: e,
|
|
780
|
-
onClose: r,
|
|
781
|
-
onSubmit: s,
|
|
782
|
-
onSuccess: u,
|
|
783
|
-
onError: m,
|
|
784
|
-
container: n
|
|
785
|
-
}) => {
|
|
786
|
-
const { t: i } = he(), o = le(), l = pe(), a = Re(), f = ce(), c = o.palette.primary.plainColor, y = o.palette.primary.onPrimary, [x, R] = T(""), [b, D] = T(""), [g, w] = T(!1), F = () => {
|
|
787
|
-
r(), R(""), D("");
|
|
788
|
-
}, L = async () => {
|
|
789
|
-
w(!0);
|
|
790
|
-
try {
|
|
791
|
-
await s(
|
|
792
|
-
x,
|
|
793
|
-
x === "OTHER" ? b : void 0
|
|
794
|
-
), u(
|
|
795
|
-
i(
|
|
796
|
-
"discussion.report.success",
|
|
797
|
-
"Post reported successfully. Thank you."
|
|
798
|
-
)
|
|
799
|
-
), F();
|
|
800
|
-
} catch {
|
|
801
|
-
m(
|
|
802
|
-
i(
|
|
803
|
-
"discussion.report.error",
|
|
804
|
-
"Failed to report post. Please try again."
|
|
805
|
-
)
|
|
806
|
-
);
|
|
807
|
-
} finally {
|
|
808
|
-
w(!1);
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
return /* @__PURE__ */ t(Fe, { open: e, onClose: F, container: n, children: /* @__PURE__ */ v(
|
|
812
|
-
$e,
|
|
813
|
-
{
|
|
814
|
-
sx: {
|
|
815
|
-
fontSize: "1em",
|
|
816
|
-
bgcolor: o.surface,
|
|
817
|
-
color: o.textPrimary,
|
|
818
|
-
borderRadius: l.md,
|
|
819
|
-
p: f.lg,
|
|
820
|
-
minWidth: 320,
|
|
821
|
-
maxWidth: 440
|
|
822
|
-
},
|
|
823
|
-
children: [
|
|
824
|
-
/* @__PURE__ */ t(
|
|
825
|
-
Xe,
|
|
826
|
-
{
|
|
827
|
-
sx: {
|
|
828
|
-
color: o.textPrimary,
|
|
829
|
-
"&:hover": { bgcolor: `${o.textPrimary}14` }
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
),
|
|
833
|
-
/* @__PURE__ */ t(
|
|
834
|
-
z,
|
|
835
|
-
{
|
|
836
|
-
level: "title-lg",
|
|
837
|
-
sx: { fontSize: "1.25em", mb: f.md, fontFamily: a.primary },
|
|
838
|
-
children: i("discussion.report.title", "Report post")
|
|
839
|
-
}
|
|
840
|
-
),
|
|
841
|
-
/* @__PURE__ */ t(z, { level: "body-sm", sx: { fontSize: "0.875em", mb: f.md, color: o.textSecondary }, children: i(
|
|
842
|
-
"discussion.report.description",
|
|
843
|
-
"Why are you reporting this post?"
|
|
844
|
-
) }),
|
|
845
|
-
/* @__PURE__ */ t(
|
|
846
|
-
qe,
|
|
847
|
-
{
|
|
848
|
-
value: x,
|
|
849
|
-
onChange: (d) => R(d.target.value),
|
|
850
|
-
sx: { gap: f.xs, mb: f.md },
|
|
851
|
-
children: Tt.map((d) => /* @__PURE__ */ t(
|
|
852
|
-
Qe,
|
|
853
|
-
{
|
|
854
|
-
value: d.value,
|
|
855
|
-
label: i(d.labelKey, d.fallback),
|
|
856
|
-
slotProps: {
|
|
857
|
-
radio: {
|
|
858
|
-
sx: {
|
|
859
|
-
bgcolor: o.surfaceVariant,
|
|
860
|
-
borderColor: o.outlineEnabledBorder,
|
|
861
|
-
"&:hover": {
|
|
862
|
-
bgcolor: o.surface,
|
|
863
|
-
borderColor: o.outlineEnabledBorder
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
},
|
|
868
|
-
sx: {
|
|
869
|
-
fontFamily: a.primary,
|
|
870
|
-
color: o.textPrimary
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
d.value
|
|
874
|
-
))
|
|
875
|
-
}
|
|
876
|
-
),
|
|
877
|
-
x === "OTHER" && /* @__PURE__ */ t(
|
|
878
|
-
Me,
|
|
879
|
-
{
|
|
880
|
-
placeholder: i(
|
|
881
|
-
"discussion.report.detailsPlaceholder",
|
|
882
|
-
"Please provide more details..."
|
|
883
|
-
),
|
|
884
|
-
value: b,
|
|
885
|
-
onChange: (d) => D(d.target.value),
|
|
886
|
-
minRows: 2,
|
|
887
|
-
maxRows: 4,
|
|
888
|
-
sx: {
|
|
889
|
-
fontSize: "1em",
|
|
890
|
-
mb: f.md,
|
|
891
|
-
bgcolor: o.surfaceVariant,
|
|
892
|
-
color: o.textPrimary,
|
|
893
|
-
border: `1px solid ${o.outlineEnabledBorder}`,
|
|
894
|
-
borderRadius: l.sm,
|
|
895
|
-
boxShadow: "none",
|
|
896
|
-
"&::before": { display: "none" },
|
|
897
|
-
"&:focus-within": {
|
|
898
|
-
border: `1px solid ${c}`,
|
|
899
|
-
boxShadow: "none"
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
),
|
|
904
|
-
/* @__PURE__ */ v(C, { sx: { display: "flex", gap: f.xs, justifyContent: "flex-end" }, children: [
|
|
905
|
-
/* @__PURE__ */ t(
|
|
906
|
-
ie,
|
|
907
|
-
{
|
|
908
|
-
variant: "plain",
|
|
909
|
-
onClick: F,
|
|
910
|
-
sx: {
|
|
911
|
-
fontSize: "1em",
|
|
912
|
-
fontFamily: a.primary,
|
|
913
|
-
color: o.textPrimary,
|
|
914
|
-
borderRadius: l.sm,
|
|
915
|
-
"&:hover": { bgcolor: `${o.textPrimary}14` }
|
|
916
|
-
},
|
|
917
|
-
children: i("common.cancel", "Cancel")
|
|
918
|
-
}
|
|
919
|
-
),
|
|
920
|
-
/* @__PURE__ */ t(
|
|
921
|
-
ie,
|
|
922
|
-
{
|
|
923
|
-
variant: "solid",
|
|
924
|
-
disabled: !x || g,
|
|
925
|
-
loading: g,
|
|
926
|
-
onClick: L,
|
|
927
|
-
sx: {
|
|
928
|
-
fontSize: "1em",
|
|
929
|
-
fontFamily: a.primary,
|
|
930
|
-
bgcolor: c,
|
|
931
|
-
color: y,
|
|
932
|
-
borderRadius: l.sm,
|
|
933
|
-
"&:hover": {
|
|
934
|
-
bgcolor: c,
|
|
935
|
-
opacity: 0.9
|
|
936
|
-
},
|
|
937
|
-
"&:disabled": {
|
|
938
|
-
bgcolor: c,
|
|
939
|
-
color: y,
|
|
940
|
-
opacity: 0.4
|
|
941
|
-
}
|
|
942
|
-
},
|
|
943
|
-
children: i("discussion.report.action", "Report")
|
|
944
|
-
}
|
|
945
|
-
)
|
|
946
|
-
] })
|
|
947
|
-
]
|
|
948
|
-
}
|
|
949
|
-
) });
|
|
950
|
-
}, Mt = (e, r, s) => {
|
|
951
|
-
const u = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - u.getTime(), i = Math.floor(n / 6e4), o = Math.floor(n / 36e5), l = Math.floor(n / 864e5);
|
|
952
|
-
return i < 1 ? r("discussion.justNow", "Just now") : i < 60 ? r("discussion.minutesAgo", "{{count}}m ago", { count: i }) : o < 24 ? r("discussion.hoursAgo", "{{count}}h ago", { count: o }) : l < 7 ? r("discussion.daysAgo", "{{count}}d ago", { count: l }) : u.toLocaleDateString(Te(s));
|
|
953
|
-
}, Ft = 8e3, Ne = ({
|
|
954
|
-
post: e,
|
|
955
|
-
sdk: r,
|
|
956
|
-
userIsLoggedIn: s,
|
|
957
|
-
onSignInClick: u,
|
|
958
|
-
showReactions: m = !0,
|
|
959
|
-
showReplies: n = !0,
|
|
960
|
-
showReportPost: i = !0,
|
|
961
|
-
onReply: o,
|
|
962
|
-
onReact: l,
|
|
963
|
-
onDelete: a,
|
|
964
|
-
onReport: f,
|
|
965
|
-
isSubmitting: c,
|
|
966
|
-
showModeratedPosts: y = !1,
|
|
967
|
-
isBanned: x = !1,
|
|
968
|
-
highlightable: R = !1,
|
|
969
|
-
isNew: b = !1,
|
|
970
|
-
onNewSeen: D,
|
|
971
|
-
depth: g = 0,
|
|
972
|
-
parentPostId: w,
|
|
973
|
-
onReplyCreated: F,
|
|
974
|
-
onDeleteSuccess: L
|
|
975
|
-
}) => {
|
|
976
|
-
var te, J, ae, be;
|
|
977
|
-
const { t: d } = he(), { shadowRootElement: I, language: ne } = ve(Ce), k = le(), j = pe(), M = ce(), A = ke(r, s), [de, Y] = T(!1), [P, U] = T([]), [V, q] = T(!1), [ee, G] = T(!1), [re, Q] = T(!1), [ye, Z] = T({ open: !1, variant: "success", title: "", message: "" }), ue = oe(null);
|
|
978
|
-
fe(() => {
|
|
979
|
-
if (!b || !D || !ue.current) return;
|
|
980
|
-
let E;
|
|
981
|
-
const O = new IntersectionObserver(
|
|
982
|
-
([$]) => {
|
|
983
|
-
$.isIntersecting && (O.disconnect(), E = setTimeout(() => D(e.id), Ft));
|
|
984
|
-
},
|
|
985
|
-
{ threshold: 0.5 }
|
|
986
|
-
);
|
|
987
|
-
return O.observe(ue.current), () => {
|
|
988
|
-
O.disconnect(), clearTimeout(E);
|
|
989
|
-
};
|
|
990
|
-
}, [b, D, e.id]);
|
|
991
|
-
const se = !!(s && A && e.userId === A), _ = !!e.moderated, p = async (E) => {
|
|
992
|
-
var N;
|
|
993
|
-
const O = g === 1 && w || e.id, $ = ((N = e.userModel) == null ? void 0 : N.name) || e.anonymousNickname || d("discussion.anonymous", "Anonymous"), H = g === 1 ? `@${$} ${E}` : E;
|
|
994
|
-
await o(O, H), Y(!1), g === 1 && F ? F() : g === 0 && (q(!0), S());
|
|
995
|
-
}, S = async () => {
|
|
996
|
-
if (!(!n || g >= 2))
|
|
997
|
-
try {
|
|
998
|
-
const E = await r.discussions.getPostReplies(e.id, {
|
|
999
|
-
limit: 25,
|
|
1000
|
-
skipDeleted: !0,
|
|
1001
|
-
skipModerated: !y
|
|
1002
|
-
});
|
|
1003
|
-
U(E.data);
|
|
1004
|
-
} catch (E) {
|
|
1005
|
-
console.error("Failed to load replies:", E);
|
|
1006
|
-
}
|
|
1007
|
-
};
|
|
1008
|
-
fe(() => {
|
|
1009
|
-
V && P.length === 0 && S();
|
|
1010
|
-
}, [V]);
|
|
1011
|
-
const h = async (E) => {
|
|
1012
|
-
await a(E, e.id), U((O) => O.filter(($) => $.id !== E));
|
|
1013
|
-
}, B = async (E, O) => {
|
|
1014
|
-
const $ = await l(E, O);
|
|
1015
|
-
$ && P.length > 0 && U(
|
|
1016
|
-
(H) => H.map((N) => N.id === E ? $ : N)
|
|
1017
|
-
);
|
|
1018
|
-
}, K = (E, O) => {
|
|
1019
|
-
Z({ open: !0, variant: O, title: "", message: E });
|
|
1020
|
-
}, W = k.palette.primary.plainColor;
|
|
1021
|
-
return /* @__PURE__ */ v(
|
|
1022
|
-
C,
|
|
1023
|
-
{
|
|
1024
|
-
sx: {
|
|
1025
|
-
mb: M.md,
|
|
1026
|
-
ml: g > 0 ? M.xl : 0,
|
|
1027
|
-
// Only colors change, so the post doesn't shift when the highlight fades
|
|
1028
|
-
...R && {
|
|
1029
|
-
px: M.sm,
|
|
1030
|
-
py: M.xs,
|
|
1031
|
-
borderInlineStart: `3px solid ${b ? W : "transparent"}`,
|
|
1032
|
-
borderRadius: j.xs,
|
|
1033
|
-
bgcolor: b ? `${W}1A` : "transparent",
|
|
1034
|
-
transition: "background-color 0.6s ease, border-color 0.6s ease"
|
|
1035
|
-
}
|
|
1036
|
-
},
|
|
1037
|
-
children: [
|
|
1038
|
-
/* @__PURE__ */ v(C, { sx: { display: "flex", gap: M.sm }, children: [
|
|
1039
|
-
/* @__PURE__ */ t(
|
|
1040
|
-
Ze,
|
|
1041
|
-
{
|
|
1042
|
-
src: (te = e.userModel) == null ? void 0 : te.avatar,
|
|
1043
|
-
alt: ((J = e.userModel) == null ? void 0 : J.name) || e.anonymousNickname || "User",
|
|
1044
|
-
size: "sm",
|
|
1045
|
-
sx: { bgcolor: k.surfaceVariant, color: k.textPrimary }
|
|
1046
|
-
}
|
|
1047
|
-
),
|
|
1048
|
-
/* @__PURE__ */ v(C, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
1049
|
-
/* @__PURE__ */ v(
|
|
1050
|
-
C,
|
|
1051
|
-
{
|
|
1052
|
-
ref: ue,
|
|
1053
|
-
sx: {
|
|
1054
|
-
display: "flex",
|
|
1055
|
-
alignItems: "center",
|
|
1056
|
-
gap: M.xs,
|
|
1057
|
-
mb: M["2xs"]
|
|
1058
|
-
},
|
|
1059
|
-
children: [
|
|
1060
|
-
/* @__PURE__ */ t(
|
|
1061
|
-
z,
|
|
1062
|
-
{
|
|
1063
|
-
level: "title-sm",
|
|
1064
|
-
sx: { fontSize: "0.875em", color: k.textPrimary },
|
|
1065
|
-
children: ((ae = e.userModel) == null ? void 0 : ae.name) || e.anonymousNickname || d("discussion.anonymous", "Anonymous")
|
|
1066
|
-
}
|
|
1067
|
-
),
|
|
1068
|
-
/* @__PURE__ */ t(
|
|
1069
|
-
z,
|
|
1070
|
-
{
|
|
1071
|
-
level: "body-xs",
|
|
1072
|
-
sx: { fontSize: "0.75em", color: k.textSecondary },
|
|
1073
|
-
children: Mt(e.createdAt, d, ne)
|
|
1074
|
-
}
|
|
1075
|
-
),
|
|
1076
|
-
b && /* @__PURE__ */ t(
|
|
1077
|
-
z,
|
|
1078
|
-
{
|
|
1079
|
-
component: "span",
|
|
1080
|
-
level: "body-xs",
|
|
1081
|
-
sx: {
|
|
1082
|
-
fontSize: "0.75em",
|
|
1083
|
-
fontWeight: 600,
|
|
1084
|
-
lineHeight: 1.5,
|
|
1085
|
-
px: M.xs,
|
|
1086
|
-
borderRadius: j.full,
|
|
1087
|
-
color: k.palette.primary.plainColor,
|
|
1088
|
-
bgcolor: `${k.palette.primary.plainColor}1F`
|
|
1089
|
-
},
|
|
1090
|
-
children: d("discussion.newPost", "New")
|
|
1091
|
-
}
|
|
1092
|
-
),
|
|
1093
|
-
/* @__PURE__ */ t(
|
|
1094
|
-
At,
|
|
1095
|
-
{
|
|
1096
|
-
isOwnPost: se,
|
|
1097
|
-
canReport: !!(i && s && !se) && !_,
|
|
1098
|
-
onDelete: () => G(!0),
|
|
1099
|
-
onReport: () => Q(!0),
|
|
1100
|
-
disabled: x
|
|
1101
|
-
}
|
|
1102
|
-
)
|
|
1103
|
-
]
|
|
1104
|
-
}
|
|
1105
|
-
),
|
|
1106
|
-
_ && y ? /* @__PURE__ */ v(
|
|
1107
|
-
C,
|
|
1108
|
-
{
|
|
1109
|
-
sx: {
|
|
1110
|
-
mb: M.xs,
|
|
1111
|
-
mr: M.md,
|
|
1112
|
-
px: M.sm,
|
|
1113
|
-
py: M.xs,
|
|
1114
|
-
borderRadius: j.xs,
|
|
1115
|
-
borderLeft: `3px solid ${k.outlineEnabledBorder}`,
|
|
1116
|
-
bgcolor: k.surfaceVariant,
|
|
1117
|
-
display: "flex",
|
|
1118
|
-
alignItems: "flex-start",
|
|
1119
|
-
gap: M.xs
|
|
1120
|
-
},
|
|
1121
|
-
children: [
|
|
1122
|
-
/* @__PURE__ */ t(
|
|
1123
|
-
ht,
|
|
1124
|
-
{
|
|
1125
|
-
sx: {
|
|
1126
|
-
fontSize: "0.9375em",
|
|
1127
|
-
color: k.textSecondary,
|
|
1128
|
-
mt: "2px",
|
|
1129
|
-
flexShrink: 0
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
),
|
|
1133
|
-
/* @__PURE__ */ t(
|
|
1134
|
-
z,
|
|
1135
|
-
{
|
|
1136
|
-
level: "body-sm",
|
|
1137
|
-
sx: {
|
|
1138
|
-
fontSize: "0.875em",
|
|
1139
|
-
fontStyle: "italic",
|
|
1140
|
-
color: k.textSecondary,
|
|
1141
|
-
lineHeight: 1.5
|
|
1142
|
-
},
|
|
1143
|
-
children: e.moderatedReason || d(
|
|
1144
|
-
"discussion.moderatedPost",
|
|
1145
|
-
"This comment has been moderated"
|
|
1146
|
-
)
|
|
1147
|
-
}
|
|
1148
|
-
)
|
|
1149
|
-
]
|
|
1150
|
-
}
|
|
1151
|
-
) : /* @__PURE__ */ t(
|
|
1152
|
-
z,
|
|
1153
|
-
{
|
|
1154
|
-
level: "body-sm",
|
|
1155
|
-
sx: {
|
|
1156
|
-
fontSize: "0.875em",
|
|
1157
|
-
mb: M.xs,
|
|
1158
|
-
whiteSpace: "pre-wrap",
|
|
1159
|
-
color: k.textBody
|
|
1160
|
-
},
|
|
1161
|
-
children: e.content
|
|
1162
|
-
}
|
|
1163
|
-
),
|
|
1164
|
-
!_ && /* @__PURE__ */ t(
|
|
1165
|
-
Dt,
|
|
1166
|
-
{
|
|
1167
|
-
post: e,
|
|
1168
|
-
sdk: r,
|
|
1169
|
-
userIsLoggedIn: s,
|
|
1170
|
-
onSignInClick: u,
|
|
1171
|
-
onReact: l,
|
|
1172
|
-
showReactions: m,
|
|
1173
|
-
showReplyButton: n && g < 2,
|
|
1174
|
-
onReplyClick: () => Y(!de),
|
|
1175
|
-
isBanned: x
|
|
1176
|
-
}
|
|
1177
|
-
),
|
|
1178
|
-
n && e.repliesCount > 0 && /* @__PURE__ */ t(C, { sx: { mb: M.xs }, children: /* @__PURE__ */ v(
|
|
1179
|
-
z,
|
|
1180
|
-
{
|
|
1181
|
-
level: "body-sm",
|
|
1182
|
-
sx: {
|
|
1183
|
-
fontSize: "0.875em",
|
|
1184
|
-
color: k.palette.primary.plainColor,
|
|
1185
|
-
cursor: "pointer",
|
|
1186
|
-
fontWeight: 600,
|
|
1187
|
-
display: "flex",
|
|
1188
|
-
alignItems: "center",
|
|
1189
|
-
gap: M["2xs"]
|
|
1190
|
-
},
|
|
1191
|
-
onClick: () => q(!V),
|
|
1192
|
-
children: [
|
|
1193
|
-
V ? d("discussion.hideReplies", "Hide replies") : d("discussion.repliesCount", "{{count}} replies", {
|
|
1194
|
-
count: e.repliesCount
|
|
1195
|
-
}),
|
|
1196
|
-
!V && " ▼"
|
|
1197
|
-
]
|
|
1198
|
-
}
|
|
1199
|
-
) }),
|
|
1200
|
-
de && !_ && /* @__PURE__ */ t(C, { sx: { mt: M.md }, children: /* @__PURE__ */ t(
|
|
1201
|
-
Be,
|
|
1202
|
-
{
|
|
1203
|
-
onSubmit: p,
|
|
1204
|
-
userIsLoggedIn: s,
|
|
1205
|
-
onSignInClick: u,
|
|
1206
|
-
placeholder: d("discussion.writeReply", "Write a reply..."),
|
|
1207
|
-
isSubmitting: c,
|
|
1208
|
-
replyTo: ((be = e.userModel) == null ? void 0 : be.name) || e.anonymousNickname,
|
|
1209
|
-
onCancel: () => Y(!1),
|
|
1210
|
-
disabled: x
|
|
1211
|
-
}
|
|
1212
|
-
) }),
|
|
1213
|
-
V && P.length > 0 && /* @__PURE__ */ t(C, { sx: { mt: M.md }, children: P.map((E) => /* @__PURE__ */ t(
|
|
1214
|
-
Ne,
|
|
1215
|
-
{
|
|
1216
|
-
post: E,
|
|
1217
|
-
sdk: r,
|
|
1218
|
-
userIsLoggedIn: s,
|
|
1219
|
-
onSignInClick: u,
|
|
1220
|
-
showReactions: m,
|
|
1221
|
-
showReplies: n,
|
|
1222
|
-
showReportPost: i,
|
|
1223
|
-
onReply: o,
|
|
1224
|
-
onReact: B,
|
|
1225
|
-
onDelete: h,
|
|
1226
|
-
onReport: f,
|
|
1227
|
-
isSubmitting: c,
|
|
1228
|
-
showModeratedPosts: y,
|
|
1229
|
-
isBanned: x,
|
|
1230
|
-
depth: g + 1,
|
|
1231
|
-
parentPostId: g === 0 ? e.id : w,
|
|
1232
|
-
onReplyCreated: g === 0 ? S : void 0,
|
|
1233
|
-
onDeleteSuccess: L
|
|
1234
|
-
},
|
|
1235
|
-
E.id
|
|
1236
|
-
)) })
|
|
1237
|
-
] })
|
|
1238
|
-
] }),
|
|
1239
|
-
/* @__PURE__ */ t(
|
|
1240
|
-
zt,
|
|
1241
|
-
{
|
|
1242
|
-
open: ee,
|
|
1243
|
-
onClose: () => G(!1),
|
|
1244
|
-
onConfirm: async () => {
|
|
1245
|
-
await a(e.id), L == null || L();
|
|
1246
|
-
},
|
|
1247
|
-
onError: (E) => K(E, "error"),
|
|
1248
|
-
container: I
|
|
1249
|
-
}
|
|
1250
|
-
),
|
|
1251
|
-
/* @__PURE__ */ t(
|
|
1252
|
-
It,
|
|
1253
|
-
{
|
|
1254
|
-
open: re,
|
|
1255
|
-
onClose: () => Q(!1),
|
|
1256
|
-
onSubmit: (E, O) => f(e.id, E, O),
|
|
1257
|
-
onSuccess: (E) => K(E, "success"),
|
|
1258
|
-
onError: (E) => K(E, "error"),
|
|
1259
|
-
container: I
|
|
1260
|
-
}
|
|
1261
|
-
),
|
|
1262
|
-
/* @__PURE__ */ t(
|
|
1263
|
-
Ie,
|
|
1264
|
-
{
|
|
1265
|
-
notification: ye,
|
|
1266
|
-
onClose: () => Z((E) => ({ ...E, open: !1 }))
|
|
1267
|
-
}
|
|
1268
|
-
)
|
|
1269
|
-
]
|
|
1270
|
-
}
|
|
1271
|
-
);
|
|
1272
|
-
}, we = 864e5, ze = -1, $t = ({
|
|
1273
|
-
ban: e,
|
|
1274
|
-
showBanHistory: r = !1
|
|
1275
|
-
}) => {
|
|
1276
|
-
const { t: s } = he(), { language: u } = ve(Ce), m = le(), n = pe(), i = Re(), o = ce(), [l, a] = T(!1), f = m.palette.danger.plainColor, c = Te(u), y = (d) => new Date(d).toLocaleDateString(c, { dateStyle: "medium" }), x = (d) => new Date(d).toLocaleString(c, {
|
|
1277
|
-
dateStyle: "medium",
|
|
1278
|
-
timeStyle: "short"
|
|
1279
|
-
}), { activeBan: R } = e, b = R.bannedPeriodInDays === ze, D = new Date(
|
|
1280
|
-
new Date(R.bannedAt).getTime() + R.bannedPeriodInDays * we
|
|
1281
|
-
), g = Math.max(
|
|
1282
|
-
1,
|
|
1283
|
-
Math.ceil((D.getTime() - Date.now()) / we)
|
|
1284
|
-
), w = (e.history || []).filter(
|
|
1285
|
-
(d) => d.bannedAt !== R.bannedAt
|
|
1286
|
-
), F = { fontSize: "0.8125em", color: m.textSecondary }, L = {
|
|
1287
|
-
fontSize: "0.75em",
|
|
1288
|
-
fontWeight: 600,
|
|
1289
|
-
color: f,
|
|
1290
|
-
border: `1px solid ${f}`,
|
|
1291
|
-
borderRadius: n.lg,
|
|
1292
|
-
px: o.xs,
|
|
1293
|
-
py: "0.125em"
|
|
1294
|
-
};
|
|
1295
|
-
return /* @__PURE__ */ t(
|
|
1296
|
-
C,
|
|
1297
|
-
{
|
|
1298
|
-
role: "status",
|
|
1299
|
-
sx: {
|
|
1300
|
-
fontSize: "1em",
|
|
1301
|
-
mb: o.sm,
|
|
1302
|
-
p: o.md,
|
|
1303
|
-
bgcolor: m.palette.danger.softBg,
|
|
1304
|
-
borderLeft: `4px solid ${f}`,
|
|
1305
|
-
borderRadius: n.sm
|
|
1306
|
-
},
|
|
1307
|
-
children: /* @__PURE__ */ v(
|
|
1308
|
-
C,
|
|
1309
|
-
{
|
|
1310
|
-
sx: { display: "flex", gap: o.sm, alignItems: "flex-start" },
|
|
1311
|
-
children: [
|
|
1312
|
-
/* @__PURE__ */ t(
|
|
1313
|
-
C,
|
|
1314
|
-
{
|
|
1315
|
-
sx: {
|
|
1316
|
-
flexShrink: 0,
|
|
1317
|
-
display: "flex",
|
|
1318
|
-
alignItems: "center",
|
|
1319
|
-
justifyContent: "center",
|
|
1320
|
-
width: "2.25em",
|
|
1321
|
-
height: "2.25em",
|
|
1322
|
-
borderRadius: "50%",
|
|
1323
|
-
bgcolor: `${f}1F`,
|
|
1324
|
-
color: f
|
|
1325
|
-
},
|
|
1326
|
-
children: /* @__PURE__ */ t(yt, { sx: { fontSize: "1.25em" } })
|
|
1327
|
-
}
|
|
1328
|
-
),
|
|
1329
|
-
/* @__PURE__ */ v(C, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
1330
|
-
/* @__PURE__ */ t(
|
|
1331
|
-
z,
|
|
1332
|
-
{
|
|
1333
|
-
level: "title-md",
|
|
1334
|
-
sx: {
|
|
1335
|
-
fontSize: "1em",
|
|
1336
|
-
fontWeight: 700,
|
|
1337
|
-
fontFamily: i.primary,
|
|
1338
|
-
color: m.textPrimary
|
|
1339
|
-
},
|
|
1340
|
-
children: s("discussion.ban.title", "You've been banned from commenting")
|
|
1341
|
-
}
|
|
1342
|
-
),
|
|
1343
|
-
/* @__PURE__ */ t(
|
|
1344
|
-
z,
|
|
1345
|
-
{
|
|
1346
|
-
level: "body-sm",
|
|
1347
|
-
sx: {
|
|
1348
|
-
fontSize: "0.875em",
|
|
1349
|
-
color: m.textBody,
|
|
1350
|
-
mt: o["2xs"]
|
|
1351
|
-
},
|
|
1352
|
-
children: b ? s(
|
|
1353
|
-
"discussion.ban.descriptionPermanent",
|
|
1354
|
-
"You can still read the discussion, but you can no longer post, reply or react."
|
|
1355
|
-
) : s(
|
|
1356
|
-
"discussion.ban.description",
|
|
1357
|
-
"You can still read the discussion, but you can't post, reply or react until the ban ends."
|
|
1358
|
-
)
|
|
1359
|
-
}
|
|
1360
|
-
),
|
|
1361
|
-
/* @__PURE__ */ v(
|
|
1362
|
-
C,
|
|
1363
|
-
{
|
|
1364
|
-
sx: {
|
|
1365
|
-
display: "flex",
|
|
1366
|
-
flexWrap: "wrap",
|
|
1367
|
-
alignItems: "center",
|
|
1368
|
-
gap: o.xs,
|
|
1369
|
-
mt: o.sm
|
|
1370
|
-
},
|
|
1371
|
-
children: [
|
|
1372
|
-
/* @__PURE__ */ t(z, { component: "span", sx: L, children: b ? s("discussion.ban.permanent", "Permanent ban") : s("discussion.ban.daysLeft", "{{count}} days left", {
|
|
1373
|
-
count: g
|
|
1374
|
-
}) }),
|
|
1375
|
-
/* @__PURE__ */ t(z, { component: "span", sx: F, children: s("discussion.ban.since", "Since {{date}}", {
|
|
1376
|
-
date: y(R.bannedAt)
|
|
1377
|
-
}) }),
|
|
1378
|
-
!b && /* @__PURE__ */ v(z, { component: "span", sx: F, children: [
|
|
1379
|
-
"·",
|
|
1380
|
-
" ",
|
|
1381
|
-
s("discussion.ban.until", "Until {{date}}", {
|
|
1382
|
-
date: x(D)
|
|
1383
|
-
})
|
|
1384
|
-
] })
|
|
1385
|
-
]
|
|
1386
|
-
}
|
|
1387
|
-
),
|
|
1388
|
-
R.bannedReason && /* @__PURE__ */ v(
|
|
1389
|
-
C,
|
|
1390
|
-
{
|
|
1391
|
-
sx: {
|
|
1392
|
-
mt: o.sm,
|
|
1393
|
-
px: o.sm,
|
|
1394
|
-
py: o.xs,
|
|
1395
|
-
bgcolor: m.surface,
|
|
1396
|
-
borderRadius: n.xs
|
|
1397
|
-
},
|
|
1398
|
-
children: [
|
|
1399
|
-
/* @__PURE__ */ t(
|
|
1400
|
-
z,
|
|
1401
|
-
{
|
|
1402
|
-
level: "body-xs",
|
|
1403
|
-
sx: {
|
|
1404
|
-
fontSize: "0.75em",
|
|
1405
|
-
fontWeight: 600,
|
|
1406
|
-
textTransform: "uppercase",
|
|
1407
|
-
color: m.textSecondary
|
|
1408
|
-
},
|
|
1409
|
-
children: s("discussion.ban.reason", "Reason")
|
|
1410
|
-
}
|
|
1411
|
-
),
|
|
1412
|
-
/* @__PURE__ */ t(
|
|
1413
|
-
z,
|
|
1414
|
-
{
|
|
1415
|
-
level: "body-sm",
|
|
1416
|
-
sx: {
|
|
1417
|
-
fontSize: "0.875em",
|
|
1418
|
-
color: m.textPrimary,
|
|
1419
|
-
whiteSpace: "pre-wrap",
|
|
1420
|
-
unicodeBidi: "plaintext"
|
|
1421
|
-
},
|
|
1422
|
-
children: R.bannedReason
|
|
1423
|
-
}
|
|
1424
|
-
)
|
|
1425
|
-
]
|
|
1426
|
-
}
|
|
1427
|
-
),
|
|
1428
|
-
r && w.length > 0 && /* @__PURE__ */ v(C, { sx: { mt: o.sm }, children: [
|
|
1429
|
-
/* @__PURE__ */ v(
|
|
1430
|
-
z,
|
|
1431
|
-
{
|
|
1432
|
-
component: "button",
|
|
1433
|
-
type: "button",
|
|
1434
|
-
"aria-expanded": l,
|
|
1435
|
-
onClick: () => a((d) => !d),
|
|
1436
|
-
sx: {
|
|
1437
|
-
fontSize: "0.8125em",
|
|
1438
|
-
fontWeight: 600,
|
|
1439
|
-
fontFamily: i.primary,
|
|
1440
|
-
color: m.textPrimary,
|
|
1441
|
-
display: "inline-flex",
|
|
1442
|
-
alignItems: "center",
|
|
1443
|
-
gap: o["2xs"],
|
|
1444
|
-
p: 0,
|
|
1445
|
-
border: "none",
|
|
1446
|
-
bgcolor: "transparent",
|
|
1447
|
-
cursor: "pointer"
|
|
1448
|
-
},
|
|
1449
|
-
children: [
|
|
1450
|
-
s("discussion.ban.previousBans", "Previous bans ({{count}})", {
|
|
1451
|
-
count: w.length
|
|
1452
|
-
}),
|
|
1453
|
-
/* @__PURE__ */ t(
|
|
1454
|
-
xt,
|
|
1455
|
-
{
|
|
1456
|
-
sx: {
|
|
1457
|
-
fontSize: "1.25em",
|
|
1458
|
-
transition: "transform 0.2s",
|
|
1459
|
-
transform: l ? "rotate(180deg)" : "none"
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
)
|
|
1463
|
-
]
|
|
1464
|
-
}
|
|
1465
|
-
),
|
|
1466
|
-
l && /* @__PURE__ */ t(
|
|
1467
|
-
C,
|
|
1468
|
-
{
|
|
1469
|
-
component: "ul",
|
|
1470
|
-
sx: { listStyle: "none", m: 0, p: 0, mt: o.xs },
|
|
1471
|
-
children: w.map((d) => {
|
|
1472
|
-
const I = d.unbannedAt ?? (d.bannedPeriodInDays > 0 ? new Date(
|
|
1473
|
-
new Date(d.bannedAt).getTime() + d.bannedPeriodInDays * we
|
|
1474
|
-
) : null);
|
|
1475
|
-
return /* @__PURE__ */ v(
|
|
1476
|
-
C,
|
|
1477
|
-
{
|
|
1478
|
-
component: "li",
|
|
1479
|
-
sx: {
|
|
1480
|
-
py: o.xs,
|
|
1481
|
-
borderTop: `1px solid ${f}33`
|
|
1482
|
-
},
|
|
1483
|
-
children: [
|
|
1484
|
-
/* @__PURE__ */ v(
|
|
1485
|
-
z,
|
|
1486
|
-
{
|
|
1487
|
-
sx: {
|
|
1488
|
-
...F,
|
|
1489
|
-
fontWeight: 600,
|
|
1490
|
-
color: m.textPrimary
|
|
1491
|
-
},
|
|
1492
|
-
children: [
|
|
1493
|
-
y(d.bannedAt),
|
|
1494
|
-
I && ` – ${y(I)}`,
|
|
1495
|
-
d.bannedPeriodInDays === ze && ` · ${s("discussion.ban.permanent", "Permanent ban")}`,
|
|
1496
|
-
d.bannedPeriodInDays > 0 && ` · ${s("discussion.ban.days", "{{count}} days", { count: d.bannedPeriodInDays })}`
|
|
1497
|
-
]
|
|
1498
|
-
}
|
|
1499
|
-
),
|
|
1500
|
-
d.bannedReason && /* @__PURE__ */ t(
|
|
1501
|
-
z,
|
|
1502
|
-
{
|
|
1503
|
-
sx: { ...F, unicodeBidi: "plaintext" },
|
|
1504
|
-
children: d.bannedReason
|
|
1505
|
-
}
|
|
1506
|
-
),
|
|
1507
|
-
d.unbannedAt && /* @__PURE__ */ v(z, { sx: { ...F, fontStyle: "italic" }, children: [
|
|
1508
|
-
s("discussion.ban.lifted", "Lifted on {{date}}", {
|
|
1509
|
-
date: y(d.unbannedAt)
|
|
1510
|
-
}),
|
|
1511
|
-
d.unbannedReason && /* @__PURE__ */ v(Se, { children: [
|
|
1512
|
-
": ",
|
|
1513
|
-
/* @__PURE__ */ t(
|
|
1514
|
-
C,
|
|
1515
|
-
{
|
|
1516
|
-
component: "span",
|
|
1517
|
-
sx: { unicodeBidi: "isolate" },
|
|
1518
|
-
children: d.unbannedReason
|
|
1519
|
-
}
|
|
1520
|
-
)
|
|
1521
|
-
] })
|
|
1522
|
-
] })
|
|
1523
|
-
]
|
|
1524
|
-
},
|
|
1525
|
-
d.bannedAt
|
|
1526
|
-
);
|
|
1527
|
-
})
|
|
1528
|
-
}
|
|
1529
|
-
)
|
|
1530
|
-
] })
|
|
1531
|
-
] })
|
|
1532
|
-
]
|
|
1533
|
-
}
|
|
1534
|
-
)
|
|
1535
|
-
}
|
|
1536
|
-
);
|
|
1537
|
-
}, Lt = (e) => {
|
|
1538
|
-
var r, s, u;
|
|
1539
|
-
return (((r = e == null ? void 0 : e.error) == null ? void 0 : r.code) ?? ((u = (s = e == null ? void 0 : e.data) == null ? void 0 : s.error) == null ? void 0 : u.code) ?? (e == null ? void 0 : e.status)) === 429;
|
|
1540
|
-
}, Bt = ({
|
|
1541
|
-
discussion: e,
|
|
1542
|
-
posts: r,
|
|
1543
|
-
postsHidden: s = !1,
|
|
1544
|
-
sdk: u,
|
|
1545
|
-
userIsLoggedIn: m,
|
|
1546
|
-
onSignInClick: n,
|
|
1547
|
-
showReactions: i,
|
|
1548
|
-
showReplies: o,
|
|
1549
|
-
showReportPost: l,
|
|
1550
|
-
currentSort: a,
|
|
1551
|
-
onSortChange: f,
|
|
1552
|
-
onCreatePost: c,
|
|
1553
|
-
onReact: y,
|
|
1554
|
-
onDeletePost: x,
|
|
1555
|
-
onReportPost: R,
|
|
1556
|
-
onLoadMore: b,
|
|
1557
|
-
hasMore: D,
|
|
1558
|
-
liveRefresh: g = !1,
|
|
1559
|
-
newPostIds: w,
|
|
1560
|
-
onNewPostSeen: F,
|
|
1561
|
-
isLoading: L,
|
|
1562
|
-
isSubmitting: d,
|
|
1563
|
-
infiniteScroll: I = !1,
|
|
1564
|
-
showModeratedPosts: ne = !1,
|
|
1565
|
-
ban: k,
|
|
1566
|
-
isBanned: j = !1,
|
|
1567
|
-
showBanHistory: M = !1
|
|
1568
|
-
}) => {
|
|
1569
|
-
const { t: A } = he(), { shadowRootElement: de } = ve(Ce), Y = pe(), P = le(), U = ce(), V = oe(null), q = oe(null);
|
|
1570
|
-
fe(() => {
|
|
1571
|
-
if (!I || !q.current) return;
|
|
1572
|
-
const p = new IntersectionObserver(
|
|
1573
|
-
(S) => {
|
|
1574
|
-
S[0].isIntersecting && D && !L && b();
|
|
1575
|
-
},
|
|
1576
|
-
{ root: V.current, threshold: 0.1 }
|
|
1577
|
-
);
|
|
1578
|
-
return p.observe(q.current), () => p.disconnect();
|
|
1579
|
-
}, [I, D, L, b]);
|
|
1580
|
-
const [ee, G] = T({ open: !1, variant: "success", title: "", message: "" }), re = () => {
|
|
1581
|
-
G({
|
|
1582
|
-
open: !0,
|
|
1583
|
-
variant: "success",
|
|
1584
|
-
title: "",
|
|
1585
|
-
message: A("discussion.delete.success", "Comment deleted successfully.")
|
|
1586
|
-
});
|
|
1587
|
-
}, Q = (p, S) => {
|
|
1588
|
-
Le(p) || G({
|
|
1589
|
-
open: !0,
|
|
1590
|
-
variant: "error",
|
|
1591
|
-
title: "",
|
|
1592
|
-
message: Lt(p) ? A(
|
|
1593
|
-
"discussion.rateLimited",
|
|
1594
|
-
"You're doing that too often. Please wait a moment and try again."
|
|
1595
|
-
) : S
|
|
1596
|
-
});
|
|
1597
|
-
}, ye = async (p, S) => {
|
|
1598
|
-
try {
|
|
1599
|
-
return await y(p, S);
|
|
1600
|
-
} catch (h) {
|
|
1601
|
-
throw Q(
|
|
1602
|
-
h,
|
|
1603
|
-
A("discussion.reactError", "Failed to add reaction. Please try again.")
|
|
1604
|
-
), h;
|
|
1605
|
-
}
|
|
1606
|
-
}, Z = async (p, S) => {
|
|
1607
|
-
try {
|
|
1608
|
-
await c(p, S);
|
|
1609
|
-
} catch (h) {
|
|
1610
|
-
throw Q(
|
|
1611
|
-
h,
|
|
1612
|
-
A("discussion.postError", "Failed to post comment. Please try again.")
|
|
1613
|
-
), h;
|
|
1614
|
-
}
|
|
1615
|
-
G({
|
|
1616
|
-
open: !0,
|
|
1617
|
-
variant: "success",
|
|
1618
|
-
title: "",
|
|
1619
|
-
message: A("discussion.postSuccess", "Comment posted successfully.")
|
|
1620
|
-
});
|
|
1621
|
-
}, ue = [
|
|
1622
|
-
{ value: "LATEST", label: A("discussion.sort.latest", "Latest") },
|
|
1623
|
-
{ value: "OLDEST", label: A("discussion.sort.oldest", "Oldest") },
|
|
1624
|
-
{ value: "POPULAR", label: A("discussion.sort.popular", "Popular") },
|
|
1625
|
-
{
|
|
1626
|
-
value: "INTERACTED",
|
|
1627
|
-
label: A("discussion.sort.interacted", "Most Interacted")
|
|
1628
|
-
}
|
|
1629
|
-
], se = {
|
|
1630
|
-
listbox: {
|
|
1631
|
-
container: de,
|
|
1632
|
-
sx: {
|
|
1633
|
-
zIndex: 1300,
|
|
1634
|
-
bgcolor: P.surface,
|
|
1635
|
-
border: `1px solid ${P.outlineEnabledBorder}`,
|
|
1636
|
-
borderRadius: Y.sm,
|
|
1637
|
-
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
}, _ = {
|
|
1641
|
-
fontSize: "1em",
|
|
1642
|
-
color: `${P.textPrimary} !important`,
|
|
1643
|
-
bgcolor: `${P.surface} !important`,
|
|
1644
|
-
"&:hover": {
|
|
1645
|
-
bgcolor: `${P.surfaceVariant} !important`,
|
|
1646
|
-
color: `${P.textPrimary} !important`
|
|
1647
|
-
},
|
|
1648
|
-
"&.Mui-selected": {
|
|
1649
|
-
bgcolor: `${P.surfaceVariant} !important`,
|
|
1650
|
-
color: `${P.textPrimary} !important`
|
|
1651
|
-
},
|
|
1652
|
-
"&.Mui-selected:hover": {
|
|
1653
|
-
bgcolor: `${P.surfaceVariant} !important`,
|
|
1654
|
-
color: `${P.textPrimary} !important`
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
return /* @__PURE__ */ v(
|
|
1658
|
-
C,
|
|
1659
|
-
{
|
|
1660
|
-
ref: V,
|
|
1661
|
-
sx: {
|
|
1662
|
-
mx: "auto",
|
|
1663
|
-
maxHeight: "100%",
|
|
1664
|
-
overflowY: "auto",
|
|
1665
|
-
bgcolor: P.surface
|
|
1666
|
-
},
|
|
1667
|
-
children: [
|
|
1668
|
-
/* @__PURE__ */ v(C, { sx: { mb: U.lg }, children: [
|
|
1669
|
-
/* @__PURE__ */ t(z, { level: "h3", sx: { fontSize: "1.5em", mb: U.xs }, children: e.label || A("discussion.title", "Discussion") }),
|
|
1670
|
-
!s && /* @__PURE__ */ t(z, { level: "body-sm", sx: { fontSize: "0.875em", color: P.textSecondary }, children: A("discussion.postsCount", "{{count}} posts", {
|
|
1671
|
-
count: e.postsCount || 0
|
|
1672
|
-
}) })
|
|
1673
|
-
] }),
|
|
1674
|
-
j && k && /* @__PURE__ */ t($t, { ban: k, showBanHistory: M }),
|
|
1675
|
-
/* @__PURE__ */ t(
|
|
1676
|
-
Be,
|
|
1677
|
-
{
|
|
1678
|
-
onSubmit: (p) => Z(p),
|
|
1679
|
-
userIsLoggedIn: m,
|
|
1680
|
-
onSignInClick: n,
|
|
1681
|
-
isSubmitting: d,
|
|
1682
|
-
disabled: j
|
|
1683
|
-
}
|
|
1684
|
-
),
|
|
1685
|
-
!s && /* @__PURE__ */ v(Se, { children: [
|
|
1686
|
-
/* @__PURE__ */ t(et, { sx: { my: U.lg } }),
|
|
1687
|
-
/* @__PURE__ */ v(
|
|
1688
|
-
C,
|
|
1689
|
-
{
|
|
1690
|
-
sx: {
|
|
1691
|
-
mb: U.lg,
|
|
1692
|
-
display: "flex",
|
|
1693
|
-
justifyContent: "space-between",
|
|
1694
|
-
alignItems: "center"
|
|
1695
|
-
},
|
|
1696
|
-
children: [
|
|
1697
|
-
/* @__PURE__ */ t(z, { level: "title-md", sx: { fontSize: "1em" }, children: A("discussion.comments", "Comments") }),
|
|
1698
|
-
/* @__PURE__ */ t(
|
|
1699
|
-
tt,
|
|
1700
|
-
{
|
|
1701
|
-
value: a,
|
|
1702
|
-
onChange: (p, S) => S && f(S),
|
|
1703
|
-
size: "sm",
|
|
1704
|
-
sx: {
|
|
1705
|
-
fontSize: "1em",
|
|
1706
|
-
minWidth: 150,
|
|
1707
|
-
bgcolor: P.surfaceVariant,
|
|
1708
|
-
color: P.textPrimary,
|
|
1709
|
-
border: `1px solid ${P.outlineEnabledBorder}`,
|
|
1710
|
-
borderRadius: Y.sm,
|
|
1711
|
-
boxShadow: "none",
|
|
1712
|
-
"&:hover": {
|
|
1713
|
-
bgcolor: P.surfaceVariant,
|
|
1714
|
-
boxShadow: "none"
|
|
1715
|
-
}
|
|
1716
|
-
},
|
|
1717
|
-
slotProps: se,
|
|
1718
|
-
children: ue.map((p) => /* @__PURE__ */ t(ot, { value: p.value, sx: _, children: p.label }, p.value))
|
|
1719
|
-
}
|
|
1720
|
-
)
|
|
1721
|
-
]
|
|
1722
|
-
}
|
|
1723
|
-
),
|
|
1724
|
-
L && r.length === 0 ? /* @__PURE__ */ t(C, { sx: { py: U.xl }, children: /* @__PURE__ */ t(Pe, { my: 4 }) }) : r.length === 0 ? /* @__PURE__ */ t(C, { sx: { textAlign: "center", py: U.xl }, children: /* @__PURE__ */ t(z, { level: "body-md", sx: { fontSize: "1em", color: P.textSecondary }, children: A(
|
|
1725
|
-
"discussion.noPosts",
|
|
1726
|
-
"No comments yet. Be the first to comment!"
|
|
1727
|
-
) }) }) : /* @__PURE__ */ v(Se, { children: [
|
|
1728
|
-
/* @__PURE__ */ t(C, { children: r.map((p) => /* @__PURE__ */ t(
|
|
1729
|
-
Ne,
|
|
1730
|
-
{
|
|
1731
|
-
post: p,
|
|
1732
|
-
sdk: u,
|
|
1733
|
-
userIsLoggedIn: m,
|
|
1734
|
-
onSignInClick: n,
|
|
1735
|
-
showReactions: i,
|
|
1736
|
-
showReplies: o,
|
|
1737
|
-
showReportPost: l,
|
|
1738
|
-
onReply: (S, h) => Z(h, S),
|
|
1739
|
-
onReact: ye,
|
|
1740
|
-
onDelete: x,
|
|
1741
|
-
onReport: R,
|
|
1742
|
-
isSubmitting: d,
|
|
1743
|
-
showModeratedPosts: ne,
|
|
1744
|
-
isBanned: j,
|
|
1745
|
-
highlightable: g,
|
|
1746
|
-
isNew: w == null ? void 0 : w.has(p.id),
|
|
1747
|
-
onNewSeen: F,
|
|
1748
|
-
onDeleteSuccess: re
|
|
1749
|
-
},
|
|
1750
|
-
p.id
|
|
1751
|
-
)) }),
|
|
1752
|
-
I && /* @__PURE__ */ t(C, { ref: q, sx: { height: 1 } })
|
|
1753
|
-
] }),
|
|
1754
|
-
I && L && r.length > 0 && /* @__PURE__ */ t(C, { sx: { py: U.md }, children: /* @__PURE__ */ t(Pe, { my: 2 }) }),
|
|
1755
|
-
!I && D && /* @__PURE__ */ t(C, { sx: { display: "flex", justifyContent: "center", mt: U.lg }, children: /* @__PURE__ */ t(
|
|
1756
|
-
ie,
|
|
1757
|
-
{
|
|
1758
|
-
variant: "outlined",
|
|
1759
|
-
onClick: b,
|
|
1760
|
-
loading: L,
|
|
1761
|
-
disabled: L,
|
|
1762
|
-
sx: {
|
|
1763
|
-
fontSize: "1em",
|
|
1764
|
-
borderColor: P.palette.primary.plainColor,
|
|
1765
|
-
color: P.palette.primary.plainColor,
|
|
1766
|
-
borderRadius: Y.sm,
|
|
1767
|
-
"&:hover": {
|
|
1768
|
-
bgcolor: `${P.palette.primary.plainColor}14`,
|
|
1769
|
-
borderColor: P.palette.primary.plainColor
|
|
1770
|
-
},
|
|
1771
|
-
"&:disabled": {
|
|
1772
|
-
borderColor: P.palette.primary.plainColor,
|
|
1773
|
-
color: P.palette.primary.plainColor,
|
|
1774
|
-
opacity: 0.4
|
|
1775
|
-
}
|
|
1776
|
-
},
|
|
1777
|
-
children: A("discussion.loadMore", "Load More")
|
|
1778
|
-
}
|
|
1779
|
-
) })
|
|
1780
|
-
] }),
|
|
1781
|
-
/* @__PURE__ */ t(
|
|
1782
|
-
Ie,
|
|
1783
|
-
{
|
|
1784
|
-
notification: ee,
|
|
1785
|
-
onClose: () => G((p) => ({ ...p, open: !1 }))
|
|
1786
|
-
}
|
|
1787
|
-
)
|
|
1788
|
-
]
|
|
1789
|
-
}
|
|
1790
|
-
);
|
|
1791
|
-
}, kt = (e) => {
|
|
1792
|
-
const {
|
|
1793
|
-
entityId: r,
|
|
1794
|
-
sdk: s,
|
|
1795
|
-
discussionLabel: u,
|
|
1796
|
-
discussionUrl: m = "",
|
|
1797
|
-
defaultSort: n = "LATEST",
|
|
1798
|
-
postsPerPage: i = 20,
|
|
1799
|
-
showReactions: o = !0,
|
|
1800
|
-
showReplies: l = !0,
|
|
1801
|
-
showReportPost: a = !0,
|
|
1802
|
-
infiniteScroll: f = !1,
|
|
1803
|
-
showModeratedPosts: c = !1,
|
|
1804
|
-
userIsLoggedIn: y = !1,
|
|
1805
|
-
showBanHistory: x = !1,
|
|
1806
|
-
refreshInterval: R = 0,
|
|
1807
|
-
onSignInClick: b
|
|
1808
|
-
} = e, { ban: D, isBanned: g, refresh: w } = Pt(s, y), {
|
|
1809
|
-
discussion: F,
|
|
1810
|
-
setDiscussion: L,
|
|
1811
|
-
isLoading: d,
|
|
1812
|
-
error: I,
|
|
1813
|
-
isNotFound: ne
|
|
1814
|
-
} = St(s, r), k = (se) => {
|
|
1815
|
-
L(
|
|
1816
|
-
(_) => _ && { ..._, postsCount: Math.max(0, _.postsCount + se) }
|
|
1817
|
-
);
|
|
1818
|
-
}, {
|
|
1819
|
-
posts: j,
|
|
1820
|
-
postsHidden: M,
|
|
1821
|
-
isLoading: A,
|
|
1822
|
-
isSubmitting: de,
|
|
1823
|
-
currentSort: Y,
|
|
1824
|
-
hasMore: P,
|
|
1825
|
-
newPostIds: U,
|
|
1826
|
-
markPostSeen: V,
|
|
1827
|
-
handleSortChange: q,
|
|
1828
|
-
handleLoadMore: ee,
|
|
1829
|
-
handleCreatePost: G,
|
|
1830
|
-
handleReact: re,
|
|
1831
|
-
handleDeletePost: Q,
|
|
1832
|
-
handleReportPost: ye
|
|
1833
|
-
} = Ct(
|
|
1834
|
-
s,
|
|
1835
|
-
r,
|
|
1836
|
-
u || null,
|
|
1837
|
-
m,
|
|
1838
|
-
n,
|
|
1839
|
-
i,
|
|
1840
|
-
k,
|
|
1841
|
-
c,
|
|
1842
|
-
R
|
|
1843
|
-
), Z = (se) => async (..._) => {
|
|
1844
|
-
try {
|
|
1845
|
-
return await se(..._);
|
|
1846
|
-
} catch (p) {
|
|
1847
|
-
throw Le(p) && w(), p;
|
|
1848
|
-
}
|
|
1849
|
-
};
|
|
1850
|
-
if (d || !F && !ne && A)
|
|
1851
|
-
return /* @__PURE__ */ t(Pe, { my: 20 });
|
|
1852
|
-
if (I)
|
|
1853
|
-
return /* @__PURE__ */ t("div", { style: { padding: "20px", textAlign: "center" }, children: /* @__PURE__ */ t("p", { children: "Failed to load discussion. Please try again later." }) });
|
|
1854
|
-
const ue = F || {
|
|
1855
|
-
id: r,
|
|
1856
|
-
title: "",
|
|
1857
|
-
description: "",
|
|
1858
|
-
postsCount: 0,
|
|
1859
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1860
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1861
|
-
};
|
|
1862
|
-
return /* @__PURE__ */ t(
|
|
1863
|
-
Bt,
|
|
1864
|
-
{
|
|
1865
|
-
discussion: ue,
|
|
1866
|
-
posts: j,
|
|
1867
|
-
postsHidden: M,
|
|
1868
|
-
sdk: s,
|
|
1869
|
-
userIsLoggedIn: y,
|
|
1870
|
-
onSignInClick: b,
|
|
1871
|
-
showReactions: o,
|
|
1872
|
-
showReplies: l,
|
|
1873
|
-
showReportPost: a,
|
|
1874
|
-
currentSort: Y,
|
|
1875
|
-
onSortChange: q,
|
|
1876
|
-
onCreatePost: Z(G),
|
|
1877
|
-
onReact: Z(re),
|
|
1878
|
-
onDeletePost: Z(Q),
|
|
1879
|
-
onReportPost: Z(ye),
|
|
1880
|
-
onLoadMore: ee,
|
|
1881
|
-
hasMore: P,
|
|
1882
|
-
liveRefresh: R > 0,
|
|
1883
|
-
newPostIds: U,
|
|
1884
|
-
onNewPostSeen: V,
|
|
1885
|
-
isLoading: A,
|
|
1886
|
-
isSubmitting: de,
|
|
1887
|
-
infiniteScroll: f,
|
|
1888
|
-
showModeratedPosts: c,
|
|
1889
|
-
ban: D,
|
|
1890
|
-
isBanned: g,
|
|
1891
|
-
showBanHistory: x
|
|
1892
|
-
}
|
|
1893
|
-
);
|
|
1894
|
-
}, Nt = (e) => {
|
|
1895
|
-
const [r, s] = X.useState(!1), [u, m] = X.useState(!1), n = Ke(e.language), i = X.useRef(
|
|
1896
|
-
`$discussion-shadow-root-${Math.random().toString(36).substring(2, 11)}`
|
|
1897
|
-
), o = X.useRef(null), l = X.useRef(null), a = X.useRef(null), [f, c] = X.useState(null);
|
|
1898
|
-
X.useEffect(() => {
|
|
1899
|
-
We(e.language || "en").finally(() => m(!0));
|
|
1900
|
-
}, [e.language]), X.useEffect(() => {
|
|
1901
|
-
if (!o.current) return;
|
|
1902
|
-
o.current.shadowRoot ? (l.current = o.current.shadowRoot, a.current = l.current.getElementById(
|
|
1903
|
-
i.current
|
|
1904
|
-
), a.current || (a.current = document.createElement("div"), a.current.id = i.current, a.current.style.height = "100%", l.current.appendChild(a.current))) : (l.current = o.current.attachShadow({ mode: "open" }), a.current = document.createElement("div"), a.current.id = i.current, a.current.style.height = "100%", l.current.appendChild(a.current)), He(a.current, n);
|
|
1905
|
-
const b = Ue("discussion", n);
|
|
1906
|
-
return c(
|
|
1907
|
-
(D) => (D == null ? void 0 : D.key) === b ? D : Ve(
|
|
1908
|
-
"discussion",
|
|
1909
|
-
l.current,
|
|
1910
|
-
n
|
|
1911
|
-
)
|
|
1912
|
-
), s(!0), () => {
|
|
1913
|
-
s(!1);
|
|
1914
|
-
};
|
|
1915
|
-
}, [n]);
|
|
1916
|
-
const y = e.themeOptions, x = /* @__PURE__ */ t(C, { ref: o, lang: e.language || "en", sx: { height: "100%", display: "block" } }), R = r && u && a.current && f ? gt(
|
|
1917
|
-
// Keyed on the cache, not on `direction`: it must change in the same
|
|
1918
|
-
// render that adopts the new cache, or CssVarsProvider writes its CSS
|
|
1919
|
-
// variables into the outgoing cache and never repeats.
|
|
1920
|
-
/* @__PURE__ */ t(bt, { value: f, children: /* @__PURE__ */ t(_e, { containerRef: o, children: /* @__PURE__ */ t(
|
|
1921
|
-
je,
|
|
1922
|
-
{
|
|
1923
|
-
customTheme: y,
|
|
1924
|
-
mode: y == null ? void 0 : y.mode,
|
|
1925
|
-
shadowRootElement: a.current,
|
|
1926
|
-
direction: n,
|
|
1927
|
-
children: /* @__PURE__ */ t(
|
|
1928
|
-
Ye,
|
|
1929
|
-
{
|
|
1930
|
-
shadowRootElement: a.current,
|
|
1931
|
-
leadPhoneCountryCode: null,
|
|
1932
|
-
language: e.language,
|
|
1933
|
-
optionsLayout: null,
|
|
1934
|
-
direction: n,
|
|
1935
|
-
disableCache: e.disableCache ?? !1,
|
|
1936
|
-
children: e.children
|
|
1937
|
-
}
|
|
1938
|
-
)
|
|
1939
|
-
}
|
|
1940
|
-
) }) }, f.key),
|
|
1941
|
-
a.current
|
|
1942
|
-
) : null;
|
|
1943
|
-
return /* @__PURE__ */ v(Se, { children: [
|
|
1944
|
-
x,
|
|
1945
|
-
R
|
|
1946
|
-
] });
|
|
1947
|
-
}, Yt = (e) => /* @__PURE__ */ t(Nt, { ...e, children: /* @__PURE__ */ t(kt, { ...e }) });
|
|
1948
|
-
export {
|
|
1949
|
-
Yt as M
|
|
1950
|
-
};
|