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.
Files changed (62) hide show
  1. package/Betslip.js +2 -2
  2. package/ChanceGame.js +496 -505
  3. package/ClassicQuizPlay.js +2 -2
  4. package/CollectLead.js +405 -1163
  5. package/CompetitionStatistics.js +2 -2
  6. package/CompetitorCard.js +445 -425
  7. package/Discussion.js +2 -2
  8. package/EitherOrPlay.js +2 -2
  9. package/EventCard.js +648 -593
  10. package/EventGamePlay.js +2 -2
  11. package/Leaderboard.js +142 -132
  12. package/List.js +675 -713
  13. package/MatchQuizPlay.js +2 -2
  14. package/Odds.js +1 -1
  15. package/PersonalityQuizPlay.js +2 -2
  16. package/PickThePair.js +925 -1824
  17. package/PlayerOfTheMatch.js +2106 -2223
  18. package/PollVote.js +2 -2
  19. package/Predictor.js +4209 -18629
  20. package/Standings.js +497 -486
  21. package/TopX.js +3223 -16958
  22. package/chunks/{ChanceGameEmbedVariant-DM9eLG5s.js → ChanceGameEmbedVariant-z8XYzgDW.js} +1 -1
  23. package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
  24. package/chunks/index-BNl8scz6.js +4 -0
  25. package/chunks/index-CSa2JU4m.js +4 -0
  26. package/chunks/index-CVRI82Gb.js +4 -0
  27. package/chunks/index-Cd1dg0KI.js +4 -0
  28. package/chunks/index-Cei2fzi7.js +4 -0
  29. package/chunks/index-Cxb4wEJU.js +4 -0
  30. package/chunks/index-w1LGN5dz.js +4 -0
  31. package/chunks/main-07vzblS8.js +2091 -0
  32. package/chunks/main-C7X4dM_P.js +4827 -0
  33. package/chunks/main-D_QDfmAw.js +6417 -0
  34. package/chunks/{main-CzfWaEQP.js → main-DdL0UekL.js} +1931 -2025
  35. package/chunks/main-DmBfwyb4.js +2992 -0
  36. package/chunks/main-LEE8n2cG.js +3117 -0
  37. package/chunks/{main-DxvBjXsd.js → main-P2WNvBZE.js} +473 -444
  38. package/chunks/{main-DiBlJBNb.js → main-gV165E-A.js} +629 -657
  39. package/chunks/predictionsHelpers-fwXaMadu.js +10063 -0
  40. package/chunks/{withVersionStamp-BsLyhvNA.js → withVersionStamp-CPDfSE5H.js} +1 -1
  41. package/package.json +2 -6
  42. package/withVersionStamp.d.ts.map +1 -1
  43. package/chunks/CheckCircle-I1FktW5Y.js +0 -13
  44. package/chunks/Person-CXRqyF4E.js +0 -11
  45. package/chunks/PickOneOfX-DET4ZhjV.js +0 -3117
  46. package/chunks/Search-CIXthh0D.js +0 -17
  47. package/chunks/TimerOutlined-D-WA_vpE.js +0 -8
  48. package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +0 -136
  49. package/chunks/chevrons-right-HWKW2c4I.js +0 -45
  50. package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
  51. package/chunks/index-BENM3N_w.js +0 -4
  52. package/chunks/index-BRxAV693.js +0 -4
  53. package/chunks/index-BXYTsvIX.js +0 -4
  54. package/chunks/index-C0ilols1.js +0 -4
  55. package/chunks/index-D7VhczXH.js +0 -4
  56. package/chunks/index-DKwvdw9t.js +0 -4
  57. package/chunks/index-DZN-AITW.js +0 -4
  58. package/chunks/main-B2sDRFF4.js +0 -2184
  59. package/chunks/main-DFNl3g_U.js +0 -4910
  60. package/chunks/main-DLwnvntz.js +0 -4020
  61. package/chunks/main-S8_NDSiY.js +0 -3209
  62. package/chunks/main-lBgr8Liq.js +0 -6571
