@linktr.ee/messaging-react 1.15.2 โ†’ 1.16.0-rc-1769569754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as i, Fragment as be } from "react/jsx-runtime";
2
- import M from "classnames";
3
- import P, { createContext as ze, useContext as Ge, useCallback as T, useState as I, useRef as W, useEffect as Z, useMemo as we } from "react";
4
- import { StreamChatService as He } from "@linktr.ee/messaging-core";
5
- import { Chat as Ve, ChannelList as We, DateSeparator as Ze, areMessageUIPropsEqual as qe, useChatContext as Ye, useTranslationContext as Je, useMessageReminder as Qe, useComponentContext as Xe, Attachment as Ke, Avatar as es, EditMessageModal as ss, MessageBlocked as ts, MessageBouncePrompt as ns, MessageDeleted as rs, MessageIsThreadReplyInChannelButtonIndicator as as, MessageRepliesCountButton as ls, MessageStatus as os, MessageTimestamp as Re, ReminderNotification as is, StreamedMessageText as cs, messageHasAttachments as ds, messageHasReactions as ms, isDateSeparatorMessage as us, isMessageBlocked as hs, isMessageBounced as fs, isMessageEdited as gs, MessageBounceModal as xs, Poll as Cs, MessageText as bs, MessageErrorIcon as Ns, MessageEditedTimestamp as vs, useMessageContext as ws, useMessageComposer as ps, useStateStore as ys, MessageInput as Es, useMessageInputContext as Is, useMessageComposerHasSendableData as Ss, SimpleAttachmentSelector as _s, QuotedMessagePreview as Ms, AttachmentPreviewList as ks, TextareaComposer as Rs, Channel as Ts, useChannelStateContext as Te, WithComponents as Ds, Window as Fs, MessageList as Ls } from "stream-chat-react";
6
- import { GiftIcon as Ps, XIcon as Ne, ArrowUpIcon as Os, ArrowLeftIcon as pe, StarIcon as ye, DotsThreeIcon as Ee, SpinnerGapIcon as de, SignOutIcon as Us, ProhibitInsetIcon as Ie, FlagIcon as Bs, MagnifyingGlassIcon as As, ChatCircleDotsIcon as Se } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as _e } from "stream-chat";
8
- const De = ze({
1
+ import { jsx as e, jsxs as i, Fragment as Ne } from "react/jsx-runtime";
2
+ import R from "classnames";
3
+ import L, { createContext as Ge, useContext as He, useCallback as D, useState as I, useRef as W, useEffect as q, useMemo as pe } from "react";
4
+ import { StreamChatService as Ve } from "@linktr.ee/messaging-core";
5
+ import { Chat as We, ChannelList as qe, DateSeparator as Ze, areMessageUIPropsEqual as Ye, useChatContext as Je, useTranslationContext as Qe, useMessageReminder as Xe, useComponentContext as Ke, Attachment as es, Avatar as ss, EditMessageModal as ts, MessageBlocked as ns, MessageBouncePrompt as rs, MessageDeleted as as, MessageIsThreadReplyInChannelButtonIndicator as ls, MessageRepliesCountButton as os, MessageStatus as is, MessageTimestamp as Te, ReminderNotification as cs, StreamedMessageText as ds, messageHasAttachments as ms, messageHasReactions as us, isDateSeparatorMessage as hs, isMessageBlocked as fs, isMessageBounced as gs, isMessageEdited as xs, MessageBounceModal as Cs, Poll as bs, MessageText as Ns, MessageErrorIcon as vs, MessageEditedTimestamp as ws, useMessageContext as ps, useMessageComposer as ys, useStateStore as Es, MessageInput as Is, useMessageInputContext as Ss, useMessageComposerHasSendableData as _s, SimpleAttachmentSelector as Ms, QuotedMessagePreview as ks, AttachmentPreviewList as Rs, TextareaComposer as Ts, Channel as Ds, useChannelStateContext as De, WithComponents as Fs, Window as Ls, MessageList as Ps } from "stream-chat-react";
6
+ import { GiftIcon as Os, XIcon as ve, ArrowUpIcon as Us, ArrowLeftIcon as ye, StarIcon as Ee, DotsThreeIcon as Ie, SpinnerGapIcon as ue, SignOutIcon as Bs, ProhibitInsetIcon as Se, FlagIcon as As, MagnifyingGlassIcon as js, ChatCircleDotsIcon as _e } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as Me } from "stream-chat";
8
+ const Fe = Ge({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,7 +15,7 @@ const De = ze({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), he = () => Ge(De), wt = ({
18
+ }), ge = () => He(Fe), pt = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
@@ -23,9 +23,9 @@ const De = ze({
23
23
  capabilities: l = {},
24
24
  debug: c = !1
25
25
  }) => {
26
- const a = T(
27
- (d, ...N) => {
28
- c && console.log(`๐Ÿ”ฅ [MessagingProvider] ${d}`, ...N);
26
+ const a = D(
27
+ (d, ...v) => {
28
+ c && console.log(`๐Ÿ”ฅ [MessagingProvider] ${d}`, ...v);
29
29
  },
30
30
  [c]
31
31
  );
@@ -35,28 +35,28 @@ const De = ze({
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(l)
37
37
  });
38
- const [u, h] = I(null), [x, y] = I(null), [f, o] = I(!1), [_, E] = I(!1), [m, C] = I(null), v = W(!1), w = W({
38
+ const [u, h] = I(null), [x, p] = I(null), [f, o] = I(!1), [M, S] = I(!1), [g, m] = I(null), b = W(!1), N = W({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
42
  capabilities: l
43
- }), S = W(0);
44
- S.current++, a("๐Ÿ“Š RENDER INFO", {
45
- renderCount: S.current,
43
+ }), y = W(0);
44
+ y.current++, a("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: y.current,
46
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
- userChanged: w.current.userId !== (s == null ? void 0 : s.id),
49
- apiKeyChanged: w.current.apiKey !== r,
50
- serviceConfigChanged: w.current.serviceConfig !== n,
51
- capabilitiesChanged: w.current.capabilities !== l
48
+ userChanged: N.current.userId !== (s == null ? void 0 : s.id),
49
+ apiKeyChanged: N.current.apiKey !== r,
50
+ serviceConfigChanged: N.current.serviceConfig !== n,
51
+ capabilitiesChanged: N.current.capabilities !== l
52
52
  }
53
- }), w.current = {
53
+ }), N.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
55
  apiKey: r,
56
56
  serviceConfig: n,
57
57
  capabilities: l
58
- }, Z(() => {
59
- const d = S.current;
58
+ }, q(() => {
59
+ const d = y.current;
60
60
  if (a("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
61
  renderCount: d,
62
62
  apiKey: !!r,
@@ -64,8 +64,8 @@ const De = ze({
64
64
  dependencies: {
65
65
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
66
66
  serviceConfigRef: n,
67
- serviceConfigStable: w.current.serviceConfig === n,
68
- apiKeyStable: w.current.apiKey === r
67
+ serviceConfigStable: N.current.serviceConfig === n,
68
+ apiKeyStable: N.current.apiKey === r
69
69
  }
70
70
  }), !r || !n) {
71
71
  a("โš ๏ธ SERVICE INIT SKIPPED", {
@@ -77,42 +77,42 @@ const De = ze({
77
77
  a("๐Ÿš€ CREATING NEW SERVICE", {
78
78
  renderCount: d,
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
- serviceConfigChanged: w.current.serviceConfig !== n
80
+ serviceConfigChanged: N.current.serviceConfig !== n
81
81
  });
82
- const N = new He({
82
+ const v = new Ve({
83
83
  ...n,
84
84
  apiKey: r,
85
85
  debug: c
86
86
  });
87
- return h(N), a("โœ… SERVICE SET", {
87
+ return h(v), a("โœ… SERVICE SET", {
88
88
  renderCount: d,
89
- serviceInstance: !!N
89
+ serviceInstance: !!v
90
90
  }), () => {
91
91
  a("๐Ÿงน SERVICE CLEANUP", {
92
92
  renderCount: d,
93
93
  reason: "Effect cleanup"
94
- }), N.disconnectUser().catch(console.error);
94
+ }), v.disconnectUser().catch(console.error);
95
95
  };
96
96
  }, [r, n, c, a]);
97
- const b = W(null);
98
- Z(() => {
99
- var N, O;
97
+ const _ = W(null);
98
+ q(() => {
99
+ var v, P;
100
100
  if (a("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!u,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: v.current,
104
+ isConnecting: b.current,
105
105
  isConnected: f,
106
106
  dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
107
107
  }), !u || !s) {
108
108
  a("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (v.current) {
111
+ if (b.current) {
112
112
  a("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((N = b.current) == null ? void 0 : N.serviceId) === u && ((O = b.current) == null ? void 0 : O.userId) === s.id) {
115
+ if (((v = _.current) == null ? void 0 : v.serviceId) === u && ((P = _.current) == null ? void 0 : P.userId) === s.id) {
116
116
  a(
117
117
  "โš ๏ธ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,40 +120,40 @@ const De = ze({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- a("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), v.current = !0, E(!0), C(null);
123
+ a("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), b.current = !0, S(!0), m(null);
124
124
  try {
125
125
  a("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const j = await u.connectUser(s);
127
- y(j), o(!0), b.current = { serviceId: u, userId: s.id }, a("โœ… USER CONNECTION SUCCESS", {
127
+ p(j), o(!0), _.current = { serviceId: u, userId: s.id }, a("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: j.userID
130
130
  });
131
131
  } catch (j) {
132
- const q = j instanceof Error ? j.message : "Connection failed";
133
- C(q), a("โŒ USER CONNECTION ERROR", {
132
+ const z = j instanceof Error ? j.message : "Connection failed";
133
+ m(z), a("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: q
135
+ error: z
136
136
  });
137
137
  } finally {
138
- E(!1), v.current = !1, a("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ S(!1), b.current = !1, a("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
140
  isConnected: f
141
141
  });
142
142
  }
143
143
  })();
144
- }, [u, s, a, f]), Z(() => (a("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [u, s, a, f]), q(() => (a("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!u,
146
146
  isConnected: f
147
147
  }), () => {
148
148
  u && f ? (a(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), b.current = null, u.disconnectUser().catch(console.error)) : a("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), _.current = null, u.disconnectUser().catch(console.error)) : a("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!u,
153
153
  isConnected: f
154
154
  });
155
155
  }), [u, f, a]);
156
- const k = T(async () => {
156
+ const E = D(async () => {
157
157
  if (a("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!u,
159
159
  hasUser: !!s
@@ -161,53 +161,53 @@ const De = ze({
161
161
  a("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- a("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), E(!0);
164
+ a("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), S(!0);
165
165
  try {
166
166
  a("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await u.disconnectUser(), a("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
167
  const d = await u.connectUser(s);
168
- y(d), o(!0), C(null), a("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ p(d), o(!0), m(null), a("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
169
  } catch (d) {
170
- const N = d instanceof Error ? d.message : "Refresh failed";
171
- C(N), a("โŒ CONNECTION REFRESH ERROR", {
170
+ const v = d instanceof Error ? d.message : "Refresh failed";
171
+ m(v), a("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: N
173
+ error: v
174
174
  });
175
175
  } finally {
176
- E(!1), a("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ S(!1), a("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [u, s, a]), g = P.useMemo(() => (a("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [u, s, a]), C = L.useMemo(() => (a("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!u,
180
180
  hasClient: !!x,
181
181
  isConnected: f,
182
- isLoading: _,
183
- hasError: !!m,
182
+ isLoading: M,
183
+ hasError: !!g,
184
184
  capabilitiesKeys: Object.keys(l)
185
185
  }), {
186
186
  service: u,
187
187
  client: x,
188
188
  isConnected: f,
189
- isLoading: _,
190
- error: m,
189
+ isLoading: M,
190
+ error: g,
191
191
  capabilities: l,
192
- refreshConnection: k,
192
+ refreshConnection: E,
193
193
  debug: c
194
194
  }), [
195
195
  u,
196
196
  x,
197
197
  f,
198
- _,
199
- m,
198
+ M,
199
+ g,
200
200
  l,
201
- k,
201
+ E,
202
202
  c,
203
203
  a
204
204
  ]);
205
205
  return a("๐Ÿ”„ RENDER END", {
206
- renderCount: S.current,
206
+ renderCount: y.current,
207
207
  willRenderChat: !!(x && f),
208
- contextValueReady: !!g
209
- }), /* @__PURE__ */ e(De.Provider, { value: g, children: x && f ? /* @__PURE__ */ e(
210
- Ve,
208
+ contextValueReady: !!C
209
+ }), /* @__PURE__ */ e(Fe.Provider, { value: C, children: x && f ? /* @__PURE__ */ e(
210
+ We,
211
211
  {
212
212
  client: x,
213
213
  customClasses: {
@@ -216,18 +216,18 @@ const De = ze({
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, js = () => he(), $s = (t, s) => {
219
+ }, $s = () => ge(), zs = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
222
  ), l = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
225
  return Math.floor(l / (1e3 * 60 * 60 * 24));
226
- }, zs = (t) => {
226
+ }, Gs = (t) => {
227
227
  const s = /* @__PURE__ */ new Date();
228
228
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
229
229
  return "Just now";
230
- const r = $s(t, s);
230
+ const r = zs(t, s);
231
231
  return r === 0 ? t.toLocaleTimeString([], {
232
232
  hour: "numeric",
233
233
  minute: "2-digit",
@@ -237,7 +237,7 @@ const De = ze({
237
237
  day: "numeric",
238
238
  year: "2-digit"
239
239
  });
240
- }, Me = [
240
+ }, ke = [
241
241
  "๐ŸŽ",
242
242
  // Apple
243
243
  "๐ŸŒ",
@@ -265,7 +265,7 @@ const De = ze({
265
265
  "๐Ÿˆ"
266
266
  // Melon
267
267
  ];
268
- function Gs(t) {
268
+ function Hs(t) {
269
269
  let s = 0;
270
270
  for (let n = 0; n < t.length; n++) {
271
271
  const r = t.charCodeAt(n);
@@ -273,25 +273,25 @@ function Gs(t) {
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function Hs(t) {
277
- const n = Gs(t) % Me.length;
278
- return Me[n];
276
+ function Vs(t) {
277
+ const n = Hs(t) % ke.length;
278
+ return ke[n];
279
279
  }
280
- const te = ({
280
+ const ne = ({
281
281
  id: t,
282
282
  image: s,
283
283
  size: n = 40,
284
284
  className: r,
285
285
  shape: l = "squircle"
286
286
  }) => {
287
- const c = Hs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = l === "circle" ? { borderRadius: "50%" } : {
287
+ const c = Vs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = l === "circle" ? { borderRadius: "50%" } : {
288
288
  borderRadius: "33%",
289
289
  "corner-shape": "superellipse(1.3)"
290
290
  };
291
291
  return /* @__PURE__ */ e(
292
292
  "div",
293
293
  {
294
- className: M("flex-shrink-0 overflow-hidden", r),
294
+ className: R("flex-shrink-0 overflow-hidden", r),
295
295
  style: {
296
296
  width: `${n}px`,
297
297
  height: `${n}px`,
@@ -308,7 +308,7 @@ const te = ({
308
308
  "div",
309
309
  {
310
310
  "aria-hidden": "true",
311
- className: M(
311
+ className: R(
312
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
313
313
  u
314
314
  ),
@@ -317,30 +317,30 @@ const te = ({
317
317
  )
318
318
  }
319
319
  );
320
- }, Vs = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
320
+ }, Ws = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
321
321
  "path",
322
322
  {
323
323
  d: "M10.003 5a.705.705 0 0 1-.469.67L6.7 6.7 5.67 9.535a.715.715 0 0 1-1.34 0L3.3 6.7.466 5.67a.715.715 0 0 1 0-1.34L3.3 3.3 4.33.466a.715.715 0 0 1 1.34 0L6.7 3.3l2.834 1.03a.705.705 0 0 1 .469.67",
324
324
  fill: "currentColor"
325
325
  }
326
- ) }), Ws = (t) => {
326
+ ) }), qs = (t) => {
327
327
  var s;
328
328
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
329
329
  }, Zs = (t) => {
330
330
  var s;
331
331
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
332
- }, Fe = (t) => {
332
+ }, Le = (t) => {
333
333
  var s;
334
334
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
335
- }, Le = (t) => Ws(t) || Zs(t), qs = (t) => {
335
+ }, Pe = (t) => qs(t) || Zs(t), Ys = (t) => {
336
336
  var s;
337
- return Le(t) && !((s = t.text) != null && s.trim());
338
- }, ke = ({
337
+ return Pe(t) && !((s = t.text) != null && s.trim());
338
+ }, Re = ({
339
339
  message: t,
340
340
  standalone: s = !1
341
341
  }) => {
342
342
  var l;
343
- const n = Le(t), r = Fe(t);
343
+ const n = Pe(t), r = Le(t);
344
344
  if (!n && !r)
345
345
  return null;
346
346
  if (n) {
@@ -348,42 +348,42 @@ const te = ({
348
348
  if (!c) return null;
349
349
  const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
350
350
  return /* @__PURE__ */ i("div", { className: a, children: [
351
- /* @__PURE__ */ e(Ps, { size: s ? 14 : 12 }),
351
+ /* @__PURE__ */ e(Os, { size: s ? 14 : 12 }),
352
352
  /* @__PURE__ */ e("span", { children: u })
353
353
  ] });
354
354
  }
355
355
  return /* @__PURE__ */ i("div", { className: "message-tag message-tag--chatbot", children: [
356
- /* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Vs, {}) }),
356
+ /* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Ws, {}) }),
357
357
  /* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
358
358
  ] });
359
- }, Pe = P.memo(
359
+ }, Oe = L.memo(
360
360
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: l }) => {
361
- var v, w, S, b, k, g;
361
+ var b, N, y, _, E, C;
362
362
  const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
363
363
  t && n(t);
364
- }, h = Object.values(((v = t == null ? void 0 : t.state) == null ? void 0 : v.members) || {}).find(
364
+ }, h = Object.values(((b = t == null ? void 0 : t.state) == null ? void 0 : b.members) || {}).find(
365
365
  (d) => {
366
- var N, O;
367
- return ((N = d.user) == null ? void 0 : N.id) && d.user.id !== ((O = t == null ? void 0 : t._client) == null ? void 0 : O.userID);
366
+ var v, P;
367
+ return ((v = d.user) == null ? void 0 : v.id) && d.user.id !== ((P = t == null ? void 0 : t._client) == null ? void 0 : P.userID);
368
368
  }
369
- ), x = ((w = h == null ? void 0 : h.user) == null ? void 0 : w.name) || "Conversation", y = (S = h == null ? void 0 : h.user) == null ? void 0 : S.image, f = (k = (b = t == null ? void 0 : t.state) == null ? void 0 : b.messages) == null ? void 0 : k[t.state.messages.length - 1], _ = (() => {
370
- var N;
369
+ ), x = ((N = h == null ? void 0 : h.user) == null ? void 0 : N.name) || "Conversation", p = (y = h == null ? void 0 : h.user) == null ? void 0 : y.image, f = (E = (_ = t == null ? void 0 : t.state) == null ? void 0 : _.messages) == null ? void 0 : E[t.state.messages.length - 1], M = (() => {
370
+ var v;
371
371
  if (f != null && f.text) return f.text;
372
- const d = (N = f == null ? void 0 : f.attachments) == null ? void 0 : N[0];
372
+ const d = (v = f == null ? void 0 : f.attachments) == null ? void 0 : v[0];
373
373
  return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "๐Ÿ“ท Sent an image" : d.type === "video" ? "๐ŸŽฅ Sent a video" : d.type === "audio" ? "๐ŸŽต Sent audio" : d.type === "file" ? "๐Ÿ“Ž Sent a file" : "๐Ÿ“Ž Sent an attachment" : "No messages yet";
374
- })(), E = f != null && f.created_at ? zs(new Date(f.created_at)) : "", m = f ? Fe(f) : !1, C = l ?? 0;
374
+ })(), S = f != null && f.created_at ? Gs(new Date(f.created_at)) : "", g = f ? Le(f) : !1, m = l ?? 0;
375
375
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
376
376
  channelId: t == null ? void 0 : t.id,
377
377
  isSelected: c,
378
378
  participantName: x,
379
- unreadCount: C,
380
- hasTimestamp: !!E
379
+ unreadCount: m,
380
+ hasTimestamp: !!S
381
381
  }), /* @__PURE__ */ e(
382
382
  "button",
383
383
  {
384
384
  type: "button",
385
385
  onClick: a,
386
- className: M(
386
+ className: R(
387
387
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
388
388
  {
389
389
  "bg-primary-alt/10 border-l-4 border-l-primary": c,
@@ -392,11 +392,11 @@ const te = ({
392
392
  ),
393
393
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
394
394
  /* @__PURE__ */ e(
395
- te,
395
+ ne,
396
396
  {
397
- id: ((g = h == null ? void 0 : h.user) == null ? void 0 : g.id) || t.id || "unknown",
397
+ id: ((C = h == null ? void 0 : h.user) == null ? void 0 : C.id) || t.id || "unknown",
398
398
  name: x,
399
- image: y,
399
+ image: p,
400
400
  size: 44,
401
401
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
402
402
  }
@@ -406,21 +406,21 @@ const te = ({
406
406
  /* @__PURE__ */ e(
407
407
  "h3",
408
408
  {
409
- className: M(
409
+ className: R(
410
410
  "text-sm font-medium truncate",
411
411
  c ? "text-primary" : "text-charcoal"
412
412
  ),
413
413
  children: x
414
414
  }
415
415
  ),
416
- E && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: E })
416
+ S && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: S })
417
417
  ] }),
418
418
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
419
419
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: [
420
- m && "โœจ ",
421
- _
420
+ g && "โœจ ",
421
+ M
422
422
  ] }),
423
- C > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: C > 99 ? "99+" : C })
423
+ m > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: m > 99 ? "99+" : m })
424
424
  ] })
425
425
  ] })
426
426
  ] })
@@ -428,8 +428,8 @@ const te = ({
428
428
  );
429
429
  }
430
430
  );
431
- Pe.displayName = "CustomChannelPreview";
432
- const Oe = P.memo(
431
+ Oe.displayName = "CustomChannelPreview";
432
+ const Ue = L.memo(
433
433
  ({
434
434
  onChannelSelect: t,
435
435
  selectedChannel: s,
@@ -437,16 +437,16 @@ const Oe = P.memo(
437
437
  className: r,
438
438
  customEmptyStateIndicator: l
439
439
  }) => {
440
- const c = P.useRef(0);
440
+ const c = L.useRef(0);
441
441
  c.current++;
442
- const { debug: a = !1 } = he();
442
+ const { debug: a = !1 } = ge();
443
443
  a && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
444
444
  renderCount: c.current,
445
445
  selectedChannelId: s == null ? void 0 : s.id,
446
446
  filters: n
447
447
  });
448
- const u = P.useMemo(() => (x) => /* @__PURE__ */ e(
449
- Pe,
448
+ const u = L.useMemo(() => (x) => /* @__PURE__ */ e(
449
+ Oe,
450
450
  {
451
451
  ...x,
452
452
  selectedChannel: s,
@@ -457,12 +457,12 @@ const Oe = P.memo(
457
457
  return /* @__PURE__ */ e(
458
458
  "div",
459
459
  {
460
- className: M(
460
+ className: R(
461
461
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
462
462
  r
463
463
  ),
464
464
  children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
465
- We,
465
+ qe,
466
466
  {
467
467
  filters: n,
468
468
  sort: { last_message_at: -1 },
@@ -476,8 +476,8 @@ const Oe = P.memo(
476
476
  );
477
477
  }
478
478
  );
479
- Oe.displayName = "ChannelList";
480
- const ce = ({
479
+ Ue.displayName = "ChannelList";
480
+ const me = ({
481
481
  variant: t = "default",
482
482
  className: s,
483
483
  children: n,
@@ -486,7 +486,7 @@ const ce = ({
486
486
  "button",
487
487
  {
488
488
  type: "button",
489
- className: M(
489
+ className: R(
490
490
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
491
491
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
492
492
  s
@@ -495,12 +495,12 @@ const ce = ({
495
495
  children: n
496
496
  }
497
497
  );
498
- function Ue({ label: t, className: s, children: n, ...r }) {
498
+ function Be({ label: t, className: s, children: n, ...r }) {
499
499
  return /* @__PURE__ */ i(
500
500
  "button",
501
501
  {
502
502
  type: "button",
503
- className: M(
503
+ className: R(
504
504
  "rounded-full p-2 transition-colors focus-ring",
505
505
  {
506
506
  "cursor-not-allowed opacity-50": r.disabled,
@@ -516,11 +516,11 @@ function Ue({ label: t, className: s, children: n, ...r }) {
516
516
  }
517
517
  );
518
518
  }
519
- function Be({ onClick: t }) {
520
- return /* @__PURE__ */ e(Ue, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone", weight: "bold" }) });
519
+ function Ae({ onClick: t }) {
520
+ return /* @__PURE__ */ e(Be, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ve, { className: "h-5 w-5 text-stone", weight: "bold" }) });
521
521
  }
522
- const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t) => {
523
- var X, p;
522
+ const Js = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Qs = (t) => {
523
+ var de, J;
524
524
  const {
525
525
  additionalMessageInputProps: s,
526
526
  editing: n,
@@ -531,160 +531,160 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
531
531
  handleOpenThread: u,
532
532
  handleRetry: h,
533
533
  highlighted: x,
534
- isMessageAIGenerated: y,
534
+ isMessageAIGenerated: p,
535
535
  isMyMessage: f,
536
536
  message: o,
537
- onUserClick: _,
538
- onUserHover: E,
539
- renderText: m,
540
- threadList: C
541
- } = t, { client: v } = Ye("CustomMessage"), { t: w } = Je("CustomMessage"), [S, b] = I(!1), [k, g] = I(!1), d = Qe(o.id), {
542
- Attachment: N = Ke,
543
- Avatar: O = es,
544
- EditMessageModal: j = ss,
545
- MessageBlocked: q = ts,
546
- MessageBouncePrompt: Y = ns,
547
- MessageDeleted: ne = rs,
548
- MessageIsThreadReplyInChannelButtonIndicator: K = as,
549
- MessageRepliesCountButton: ee = ls,
550
- MessageStatus: re = os,
551
- MessageTimestamp: U = Re,
552
- ReminderNotification: H = is,
553
- StreamedMessageText: J = cs,
554
- PinIndicator: G
555
- } = Xe("CustomMessage"), R = ds(o), D = ms(o), B = we(
556
- () => y == null ? void 0 : y(o),
557
- [y, o]
558
- ), $ = we(
537
+ onUserClick: M,
538
+ onUserHover: S,
539
+ renderText: g,
540
+ threadList: m
541
+ } = t, { client: b } = Je("CustomMessage"), { t: N } = Qe("CustomMessage"), [y, _] = I(!1), [E, C] = I(!1), d = Xe(o.id), {
542
+ Attachment: v = es,
543
+ Avatar: P = ss,
544
+ EditMessageModal: j = ts,
545
+ MessageBlocked: z = ns,
546
+ MessageBouncePrompt: re = rs,
547
+ MessageDeleted: Q = as,
548
+ MessageIsThreadReplyInChannelButtonIndicator: X = ls,
549
+ MessageRepliesCountButton: K = os,
550
+ MessageStatus: ee = is,
551
+ MessageTimestamp: ae = Te,
552
+ ReminderNotification: O = cs,
553
+ StreamedMessageText: G = ds,
554
+ PinIndicator: Z
555
+ } = Ke("CustomMessage"), k = ms(o), T = us(o), U = pe(
556
+ () => p == null ? void 0 : p(o),
557
+ [p, o]
558
+ ), B = pe(
559
559
  () => !o.shared_location && !o.attachments ? [] : o.shared_location ? [o.shared_location, ...o.attachments ?? []] : o.attachments,
560
560
  [o]
561
561
  );
562
- if (us(o))
562
+ if (hs(o))
563
563
  return null;
564
564
  if (o.deleted_at || o.type === "deleted")
565
- return /* @__PURE__ */ e(ne, { message: o });
566
- if (hs(o))
567
- return /* @__PURE__ */ e(q, {});
568
- const se = !c || r, Q = !C && !!o.reply_count, V = !C && o.show_in_channel && o.parent_id, le = o.status === "failed" && ((X = o.error) == null ? void 0 : X.status) !== 403, oe = fs(o), ae = gs(o) && !B;
569
- let z;
570
- le ? z = () => h(o) : oe ? z = () => b(!0) : ae && (z = () => g((L) => !L));
571
- const fe = M(
565
+ return /* @__PURE__ */ e(Q, { message: o });
566
+ if (fs(o))
567
+ return /* @__PURE__ */ e(z, {});
568
+ const se = !c || r, oe = !m && !!o.reply_count, Y = !m && o.show_in_channel && o.parent_id, H = o.status === "failed" && ((de = o.error) == null ? void 0 : de.status) !== 403, ie = gs(o), le = xs(o) && !U;
569
+ let V;
570
+ H ? V = () => h(o) : ie ? V = () => _(!0) : le && (V = () => C((w) => !w));
571
+ const te = R(
572
572
  "str-chat__message str-chat__message-simple",
573
573
  `str-chat__message--${o.type}`,
574
574
  `str-chat__message--${o.status}`,
575
575
  f() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
576
576
  o.text ? "str-chat__message--has-text" : "has-no-text",
577
577
  {
578
- "str-chat__message--has-attachment": R,
578
+ "str-chat__message--has-attachment": k,
579
579
  "str-chat__message--highlighted": x,
580
580
  "str-chat__message--pinned pinned-message": o.pinned,
581
- "str-chat__message--with-reactions": D,
582
- "str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((p = o == null ? void 0 : o.error) == null ? void 0 : p.status) !== 403,
583
- "str-chat__message-with-thread-link": Q || V,
581
+ "str-chat__message--with-reactions": T,
582
+ "str-chat__message-send-can-be-retried": (o == null ? void 0 : o.status) === "failed" && ((J = o == null ? void 0 : o.error) == null ? void 0 : J.status) !== 403,
583
+ "str-chat__message-with-thread-link": oe || Y,
584
584
  "str-chat__virtual-message__wrapper--end": r,
585
585
  "str-chat__virtual-message__wrapper--first": l,
586
586
  "str-chat__virtual-message__wrapper--group": c
587
587
  }
588
- ), ie = o.poll_id && v.polls.fromState(o.poll_id), ge = qs(o);
589
- return /* @__PURE__ */ i(be, { children: [
588
+ ), ce = o.poll_id && b.polls.fromState(o.poll_id), xe = Ys(o);
589
+ return /* @__PURE__ */ i(Ne, { children: [
590
590
  n && /* @__PURE__ */ e(
591
591
  j,
592
592
  {
593
593
  additionalMessageInputProps: s
594
594
  }
595
595
  ),
596
- S && /* @__PURE__ */ e(
597
- xs,
596
+ y && /* @__PURE__ */ e(
597
+ Cs,
598
598
  {
599
- MessageBouncePrompt: Y,
600
- onClose: () => b(!1),
601
- open: S
599
+ MessageBouncePrompt: re,
600
+ onClose: () => _(!1),
601
+ open: y
602
602
  }
603
603
  ),
604
- /* @__PURE__ */ i("div", { className: fe, children: [
605
- G && /* @__PURE__ */ e(G, {}),
606
- !!d && /* @__PURE__ */ e(H, { reminder: d }),
604
+ /* @__PURE__ */ i("div", { className: te, children: [
605
+ Z && /* @__PURE__ */ e(Z, {}),
606
+ !!d && /* @__PURE__ */ e(O, { reminder: d }),
607
607
  o.user && /* @__PURE__ */ e(
608
- O,
608
+ P,
609
609
  {
610
610
  image: o.user.image,
611
611
  name: o.user.name || o.user.id,
612
- onClick: _,
613
- onMouseOver: E,
612
+ onClick: M,
613
+ onMouseOver: S,
614
614
  user: o.user
615
615
  }
616
616
  ),
617
617
  /* @__PURE__ */ e(
618
618
  "div",
619
619
  {
620
- className: M("str-chat__message-inner", {
621
- "str-chat__simple-message--error-failed": le || oe
620
+ className: R("str-chat__message-inner", {
621
+ "str-chat__simple-message--error-failed": H || ie
622
622
  }),
623
623
  "data-testid": "message-inner",
624
- onClick: z,
625
- onKeyDown: z,
626
- role: z ? "button" : void 0,
627
- tabIndex: z ? 0 : void 0,
624
+ onClick: V,
625
+ onKeyDown: V,
626
+ role: V ? "button" : void 0,
627
+ tabIndex: V ? 0 : void 0,
628
628
  style: {
629
629
  // Force margins to 0 to prevent hover layout shift
630
630
  // Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
631
631
  marginInlineEnd: 0,
632
632
  marginInlineStart: 0
633
633
  },
634
- children: ge ? (
634
+ children: xe ? (
635
635
  /* Tip-only messages render as a standalone bubble */
636
- /* @__PURE__ */ e(ke, { message: o, standalone: !0 })
636
+ /* @__PURE__ */ e(Re, { message: o, standalone: !0 })
637
637
  ) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
638
638
  /* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
639
- ie && /* @__PURE__ */ e(Cs, { poll: ie }),
640
- $ != null && $.length && !o.quoted_message ? /* @__PURE__ */ e(
641
- N,
639
+ ce && /* @__PURE__ */ e(bs, { poll: ce }),
640
+ B != null && B.length && !o.quoted_message ? /* @__PURE__ */ e(
641
+ v,
642
642
  {
643
643
  actionHandler: a,
644
- attachments: $
644
+ attachments: B
645
645
  }
646
646
  ) : null,
647
- B ? /* @__PURE__ */ e(
648
- J,
647
+ U ? /* @__PURE__ */ e(
648
+ G,
649
649
  {
650
650
  message: o,
651
- renderText: m
651
+ renderText: g
652
652
  }
653
- ) : /* @__PURE__ */ e(bs, { message: o, renderText: m }),
654
- /* @__PURE__ */ e(Ns, {})
653
+ ) : /* @__PURE__ */ e(Ns, { message: o, renderText: g }),
654
+ /* @__PURE__ */ e(vs, {})
655
655
  ] }),
656
- /* @__PURE__ */ e(ke, { message: o })
656
+ /* @__PURE__ */ e(Re, { message: o })
657
657
  ] })
658
658
  }
659
659
  ),
660
- Q && /* @__PURE__ */ e(
661
- ee,
660
+ oe && /* @__PURE__ */ e(
661
+ K,
662
662
  {
663
663
  onClick: u,
664
664
  reply_count: o.reply_count
665
665
  }
666
666
  ),
667
- V && /* @__PURE__ */ e(K, {}),
667
+ Y && /* @__PURE__ */ e(X, {}),
668
668
  se && /* @__PURE__ */ i("div", { className: "str-chat__message-metadata", children: [
669
- /* @__PURE__ */ e(re, {}),
669
+ /* @__PURE__ */ e(ee, {}),
670
670
  !f() && !!o.user && /* @__PURE__ */ e("span", { className: "str-chat__message-simple-name", children: o.user.name || o.user.id }),
671
- /* @__PURE__ */ e(U, { customClass: "str-chat__message-simple-timestamp" }),
672
- ae && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: w("Edited") }),
673
- ae && /* @__PURE__ */ e(vs, { calendar: !0, open: k })
671
+ /* @__PURE__ */ e(ae, { customClass: "str-chat__message-simple-timestamp" }),
672
+ le && /* @__PURE__ */ e("span", { className: "str-chat__mesage-simple-edited", children: N("Edited") }),
673
+ le && /* @__PURE__ */ e(ws, { calendar: !0, open: E })
674
674
  ] })
675
675
  ] }, o.id)
676
676
  ] });
677
- }, Qs = P.memo(
678
- Js,
679
- qe
680
- ), Xs = (t) => {
681
- const s = ws("CustomMessage");
682
- return /* @__PURE__ */ e(Qs, { ...s, ...t });
683
- }, Ks = (t) => ({
677
+ }, Xs = L.memo(
678
+ Qs,
679
+ Ye
680
+ ), Ks = (t) => {
681
+ const s = ps("CustomMessage");
682
+ return /* @__PURE__ */ e(Xs, { ...s, ...t });
683
+ }, et = (t) => ({
684
684
  linkPreviews: Array.from(t.previews.values()).filter(
685
- (s) => _e.previewIsLoaded(s) || _e.previewIsLoading(s)
685
+ (s) => Me.previewIsLoaded(s) || Me.previewIsLoading(s)
686
686
  )
687
- }), et = ({
687
+ }), st = ({
688
688
  link: t,
689
689
  onDismiss: s
690
690
  }) => {
@@ -714,7 +714,7 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
714
714
  },
715
715
  className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
716
716
  "aria-label": "Close link preview",
717
- children: /* @__PURE__ */ e(Ne, { className: "size-4 text-black/90" })
717
+ children: /* @__PURE__ */ e(ve, { className: "size-4 text-black/90" })
718
718
  }
719
719
  ),
720
720
  /* @__PURE__ */ i("div", { className: "p-2", children: [
@@ -724,32 +724,32 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
724
724
  ]
725
725
  }
726
726
  );
727
- }, st = () => {
728
- const { linkPreviewsManager: t } = ps(), { linkPreviews: s } = ys(
727
+ }, tt = () => {
728
+ const { linkPreviewsManager: t } = ys(), { linkPreviews: s } = Es(
729
729
  t.state,
730
- Ks
730
+ et
731
731
  ), n = (l) => {
732
732
  t.dismissPreview(l);
733
733
  };
734
734
  return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((l) => /* @__PURE__ */ e(
735
- et,
735
+ st,
736
736
  {
737
737
  link: l,
738
738
  onDismiss: n
739
739
  },
740
740
  l.og_scrape_url
741
741
  )) }) : null;
742
- }, tt = () => {
743
- const { handleSubmit: t } = Is(), s = Ss();
744
- return /* @__PURE__ */ i(be, { children: [
745
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(_s, {}) }),
742
+ }, nt = () => {
743
+ const { handleSubmit: t } = Ss(), s = _s();
744
+ return /* @__PURE__ */ i(Ne, { children: [
745
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ms, {}) }),
746
746
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
747
- /* @__PURE__ */ e(Ms, {}),
748
- /* @__PURE__ */ e(st, {}),
749
747
  /* @__PURE__ */ e(ks, {}),
748
+ /* @__PURE__ */ e(tt, {}),
749
+ /* @__PURE__ */ e(Rs, {}),
750
750
  /* @__PURE__ */ i("div", { className: "flex", children: [
751
751
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
752
- Rs,
752
+ Ts,
753
753
  {
754
754
  className: "w-full resize-none outline-none leading-6",
755
755
  autoFocus: !0,
@@ -765,18 +765,18 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
765
765
  disabled: !s,
766
766
  onClick: t,
767
767
  type: "button",
768
- children: /* @__PURE__ */ e(Os, { className: "size-4" })
768
+ children: /* @__PURE__ */ e(Us, { className: "size-4" })
769
769
  }
770
770
  )
771
771
  ] })
772
772
  ] })
773
773
  ] });
774
- }, nt = ({
774
+ }, rt = ({
775
775
  renderActions: t
776
776
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
777
777
  t && (t == null ? void 0 : t()),
778
- /* @__PURE__ */ e(Es, { Input: tt })
779
- ] }), rt = (t) => {
778
+ /* @__PURE__ */ e(Is, { Input: nt })
779
+ ] }), at = (t) => {
780
780
  const s = t.message.hide_date === !0;
781
781
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
782
782
  /* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
@@ -784,12 +784,12 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
784
784
  /* @__PURE__ */ e("p", { children: t.message.text }),
785
785
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
786
786
  ] }),
787
- !s && /* @__PURE__ */ e(Re, { message: t.message })
787
+ !s && /* @__PURE__ */ e(Te, { message: t.message })
788
788
  ] });
789
- }, at = () => null, lt = ({ className: t, message: s }) => /* @__PURE__ */ i(
789
+ }, lt = () => null, ot = ({ className: t, message: s }) => /* @__PURE__ */ i(
790
790
  "div",
791
791
  {
792
- className: M("flex items-center justify-center h-full", t),
792
+ className: R("flex items-center justify-center h-full", t),
793
793
  children: [
794
794
  /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
795
795
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -829,33 +829,40 @@ const Ys = (t) => /* @__PURE__ */ e(Ze, { ...t, position: "center" }), Js = (t)
829
829
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
830
830
  ]
831
831
  }
832
- ), ue = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
833
- /* @__PURE__ */ e(lt, { className: "w-6 h-6" }),
832
+ ), fe = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
833
+ /* @__PURE__ */ e(ot, { className: "w-6 h-6" }),
834
834
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
835
835
  ] }) }));
836
- ue.displayName = "LoadingState";
837
- const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
838
- var f, o, _, E, m, C;
839
- const { channel: l } = Te(), c = P.useMemo(() => Object.values(l.state.members || {}).find(
840
- (w) => {
841
- var S;
842
- return ((S = w.user) == null ? void 0 : S.id) && w.user.id !== l._client.userID;
836
+ fe.displayName = "LoadingState";
837
+ const it = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
838
+ var f, o, M, S, g, m;
839
+ const { channel: l } = De(), c = L.useMemo(() => Object.values(l.state.members || {}).find(
840
+ (N) => {
841
+ var y;
842
+ return ((y = N.user) == null ? void 0 : y.id) && N.user.id !== l._client.userID;
843
843
  }
844
- ), [l._client.userID, l.state.members]), a = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((o = c == null ? void 0 : c.user) == null ? void 0 : o.id) || "Unknown member", u = (_ = c == null ? void 0 : c.user) == null ? void 0 : _.image, [h, x] = I(!!((E = l.state.membership) != null && E.pinned_at));
845
- Z(() => {
846
- const v = (w) => {
847
- var S;
848
- x(w != null && w.member ? !!w.member.pinned_at : !!((S = l.state.membership) != null && S.pinned_at));
844
+ ), [l._client.userID, l.state.members]), a = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((o = c == null ? void 0 : c.user) == null ? void 0 : o.id) || "Unknown member", u = (M = c == null ? void 0 : c.user) == null ? void 0 : M.image, [h, x] = I(
845
+ !!((S = l.state.membership) != null && S.pinned_at)
846
+ );
847
+ q(() => {
848
+ const b = (N) => {
849
+ var y;
850
+ x(
851
+ N != null && N.member ? !!N.member.pinned_at : !!((y = l.state.membership) != null && y.pinned_at)
852
+ );
849
853
  };
850
- return l.on("member.updated", v), () => {
851
- l.off("member.updated", v);
854
+ return l.on("member.updated", b), () => {
855
+ l.off("member.updated", b);
852
856
  };
853
857
  }, [l]);
854
- const y = async () => {
858
+ const p = async () => {
855
859
  try {
856
860
  h ? await l.unpin() : await l.pin();
857
- } catch (v) {
858
- console.error("[CustomChannelHeader] Failed to update pinned status:", v);
861
+ } catch (b) {
862
+ console.error(
863
+ "[CustomChannelHeader] Failed to update pinned status:",
864
+ b
865
+ );
859
866
  }
860
867
  };
861
868
  return /* @__PURE__ */ i("div", { className: "@container", children: [
@@ -864,7 +871,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
864
871
  /* @__PURE__ */ e(
865
872
  "button",
866
873
  {
867
- className: M(
874
+ className: R(
868
875
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
869
876
  !s && "invisible"
870
877
  ),
@@ -872,16 +879,16 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
872
879
  }),
873
880
  type: "button",
874
881
  "aria-label": "Back to conversations",
875
- children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
882
+ children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
876
883
  }
877
884
  ),
878
885
  /* @__PURE__ */ e("div", { className: "size-10" })
879
886
  ] }),
880
887
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
881
888
  /* @__PURE__ */ e(
882
- te,
889
+ ne,
883
890
  {
884
- id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || l.id || "unknown",
891
+ id: ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || l.id || "unknown",
885
892
  name: a,
886
893
  image: u,
887
894
  size: 40
@@ -894,11 +901,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
894
901
  "button",
895
902
  {
896
903
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
897
- onClick: y,
904
+ onClick: p,
898
905
  type: "button",
899
906
  "aria-label": h ? "Unstar conversation" : "Star conversation",
900
907
  children: /* @__PURE__ */ e(
901
- ye,
908
+ Ee,
902
909
  {
903
910
  className: "size-5 text-black/90",
904
911
  weight: h ? "fill" : "regular"
@@ -913,7 +920,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
913
920
  onClick: n,
914
921
  type: "button",
915
922
  "aria-label": "Show info",
916
- children: /* @__PURE__ */ e(Ee, { className: "size-5 text-black/90" })
923
+ children: /* @__PURE__ */ e(Ie, { className: "size-5 text-black/90" })
917
924
  }
918
925
  )
919
926
  ] })
@@ -927,13 +934,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
927
934
  onClick: t,
928
935
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
929
936
  "aria-label": "Back to conversations",
930
- children: /* @__PURE__ */ e(pe, { className: "size-5 text-black/90" })
937
+ children: /* @__PURE__ */ e(ye, { className: "size-5 text-black/90" })
931
938
  }
932
939
  ),
933
940
  /* @__PURE__ */ e(
934
- te,
941
+ ne,
935
942
  {
936
- id: ((C = c == null ? void 0 : c.user) == null ? void 0 : C.id) || l.id || "unknown",
943
+ id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || l.id || "unknown",
937
944
  name: a,
938
945
  image: u,
939
946
  size: 40
@@ -946,11 +953,11 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
946
953
  "button",
947
954
  {
948
955
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
949
- onClick: y,
956
+ onClick: p,
950
957
  type: "button",
951
958
  "aria-label": h ? "Unstar conversation" : "Star conversation",
952
959
  children: /* @__PURE__ */ e(
953
- ye,
960
+ Ee,
954
961
  {
955
962
  className: "size-5 text-black/90",
956
963
  weight: h ? "fill" : "regular"
@@ -965,13 +972,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
965
972
  onClick: n,
966
973
  type: "button",
967
974
  "aria-label": "Show info",
968
- children: /* @__PURE__ */ e(Ee, { className: "size-5 text-black/90" })
975
+ children: /* @__PURE__ */ e(Ie, { className: "size-5 text-black/90" })
969
976
  }
970
977
  )
971
978
  ] })
972
979
  ] })
973
980
  ] });
974
- }, it = ({
981
+ }, ct = ({
975
982
  dialogRef: t,
976
983
  onClose: s,
977
984
  participant: n,
@@ -982,76 +989,76 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
982
989
  showDeleteConversation: u = !0,
983
990
  onDeleteConversationClick: h,
984
991
  onBlockParticipantClick: x,
985
- onReportParticipantClick: y
992
+ onReportParticipantClick: p
986
993
  }) => {
987
- var K, ee, re, U, H, J, G;
988
- const { service: f, debug: o } = he(), [_, E] = I(!1), [m, C] = I(!1), [v, w] = I(!1), S = T(async () => {
989
- var R;
990
- if (!(!f || !((R = n == null ? void 0 : n.user) != null && R.id)))
994
+ var X, K, ee, ae, O, G, Z;
995
+ const { service: f, debug: o } = ge(), [M, S] = I(!1), [g, m] = I(!1), [b, N] = I(!1), y = D(async () => {
996
+ var k;
997
+ if (!(!f || !((k = n == null ? void 0 : n.user) != null && k.id)))
991
998
  try {
992
- const B = (await f.getBlockedUsers()).some(
993
- ($) => {
999
+ const U = (await f.getBlockedUsers()).some(
1000
+ (B) => {
994
1001
  var se;
995
- return $.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
1002
+ return B.blocked_user_id === ((se = n == null ? void 0 : n.user) == null ? void 0 : se.id);
996
1003
  }
997
1004
  );
998
- E(B);
999
- } catch (D) {
1005
+ S(U);
1006
+ } catch (T) {
1000
1007
  console.error(
1001
1008
  "[ChannelInfoDialog] Failed to check blocked status:",
1002
- D
1009
+ T
1003
1010
  );
1004
1011
  }
1005
- }, [f, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
1006
- Z(() => {
1007
- S();
1008
- }, [S]);
1009
- const b = async () => {
1010
- var R;
1011
- if (!m) {
1012
- h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
1012
+ }, [f, (X = n == null ? void 0 : n.user) == null ? void 0 : X.id]);
1013
+ q(() => {
1014
+ y();
1015
+ }, [y]);
1016
+ const _ = async () => {
1017
+ var k;
1018
+ if (!g) {
1019
+ h == null || h(), o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), m(!0);
1013
1020
  try {
1014
- const D = ((R = r._client) == null ? void 0 : R.userID) ?? null;
1015
- await r.hide(D, !1), c && await c(r), s();
1016
- } catch (D) {
1017
- console.error("[ChannelInfoDialog] Failed to leave conversation", D);
1021
+ const T = ((k = r._client) == null ? void 0 : k.userID) ?? null;
1022
+ await r.hide(T, !1), c && await c(r), s();
1023
+ } catch (T) {
1024
+ console.error("[ChannelInfoDialog] Failed to leave conversation", T);
1018
1025
  } finally {
1019
- C(!1);
1026
+ m(!1);
1020
1027
  }
1021
1028
  }
1022
- }, k = async () => {
1023
- var R, D, B;
1024
- if (!(v || !f)) {
1025
- x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
1029
+ }, E = async () => {
1030
+ var k, T, U;
1031
+ if (!(b || !f)) {
1032
+ x == null || x(), o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), N(!0);
1026
1033
  try {
1027
- await f.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
1028
- } catch ($) {
1029
- console.error("[ChannelInfoDialog] Failed to block member", $);
1034
+ await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1035
+ } catch (B) {
1036
+ console.error("[ChannelInfoDialog] Failed to block member", B);
1030
1037
  } finally {
1031
- w(!1);
1038
+ N(!1);
1032
1039
  }
1033
1040
  }
1034
- }, g = async () => {
1035
- var R, D, B;
1036
- if (!(v || !f)) {
1037
- x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
1041
+ }, C = async () => {
1042
+ var k, T, U;
1043
+ if (!(b || !f)) {
1044
+ x == null || x(), o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), N(!0);
1038
1045
  try {
1039
- await f.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), a && await a((B = n == null ? void 0 : n.user) == null ? void 0 : B.id), s();
1040
- } catch ($) {
1041
- console.error("[ChannelInfoDialog] Failed to unblock member", $);
1046
+ await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), a && await a((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1047
+ } catch (B) {
1048
+ console.error("[ChannelInfoDialog] Failed to unblock member", B);
1042
1049
  } finally {
1043
- w(!1);
1050
+ N(!1);
1044
1051
  }
1045
1052
  }
1046
1053
  }, d = () => {
1047
- y == null || y(), s(), window.open(
1054
+ p == null || p(), s(), window.open(
1048
1055
  "https://linktr.ee/s/about/trust-center/report",
1049
1056
  "_blank",
1050
1057
  "noopener,noreferrer"
1051
1058
  );
1052
1059
  };
1053
1060
  if (!n) return null;
1054
- const N = ((ee = n.user) == null ? void 0 : ee.name) || ((re = n.user) == null ? void 0 : re.id) || "Unknown member", O = (U = n.user) == null ? void 0 : U.image, j = (H = n.user) == null ? void 0 : H.email, q = (J = n.user) == null ? void 0 : J.username, Y = j || (q ? `linktr.ee/${q}` : void 0), ne = ((G = n.user) == null ? void 0 : G.id) || "unknown";
1061
+ const v = ((K = n.user) == null ? void 0 : K.name) || ((ee = n.user) == null ? void 0 : ee.id) || "Unknown member", P = (ae = n.user) == null ? void 0 : ae.image, j = (O = n.user) == null ? void 0 : O.email, z = (G = n.user) == null ? void 0 : G.username, re = j || (z ? `linktr.ee/${z}` : void 0), Q = ((Z = n.user) == null ? void 0 : Z.id) || "unknown";
1055
1062
  return (
1056
1063
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1057
1064
  /* @__PURE__ */ e(
@@ -1060,13 +1067,13 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1060
1067
  ref: t,
1061
1068
  className: "mes-dialog group",
1062
1069
  onClose: s,
1063
- onClick: (R) => {
1064
- R.target === t.current && s();
1070
+ onClick: (k) => {
1071
+ k.target === t.current && s();
1065
1072
  },
1066
1073
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
1067
1074
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
1068
1075
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
1069
- /* @__PURE__ */ e(Be, { onClick: s })
1076
+ /* @__PURE__ */ e(Ae, { onClick: s })
1070
1077
  ] }),
1071
1078
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
1072
1079
  /* @__PURE__ */ e(
@@ -1076,18 +1083,18 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1076
1083
  style: { backgroundColor: "#FBFAF9" },
1077
1084
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
1078
1085
  /* @__PURE__ */ e(
1079
- te,
1086
+ ne,
1080
1087
  {
1081
- id: ne,
1082
- name: N,
1083
- image: O,
1088
+ id: Q,
1089
+ name: v,
1090
+ image: P,
1084
1091
  size: 88,
1085
1092
  shape: "circle"
1086
1093
  }
1087
1094
  ),
1088
1095
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
1089
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: N }),
1090
- Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
1096
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: v }),
1097
+ re && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: re }),
1091
1098
  l && /* @__PURE__ */ e(
1092
1099
  "span",
1093
1100
  {
@@ -1108,42 +1115,42 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1108
1115
  ),
1109
1116
  /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
1110
1117
  u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1111
- ce,
1118
+ me,
1112
1119
  {
1113
- onClick: b,
1114
- disabled: m,
1115
- "aria-busy": m,
1120
+ onClick: _,
1121
+ disabled: g,
1122
+ "aria-busy": g,
1116
1123
  children: [
1117
- m ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
1124
+ g ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
1118
1125
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
1119
1126
  ]
1120
1127
  }
1121
1128
  ) }),
1122
- /* @__PURE__ */ e("li", { children: _ ? /* @__PURE__ */ i(
1123
- ce,
1129
+ /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
1130
+ me,
1124
1131
  {
1125
- onClick: g,
1126
- disabled: v,
1127
- "aria-busy": v,
1132
+ onClick: C,
1133
+ disabled: b,
1134
+ "aria-busy": b,
1128
1135
  children: [
1129
- v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
1136
+ b ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Se, { className: "h-5 w-5" }),
1130
1137
  /* @__PURE__ */ e("span", { children: "Unblock" })
1131
1138
  ]
1132
1139
  }
1133
1140
  ) : /* @__PURE__ */ i(
1134
- ce,
1141
+ me,
1135
1142
  {
1136
- onClick: k,
1137
- disabled: v,
1138
- "aria-busy": v,
1143
+ onClick: E,
1144
+ disabled: b,
1145
+ "aria-busy": b,
1139
1146
  children: [
1140
- v ? /* @__PURE__ */ e(de, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
1147
+ b ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Se, { className: "h-5 w-5" }),
1141
1148
  /* @__PURE__ */ e("span", { children: "Block" })
1142
1149
  ]
1143
1150
  }
1144
1151
  ) }),
1145
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ce, { variant: "danger", onClick: d, children: [
1146
- /* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
1152
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(me, { variant: "danger", onClick: d, children: [
1153
+ /* @__PURE__ */ e(As, { className: "h-5 w-5" }),
1147
1154
  /* @__PURE__ */ e("span", { children: "Report" })
1148
1155
  ] }) })
1149
1156
  ] })
@@ -1152,7 +1159,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1152
1159
  }
1153
1160
  )
1154
1161
  );
1155
- }, ct = ({
1162
+ }, dt = ({
1156
1163
  onBack: t,
1157
1164
  showBackButton: s,
1158
1165
  renderMessageInputActions: n,
@@ -1163,43 +1170,43 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1163
1170
  onBlockParticipantClick: u,
1164
1171
  onReportParticipantClick: h
1165
1172
  }) => {
1166
- const { channel: x } = Te(), y = W(null), f = P.useMemo(() => Object.values(x.state.members || {}).find(
1167
- (C) => {
1168
- var v;
1169
- return ((v = C.user) == null ? void 0 : v.id) && C.user.id !== x._client.userID;
1173
+ const { channel: x } = De(), p = W(null), f = L.useMemo(() => Object.values(x.state.members || {}).find(
1174
+ (m) => {
1175
+ var b;
1176
+ return ((b = m.user) == null ? void 0 : b.id) && m.user.id !== x._client.userID;
1170
1177
  }
1171
- ), [x._client.userID, x.state.members]), o = P.useMemo(() => {
1172
- const m = x.data ?? {};
1173
- if (m.followerStatus)
1174
- return String(m.followerStatus);
1175
- if (m.isFollower !== void 0)
1176
- return m.isFollower ? "Subscribed to you" : "Not subscribed";
1177
- }, [x.data]), _ = T(() => {
1178
- var m;
1179
- (m = y.current) == null || m.showModal();
1180
- }, []), E = T(() => {
1181
- var m;
1182
- (m = y.current) == null || m.close();
1178
+ ), [x._client.userID, x.state.members]), o = L.useMemo(() => {
1179
+ const g = x.data ?? {};
1180
+ if (g.followerStatus)
1181
+ return String(g.followerStatus);
1182
+ if (g.isFollower !== void 0)
1183
+ return g.isFollower ? "Subscribed to you" : "Not subscribed";
1184
+ }, [x.data]), M = D(() => {
1185
+ var g;
1186
+ (g = p.current) == null || g.showModal();
1187
+ }, []), S = D(() => {
1188
+ var g;
1189
+ (g = p.current) == null || g.close();
1183
1190
  }, []);
1184
- return /* @__PURE__ */ i(be, { children: [
1191
+ return /* @__PURE__ */ i(Ne, { children: [
1185
1192
  /* @__PURE__ */ e(
1186
- Ds,
1193
+ Fs,
1187
1194
  {
1188
1195
  overrides: {
1189
- Message: (m) => /* @__PURE__ */ e(Xs, { ...m })
1196
+ Message: (g) => /* @__PURE__ */ e(Ks, { ...g })
1190
1197
  },
1191
- children: /* @__PURE__ */ i(Fs, { children: [
1198
+ children: /* @__PURE__ */ i(Ls, { children: [
1192
1199
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
1193
- ot,
1200
+ it,
1194
1201
  {
1195
1202
  onBack: t,
1196
1203
  showBackButton: s,
1197
- onShowInfo: _,
1204
+ onShowInfo: M,
1198
1205
  canShowInfo: !!f
1199
1206
  }
1200
1207
  ) }),
1201
1208
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
1202
- Ls,
1209
+ Ps,
1203
1210
  {
1204
1211
  hideDeletedMessages: !0,
1205
1212
  hideNewMessageSeparator: !1,
@@ -1207,7 +1214,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1207
1214
  }
1208
1215
  ) }),
1209
1216
  /* @__PURE__ */ e(
1210
- nt,
1217
+ rt,
1211
1218
  {
1212
1219
  renderActions: () => n == null ? void 0 : n(x)
1213
1220
  }
@@ -1216,10 +1223,10 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1216
1223
  }
1217
1224
  ),
1218
1225
  /* @__PURE__ */ e(
1219
- it,
1226
+ ct,
1220
1227
  {
1221
- dialogRef: y,
1222
- onClose: E,
1228
+ dialogRef: p,
1229
+ onClose: S,
1223
1230
  participant: f,
1224
1231
  channel: x,
1225
1232
  followerStatusLabel: o,
@@ -1232,7 +1239,7 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1232
1239
  }
1233
1240
  )
1234
1241
  ] });
1235
- }, Ae = P.memo(
1242
+ }, je = L.memo(
1236
1243
  ({
1237
1244
  channel: t,
1238
1245
  onBack: s,
@@ -1241,48 +1248,60 @@ const ot = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1241
1248
  onLeaveConversation: l,
1242
1249
  onBlockParticipant: c,
1243
1250
  className: a,
1244
- CustomChannelEmptyState: u = at,
1251
+ CustomChannelEmptyState: u = lt,
1245
1252
  showDeleteConversation: h = !0,
1246
1253
  onDeleteConversationClick: x,
1247
- onBlockParticipantClick: y,
1248
- onReportParticipantClick: f
1249
- }) => /* @__PURE__ */ e(
1250
- "div",
1251
- {
1252
- className: M(
1253
- "messaging-channel-view h-full flex flex-col",
1254
- a
1255
- ),
1256
- children: /* @__PURE__ */ e(
1257
- Ts,
1258
- {
1259
- channel: t,
1260
- MessageSystem: rt,
1261
- EmptyStateIndicator: u,
1262
- LoadingIndicator: ue,
1263
- DateSeparator: Ys,
1264
- children: /* @__PURE__ */ e(
1265
- ct,
1266
- {
1267
- onBack: s,
1268
- showBackButton: n,
1269
- renderMessageInputActions: r,
1270
- onLeaveConversation: l,
1271
- onBlockParticipant: c,
1272
- CustomChannelEmptyState: u,
1273
- showDeleteConversation: h,
1274
- onDeleteConversationClick: x,
1275
- onBlockParticipantClick: y,
1276
- onReportParticipantClick: f
1277
- }
1278
- )
1279
- }
1280
- )
1281
- }
1282
- )
1254
+ onBlockParticipantClick: p,
1255
+ onReportParticipantClick: f,
1256
+ dmAgentEnabled: o
1257
+ }) => {
1258
+ var m;
1259
+ const M = ((m = t.data) == null ? void 0 : m.chatbot_paused) === !0, S = o && !M, g = D(
1260
+ async (b, N, y) => S ? t.sendMessage(
1261
+ { ...N, silent: !0 },
1262
+ { ...y, skip_push: !0 }
1263
+ ) : t.sendMessage(N, y),
1264
+ [t, S]
1265
+ );
1266
+ return /* @__PURE__ */ e(
1267
+ "div",
1268
+ {
1269
+ className: R(
1270
+ "messaging-channel-view h-full flex flex-col",
1271
+ a
1272
+ ),
1273
+ children: /* @__PURE__ */ e(
1274
+ Ds,
1275
+ {
1276
+ channel: t,
1277
+ MessageSystem: at,
1278
+ EmptyStateIndicator: u,
1279
+ LoadingIndicator: fe,
1280
+ DateSeparator: Js,
1281
+ doSendMessageRequest: g,
1282
+ children: /* @__PURE__ */ e(
1283
+ dt,
1284
+ {
1285
+ onBack: s,
1286
+ showBackButton: n,
1287
+ renderMessageInputActions: r,
1288
+ onLeaveConversation: l,
1289
+ onBlockParticipant: c,
1290
+ CustomChannelEmptyState: u,
1291
+ showDeleteConversation: h,
1292
+ onDeleteConversationClick: x,
1293
+ onBlockParticipantClick: p,
1294
+ onReportParticipantClick: f
1295
+ }
1296
+ )
1297
+ }
1298
+ )
1299
+ }
1300
+ );
1301
+ }
1283
1302
  );
1284
- Ae.displayName = "ChannelView";
1285
- function dt({
1303
+ je.displayName = "ChannelView";
1304
+ function mt({
1286
1305
  searchQuery: t,
1287
1306
  setSearchQuery: s,
1288
1307
  placeholder: n
@@ -1290,7 +1309,7 @@ function dt({
1290
1309
  const r = W(null);
1291
1310
  return /* @__PURE__ */ i("div", { className: "relative", children: [
1292
1311
  /* @__PURE__ */ e(
1293
- As,
1312
+ js,
1294
1313
  {
1295
1314
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
1296
1315
  weight: "bold"
@@ -1308,7 +1327,7 @@ function dt({
1308
1327
  }
1309
1328
  ),
1310
1329
  t && /* @__PURE__ */ e(
1311
- Ue,
1330
+ Be,
1312
1331
  {
1313
1332
  label: "Clear search",
1314
1333
  onClick: () => {
@@ -1316,12 +1335,12 @@ function dt({
1316
1335
  s(""), (l = r.current) == null || l.focus();
1317
1336
  },
1318
1337
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1319
- children: /* @__PURE__ */ e(Ne, { className: "h-4 w-4", weight: "bold" })
1338
+ children: /* @__PURE__ */ e(ve, { className: "h-4 w-4", weight: "bold" })
1320
1339
  }
1321
1340
  )
1322
1341
  ] });
1323
1342
  }
1324
- const mt = ({
1343
+ const ut = ({
1325
1344
  participantSource: t,
1326
1345
  onSelectParticipant: s,
1327
1346
  onClose: n,
@@ -1330,73 +1349,73 @@ const mt = ({
1330
1349
  searchPlaceholder: c = "Search participants...",
1331
1350
  className: a
1332
1351
  }) => {
1333
- const { debug: u } = he(), [h, x] = I(""), [y, f] = I([]), [o, _] = I(!1), [E, m] = I(null), [C, v] = I(
1352
+ const { debug: u } = ge(), [h, x] = I(""), [p, f] = I([]), [o, M] = I(!1), [S, g] = I(null), [m, b] = I(
1334
1353
  null
1335
- ), w = W(!1);
1336
- Z(() => {
1354
+ ), N = W(!1);
1355
+ q(() => {
1337
1356
  if (t.loading) {
1338
1357
  u && console.log(
1339
1358
  "[ParticipantPicker] Waiting for participant source to finish loading..."
1340
1359
  );
1341
1360
  return;
1342
1361
  }
1343
- if (w.current) return;
1362
+ if (N.current) return;
1344
1363
  (async () => {
1345
- u && console.log("[ParticipantPicker] Loading initial participants..."), _(!0), m(null);
1364
+ u && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), g(null);
1346
1365
  try {
1347
1366
  const d = await t.loadParticipants({
1348
1367
  search: "",
1349
1368
  // Load all participants initially
1350
1369
  limit: 100
1351
1370
  });
1352
- f(d.participants), w.current = !0, u && console.log(
1371
+ f(d.participants), N.current = !0, u && console.log(
1353
1372
  "[ParticipantPicker] Participants loaded successfully:",
1354
1373
  d.participants.length
1355
1374
  );
1356
1375
  } catch (d) {
1357
- const N = d instanceof Error ? d.message : "Failed to load participants";
1358
- m(N), console.error("[ParticipantPicker] Failed to load participants:", d);
1376
+ const v = d instanceof Error ? d.message : "Failed to load participants";
1377
+ g(v), console.error("[ParticipantPicker] Failed to load participants:", d);
1359
1378
  } finally {
1360
- _(!1);
1379
+ M(!1);
1361
1380
  }
1362
1381
  })();
1363
1382
  }, [t.loading, u]);
1364
- const S = y.filter((g) => !r.has(g.id)).filter((g) => {
1365
- var N;
1383
+ const y = p.filter((C) => !r.has(C.id)).filter((C) => {
1384
+ var v;
1366
1385
  if (!h) return !0;
1367
1386
  const d = h.toLowerCase();
1368
- return g.name.toLowerCase().includes(d) || ((N = g.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
1369
- }), b = T(
1370
- async (g) => {
1371
- if (!C) {
1372
- v(g.id);
1387
+ return C.name.toLowerCase().includes(d) || ((v = C.email) == null ? void 0 : v.toLowerCase().includes(d)) || !1;
1388
+ }), _ = D(
1389
+ async (C) => {
1390
+ if (!m) {
1391
+ b(C.id);
1373
1392
  try {
1374
- await s(g);
1393
+ await s(C);
1375
1394
  } catch (d) {
1376
- console.error("[ParticipantPicker] Failed to start chat:", d), v(null);
1395
+ console.error("[ParticipantPicker] Failed to start chat:", d), b(null);
1377
1396
  }
1378
1397
  }
1379
1398
  },
1380
- [s, C]
1381
- ), k = (g, d) => {
1382
- (g.key === "Enter" || g.key === " ") && (g.preventDefault(), b(d));
1399
+ [s, m]
1400
+ ), E = (C, d) => {
1401
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), _(d));
1383
1402
  };
1384
- return /* @__PURE__ */ i("div", { className: M("flex flex-col h-full", a), children: [
1403
+ return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", a), children: [
1385
1404
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1386
1405
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1387
1406
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1388
- /* @__PURE__ */ e(Be, { onClick: n })
1407
+ /* @__PURE__ */ e(Ae, { onClick: n })
1389
1408
  ] }),
1390
1409
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1391
1410
  "Select a ",
1392
1411
  l.slice(0, -1),
1393
1412
  " to start messaging (",
1394
- S.length,
1413
+ y.length,
1395
1414
  " available)",
1396
1415
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${l} total`
1397
1416
  ] }),
1398
1417
  /* @__PURE__ */ e(
1399
- dt,
1418
+ mt,
1400
1419
  {
1401
1420
  searchQuery: h,
1402
1421
  setSearchQuery: x,
@@ -1404,53 +1423,53 @@ const mt = ({
1404
1423
  }
1405
1424
  )
1406
1425
  ] }),
1407
- E && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1426
+ S && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1408
1427
  "Error loading ",
1409
1428
  l,
1410
1429
  ": ",
1411
- E
1430
+ S
1412
1431
  ] }),
1413
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: o && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1432
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: o && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1414
1433
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1415
1434
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1416
1435
  "Loading ",
1417
1436
  l,
1418
1437
  "..."
1419
1438
  ] })
1420
- ] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1421
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Se, { className: "h-8 w-8 text-charcoal" }) }),
1422
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${l} found` : y.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
1423
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : y.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
1439
+ ] }) }) : y.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1440
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(_e, { className: "h-8 w-8 text-charcoal" }) }),
1441
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${l} found` : p.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
1442
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : p.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
1424
1443
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1425
- S.map((g) => {
1426
- const d = g.name || g.email || g.id, N = g.email && g.name ? g.email : g.phone;
1444
+ y.map((C) => {
1445
+ const d = C.name || C.email || C.id, v = C.email && C.name ? C.email : C.phone;
1427
1446
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1428
1447
  "button",
1429
1448
  {
1430
1449
  type: "button",
1431
- onClick: () => b(g),
1432
- onKeyDown: (O) => k(O, g),
1450
+ onClick: () => _(C),
1451
+ onKeyDown: (P) => E(P, C),
1433
1452
  className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
1434
1453
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1435
1454
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1436
1455
  /* @__PURE__ */ e(
1437
- te,
1456
+ ne,
1438
1457
  {
1439
- id: g.id,
1458
+ id: C.id,
1440
1459
  name: d,
1441
- image: g.image,
1460
+ image: C.image,
1442
1461
  size: 40
1443
1462
  }
1444
1463
  ),
1445
1464
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1446
1465
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1447
- N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
1466
+ v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
1448
1467
  ] })
1449
1468
  ] }),
1450
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C === g.id ? /* @__PURE__ */ e(de, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Se, { className: "h-5 w-5 text-stone" }) })
1469
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: m === C.id ? /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(_e, { className: "h-5 w-5 text-stone" }) })
1451
1470
  ] })
1452
1471
  }
1453
- ) }, g.id);
1472
+ ) }, C.id);
1454
1473
  }),
1455
1474
  o && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1456
1475
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
@@ -1458,7 +1477,7 @@ const mt = ({
1458
1477
  ] }) })
1459
1478
  ] }) })
1460
1479
  ] });
1461
- }, ut = ({ className: t }) => /* @__PURE__ */ i(
1480
+ }, ht = ({ className: t }) => /* @__PURE__ */ i(
1462
1481
  "svg",
1463
1482
  {
1464
1483
  width: "140",
@@ -1592,17 +1611,17 @@ const mt = ({
1592
1611
  ] })
1593
1612
  ]
1594
1613
  }
1595
- ), je = P.memo(
1614
+ ), $e = L.memo(
1596
1615
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1597
- /* @__PURE__ */ e(ut, {}),
1616
+ /* @__PURE__ */ e(ht, {}),
1598
1617
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1599
1618
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1600
1619
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1601
1620
  ] })
1602
1621
  ] }) })
1603
1622
  );
1604
- je.displayName = "EmptyState";
1605
- const me = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1623
+ $e.displayName = "EmptyState";
1624
+ const he = L.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1606
1625
  /* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "โš ๏ธ" }) }),
1607
1626
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1608
1627
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1616,8 +1635,8 @@ const me = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1616
1635
  }
1617
1636
  )
1618
1637
  ] }) }));
1619
- me.displayName = "ErrorState";
1620
- const pt = ({
1638
+ he.displayName = "ErrorState";
1639
+ const yt = ({
1621
1640
  capabilities: t = {},
1622
1641
  className: s,
1623
1642
  renderMessageInputActions: n,
@@ -1628,105 +1647,106 @@ const pt = ({
1628
1647
  CustomChannelEmptyState: u,
1629
1648
  showChannelList: h = !0,
1630
1649
  filters: x,
1631
- channelListCustomEmptyStateIndicator: y,
1650
+ channelListCustomEmptyStateIndicator: p,
1632
1651
  onDeleteConversationClick: f,
1633
1652
  onBlockParticipantClick: o,
1634
- onReportParticipantClick: _
1653
+ onReportParticipantClick: M,
1654
+ dmAgentEnabled: S
1635
1655
  }) => {
1636
1656
  const {
1637
- service: E,
1657
+ service: g,
1638
1658
  client: m,
1639
- isConnected: C,
1640
- isLoading: v,
1641
- error: w,
1642
- refreshConnection: S,
1643
- debug: b
1644
- } = js(), [k, g] = I(null), [d, N] = I(!1), [O, j] = I(!1), [q, Y] = I(!1), [ne, K] = I(/* @__PURE__ */ new Set()), [ee, re] = I(0), [U, H] = I(!1), [J, G] = I(null), R = W(null), {
1645
- participantSource: D,
1659
+ isConnected: b,
1660
+ isLoading: N,
1661
+ error: y,
1662
+ refreshConnection: _,
1663
+ debug: E
1664
+ } = $s(), [C, d] = I(null), [v, P] = I(!1), [j, z] = I(!1), [re, Q] = I(!1), [X, K] = I(/* @__PURE__ */ new Set()), [ee, ae] = I(0), [O, G] = I(!1), [Z, k] = I(null), T = W(null), {
1665
+ participantSource: U,
1646
1666
  participantLabel: B = "participants",
1647
- showDeleteConversation: $ = !0
1648
- } = t, se = P.useMemo(() => {
1649
- const p = m == null ? void 0 : m.userID;
1667
+ showDeleteConversation: se = !0
1668
+ } = t, oe = L.useMemo(() => {
1669
+ const w = m == null ? void 0 : m.userID;
1650
1670
  return {
1651
1671
  ...{
1652
1672
  type: "messaging",
1653
1673
  last_message_at: { $exists: !0 },
1654
- ...p && {
1655
- members: { $in: [p] },
1674
+ ...w && {
1675
+ members: { $in: [w] },
1656
1676
  hidden: !1
1657
1677
  }
1658
1678
  },
1659
1679
  ...x
1660
1680
  };
1661
- }, [x, m == null ? void 0 : m.userID]), Q = W(null), V = T(async () => {
1662
- if (!m || !C) return;
1663
- const p = m.userID;
1664
- if (p)
1681
+ }, [x, m == null ? void 0 : m.userID]), Y = W(null), H = D(async () => {
1682
+ if (!m || !b) return;
1683
+ const w = m.userID;
1684
+ if (w)
1665
1685
  try {
1666
- b && console.log("[MessagingShell] Syncing channels for user:", p);
1667
- const L = await m.queryChannels(
1686
+ E && console.log("[MessagingShell] Syncing channels for user:", w);
1687
+ const $ = await m.queryChannels(
1668
1688
  {
1669
1689
  type: "messaging",
1670
- members: { $in: [p] }
1690
+ members: { $in: [w] }
1671
1691
  },
1672
1692
  {},
1673
1693
  { limit: 100 }
1674
1694
  ), F = /* @__PURE__ */ new Set();
1675
- L.forEach((A) => {
1676
- const xe = A.state.members;
1677
- Object.values(xe).forEach(($e) => {
1678
- var ve;
1679
- const Ce = (ve = $e.user) == null ? void 0 : ve.id;
1680
- Ce && Ce !== p && F.add(Ce);
1695
+ $.forEach((A) => {
1696
+ const Ce = A.state.members;
1697
+ Object.values(Ce).forEach((ze) => {
1698
+ var we;
1699
+ const be = (we = ze.user) == null ? void 0 : we.id;
1700
+ be && be !== w && F.add(be);
1681
1701
  });
1682
- }), K((A) => A.size === F.size && [...A].every((xe) => F.has(xe)) ? A : F), N(L.length > 0), j(!0), Q.current = p, b && console.log("[MessagingShell] Channels synced successfully:", {
1683
- channelCount: L.length,
1702
+ }), K((A) => A.size === F.size && [...A].every((Ce) => F.has(Ce)) ? A : F), P($.length > 0), z(!0), Y.current = w, E && console.log("[MessagingShell] Channels synced successfully:", {
1703
+ channelCount: $.length,
1684
1704
  memberCount: F.size
1685
1705
  });
1686
- } catch (L) {
1687
- console.error("[MessagingShell] Failed to sync channels:", L);
1706
+ } catch ($) {
1707
+ console.error("[MessagingShell] Failed to sync channels:", $);
1688
1708
  }
1689
- }, [m, C, b]);
1690
- Z(() => {
1691
- if (!m || !C) return;
1692
- const p = m.userID;
1693
- p && Q.current !== p && V();
1694
- }, [m, C, V]), Z(() => {
1695
- if (!c || !m || !C) return;
1709
+ }, [m, b, E]);
1710
+ q(() => {
1711
+ if (!m || !b) return;
1712
+ const w = m.userID;
1713
+ w && Y.current !== w && H();
1714
+ }, [m, b, H]), q(() => {
1715
+ if (!c || !m || !b) return;
1696
1716
  (async () => {
1697
- const L = m.userID;
1698
- if (L)
1717
+ const $ = m.userID;
1718
+ if ($)
1699
1719
  try {
1700
- b && console.log(
1720
+ E && console.log(
1701
1721
  "[MessagingShell] Loading initial conversation with:",
1702
1722
  c
1703
1723
  );
1704
1724
  const F = await m.queryChannels(
1705
1725
  {
1706
1726
  type: "messaging",
1707
- members: { $eq: [L, c] }
1727
+ members: { $eq: [$, c] }
1708
1728
  },
1709
1729
  {},
1710
1730
  { limit: 1 }
1711
1731
  );
1712
1732
  if (F.length > 0)
1713
- g(F[0]), H(!0), G(null), r && r(F[0]), b && console.log(
1733
+ d(F[0]), G(!0), k(null), r && r(F[0]), E && console.log(
1714
1734
  "[MessagingShell] Initial conversation loaded:",
1715
1735
  F[0].id
1716
1736
  );
1717
- else if (a && E) {
1718
- b && console.log(
1737
+ else if (a && g) {
1738
+ E && console.log(
1719
1739
  "[MessagingShell] No conversation found, creating one for:",
1720
1740
  a
1721
1741
  );
1722
1742
  try {
1723
- const A = await E.startChannelWithParticipant({
1743
+ const A = await g.startChannelWithParticipant({
1724
1744
  id: a.id,
1725
1745
  name: a.name,
1726
1746
  email: a.email,
1727
1747
  phone: a.phone
1728
1748
  });
1729
- g(A), H(!0), G(null), r && r(A), b && console.log(
1749
+ d(A), G(!0), k(null), r && r(A), E && console.log(
1730
1750
  "[MessagingShell] Channel created and loaded:",
1731
1751
  A.id
1732
1752
  );
@@ -1734,12 +1754,12 @@ const pt = ({
1734
1754
  console.error(
1735
1755
  "[MessagingShell] Failed to create conversation:",
1736
1756
  A
1737
- ), G("Failed to create conversation");
1757
+ ), k("Failed to create conversation");
1738
1758
  }
1739
1759
  } else
1740
- G(
1760
+ k(
1741
1761
  "No conversation found with this account"
1742
- ), b && console.log(
1762
+ ), E && console.log(
1743
1763
  "[MessagingShell] No conversation found for:",
1744
1764
  c
1745
1765
  );
@@ -1747,80 +1767,80 @@ const pt = ({
1747
1767
  console.error(
1748
1768
  "[MessagingShell] Failed to load initial conversation:",
1749
1769
  F
1750
- ), G("Failed to load conversation");
1770
+ ), k("Failed to load conversation");
1751
1771
  }
1752
1772
  })();
1753
1773
  }, [
1754
1774
  c,
1755
1775
  a,
1756
1776
  m,
1757
- C,
1758
- E,
1759
1777
  b,
1778
+ g,
1779
+ E,
1760
1780
  r
1761
1781
  ]);
1762
- const le = T(
1763
- (p) => {
1764
- g(p), r == null || r(p);
1782
+ const ie = D(
1783
+ (w) => {
1784
+ d(w), r == null || r(w);
1765
1785
  },
1766
1786
  [r]
1767
- ), oe = T(() => {
1768
- U || g(null);
1769
- }, [U]), ae = T(
1770
- async (p) => {
1771
- var L;
1772
- if (E)
1787
+ ), le = D(() => {
1788
+ O || d(null);
1789
+ }, [O]), V = D(
1790
+ async (w) => {
1791
+ var $;
1792
+ if (g)
1773
1793
  try {
1774
- b && console.log(
1794
+ E && console.log(
1775
1795
  "[MessagingShell] Starting conversation with:",
1776
- p.id
1796
+ w.id
1777
1797
  );
1778
- const F = await E.startChannelWithParticipant({
1779
- id: p.id,
1780
- name: p.name,
1781
- email: p.email,
1782
- phone: p.phone
1798
+ const F = await g.startChannelWithParticipant({
1799
+ id: w.id,
1800
+ name: w.name,
1801
+ email: w.email,
1802
+ phone: w.phone
1783
1803
  });
1784
1804
  try {
1785
1805
  await F.show();
1786
1806
  } catch (A) {
1787
1807
  console.warn("[MessagingShell] Failed to unhide channel:", A);
1788
1808
  }
1789
- g(F), Y(!1), (L = R.current) == null || L.close(), l == null || l(p);
1809
+ d(F), Q(!1), ($ = T.current) == null || $.close(), l == null || l(w);
1790
1810
  } catch (F) {
1791
1811
  console.error("[MessagingShell] Failed to start conversation:", F);
1792
1812
  }
1793
1813
  },
1794
- [E, l, b]
1795
- ), z = T(() => {
1796
- var p;
1797
- Y(!1), (p = R.current) == null || p.close();
1798
- }, []), fe = T(
1799
- (p) => {
1800
- p.target === R.current && z();
1814
+ [g, l, E]
1815
+ ), te = D(() => {
1816
+ var w;
1817
+ Q(!1), (w = T.current) == null || w.close();
1818
+ }, []), ce = D(
1819
+ (w) => {
1820
+ w.target === T.current && te();
1801
1821
  },
1802
- [z]
1803
- ), ie = T(
1804
- async (p) => {
1805
- b && console.log("[MessagingShell] Leaving conversation:", p.id), g(null), H(!1), Q.current = null, await V();
1822
+ [te]
1823
+ ), xe = D(
1824
+ async (w) => {
1825
+ E && console.log("[MessagingShell] Leaving conversation:", w.id), d(null), G(!1), Y.current = null, await H();
1806
1826
  },
1807
- [V, b]
1808
- ), ge = T(
1809
- async (p) => {
1810
- b && console.log("[MessagingShell] Blocking participant:", p), g(null), H(!1), Q.current = null, await V();
1827
+ [H, E]
1828
+ ), de = D(
1829
+ async (w) => {
1830
+ E && console.log("[MessagingShell] Blocking participant:", w), d(null), G(!1), Y.current = null, await H();
1811
1831
  },
1812
- [V, b]
1813
- ), X = !!k;
1814
- return v ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(ue, {}) }) : w ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(me, { message: w, onBack: S }) }) : !C || !m ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(
1815
- me,
1832
+ [H, E]
1833
+ ), J = !!C;
1834
+ return N ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(fe, {}) }) : y ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(he, { message: y, onBack: _ }) }) : !b || !m ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1835
+ he,
1816
1836
  {
1817
1837
  message: "Not connected to messaging service",
1818
- onBack: S
1838
+ onBack: _
1819
1839
  }
1820
- ) }) : J ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(me, { message: J }) }) : /* @__PURE__ */ i(
1840
+ ) }) : Z ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(he, { message: Z }) }) : /* @__PURE__ */ i(
1821
1841
  "div",
1822
1842
  {
1823
- className: M(
1843
+ className: R(
1824
1844
  "messaging-shell h-full bg-background-primary overflow-hidden",
1825
1845
  s
1826
1846
  ),
@@ -1829,23 +1849,23 @@ const pt = ({
1829
1849
  /* @__PURE__ */ e(
1830
1850
  "div",
1831
1851
  {
1832
- className: M(
1852
+ className: R(
1833
1853
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1834
1854
  {
1835
- "!hidden": h === !1 || U,
1855
+ "!hidden": h === !1 || O,
1836
1856
  // Hide on mobile when channel selected, show on desktop with consistent wide width
1837
- "hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !U && X,
1857
+ "hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !O && J,
1838
1858
  // Show on mobile when no channel selected, use same wide width on desktop
1839
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !U && !X
1859
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !O && !J
1840
1860
  }
1841
1861
  ),
1842
1862
  children: /* @__PURE__ */ e(
1843
- Oe,
1863
+ Ue,
1844
1864
  {
1845
- onChannelSelect: le,
1846
- selectedChannel: k || void 0,
1847
- filters: se,
1848
- customEmptyStateIndicator: y
1865
+ onChannelSelect: ie,
1866
+ selectedChannel: C || void 0,
1867
+ filters: oe,
1868
+ customEmptyStateIndicator: p
1849
1869
  }
1850
1870
  )
1851
1871
  }
@@ -1853,59 +1873,60 @@ const pt = ({
1853
1873
  /* @__PURE__ */ e(
1854
1874
  "div",
1855
1875
  {
1856
- className: M(
1876
+ className: R(
1857
1877
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1858
1878
  {
1859
1879
  // In direct conversation mode (or waiting for it), always show (full width)
1860
- flex: U || X || c,
1880
+ flex: O || J || c,
1861
1881
  // Normal mode: hide on mobile when no channel selected
1862
- "hidden lg:flex": !U && !X && !c
1882
+ "hidden lg:flex": !O && !J && !c
1863
1883
  }
1864
1884
  ),
1865
- children: k ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1866
- Ae,
1885
+ children: C ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1886
+ je,
1867
1887
  {
1868
- channel: k,
1869
- onBack: oe,
1870
- showBackButton: !U,
1888
+ channel: C,
1889
+ onBack: le,
1890
+ showBackButton: !O,
1871
1891
  renderMessageInputActions: n,
1872
- onLeaveConversation: ie,
1873
- onBlockParticipant: ge,
1892
+ onLeaveConversation: xe,
1893
+ onBlockParticipant: de,
1874
1894
  CustomChannelEmptyState: u,
1875
- showDeleteConversation: $,
1895
+ showDeleteConversation: se,
1876
1896
  onDeleteConversationClick: f,
1877
1897
  onBlockParticipantClick: o,
1878
- onReportParticipantClick: _
1898
+ onReportParticipantClick: M,
1899
+ dmAgentEnabled: S
1879
1900
  },
1880
- k.id
1901
+ C.id
1881
1902
  ) }) : c ? (
1882
1903
  // Show loading while creating/loading direct conversation channel
1883
- /* @__PURE__ */ e(ue, {})
1904
+ /* @__PURE__ */ e(fe, {})
1884
1905
  ) : /* @__PURE__ */ e(
1885
- je,
1906
+ $e,
1886
1907
  {
1887
- hasChannels: d,
1888
- channelsLoaded: O
1908
+ hasChannels: v,
1909
+ channelsLoaded: j
1889
1910
  }
1890
1911
  )
1891
1912
  }
1892
1913
  )
1893
1914
  ] }),
1894
- D && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1915
+ U && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1895
1916
  /* @__PURE__ */ e(
1896
1917
  "dialog",
1897
1918
  {
1898
- ref: R,
1919
+ ref: T,
1899
1920
  className: "mes-dialog",
1900
- onClick: fe,
1901
- onClose: z,
1921
+ onClick: ce,
1922
+ onClose: te,
1902
1923
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1903
- mt,
1924
+ ut,
1904
1925
  {
1905
- participantSource: D,
1906
- onSelectParticipant: ae,
1907
- onClose: z,
1908
- existingParticipantIds: ne,
1926
+ participantSource: U,
1927
+ onSelectParticipant: V,
1928
+ onClose: te,
1929
+ existingParticipantIds: X,
1909
1930
  participantLabel: B,
1910
1931
  searchPlaceholder: `Search ${B}...`
1911
1932
  },
@@ -1916,7 +1937,7 @@ const pt = ({
1916
1937
  ]
1917
1938
  }
1918
1939
  );
1919
- }, ht = ({
1940
+ }, ft = ({
1920
1941
  question: t,
1921
1942
  onClick: s,
1922
1943
  loading: n = !1,
@@ -1928,7 +1949,7 @@ const pt = ({
1928
1949
  onClick: s,
1929
1950
  disabled: n,
1930
1951
  style: { backgroundColor: "#E6E5E3" },
1931
- className: M(
1952
+ className: R(
1932
1953
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1933
1954
  {
1934
1955
  "hover:brightness-95 active:brightness-90": !n,
@@ -1938,7 +1959,7 @@ const pt = ({
1938
1959
  ),
1939
1960
  children: t
1940
1961
  }
1941
- ), yt = ({
1962
+ ), Et = ({
1942
1963
  faqs: t,
1943
1964
  onFaqClick: s,
1944
1965
  loadingFaqId: n,
@@ -1950,7 +1971,7 @@ const pt = ({
1950
1971
  const u = t.filter((h) => h.enabled).sort((h, x) => (h.order ?? 0) - (x.order ?? 0));
1951
1972
  return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1952
1973
  (c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1953
- te,
1974
+ ne,
1954
1975
  {
1955
1976
  id: a || "account",
1956
1977
  name: a || "Account",
@@ -1967,7 +1988,7 @@ const pt = ({
1967
1988
  children: [
1968
1989
  r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1969
1990
  u.map((h) => /* @__PURE__ */ e(
1970
- ht,
1991
+ ft,
1971
1992
  {
1972
1993
  question: h.question,
1973
1994
  onClick: () => s(h.id),
@@ -1979,59 +2000,59 @@ const pt = ({
1979
2000
  }
1980
2001
  )
1981
2002
  ] }) });
1982
- }, Et = (t, s = {}) => {
1983
- const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [h, x] = I(null), [y, f] = I(n), [o, _] = I(!0), [E, m] = I(), C = T(async (b = !1, k) => {
2003
+ }, It = (t, s = {}) => {
2004
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [l, c] = I([]), [a, u] = I(!1), [h, x] = I(null), [p, f] = I(n), [o, M] = I(!0), [S, g] = I(), m = D(async (_ = !1, E) => {
1984
2005
  if (a) return;
1985
- const g = k !== void 0 ? k : y;
2006
+ const C = E !== void 0 ? E : p;
1986
2007
  u(!0), x(null);
1987
2008
  try {
1988
2009
  const d = await t.loadParticipants({
1989
- search: g || void 0,
2010
+ search: C || void 0,
1990
2011
  limit: r,
1991
- cursor: b ? void 0 : E
2012
+ cursor: _ ? void 0 : S
1992
2013
  });
1993
2014
  c(
1994
- (N) => b ? d.participants : [...N, ...d.participants]
1995
- ), _(d.hasMore), m(d.nextCursor);
2015
+ (v) => _ ? d.participants : [...v, ...d.participants]
2016
+ ), M(d.hasMore), g(d.nextCursor);
1996
2017
  } catch (d) {
1997
- const N = d instanceof Error ? d.message : "Failed to load participants";
1998
- x(N), console.error("[useParticipants] Load error:", d);
2018
+ const v = d instanceof Error ? d.message : "Failed to load participants";
2019
+ x(v), console.error("[useParticipants] Load error:", d);
1999
2020
  } finally {
2000
2021
  u(!1);
2001
2022
  }
2002
- }, [t, y, E, r, a]), v = T(() => {
2003
- o && !a && C(!1);
2004
- }, [o, a, C]), w = T((b) => {
2005
- f(b), m(void 0), C(!0, b);
2006
- }, [C]), S = T(() => {
2007
- m(void 0), C(!0);
2008
- }, [C]);
2009
- return Z(() => {
2010
- C(!0);
2023
+ }, [t, p, S, r, a]), b = D(() => {
2024
+ o && !a && m(!1);
2025
+ }, [o, a, m]), N = D((_) => {
2026
+ f(_), g(void 0), m(!0, _);
2027
+ }, [m]), y = D(() => {
2028
+ g(void 0), m(!0);
2029
+ }, [m]);
2030
+ return q(() => {
2031
+ m(!0);
2011
2032
  }, [t.loadParticipants]), {
2012
2033
  participants: l,
2013
2034
  loading: a,
2014
2035
  error: h,
2015
- searchQuery: y,
2036
+ searchQuery: p,
2016
2037
  hasMore: o,
2017
2038
  totalCount: t.totalCount,
2018
- loadMore: v,
2019
- search: w,
2020
- refresh: S
2039
+ loadMore: b,
2040
+ search: N,
2041
+ refresh: y
2021
2042
  };
2022
2043
  };
2023
2044
  export {
2024
- te as Avatar,
2025
- at as ChannelEmptyState,
2026
- Oe as ChannelList,
2027
- Ae as ChannelView,
2028
- yt as FaqList,
2029
- ht as FaqListItem,
2030
- wt as MessagingProvider,
2031
- pt as MessagingShell,
2032
- mt as ParticipantPicker,
2033
- zs as formatRelativeTime,
2034
- js as useMessaging,
2035
- Et as useParticipants
2045
+ ne as Avatar,
2046
+ lt as ChannelEmptyState,
2047
+ Ue as ChannelList,
2048
+ je as ChannelView,
2049
+ Et as FaqList,
2050
+ ft as FaqListItem,
2051
+ pt as MessagingProvider,
2052
+ yt as MessagingShell,
2053
+ ut as ParticipantPicker,
2054
+ Gs as formatRelativeTime,
2055
+ $s as useMessaging,
2056
+ It as useParticipants
2036
2057
  };
2037
2058
  //# sourceMappingURL=index.js.map