@linktr.ee/messaging-react 1.9.1 → 1.9.2

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,241 +1,232 @@
1
- import { jsx as e, jsxs as d, Fragment as se } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as u, Fragment as ue } from "react/jsx-runtime";
2
2
  import R from "classnames";
3
- import Y, { createContext as Re, useContext as Fe, useCallback as P, useState as y, useRef as $, useEffect as H } from "react";
4
- import { StreamChatService as Te } from "@linktr.ee/messaging-core";
5
- import { Chat as De, ChannelList as pe, MessageInput as Me, useMessageInputContext as Pe, useMessageComposerHasSendableData as Ue, SimpleAttachmentSelector as Oe, QuotedMessagePreview as Le, LinkPreviewList as _e, AttachmentPreviewList as je, TextareaComposer as Ae, Channel as Be, useChannelStateContext as fe, Window as ze, MessageList as $e } from "stream-chat-react";
6
- import { XIcon as he, ArrowUpIcon as He, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as Ge, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
7
- const ge = Re({
3
+ import q, { createContext as ye, useContext as Se, useCallback as M, useState as E, useRef as z, useEffect as $ } from "react";
4
+ import { StreamChatService as ke } from "@linktr.ee/messaging-core";
5
+ import { Chat as Re, ChannelList as Fe, MessageInput as Te, useMessageInputContext as De, useMessageComposerHasSendableData as pe, SimpleAttachmentSelector as Me, QuotedMessagePreview as Pe, LinkPreviewList as Ue, AttachmentPreviewList as Oe, TextareaComposer as Le, Channel as _e, useChannelStateContext as me, Window as je, MessageList as Ae } from "stream-chat-react";
6
+ import { XIcon as fe, ArrowUpIcon as Be, ArrowLeftIcon as oe, DotsThreeIcon as ae, SpinnerGapIcon as ee, SignOutIcon as ze, ProhibitInsetIcon as ie, FlagIcon as $e, MagnifyingGlassIcon as He, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
+ const he = ye({
8
8
  service: null,
9
9
  client: null,
10
10
  isConnected: !1,
11
11
  isLoading: !1,
12
12
  error: null,
13
13
  capabilities: {},
14
- customization: {},
15
14
  refreshConnection: async () => {
16
15
  },
17
16
  debug: !1
18
- }), ne = () => Fe(ge), bs = ({
17
+ }), se = () => Se(he), gs = ({
19
18
  children: t,
20
19
  user: s,
21
20
  serviceConfig: n,
22
- apiKey: r,
23
- capabilities: a = {},
24
- customization: c = {},
21
+ apiKey: l,
22
+ capabilities: o = {},
25
23
  debug: i = !1
26
24
  }) => {
27
- const l = P(
28
- (x, ...D) => {
29
- i && console.log(`🔥 [MessagingProvider] ${x}`, ...D);
25
+ const r = M(
26
+ (d, ...N) => {
27
+ i && console.log(`🔥 [MessagingProvider] ${d}`, ...N);
30
28
  },
31
29
  [i]
32
30
  );
33
- l("🔄 RENDER START", {
31
+ r("🔄 RENDER START", {
34
32
  userId: s == null ? void 0 : s.id,
35
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
33
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
36
34
  serviceConfig: !!n,
37
- capabilities: Object.keys(a),
38
- customization: Object.keys(c)
35
+ capabilities: Object.keys(o)
39
36
  });
40
- const [o, w] = y(null), [I, N] = y(null), [m, S] = y(!1), [g, b] = y(!1), [E, v] = y(null), F = $(!1), C = $({
37
+ const [a, m] = E(null), [x, k] = E(null), [f, h] = E(!1), [I, g] = E(!1), [C, w] = E(null), v = z(!1), y = z({
41
38
  userId: s == null ? void 0 : s.id,
42
- apiKey: r,
39
+ apiKey: l,
43
40
  serviceConfig: n,
44
- capabilities: a,
45
- customization: c
46
- }), T = $(0);
47
- T.current++, l("📊 RENDER INFO", {
48
- renderCount: T.current,
49
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
41
+ capabilities: o
42
+ }), S = z(0);
43
+ S.current++, r("📊 RENDER INFO", {
44
+ renderCount: S.current,
45
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
50
46
  propChanges: {
51
- userChanged: C.current.userId !== (s == null ? void 0 : s.id),
52
- apiKeyChanged: C.current.apiKey !== r,
53
- serviceConfigChanged: C.current.serviceConfig !== n,
54
- capabilitiesChanged: C.current.capabilities !== a,
55
- customizationChanged: C.current.customization !== c
47
+ userChanged: y.current.userId !== (s == null ? void 0 : s.id),
48
+ apiKeyChanged: y.current.apiKey !== l,
49
+ serviceConfigChanged: y.current.serviceConfig !== n,
50
+ capabilitiesChanged: y.current.capabilities !== o
56
51
  }
57
- }), C.current = {
52
+ }), y.current = {
58
53
  userId: s == null ? void 0 : s.id,
59
- apiKey: r,
54
+ apiKey: l,
60
55
  serviceConfig: n,
61
- capabilities: a,
62
- customization: c
63
- }, H(() => {
64
- const x = T.current;
65
- if (l("🔧 SERVICE INIT EFFECT TRIGGERED", {
66
- renderCount: x,
67
- apiKey: !!r,
56
+ capabilities: o
57
+ }, $(() => {
58
+ const d = S.current;
59
+ if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
60
+ renderCount: d,
61
+ apiKey: !!l,
68
62
  serviceConfig: !!n,
69
63
  dependencies: {
70
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
64
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
71
65
  serviceConfigRef: n,
72
- serviceConfigStable: C.current.serviceConfig === n,
73
- apiKeyStable: C.current.apiKey === r
66
+ serviceConfigStable: y.current.serviceConfig === n,
67
+ apiKeyStable: y.current.apiKey === l
74
68
  }
75
- }), !r || !n) {
76
- l("⚠️ SERVICE INIT SKIPPED", {
77
- renderCount: x,
69
+ }), !l || !n) {
70
+ r("⚠️ SERVICE INIT SKIPPED", {
71
+ renderCount: d,
78
72
  reason: "Missing apiKey or serviceConfig"
79
73
  });
80
74
  return;
81
75
  }
82
- l("🚀 CREATING NEW SERVICE", {
83
- renderCount: x,
84
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
85
- serviceConfigChanged: C.current.serviceConfig !== n
76
+ r("🚀 CREATING NEW SERVICE", {
77
+ renderCount: d,
78
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
79
+ serviceConfigChanged: y.current.serviceConfig !== n
86
80
  });
87
- const D = new Te({
81
+ const N = new ke({
88
82
  ...n,
89
- apiKey: r,
83
+ apiKey: l,
90
84
  debug: i
91
85
  });
92
- return w(D), l("✅ SERVICE SET", {
93
- renderCount: x,
94
- serviceInstance: !!D
86
+ return m(N), r("✅ SERVICE SET", {
87
+ renderCount: d,
88
+ serviceInstance: !!N
95
89
  }), () => {
96
- l("🧹 SERVICE CLEANUP", {
97
- renderCount: x,
90
+ r("🧹 SERVICE CLEANUP", {
91
+ renderCount: d,
98
92
  reason: "Effect cleanup"
99
- }), D.disconnectUser().catch(console.error);
93
+ }), N.disconnectUser().catch(console.error);
100
94
  };
101
- }, [r, n, i, l]);
102
- const p = $(null);
103
- H(() => {
104
- var D, q;
105
- if (l("🔗 USER CONNECTION EFFECT TRIGGERED", {
106
- hasService: !!o,
95
+ }, [l, n, i, r]);
96
+ const F = z(null);
97
+ $(() => {
98
+ var N, j;
99
+ if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
100
+ hasService: !!a,
107
101
  hasUser: !!s,
108
102
  userId: s == null ? void 0 : s.id,
109
- isConnecting: F.current,
110
- isConnected: m,
111
- dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
112
- }), !o || !s) {
113
- l("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
103
+ isConnecting: v.current,
104
+ isConnected: f,
105
+ dependencies: { service: !!a, userId: s == null ? void 0 : s.id }
106
+ }), !a || !s) {
107
+ r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
114
108
  return;
115
109
  }
116
- if (F.current) {
117
- l("⚠️ USER CONNECTION SKIPPED", "Already connecting");
110
+ if (v.current) {
111
+ r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
118
112
  return;
119
113
  }
120
- if (((D = p.current) == null ? void 0 : D.serviceId) === o && ((q = p.current) == null ? void 0 : q.userId) === s.id) {
121
- l(
114
+ if (((N = F.current) == null ? void 0 : N.serviceId) === a && ((j = F.current) == null ? void 0 : j.userId) === s.id) {
115
+ r(
122
116
  "⚠️ USER CONNECTION SKIPPED",
123
117
  "Already connected this user with this service"
124
118
  );
125
119
  return;
126
120
  }
127
121
  (async () => {
128
- l("🚀 STARTING USER CONNECTION", { userId: s.id }), F.current = !0, b(!0), v(null);
122
+ r("🚀 STARTING USER CONNECTION", { userId: s.id }), v.current = !0, g(!0), w(null);
129
123
  try {
130
- l("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
- const _ = await o.connectUser(s);
132
- N(_), S(!0), p.current = { serviceId: o, userId: s.id }, l("✅ USER CONNECTION SUCCESS", {
124
+ r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
125
+ const A = await a.connectUser(s);
126
+ k(A), h(!0), F.current = { serviceId: a, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
133
127
  userId: s.id,
134
- clientId: _.userID
128
+ clientId: A.userID
135
129
  });
136
- } catch (_) {
137
- const O = _ instanceof Error ? _.message : "Connection failed";
138
- v(O), l("❌ USER CONNECTION ERROR", {
130
+ } catch (A) {
131
+ const W = A instanceof Error ? A.message : "Connection failed";
132
+ w(W), r("❌ USER CONNECTION ERROR", {
139
133
  userId: s.id,
140
- error: O
134
+ error: W
141
135
  });
142
136
  } finally {
143
- b(!1), F.current = !1, l("🔄 USER CONNECTION FINISHED", {
137
+ g(!1), v.current = !1, r("🔄 USER CONNECTION FINISHED", {
144
138
  userId: s.id,
145
- isConnected: m
139
+ isConnected: f
146
140
  });
147
141
  }
148
142
  })();
149
- }, [o, s, l, m]), H(() => (l("🔌 CLEANUP EFFECT REGISTERED", {
150
- hasService: !!o,
151
- isConnected: m
143
+ }, [a, s, r, f]), $(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
144
+ hasService: !!a,
145
+ isConnected: f
152
146
  }), () => {
153
- o && m ? (l(
147
+ a && f ? (r(
154
148
  "🧹 CLEANUP EFFECT TRIGGERED",
155
149
  "Cleaning up connection on unmount"
156
- ), p.current = null, o.disconnectUser().catch(console.error)) : l("🔇 CLEANUP EFFECT SKIPPED", {
157
- hasService: !!o,
158
- isConnected: m
150
+ ), F.current = null, a.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
151
+ hasService: !!a,
152
+ isConnected: f
159
153
  });
160
- }), [o, m, l]);
161
- const u = P(async () => {
162
- if (l("🔄 REFRESH CONNECTION CALLED", {
163
- hasService: !!o,
154
+ }), [a, f, r]);
155
+ const D = M(async () => {
156
+ if (r("🔄 REFRESH CONNECTION CALLED", {
157
+ hasService: !!a,
164
158
  hasUser: !!s
165
- }), !o || !s) {
166
- l("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
159
+ }), !a || !s) {
160
+ r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
167
161
  return;
168
162
  }
169
- l("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
163
+ r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), g(!0);
170
164
  try {
171
- l("🔌 DISCONNECTING FOR REFRESH"), await o.disconnectUser(), l("📞 RECONNECTING FOR REFRESH");
172
- const x = await o.connectUser(s);
173
- N(x), S(!0), v(null), l("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
174
- } catch (x) {
175
- const D = x instanceof Error ? x.message : "Refresh failed";
176
- v(D), l("❌ CONNECTION REFRESH ERROR", {
165
+ r("🔌 DISCONNECTING FOR REFRESH"), await a.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
166
+ const d = await a.connectUser(s);
167
+ k(d), h(!0), w(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ } catch (d) {
169
+ const N = d instanceof Error ? d.message : "Refresh failed";
170
+ w(N), r("❌ CONNECTION REFRESH ERROR", {
177
171
  userId: s.id,
178
- error: D
172
+ error: N
179
173
  });
180
174
  } finally {
181
- b(!1), l("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
175
+ g(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
182
176
  }
183
- }, [o, s, l]), f = Y.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
184
- hasService: !!o,
185
- hasClient: !!I,
186
- isConnected: m,
187
- isLoading: g,
188
- hasError: !!E,
189
- capabilitiesKeys: Object.keys(a),
190
- customizationKeys: Object.keys(c)
177
+ }, [a, s, r]), c = q.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
178
+ hasService: !!a,
179
+ hasClient: !!x,
180
+ isConnected: f,
181
+ isLoading: I,
182
+ hasError: !!C,
183
+ capabilitiesKeys: Object.keys(o)
191
184
  }), {
192
- service: o,
193
- client: I,
194
- isConnected: m,
195
- isLoading: g,
196
- error: E,
197
- capabilities: a,
198
- customization: c,
199
- refreshConnection: u,
185
+ service: a,
186
+ client: x,
187
+ isConnected: f,
188
+ isLoading: I,
189
+ error: C,
190
+ capabilities: o,
191
+ refreshConnection: D,
200
192
  debug: i
201
193
  }), [
202
- o,
203
- I,
204
- m,
205
- g,
206
- E,
207
194
  a,
208
- c,
209
- u,
195
+ x,
196
+ f,
197
+ I,
198
+ C,
199
+ o,
200
+ D,
210
201
  i,
211
- l
202
+ r
212
203
  ]);
213
- return l("🔄 RENDER END", {
214
- renderCount: T.current,
215
- willRenderChat: !!(I && m),
216
- contextValueReady: !!f
217
- }), /* @__PURE__ */ e(ge.Provider, { value: f, children: I && m ? /* @__PURE__ */ e(De, { client: I, children: t }) : t });
218
- }, qe = () => ne(), Ye = (t, s) => {
204
+ return r("🔄 RENDER END", {
205
+ renderCount: S.current,
206
+ willRenderChat: !!(x && f),
207
+ contextValueReady: !!c
208
+ }), /* @__PURE__ */ e(he.Provider, { value: c, children: x && f ? /* @__PURE__ */ e(Re, { client: x, children: t }) : t });
209
+ }, Ge = () => se(), Ve = (t, s) => {
219
210
  const n = new Date(
220
211
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
221
- ), a = new Date(
212
+ ), o = new Date(
222
213
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
223
214
  ).getTime() - n.getTime();
224
- return Math.floor(a / (1e3 * 60 * 60 * 24));
225
- }, Je = (t) => {
215
+ return Math.floor(o / (1e3 * 60 * 60 * 24));
216
+ }, We = (t) => {
226
217
  const s = /* @__PURE__ */ new Date();
227
218
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
228
219
  return "Just now";
229
- const r = Ye(t, s);
230
- return r === 0 ? t.toLocaleTimeString([], {
220
+ const l = Ve(t, s);
221
+ return l === 0 ? t.toLocaleTimeString([], {
231
222
  hour: "numeric",
232
223
  minute: "2-digit"
233
- }) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
224
+ }) : l === 1 ? "Yesterday" : l < 7 ? `${l}d` : l < 28 ? `${Math.floor(l / 7)}w` : t.toLocaleDateString("en-US", {
234
225
  month: "numeric",
235
226
  day: "numeric",
236
227
  year: "2-digit"
237
228
  });
238
- }, ue = [
229
+ }, de = [
239
230
  "🍎",
240
231
  // Apple
241
232
  "🍌",
@@ -263,37 +254,37 @@ const ge = Re({
263
254
  "🍈"
264
255
  // Melon
265
256
  ];
266
- function Qe(t) {
257
+ function qe(t) {
267
258
  let s = 0;
268
259
  for (let n = 0; n < t.length; n++) {
269
- const r = t.charCodeAt(n);
270
- s = (s << 5) - s + r, s = s & s;
260
+ const l = t.charCodeAt(n);
261
+ s = (s << 5) - s + l, s = s & s;
271
262
  }
272
263
  return Math.abs(s);
273
264
  }
274
- function Xe(t) {
275
- const n = Qe(t) % ue.length;
276
- return ue[n];
265
+ function Ye(t) {
266
+ const n = qe(t) % de.length;
267
+ return de[n];
277
268
  }
278
- const J = ({
269
+ const Y = ({
279
270
  id: t,
280
271
  image: s,
281
272
  size: n = 40,
282
- className: r,
283
- shape: a = "squircle"
273
+ className: l,
274
+ shape: o = "squircle"
284
275
  }) => {
285
- const c = Xe(t), l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", o = a === "circle" ? { borderRadius: "50%" } : {
276
+ const i = Ye(t), a = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
286
277
  borderRadius: "33%",
287
278
  "corner-shape": "superellipse(1.3)"
288
279
  };
289
280
  return /* @__PURE__ */ e(
290
281
  "div",
291
282
  {
292
- className: R("flex-shrink-0 overflow-hidden", r),
283
+ className: R("flex-shrink-0 overflow-hidden", l),
293
284
  style: {
294
285
  width: `${n}px`,
295
286
  height: `${n}px`,
296
- ...o
287
+ ...m
297
288
  },
298
289
  children: s ? /* @__PURE__ */ e(
299
290
  "img",
@@ -308,91 +299,91 @@ const J = ({
308
299
  "aria-hidden": "true",
309
300
  className: R(
310
301
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
311
- l
302
+ a
312
303
  ),
313
- children: c
304
+ children: i
314
305
  }
315
306
  )
316
307
  }
317
308
  );
318
- }, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
319
- var E, v, F, C, T, p;
320
- const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
309
+ }, Je = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: o }) => {
310
+ var w, v, y, S, F, D;
311
+ const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
321
312
  t && n(t);
322
- }, o = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
323
- (u) => {
324
- var f, x;
325
- return ((f = u.user) == null ? void 0 : f.id) && u.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
313
+ }, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
314
+ (c) => {
315
+ var d, N;
316
+ return ((d = c.user) == null ? void 0 : d.id) && c.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
326
317
  }
327
- ), w = ((v = o == null ? void 0 : o.user) == null ? void 0 : v.name) || "Conversation", I = (F = o == null ? void 0 : o.user) == null ? void 0 : F.image, N = (T = (C = t == null ? void 0 : t.state) == null ? void 0 : C.messages) == null ? void 0 : T[t.state.messages.length - 1], S = (() => {
328
- var f;
329
- if (N != null && N.text) return N.text;
330
- const u = (f = N == null ? void 0 : N.attachments) == null ? void 0 : f[0];
331
- return u != null && u.asset_url ? u.asset_url : u != null && u.image_url ? u.image_url : u != null && u.og_scrape_url ? u.og_scrape_url : u != null && u.thumb_url ? u.thumb_url : "No messages yet";
332
- })(), g = N != null && N.created_at ? Je(new Date(N.created_at)) : "", b = a ?? 0;
333
- return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
318
+ ), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (y = m == null ? void 0 : m.user) == null ? void 0 : y.image, f = (F = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : F[t.state.messages.length - 1], I = (() => {
319
+ var d;
320
+ if (f != null && f.text) return f.text;
321
+ const c = (d = f == null ? void 0 : f.attachments) == null ? void 0 : d[0];
322
+ return c != null && c.asset_url ? c.asset_url : c != null && c.image_url ? c.image_url : c != null && c.og_scrape_url ? c.og_scrape_url : c != null && c.thumb_url ? c.thumb_url : "No messages yet";
323
+ })(), g = f != null && f.created_at ? We(new Date(f.created_at)) : "", C = o ?? 0;
324
+ return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
334
325
  channelId: t == null ? void 0 : t.id,
335
- isSelected: c,
336
- participantName: w,
337
- unreadCount: b,
326
+ isSelected: i,
327
+ participantName: x,
328
+ unreadCount: C,
338
329
  hasTimestamp: !!g
339
330
  }), /* @__PURE__ */ e(
340
331
  "button",
341
332
  {
342
333
  type: "button",
343
- onClick: i,
334
+ onClick: r,
344
335
  className: R(
345
336
  "group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
346
337
  {
347
- "bg-primary-alt/10 border-l-4 border-l-primary": c,
348
- "hover:bg-sand": !c
338
+ "bg-primary-alt/10 border-l-4 border-l-primary": i,
339
+ "hover:bg-sand": !i
349
340
  }
350
341
  ),
351
- children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
342
+ children: /* @__PURE__ */ u("div", { className: "flex items-start gap-3", children: [
352
343
  /* @__PURE__ */ e(
353
- J,
344
+ Y,
354
345
  {
355
- id: ((p = o == null ? void 0 : o.user) == null ? void 0 : p.id) || t.id || "unknown",
356
- name: w,
357
- image: I,
346
+ id: ((D = m == null ? void 0 : m.user) == null ? void 0 : D.id) || t.id || "unknown",
347
+ name: x,
348
+ image: k,
358
349
  size: 44,
359
350
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
360
351
  }
361
352
  ),
362
- /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
363
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
353
+ /* @__PURE__ */ u("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
354
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2", children: [
364
355
  /* @__PURE__ */ e(
365
356
  "h3",
366
357
  {
367
358
  className: R(
368
359
  "text-sm font-medium truncate",
369
- c ? "text-primary" : "text-charcoal"
360
+ i ? "text-primary" : "text-charcoal"
370
361
  ),
371
- children: w
362
+ children: x
372
363
  }
373
364
  ),
374
365
  g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
375
366
  ] }),
376
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
377
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
378
- b > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: b > 99 ? "99+" : b })
367
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
368
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: I }),
369
+ C > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: C > 99 ? "99+" : C })
379
370
  ] })
380
371
  ] })
381
372
  ] })
382
373
  }
383
374
  );
384
- }, Ke = ({
375
+ }, Qe = ({
385
376
  onChannelSelect: t,
386
377
  selectedChannel: s,
387
378
  filters: n,
388
- className: r,
389
- customEmptyStateIndicator: a
379
+ className: l,
380
+ customEmptyStateIndicator: o
390
381
  }) => {
391
- const c = Y.useRef(0);
392
- c.current++;
393
- const { debug: i = !1 } = ne();
394
- return i && console.log("📺 [ChannelList] 🔄 RENDER START", {
395
- renderCount: c.current,
382
+ const i = q.useRef(0);
383
+ i.current++;
384
+ const { debug: r = !1 } = se();
385
+ return r && console.log("📺 [ChannelList] 🔄 RENDER START", {
386
+ renderCount: i.current,
396
387
  selectedChannelId: s == null ? void 0 : s.id,
397
388
  filters: n
398
389
  }), /* @__PURE__ */ e(
@@ -400,34 +391,34 @@ const J = ({
400
391
  {
401
392
  className: R(
402
393
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
403
- r
394
+ l
404
395
  ),
405
- children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (i && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
406
- renderCount: c.current,
396
+ children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
397
+ renderCount: i.current,
407
398
  filters: n
408
399
  }), /* @__PURE__ */ e(
409
- pe,
400
+ Fe,
410
401
  {
411
402
  filters: n,
412
403
  sort: { last_message_at: -1 },
413
404
  options: { limit: 30 },
414
- Preview: (l) => {
415
- var o, w;
416
- return i && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
417
- channelId: (o = l.channel) == null ? void 0 : o.id,
405
+ Preview: (a) => {
406
+ var m, x;
407
+ return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
408
+ channelId: (m = a.channel) == null ? void 0 : m.id,
418
409
  selectedChannelId: s == null ? void 0 : s.id,
419
- isSelected: (s == null ? void 0 : s.id) === ((w = l.channel) == null ? void 0 : w.id)
410
+ isSelected: (s == null ? void 0 : s.id) === ((x = a.channel) == null ? void 0 : x.id)
420
411
  }), /* @__PURE__ */ e(
421
- Ze,
412
+ Je,
422
413
  {
423
- ...l,
414
+ ...a,
424
415
  selectedChannel: s,
425
416
  onChannelSelect: t,
426
- debug: i
417
+ debug: r
427
418
  }
428
419
  );
429
420
  },
430
- EmptyStateIndicator: a
421
+ EmptyStateIndicator: o
431
422
  },
432
423
  JSON.stringify(n)
433
424
  )) })
@@ -437,7 +428,7 @@ const J = ({
437
428
  variant: t = "default",
438
429
  className: s,
439
430
  children: n,
440
- ...r
431
+ ...l
441
432
  }) => /* @__PURE__ */ e(
442
433
  "button",
443
434
  {
@@ -447,24 +438,24 @@ const J = ({
447
438
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
448
439
  s
449
440
  ),
450
- ...r,
441
+ ...l,
451
442
  children: n
452
443
  }
453
444
  );
454
- function xe({ label: t, className: s, children: n, ...r }) {
455
- return /* @__PURE__ */ d(
445
+ function ge({ label: t, className: s, children: n, ...l }) {
446
+ return /* @__PURE__ */ u(
456
447
  "button",
457
448
  {
458
449
  type: "button",
459
450
  className: R(
460
451
  "rounded-full p-2 transition-colors focus-ring",
461
452
  {
462
- "cursor-not-allowed opacity-50": r.disabled,
463
- "hover:bg-sand": !r.disabled
453
+ "cursor-not-allowed opacity-50": l.disabled,
454
+ "hover:bg-sand": !l.disabled
464
455
  },
465
456
  s
466
457
  ),
467
- ...r,
458
+ ...l,
468
459
  children: [
469
460
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
470
461
  n
@@ -472,20 +463,20 @@ function xe({ label: t, className: s, children: n, ...r }) {
472
463
  }
473
464
  );
474
465
  }
475
- function Ne({ onClick: t }) {
476
- return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
466
+ function xe({ onClick: t }) {
467
+ return /* @__PURE__ */ e(ge, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
477
468
  }
478
- const es = () => {
479
- const { handleSubmit: t } = Pe(), s = Ue();
480
- return /* @__PURE__ */ d(se, { children: [
481
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Oe, {}) }),
482
- /* @__PURE__ */ d("div", { className: "central-container w-full p-2 bg-white rounded-lg 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: [
483
- /* @__PURE__ */ e(Le, {}),
484
- /* @__PURE__ */ e(_e, {}),
485
- /* @__PURE__ */ e(je, {}),
486
- /* @__PURE__ */ d("div", { className: "flex", children: [
469
+ const Xe = () => {
470
+ const { handleSubmit: t } = De(), s = pe();
471
+ return /* @__PURE__ */ u(ue, { children: [
472
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Me, {}) }),
473
+ /* @__PURE__ */ u("div", { className: "central-container w-full p-2 bg-white rounded-lg 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: [
474
+ /* @__PURE__ */ e(Pe, {}),
475
+ /* @__PURE__ */ e(Ue, {}),
476
+ /* @__PURE__ */ e(Oe, {}),
477
+ /* @__PURE__ */ u("div", { className: "flex", children: [
487
478
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
488
- Ae,
479
+ Le,
489
480
  {
490
481
  className: "align-middle w-full resize-none outline-none",
491
482
  maxRows: 4
@@ -500,30 +491,30 @@ const es = () => {
500
491
  disabled: !s,
501
492
  onClick: t,
502
493
  type: "button",
503
- children: /* @__PURE__ */ e(He, { className: "size-4" })
494
+ children: /* @__PURE__ */ e(Be, { className: "size-4" })
504
495
  }
505
496
  )
506
497
  ] })
507
498
  ] })
508
499
  ] });
509
- }, ss = ({
500
+ }, Ze = ({
510
501
  renderActions: t
511
- }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
502
+ }) => /* @__PURE__ */ u("div", { className: "message-input flex items-center gap-2 p-4", children: [
512
503
  t && (t == null ? void 0 : t()),
513
- /* @__PURE__ */ e(Me, { Input: es })
514
- ] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
504
+ /* @__PURE__ */ e(Te, { Input: Xe })
505
+ ] }), Ne = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
515
506
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
516
507
  /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
517
- ] }) }), ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
518
- var o, w, I, N, m;
519
- const { channel: a } = fe(), c = Y.useMemo(() => Object.values(a.state.members || {}).find(
508
+ ] }) }), Ke = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
509
+ var m, x, k, f, h;
510
+ const { channel: o } = me(), i = q.useMemo(() => Object.values(o.state.members || {}).find(
520
511
  (g) => {
521
- var b;
522
- return ((b = g.user) == null ? void 0 : b.id) && g.user.id !== a._client.userID;
512
+ var C;
513
+ return ((C = g.user) == null ? void 0 : C.id) && g.user.id !== o._client.userID;
523
514
  }
524
- ), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || "Unknown member", l = (I = c == null ? void 0 : c.user) == null ? void 0 : I.image;
525
- return /* @__PURE__ */ d("div", { className: "@container", children: [
526
- /* @__PURE__ */ d("div", { className: "flex justify-between items-center @md:hidden", children: [
515
+ ), [o._client.userID, o.state.members]), r = ((m = i == null ? void 0 : i.user) == null ? void 0 : m.name) || ((x = i == null ? void 0 : i.user) == null ? void 0 : x.id) || "Unknown member", a = (k = i == null ? void 0 : i.user) == null ? void 0 : k.image;
516
+ return /* @__PURE__ */ u("div", { className: "@container", children: [
517
+ /* @__PURE__ */ u("div", { className: "flex justify-between items-center @md:hidden", children: [
527
518
  /* @__PURE__ */ e(
528
519
  "button",
529
520
  {
@@ -533,20 +524,20 @@ const es = () => {
533
524
  ),
534
525
  onClick: t || (() => {
535
526
  }),
536
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
527
+ children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
537
528
  }
538
529
  ),
539
- /* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
530
+ /* @__PURE__ */ u("div", { className: "flex flex-col gap-1 items-center", children: [
540
531
  /* @__PURE__ */ e(
541
- J,
532
+ Y,
542
533
  {
543
- id: ((N = c == null ? void 0 : c.user) == null ? void 0 : N.id) || a.id || "unknown",
544
- name: i,
545
- image: l,
534
+ id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || o.id || "unknown",
535
+ name: r,
536
+ image: a,
546
537
  size: 40
547
538
  }
548
539
  ),
549
- /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: i })
540
+ /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: r })
550
541
  ] }),
551
542
  /* @__PURE__ */ e(
552
543
  "button",
@@ -556,12 +547,12 @@ const es = () => {
556
547
  ),
557
548
  onClick: n || (() => {
558
549
  }),
559
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
550
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
560
551
  }
561
552
  )
562
553
  ] }),
563
- /* @__PURE__ */ d("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
564
- /* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
554
+ /* @__PURE__ */ u("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
555
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-4 min-w-0", children: [
565
556
  s && t && /* @__PURE__ */ e(
566
557
  "button",
567
558
  {
@@ -569,106 +560,106 @@ const es = () => {
569
560
  onClick: t,
570
561
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
571
562
  "aria-label": "Back to conversations",
572
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
563
+ children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
573
564
  }
574
565
  ),
575
566
  /* @__PURE__ */ e(
576
- J,
567
+ Y,
577
568
  {
578
- id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || a.id || "unknown",
579
- name: i,
580
- image: l,
569
+ id: ((h = i == null ? void 0 : i.user) == null ? void 0 : h.id) || o.id || "unknown",
570
+ name: r,
571
+ image: a,
581
572
  size: 40
582
573
  }
583
574
  ),
584
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: i }) })
575
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: r }) })
585
576
  ] }),
586
- r && n && /* @__PURE__ */ e(
577
+ l && n && /* @__PURE__ */ e(
587
578
  "button",
588
579
  {
589
580
  className: R(
590
581
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
591
582
  ),
592
583
  onClick: n,
593
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
584
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
594
585
  }
595
586
  )
596
587
  ] })
597
588
  ] });
598
- }, ts = ({
589
+ }, es = ({
599
590
  isOpen: t,
600
591
  onClose: s,
601
592
  participant: n,
602
- channel: r,
603
- followerStatusLabel: a,
604
- onLeaveConversation: c,
605
- onBlockParticipant: i
593
+ channel: l,
594
+ followerStatusLabel: o,
595
+ onLeaveConversation: i,
596
+ onBlockParticipant: r
606
597
  }) => {
607
- var _, O, W, Q, G, V, X;
608
- const { service: l, debug: o } = ne(), w = $(null), [I, N] = y(!1), [m, S] = y(!1), [g, b] = y(!1);
609
- H(() => {
610
- const k = w.current;
611
- k && (t ? k.showModal() : k.close());
598
+ var W, _, G, J, H, V, Q;
599
+ const { service: a, debug: m } = se(), x = z(null), [k, f] = E(!1), [h, I] = E(!1), [g, C] = E(!1);
600
+ $(() => {
601
+ const T = x.current;
602
+ T && (t ? T.showModal() : T.close());
612
603
  }, [t]);
613
- const E = P(async () => {
614
- var k;
615
- if (!(!l || !((k = n == null ? void 0 : n.user) != null && k.id)))
604
+ const w = M(async () => {
605
+ var T;
606
+ if (!(!a || !((T = n == null ? void 0 : n.user) != null && T.id)))
616
607
  try {
617
- const A = (await l.getBlockedUsers()).some(
618
- (j) => {
619
- var B;
620
- return j.blocked_user_id === ((B = n == null ? void 0 : n.user) == null ? void 0 : B.id);
608
+ const U = (await a.getBlockedUsers()).some(
609
+ (O) => {
610
+ var X;
611
+ return O.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
621
612
  }
622
613
  );
623
- N(A);
624
- } catch (M) {
614
+ f(U);
615
+ } catch (P) {
625
616
  console.error(
626
617
  "[ChannelInfoDialog] Failed to check blocked status:",
627
- M
618
+ P
628
619
  );
629
620
  }
630
- }, [l, (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id]);
631
- H(() => {
632
- t && E();
633
- }, [t, E]);
621
+ }, [a, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
622
+ $(() => {
623
+ t && w();
624
+ }, [t, w]);
634
625
  const v = async () => {
635
- var k;
636
- if (!m) {
637
- o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
626
+ var T;
627
+ if (!h) {
628
+ m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), I(!0);
638
629
  try {
639
- const M = ((k = r._client) == null ? void 0 : k.userID) ?? null;
640
- await r.hide(M, !1), c && await c(r), s();
641
- } catch (M) {
642
- console.error("[ChannelInfoDialog] Failed to leave conversation", M);
630
+ const P = ((T = l._client) == null ? void 0 : T.userID) ?? null;
631
+ await l.hide(P, !1), i && await i(l), s();
632
+ } catch (P) {
633
+ console.error("[ChannelInfoDialog] Failed to leave conversation", P);
643
634
  } finally {
644
- S(!1);
635
+ I(!1);
645
636
  }
646
637
  }
647
- }, F = async () => {
648
- var k, M, A;
649
- if (!(g || !l)) {
650
- o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
638
+ }, y = async () => {
639
+ var T, P, U;
640
+ if (!(g || !a)) {
641
+ m && console.log("[ChannelInfoDialog] Block member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
651
642
  try {
652
- await l.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
653
- } catch (j) {
654
- console.error("[ChannelInfoDialog] Failed to block member", j);
643
+ await a.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
644
+ } catch (O) {
645
+ console.error("[ChannelInfoDialog] Failed to block member", O);
655
646
  } finally {
656
- b(!1);
647
+ C(!1);
657
648
  }
658
649
  }
659
- }, C = async () => {
660
- var k, M, A;
661
- if (!(g || !l)) {
662
- o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
650
+ }, S = async () => {
651
+ var T, P, U;
652
+ if (!(g || !a)) {
653
+ m && console.log("[ChannelInfoDialog] Unblock member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
663
654
  try {
664
- await l.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
665
- } catch (j) {
666
- console.error("[ChannelInfoDialog] Failed to unblock member", j);
655
+ await a.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
656
+ } catch (O) {
657
+ console.error("[ChannelInfoDialog] Failed to unblock member", O);
667
658
  } finally {
668
- b(!1);
659
+ C(!1);
669
660
  }
670
661
  }
671
- }, T = () => {
662
+ }, F = () => {
672
663
  s(), window.open(
673
664
  "https://linktr.ee/s/about/trust-center/report",
674
665
  "_blank",
@@ -676,99 +667,99 @@ const es = () => {
676
667
  );
677
668
  };
678
669
  if (!n) return null;
679
- const p = ((O = n.user) == null ? void 0 : O.name) || ((W = n.user) == null ? void 0 : W.id) || "Unknown member", u = (Q = n.user) == null ? void 0 : Q.image, f = (G = n.user) == null ? void 0 : G.email, x = (V = n.user) == null ? void 0 : V.username, D = f || (x ? `linktr.ee/${x}` : void 0), q = ((X = n.user) == null ? void 0 : X.id) || "unknown";
670
+ const D = ((_ = n.user) == null ? void 0 : _.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", c = (J = n.user) == null ? void 0 : J.image, d = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = d || (N ? `linktr.ee/${N}` : void 0), A = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
680
671
  return (
681
672
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
682
673
  /* @__PURE__ */ e(
683
674
  "dialog",
684
675
  {
685
- ref: w,
676
+ ref: x,
686
677
  className: "mes-dialog",
687
678
  onClose: s,
688
- onClick: (k) => {
689
- k.target === w.current && s();
679
+ onClick: (T) => {
680
+ T.target === x.current && s();
690
681
  },
691
- children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
692
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
682
+ children: /* @__PURE__ */ u("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
683
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
693
684
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
694
- /* @__PURE__ */ e(Ne, { onClick: s })
685
+ /* @__PURE__ */ e(xe, { onClick: s })
695
686
  ] }),
696
- /* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
687
+ /* @__PURE__ */ u("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
697
688
  /* @__PURE__ */ e(
698
689
  "div",
699
690
  {
700
691
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
701
692
  style: { backgroundColor: "#FBFAF9" },
702
- children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
693
+ children: /* @__PURE__ */ u("div", { className: "flex items-center gap-3 w-full", children: [
703
694
  /* @__PURE__ */ e(
704
- J,
695
+ Y,
705
696
  {
706
- id: q,
707
- name: p,
708
- image: u,
697
+ id: A,
698
+ name: D,
699
+ image: c,
709
700
  size: 88,
710
701
  shape: "circle"
711
702
  }
712
703
  ),
713
- /* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
714
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: p }),
715
- D && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: D }),
716
- a && /* @__PURE__ */ e(
704
+ /* @__PURE__ */ u("div", { className: "flex flex-col min-w-0 flex-1", children: [
705
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: D }),
706
+ j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
707
+ o && /* @__PURE__ */ e(
717
708
  "span",
718
709
  {
719
710
  className: "mt-1 rounded-full text-xs font-normal w-fit",
720
711
  style: {
721
712
  padding: "4px 8px",
722
- backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
723
- color: a === "Subscribed to you" ? "#008236" : "#78716C",
713
+ backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
714
+ color: o === "Subscribed to you" ? "#008236" : "#78716C",
724
715
  lineHeight: "133.333%",
725
716
  letterSpacing: "0.21px"
726
717
  },
727
- children: a
718
+ children: o
728
719
  }
729
720
  )
730
721
  ] })
731
722
  ] })
732
723
  }
733
724
  ),
734
- /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
735
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
725
+ /* @__PURE__ */ u("ul", { className: "flex flex-col gap-2 mt-2", children: [
726
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(
736
727
  K,
737
728
  {
738
729
  onClick: v,
739
- disabled: m,
740
- "aria-busy": m,
730
+ disabled: h,
731
+ "aria-busy": h,
741
732
  children: [
742
- m ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ge, { className: "h-5 w-5" }),
733
+ h ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "h-5 w-5" }),
743
734
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
744
735
  ]
745
736
  }
746
737
  ) }),
747
- /* @__PURE__ */ e("li", { children: I ? /* @__PURE__ */ d(
738
+ /* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ u(
748
739
  K,
749
740
  {
750
- onClick: C,
741
+ onClick: S,
751
742
  disabled: g,
752
743
  "aria-busy": g,
753
744
  children: [
754
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
745
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
755
746
  /* @__PURE__ */ e("span", { children: "Unblock" })
756
747
  ]
757
748
  }
758
- ) : /* @__PURE__ */ d(
749
+ ) : /* @__PURE__ */ u(
759
750
  K,
760
751
  {
761
- onClick: F,
752
+ onClick: y,
762
753
  disabled: g,
763
754
  "aria-busy": g,
764
755
  children: [
765
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
756
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
766
757
  /* @__PURE__ */ e("span", { children: "Block" })
767
758
  ]
768
759
  }
769
760
  ) }),
770
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
771
- /* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
761
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(K, { variant: "danger", onClick: F, children: [
762
+ /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
772
763
  /* @__PURE__ */ e("span", { children: "Report" })
773
764
  ] }) })
774
765
  ] })
@@ -777,107 +768,107 @@ const es = () => {
777
768
  }
778
769
  )
779
770
  );
780
- }, rs = ({
771
+ }, ss = ({
781
772
  onBack: t,
782
773
  showBackButton: s,
783
774
  renderMessageInputActions: n,
784
- onLeaveConversation: r,
785
- onBlockParticipant: a,
786
- CustomChannelEmptyState: c = be
775
+ onLeaveConversation: l,
776
+ onBlockParticipant: o,
777
+ CustomChannelEmptyState: i = Ne
787
778
  }) => {
788
- var m, S;
789
- const { channel: i } = fe(), [l, o] = y(!1), w = (((S = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : S.length) ?? 0) > 0, I = Y.useMemo(() => Object.values(i.state.members || {}).find(
790
- (b) => {
791
- var E;
792
- return ((E = b.user) == null ? void 0 : E.id) && b.user.id !== i._client.userID;
779
+ var h, I;
780
+ const { channel: r } = me(), [a, m] = E(!1), x = (((I = (h = r == null ? void 0 : r.state) == null ? void 0 : h.messages) == null ? void 0 : I.length) ?? 0) > 0, k = q.useMemo(() => Object.values(r.state.members || {}).find(
781
+ (C) => {
782
+ var w;
783
+ return ((w = C.user) == null ? void 0 : w.id) && C.user.id !== r._client.userID;
793
784
  }
794
- ), [i._client.userID, i.state.members]), N = Y.useMemo(() => {
795
- const g = i.data ?? {};
785
+ ), [r._client.userID, r.state.members]), f = q.useMemo(() => {
786
+ const g = r.data ?? {};
796
787
  if (g.followerStatus)
797
788
  return String(g.followerStatus);
798
789
  if (g.isFollower !== void 0)
799
790
  return g.isFollower ? "Subscribed to you" : "Not subscribed";
800
- }, [i.data]);
801
- return /* @__PURE__ */ d(se, { children: [
802
- /* @__PURE__ */ d(ze, { children: [
791
+ }, [r.data]);
792
+ return /* @__PURE__ */ u(ue, { children: [
793
+ /* @__PURE__ */ u(je, { children: [
803
794
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
804
- ns,
795
+ Ke,
805
796
  {
806
797
  onBack: t,
807
798
  showBackButton: s,
808
- onShowInfo: () => o(!0),
809
- canShowInfo: !!I
799
+ onShowInfo: () => m(!0),
800
+ canShowInfo: !!k
810
801
  }
811
802
  ) }),
812
- /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
803
+ /* @__PURE__ */ u("div", { className: "flex-1 overflow-hidden relative", children: [
813
804
  /* @__PURE__ */ e(
814
- $e,
805
+ Ae,
815
806
  {
816
807
  hideDeletedMessages: !0,
817
808
  hideNewMessageSeparator: !1,
818
809
  messageActions: []
819
810
  }
820
811
  ),
821
- !w && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(c, {}) })
812
+ !x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
822
813
  ] }),
823
814
  /* @__PURE__ */ e(
824
- ss,
815
+ Ze,
825
816
  {
826
- renderActions: () => n == null ? void 0 : n(i)
817
+ renderActions: () => n == null ? void 0 : n(r)
827
818
  }
828
819
  )
829
820
  ] }),
830
821
  /* @__PURE__ */ e(
831
- ts,
822
+ es,
832
823
  {
833
- isOpen: l,
834
- onClose: () => o(!1),
835
- participant: I,
836
- channel: i,
837
- followerStatusLabel: N,
838
- onLeaveConversation: r,
839
- onBlockParticipant: a
824
+ isOpen: a,
825
+ onClose: () => m(!1),
826
+ participant: k,
827
+ channel: r,
828
+ followerStatusLabel: f,
829
+ onLeaveConversation: l,
830
+ onBlockParticipant: o
840
831
  }
841
832
  )
842
833
  ] });
843
- }, ls = ({
834
+ }, ns = ({
844
835
  channel: t,
845
836
  onBack: s,
846
837
  showBackButton: n = !1,
847
- renderMessageInputActions: r,
848
- onLeaveConversation: a,
849
- onBlockParticipant: c,
850
- className: i,
851
- CustomChannelEmptyState: l = be
838
+ renderMessageInputActions: l,
839
+ onLeaveConversation: o,
840
+ onBlockParticipant: i,
841
+ className: r,
842
+ CustomChannelEmptyState: a = Ne
852
843
  }) => /* @__PURE__ */ e(
853
844
  "div",
854
845
  {
855
846
  className: R(
856
847
  "messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
857
- i
848
+ r
858
849
  ),
859
- children: /* @__PURE__ */ e(Be, { channel: t, children: /* @__PURE__ */ e(
860
- rs,
850
+ children: /* @__PURE__ */ e(_e, { channel: t, children: /* @__PURE__ */ e(
851
+ ss,
861
852
  {
862
853
  onBack: s,
863
854
  showBackButton: n,
864
- renderMessageInputActions: r,
865
- onLeaveConversation: a,
866
- onBlockParticipant: c,
867
- CustomChannelEmptyState: l
855
+ renderMessageInputActions: l,
856
+ onLeaveConversation: o,
857
+ onBlockParticipant: i,
858
+ CustomChannelEmptyState: a
868
859
  }
869
860
  ) })
870
861
  }
871
862
  );
872
- function os({
863
+ function ts({
873
864
  searchQuery: t,
874
865
  setSearchQuery: s,
875
866
  placeholder: n
876
867
  }) {
877
- const r = $(null);
878
- return /* @__PURE__ */ d("div", { className: "relative", children: [
868
+ const l = z(null);
869
+ return /* @__PURE__ */ u("div", { className: "relative", children: [
879
870
  /* @__PURE__ */ e(
880
- We,
871
+ He,
881
872
  {
882
873
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
883
874
  weight: "bold"
@@ -886,196 +877,170 @@ function os({
886
877
  /* @__PURE__ */ e(
887
878
  "input",
888
879
  {
889
- ref: r,
880
+ ref: l,
890
881
  type: "text",
891
882
  placeholder: n,
892
883
  value: t,
893
- onChange: (a) => s(a.target.value),
884
+ onChange: (o) => s(o.target.value),
894
885
  className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
895
886
  }
896
887
  ),
897
888
  t && /* @__PURE__ */ e(
898
- xe,
889
+ ge,
899
890
  {
900
891
  label: "Clear search",
901
892
  onClick: () => {
902
- var a;
903
- s(""), (a = r.current) == null || a.focus();
893
+ var o;
894
+ s(""), (o = l.current) == null || o.focus();
904
895
  },
905
896
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
906
- children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
897
+ children: /* @__PURE__ */ e(fe, { className: "h-4 w-4", weight: "bold" })
907
898
  }
908
899
  )
909
900
  ] });
910
901
  }
911
- const as = ({
902
+ const rs = ({
912
903
  participantSource: t,
913
904
  onSelectParticipant: s,
914
905
  onClose: n,
915
- existingParticipantIds: r = /* @__PURE__ */ new Set(),
916
- participantLabel: a = "participants",
917
- searchPlaceholder: c = "Search participants...",
918
- className: i
906
+ existingParticipantIds: l = /* @__PURE__ */ new Set(),
907
+ participantLabel: o = "participants",
908
+ searchPlaceholder: i = "Search participants...",
909
+ className: r
919
910
  }) => {
920
- const { debug: l } = ne(), [o, w] = y(""), [I, N] = y([]), [m, S] = y(!1), [g, b] = y(null), [E, v] = y(
911
+ const { debug: a } = se(), [m, x] = E(""), [k, f] = E([]), [h, I] = E(!1), [g, C] = E(null), [w, v] = E(
921
912
  null
922
- ), F = $(!1);
923
- H(() => {
913
+ ), y = z(!1);
914
+ $(() => {
924
915
  if (t.loading) {
925
- l && console.log(
916
+ a && console.log(
926
917
  "[ParticipantPicker] Waiting for participant source to finish loading..."
927
918
  );
928
919
  return;
929
920
  }
930
- if (F.current) return;
921
+ if (y.current) return;
931
922
  (async () => {
932
- l && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), b(null);
923
+ a && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), C(null);
933
924
  try {
934
- const f = await t.loadParticipants({
925
+ const d = await t.loadParticipants({
935
926
  search: "",
936
927
  // Load all participants initially
937
928
  limit: 100
938
929
  });
939
- N(f.participants), F.current = !0, l && console.log(
930
+ f(d.participants), y.current = !0, a && console.log(
940
931
  "[ParticipantPicker] Participants loaded successfully:",
941
- f.participants.length
932
+ d.participants.length
942
933
  );
943
- } catch (f) {
944
- const x = f instanceof Error ? f.message : "Failed to load participants";
945
- b(x), console.error("[ParticipantPicker] Failed to load participants:", f);
934
+ } catch (d) {
935
+ const N = d instanceof Error ? d.message : "Failed to load participants";
936
+ C(N), console.error("[ParticipantPicker] Failed to load participants:", d);
946
937
  } finally {
947
- S(!1);
938
+ I(!1);
948
939
  }
949
940
  })();
950
- }, [t.loading, l]);
951
- const C = I.filter((u) => !r.has(u.id)).filter((u) => {
952
- var x;
953
- if (!o) return !0;
954
- const f = o.toLowerCase();
955
- return u.name.toLowerCase().includes(f) || ((x = u.email) == null ? void 0 : x.toLowerCase().includes(f)) || !1;
956
- }), T = P(
957
- async (u) => {
958
- if (!E) {
959
- v(u.id);
941
+ }, [t.loading, a]);
942
+ const S = k.filter((c) => !l.has(c.id)).filter((c) => {
943
+ var N;
944
+ if (!m) return !0;
945
+ const d = m.toLowerCase();
946
+ return c.name.toLowerCase().includes(d) || ((N = c.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
947
+ }), F = M(
948
+ async (c) => {
949
+ if (!w) {
950
+ v(c.id);
960
951
  try {
961
- await s(u);
962
- } catch (f) {
963
- console.error("[ParticipantPicker] Failed to start chat:", f), v(null);
952
+ await s(c);
953
+ } catch (d) {
954
+ console.error("[ParticipantPicker] Failed to start chat:", d), v(null);
964
955
  }
965
956
  }
966
957
  },
967
- [s, E]
968
- ), p = (u, f) => {
969
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), T(f));
958
+ [s, w]
959
+ ), D = (c, d) => {
960
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), F(d));
970
961
  };
971
- return /* @__PURE__ */ d("div", { className: R("flex flex-col h-full", i), children: [
972
- /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
973
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
962
+ return /* @__PURE__ */ u("div", { className: R("flex flex-col h-full", r), children: [
963
+ /* @__PURE__ */ u("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
964
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-3", children: [
974
965
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
975
- /* @__PURE__ */ e(Ne, { onClick: n })
966
+ /* @__PURE__ */ e(xe, { onClick: n })
976
967
  ] }),
977
- /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
968
+ /* @__PURE__ */ u("p", { className: "text-xs text-stone mb-3", children: [
978
969
  "Select a ",
979
- a.slice(0, -1),
970
+ o.slice(0, -1),
980
971
  " to start messaging (",
981
- C.length,
972
+ S.length,
982
973
  " available)",
983
- t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
974
+ t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
984
975
  ] }),
985
976
  /* @__PURE__ */ e(
986
- os,
977
+ ts,
987
978
  {
988
- searchQuery: o,
989
- setSearchQuery: w,
990
- placeholder: c
979
+ searchQuery: m,
980
+ setSearchQuery: x,
981
+ placeholder: i
991
982
  }
992
983
  )
993
984
  ] }),
994
- g && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
985
+ g && /* @__PURE__ */ u("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
995
986
  "Error loading ",
996
- a,
987
+ o,
997
988
  ": ",
998
989
  g
999
990
  ] }),
1000
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
991
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: h && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1001
992
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1002
- /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
993
+ /* @__PURE__ */ u("span", { className: "text-sm text-stone", children: [
1003
994
  "Loading ",
1004
- a,
995
+ o,
1005
996
  "..."
1006
997
  ] })
1007
- ] }) }) : C.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
1008
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
1009
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : I.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1010
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : I.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1011
- ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
1012
- C.map((u) => {
1013
- const f = u.name || u.email || u.id, x = u.email && u.name ? u.email : u.phone;
998
+ ] }) }) : S.length === 0 ? /* @__PURE__ */ u("div", { className: "p-6 text-center", children: [
999
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ce, { className: "h-8 w-8 text-charcoal" }) }),
1000
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` : k.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1001
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1002
+ ] }) : /* @__PURE__ */ u("ul", { className: "space-y-0", children: [
1003
+ S.map((c) => {
1004
+ const d = c.name || c.email || c.id, N = c.email && c.name ? c.email : c.phone;
1014
1005
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1015
1006
  "button",
1016
1007
  {
1017
1008
  type: "button",
1018
- onClick: () => T(u),
1019
- onKeyDown: (D) => p(D, u),
1009
+ onClick: () => F(c),
1010
+ onKeyDown: (j) => D(j, c),
1020
1011
  className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
1021
- children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
1022
- /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1012
+ children: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
1013
+ /* @__PURE__ */ u("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1023
1014
  /* @__PURE__ */ e(
1024
- J,
1015
+ Y,
1025
1016
  {
1026
- id: u.id,
1027
- name: f,
1028
- image: u.image,
1017
+ id: c.id,
1018
+ name: d,
1019
+ image: c.image,
1029
1020
  size: 40
1030
1021
  }
1031
1022
  ),
1032
- /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
1033
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: f }),
1034
- x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1023
+ /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
1024
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1025
+ N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
1035
1026
  ] })
1036
1027
  ] }),
1037
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === u.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
1028
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === c.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
1038
1029
  ] })
1039
1030
  }
1040
- ) }, u.id);
1031
+ ) }, c.id);
1041
1032
  }),
1042
- m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
1033
+ h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1043
1034
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1044
1035
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1045
1036
  ] }) })
1046
1037
  ] }) })
1047
1038
  ] });
1048
- }, is = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1039
+ }, ls = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1049
1040
  /* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "💬" }) }),
1050
1041
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
1051
- /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(se, { children: [
1052
- "Choose a conversation from the list or",
1053
- " ",
1054
- s && /* @__PURE__ */ d(me, { onClick: s, children: [
1055
- "start a new conversation with a ",
1056
- n.slice(0, -1),
1057
- "."
1058
- ] })
1059
- ] }) : s && /* @__PURE__ */ d(se, { children: [
1060
- /* @__PURE__ */ d(me, { onClick: s, children: [
1061
- "Start a new conversation with one of your ",
1062
- n
1063
- ] }),
1064
- " ",
1065
- "to begin messaging."
1066
- ] }) })
1067
- ] }) }), me = ({
1068
- onClick: t,
1069
- children: s
1070
- }) => /* @__PURE__ */ e(
1071
- "button",
1072
- {
1073
- type: "button",
1074
- onClick: t,
1075
- className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
1076
- children: s
1077
- }
1078
- ), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1042
+ /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? "Choose a conversation from the list." : "No conversations yet." })
1043
+ ] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1079
1044
  /* @__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: "⚠️" }) }),
1080
1045
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1081
1046
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1088,12 +1053,12 @@ const as = ({
1088
1053
  children: "Go Back"
1089
1054
  }
1090
1055
  )
1091
- ] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */ d(
1056
+ ] }) }), os = ({ className: t, message: s }) => /* @__PURE__ */ u(
1092
1057
  "div",
1093
1058
  {
1094
1059
  className: R("flex items-center justify-center h-full", t),
1095
1060
  children: [
1096
- /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1061
+ /* @__PURE__ */ u("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1097
1062
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1098
1063
  "animateTransform",
1099
1064
  {
@@ -1131,205 +1096,198 @@ const as = ({
1131
1096
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1132
1097
  ]
1133
1098
  }
1134
- ), ds = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1135
- /* @__PURE__ */ e(cs, { className: "w-6 h-6" }),
1099
+ ), as = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ u("div", { className: "flex items-center", children: [
1100
+ /* @__PURE__ */ e(os, { className: "w-6 h-6" }),
1136
1101
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1137
- ] }) }), vs = ({
1102
+ ] }) }), xs = ({
1138
1103
  capabilities: t = {},
1139
1104
  className: s,
1140
1105
  renderMessageInputActions: n,
1141
- onChannelSelect: r,
1142
- onParticipantSelect: a,
1143
- initialParticipantFilter: c,
1144
- initialParticipantData: i,
1145
- CustomChannelEmptyState: l,
1146
- showChannelList: o = !0,
1147
- filters: w,
1148
- channelListCustomEmptyStateIndicator: I
1106
+ onChannelSelect: l,
1107
+ onParticipantSelect: o,
1108
+ initialParticipantFilter: i,
1109
+ initialParticipantData: r,
1110
+ CustomChannelEmptyState: a,
1111
+ showChannelList: m = !0,
1112
+ filters: x,
1113
+ channelListCustomEmptyStateIndicator: k
1149
1114
  }) => {
1150
1115
  const {
1151
- service: N,
1152
- client: m,
1153
- isConnected: S,
1116
+ service: f,
1117
+ client: h,
1118
+ isConnected: I,
1154
1119
  isLoading: g,
1155
- error: b,
1156
- refreshConnection: E,
1120
+ error: C,
1121
+ refreshConnection: w,
1157
1122
  debug: v
1158
- } = qe(), [F, C] = y(null), [T, p] = y(!1), [u, f] = y(!1), [x, D] = y(/* @__PURE__ */ new Set()), [q, _] = y(0), [O, W] = y(!1), [Q, G] = y(null), V = $(null), {
1159
- showStartConversation: X = !1,
1160
- participantSource: k,
1161
- participantLabel: M = "participants"
1162
- } = t, A = Y.useMemo(() => {
1163
- const h = m == null ? void 0 : m.userID;
1123
+ } = Ge(), [y, S] = E(null), [F, D] = E(!1), [c, d] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [_, G] = E(!1), [J, H] = E(null), V = z(null), { participantSource: Q, participantLabel: T = "participants" } = t, P = q.useMemo(() => {
1124
+ const b = h == null ? void 0 : h.userID;
1164
1125
  return {
1165
1126
  ...{
1166
1127
  type: "messaging",
1167
1128
  last_message_at: { $exists: !0 },
1168
- ...h && {
1169
- members: { $in: [h] },
1129
+ ...b && {
1130
+ members: { $in: [b] },
1170
1131
  hidden: !1
1171
1132
  }
1172
1133
  },
1173
- ...w
1134
+ ...x
1174
1135
  };
1175
- }, [w, m == null ? void 0 : m.userID]), j = $(null), B = P(async () => {
1176
- if (!m || !S) return;
1177
- const h = m.userID;
1178
- if (h)
1136
+ }, [x, h == null ? void 0 : h.userID]), U = z(null), O = M(async () => {
1137
+ if (!h || !I) return;
1138
+ const b = h.userID;
1139
+ if (b)
1179
1140
  try {
1180
- v && console.log("[MessagingShell] Syncing channels for user:", h);
1181
- const L = await m.queryChannels(
1141
+ v && console.log("[MessagingShell] Syncing channels for user:", b);
1142
+ const L = await h.queryChannels(
1182
1143
  {
1183
1144
  type: "messaging",
1184
- members: { $in: [h] }
1145
+ members: { $in: [b] }
1185
1146
  },
1186
1147
  {},
1187
1148
  { limit: 100 }
1188
- ), U = /* @__PURE__ */ new Set();
1189
- L.forEach((z) => {
1190
- const Se = z.state.members;
1191
- Object.values(Se).forEach((ke) => {
1192
- var oe;
1193
- const re = (oe = ke.user) == null ? void 0 : oe.id;
1194
- re && re !== h && U.add(re);
1149
+ ), p = /* @__PURE__ */ new Set();
1150
+ L.forEach((B) => {
1151
+ const Ee = B.state.members;
1152
+ Object.values(Ee).forEach((Ie) => {
1153
+ var le;
1154
+ const te = (le = Ie.user) == null ? void 0 : le.id;
1155
+ te && te !== b && p.add(te);
1195
1156
  });
1196
- }), D(U), p(L.length > 0), j.current = h, v && console.log("[MessagingShell] Channels synced successfully:", {
1157
+ }), j(p), D(L.length > 0), U.current = b, v && console.log("[MessagingShell] Channels synced successfully:", {
1197
1158
  channelCount: L.length,
1198
- memberCount: U.size
1159
+ memberCount: p.size
1199
1160
  });
1200
1161
  } catch (L) {
1201
1162
  console.error("[MessagingShell] Failed to sync channels:", L);
1202
1163
  }
1203
- }, [m, S, v]);
1204
- H(() => {
1205
- if (!m || !S) return;
1206
- const h = m.userID;
1207
- h && j.current !== h && B();
1208
- }, [m, S, B]), H(() => {
1209
- if (!c || !m || !S) return;
1164
+ }, [h, I, v]);
1165
+ $(() => {
1166
+ if (!h || !I) return;
1167
+ const b = h.userID;
1168
+ b && U.current !== b && O();
1169
+ }, [h, I, O]), $(() => {
1170
+ if (!i || !h || !I) return;
1210
1171
  (async () => {
1211
- const L = m.userID;
1172
+ const L = h.userID;
1212
1173
  if (L)
1213
1174
  try {
1214
1175
  v && console.log(
1215
1176
  "[MessagingShell] Loading initial conversation with:",
1216
- c
1177
+ i
1217
1178
  );
1218
- const U = await m.queryChannels(
1179
+ const p = await h.queryChannels(
1219
1180
  {
1220
1181
  type: "messaging",
1221
- members: { $eq: [L, c] }
1182
+ members: { $eq: [L, i] }
1222
1183
  },
1223
1184
  {},
1224
1185
  { limit: 1 }
1225
1186
  );
1226
- if (U.length > 0)
1227
- C(U[0]), W(!0), G(null), r && r(U[0]), v && console.log(
1187
+ if (p.length > 0)
1188
+ S(p[0]), G(!0), H(null), l && l(p[0]), v && console.log(
1228
1189
  "[MessagingShell] Initial conversation loaded:",
1229
- U[0].id
1190
+ p[0].id
1230
1191
  );
1231
- else if (i && N) {
1192
+ else if (r && f) {
1232
1193
  v && console.log(
1233
1194
  "[MessagingShell] No conversation found, creating one for:",
1234
- i
1195
+ r
1235
1196
  );
1236
1197
  try {
1237
- const z = await N.startChannelWithParticipant({
1238
- id: i.id,
1239
- name: i.name,
1240
- email: i.email,
1241
- phone: i.phone
1198
+ const B = await f.startChannelWithParticipant({
1199
+ id: r.id,
1200
+ name: r.name,
1201
+ email: r.email,
1202
+ phone: r.phone
1242
1203
  });
1243
- C(z), W(!0), G(null), r && r(z), v && console.log(
1204
+ S(B), G(!0), H(null), l && l(B), v && console.log(
1244
1205
  "[MessagingShell] Channel created and loaded:",
1245
- z.id
1206
+ B.id
1246
1207
  );
1247
- } catch (z) {
1208
+ } catch (B) {
1248
1209
  console.error(
1249
1210
  "[MessagingShell] Failed to create conversation:",
1250
- z
1251
- ), G("Failed to create conversation");
1211
+ B
1212
+ ), H("Failed to create conversation");
1252
1213
  }
1253
1214
  } else
1254
- G(
1215
+ H(
1255
1216
  "No conversation found with this account"
1256
1217
  ), v && console.log(
1257
1218
  "[MessagingShell] No conversation found for:",
1258
- c
1219
+ i
1259
1220
  );
1260
- } catch (U) {
1221
+ } catch (p) {
1261
1222
  console.error(
1262
1223
  "[MessagingShell] Failed to load initial conversation:",
1263
- U
1264
- ), G("Failed to load conversation");
1224
+ p
1225
+ ), H("Failed to load conversation");
1265
1226
  }
1266
1227
  })();
1267
1228
  }, [
1268
- c,
1269
1229
  i,
1270
- m,
1271
- S,
1272
- N,
1230
+ r,
1231
+ h,
1232
+ I,
1233
+ f,
1273
1234
  v,
1274
- r
1235
+ l
1275
1236
  ]);
1276
- const ve = P(
1277
- (h) => {
1278
- C(h), r == null || r(h);
1237
+ const X = M(
1238
+ (b) => {
1239
+ S(b), l == null || l(b);
1279
1240
  },
1280
- [r]
1281
- ), Ce = P(() => {
1282
- O || C(null);
1283
- }, [O]), we = P(() => {
1284
- var h;
1285
- k && (_((L) => L + 1), f(!0), (h = V.current) == null || h.showModal());
1286
- }, [k]), Ee = P(
1287
- async (h) => {
1241
+ [l]
1242
+ ), be = M(() => {
1243
+ _ || S(null);
1244
+ }, [_]), ve = M(
1245
+ async (b) => {
1288
1246
  var L;
1289
- if (N)
1247
+ if (f)
1290
1248
  try {
1291
1249
  v && console.log(
1292
1250
  "[MessagingShell] Starting conversation with:",
1293
- h.id
1251
+ b.id
1294
1252
  );
1295
- const U = await N.startChannelWithParticipant({
1296
- id: h.id,
1297
- name: h.name,
1298
- email: h.email,
1299
- phone: h.phone
1253
+ const p = await f.startChannelWithParticipant({
1254
+ id: b.id,
1255
+ name: b.name,
1256
+ email: b.email,
1257
+ phone: b.phone
1300
1258
  });
1301
1259
  try {
1302
- await U.show();
1303
- } catch (z) {
1304
- console.warn("[MessagingShell] Failed to unhide channel:", z);
1260
+ await p.show();
1261
+ } catch (B) {
1262
+ console.warn("[MessagingShell] Failed to unhide channel:", B);
1305
1263
  }
1306
- C(U), f(!1), (L = V.current) == null || L.close(), a == null || a(h);
1307
- } catch (U) {
1308
- console.error("[MessagingShell] Failed to start conversation:", U);
1264
+ S(p), d(!1), (L = V.current) == null || L.close(), o == null || o(b);
1265
+ } catch (p) {
1266
+ console.error("[MessagingShell] Failed to start conversation:", p);
1309
1267
  }
1310
1268
  },
1311
- [N, a, v]
1312
- ), te = P(() => {
1313
- var h;
1314
- f(!1), (h = V.current) == null || h.close();
1315
- }, []), ye = P(
1316
- async (h) => {
1317
- v && console.log("[MessagingShell] Leaving conversation:", h.id), C(null), W(!1), j.current = null, await B();
1269
+ [f, o, v]
1270
+ ), ne = M(() => {
1271
+ var b;
1272
+ d(!1), (b = V.current) == null || b.close();
1273
+ }, []), Ce = M(
1274
+ async (b) => {
1275
+ v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1), U.current = null, await O();
1318
1276
  },
1319
- [B, v]
1320
- ), Ie = P(
1321
- async (h) => {
1322
- v && console.log("[MessagingShell] Blocking participant:", h), C(null), W(!1), j.current = null, await B();
1277
+ [O, v]
1278
+ ), we = M(
1279
+ async (b) => {
1280
+ v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1), U.current = null, await O();
1323
1281
  },
1324
- [B, v]
1325
- ), Z = !!F;
1326
- return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ds, {}) }) : b ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: b, onBack: E }) }) : !S || !m ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1327
- le,
1282
+ [O, v]
1283
+ ), Z = !!y;
1284
+ return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(as, {}) }) : C ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: C, onBack: w }) }) : !I || !h ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1285
+ re,
1328
1286
  {
1329
1287
  message: "Not connected to messaging service",
1330
- onBack: E
1288
+ onBack: w
1331
1289
  }
1332
- ) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */ d(
1290
+ ) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */ u(
1333
1291
  "div",
1334
1292
  {
1335
1293
  className: R(
@@ -1337,7 +1295,7 @@ const as = ({
1337
1295
  s
1338
1296
  ),
1339
1297
  children: [
1340
- /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1298
+ /* @__PURE__ */ u("div", { className: "flex h-full min-h-0", children: [
1341
1299
  /* @__PURE__ */ e(
1342
1300
  "div",
1343
1301
  {
@@ -1345,20 +1303,20 @@ const as = ({
1345
1303
  "messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
1346
1304
  {
1347
1305
  // Explicitly hidden via prop or in direct conversation mode
1348
- "!hidden": o === !1 || O,
1306
+ "!hidden": m === !1 || _,
1349
1307
  // Normal mode: hide on mobile when channel selected, show on desktop
1350
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !O && Z,
1308
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !_ && Z,
1351
1309
  // Normal mode: show when no channel selected
1352
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !O && !Z
1310
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !_ && !Z
1353
1311
  }
1354
1312
  ),
1355
1313
  children: /* @__PURE__ */ e(
1356
- Ke,
1314
+ Qe,
1357
1315
  {
1358
- onChannelSelect: ve,
1359
- selectedChannel: F || void 0,
1360
- filters: A,
1361
- customEmptyStateIndicator: I
1316
+ onChannelSelect: X,
1317
+ selectedChannel: y || void 0,
1318
+ filters: P,
1319
+ customEmptyStateIndicator: k
1362
1320
  }
1363
1321
  )
1364
1322
  }
@@ -1370,66 +1328,59 @@ const as = ({
1370
1328
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1371
1329
  {
1372
1330
  // In direct conversation mode, always show (full width)
1373
- flex: O || Z,
1331
+ flex: _ || Z,
1374
1332
  // Normal mode: hide on mobile when no channel selected
1375
- "hidden lg:flex": !O && !Z
1333
+ "hidden lg:flex": !_ && !Z
1376
1334
  }
1377
1335
  ),
1378
- children: F ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1379
- ls,
1336
+ children: y ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1337
+ ns,
1380
1338
  {
1381
- channel: F,
1382
- onBack: Ce,
1383
- showBackButton: !O,
1339
+ channel: y,
1340
+ onBack: be,
1341
+ showBackButton: !_,
1384
1342
  renderMessageInputActions: n,
1385
- onLeaveConversation: ye,
1386
- onBlockParticipant: Ie,
1387
- CustomChannelEmptyState: l
1343
+ onLeaveConversation: Ce,
1344
+ onBlockParticipant: we,
1345
+ CustomChannelEmptyState: a
1388
1346
  },
1389
- F.id
1390
- ) }) : /* @__PURE__ */ e(
1391
- is,
1392
- {
1393
- hasChannels: T,
1394
- onStartConversation: X ? we : void 0,
1395
- participantLabel: M
1396
- }
1397
- )
1347
+ y.id
1348
+ ) }) : /* @__PURE__ */ e(ls, { hasChannels: F })
1398
1349
  }
1399
1350
  )
1400
1351
  ] }),
1401
- k && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1352
+ Q && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1402
1353
  /* @__PURE__ */ e(
1403
1354
  "dialog",
1404
1355
  {
1405
1356
  ref: V,
1406
1357
  className: "mes-dialog",
1407
- onClick: (h) => {
1408
- h.target === V.current && te();
1358
+ onClick: (b) => {
1359
+ b.target === V.current && ne();
1409
1360
  },
1410
- onClose: te,
1361
+ onClose: ne,
1411
1362
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1412
- as,
1363
+ rs,
1413
1364
  {
1414
- participantSource: k,
1415
- onSelectParticipant: Ee,
1416
- onClose: te,
1417
- existingParticipantIds: x,
1418
- participantLabel: M,
1419
- searchPlaceholder: `Search ${M}...`
1365
+ participantSource: Q,
1366
+ onSelectParticipant: ve,
1367
+ onClose: ne,
1368
+ existingParticipantIds: N,
1369
+ participantLabel: T,
1370
+ searchPlaceholder: `Search ${T}...`
1420
1371
  },
1421
- q
1372
+ A
1422
1373
  ) })
1423
1374
  }
1424
1375
  )
1425
1376
  ]
1426
1377
  }
1427
1378
  );
1428
- }, us = ({
1379
+ }, is = ({
1429
1380
  question: t,
1430
1381
  onClick: s,
1431
1382
  loading: n = !1,
1432
- className: r
1383
+ className: l
1433
1384
  }) => /* @__PURE__ */ e(
1434
1385
  "button",
1435
1386
  {
@@ -1443,104 +1394,104 @@ const as = ({
1443
1394
  "hover:brightness-95 active:brightness-90": !n,
1444
1395
  "opacity-50 cursor-not-allowed": n
1445
1396
  },
1446
- r
1397
+ l
1447
1398
  ),
1448
1399
  children: t
1449
1400
  }
1450
- ), Cs = ({
1401
+ ), Ns = ({
1451
1402
  faqs: t,
1452
1403
  onFaqClick: s,
1453
1404
  loadingFaqId: n,
1454
- headerText: r,
1455
- className: a,
1456
- avatarImage: c,
1457
- avatarName: i
1405
+ headerText: l,
1406
+ className: o,
1407
+ avatarImage: i,
1408
+ avatarName: r
1458
1409
  }) => {
1459
- const l = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
1460
- return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1461
- (c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1462
- J,
1410
+ const a = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
1411
+ return a.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */ u("div", { className: "flex gap-3 items-end", children: [
1412
+ (i || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1413
+ Y,
1463
1414
  {
1464
- id: i || "account",
1465
- name: i || "Account",
1466
- image: c,
1415
+ id: r || "account",
1416
+ name: r || "Account",
1417
+ image: i,
1467
1418
  size: 24,
1468
1419
  shape: "circle"
1469
1420
  }
1470
1421
  ) }),
1471
- /* @__PURE__ */ d(
1422
+ /* @__PURE__ */ u(
1472
1423
  "div",
1473
1424
  {
1474
1425
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
1475
1426
  style: { backgroundColor: "#F1F0EE" },
1476
1427
  children: [
1477
- r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1478
- l.map((o) => /* @__PURE__ */ e(
1479
- us,
1428
+ l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1429
+ a.map((m) => /* @__PURE__ */ e(
1430
+ is,
1480
1431
  {
1481
- question: o.question,
1482
- onClick: () => s(o.id),
1483
- loading: n === o.id
1432
+ question: m.question,
1433
+ onClick: () => s(m.id),
1434
+ loading: n === m.id
1484
1435
  },
1485
- o.id
1436
+ m.id
1486
1437
  ))
1487
1438
  ]
1488
1439
  }
1489
1440
  )
1490
1441
  ] }) });
1491
- }, ws = (t, s = {}) => {
1492
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [i, l] = y(!1), [o, w] = y(null), [I, N] = y(n), [m, S] = y(!0), [g, b] = y(), E = P(async (T = !1, p) => {
1493
- if (i) return;
1494
- const u = p !== void 0 ? p : I;
1495
- l(!0), w(null);
1442
+ }, bs = (t, s = {}) => {
1443
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [o, i] = E([]), [r, a] = E(!1), [m, x] = E(null), [k, f] = E(n), [h, I] = E(!0), [g, C] = E(), w = M(async (F = !1, D) => {
1444
+ if (r) return;
1445
+ const c = D !== void 0 ? D : k;
1446
+ a(!0), x(null);
1496
1447
  try {
1497
- const f = await t.loadParticipants({
1498
- search: u || void 0,
1499
- limit: r,
1500
- cursor: T ? void 0 : g
1448
+ const d = await t.loadParticipants({
1449
+ search: c || void 0,
1450
+ limit: l,
1451
+ cursor: F ? void 0 : g
1501
1452
  });
1502
- c(
1503
- (x) => T ? f.participants : [...x, ...f.participants]
1504
- ), S(f.hasMore), b(f.nextCursor);
1505
- } catch (f) {
1506
- const x = f instanceof Error ? f.message : "Failed to load participants";
1507
- w(x), console.error("[useParticipants] Load error:", f);
1453
+ i(
1454
+ (N) => F ? d.participants : [...N, ...d.participants]
1455
+ ), I(d.hasMore), C(d.nextCursor);
1456
+ } catch (d) {
1457
+ const N = d instanceof Error ? d.message : "Failed to load participants";
1458
+ x(N), console.error("[useParticipants] Load error:", d);
1508
1459
  } finally {
1509
- l(!1);
1460
+ a(!1);
1510
1461
  }
1511
- }, [t, I, g, r, i]), v = P(() => {
1512
- m && !i && E(!1);
1513
- }, [m, i, E]), F = P((T) => {
1514
- N(T), b(void 0), E(!0, T);
1515
- }, [E]), C = P(() => {
1516
- b(void 0), E(!0);
1517
- }, [E]);
1518
- return H(() => {
1519
- E(!0);
1462
+ }, [t, k, g, l, r]), v = M(() => {
1463
+ h && !r && w(!1);
1464
+ }, [h, r, w]), y = M((F) => {
1465
+ f(F), C(void 0), w(!0, F);
1466
+ }, [w]), S = M(() => {
1467
+ C(void 0), w(!0);
1468
+ }, [w]);
1469
+ return $(() => {
1470
+ w(!0);
1520
1471
  }, [t.loadParticipants]), {
1521
- participants: a,
1522
- loading: i,
1523
- error: o,
1524
- searchQuery: I,
1525
- hasMore: m,
1472
+ participants: o,
1473
+ loading: r,
1474
+ error: m,
1475
+ searchQuery: k,
1476
+ hasMore: h,
1526
1477
  totalCount: t.totalCount,
1527
1478
  loadMore: v,
1528
- search: F,
1529
- refresh: C
1479
+ search: y,
1480
+ refresh: S
1530
1481
  };
1531
1482
  };
1532
1483
  export {
1533
- J as Avatar,
1534
- be as ChannelEmptyState,
1535
- Ke as ChannelList,
1536
- ls as ChannelView,
1537
- Cs as FaqList,
1538
- us as FaqListItem,
1539
- bs as MessagingProvider,
1540
- vs as MessagingShell,
1541
- as as ParticipantPicker,
1542
- Je as formatRelativeTime,
1543
- qe as useMessaging,
1544
- ws as useParticipants
1484
+ Y as Avatar,
1485
+ Ne as ChannelEmptyState,
1486
+ Qe as ChannelList,
1487
+ ns as ChannelView,
1488
+ Ns as FaqList,
1489
+ is as FaqListItem,
1490
+ gs as MessagingProvider,
1491
+ xs as MessagingShell,
1492
+ rs as ParticipantPicker,
1493
+ We as formatRelativeTime,
1494
+ Ge as useMessaging,
1495
+ bs as useParticipants
1545
1496
  };
1546
1497
  //# sourceMappingURL=index.js.map