@linktr.ee/messaging-react 1.18.0 → 1.19.0

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