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