@linktr.ee/messaging-react 1.6.0 โ†’ 1.6.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,6 +1,6 @@
1
- import { jsx as e, jsxs as c, Fragment as oe } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as oe } from "react/jsx-runtime";
2
2
  import D from "classnames";
3
- import X, { createContext as ve, useContext as we, useCallback as U, useState as I, useRef as H, useEffect as G } from "react";
3
+ import X, { createContext as ve, useContext as we, useCallback as U, useState as E, useRef as H, useEffect as G } from "react";
4
4
  import { StreamChatService as Ee } from "@linktr.ee/messaging-core";
5
5
  import { Chat as Ie, useChatContext as ye, ChannelList as Se, Channel as Re, useChannelStateContext as ue, Window as ke, MessageList as Te, MessageInput as Pe } from "stream-chat-react";
6
6
  import { NotePencilIcon as De, XIcon as me, ArrowLeftIcon as Me, DotsThreeIcon as Oe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Fe, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
@@ -20,50 +20,50 @@ const he = ve({
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: l,
23
- capabilities: a = {},
24
- customization: d = {},
25
- debug: i = !1
23
+ capabilities: i = {},
24
+ customization: c = {},
25
+ debug: a = !1
26
26
  }) => {
27
- const r = U(
28
- (v, ...M) => {
29
- i && console.log(`๐Ÿ”ฅ [MessagingProvider] ${v}`, ...M);
27
+ const o = U(
28
+ (w, ...M) => {
29
+ a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${w}`, ...M);
30
30
  },
31
- [i]
31
+ [a]
32
32
  );
33
- r("๐Ÿ”„ RENDER START", {
33
+ o("๐Ÿ”„ RENDER START", {
34
34
  userId: s == null ? void 0 : s.id,
35
35
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
36
36
  serviceConfig: !!n,
37
- capabilities: Object.keys(a),
38
- customization: Object.keys(d)
37
+ capabilities: Object.keys(i),
38
+ customization: Object.keys(c)
39
39
  });
40
- const [o, w] = I(null), [u, N] = I(null), [m, E] = I(!1), [x, h] = I(!1), [C, S] = I(null), O = H(!1), y = H({
40
+ const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null), O = H(!1), y = H({
41
41
  userId: s == null ? void 0 : s.id,
42
42
  apiKey: l,
43
43
  serviceConfig: n,
44
- capabilities: a,
45
- customization: d
44
+ capabilities: i,
45
+ customization: c
46
46
  }), k = H(0);
47
- k.current++, r("๐Ÿ“Š RENDER INFO", {
47
+ k.current++, o("๐Ÿ“Š RENDER INFO", {
48
48
  renderCount: k.current,
49
49
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
50
50
  propChanges: {
51
51
  userChanged: y.current.userId !== (s == null ? void 0 : s.id),
52
52
  apiKeyChanged: y.current.apiKey !== l,
53
53
  serviceConfigChanged: y.current.serviceConfig !== n,
54
- capabilitiesChanged: y.current.capabilities !== a,
55
- customizationChanged: y.current.customization !== d
54
+ capabilitiesChanged: y.current.capabilities !== i,
55
+ customizationChanged: y.current.customization !== c
56
56
  }
57
57
  }), y.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
59
  apiKey: l,
60
60
  serviceConfig: n,
61
- capabilities: a,
62
- customization: d
61
+ capabilities: i,
62
+ customization: c
63
63
  }, G(() => {
64
- const v = k.current;
65
- if (r("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
- renderCount: v,
64
+ const w = k.current;
65
+ if (o("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
+ renderCount: w,
67
67
  apiKey: !!l,
68
68
  serviceConfig: !!n,
69
69
  dependencies: {
@@ -73,151 +73,151 @@ const he = ve({
73
73
  apiKeyStable: y.current.apiKey === l
74
74
  }
75
75
  }), !l || !n) {
76
- r("โš ๏ธ SERVICE INIT SKIPPED", {
77
- renderCount: v,
76
+ o("โš ๏ธ SERVICE INIT SKIPPED", {
77
+ renderCount: w,
78
78
  reason: "Missing apiKey or serviceConfig"
79
79
  });
80
80
  return;
81
81
  }
82
- r("๐Ÿš€ CREATING NEW SERVICE", {
83
- renderCount: v,
82
+ o("๐Ÿš€ CREATING NEW SERVICE", {
83
+ renderCount: w,
84
84
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
85
85
  serviceConfigChanged: y.current.serviceConfig !== n
86
86
  });
87
87
  const M = new Ee({
88
88
  ...n,
89
89
  apiKey: l,
90
- debug: i
90
+ debug: a
91
91
  });
92
- return w(M), r("โœ… SERVICE SET", {
93
- renderCount: v,
92
+ return b(M), o("โœ… SERVICE SET", {
93
+ renderCount: w,
94
94
  serviceInstance: !!M
95
95
  }), () => {
96
- r("๐Ÿงน SERVICE CLEANUP", {
97
- renderCount: v,
96
+ o("๐Ÿงน SERVICE CLEANUP", {
97
+ renderCount: w,
98
98
  reason: "Effect cleanup"
99
99
  }), M.disconnectUser().catch(console.error);
100
100
  };
101
- }, [l, n, i, r]);
101
+ }, [l, n, a, o]);
102
102
  const T = H(null);
103
103
  G(() => {
104
104
  var M, p;
105
- if (r("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
106
- hasService: !!o,
105
+ if (o("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
106
+ hasService: !!r,
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
109
  isConnecting: O.current,
110
110
  isConnected: m,
111
- dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
112
- }), !o || !s) {
113
- r("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
111
+ dependencies: { service: !!r, userId: s == null ? void 0 : s.id }
112
+ }), !r || !s) {
113
+ o("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
114
114
  return;
115
115
  }
116
116
  if (O.current) {
117
- r("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
117
+ o("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
118
118
  return;
119
119
  }
120
- if (((M = T.current) == null ? void 0 : M.serviceId) === o && ((p = T.current) == null ? void 0 : p.userId) === s.id) {
121
- r(
120
+ if (((M = T.current) == null ? void 0 : M.serviceId) === r && ((p = T.current) == null ? void 0 : p.userId) === s.id) {
121
+ o(
122
122
  "โš ๏ธ USER CONNECTION SKIPPED",
123
123
  "Already connected this user with this service"
124
124
  );
125
125
  return;
126
126
  }
127
127
  (async () => {
128
- r("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), O.current = !0, h(!0), S(null);
128
+ o("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), O.current = !0, h(!0), S(null);
129
129
  try {
130
- r("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
- const L = await o.connectUser(s);
132
- N(L), E(!0), T.current = { serviceId: o, userId: s.id }, r("โœ… USER CONNECTION SUCCESS", {
130
+ o("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
+ const L = await r.connectUser(s);
132
+ g(L), I(!0), T.current = { serviceId: r, userId: s.id }, o("โœ… USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
134
  clientId: L.userID
135
135
  });
136
136
  } catch (L) {
137
137
  const $ = L instanceof Error ? L.message : "Connection failed";
138
- S($), r("โŒ USER CONNECTION ERROR", {
138
+ S($), o("โŒ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
140
  error: $
141
141
  });
142
142
  } finally {
143
- h(!1), O.current = !1, r("๐Ÿ”„ USER CONNECTION FINISHED", {
143
+ h(!1), O.current = !1, o("๐Ÿ”„ USER CONNECTION FINISHED", {
144
144
  userId: s.id,
145
145
  isConnected: m
146
146
  });
147
147
  }
148
148
  })();
149
- }, [o, s, r, m]), G(() => (r("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
150
- hasService: !!o,
149
+ }, [r, s, o, m]), G(() => (o("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
150
+ hasService: !!r,
151
151
  isConnected: m
152
152
  }), () => {
153
- o && m ? (r(
153
+ r && m ? (o(
154
154
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
155
155
  "Cleaning up connection on unmount"
156
- ), T.current = null, o.disconnectUser().catch(console.error)) : r("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
157
- hasService: !!o,
156
+ ), T.current = null, r.disconnectUser().catch(console.error)) : o("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
157
+ hasService: !!r,
158
158
  isConnected: m
159
159
  });
160
- }), [o, m, r]);
160
+ }), [r, m, o]);
161
161
  const f = U(async () => {
162
- if (r("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
- hasService: !!o,
162
+ if (o("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
+ hasService: !!r,
164
164
  hasUser: !!s
165
- }), !o || !s) {
166
- r("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
165
+ }), !r || !s) {
166
+ o("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
167
167
  return;
168
168
  }
169
- r("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
169
+ o("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
170
170
  try {
171
- r("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await o.disconnectUser(), r("๐Ÿ“ž RECONNECTING FOR REFRESH");
172
- const v = await o.connectUser(s);
173
- N(v), E(!0), S(null), r("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
- } catch (v) {
175
- const M = v instanceof Error ? v.message : "Refresh failed";
176
- S(M), r("โŒ CONNECTION REFRESH ERROR", {
171
+ o("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await r.disconnectUser(), o("๐Ÿ“ž RECONNECTING FOR REFRESH");
172
+ const w = await r.connectUser(s);
173
+ g(w), I(!0), S(null), o("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
+ } catch (w) {
175
+ const M = w instanceof Error ? w.message : "Refresh failed";
176
+ S(M), o("โŒ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
178
  error: M
179
179
  });
180
180
  } finally {
181
- h(!1), r("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ h(!1), o("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
182
182
  }
183
- }, [o, s, r]), g = X.useMemo(() => (r("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
184
- hasService: !!o,
183
+ }, [r, s, o]), x = X.useMemo(() => (o("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
184
+ hasService: !!r,
185
185
  hasClient: !!u,
186
186
  isConnected: m,
187
- isLoading: x,
188
- hasError: !!C,
189
- capabilitiesKeys: Object.keys(a),
190
- customizationKeys: Object.keys(d)
187
+ isLoading: N,
188
+ hasError: !!v,
189
+ capabilitiesKeys: Object.keys(i),
190
+ customizationKeys: Object.keys(c)
191
191
  }), {
192
- service: o,
192
+ service: r,
193
193
  client: u,
194
194
  isConnected: m,
195
- isLoading: x,
196
- error: C,
197
- capabilities: a,
198
- customization: d,
195
+ isLoading: N,
196
+ error: v,
197
+ capabilities: i,
198
+ customization: c,
199
199
  refreshConnection: f,
200
- debug: i
200
+ debug: a
201
201
  }), [
202
- o,
202
+ r,
203
203
  u,
204
204
  m,
205
- x,
206
- C,
207
- a,
208
- d,
209
- f,
205
+ N,
206
+ v,
210
207
  i,
211
- r
208
+ c,
209
+ f,
210
+ a,
211
+ o
212
212
  ]);
213
- return r("๐Ÿ”„ RENDER END", {
213
+ return o("๐Ÿ”„ RENDER END", {
214
214
  renderCount: k.current,
215
215
  willRenderChat: !!(u && m),
216
- contextValueReady: !!g
217
- }), /* @__PURE__ */ e(he.Provider, { value: g, children: u && m ? /* @__PURE__ */ e(Ie, { client: u, children: t }) : t });
216
+ contextValueReady: !!x
217
+ }), /* @__PURE__ */ e(he.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(Ie, { client: u, children: t }) : t });
218
218
  }, Le = () => se();
219
219
  function ne({ label: t, className: s, children: n, ...l }) {
220
- return /* @__PURE__ */ c(
220
+ return /* @__PURE__ */ d(
221
221
  "button",
222
222
  {
223
223
  type: "button",
@@ -265,8 +265,8 @@ function je(t) {
265
265
  // olive green
266
266
  ];
267
267
  let n = 0;
268
- for (let a = 0; a < t.length; a++)
269
- n = (n << 5) - n + t.charCodeAt(a), n = n & n;
268
+ for (let i = 0; i < t.length; i++)
269
+ n = (n << 5) - n + t.charCodeAt(i), n = n & n;
270
270
  const l = Math.abs(n) % s.length;
271
271
  return s[l];
272
272
  }
@@ -275,15 +275,15 @@ const Y = ({
275
275
  name: s,
276
276
  image: n,
277
277
  size: l = 40,
278
- className: a
278
+ className: i
279
279
  }) => {
280
- const { color: d } = je(t), i = s.charAt(0).toUpperCase(), o = l < 32 ? "text-xs" : l < 56 ? "text-sm" : "text-lg";
280
+ const { color: c } = je(t), a = s.charAt(0).toUpperCase(), r = l < 32 ? "text-xs" : l < 56 ? "text-sm" : "text-lg";
281
281
  return /* @__PURE__ */ e(
282
282
  "div",
283
283
  {
284
284
  className: D(
285
285
  "flex-shrink-0 overflow-hidden rounded-full",
286
- a
286
+ i
287
287
  ),
288
288
  style: { width: `${l}px`, height: `${l}px` },
289
289
  children: n ? /* @__PURE__ */ e(
@@ -299,75 +299,75 @@ const Y = ({
299
299
  "aria-hidden": "true",
300
300
  className: D(
301
301
  "flex h-full w-full items-center justify-center font-semibold",
302
- o
302
+ r
303
303
  ),
304
304
  style: {
305
- color: d,
306
- backgroundColor: `color-mix(in srgb, ${d} 20%, transparent)`
305
+ color: c,
306
+ backgroundColor: `color-mix(in srgb, ${c} 20%, transparent)`
307
307
  },
308
- children: i
308
+ children: a
309
309
  }
310
310
  )
311
311
  }
312
312
  );
313
- }, Ae = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1 }) => {
314
- var x, h, C, S, O, y, k;
315
- const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
313
+ }, Ae = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: i }) => {
314
+ var h, v, S, O, y, k;
315
+ const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
316
316
  t && n(t);
317
- }, r = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
317
+ }, r = Object.values(((h = t == null ? void 0 : t.state) == null ? void 0 : h.members) || {}).find(
318
318
  (T) => {
319
- var f, g;
320
- return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((g = t == null ? void 0 : t._client) == null ? void 0 : g.userID);
319
+ var f, x;
320
+ return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
321
321
  }
322
- ), o = ((h = r == null ? void 0 : r.user) == null ? void 0 : h.name) || "Conversation", w = (C = r == null ? void 0 : r.user) == null ? void 0 : C.image, u = (O = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : O[t.state.messages.length - 1], N = (u == null ? void 0 : u.text) || "No messages yet", m = u != null && u.created_at ? new Date(u.created_at).toLocaleTimeString([], {
322
+ ), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (O = t == null ? void 0 : t.state) == null ? void 0 : O.messages) == null ? void 0 : y[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", I = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
323
323
  hour: "2-digit",
324
324
  minute: "2-digit"
325
- }) : "", E = ((y = t == null ? void 0 : t.state) == null ? void 0 : y.unreadCount) || 0;
325
+ }) : "", N = i ?? 0;
326
326
  return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
327
327
  channelId: t == null ? void 0 : t.id,
328
- isSelected: a,
329
- participantName: o,
330
- unread: E,
331
- hasTimestamp: !!m
328
+ isSelected: c,
329
+ participantName: b,
330
+ unreadCount: N,
331
+ hasTimestamp: !!I
332
332
  }), /* @__PURE__ */ e(
333
333
  "button",
334
334
  {
335
335
  type: "button",
336
- onClick: d,
336
+ onClick: a,
337
337
  className: D(
338
338
  "w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
339
339
  {
340
- "bg-primary-alt/10 border-l-4 border-l-primary": a,
341
- "hover:bg-sand": !a
340
+ "bg-primary-alt/10 border-l-4 border-l-primary": c,
341
+ "hover:bg-sand": !c
342
342
  }
343
343
  ),
344
- children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
344
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
345
345
  /* @__PURE__ */ e(
346
346
  Y,
347
347
  {
348
348
  id: ((k = r == null ? void 0 : r.user) == null ? void 0 : k.id) || t.id || "unknown",
349
- name: o,
350
- image: w,
349
+ name: b,
350
+ image: u,
351
351
  size: 44
352
352
  }
353
353
  ),
354
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
355
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
354
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
355
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
356
356
  /* @__PURE__ */ e(
357
357
  "h3",
358
358
  {
359
359
  className: D(
360
360
  "text-sm font-medium truncate",
361
- a ? "text-primary" : "text-charcoal"
361
+ c ? "text-primary" : "text-charcoal"
362
362
  ),
363
- children: o
363
+ children: b
364
364
  }
365
365
  ),
366
- m && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: m })
366
+ I && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: I })
367
367
  ] }),
368
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
369
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: N }),
370
- E > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: E > 99 ? "99+" : E })
368
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
369
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: m }),
370
+ N > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: N > 99 ? "99+" : N })
371
371
  ] })
372
372
  ] })
373
373
  ] })
@@ -378,43 +378,43 @@ const Y = ({
378
378
  selectedChannel: s,
379
379
  showStartConversation: n = !1,
380
380
  onStartConversation: l,
381
- participantLabel: a = "participants",
382
- className: d
381
+ participantLabel: i = "participants",
382
+ className: c
383
383
  }) => {
384
384
  var u;
385
- const i = X.useRef(0);
386
- i.current++;
387
- const { debug: r = !1 } = se();
388
- r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
389
- renderCount: i.current,
385
+ const a = X.useRef(0);
386
+ a.current++;
387
+ const { debug: o = !1 } = se();
388
+ o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
389
+ renderCount: a.current,
390
390
  selectedChannelId: s == null ? void 0 : s.id,
391
391
  showStartConversation: n,
392
- participantLabel: a
392
+ participantLabel: i
393
393
  });
394
- const { client: o } = ye();
395
- r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“ก CHAT CONTEXT", {
396
- renderCount: i.current,
397
- hasClient: !!o,
398
- clientUserId: o == null ? void 0 : o.userID,
399
- clientConnected: (u = o == null ? void 0 : o.wsConnection) == null ? void 0 : u.isHealthy
394
+ const { client: r } = ye();
395
+ o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“ก CHAT CONTEXT", {
396
+ renderCount: a.current,
397
+ hasClient: !!r,
398
+ clientUserId: r == null ? void 0 : r.userID,
399
+ clientConnected: (u = r == null ? void 0 : r.wsConnection) == null ? void 0 : u.isHealthy
400
400
  });
401
- const w = X.useMemo(() => {
402
- const N = o.userID, m = N ? { type: "messaging", members: { $in: [N] }, hidden: !1 } : { type: "messaging" };
403
- return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ” FILTERS MEMOIZED", {
404
- renderCount: i.current,
405
- userId: N,
401
+ const b = X.useMemo(() => {
402
+ const g = r.userID, m = g ? { type: "messaging", members: { $in: [g] }, hidden: !1 } : { type: "messaging" };
403
+ return o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ” FILTERS MEMOIZED", {
404
+ renderCount: a.current,
405
+ userId: g,
406
406
  filters: m
407
407
  }), m;
408
- }, [o.userID, r]);
409
- return /* @__PURE__ */ c(
408
+ }, [r.userID, o]);
409
+ return /* @__PURE__ */ d(
410
410
  "div",
411
411
  {
412
412
  className: D(
413
413
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
414
- d
414
+ c
415
415
  ),
416
416
  children: [
417
- /* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
417
+ /* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
418
418
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
419
419
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && l && /* @__PURE__ */ e(
420
420
  ne,
@@ -426,30 +426,30 @@ const Y = ({
426
426
  }
427
427
  ) })
428
428
  ] }) }),
429
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
430
- renderCount: i.current,
431
- filters: w,
432
- hasClient: !!o,
433
- clientUserId: o == null ? void 0 : o.userID
429
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (o && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
430
+ renderCount: a.current,
431
+ filters: b,
432
+ hasClient: !!r,
433
+ clientUserId: r == null ? void 0 : r.userID
434
434
  }), /* @__PURE__ */ e(
435
435
  Se,
436
436
  {
437
- filters: w,
437
+ filters: b,
438
438
  sort: { last_message_at: -1 },
439
439
  options: { limit: 30 },
440
- Preview: (N) => {
441
- var m, E;
442
- return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
443
- channelId: (m = N.channel) == null ? void 0 : m.id,
440
+ Preview: (g) => {
441
+ var m, I;
442
+ return o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
443
+ channelId: (m = g.channel) == null ? void 0 : m.id,
444
444
  selectedChannelId: s == null ? void 0 : s.id,
445
- isSelected: (s == null ? void 0 : s.id) === ((E = N.channel) == null ? void 0 : E.id)
445
+ isSelected: (s == null ? void 0 : s.id) === ((I = g.channel) == null ? void 0 : I.id)
446
446
  }), /* @__PURE__ */ e(
447
447
  Ae,
448
448
  {
449
- ...N,
449
+ ...g,
450
450
  selectedChannel: s,
451
451
  onChannelSelect: t,
452
- debug: r
452
+ debug: o
453
453
  }
454
454
  );
455
455
  }
@@ -479,19 +479,19 @@ const Y = ({
479
479
  function fe({ onClick: t }) {
480
480
  return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
481
481
  }
482
- const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
482
+ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
483
483
  t && t(),
484
484
  /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Pe, { focus: !0, maxRows: 4 }) })
485
485
  ] }), Ge = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
486
- var o, w, u, N;
487
- const { channel: a } = ue(), d = X.useMemo(() => Object.values(a.state.members || {}).find(
488
- (E) => {
489
- var x;
490
- return ((x = E.user) == null ? void 0 : x.id) && E.user.id !== a._client.userID;
486
+ var r, b, u, g;
487
+ const { channel: i } = ue(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
488
+ (I) => {
489
+ var N;
490
+ return ((N = I.user) == null ? void 0 : N.id) && I.user.id !== i._client.userID;
491
491
  }
492
- ), [a._client.userID, a.state.members]), i = ((o = d == null ? void 0 : d.user) == null ? void 0 : o.name) || ((w = d == null ? void 0 : d.user) == null ? void 0 : w.id) || "Unknown member", r = (u = d == null ? void 0 : d.user) == null ? void 0 : u.image;
493
- return /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
- /* @__PURE__ */ c("div", { className: "flex items-center gap-3 min-w-0", children: [
492
+ ), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member", o = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
493
+ return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
495
495
  s && t && /* @__PURE__ */ e(
496
496
  "button",
497
497
  {
@@ -505,13 +505,13 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
505
505
  /* @__PURE__ */ e(
506
506
  Y,
507
507
  {
508
- id: ((N = d == null ? void 0 : d.user) == null ? void 0 : N.id) || a.id || "unknown",
509
- name: i,
510
- image: r,
508
+ id: ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || i.id || "unknown",
509
+ name: a,
510
+ image: o,
511
511
  size: 40
512
512
  }
513
513
  ),
514
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: i }) })
514
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: a }) })
515
515
  ] }),
516
516
  l && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Oe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
517
517
  ] });
@@ -520,56 +520,56 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
520
520
  onClose: s,
521
521
  participant: n,
522
522
  channel: l,
523
- followerStatusLabel: a,
524
- onLeaveConversation: d,
525
- onBlockParticipant: i
523
+ followerStatusLabel: i,
524
+ onLeaveConversation: c,
525
+ onBlockParticipant: a
526
526
  }) => {
527
527
  var L, $, _, V, Q, W, z;
528
- const { service: r, debug: o } = se(), w = H(null), [u, N] = I(!1), [m, E] = I(!1), [x, h] = I(!1);
528
+ const { service: o, debug: r } = se(), b = H(null), [u, g] = E(!1), [m, I] = E(!1), [N, h] = E(!1);
529
529
  G(() => {
530
- const R = w.current;
530
+ const R = b.current;
531
531
  R && (t ? R.showModal() : R.close());
532
532
  }, [t]);
533
- const C = U(async () => {
533
+ const v = U(async () => {
534
534
  var R;
535
- if (!(!r || !((R = n == null ? void 0 : n.user) != null && R.id)))
535
+ if (!(!o || !((R = n == null ? void 0 : n.user) != null && R.id)))
536
536
  try {
537
- const A = (await r.getBlockedUsers()).some(
537
+ const A = (await o.getBlockedUsers()).some(
538
538
  (q) => {
539
539
  var Z;
540
540
  return q.blocked_user_id === ((Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id);
541
541
  }
542
542
  );
543
- N(A);
543
+ g(A);
544
544
  } catch (P) {
545
545
  console.error(
546
546
  "[ChannelInfoDialog] Failed to check blocked status:",
547
547
  P
548
548
  );
549
549
  }
550
- }, [r, (L = n == null ? void 0 : n.user) == null ? void 0 : L.id]);
550
+ }, [o, (L = n == null ? void 0 : n.user) == null ? void 0 : L.id]);
551
551
  G(() => {
552
- t && C();
553
- }, [t, C]);
552
+ t && v();
553
+ }, [t, v]);
554
554
  const S = async () => {
555
555
  var R;
556
556
  if (!m) {
557
- o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), E(!0);
557
+ r && console.log("[ChannelInfoDialog] Leave conversation", l.cid), I(!0);
558
558
  try {
559
559
  const P = ((R = l._client) == null ? void 0 : R.userID) ?? null;
560
- await l.hide(P, !1), d && await d(l), s();
560
+ await l.hide(P, !1), c && await c(l), s();
561
561
  } catch (P) {
562
562
  console.error("[ChannelInfoDialog] Failed to leave conversation", P);
563
563
  } finally {
564
- E(!1);
564
+ I(!1);
565
565
  }
566
566
  }
567
567
  }, O = async () => {
568
568
  var R, P, A;
569
- if (!(x || !r)) {
570
- o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
569
+ if (!(N || !o)) {
570
+ r && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
571
571
  try {
572
- await r.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
572
+ await o.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
573
573
  } catch (q) {
574
574
  console.error("[ChannelInfoDialog] Failed to block member", q);
575
575
  } finally {
@@ -578,10 +578,10 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
578
578
  }
579
579
  }, y = async () => {
580
580
  var R, P, A;
581
- if (!(x || !r)) {
582
- o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
581
+ if (!(N || !o)) {
582
+ r && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
583
583
  try {
584
- await r.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
584
+ await o.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
585
585
  } catch (q) {
586
586
  console.error("[ChannelInfoDialog] Failed to unblock member", q);
587
587
  } finally {
@@ -596,25 +596,25 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
596
596
  );
597
597
  };
598
598
  if (!n) return null;
599
- const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, g = (Q = n.user) == null ? void 0 : Q.email, v = (W = n.user) == null ? void 0 : W.username, M = g || (v ? `linktr.ee/${v}` : void 0), p = ((z = n.user) == null ? void 0 : z.id) || "unknown";
599
+ const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, M = x || (w ? `linktr.ee/${w}` : void 0), p = ((z = n.user) == null ? void 0 : z.id) || "unknown";
600
600
  return (
601
601
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
602
602
  /* @__PURE__ */ e(
603
603
  "dialog",
604
604
  {
605
- ref: w,
605
+ ref: b,
606
606
  className: "mes-dialog",
607
607
  onClose: s,
608
608
  onClick: (R) => {
609
- R.target === w.current && s();
609
+ R.target === b.current && s();
610
610
  },
611
- children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
611
+ children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
613
613
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
614
614
  /* @__PURE__ */ e(fe, { onClick: s })
615
615
  ] }),
616
- /* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
- /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
616
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
+ /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
618
618
  /* @__PURE__ */ e(
619
619
  Y,
620
620
  {
@@ -624,14 +624,14 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
624
624
  size: 64
625
625
  }
626
626
  ),
627
- /* @__PURE__ */ c("div", { className: "min-w-0 flex-1", children: [
627
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
628
628
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
629
629
  M && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: M }),
630
- a && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: a })
630
+ i && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: i })
631
631
  ] })
632
632
  ] }) }),
633
- /* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
634
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
633
+ /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
634
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
635
635
  K,
636
636
  {
637
637
  onClick: S,
@@ -643,30 +643,30 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
643
643
  ]
644
644
  }
645
645
  ) }),
646
- /* @__PURE__ */ e("li", { children: u ? /* @__PURE__ */ c(
646
+ /* @__PURE__ */ e("li", { children: u ? /* @__PURE__ */ d(
647
647
  K,
648
648
  {
649
649
  onClick: y,
650
- disabled: x,
651
- "aria-busy": x,
650
+ disabled: N,
651
+ "aria-busy": N,
652
652
  children: [
653
- x ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
653
+ N ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
654
654
  /* @__PURE__ */ e("span", { children: "Unblock" })
655
655
  ]
656
656
  }
657
- ) : /* @__PURE__ */ c(
657
+ ) : /* @__PURE__ */ d(
658
658
  K,
659
659
  {
660
660
  onClick: O,
661
- disabled: x,
662
- "aria-busy": x,
661
+ disabled: N,
662
+ "aria-busy": N,
663
663
  children: [
664
- x ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
664
+ N ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
665
665
  /* @__PURE__ */ e("span", { children: "Block" })
666
666
  ]
667
667
  }
668
668
  ) }),
669
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(K, { variant: "danger", onClick: k, children: [
669
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: k, children: [
670
670
  /* @__PURE__ */ e(Fe, { className: "h-5 w-5" }),
671
671
  /* @__PURE__ */ e("span", { children: "Report" })
672
672
  ] }) })
@@ -681,51 +681,51 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
681
681
  showBackButton: s,
682
682
  renderMessageInputActions: n,
683
683
  onLeaveConversation: l,
684
- onBlockParticipant: a,
685
- CustomChannelEmptyState: d
684
+ onBlockParticipant: i,
685
+ CustomChannelEmptyState: c
686
686
  }) => {
687
- var m, E;
688
- const { channel: i } = ue(), [r, o] = I(!1), w = (((E = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : E.length) ?? 0) > 0, u = X.useMemo(() => Object.values(i.state.members || {}).find(
687
+ var m, I;
688
+ const { channel: a } = ue(), [o, r] = E(!1), b = (((I = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : I.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
689
689
  (h) => {
690
- var C;
691
- return ((C = h.user) == null ? void 0 : C.id) && h.user.id !== i._client.userID;
690
+ var v;
691
+ return ((v = h.user) == null ? void 0 : v.id) && h.user.id !== a._client.userID;
692
692
  }
693
- ), [i._client.userID, i.state.members]), N = X.useMemo(() => {
694
- const x = i.data ?? {};
695
- return x.followerStatus ? String(x.followerStatus) : x.isFollower ? "Subscribed to you" : void 0;
696
- }, [i.data]);
697
- return /* @__PURE__ */ c(oe, { children: [
698
- /* @__PURE__ */ c(ke, { children: [
693
+ ), [a._client.userID, a.state.members]), g = X.useMemo(() => {
694
+ const N = a.data ?? {};
695
+ return N.followerStatus ? String(N.followerStatus) : N.isFollower ? "Subscribed to you" : void 0;
696
+ }, [a.data]);
697
+ return /* @__PURE__ */ d(oe, { children: [
698
+ /* @__PURE__ */ d(ke, { children: [
699
699
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
700
700
  Ge,
701
701
  {
702
702
  onBack: t,
703
703
  showBackButton: s,
704
- onShowInfo: () => o(!0),
704
+ onShowInfo: () => r(!0),
705
705
  canShowInfo: !!u
706
706
  }
707
707
  ) }),
708
- /* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden relative", children: [
708
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
709
709
  /* @__PURE__ */ e(Te, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
710
- !w && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(d, {}) })
710
+ !b && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(c, {}) })
711
711
  ] }),
712
712
  /* @__PURE__ */ e(
713
713
  He,
714
714
  {
715
- renderActions: () => n == null ? void 0 : n(i)
715
+ renderActions: () => n == null ? void 0 : n(a)
716
716
  }
717
717
  )
718
718
  ] }),
719
719
  /* @__PURE__ */ e(
720
720
  $e,
721
721
  {
722
- isOpen: r,
723
- onClose: () => o(!1),
722
+ isOpen: o,
723
+ onClose: () => r(!1),
724
724
  participant: u,
725
- channel: i,
726
- followerStatusLabel: N,
725
+ channel: a,
726
+ followerStatusLabel: g,
727
727
  onLeaveConversation: l,
728
- onBlockParticipant: a
728
+ onBlockParticipant: i
729
729
  }
730
730
  )
731
731
  ] });
@@ -734,16 +734,16 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
734
734
  onBack: s,
735
735
  showBackButton: n = !1,
736
736
  renderMessageInputActions: l,
737
- onLeaveConversation: a,
738
- onBlockParticipant: d,
739
- className: i,
740
- CustomChannelEmptyState: r
737
+ onLeaveConversation: i,
738
+ onBlockParticipant: c,
739
+ className: a,
740
+ CustomChannelEmptyState: o
741
741
  }) => /* @__PURE__ */ e(
742
742
  "div",
743
743
  {
744
744
  className: D(
745
745
  "messaging-channel-view h-full flex flex-col",
746
- i
746
+ a
747
747
  ),
748
748
  children: /* @__PURE__ */ e(Re, { channel: t, children: /* @__PURE__ */ e(
749
749
  _e,
@@ -751,9 +751,9 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
751
751
  onBack: s,
752
752
  showBackButton: n,
753
753
  renderMessageInputActions: l,
754
- onLeaveConversation: a,
755
- onBlockParticipant: d,
756
- CustomChannelEmptyState: r
754
+ onLeaveConversation: i,
755
+ onBlockParticipant: c,
756
+ CustomChannelEmptyState: o
757
757
  }
758
758
  ) })
759
759
  }
@@ -764,7 +764,7 @@ function We({
764
764
  placeholder: n
765
765
  }) {
766
766
  const l = H(null);
767
- return /* @__PURE__ */ c("div", { className: "relative", children: [
767
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
768
768
  /* @__PURE__ */ e(
769
769
  pe,
770
770
  {
@@ -779,7 +779,7 @@ function We({
779
779
  type: "text",
780
780
  placeholder: n,
781
781
  value: t,
782
- onChange: (a) => s(a.target.value),
782
+ onChange: (i) => s(i.target.value),
783
783
  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"
784
784
  }
785
785
  ),
@@ -788,8 +788,8 @@ function We({
788
788
  {
789
789
  label: "Clear search",
790
790
  onClick: () => {
791
- var a;
792
- s(""), (a = l.current) == null || a.focus();
791
+ var i;
792
+ s(""), (i = l.current) == null || i.focus();
793
793
  },
794
794
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
795
795
  children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
@@ -802,104 +802,104 @@ const ze = ({
802
802
  onSelectParticipant: s,
803
803
  onClose: n,
804
804
  existingParticipantIds: l = /* @__PURE__ */ new Set(),
805
- participantLabel: a = "participants",
806
- searchPlaceholder: d = "Search participants...",
807
- className: i
805
+ participantLabel: i = "participants",
806
+ searchPlaceholder: c = "Search participants...",
807
+ className: a
808
808
  }) => {
809
- const { debug: r } = se(), [o, w] = I(""), [u, N] = I([]), [m, E] = I(!1), [x, h] = I(null), [C, S] = I(
809
+ const { debug: o } = se(), [r, b] = E(""), [u, g] = E([]), [m, I] = E(!1), [N, h] = E(null), [v, S] = E(
810
810
  null
811
811
  ), O = H(!1);
812
812
  G(() => {
813
813
  if (t.loading) {
814
- r && console.log(
814
+ o && console.log(
815
815
  "[ParticipantPicker] Waiting for participant source to finish loading..."
816
816
  );
817
817
  return;
818
818
  }
819
819
  if (O.current) return;
820
820
  (async () => {
821
- r && console.log("[ParticipantPicker] Loading initial participants..."), E(!0), h(null);
821
+ o && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), h(null);
822
822
  try {
823
- const g = await t.loadParticipants({
823
+ const x = await t.loadParticipants({
824
824
  search: "",
825
825
  // Load all participants initially
826
826
  limit: 100
827
827
  });
828
- N(g.participants), O.current = !0, r && console.log(
828
+ g(x.participants), O.current = !0, o && console.log(
829
829
  "[ParticipantPicker] Participants loaded successfully:",
830
- g.participants.length
830
+ x.participants.length
831
831
  );
832
- } catch (g) {
833
- const v = g instanceof Error ? g.message : "Failed to load participants";
834
- h(v), console.error("[ParticipantPicker] Failed to load participants:", g);
832
+ } catch (x) {
833
+ const w = x instanceof Error ? x.message : "Failed to load participants";
834
+ h(w), console.error("[ParticipantPicker] Failed to load participants:", x);
835
835
  } finally {
836
- E(!1);
836
+ I(!1);
837
837
  }
838
838
  })();
839
- }, [t.loading, r]);
839
+ }, [t.loading, o]);
840
840
  const y = u.filter((f) => !l.has(f.id)).filter((f) => {
841
- var v;
842
- if (!o) return !0;
843
- const g = o.toLowerCase();
844
- return f.name.toLowerCase().includes(g) || ((v = f.email) == null ? void 0 : v.toLowerCase().includes(g)) || !1;
841
+ var w;
842
+ if (!r) return !0;
843
+ const x = r.toLowerCase();
844
+ return f.name.toLowerCase().includes(x) || ((w = f.email) == null ? void 0 : w.toLowerCase().includes(x)) || !1;
845
845
  }), k = U(
846
846
  async (f) => {
847
- if (!C) {
847
+ if (!v) {
848
848
  S(f.id);
849
849
  try {
850
850
  await s(f);
851
- } catch (g) {
852
- console.error("[ParticipantPicker] Failed to start chat:", g), S(null);
851
+ } catch (x) {
852
+ console.error("[ParticipantPicker] Failed to start chat:", x), S(null);
853
853
  }
854
854
  }
855
855
  },
856
- [s, C]
857
- ), T = (f, g) => {
858
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k(g));
856
+ [s, v]
857
+ ), T = (f, x) => {
858
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k(x));
859
859
  };
860
- return /* @__PURE__ */ c("div", { className: D("flex flex-col h-full", i), children: [
861
- /* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
862
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
860
+ return /* @__PURE__ */ d("div", { className: D("flex flex-col h-full", a), children: [
861
+ /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
862
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
863
863
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
864
864
  /* @__PURE__ */ e(fe, { onClick: n })
865
865
  ] }),
866
- /* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
866
+ /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
867
867
  "Select a ",
868
- a.slice(0, -1),
868
+ i.slice(0, -1),
869
869
  " to start messaging (",
870
870
  y.length,
871
871
  " available)",
872
- t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
872
+ t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${i} total`
873
873
  ] }),
874
874
  /* @__PURE__ */ e(
875
875
  We,
876
876
  {
877
- searchQuery: o,
878
- setSearchQuery: w,
879
- placeholder: d
877
+ searchQuery: r,
878
+ setSearchQuery: b,
879
+ placeholder: c
880
880
  }
881
881
  )
882
882
  ] }),
