@linktr.ee/messaging-react 1.24.4 → 1.25.0-rc-1774238116

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