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