@linktr.ee/messaging-react 1.22.0-rc-1771560879 → 1.22.0-rc-1771906339

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