883
- x && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
883
+ N && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
884
884
  "Error loading ",
885
- a,
885
+ i,
886
886
  ": ",
887
- x
887
+ N
888
888
  ] }),
889
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
889
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && y.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: [
890
890
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
891
- /* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
891
+ /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
892
892
  "Loading ",
893
- a,
893
+ i,
894
894
  "..."
895
895
  ] })
896
- ] }) }) : y.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
896
+ ] }) }) : y.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
897
897
  /* @__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" }) }),
898
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : u.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
899
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : u.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
900
- ] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
898
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: r ? `No ${i} found` : u.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
899
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: r ? "Try a different search term" : u.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
900
+ ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
901
901
  y.map((f) => {
902
- const g = f.name || f.email || f.id, v = f.email && f.name ? f.email : f.phone;
902
+ const x = f.name || f.email || f.id, w = f.email && f.name ? f.email : f.phone;
903
903
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
904
904
  "button",
905
905
  {
@@ -907,46 +907,46 @@ const ze = ({
907
907
  onClick: () => k(f),
908
908
  onKeyDown: (M) => T(M, f),
909
909
  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",
910
- children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
911
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
910
+ children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
911
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
912
912
  /* @__PURE__ */ e(
913
913
  Y,
914
914
  {
915
915
  id: f.id,
916
- name: g,
916
+ name: x,
917
917
  image: f.image,
918
918
  size: 40
919
919
  }
920
920
  ),
921
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
922
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: g }),
923
- v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
921
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
922
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: x }),
923
+ w && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: w })
924
924
  ] })
