@logora/debate 0.4.102 → 0.4.104

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.
@@ -1,117 +1,118 @@
1
- import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
- import { useRef as Ye, useState as u, useEffect as p, Suspense as je, lazy as ze } from "react";
3
- import { useIntl as Oe, FormattedMessage as he } from "react-intl";
4
- import { useLocation as Je } from "react-router";
5
- import x from "classnames";
1
+ import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
+ import { storePendingReply as je } from "../../util/pending_reply/pendingReply.js";
3
+ import { useRef as ze, useState as u, useEffect as M, Suspense as Oe, lazy as Re } from "react";
4
+ import { useIntl as Je, FormattedMessage as he } from "react-intl";
5
+ import { useLocation as Ke } from "react-router";
6
+ import I from "classnames";
6
7
  import n from "./ArgumentInput.module.scss.js";
7
- import { useDataProvider as Ke } from "../../data/data_provider/useDataProvider.js";
8
- import { useList as Re } from "../../list/list_provider/useList.js";
9
- import { useConfig as Ge } from "../../data/config_provider/useConfig.js";
10
- import { useInput as He } from "../input_provider/useInput.js";
11
- import { useAuth as Qe } from "../../auth/use_auth/useAuth.js";
12
- import { useFormValidation as Xe } from "../../forms/use_form_validation/useFormValidation.js";
13
- import { useResponsive as Ze } from "../../hooks/use_responsive/useResponsive.js";
14
- import { useSessionStorageState as et } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
15
- import { useAuthRequired as tt } from "../../hooks/use_auth_required/useAuthRequired.js";
16
- import { useModal as nt } from "../../dialog/modal/useModal.js";
17
- import { useToast as at } from "../../dialog/toast_provider/useToast.js";
18
- import { TogglePosition as st } from "../toggle_position/TogglePosition.js";
19
- import { Avatar as it } from "../../user/avatar/Avatar.js";
20
- import { AuthorBox as ot } from "../../user/author_box/AuthorBox.js";
21
- import { TextEditor as rt } from "../text_editor/TextEditor.js";
22
- import { Icon as ut } from "../../icons/icon/Icon.js";
23
- const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Pt = ({
8
+ import { useDataProvider as Ge } from "../../data/data_provider/useDataProvider.js";
9
+ import { useList as He } from "../../list/list_provider/useList.js";
10
+ import { useConfig as Qe } from "../../data/config_provider/useConfig.js";
11
+ import { useInput as Xe } from "../input_provider/useInput.js";
12
+ import { useAuth as Ze } from "../../auth/use_auth/useAuth.js";
13
+ import { useFormValidation as et } from "../../forms/use_form_validation/useFormValidation.js";
14
+ import { useResponsive as tt } from "../../hooks/use_responsive/useResponsive.js";
15
+ import { useScrollToEditor as nt } from "../use_scroll_to_editor/useScrollToEditor.js";
16
+ import { useSessionStorageState as at } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
17
+ import { useAuthRequired as it } from "../../hooks/use_auth_required/useAuthRequired.js";
18
+ import { useModal as st } from "../../dialog/modal/useModal.js";
19
+ import { useToast as ot } from "../../dialog/toast_provider/useToast.js";
20
+ import { TogglePosition as rt } from "../toggle_position/TogglePosition.js";
21
+ import { Avatar as ut } from "../../user/avatar/Avatar.js";
22
+ import { AuthorBox as dt } from "../../user/author_box/AuthorBox.js";
23
+ import { TextEditor as lt } from "../text_editor/TextEditor.js";
24
+ import { Icon as ct } from "../../icons/icon/Icon.js";
25
+ const mt = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), qt = ({
24
26
  argumentListId: N,
25
27
  avatarSize: pe = 48,
26
- disabled: J = !1,
28
+ disabled: R = !1,
27
29
  positions: a = [],
28
30
  disabledPositions: T = [],
29
- groupId: _,
31
+ groupId: f,
30
32
  groupName: _e,
31
- groupType: K,
33
+ groupType: J,
32
34
  hideSourceAction: Me = !1,
33
- isReply: i = !1,
34
- onSubmit: R,
35
+ isReply: s = !1,
36
+ onSubmit: K,
35
37
  onUpdate: G,
36
- parentId: M,
37
- placeholder: ve,
38
+ parentId: m,
39
+ ancestorIds: ve = [],
40
+ placeholder: be,
38
41
  positionId: w,
39
- focusOnInit: be = !1,
42
+ focusOnInit: Ae = !1,
40
43
  activeOnInit: P = !1,
41
44
  userGuideUrl: H,
42
- hideUserGuideLink: Ae = !1,
43
- hideCharCount: Ce = !1,
44
- disableAutoActivate: we = !1,
45
+ hideUserGuideLink: Ce = !1,
46
+ hideCharCount: we = !1,
47
+ disableAutoActivate: Se = !1,
45
48
  autoFocus: Q = !1
46
49
  }) => {
47
- const r = Oe(), X = Ke(), L = Re(), v = Ge(), {
50
+ const r = Je(), X = Ge(), y = He(), v = Qe(), {
48
51
  focus: Z,
49
52
  setFocus: ee,
50
53
  inputContent: B,
51
54
  setInputContent: te,
52
- setInputRichContent: Se
53
- } = He(), { isLoggedIn: S, currentUser: d } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), Ie = Je(), ne = Ye(null), [V, k] = u([]), [q, D] = u(""), [ae, U] = u(null), [l, b] = u(null), [se, ie] = u(null), [oe, re] = u(!1), [I, ue] = u(!1), [A, de] = u({}), [xe, W] = u(!1), [Ne, Te] = u(0), [f, Le] = et(
55
+ setInputRichContent: xe
56
+ } = Xe(), { isLoggedIn: S, currentUser: d } = Ze(), { errors: E, validate: $ } = et(), { isMobile: g } = tt(), Ie = Ke(), ne = ze(null), L = nt(ne), [V, q] = u([]), [D, U] = u(""), [ae, W] = u(null), [l, b] = u(null), [ie, se] = u(null), [oe, re] = u(!1), [x, ue] = u(!1), [A, de] = u({}), [Ne, Y] = u(!1), [Te, ye] = u(0), [h, Le] = at(
54
57
  "userSide",
55
58
  {}
56
- ), [g, ye] = u(
59
+ ), [p, Fe] = u(
57
60
  !S && v?.actions?.disableInputForVisitor
58
- ), Y = tt(), { showModal: Fe } = nt(), { toast: j } = at() || {}, le = new URLSearchParams(
61
+ ), k = it(), { showModal: Pe } = st(), { toast: j } = ot() || {}, le = new URLSearchParams(
59
62
  typeof window < "u" ? window.location.search : Ie.search
60
63
  );
61
- p(() => {
62
- ye(
64
+ M(() => {
65
+ Fe(
63
66
  !S && v?.actions?.disableInputForVisitor
64
67
  );
65
68
  }, [S, v]);
66
69
  const z = d?.role === "editor" || d?.role === "moderator", ce = d?.moderation_status === "banned";
67
- p(() => {
70
+ M(() => {
68
71
  let e = null;
69
- typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : f && f.groupId == _ && f.positionId != a[2]?.id && b(f.positionId);
70
- }, [w]), p(() => {
71
- Q && W(!0);
72
- }, [Q]), p(() => {
73
- P && (O(), W(!0), y());
74
- }, [P]), p(() => {
72
+ typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : h && h.groupId == f && h.positionId != a[2]?.id && b(h.positionId);
73
+ }, [w]), M(() => {
74
+ Q && Y(!0);
75
+ }, [Q]), M(() => {
76
+ P && (O(), Y(!0), L());
77
+ }, [P]), M(() => {
75
78
  if (typeof window < "u") {
76
- const e = be || le.get("initArgument");
77
- (e === !0 || e === "true") && (W(!0), y(), De());
79
+ const e = Ae || le.get("initArgument");
80
+ (e === !0 || e === "true") && (Y(!0), L(), We());
78
81
  }
79
- }, []), p(() => {
80
- Z && !i && (y(), ee(!1));
81
- }, [Z]), p(() => {
82
- B?.id && !i && (Pe(B), ee(!0));
82
+ }, []), M(() => {
83
+ Z && !s && (L(), ee(!1));
84
+ }, [Z]), M(() => {
85
+ B?.id && !s && (Be(B), ee(!0));
83
86
  }, [B]);
84
- const Pe = (e) => {
85
- de(e), ue(!0), k(e.sources), D(e.content), U(e.rich_content), ie(e.id), y(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Se(e.rich_content) : te(e.content);
86
- }, y = () => {
87
- ne.current.scrollIntoView({ behavior: "smooth", block: "center" });
87
+ const Be = (e) => {
88
+ de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content), se(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? xe(e.rich_content) : te(e.content);
88
89
  }, me = () => {
89
- D(""), U(null), de({}), ie(null), k([]), Te((e) => e + 1), te(null);
90
- }, Be = (e) => {
90
+ U(""), W(null), de({}), se(null), q([]), ye((e) => e + 1), te(null);
91
+ }, Ee = (e) => {
91
92
  b(e), ge(e);
92
- }, Ee = () => {
93
- Fe(
94
- /* @__PURE__ */ s(je, { fallback: null, children: /* @__PURE__ */ s(
95
- dt,
93
+ }, $e = () => {
94
+ Pe(
95
+ /* @__PURE__ */ i(Oe, { fallback: null, children: /* @__PURE__ */ i(
96
+ mt,
96
97
  {
97
98
  modalTitle: r.formatMessage({
98
99
  id: "modal.side_modal.modal_title",
99
100
  defaultMessage: "Choose your side"
100
101
  }),
101
- onChooseSide: Be,
102
+ onChooseSide: Ee,
102
103
  positions: a,
103
104
  title: _e,
104
- disabledPositions: !i && T,
105
- isNeutral: f && f.groupId == _ && f.positionId === a[2]?.id
105
+ disabledPositions: !s && T,
106
+ isNeutral: h && h.groupId == f && h.positionId === a[2]?.id
106
107
  }
107
108
  ) })
108
109
  );
109
- }, $e = () => {
110
- S ? se ? qe() : !a || a?.length === 0 || !T?.find((e) => e?.id === l) && l || z && i ? ge(i && z && a[0]?.id) : Ee() : Y({ loginAction: "argument" });
111
- }, Ve = (e, t) => {
112
- g ? Y({ loginAction: "argument" }) : (D(e), U(t), $({ content: e }, [{ content: ["url", null] }]));
113
- }, ke = (e) => {
114
- k(e);
110
+ }, Ve = () => {
111
+ S ? ie ? Ue() : !a || a?.length === 0 || !T?.find((e) => e?.id === l) && l || z && s ? ge(s && z && a[0]?.id) : $e() : (m && je({ groupId: f, parentId: m, ancestorIds: ve }), k({ loginAction: "argument" }));
112
+ }, qe = (e, t) => {
113
+ p ? k({ loginAction: "argument" }) : (U(e), W(t), $({ content: e }, [{ content: ["url", null] }]));
114
+ }, De = (e) => {
115
+ q(e);
115
116
  }, fe = [
116
117
  { content: ["length", 3] },
117
118
  { content: ["required", null] },
@@ -119,22 +120,22 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
119
120
  ...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
120
121
  ], ge = (e) => {
121
122
  const t = e || l, c = {
122
- content: q,
123
+ content: D,
123
124
  rich_content: ae,
124
- group_id: _,
125
- ...K && { group_type: K },
125
+ group_id: f,
126
+ ...J && { group_type: J },
126
127
  ...t && { position_id: t },
127
- is_reply: !!M,
128
- message_id: M || null,
128
+ is_reply: !!m,
129
+ message_id: m || null,
129
130
  source_ids: V?.map((o) => o.id)
130
131
  };
131
132
  $(c, fe) && (t && a && a.map((o) => o.id).includes(t) && Le({
132
- groupId: _,
133
+ groupId: f,
133
134
  positionId: t
134
135
  }), me(), X.create("messages", c).then((o) => {
135
136
  if (o.data.success) {
136
- if (M)
137
- R(o.data.data.resource), j(
137
+ if (m)
138
+ K(o.data.data.resource), j(
138
139
  r.formatMessage({
139
140
  id: "alert.argument_create",
140
141
  defaultMessage: "Your contribution has been sent !"
@@ -148,12 +149,12 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
148
149
  }
149
150
  );
150
151
  else {
151
- const h = o.data.data.resource;
152
+ const _ = o.data.data.resource;
152
153
  let F = N;
153
- t && !m && (F = `argumentList${h.position.id}`), R?.(
154
- q,
155
- a.find((We) => We.id === t) || null
156
- ), L.add(F, [h]), j(
154
+ t && !g && (F = `argumentList${_.position.id}`), K?.(
155
+ D,
156
+ a.find((ke) => ke.id === t) || null
157
+ ), y.add(F, [_]), j(
157
158
  r.formatMessage({
158
159
  id: "alert.argument_create",
159
160
  defaultMessage: "Your contribution has been sent !"
@@ -178,32 +179,32 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
178
179
  );
179
180
  }
180
181
  }));
181
- }, qe = () => {
182
+ }, Ue = () => {
182
183
  const e = {
183
- content: q,
184
+ content: D,
184
185
  rich_content: ae,
185
186
  source_ids: V?.map((t) => t.id),
186
187
  ...l && { position_id: l }
187
188
  };
188
- $(e, fe) && X.update("messages", se, e).then((t) => {
189
+ $(e, fe) && X.update("messages", ie, e).then((t) => {
189
190
  if (t.data.success) {
190
191
  const c = t.data.data.resource;
191
192
  let o = N;
192
- if (A?.is_reply || i) {
193
- const h = A?.message_id || A?.reply_to_id || M;
194
- h && (o = `argument_${h}_reply_list`);
195
- } else l && !m && (o = `argumentList${c.position?.id}`);
196
- if (!A?.is_reply && A?.position?.id != c.position?.id && !m) {
197
- const h = `argumentList${A.position.id}`, F = `argumentList${c.position.id}`;
198
- L.remove(h, [c]), L.add(F, [c]);
193
+ if (A?.is_reply || s) {
194
+ const _ = A?.message_id || A?.reply_to_id || m;
195
+ _ && (o = `argument_${_}_reply_list`);
196
+ } else l && !g && (o = `argumentList${c.position?.id}`);
197
+ if (!A?.is_reply && A?.position?.id != c.position?.id && !g) {
198
+ const _ = `argumentList${A.position.id}`, F = `argumentList${c.position.id}`;
199
+ y.remove(_, [c]), y.add(F, [c]);
199
200
  } else
200
- L.update(o, [c]);
201
+ y.update(o, [c]);
201
202
  G && G(c), j(r.formatMessage({ id: "alert.argument_modify" }), {
202
203
  type: "success"
203
204
  }), me();
204
205
  }
205
206
  });
206
- }, De = () => {
207
+ }, We = () => {
207
208
  if (!oe) {
208
209
  re(!0);
209
210
  const e = setTimeout(() => {
@@ -212,8 +213,8 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
212
213
  return () => clearTimeout(e);
213
214
  }
214
215
  }, O = () => {
215
- g ? Y({ loginAction: "argument" }) : ue(!0);
216
- }, Ue = () => {
216
+ p ? k({ loginAction: "argument" }) : ue(!0);
217
+ }, Ye = () => {
217
218
  const e = T.find(
218
219
  (t) => t.id === l
219
220
  );
@@ -227,28 +228,28 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
227
228
  );
228
229
  };
229
230
  return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
230
- J && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
231
+ R && /* @__PURE__ */ i("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
231
232
  id: "input.argument_input.user_banned",
232
233
  defaultMessage: "You are banned from the debate space."
233
234
  }) : r.formatMessage({
234
235
  id: "info.debate_is_inactive",
235
236
  defaultMessage: "Debate is closed"
236
237
  }) }),
237
- /* @__PURE__ */ s(
238
+ /* @__PURE__ */ i(
238
239
  "div",
239
240
  {
240
- className: x(n.argumentInput, {
241
+ className: I(n.argumentInput, {
241
242
  [n.flash]: oe,
242
- [n.replyInputContainer]: i
243
+ [n.replyInputContainer]: s
243
244
  }),
244
- children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ C("div", { className: n.argumentInputBox, children: [
245
- a.length > 0 && S && (!i || !z) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
246
- /* @__PURE__ */ s("div", { children: r.formatMessage({
245
+ children: /* @__PURE__ */ i("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ C("div", { className: n.argumentInputBox, children: [
246
+ a.length > 0 && S && (!s || !z) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
247
+ /* @__PURE__ */ i("div", { children: r.formatMessage({
247
248
  id: "input.position",
248
249
  defaultMessage: "Your position"
249
250
  }) }),
250
- /* @__PURE__ */ s(
251
- st,
251
+ /* @__PURE__ */ i(
252
+ rt,
252
253
  {
253
254
  activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
254
255
  firstLabel: a[0],
@@ -260,27 +261,27 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
260
261
  /* @__PURE__ */ C(
261
262
  "div",
262
263
  {
263
- className: x(n.argumentTextInputBox, {
264
- [n.argumentTextInputBoxisTablet]: !m,
265
- [n.replyEditorRow]: i
264
+ className: I(n.argumentTextInputBox, {
265
+ [n.argumentTextInputBoxisTablet]: !g,
266
+ [n.replyEditorRow]: s
266
267
  }),
267
268
  children: [
268
- /* @__PURE__ */ s(
269
+ /* @__PURE__ */ i(
269
270
  "div",
270
271
  {
271
- className: x(n.argumentAuthorContainer, {
272
- [n.argumentAuthorContainerMobile]: m,
273
- [n.argumentAuthorContainerActivated]: !m && I || i
272
+ className: I(n.argumentAuthorContainer, {
273
+ [n.argumentAuthorContainerMobile]: g,
274
+ [n.argumentAuthorContainerActivated]: !g && x || s
274
275
  }),
275
- children: !m && I || i ? /* @__PURE__ */ s(
276
- it,
276
+ children: !g && x || s ? /* @__PURE__ */ i(
277
+ ut,
277
278
  {
278
279
  avatarUrl: d.image_url,
279
280
  userName: d.full_name,
280
281
  size: pe
281
282
  }
282
- ) : /* @__PURE__ */ s(
283
- ot,
283
+ ) : /* @__PURE__ */ i(
284
+ dt,
284
285
  {
285
286
  fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
286
287
  avatarUrl: d?.image_url,
@@ -295,57 +296,57 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
295
296
  {
296
297
  onClick: O,
297
298
  "data-testid": "argument-input",
298
- className: x(n.textEditorBox, {
299
- [n.replyTextEditorBox]: i
299
+ className: I(n.textEditorBox, {
300
+ [n.replyTextEditorBox]: s
300
301
  }),
301
302
  children: [
302
- /* @__PURE__ */ s(
303
- rt,
303
+ /* @__PURE__ */ i(
304
+ lt,
304
305
  {
305
306
  handleChange: (e, t) => {
306
- Ve(e, t);
307
+ qe(e, t);
307
308
  },
308
309
  handleSourcesChange: (e) => {
309
- ke(e);
310
+ De(e);
310
311
  },
311
- placeholder: ve,
312
+ placeholder: be,
312
313
  "aria-label": r.formatMessage({
313
314
  id: "input.argument_input.aria_label",
314
315
  defaultMessage: "Message input field"
315
316
  }),
316
- onSubmit: $e,
317
+ onSubmit: Ve,
317
318
  sources: V,
318
- hideSourceAction: Me || g,
319
- uid: M ? `Reply${_}_${M}` : `Argument${_}`,
319
+ hideSourceAction: Me || p,
320
+ uid: m ? `Reply${f}_${m}` : `Argument${f}`,
320
321
  onActivation: O,
321
- showStylesControls: I,
322
- disabled: J || g || ce,
323
- maxLength: g ? !1 : v?.actions?.argumentMaxLength,
324
- disableRichText: v?.actions?.disableRichText || g,
325
- shortBar: i,
326
- isReply: i,
327
- resetSignal: Ne,
328
- hideSubmit: g,
322
+ showStylesControls: x,
323
+ disabled: R || p || ce,
324
+ maxLength: p ? !1 : v?.actions?.argumentMaxLength,
325
+ disableRichText: v?.actions?.disableRichText || p,
326
+ shortBar: s,
327
+ isReply: s,
328
+ resetSignal: Te,
329
+ hideSubmit: p,
329
330
  allowedDomains: v?.allowed_sources,
330
331
  active: P,
331
- autoFocus: xe,
332
- hideCharCount: Ce,
333
- disableAutoActivate: we
332
+ autoFocus: Ne,
333
+ hideCharCount: we,
334
+ disableAutoActivate: Se
334
335
  }
335
336
  ),
336
- E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
337
- I && T?.find(
337
+ E?.content && /* @__PURE__ */ i("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ i("div", { children: e }, t)) }),
338
+ x && T?.find(
338
339
  (e) => e.id === l
339
340
  ) && /* @__PURE__ */ C(
340
341
  "div",
341
342
  {
342
- className: x(
343
+ className: I(
343
344
  n.argumentInputWarning,
344
345
  n.disabledPositionWarning
345
346
  ),
346
347
  children: [
347
- /* @__PURE__ */ s(
348
- ut,
348
+ /* @__PURE__ */ i(
349
+ ct,
349
350
  {
350
351
  name: "announcement",
351
352
  className: n.warningIcon,
@@ -353,24 +354,24 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
353
354
  width: 20
354
355
  }
355
356
  ),
356
- /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: Ue() })
357
+ /* @__PURE__ */ i("div", { className: n.argumentInputWarningText, children: Ye() })
357
358
  ]
358
359
  }
359
360
  ),
360
- I && H && !Ae && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
361
+ x && H && !Ce && /* @__PURE__ */ i("div", { className: n.guideMessage, children: /* @__PURE__ */ i(
361
362
  he,
362
363
  {
363
364
  id: "alert.guide_message",
364
365
  defaultMessage: "Contributions must comply with our {userCharter}.",
365
366
  values: {
366
- userCharter: /* @__PURE__ */ s(
367
+ userCharter: /* @__PURE__ */ i(
367
368
  "a",
368
369
  {
369
370
  className: n.guideMessage,
370
371
  href: H,
371
372
  target: "_blank",
372
373
  rel: "noreferrer",
373
- children: /* @__PURE__ */ s(
374
+ children: /* @__PURE__ */ i(
374
375
  he,
375
376
  {
376
377
  id: "alert.user_charter",
@@ -394,5 +395,5 @@ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
394
395
  ] });
395
396
  };
396
397
  export {
397
- Pt as ArgumentInput
398
+ qt as ArgumentInput
398
399
  };
@@ -0,0 +1,20 @@
1
+ import { useRef as t, useCallback as c, useEffect as i } from "react";
2
+ const u = (e) => {
3
+ const r = t(null), o = c(() => {
4
+ window.cancelAnimationFrame(r.current), r.current = window.requestAnimationFrame(() => {
5
+ r.current = window.requestAnimationFrame(() => {
6
+ const n = e?.current;
7
+ n && n.scrollIntoView({ behavior: "smooth", block: "center" });
8
+ });
9
+ });
10
+ }, [e]);
11
+ return i(
12
+ () => () => {
13
+ window.cancelAnimationFrame(r.current);
14
+ },
15
+ []
16
+ ), o;
17
+ };
18
+ export {
19
+ u as useScrollToEditor
20
+ };
@@ -0,0 +1,32 @@
1
+ const t = "Logora:pendingReply", c = 18e5, a = ({ groupId: e, parentId: n, ancestorIds: r = [] }) => {
2
+ try {
3
+ sessionStorage.setItem(
4
+ t,
5
+ JSON.stringify({
6
+ groupId: e,
7
+ parentId: n,
8
+ ancestorIds: r,
9
+ createdAt: Date.now()
10
+ })
11
+ );
12
+ } catch {
13
+ }
14
+ }, o = () => {
15
+ try {
16
+ sessionStorage.removeItem(t);
17
+ } catch {
18
+ }
19
+ }, i = () => {
20
+ try {
21
+ const e = JSON.parse(sessionStorage.getItem(t));
22
+ return !e || typeof e != "object" || !e.parentId ? null : Date.now() - (e.createdAt || 0) > 18e5 ? (o(), null) : e;
23
+ } catch {
24
+ return null;
25
+ }
26
+ };
27
+ export {
28
+ c as PENDING_REPLY_MAX_AGE,
29
+ o as clearPendingReply,
30
+ i as readPendingReply,
31
+ a as storePendingReply
32
+ };