@@ -1,86 +1,87 @@
1
- import { jsxs as S, jsx as n, Fragment as Re } from "@emotion/react/jsx-runtime";
2
- import { InlineSpinner as vt, Modal as ut, Avatar as St, Notification as pt, useSelect as wt, Spinner as We, WidgetPortal as Ct } from "fansunited-frontend-core/ui/emotion";
3
- import Ie, { useState as D, useEffect as he, useRef as W, useCallback as Se, useLayoutEffect as Ne, useId as kt } from "react";
4
- import { useDisableCache as Rt, useColors as It, useIsRtl as Et, useConstantContext as je, ConstantsContext as Ve, toIntlLocale as ft } from "fansunited-frontend-core";
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 ye } from "react-i18next";
7
- import { ThumbUpIcon as Dt, ThumbDownIcon as Bt, FavoriteIcon as Tt, SentimentSatisfiedIcon as Pt, FavoriteBorderIcon as Mt, EmojiEmotionsIcon as At, SentimentVeryDissatisfiedIcon as Lt, MoodBadIcon as zt, ReplyIcon as $t, MoreVertIcon as Ft, DeleteIcon as Ht, FlagIcon as Xt, CloseIcon as Ot, PersonIcon as Wt, RemoveCircleOutlineIcon as Nt, BlockIcon as Kt, KeyboardArrowDownIcon as Ut, UnfoldIcon as jt } from "fansunited-frontend-core/ui/icons";
8
- import { createPortal as Vt } from "react-dom";
9
- const _t = (t, r) => {
10
- const [i, s] = D(null), [p, a] = D(!0), [m, d] = D(null), [l, c] = D(!1);
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 u = await t.discussions.getById(r);
16
- s(u), d(null), c(!1);
17
- } catch (u) {
18
- (t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? u.error.code === 404 : u.data.error.code === 404) ? (c(!0), d(null), s(null)) : (d(m), s(null), c(!1));
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: p, error: m, isNotFound: l };
24
- }, Yt = 5e3, Gt = 5, Jt = (t, r, i = null, s = "", p = "LATEST", a = 20, m, d = !1, l = 0) => {
25
- const c = a <= 0, [h, u] = D([]), [y, b] = D(!c), [g, k] = D(!1), [I, v] = D(null), [f, B] = D(p), [A, E] = D(
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
- ), [$, J] = D(!1), [U, V] = D(() => /* @__PURE__ */ new Set()), q = W(0), T = Se(
28
- async (R, w, C = !1) => {
29
- var M, N;
30
- C || (q.current += 1, V(/* @__PURE__ */ new Set()));
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
- b(!0);
33
- const X = await t.discussions.getPosts(r, {
34
- sort: R,
32
+ x(!0);
33
+ const H = await t.discussions.getPosts(r, {
34
+ sort: C,
35
35
  limit: a,
36
- startAfter: w,
36
+ startAfter: S,
37
37
  skipDeleted: !0,
38
38
  skipModerated: !d
39
- }), ae = X.data;
40
- u(C ? (F) => [...F, ...ae] : ae);
41
- const x = !!((M = X.meta.pagination) != null && M.nextPageStartsAfter) && ae.length === a;
42
- E(
43
- ((N = X.meta.pagination) == null ? void 0 : N.nextPageStartsAfter) || null
44
- ), J(x), v(null);
45
- } catch (X) {
46
- (t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? X.error.code === 404 : X.data.error.code === 404) ? (u([]), J(!1), E(null), v(null)) : v(I);
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
- b(!1);
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
- u([]), J(!1), b(!1);
56
+ f([]), J(!1), x(!1);
56
57
  return;
57
58
  }
58
- r && T(f);
59
- }, [r, f, T, c]);
60
- const _ = (R) => {
61
- B(R), E(null);
62
- }, oe = W(y);
63
- oe.current = y;
64
- const ne = W(A);
65
- ne.current = A;
66
- const pe = Se(() => {
67
- ne.current && !oe.current && T(f, ne.current, !0);
68
- }, [T, f]), Z = W(h);
69
- Z.current = h;
70
- const de = W($);
71
- de.current = $;
72
- const re = W(m);
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 = W(!1), Q = Se(async () => {
75
- var X, ae;
75
+ const ie = V(!1), Z = Ce(async () => {
76
+ var H, ae;
76
77
  if (oe.current || ie.current) return;
77
- const R = f === "LATEST" || !de.current;
78
+ const C = p === "LATEST" || !de.current;
78
79
  ie.current = !0;
79
- const w = q.current, C = Z.current, M = new Map(C.map((x) => [x.id, x])), N = (x) => !M.has(x.id);
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 x = [], F = /* @__PURE__ */ new Map();
82
+ const h = [], $ = /* @__PURE__ */ new Map();
82
83
  let ee;
83
- for (let K = 0; K < Gt; K++) {
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((me) => {
93
- const Ge = M.get(me.id);
94
- Ge ? me.moderated && !Ge.moderated && F.set(me.id, me) : (d || !me.moderated) && x.push(me);
95
- }), ee = ((X = Y.meta.pagination) == null ? void 0 : X.nextPageStartsAfter) || void 0;
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 (!R || !C.length || !xe || !ee) break;
98
+ if (!C || !w.length || !xe || !ee) break;
98
99
  }
99
- if (w !== q.current || (F.size && u(
100
- (K) => d ? K.map((Y) => {
101
- const G = F.get(Y.id);
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
- }) : K.filter((Y) => !F.has(Y.id))
110
- ), !R)) return;
111
- const ke = new Set(Z.current.map((K) => K.id)), ce = x.filter((K) => !ke.has(K.id));
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
- C.length ? u((K) => {
114
- const Y = new Set(K.map((xe) => xe.id)), G = ce.filter((xe) => !Y.has(xe.id));
115
- return f === "LATEST" ? [...G, ...K].sort(
116
- (xe, me) => Date.parse(me.createdAt) - Date.parse(xe.createdAt)
117
- ) : [...K, ...G.reverse()];
118
- }) : await T(f), V((K) => {
119
- const Y = new Set(K);
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
- f,
132
- T
133
- ]), se = l > 0 ? Math.max(l, Yt) : 0;
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 R = () => {
137
- document.visibilityState !== "hidden" && Q();
138
- }, w = () => {
139
- document.visibilityState === "visible" && Q();
140
- }, C = setInterval(R, se);
141
- return document.addEventListener("visibilitychange", w), () => {
142
- clearInterval(C), document.removeEventListener("visibilitychange", w);
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, Q]);
145
- const P = Se((R) => {
146
- V((w) => {
147
- if (!w.has(R)) return w;
148
- const C = new Set(w);
149
- return C.delete(R), C;
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: h,
154
+ posts: y,
154
155
  postsHidden: c,
155
- isLoading: y,
156
+ isLoading: k,
156
157
  isSubmitting: g,
157
- error: I,
158
- currentSort: f,
159
- hasMore: $,
160
- newPostIds: U,
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 (R, w) => {
165
+ handleCreatePost: async (C, S) => {
165
166
  try {
166
- k(!0);
167
- let M = await t.discussions.createPost(r, {
168
- content: R,
169
- replyId: w || null,
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
- M = { ...M, userModel: N };
182
+ A = { ...A, userModel: N };
182
183
  } catch {
183
184
  }
184
- w ? u(
185
+ S ? f(
185
186
  (N) => N.map(
186
- (X) => X.id === w ? { ...X, repliesCount: (X.repliesCount || 0) + 1 } : X
187
+ (H) => H.id === S ? { ...H, repliesCount: (H.repliesCount || 0) + 1 } : H
187
188
  )
188
- ) : c || u((N) => [M, ...N]), m == null || m(1), v(null);
189
- } catch (C) {
189
+ ) : c || f((N) => [A, ...N]), m == null || m(1), v(null);
190
+ } catch (w) {
190
191
  throw v(
191
- C
192
- ), C;
192
+ w
193
+ ), w;
193
194
  } finally {
194
- k(!1);
195
+ E(!1);
195
196
  }
196
197
  },
197
- handleReact: async (R, w) => {
198
+ handleReact: async (C, S) => {
198
199
  try {
199
- const C = await t.discussions.react(R, w);
200
- return u(
201
- (M) => M.map((N) => N.id === R ? C : N)
202
- ), v(null), C;
203
- } catch (C) {
204
- throw console.error("Error reacting to post:", C), v(
205
- C
206
- ), C;
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 (R, w) => {
210
+ handleDeletePost: async (C, S) => {
210
211
  try {
211
- await t.discussions.deletePost(R), u((C) => C.filter((M) => M.id !== R)), w && u(
212
- (C) => C.map(
213
- (M) => M.id === w ? { ...M, repliesCount: Math.max(0, (M.repliesCount || 0) - 1) } : M
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 (C) {
217
+ } catch (w) {
217
218
  throw v(
218
- C
219
- ), C;
219
+ w
220
+ ), w;
220
221
  }
221
222
  },
222
- handleReportPost: async (R, w, C) => {
223
+ handleReportPost: async (C, S, w) => {
223
224
  try {
224
- await t.discussions.reportPost(R, w, C), v(null);
225
- } catch (M) {
225
+ await t.discussions.reportPost(C, S, w), v(null);
226
+ } catch (A) {
226
227
  throw v(
227
- M
228
- ), M;
228
+ A
229
+ ), A;
229
230
  }
230
231
  }
231
232
  };
232
- }, qt = async (t) => {
233
+ }, Zt = async (t) => {
233
234
  var r;
234
235
  try {
235
- const s = (r = t.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(), p = s == null ? void 0 : s.split(".")[1];
236
- if (!p) return null;
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(p.replace(/-/g, "+").replace(/_/g, "/"))
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
- }, Zt = (t, r) => {
245
+ }, eo = (t, r) => {
245
246
  var d;
246
- const [i, s] = D(null), p = Rt(), a = Se(
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 qt(t);
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(p);
264
- }, [a, p]);
265
- const m = Se(() => a(!0), [a]);
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
- }, mt = (t) => {
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
- joyText: "var(--fu-ucrc-joy-text-primary)",
283
- icon: "var(--fu-ucrc-joy-text-icon)",
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
- }, _e = () => {
305
- const t = It(), r = t.palette.primary.plainColor, i = t.palette.danger.plainColor, s = t.textPrimary;
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.joyText }),
319
- titleLg: o(ve("1.25em", 600, 1.33334), { color: e.joyText }),
320
- titleMd: o(ve("1em", 500, 1.5), { color: e.joyText }),
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
- }, Ye = o({
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
- }), Qt = o(Ye, {
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
- }), Je = o(Ye, {
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
- }), qe = o(Ye, {
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: Qt,
365
- plain: Je,
366
- outlined: qe,
367
- signIn: o(qe, { width: "100%", paddingBlock: e.spaceSm, fontFamily: e.fontPrimary }),
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(Je, {
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: p, ...a }) => /* @__PURE__ */ S("button", { type: "button", css: Pe[t], disabled: s || r, ...a, 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
- p,
382
- r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(vt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
383
- ] }), Me = {
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
- }, eo = {
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: p,
432
+ maxRows: u,
442
433
  disabled: a,
443
434
  marginBottom: m
444
435
  }) => {
445
- const d = W(null), l = W(null), c = W(null), h = Se(() => {
446
- const u = d.current, y = l.current;
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: Me.textarea,
442
+ css: Te.textarea,
472
443
  rows: s,
473
444
  value: t,
474
445
  placeholder: i,
475
446
  disabled: a,
476
- onChange: (u) => r(u.target.value)
447
+ onChange: (c) => r(c.target.value)
477
448
  }
478
449
  ),
479
- /* @__PURE__ */ n("textarea", { ref: l, css: Me.textarea, "aria-hidden": !0, readOnly: !0, tabIndex: -1, style: eo })
450
+ /* @__PURE__ */ n("textarea", { ref: l, css: Te.textarea, "aria-hidden": !0, readOnly: !0, tabIndex: -1, style: vt })
480
451
  ] });
481
- }, Be = {
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
- }, ht = ({
456
+ }, ft = ({
486
457
  onSubmit: t,
487
458
  userIsLoggedIn: r,
488
459
  onSignInClick: i,
489
460
  placeholder: s,
490
- isSubmitting: p,
461
+ isSubmitting: u,
491
462
  replyTo: a,
492
463
  onCancel: m,
493
464
  disabled: d = !1
494
465
  }) => {
495
- const { t: l } = ye(), [c, h] = D(""), u = async (y) => {
496
- if (y.preventDefault(), !(!c.trim() || d))
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), h("");
499
- } catch (b) {
500
- console.error("Failed to submit comment:", b);
469
+ await t(c), y("");
470
+ } catch (x) {
471
+ console.error("Failed to submit comment:", x);
501
472
  }
502
473
  };
503
- return r ? /* @__PURE__ */ S("form", { onSubmit: u, css: Be.form, children: [
504
- a && /* @__PURE__ */ n("p", { css: Be.replyingTo, children: l("discussion.replyingTo", "Replying to {{name}}", {
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
- gt,
479
+ mt,
509
480
  {
510
481
  placeholder: s || l("discussion.writeComment", "Write a comment..."),
511
482
  value: c,
512
- onChange: h,
483
+ onChange: y,
513
484
  minRows: 3,
514
485
  maxRows: 8,
515
- disabled: p || d,
486
+ disabled: u || d,
516
487
  marginBottom: e.spaceSm
517
488
  }
518
489
  ),
519
- /* @__PURE__ */ S("div", { css: Be.actions, children: [
520
- m && /* @__PURE__ */ n(ue, { look: "plain", onClick: m, disabled: p, children: l("common.cancel", "Cancel") }),
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() || p || d,
527
- loading: p,
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: Be.form, children: /* @__PURE__ */ n(ue, { look: "signIn", onClick: i, children: l("discussion.signInToPost", "Sign in to post") }) });
533
- }, ge = { size: "1em", color: e.icon }, to = {
534
- LIKE: /* @__PURE__ */ n(Dt, { ...ge }),
535
- DISLIKE: /* @__PURE__ */ n(Bt, { ...ge }),
536
- LOVE: /* @__PURE__ */ n(Tt, { ...ge }),
537
- LAUGH: /* @__PURE__ */ n(Pt, { ...ge }),
538
- CARE: /* @__PURE__ */ n(Mt, { ...ge }),
539
- WOW: /* @__PURE__ */ n(At, { ...ge }),
540
- SAD: /* @__PURE__ */ n(Lt, { ...ge }),
541
- ANGRY: /* @__PURE__ */ n(zt, { ...ge })
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
- }), Le = o(z.bodySm, { fontWeight: 500, color: e.text }), we = {
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
- }, ze = {
526
+ }, Le = {
556
527
  cursor: "pointer",
557
528
  "&:hover": { backgroundColor: "var(--fu-ucrc-neutral-soft-hover-bg)" }
558
- }, $e = { opacity: 0.5 }, Fe = {
529
+ }, ze = { opacity: 0.5 }, Fe = {
559
530
  pill: {
560
531
  enabled: {
561
- idle: o(we.idle, ze),
562
- primary: o(we.primary, ze),
563
- danger: o(we.danger, ze)
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(we.idle, $e),
567
- primary: o(we.primary, $e),
568
- danger: o(we.danger, $e)
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: Le, primary: o(Le, { color: e.primary }), danger: o(Le, { color: e.danger }) }
573
- }, Ze = ({
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: p
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__ */ S(
552
+ return /* @__PURE__ */ b(
582
553
  "div",
583
554
  {
584
- css: Fe.pill[p ? "disabled" : "enabled"][m],
585
- onClick: p ? void 0 : s,
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: to[t] }),
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
- }, bt = (t, r) => {
593
- const [i, s] = D(null);
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
- }, Qe = {
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
- }, oo = ({
586
+ }, no = ({
616
587
  post: t,
617
588
  sdk: r,
618
589
  userIsLoggedIn: i,
619
590
  onSignInClick: s,
620
- onReact: p,
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, k, I, v;
627
- const { t: c } = ye(), h = bt(r, i), y = (() => {
628
- if (!h || !t.reactions)
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 f of t.reactions)
631
- if (f.userIds.includes(h))
632
- return f.type;
601
+ for (const p of t.reactions)
602
+ if (p.userIds.includes(y))
603
+ return p.type;
633
604
  return null;
634
- })(), b = (f) => {
605
+ })(), x = (p) => {
635
606
  if (!i) {
636
607
  s == null || s();
637
608
  return;
638
609
  }
639
- p(t.id, f).catch(() => {
610
+ u(t.id, p).catch(() => {
640
611
  });
641
612
  };
642
- return /* @__PURE__ */ S("div", { css: Qe.row, children: [
643
- a && /* @__PURE__ */ S(Re, { children: [
613
+ return /* @__PURE__ */ b("div", { css: qe.row, children: [
614
+ a && /* @__PURE__ */ b(Re, { children: [
644
615
  /* @__PURE__ */ n(
645
- Ze,
616
+ Je,
646
617
  {
647
618
  reaction: "LIKE",
648
- count: ((k = (g = t.reactions) == null ? void 0 : g.find((f) => f.type === "LIKE")) == null ? void 0 : k.reactionCount) || 0,
649
- isActive: y === "LIKE",
650
- onClick: () => b("LIKE"),
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
- Ze,
626
+ Je,
656
627
  {
657
628
  reaction: "DISLIKE",
658
- count: ((v = (I = t.reactions) == null ? void 0 : I.find((f) => f.type === "DISLIKE")) == null ? void 0 : v.reactionCount) || 0,
659
- isActive: y === "DISLIKE",
660
- onClick: () => b("DISLIKE"),
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($t, { size: "1em", css: Qe.replyIcon, style: { marginLeft: "calc(0.375em / -1.625)" } }),
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
- }, He = 4, et = { visibility: "hidden" }, yt = (t, r, i, s) => {
677
- const p = Et(), [a, m] = D(et);
678
- return Ne(() => {
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(et);
651
+ m(Qe);
681
652
  return;
682
653
  }
683
654
  const d = () => {
684
- var k;
685
- const l = (k = r.current) == null ? void 0 : k.getBoundingClientRect(), c = i.current;
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: h, height: u } = c.getBoundingClientRect(), y = document.documentElement;
689
- let b = s === "center" ? l.left + l.width / 2 - h / 2 : p ? l.right - h : l.left;
690
- b = Math.max(0, Math.min(b, y.clientWidth - h));
691
- let g = l.bottom + He;
692
- g + u > y.clientHeight && l.top - He - u >= 0 && (g = l.top - He - u), m({
693
- left: Math.round(b),
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, p, r, i]), a;
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
- }, tt = { marginInlineEnd: e.spaceXs }, no = ({
740
+ }, Ze = { marginInlineEnd: e.spaceXs }, ro = ({
770
741
  isOwnPost: t,
771
742
  canReport: r,
772
743
  onDelete: i,
773
744
  onReport: s,
774
- disabled: p = !1
745
+ disabled: u = !1
775
746
  }) => {
776
- const { t: a } = ye(), { shadowRootElement: m } = je(Ve), d = kt(), [l, c] = Ie.useState(!1), h = W(null), u = W(null), y = yt(l, h, u, "center");
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 f = (A) => {
780
- const E = A.composedPath();
781
- h.current && E.includes(h.current) || u.current && E.includes(u.current) || c(!1);
782
- }, B = setTimeout(() => {
783
- document.addEventListener("click", f, !0);
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(B), document.removeEventListener("click", f, !0);
757
+ clearTimeout(D), document.removeEventListener("click", p, !0);
787
758
  };
788
759
  }, [l]), !t && !r) return null;
789
- const b = () => {
790
- var f;
791
- return [...((f = u.current) == null ? void 0 : f.querySelectorAll('[role="menuitem"]')) ?? []];
760
+ const x = () => {
761
+ var p;
762
+ return [...((p = f.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []];
792
763
  }, g = () => {
793
- var f;
794
- c(!1), (f = h.current) == null || f.focus();
795
- }, k = (f) => {
796
- var B;
797
- c(!1), (B = h.current) == null || B.focus(), f();
798
- }, I = (f) => {
799
- const B = b(), A = B.indexOf(f.target), E = (J) => {
800
- var U;
801
- return (U = B[(J + B.length) % B.length]) == null ? void 0 : U.focus();
802
- }, $ = {
803
- ArrowDown: () => E(A + 1),
804
- ArrowUp: () => E(A - 1),
805
- Home: () => E(0),
806
- End: () => E(B.length - 1),
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
- $[f.key] ? (f.preventDefault(), $[f.key]()) : f.key === "Tab" && c(!1);
810
- }, v = (f, B, A, E) => /* @__PURE__ */ S(
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": p,
786
+ "aria-disabled": u,
816
787
  css: Xe.item,
817
- onClick: () => k(E),
818
- onKeyDown: ($) => {
819
- $.key !== "Enter" && $.key !== " " || ($.preventDefault(), p || k(E));
788
+ onClick: () => E(R),
789
+ onKeyDown: (F) => {
790
+ F.key !== "Enter" && F.key !== " " || (F.preventDefault(), u || E(R));
820
791
  },
821
792
  children: [
822
- B,
823
- A
793
+ D,
794
+ M
824
795
  ]
825
796
  },
826
- f
797
+ p
827
798
  );
828
- return /* @__PURE__ */ S(Re, { children: [
799
+ return /* @__PURE__ */ b(Re, { children: [
829
800
  /* @__PURE__ */ n(
830
801
  "button",
831
802
  {
832
- ref: h,
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: (f) => {
839
- c(!l), !l && f.detail === 0 && requestAnimationFrame(() => {
840
- var B;
841
- return (B = b()[0]) == null ? void 0 : B.focus();
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(Ft, { size: "1.25em" })
815
+ children: /* @__PURE__ */ n(Ht, { size: "1.25em" })
845
816
  }
846
817
  ),
847
- l && m && Vt(
848
- /* @__PURE__ */ S("ul", { ref: u, id: d, role: "menu", css: Xe.menu, style: y, onKeyDown: I, children: [
849
- t && v("delete", /* @__PURE__ */ n(Ht, { size: "1em", color: e.icon, style: tt }), a("discussion.delete.action", "Delete"), i),
850
- r && v("report", /* @__PURE__ */ n(Xt, { size: "1em", color: e.icon, style: tt }), a("discussion.report.action", "Report"), s)
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
- }, ot = "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))", nt = o({
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 ${ot}, 0px 6px 12px -2px ${ot}`,
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
- }), be = {
878
- delete: o(nt, { maxWidth: "400px" }),
879
- report: o(nt, { maxWidth: "440px" }),
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
- }, rt = {
884
- title: o(be.title, { marginBottom: e.spaceXs }),
885
- description: o(be.description, { marginBottom: e.spaceLg })
886
- }, ro = ({
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: p } = ye(), a = _e(), m = Ie.useId(), [d, l] = D(!1), c = async () => {
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
- p(
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(ut, { open: t, onClose: r, children: /* @__PURE__ */ S("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": m, tabIndex: -1, css: be.delete, style: a, children: [
908
- /* @__PURE__ */ n("p", { id: m, css: rt.title, children: p("discussion.delete.title", "Delete comment") }),
909
- /* @__PURE__ */ n("p", { css: rt.description, children: p(
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__ */ S("div", { css: be.actions, children: [
914
- /* @__PURE__ */ n(ue, { look: "plain", onClick: r, children: p("common.cancel", "Cancel") }),
915
- /* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children: p("discussion.delete.action", "Delete") })
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
- }, it = o({
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
- }), st = o({
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(be.title, { marginBottom: e.spaceMd }),
942
- description: o(be.description, { marginBottom: e.spaceMd }),
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: it,
992
- checked: o(it, {
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: st, checked: o(st, { transform: "none" }) },
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
- }, io = [
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
- ], so = ({
1011
+ ], ao = ({
1041
1012
  open: t,
1042
1013
  onClose: r,
1043
1014
  onSubmit: i,
1044
1015
  onSuccess: s,
1045
- onError: p
1016
+ onError: u
1046
1017
  }) => {
1047
- const { t: a } = ye(), m = _e(), d = Ie.useId(), [l, c] = D(""), [h, u] = D(""), [y, b] = D(!1), g = () => {
1048
- r(), c(""), u("");
1049
- }, k = async () => {
1050
- b(!0);
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" ? h : void 0
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
- p(
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
- b(!1);
1040
+ x(!1);
1070
1041
  }
1071
1042
  };
1072
- return /* @__PURE__ */ n(ut, { open: t, onClose: g, children: /* @__PURE__ */ S("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": `${d}title`, tabIndex: -1, css: be.report, style: m, children: [
1073
- /* @__PURE__ */ n("button", { type: "button", "aria-label": a("common.rules.close", "Close"), css: le.close, onClick: g, children: /* @__PURE__ */ n(Ot, { size: "calc(2em / 1.5)" }) }),
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: io.map((I) => {
1080
- const v = l === I.value, f = v ? "checked" : "unchecked";
1081
- return /* @__PURE__ */ S("span", { css: le.radio, children: [
1082
- /* @__PURE__ */ S("span", { css: le.circle[f], children: [
1083
- /* @__PURE__ */ n("span", { css: le.dot[f] }),
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}${I.value}`,
1058
+ id: `${d}${T.value}`,
1088
1059
  type: "radio",
1089
1060
  name: `${d}reason`,
1090
- value: I.value,
1061
+ value: T.value,
1091
1062
  checked: v,
1092
- onChange: (B) => c(B.target.value),
1063
+ onChange: (D) => c(D.target.value),
1093
1064
  css: le.input
1094
1065
  }
1095
1066
  ) })
1096
1067
  ] }),
1097
- /* @__PURE__ */ n("label", { htmlFor: `${d}${I.value}`, css: le.label, children: a(I.labelKey, I.fallback) })
1098
- ] }, I.value);
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
- gt,
1072
+ mt,
1102
1073
  {
1103
1074
  placeholder: a(
1104
1075
  "discussion.report.detailsPlaceholder",
1105
1076
  "Please provide more details..."
1106
1077
  ),
1107
- value: h,
1108
- onChange: u,
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__ */ S("div", { css: be.actions, children: [
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: y,
1122
- onClick: k,
1092
+ loading: k,
1093
+ onClick: E,
1123
1094
  children: a("discussion.report.action", "Report")
1124
1095
  }
1125
1096
  )
1126
1097
  ] })
1127
1098
  ] }) });
1128
- }, ao = (t, r, i) => {
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(ft(i));
1131
- }, Ke = o({ marginBottom: e.spaceMd }), Ue = o(Ke, {
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
- }), at = o(Ue, { borderInlineStartColor: e.primary, backgroundColor: e.primary1a }), co = { width: "64%", height: "64%" }, lo = { marginTop: "2px" }, O = {
1139
- post: { top: Ke, reply: o(Ke, { marginLeft: e.spaceXl }) },
1140
- highlightable: { top: Ue, reply: o(Ue, { marginLeft: e.spaceXl }) },
1141
- highlighted: { top: at, reply: o(at, { marginLeft: e.spaceXl }) },
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
- content: o(z.bodySm, { marginBottom: e.spaceXs, whiteSpace: "pre-wrap", color: e.textBody }),
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
- }, uo = 8e3, xt = ({
1163
+ }, po = 8e3, yt = ({
1192
1164
  post: t,
1193
1165
  sdk: r,
1194
1166
  userIsLoggedIn: i,
1195
1167
  onSignInClick: s,
1196
- showReactions: p = !0,
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: h,
1203
- isSubmitting: u,
1204
- showModeratedPosts: y = !1,
1205
- isBanned: b = !1,
1174
+ onReport: y,
1175
+ isSubmitting: f,
1176
+ showModeratedPosts: k = !1,
1177
+ isBanned: x = !1,
1206
1178
  highlightable: g = !1,
1207
- isNew: k = !1,
1208
- onNewSeen: I,
1179
+ isNew: E = !1,
1180
+ onNewSeen: T,
1209
1181
  depth: v = 0,
1210
- parentPostId: f,
1211
- onReplyCreated: B,
1212
- onDeleteSuccess: A
1182
+ parentPostId: p,
1183
+ onReplyCreated: D,
1184
+ onDeleteSuccess: M
1213
1185
  }) => {
1214
- var M, N, X, ae;
1215
- const { t: E } = ye(), { language: $ } = je(Ve), J = bt(r, i), [U, V] = D(!1), [q, T] = D([]), [_, oe] = D(!1), [ne, pe] = D(!1), [Z, de] = D(!1), [re, ie] = D({ open: !1, variant: "success", title: "", message: "" }), Q = W(null);
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 (!k || !I || !Q.current) return;
1218
- let x;
1219
- const F = new IntersectionObserver(
1189
+ if (!E || !T || !Z.current) return;
1190
+ let h;
1191
+ const $ = new IntersectionObserver(
1220
1192
  ([ee]) => {
1221
- ee.isIntersecting && (F.disconnect(), x = setTimeout(() => I(t.id), uo));
1193
+ ee.isIntersecting && ($.disconnect(), h = setTimeout(() => T(t.id), po));
1222
1194
  },
1223
1195
  { threshold: 0.5 }
1224
1196
  );
1225
- return F.observe(Q.current), () => {
1226
- F.disconnect(), clearTimeout(x);
1197
+ return $.observe(Z.current), () => {
1198
+ $.disconnect(), clearTimeout(h);
1227
1199
  };
1228
- }, [k, I, t.id]);
1229
- const se = !!(i && J && t.userId === J), P = !!t.moderated, j = async (x) => {
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 F = v === 1 && f || t.id, ee = ((ce = t.userModel) == null ? void 0 : ce.name) || t.anonymousNickname || E("discussion.anonymous", "Anonymous"), ke = v === 1 ? `@${ee} ${x}` : x;
1232
- await d(F, ke), V(!1), v === 1 && B ? B() : v === 0 && (oe(!0), H());
1233
- }, H = async () => {
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 x = await r.discussions.getPostReplies(t.id, {
1208
+ const h = await r.discussions.getPostReplies(t.id, {
1237
1209
  limit: 25,
1238
1210
  skipDeleted: !0,
1239
- skipModerated: !y
1211
+ skipModerated: !k
1240
1212
  });
1241
- T(x.data);
1242
- } catch (x) {
1243
- console.error("Failed to load replies:", x);
1213
+ B(h.data);
1214
+ } catch (h) {
1215
+ console.error("Failed to load replies:", h);
1244
1216
  }
1245
1217
  };
1246
1218
  he(() => {
1247
- _ && q.length === 0 && H();
1248
- }, [_]);
1249
- const Ee = async (x) => {
1250
- await c(x, t.id), T((F) => F.filter((ee) => ee.id !== x));
1251
- }, fe = async (x, F) => {
1252
- const ee = await l(x, F);
1253
- ee && q.length > 0 && T(
1254
- (ke) => ke.map((ce) => ce.id === x ? ee : ce)
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
- }, R = (x, F) => {
1257
- ie({ open: !0, variant: F, title: "", message: x });
1258
- }, w = v > 0 ? "reply" : "top", C = ((M = t.userModel) == null ? void 0 : M.name) || t.anonymousNickname || "User";
1259
- return /* @__PURE__ */ S(
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 ? k ? O.highlighted[w] : O.highlightable[w] : O.post[w],
1234
+ css: g ? E ? O.highlighted[S] : O.highlightable[S] : O.post[S],
1263
1235
  children: [
1264
- /* @__PURE__ */ S("div", { css: O.row, children: [
1265
- /* @__PURE__ */ n(St, { src: (N = t.userModel) == null ? void 0 : N.avatar, alt: C, css: O.avatar, children: /* @__PURE__ */ n(Wt, { color: e.icon, style: co }) }),
1266
- /* @__PURE__ */ S("div", { css: O.body, children: [
1267
- /* @__PURE__ */ S("div", { ref: Q, css: O.header, children: [
1268
- /* @__PURE__ */ n("p", { css: O.name, children: ((X = t.userModel) == null ? void 0 : X.name) || t.anonymousNickname || E("discussion.anonymous", "Anonymous") }),
1269
- /* @__PURE__ */ n("span", { css: O.time, children: ao(t.createdAt, E, $) }),
1270
- k && /* @__PURE__ */ n("span", { css: O.badge, children: E("discussion.newPost", "New") }),
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
- no,
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: b
1250
+ disabled: x
1279
1251
  }
1280
1252
  )
1281
1253
  ] }),
1282
- P && y ? /* @__PURE__ */ S("div", { css: O.moderated, children: [
1283
- /* @__PURE__ */ n(Nt, { size: "0.9375em", color: e.textSecondary, style: lo }),
1284
- /* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason || E(
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
- oo,
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: p,
1269
+ showReactions: u,
1298
1270
  showReplyButton: a && v < 2,
1299
- onReplyClick: () => V(!U),
1300
- isBanned: b
1271
+ onReplyClick: () => _(!K),
1272
+ isBanned: x
1301
1273
  }
1302
1274
  ),
1303
- a && t.repliesCount > 0 && /* @__PURE__ */ n("div", { css: O.repliesRow, children: /* @__PURE__ */ S(
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
- _ ? E("discussion.hideReplies", "Hide replies") : E("discussion.repliesCount", "{{count}} replies", {
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
- U && !P && /* @__PURE__ */ n("div", { css: O.nested, children: /* @__PURE__ */ n(
1317
- ht,
1288
+ K && !P && /* @__PURE__ */ n("div", { css: O.nested, children: /* @__PURE__ */ n(
1289
+ ft,
1318
1290
  {
1319
- onSubmit: j,
1291
+ onSubmit: U,
1320
1292
  userIsLoggedIn: i,
1321
1293
  onSignInClick: s,
1322
- placeholder: E("discussion.writeReply", "Write a reply..."),
1323
- isSubmitting: u,
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: () => V(!1),
1326
- disabled: b
1297
+ onCancel: () => _(!1),
1298
+ disabled: x
1327
1299
  }
1328
1300
  ) }),
1329
- _ && q.length > 0 && /* @__PURE__ */ n("div", { css: O.nested, children: q.map((x) => /* @__PURE__ */ n(
1330
- xt,
1301
+ j && q.length > 0 && /* @__PURE__ */ n("div", { css: O.nested, children: q.map((h) => /* @__PURE__ */ n(
1302
+ yt,
1331
1303
  {
1332
- post: x,
1304
+ post: h,
1333
1305
  sdk: r,
1334
1306
  userIsLoggedIn: i,
1335
1307
  onSignInClick: s,
1336
- showReactions: p,
1308
+ showReactions: u,
1337
1309
  showReplies: a,
1338
1310
  showReportPost: m,
1339
1311
  onReply: d,
1340
- onReact: fe,
1312
+ onReact: me,
1341
1313
  onDelete: Ee,
1342
- onReport: h,
1343
- isSubmitting: u,
1344
- showModeratedPosts: y,
1345
- isBanned: b,
1314
+ onReport: y,
1315
+ isSubmitting: f,
1316
+ showModeratedPosts: k,
1317
+ isBanned: x,
1346
1318
  depth: v + 1,
1347
- parentPostId: v === 0 ? t.id : f,
1348
- onReplyCreated: v === 0 ? H : void 0,
1349
- onDeleteSuccess: A
1319
+ parentPostId: v === 0 ? t.id : p,
1320
+ onReplyCreated: v === 0 ? X : void 0,
1321
+ onDeleteSuccess: M
1350
1322
  },
1351
- x.id
1323
+ h.id
1352
1324
  )) })
1353
1325
  ] })
1354
1326
  ] }),
1355
1327
  /* @__PURE__ */ n(
1356
- ro,
1328
+ io,
1357
1329
  {
1358
1330
  open: ne,
1359
1331
  onClose: () => pe(!1),
1360
1332
  onConfirm: async () => {
1361
- await c(t.id), A == null || A();
1333
+ await c(t.id), M == null || M();
1362
1334
  },
1363
- onError: (x) => R(x, "error")
1335
+ onError: (h) => C(h, "error")
1364
1336
  }
1365
1337
  ),
1366
1338
  /* @__PURE__ */ n(
1367
- so,
1339
+ ao,
1368
1340
  {
1369
- open: Z,
1341
+ open: Q,
1370
1342
  onClose: () => de(!1),
1371
- onSubmit: (x, F) => h(t.id, x, F),
1372
- onSuccess: (x) => R(x, "success"),
1373
- onError: (x) => R(x, "error")
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
- pt,
1349
+ dt,
1378
1350
  {
1379
1351
  notification: re,
1380
- onClose: () => ie((x) => ({ ...x, open: !1 }))
1352
+ onClose: () => ie((h) => ({ ...h, open: !1 }))
1381
1353
  }
1382
1354
  )
1383
1355
  ]
1384
1356
  }
1385
1357
  );
1386
- }, Oe = 864e5, ct = -1, Te = o(z.bodyMd, { fontSize: "0.8125em", color: e.textSecondary }), lt = o({ transition: "transform 0.2s" }), L = {
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: Te,
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: lt, open: o(lt, { transform: "rotate(180deg)" }) },
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(Te, { fontWeight: 600, color: e.text }),
1450
- entryReason: o(Te, { unicodeBidi: "plaintext" }),
1451
- entryLifted: o(Te, { fontStyle: "italic" }),
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
- }, po = ({
1425
+ }, mo = ({
1454
1426
  ban: t,
1455
1427
  showBanHistory: r = !1
1456
1428
  }) => {
1457
- const { t: i } = ye(), { language: s } = je(Ve), [p, a] = D(!1), m = ft(s), d = (g) => new Date(g).toLocaleDateString(m, { dateStyle: "medium" }), l = (g) => new Date(g).toLocaleString(m, {
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, h = c.bannedPeriodInDays === ct, u = new Date(
1461
- new Date(c.bannedAt).getTime() + c.bannedPeriodInDays * Oe
1462
- ), y = Math.max(
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((u.getTime() - Date.now()) / Oe)
1465
- ), b = (t.history || []).filter(
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__ */ S("div", { css: L.row, children: [
1469
- /* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(Kt, { size: "1.25em", color: e.icon }) }),
1470
- /* @__PURE__ */ S("div", { css: L.body, children: [
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: h ? i(
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__ */ S("div", { css: L.pills, children: [
1480
- /* @__PURE__ */ n("span", { css: L.pill, children: h ? i("discussion.ban.permanent", "Permanent ban") : i("discussion.ban.daysLeft", "{{count}} days left", {
1481
- count: y
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
- !h && /* @__PURE__ */ S("span", { css: L.meta, children: [
1458
+ !y && /* @__PURE__ */ b("span", { css: L.meta, children: [
1487
1459
  "·",
1488
1460
  " ",
1489
1461
  i("discussion.ban.until", "Until {{date}}", {
1490
- date: l(u)
1462
+ date: l(f)
1491
1463
  })
1492
1464
  ] })
1493
1465
  ] }),
1494
- c.bannedReason && /* @__PURE__ */ S("div", { css: L.reasonBox, children: [
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 && b.length > 0 && /* @__PURE__ */ S("div", { css: L.history, children: [
1499
- /* @__PURE__ */ S(
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": p,
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: b.length
1480
+ count: x.length
1509
1481
  }),
1510
1482
  /* @__PURE__ */ n(
1511
- Ut,
1483
+ _t,
1512
1484
  {
1513
1485
  size: "1.25em",
1514
1486
  color: e.icon,
1515
- css: p ? L.chevron.open : L.chevron.closed
1487
+ css: u ? L.chevron.open : L.chevron.closed
1516
1488
  }
1517
1489
  )
1518
1490
  ]
1519
1491
  }
1520
1492
  ),
1521
- p && /* @__PURE__ */ n("ul", { css: L.list, children: b.map((g) => {
1522
- const k = g.unbannedAt ?? (g.bannedPeriodInDays > 0 ? new Date(
1523
- new Date(g.bannedAt).getTime() + g.bannedPeriodInDays * Oe
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__ */ S("li", { css: L.entry, children: [
1526
- /* @__PURE__ */ S("p", { css: L.entryDates, children: [
1497
+ return /* @__PURE__ */ b("li", { css: L.entry, children: [
1498
+ /* @__PURE__ */ b("p", { css: L.entryDates, children: [
1527
1499
  d(g.bannedAt),
1528
- k && ` – ${d(k)}`,
1529
- g.bannedPeriodInDays === ct && ` · ${i("discussion.ban.permanent", "Permanent ban")}`,
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__ */ S("p", { css: L.entryLifted, children: [
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__ */ S(Re, { children: [
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
- }, dt = { display: "flex", alignItems: "center", marginInlineStart: "0.5em", marginInlineEnd: "-2px" }, Ce = {
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({ ...dt, "& svg": { color: e.icon } }),
1600
- indicatorOpen: o(dt),
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
- }, mo = ({ value: t, options: r, onChange: i }) => {
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
- ), p = W(null), a = W(null), m = yt(s.open, s.rootRef, a, "start"), d = (c) => {
1647
- var u, y, b;
1648
- const h = c.target;
1649
- (u = p.current) != null && u.contains(h) || (y = a.current) != null && y.contains(h) || ((b = p.current) == null || b.focus(), s.triggerProps.onClick());
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__ */ S("div", { ref: s.rootRef, css: Ce.root, onClick: d, children: [
1652
- /* @__PURE__ */ n("button", { ref: p, ...s.triggerProps, css: Ce.button, children: (l = r.find((c) => c.value === t)) == null ? void 0 : l.label }),
1653
- /* @__PURE__ */ n("span", { css: s.open ? Ce.indicatorOpen : Ce.indicatorClosed, children: /* @__PURE__ */ n(jt, {}) }),
1654
- s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css: Ce.list, style: m, children: r.map((c, h) => /* @__PURE__ */ n("li", { ...s.optionProps(h), css: Ce.option, children: c.label }, c.value)) })
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
- }, go = ({
1655
+ }, ho = ({
1684
1656
  discussion: t,
1685
1657
  posts: r,
1686
1658
  postsHidden: i = !1,
1687
1659
  sdk: s,
1688
- userIsLoggedIn: p,
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: h,
1695
- onCreatePost: u,
1696
- onReact: y,
1697
- onDeletePost: b,
1666
+ onSortChange: y,
1667
+ onCreatePost: f,
1668
+ onReact: k,
1669
+ onDeletePost: x,
1698
1670
  onReportPost: g,
1699
- onLoadMore: k,
1700
- hasMore: I,
1671
+ onLoadMore: E,
1672
+ hasMore: T,
1701
1673
  liveRefresh: v = !1,
1702
- newPostIds: f,
1703
- onNewPostSeen: B,
1704
- isLoading: A,
1705
- isSubmitting: E,
1706
- infiniteScroll: $ = !1,
1674
+ newPostIds: p,
1675
+ onNewPostSeen: D,
1676
+ isLoading: M,
1677
+ isSubmitting: R,
1678
+ infiniteScroll: F = !1,
1707
1679
  showModeratedPosts: J = !1,
1708
- ban: U,
1709
- isBanned: V = !1,
1680
+ ban: K,
1681
+ isBanned: _ = !1,
1710
1682
  showBanHistory: q = !1
1711
1683
  }) => {
1712
- const { t: T } = ye(), _ = _e(), oe = W(null), ne = W(null);
1684
+ const { t: B } = be(), j = Ve(), oe = V(null), ne = V(null);
1713
1685
  he(() => {
1714
- if (!$ || !ne.current) return;
1686
+ if (!F || !ne.current) return;
1715
1687
  const P = new IntersectionObserver(
1716
- (j) => {
1717
- j[0].isIntersecting && I && !A && k();
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
- }, [$, I, A, k]);
1723
- const [pe, Z] = D({ open: !1, variant: "success", title: "", message: "" }), de = () => {
1724
- Z({
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: T("discussion.delete.success", "Comment deleted successfully.")
1700
+ message: B("discussion.delete.success", "Comment deleted successfully.")
1729
1701
  });
1730
- }, re = (P, j) => {
1731
- mt(P) || Z({
1702
+ }, re = (P, U) => {
1703
+ pt(P) || Q({
1732
1704
  open: !0,
1733
1705
  variant: "error",
1734
1706
  title: "",
1735
- message: fo(P) ? T(
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
- ) : j
1710
+ ) : U
1739
1711
  });
1740
- }, ie = async (P, j) => {
1712
+ }, ie = async (P, U) => {
1741
1713
  try {
1742
- return await y(P, j);
1743
- } catch (H) {
1714
+ return await k(P, U);
1715
+ } catch (X) {
1744
1716
  throw re(
1745
- H,
1746
- T("discussion.reactError", "Failed to add reaction. Please try again.")
1747
- ), H;
1717
+ X,
1718
+ B("discussion.reactError", "Failed to add reaction. Please try again.")
1719
+ ), X;
1748
1720
  }
1749
- }, Q = async (P, j) => {
1721
+ }, Z = async (P, U) => {
1750
1722
  try {
1751
- await u(P, j);
1752
- } catch (H) {
1723
+ await f(P, U);
1724
+ } catch (X) {
1753
1725
  throw re(
1754
- H,
1755
- T("discussion.postError", "Failed to post comment. Please try again.")
1756
- ), H;
1726
+ X,
1727
+ B("discussion.postError", "Failed to post comment. Please try again.")
1728
+ ), X;
1757
1729
  }
1758
- Z({
1730
+ Q({
1759
1731
  open: !0,
1760
1732
  variant: "success",
1761
1733
  title: "",
1762
- message: T("discussion.postSuccess", "Comment posted successfully.")
1734
+ message: B("discussion.postSuccess", "Comment posted successfully.")
1763
1735
  });
1764
1736
  }, se = [
1765
- { value: "LATEST", label: T("discussion.sort.latest", "Latest") },
1766
- { value: "OLDEST", label: T("discussion.sort.oldest", "Oldest") },
1767
- { value: "POPULAR", label: T("discussion.sort.popular", "Popular") },
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: T("discussion.sort.interacted", "Most Interacted")
1742
+ label: B("discussion.sort.interacted", "Most Interacted")
1771
1743
  }
1772
1744
  ];
1773
- return /* @__PURE__ */ S("div", { ref: oe, css: te.root, style: _, children: [
1774
- /* @__PURE__ */ S("div", { css: te.header, children: [
1775
- /* @__PURE__ */ n("h3", { css: te.title, children: t.label || T("discussion.title", "Discussion") }),
1776
- !i && /* @__PURE__ */ n("p", { css: te.count, children: T("discussion.postsCount", "{{count}} posts", {
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
- V && U && /* @__PURE__ */ n(po, { ban: U, showBanHistory: q }),
1752
+ _ && K && /* @__PURE__ */ n(mo, { ban: K, showBanHistory: q }),
1781
1753
  /* @__PURE__ */ n(
1782
- ht,
1754
+ ft,
1783
1755
  {
1784
- onSubmit: (P) => Q(P),
1785
- userIsLoggedIn: p,
1756
+ onSubmit: (P) => Z(P),
1757
+ userIsLoggedIn: u,
1786
1758
  onSignInClick: a,
1787
- isSubmitting: E,
1788
- disabled: V
1759
+ isSubmitting: R,
1760
+ disabled: _
1789
1761
  }
1790
1762
  ),
1791
- !i && /* @__PURE__ */ S(Re, { children: [
1763
+ !i && /* @__PURE__ */ b(Re, { children: [
1792
1764
  /* @__PURE__ */ n("hr", { css: te.divider }),
1793
- /* @__PURE__ */ S("div", { css: te.sortRow, children: [
1794
- /* @__PURE__ */ n("p", { css: z.titleMd, children: T("discussion.comments", "Comments") }),
1795
- /* @__PURE__ */ n(mo, { value: c, options: se, onChange: h })
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
- A && r.length === 0 ? /* @__PURE__ */ n("div", { css: te.listSpinner, children: /* @__PURE__ */ n(We, { marginBlock: "32px" }) }) : r.length === 0 ? /* @__PURE__ */ n("div", { css: te.empty, children: /* @__PURE__ */ n("p", { css: te.emptyText, children: T(
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__ */ S(Re, { children: [
1772
+ ) }) }) : /* @__PURE__ */ b(Re, { children: [
1801
1773
  /* @__PURE__ */ n("div", { children: r.map((P) => /* @__PURE__ */ n(
1802
- xt,
1774
+ yt,
1803
1775
  {
1804
1776
  post: P,
1805
1777
  sdk: s,
1806
- userIsLoggedIn: p,
1778
+ userIsLoggedIn: u,
1807
1779
  onSignInClick: a,
1808
1780
  showReactions: m,
1809
1781
  showReplies: d,
1810
1782
  showReportPost: l,
1811
- onReply: (j, H) => Q(H, j),
1783
+ onReply: (U, X) => Z(X, U),
1812
1784
  onReact: ie,
1813
- onDelete: b,
1785
+ onDelete: x,
1814
1786
  onReport: g,
1815
- isSubmitting: E,
1787
+ isSubmitting: R,
1816
1788
  showModeratedPosts: J,
1817
- isBanned: V,
1789
+ isBanned: _,
1818
1790
  highlightable: v,
1819
- isNew: f == null ? void 0 : f.has(P.id),
1820
- onNewSeen: B,
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
- $ && /* @__PURE__ */ n("div", { ref: ne, css: te.sentinel })
1797
+ F && /* @__PURE__ */ n("div", { ref: ne, css: te.sentinel })
1826
1798
  ] }),
1827
- $ && A && r.length > 0 && /* @__PURE__ */ n("div", { css: te.moreSpinner, children: /* @__PURE__ */ n(We, { marginBlock: "16px" }) }),
1828
- !$ && I && /* @__PURE__ */ n("div", { css: te.loadMore, children: /* @__PURE__ */ n(ue, { look: "outlined", onClick: k, loading: A, children: T("discussion.loadMore", "Load More") }) })
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
- pt,
1803
+ dt,
1832
1804
  {
1833
1805
  notification: pe,
1834
- onClose: () => Z((P) => ({ ...P, open: !1 }))
1806
+ onClose: () => Q((P) => ({ ...P, open: !1 }))
1835
1807
  }
1836
1808
  )
1837
1809
  ] });
1838
- }, ho = (t) => {
1810
+ }, yo = (t) => {
1839
1811
  const {
1840
1812
  entityId: r,
1841
1813
  sdk: i,
1842
1814
  discussionLabel: s,
1843
- discussionUrl: p = "",
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: h = !1,
1850
- showModeratedPosts: u = !1,
1851
- userIsLoggedIn: y = !1,
1852
- showBanHistory: b = !1,
1821
+ infiniteScroll: y = !1,
1822
+ showModeratedPosts: f = !1,
1823
+ userIsLoggedIn: k = !1,
1824
+ showBanHistory: x = !1,
1853
1825
  refreshInterval: g = 0,
1854
- onSignInClick: k
1855
- } = t, { ban: I, isBanned: v, refresh: f } = Zt(i, y), {
1856
- discussion: B,
1857
- setDiscussion: A,
1858
- isLoading: E,
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
- } = _t(i, r), U = () => ({
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
- }), V = (fe) => {
1868
- A((R) => {
1869
- const w = R ?? U();
1870
- return { ...w, postsCount: Math.max(0, w.postsCount + fe) };
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: T,
1875
- isLoading: _,
1846
+ postsHidden: B,
1847
+ isLoading: j,
1876
1848
  isSubmitting: oe,
1877
1849
  currentSort: ne,
1878
1850
  hasMore: pe,
1879
- newPostIds: Z,
1851
+ newPostIds: Q,
1880
1852
  markPostSeen: de,
1881
1853
  handleSortChange: re,
1882
1854
  handleLoadMore: ie,
1883
- handleCreatePost: Q,
1855
+ handleCreatePost: Z,
1884
1856
  handleReact: se,
1885
1857
  handleDeletePost: P,
1886
- handleReportPost: j
1887
- } = Jt(
1858
+ handleReportPost: U
1859
+ } = Qt(
1888
1860
  i,
1889
1861
  r,
1890
1862
  s || null,
1891
- p,
1863
+ u,
1892
1864
  a,
1893
1865
  m,
1894
- V,
1895
- u,
1866
+ _,
1867
+ f,
1896
1868
  g
1897
- ), H = (fe) => async (...R) => {
1869
+ ), X = (me) => async (...C) => {
1898
1870
  try {
1899
- return await fe(...R);
1900
- } catch (w) {
1901
- throw mt(w) && f(), w;
1871
+ return await me(...C);
1872
+ } catch (S) {
1873
+ throw pt(S) && p(), S;
1902
1874
  }
1903
1875
  };
1904
- if (E || !B && !J && _)
1905
- return /* @__PURE__ */ n(We, { marginBlock: "160px" });
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 (fe, R) => {
1909
- await Q(fe, R), s && A((w) => ({ ...w ?? U(), label: s }));
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
- go,
1884
+ ho,
1913
1885
  {
1914
- discussion: B ?? U(),
1886
+ discussion: D ?? K(),
1915
1887
  posts: q,
1916
- postsHidden: T,
1888
+ postsHidden: B,
1917
1889
  sdk: i,
1918
- userIsLoggedIn: y,
1919
- onSignInClick: k,
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: H(Ee),
1926
- onReact: H(se),
1927
- onDeletePost: H(P),
1928
- onReportPost: H(j),
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: Z,
1904
+ newPostIds: Q,
1933
1905
  onNewPostSeen: de,
1934
- isLoading: _,
1906
+ isLoading: j,
1935
1907
  isSubmitting: oe,
1936
- infiniteScroll: h,
1937
- showModeratedPosts: u,
1938
- ban: I,
1908
+ infiniteScroll: y,
1909
+ showModeratedPosts: f,
1910
+ ban: T,
1939
1911
  isBanned: v,
1940
- showBanHistory: b
1912
+ showBanHistory: x
1941
1913
  }
1942
1914
  );
1943
- }, Ro = (t) => /* @__PURE__ */ n(
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(ho, { ...t })
1923
+ children: /* @__PURE__ */ n(yo, { ...t })
1952
1924
  }
1953
1925
  );
1954
1926
  export {
1955
- Ro as M
1927
+ Io as M
1956
1928
  };