925
925
  ] }),
926
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C === f.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
926
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: v === f.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
927
927
  ] })
928
928
  }
929
929
  ) }, f.id);
930
930
  }),
931
- m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
931
+ m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
932
932
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
933
933
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
934
934
  ] }) })
935
935
  ] }) })
936
936
  ] });
937
- }, qe = ({ 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__ */ c("div", { className: "text-center max-w-sm", children: [
937
+ }, qe = ({ 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: [
938
938
  /* @__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: "๐Ÿ’ฌ" }) }),
939
939
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
940
- /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ c(oe, { children: [
940
+ /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(oe, { children: [
941
941
  "Choose a conversation from the list or",
942
942
  " ",
943
- s && /* @__PURE__ */ c(de, { onClick: s, children: [
943
+ s && /* @__PURE__ */ d(de, { onClick: s, children: [
944
944
  "start a new conversation with a ",
945
945
  n.slice(0, -1),
946
946
  "."
947
947
  ] })
948
- ] }) : s && /* @__PURE__ */ c(oe, { children: [
949
- /* @__PURE__ */ c(de, { onClick: s, children: [
948
+ ] }) : s && /* @__PURE__ */ d(oe, { children: [
949
+ /* @__PURE__ */ d(de, { onClick: s, children: [
950
950
  "Start a new conversation with one of your ",
951
951
  n
952
952
  ] }),
@@ -964,7 +964,7 @@ const ze = ({
964
964
  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",
965
965
  children: s
966
966
  }
967
- ), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
967
+ ), 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: [
968
968
  /* @__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: "โš ๏ธ" }) }),
969
969
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
970
970
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -977,12 +977,12 @@ const ze = ({
977
977
  children: "Go Back"
978
978
  }
979
979
  )
980
- ] }) }), Xe = ({ className: t, message: s }) => /* @__PURE__ */ c(
980
+ ] }) }), Xe = ({ className: t, message: s }) => /* @__PURE__ */ d(
981
981
  "div",
982
982
  {
983
983
  className: D("flex items-center justify-center h-full", t),
984
984
  children: [
985
- /* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
985
+ /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
986
986
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
987
987
  "animateTransform",
988
988
  {
@@ -1020,7 +1020,7 @@ const ze = ({
1020
1020
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1021
1021
  ]
1022
1022
  }
1023
- ), Qe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1023
+ ), Qe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1024
1024
  /* @__PURE__ */ e(Xe, { className: "w-6 h-6" }),
1025
1025
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1026
1026
  ] }) }), rs = ({
@@ -1028,34 +1028,34 @@ const ze = ({
1028
1028
  className: s,
1029
1029
  renderMessageInputActions: n,
1030
1030
  onChannelSelect: l,
1031
- onParticipantSelect: a,
1032
- initialParticipantFilter: d,
1033
- initialParticipantData: i,
1034
- CustomChannelEmptyState: r,
1035
- showChannelList: o = !0
1031
+ onParticipantSelect: i,
1032
+ initialParticipantFilter: c,
1033
+ initialParticipantData: a,
1034
+ CustomChannelEmptyState: o,
1035
+ showChannelList: r = !0
1036
1036
  }) => {
1037
1037
  const {
1038
- service: w,
1038
+ service: b,
1039
1039
  client: u,
1040
- isConnected: N,
1040
+ isConnected: g,
1041
1041
  isLoading: m,
1042
- error: E,
1043
- refreshConnection: x,
1042
+ error: I,
1043
+ refreshConnection: N,
1044
1044
  debug: h
1045
- } = Le(), [C, S] = I(null), [O, y] = I(!1), [k, T] = I(!1), [f, g] = I(/* @__PURE__ */ new Set()), [v, M] = I(0), [p, L] = I(!1), [$, _] = I(null), V = H(null), {
1045
+ } = Le(), [v, S] = E(null), [O, y] = E(!1), [k, T] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, M] = E(0), [p, L] = E(!1), [$, _] = E(null), V = H(null), {
1046
1046
  showStartConversation: Q = !1,
1047
1047
  participantSource: W,
1048
1048
  participantLabel: z = "participants"
1049
1049
  } = t, R = H(null), P = U(async () => {
1050
- if (!u || !N) return;
1051
- const b = u.userID;
1052
- if (b)
1050
+ if (!u || !g) return;
1051
+ const C = u.userID;
1052
+ if (C)
1053
1053
  try {
1054
- h && console.log("[MessagingShell] Syncing channels for user:", b);
1054
+ h && console.log("[MessagingShell] Syncing channels for user:", C);
1055
1055
  const j = await u.queryChannels(
1056
1056
  {
1057
1057
  type: "messaging",
1058
- members: { $in: [b] }
1058
+ members: { $in: [C] }
1059
1059
  },
1060
1060
  {},
1061
1061
  { limit: 100 }
@@ -1065,34 +1065,34 @@ const ze = ({
1065
1065
  Object.values(be).forEach((Ce) => {
1066
1066
  var ae;
1067
1067
  const re = (ae = Ce.user) == null ? void 0 : ae.id;
1068
- re && re !== b && F.add(re);
1068
+ re && re !== C && F.add(re);
1069
1069
  });
1070
- }), g(F), y(j.length > 0), R.current = b, h && console.log("[MessagingShell] Channels synced successfully:", {
1070
+ }), x(F), y(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
1071
1071
  channelCount: j.length,
1072
1072
  memberCount: F.size
1073
1073
  });
1074
1074
  } catch (j) {
1075
1075
  console.error("[MessagingShell] Failed to sync channels:", j);
1076
1076
  }
1077
- }, [u, N, h]);
1077
+ }, [u, g, h]);
1078
1078
  G(() => {
1079
- if (!u || !N) return;
1080
- const b = u.userID;
1081
- b && R.current !== b && P();
1082
- }, [u, N, P]), G(() => {
1083
- if (!d || !u || !N) return;
1079
+ if (!u || !g) return;
1080
+ const C = u.userID;
1081
+ C && R.current !== C && P();
1082
+ }, [u, g, P]), G(() => {
1083
+ if (!c || !u || !g) return;
1084
1084
  (async () => {
1085
1085
  const j = u.userID;
1086
1086
  if (j)
1087
1087
  try {
1088
1088
  h && console.log(
1089
1089
  "[MessagingShell] Loading initial conversation with:",
1090
- d
1090
+ c
1091
1091
  );
1092
1092
  const F = await u.queryChannels(
1093
1093
  {
1094
1094
  type: "messaging",
1095
- members: { $eq: [j, d] }
1095
+ members: { $eq: [j, c] }
1096
1096
  },
1097
1097
  {},
1098
1098
  { limit: 1 }
@@ -1102,17 +1102,17 @@ const ze = ({
1102
1102
  "[MessagingShell] Initial conversation loaded:",
1103
1103
  F[0].id
1104
1104
  );
1105
- else if (i && w) {
1105
+ else if (a && b) {
1106
1106
  h && console.log(
1107
1107
  "[MessagingShell] No conversation found, creating one for:",
1108
- i
1108
+ a
1109
1109
  );
1110
1110
  try {
1111
- const B = await w.startChannelWithParticipant({
1112
- id: i.id,
1113
- name: i.name,
1114
- email: i.email,
1115
- phone: i.phone
1111
+ const B = await b.startChannelWithParticipant({
1112
+ id: a.id,
1113
+ name: a.name,
1114
+ email: a.email,
1115
+ phone: a.phone
1116
1116
  });
1117
1117
  S(B), L(!0), _(null), l && l(B), h && console.log(
1118
1118
  "[MessagingShell] Channel created and loaded:",
@@ -1129,7 +1129,7 @@ const ze = ({
1129
1129
  "No conversation found with this account"
1130
1130
  ), h && console.log(
1131
1131
  "[MessagingShell] No conversation found for:",
1132
- d
1132
+ c
1133
1133
  );
1134
1134
  } catch (F) {
1135
1135
  console.error(
@@ -1139,71 +1139,71 @@ const ze = ({
1139
1139
  }
1140
1140
  })();
1141
1141
  }, [
1142
- d,
1143
- i,
1142
+ c,
1143
+ a,
1144
1144
  u,
1145
- N,
1146
- w,
1145
+ g,
1146
+ b,
1147
1147
  h,
1148
1148
  l
1149
1149
  ]);
1150
1150
  const A = U(
1151
- (b) => {
1152
- S(b), l == null || l(b);
1151
+ (C) => {
1152
+ S(C), l == null || l(C);
1153
1153
  },
1154
1154
  [l]
1155
1155
  ), q = U(() => {
1156
1156
  p || S(null);
1157
1157
  }, [p]), Z = U(() => {
1158
- var b;
1159
- W && (M((j) => j + 1), T(!0), (b = V.current) == null || b.showModal());
1158
+ var C;
1159
+ W && (M((j) => j + 1), T(!0), (C = V.current) == null || C.showModal());
1160
1160
  }, [W]), ge = U(
1161
- async (b) => {
1161
+ async (C) => {
1162
1162
  var j;
1163
- if (w)
1163
+ if (b)
1164
1164
  try {
1165
1165
  h && console.log(
1166
1166
  "[MessagingShell] Starting conversation with:",
1167
- b.id
1167
+ C.id
1168
1168
  );
1169
- const F = await w.startChannelWithParticipant({
1170
- id: b.id,
1171
- name: b.name,
1172
- email: b.email,
1173
- phone: b.phone
1169
+ const F = await b.startChannelWithParticipant({
1170
+ id: C.id,
1171
+ name: C.name,
1172
+ email: C.email,
1173
+ phone: C.phone
1174
1174
  });
1175
1175
  try {
1176
1176
  await F.show();
1177
1177
  } catch (B) {
1178
1178
  console.warn("[MessagingShell] Failed to unhide channel:", B);
1179
1179
  }
1180
- S(F), T(!1), (j = V.current) == null || j.close(), a == null || a(b);
1180
+ S(F), T(!1), (j = V.current) == null || j.close(), i == null || i(C);
1181
1181
  } catch (F) {
1182
1182
  console.error("[MessagingShell] Failed to start conversation:", F);
1183
1183
  }
1184
1184
  },
1185
- [w, a, h]
1185
+ [b, i, h]
1186
1186
  ), te = U(() => {
1187
- var b;
1188
- T(!1), (b = V.current) == null || b.close();
1187
+ var C;
1188
+ T(!1), (C = V.current) == null || C.close();
1189
1189
  }, []), xe = U(
1190
- async (b) => {
1191
- h && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), L(!1), R.current = null, await P();
1190
+ async (C) => {
1191
+ h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), L(!1), R.current = null, await P();
1192
1192
  },
1193
1193
  [P, h]
1194
1194
  ), Ne = U(
1195
- async (b) => {
1196
- h && console.log("[MessagingShell] Blocking participant:", b), S(null), L(!1), R.current = null, await P();
1195
+ async (C) => {
1196
+ h && console.log("[MessagingShell] Blocking participant:", C), S(null), L(!1), R.current = null, await P();
1197
1197
  },
1198
1198
  [P, h]
1199
- ), J = !!C;
1200
- return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Qe, {}) }) : E ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: E, onBack: x }) }) : !N || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1199
+ ), J = !!v;
1200
+ return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Qe, {}) }) : I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1201
1201
  le,
1202
1202
  {
1203
1203
  message: "Not connected to messaging service",
1204
- onBack: x
1204
+ onBack: N
1205
1205
  }
1206
- ) }) : $ ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: $ }) }) : /* @__PURE__ */ c(
1206
+ ) }) : $ ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: $ }) }) : /* @__PURE__ */ d(
1207
1207
  "div",
1208
1208
  {
1209
1209
  className: D(
@@ -1211,7 +1211,7 @@ const ze = ({
1211
1211
  s
1212
1212
  ),
1213
1213
  children: [
1214
- /* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
1214
+ /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1215
1215
  /* @__PURE__ */ e(
1216
1216
  "div",
1217
1217
  {
@@ -1219,18 +1219,18 @@ const ze = ({
1219
1219
  "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",
1220
1220
  {
1221
1221
  // Explicitly hidden via prop or in direct conversation mode
1222
- "!hidden": o === !1 || p,
1222
+ "!hidden": r === !1 || p,
1223
1223
  // Normal mode: hide on mobile when channel selected, show on desktop
1224
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !p && J,
1224
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !p && J,
1225
1225
  // Normal mode: show when no channel selected
1226
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !p && !J
1226
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !p && !J
1227
1227
  }
1228
1228
  ),
1229
1229
  children: /* @__PURE__ */ e(
1230
1230
  Be,
1231
1231
  {
1232
1232
  onChannelSelect: A,
1233
- selectedChannel: C || void 0,
1233
+ selectedChannel: v || void 0,
1234
1234
  showStartConversation: Q && !!W,
1235
1235
  onStartConversation: Z,
1236
1236
  participantLabel: z
@@ -1250,18 +1250,18 @@ const ze = ({
1250
1250
  "hidden lg:flex": !p && !J
1251
1251
  }
1252
1252
  ),
1253
- children: C ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1253
+ children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1254
1254
  Ve,
1255
1255
  {
1256
- channel: C,
1256
+ channel: v,
1257
1257
  onBack: q,
1258
1258
  showBackButton: !p,
1259
1259
  renderMessageInputActions: n,
1260
1260
  onLeaveConversation: xe,
1261
1261
  onBlockParticipant: Ne,
1262
- CustomChannelEmptyState: r
1262
+ CustomChannelEmptyState: o
1263
1263
  },
1264
- C.id
1264
+ v.id
1265
1265
  ) }) : /* @__PURE__ */ e(
1266
1266
  qe,
1267
1267
  {
@@ -1279,8 +1279,8 @@ const ze = ({
1279
1279
  {
1280
1280
  ref: V,
1281
1281
  className: "mes-dialog",
1282
- onClick: (b) => {
1283
- b.target === V.current && te();
1282
+ onClick: (C) => {
1283
+ C.target === V.current && te();
1284
1284
  },
1285
1285
  onClose: te,
1286
1286
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
@@ -1293,7 +1293,7 @@ const ze = ({
1293
1293
  participantLabel: z,
1294
1294
  searchPlaceholder: `Search ${z}...`
1295
1295
  },
1296
- v
1296
+ w
1297
1297
  ) })
1298
1298
  }
1299
1299
  )
@@ -1327,74 +1327,74 @@ const ze = ({
1327
1327
  onFaqClick: s,
1328
1328
  loadingFaqId: n,
1329
1329
  headerText: l,
1330
- className: a,
1331
- avatarImage: d,
1332
- avatarName: i
1330
+ className: i,
1331
+ avatarImage: c,
1332
+ avatarName: a
1333
1333
  }) => {
1334
- const r = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
1335
- return r.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", a), children: /* @__PURE__ */ c("div", { className: "flex gap-3 items-end", children: [
1336
- (d || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1334
+ const o = t.filter((r) => r.enabled).sort((r, b) => (r.order ?? 0) - (b.order ?? 0));
1335
+ return o.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", i), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1336
+ (c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1337
1337
  Y,
1338
1338
  {
1339
- id: i || "account",
1340
- name: i || "Account",
1341
- image: d,
1339
+ id: a || "account",
1340
+ name: a || "Account",
1341
+ image: c,
1342
1342
  size: 24
1343
1343
  }
1344
1344
  ) }),
1345
- /* @__PURE__ */ c(
1345
+ /* @__PURE__ */ d(
1346
1346
  "div",
1347
1347
  {
1348
1348
  className: "flex-1 rounded-lg p-4 space-y-3",
1349
1349
  style: { backgroundColor: "#F1F0EE" },
1350
1350
  children: [
1351
1351
  l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1352
- r.map((o) => /* @__PURE__ */ e(
1352
+ o.map((r) => /* @__PURE__ */ e(
1353
1353
  Ze,
1354
1354
  {
1355
- question: o.question,
1356
- onClick: () => s(o.id),
1357
- loading: n === o.id
1355
+ question: r.question,
1356
+ onClick: () => s(r.id),
1357
+ loading: n === r.id
1358
1358
  },
1359
- o.id
1359
+ r.id
1360
1360
  ))
1361
1361
  ]
1362
1362
  }
1363
1363
  )
1364
1364
  ] }) });
1365
1365
  }, os = (t, s = {}) => {
1366
- const { initialSearch: n = "", pageSize: l = 20 } = s, [a, d] = I([]), [i, r] = I(!1), [o, w] = I(null), [u, N] = I(n), [m, E] = I(!0), [x, h] = I(), C = U(async (k = !1, T) => {
1367
- if (i) return;
1366
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [i, c] = E([]), [a, o] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, I] = E(!0), [N, h] = E(), v = U(async (k = !1, T) => {
1367
+ if (a) return;
1368
1368
  const f = T !== void 0 ? T : u;
1369
- r(!0), w(null);
1369
+ o(!0), b(null);
1370
1370
  try {
1371
- const g = await t.loadParticipants({
1371
+ const x = await t.loadParticipants({
1372
1372
  search: f || void 0,
1373
1373
  limit: l,
1374
- cursor: k ? void 0 : x
1374
+ cursor: k ? void 0 : N
1375
1375
  });
1376
- d(
1377
- (v) => k ? g.participants : [...v, ...g.participants]
1378
- ), E(g.hasMore), h(g.nextCursor);
1379
- } catch (g) {
1380
- const v = g instanceof Error ? g.message : "Failed to load participants";
1381
- w(v), console.error("[useParticipants] Load error:", g);
1376
+ c(
1377
+ (w) => k ? x.participants : [...w, ...x.participants]
1378
+ ), I(x.hasMore), h(x.nextCursor);
1379
+ } catch (x) {
1380
+ const w = x instanceof Error ? x.message : "Failed to load participants";
1381
+ b(w), console.error("[useParticipants] Load error:", x);
1382
1382
  } finally {
1383
- r(!1);
1383
+ o(!1);
1384
1384
  }
1385
- }, [t, u, x, l, i]), S = U(() => {
1386
- m && !i && C(!1);
1387
- }, [m, i, C]), O = U((k) => {
1388
- N(k), h(void 0), C(!0, k);
1389
- }, [C]), y = U(() => {
1390
- h(void 0), C(!0);
1391
- }, [C]);
1385
+ }, [t, u, N, l, a]), S = U(() => {
1386
+ m && !a && v(!1);
1387
+ }, [m, a, v]), O = U((k) => {
1388
+ g(k), h(void 0), v(!0, k);
1389
+ }, [v]), y = U(() => {
1390
+ h(void 0), v(!0);
1391
+ }, [v]);
1392
1392
  return G(() => {
1393
- C(!0);
1393
+ v(!0);
1394
1394
  }, [t.loadParticipants]), {
1395
- participants: a,
1396
- loading: i,
1397
- error: o,
1395
+ participants: i,
1396
+ loading: a,
1397
+ error: r,
1398
1398
  searchQuery: u,
1399
1399
  hasMore: m,
1400
1400
  totalCount: t.totalCount,