@linktr.ee/messaging-react 1.12.2-rc-1765340127 โ†’ 1.12.2-rc-1765345284

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
2
- import k from "classnames";
3
- import O, { createContext as Ue, useContext as Pe, useCallback as _, useState as E, useRef as z, useEffect as $ } from "react";
1
+ import { jsx as e, jsxs as i, Fragment as ve } from "react/jsx-runtime";
2
+ import p from "classnames";
3
+ import U, { createContext as Pe, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
4
4
  import { StreamChatService as je } from "@linktr.ee/messaging-core";
5
- import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as Ge, MessageInput as $e, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
- import { XIcon as ue, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as Ce } from "stream-chat";
8
- const ye = Ue({
5
+ import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as $e, MessageInput as Ge, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as we, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
+ import { XIcon as me, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as be } from "stream-chat";
8
+ const ye = Pe({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,48 +15,48 @@ const ye = Ue({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), oe = () => Pe(ye), _s = ({
18
+ }), oe = () => Oe(ye), Ms = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
- capabilities: o = {},
24
- debug: d = !1
23
+ capabilities: a = {},
24
+ debug: c = !1
25
25
  }) => {
26
- const l = _(
27
- (u, ...C) => {
28
- d && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...C);
26
+ const l = D(
27
+ (u, ...b) => {
28
+ c && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...b);
29
29
  },
30
- [d]
30
+ [c]
31
31
  );
32
32
  l("๐Ÿ”„ RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
34
34
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
- capabilities: Object.keys(o)
36
+ capabilities: Object.keys(a)
37
37
  });
38
- const [m, h] = E(null), [g, v] = E(null), [f, S] = E(!1), [R, w] = E(!1), [c, x] = E(null), y = z(!1), I = z({
38
+ const [m, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [M, v] = y(!1), [d, N] = y(null), E = z(!1), I = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
- capabilities: o
43
- }), M = z(0);
44
- M.current++, l("๐Ÿ“Š RENDER INFO", {
45
- renderCount: M.current,
42
+ capabilities: a
43
+ }), k = z(0);
44
+ k.current++, l("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: k.current,
46
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: I.current.userId !== (s == null ? void 0 : s.id),
49
49
  apiKeyChanged: I.current.apiKey !== r,
50
50
  serviceConfigChanged: I.current.serviceConfig !== n,
51
- capabilitiesChanged: I.current.capabilities !== o
51
+ capabilitiesChanged: I.current.capabilities !== a
52
52
  }
53
53
  }), I.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
55
  apiKey: r,
56
56
  serviceConfig: n,
57
- capabilities: o
58
- }, $(() => {
59
- const u = M.current;
57
+ capabilities: a
58
+ }, G(() => {
59
+ const u = k.current;
60
60
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
61
  renderCount: u,
62
62
  apiKey: !!r,
@@ -79,40 +79,40 @@ const ye = Ue({
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: I.current.serviceConfig !== n
81
81
  });
82
- const C = new je({
82
+ const b = new je({
83
83
  ...n,
84
84
  apiKey: r,
85
- debug: d
85
+ debug: c
86
86
  });
87
- return h(C), l("โœ… SERVICE SET", {
87
+ return h(b), l("โœ… SERVICE SET", {
88
88
  renderCount: u,
89
- serviceInstance: !!C
89
+ serviceInstance: !!b
90
90
  }), () => {
91
91
  l("๐Ÿงน SERVICE CLEANUP", {
92
92
  renderCount: u,
93
93
  reason: "Effect cleanup"
94
- }), C.disconnectUser().catch(console.error);
94
+ }), b.disconnectUser().catch(console.error);
95
95
  };
96
- }, [r, n, d, l]);
97
- const N = z(null);
98
- $(() => {
99
- var C, B;
96
+ }, [r, n, c, l]);
97
+ const x = z(null);
98
+ G(() => {
99
+ var b, B;
100
100
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!m,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: y.current,
104
+ isConnecting: E.current,
105
105
  isConnected: f,
106
106
  dependencies: { service: !!m, userId: s == null ? void 0 : s.id }
107
107
  }), !m || !s) {
108
108
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (y.current) {
111
+ if (E.current) {
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((C = N.current) == null ? void 0 : C.serviceId) === m && ((B = N.current) == null ? void 0 : B.userId) === s.id) {
115
+ if (((b = x.current) == null ? void 0 : b.serviceId) === m && ((B = x.current) == null ? void 0 : B.userId) === s.id) {
116
116
  l(
117
117
  "โš ๏ธ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,40 +120,40 @@ const ye = Ue({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), y.current = !0, w(!0), x(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, v(!0), N(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const j = await m.connectUser(s);
127
- v(j), S(!0), N.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
127
+ w(j), S(!0), x.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: j.userID
130
130
  });
131
131
  } catch (j) {
132
- const Z = j instanceof Error ? j.message : "Connection failed";
133
- x(Z), l("โŒ USER CONNECTION ERROR", {
132
+ const W = j instanceof Error ? j.message : "Connection failed";
133
+ N(W), l("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: Z
135
+ error: W
136
136
  });
137
137
  } finally {
138
- w(!1), y.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ v(!1), E.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
140
  isConnected: f
141
141
  });
142
142
  }
143
143
  })();
144
- }, [m, s, l, f]), $(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [m, s, l, f]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!m,
146
146
  isConnected: f
147
147
  }), () => {
148
148
  m && f ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), N.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), x.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!m,
153
153
  isConnected: f
154
154
  });
155
155
  }), [m, f, l]);
156
- const p = _(async () => {
156
+ const R = D(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!m,
159
159
  hasUser: !!s
@@ -161,52 +161,52 @@ const ye = Ue({
161
161
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
164
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await m.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
167
  const u = await m.connectUser(s);
168
- v(u), S(!0), x(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ w(u), S(!0), N(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
169
  } catch (u) {
170
- const C = u instanceof Error ? u.message : "Refresh failed";
171
- x(C), l("โŒ CONNECTION REFRESH ERROR", {
170
+ const b = u instanceof Error ? u.message : "Refresh failed";
171
+ N(b), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: C
173
+ error: b
174
174
  });
175
175
  } finally {
176
- w(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ v(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, l]), a = O.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [m, s, l]), o = U.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!m,
180
180
  hasClient: !!g,
181
181
  isConnected: f,
182
- isLoading: R,
183
- hasError: !!c,
184
- capabilitiesKeys: Object.keys(o)
182
+ isLoading: M,
183
+ hasError: !!d,
184
+ capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: m,
187
187
  client: g,
188
188
  isConnected: f,
189
- isLoading: R,
190
- error: c,
191
- capabilities: o,
192
- refreshConnection: p,
193
- debug: d
189
+ isLoading: M,
190
+ error: d,
191
+ capabilities: a,
192
+ refreshConnection: R,
193
+ debug: c
194
194
  }), [
195
195
  m,
196
196
  g,
197
197
  f,
198
+ M,
199
+ d,
200
+ a,
198
201
  R,
199
202
  c,
200
- o,
201
- p,
202
- d,
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
- renderCount: M.current,
206
+ renderCount: k.current,
207
207
  willRenderChat: !!(g && f),
208
- contextValueReady: !!a
209
- }), /* @__PURE__ */ e(ye.Provider, { value: a, children: g && f ? /* @__PURE__ */ e(
208
+ contextValueReady: !!o
209
+ }), /* @__PURE__ */ e(ye.Provider, { value: o, children: g && f ? /* @__PURE__ */ e(
210
210
  Ae,
211
211
  {
212
212
  client: g,
@@ -219,11 +219,11 @@ const ye = Ue({
219
219
  }, rs = () => oe(), ls = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
- ), o = new Date(
222
+ ), a = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
- return Math.floor(o / (1e3 * 60 * 60 * 24));
226
- }, os = (t) => {
225
+ return Math.floor(a / (1e3 * 60 * 60 * 24));
226
+ }, as = (t) => {
227
227
  const s = /* @__PURE__ */ new Date();
228
228
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
229
229
  return "Just now";
@@ -236,7 +236,7 @@ const ye = Ue({
236
236
  day: "numeric",
237
237
  year: "2-digit"
238
238
  });
239
- }, be = [
239
+ }, Ce = [
240
240
  "๐ŸŽ",
241
241
  // Apple
242
242
  "๐ŸŒ",
@@ -264,7 +264,7 @@ const ye = Ue({
264
264
  "๐Ÿˆ"
265
265
  // Melon
266
266
  ];
267
- function as(t) {
267
+ function os(t) {
268
268
  let s = 0;
269
269
  for (let n = 0; n < t.length; n++) {
270
270
  const r = t.charCodeAt(n);
@@ -273,24 +273,24 @@ function as(t) {
273
273
  return Math.abs(s);
274
274
  }
275
275
  function is(t) {
276
- const n = as(t) % be.length;
277
- return be[n];
276
+ const n = os(t) % Ce.length;
277
+ return Ce[n];
278
278
  }
279
- const Y = ({
279
+ const q = ({
280
280
  id: t,
281
281
  image: s,
282
282
  size: n = 40,
283
283
  className: r,
284
- shape: o = "squircle"
284
+ shape: a = "squircle"
285
285
  }) => {
286
- const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = o === "circle" ? { borderRadius: "50%" } : {
286
+ const c = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
287
287
  borderRadius: "33%",
288
288
  "corner-shape": "superellipse(1.3)"
289
289
  };
290
290
  return /* @__PURE__ */ e(
291
291
  "div",
292
292
  {
293
- className: k("flex-shrink-0 overflow-hidden", r),
293
+ className: p("flex-shrink-0 overflow-hidden", r),
294
294
  style: {
295
295
  width: `${n}px`,
296
296
  height: `${n}px`,
@@ -307,56 +307,56 @@ const Y = ({
307
307
  "div",
308
308
  {
309
309
  "aria-hidden": "true",
310
- className: k(
310
+ className: p(
311
311
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
312
  m
313
313
  ),
314
- children: d
314
+ children: c
315
315
  }
316
316
  )
317
317
  }
318
318
  );
319
- }, Ee = O.memo(
320
- ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
321
- var x, y, I, M, N, p;
322
- const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
319
+ }, Ee = U.memo(
320
+ ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
+ var N, E, I, k, x, R;
322
+ const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
323
  t && n(t);
324
- }, h = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
325
- (a) => {
326
- var u, C;
327
- return ((u = a.user) == null ? void 0 : u.id) && a.user.id !== ((C = t == null ? void 0 : t._client) == null ? void 0 : C.userID);
324
+ }, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
325
+ (o) => {
326
+ var u, b;
327
+ return ((u = o.user) == null ? void 0 : u.id) && o.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
328
328
  }
329
- ), g = ((y = h == null ? void 0 : h.user) == null ? void 0 : y.name) || "Conversation", v = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (N = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : N[t.state.messages.length - 1], R = (() => {
329
+ ), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1], M = (() => {
330
330
  var u;
331
331
  if (f != null && f.text) return f.text;
332
- const a = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
- return a != null && a.asset_url ? a.asset_url : a != null && a.image_url ? a.image_url : a != null && a.og_scrape_url ? a.og_scrape_url : a != null && a.thumb_url ? a.thumb_url : "No messages yet";
334
- })(), w = f != null && f.created_at ? os(new Date(f.created_at)) : "", c = o ?? 0;
332
+ const o = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
+ return o != null && o.asset_url ? o.asset_url : o != null && o.image_url ? o.image_url : o != null && o.og_scrape_url ? o.og_scrape_url : o != null && o.thumb_url ? o.thumb_url : "No messages yet";
334
+ })(), v = f != null && f.created_at ? as(new Date(f.created_at)) : "", d = a ?? 0;
335
335
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
336
336
  channelId: t == null ? void 0 : t.id,
337
- isSelected: d,
337
+ isSelected: c,
338
338
  participantName: g,
339
- unreadCount: c,
340
- hasTimestamp: !!w
339
+ unreadCount: d,
340
+ hasTimestamp: !!v
341
341
  }), /* @__PURE__ */ e(
342
342
  "button",
343
343
  {
344
344
  type: "button",
345
345
  onClick: l,
346
- className: k(
346
+ className: p(
347
347
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
348
348
  {
349
- "bg-primary-alt/10 border-l-4 border-l-primary": d,
350
- "hover:bg-sand": !d
349
+ "bg-primary-alt/10 border-l-4 border-l-primary": c,
350
+ "hover:bg-sand": !c
351
351
  }
352
352
  ),
353
353
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
354
354
  /* @__PURE__ */ e(
355
- Y,
355
+ q,
356
356
  {
357
- id: ((p = h == null ? void 0 : h.user) == null ? void 0 : p.id) || t.id || "unknown",
357
+ id: ((R = h == null ? void 0 : h.user) == null ? void 0 : R.id) || t.id || "unknown",
358
358
  name: g,
359
- image: v,
359
+ image: w,
360
360
  size: 44,
361
361
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
362
362
  }
@@ -366,18 +366,18 @@ const Y = ({
366
366
  /* @__PURE__ */ e(
367
367
  "h3",
368
368
  {
369
- className: k(
369
+ className: p(
370
370
  "text-sm font-medium truncate",
371
- d ? "text-primary" : "text-charcoal"
371
+ c ? "text-primary" : "text-charcoal"
372
372
  ),
373
373
  children: g
374
374
  }
375
375
  ),
376
- w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
376
+ v && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: v })
377
377
  ] }),
378
378
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
380
- 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
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: M }),
380
+ d > 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: d > 99 ? "99+" : d })
381
381
  ] })
382
382
  ] })
383
383
  ] })
@@ -386,23 +386,23 @@ const Y = ({
386
386
  }
387
387
  );
388
388
  Ee.displayName = "CustomChannelPreview";
389
- const Ie = O.memo(
389
+ const Ie = U.memo(
390
390
  ({
391
391
  onChannelSelect: t,
392
392
  selectedChannel: s,
393
393
  filters: n,
394
394
  className: r,
395
- customEmptyStateIndicator: o
395
+ customEmptyStateIndicator: a
396
396
  }) => {
397
- const d = O.useRef(0);
398
- d.current++;
397
+ const c = U.useRef(0);
398
+ c.current++;
399
399
  const { debug: l = !1 } = oe();
400
400
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
401
- renderCount: d.current,
401
+ renderCount: c.current,
402
402
  selectedChannelId: s == null ? void 0 : s.id,
403
403
  filters: n
404
404
  });
405
- const m = O.useMemo(() => (g) => /* @__PURE__ */ e(
405
+ const m = U.useMemo(() => (g) => /* @__PURE__ */ e(
406
406
  Ee,
407
407
  {
408
408
  ...g,
@@ -414,7 +414,7 @@ const Ie = O.memo(
414
414
  return /* @__PURE__ */ e(
415
415
  "div",
416
416
  {
417
- className: k(
417
+ className: p(
418
418
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
419
419
  r
420
420
  ),
@@ -425,7 +425,7 @@ const Ie = O.memo(
425
425
  sort: { last_message_at: -1 },
426
426
  options: { limit: 30 },
427
427
  Preview: m,
428
- EmptyStateIndicator: o
428
+ EmptyStateIndicator: a
429
429
  },
430
430
  JSON.stringify(n)
431
431
  ) })
@@ -443,7 +443,7 @@ const ne = ({
443
443
  "button",
444
444
  {
445
445
  type: "button",
446
- className: k(
446
+ className: p(
447
447
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
448
448
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
449
449
  s
@@ -457,7 +457,7 @@ function Se({ label: t, className: s, children: n, ...r }) {
457
457
  "button",
458
458
  {
459
459
  type: "button",
460
- className: k(
460
+ className: p(
461
461
  "rounded-full p-2 transition-colors focus-ring",
462
462
  {
463
463
  "cursor-not-allowed opacity-50": r.disabled,
@@ -474,17 +474,17 @@ function Se({ label: t, className: s, children: n, ...r }) {
474
474
  );
475
475
  }
476
476
  function pe({ onClick: t }) {
477
- return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
477
+ return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
478
478
  }
479
479
  const cs = (t) => ({
480
480
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
481
+ (s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
482
482
  )
483
483
  }), ds = ({
484
484
  link: t,
485
485
  onDismiss: s
486
486
  }) => {
487
- const { og_scrape_url: n, title: r, image_url: o } = t;
487
+ const { og_scrape_url: n, title: r, image_url: a } = t;
488
488
  return /* @__PURE__ */ i(
489
489
  "a",
490
490
  {
@@ -493,10 +493,10 @@ const cs = (t) => ({
493
493
  rel: "noopener noreferrer",
494
494
  className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
495
495
  children: [
496
- o && /* @__PURE__ */ e(
496
+ a && /* @__PURE__ */ e(
497
497
  "img",
498
498
  {
499
- src: o,
499
+ src: a,
500
500
  alt: r || "",
501
501
  className: "h-[148px] w-full rounded-[20px] object-cover"
502
502
  }
@@ -510,7 +510,7 @@ const cs = (t) => ({
510
510
  },
511
511
  className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
512
512
  "aria-label": "Close link preview",
513
- children: /* @__PURE__ */ e(ue, { className: "size-4 text-black/90" })
513
+ children: /* @__PURE__ */ e(me, { className: "size-4 text-black/90" })
514
514
  }
515
515
  ),
516
516
  /* @__PURE__ */ i("div", { className: "p-2", children: [
@@ -521,23 +521,23 @@ const cs = (t) => ({
521
521
  }
522
522
  );
523
523
  }, us = () => {
524
- const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = Ge(
524
+ const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = $e(
525
525
  t.state,
526
526
  cs
527
- ), n = (o) => {
528
- t.dismissPreview(o);
527
+ ), n = (a) => {
528
+ t.dismissPreview(a);
529
529
  };
530
- return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
530
+ return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
531
531
  ds,
532
532
  {
533
- link: o,
533
+ link: a,
534
534
  onDismiss: n
535
535
  },
536
- o.og_scrape_url
536
+ a.og_scrape_url
537
537
  )) }) : null;
538
538
  }, ms = () => {
539
539
  const { handleSubmit: t } = He(), s = Ve();
540
- return /* @__PURE__ */ i(we, { children: [
540
+ return /* @__PURE__ */ i(ve, { children: [
541
541
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
542
542
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
543
  /* @__PURE__ */ e(Ze, {}),
@@ -570,7 +570,7 @@ const cs = (t) => ({
570
570
  renderActions: t
571
571
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
572
572
  t && (t == null ? void 0 : t()),
573
- /* @__PURE__ */ e($e, { Input: ms })
573
+ /* @__PURE__ */ e(Ge, { Input: ms })
574
574
  ] }), fs = (t) => {
575
575
  const s = t.message.hide_date === !0;
576
576
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
@@ -581,10 +581,10 @@ const cs = (t) => ({
581
581
  ] }),
582
582
  !s && /* @__PURE__ */ e(Je, { message: t.message })
583
583
  ] });
584
- }, gs = () => (console.log("[ChannelEmptyState] render - returning NULL"), null), xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
584
+ }, gs = () => null, xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
585
585
  "div",
586
586
  {
587
- className: k("flex items-center justify-center h-full", t),
587
+ className: p("flex items-center justify-center h-full", t),
588
588
  children: [
589
589
  /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
590
590
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -624,25 +624,25 @@ const cs = (t) => ({
624
624
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
625
625
  ]
626
626
  }
627
- ), me = O.memo(() => (console.log("[LoadingState] render - showing loading spinner"), /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
627
+ ), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
628
628
  /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
629
629
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
630
- ] }) })));
631
- me.displayName = "LoadingState";
630
+ ] }) }));
631
+ ae.displayName = "LoadingState";
632
632
  const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
633
- var h, g, v, f, S;
634
- const { channel: o } = ve(), d = O.useMemo(() => Object.values(o.state.members || {}).find(
635
- (w) => {
636
- var c;
637
- return ((c = w.user) == null ? void 0 : c.id) && w.user.id !== o._client.userID;
633
+ var h, g, w, f, S;
634
+ const { channel: a } = we(), c = U.useMemo(() => Object.values(a.state.members || {}).find(
635
+ (v) => {
636
+ var d;
637
+ return ((d = v.user) == null ? void 0 : d.id) && v.user.id !== a._client.userID;
638
638
  }
639
- ), [o._client.userID, o.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (v = d == null ? void 0 : d.user) == null ? void 0 : v.image;
639
+ ), [a._client.userID, a.state.members]), l = ((h = c == null ? void 0 : c.user) == null ? void 0 : h.name) || ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || "Unknown member", m = (w = c == null ? void 0 : c.user) == null ? void 0 : w.image;
640
640
  return /* @__PURE__ */ i("div", { className: "@container", children: [
641
641
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
642
642
  /* @__PURE__ */ e(
643
643
  "button",
644
644
  {
645
- className: k(
645
+ className: p(
646
646
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
647
647
  !s && "invisible"
648
648
  ),
@@ -655,9 +655,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
655
655
  ),
656
656
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
657
657
  /* @__PURE__ */ e(
658
- Y,
658
+ q,
659
659
  {
660
- id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || o.id || "unknown",
660
+ id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || a.id || "unknown",
661
661
  name: l,
662
662
  image: m,
663
663
  size: 40
@@ -668,7 +668,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
668
668
  /* @__PURE__ */ e(
669
669
  "button",
670
670
  {
671
- className: k(
671
+ className: p(
672
672
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
673
673
  ),
674
674
  onClick: n,
@@ -691,9 +691,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
691
691
  }
692
692
  ),
693
693
  /* @__PURE__ */ e(
694
- Y,
694
+ q,
695
695
  {
696
- id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || o.id || "unknown",
696
+ id: ((S = c == null ? void 0 : c.user) == null ? void 0 : S.id) || a.id || "unknown",
697
697
  name: l,
698
698
  image: m,
699
699
  size: 40
@@ -704,7 +704,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
704
704
  r && n && /* @__PURE__ */ e(
705
705
  "button",
706
706
  {
707
- className: k(
707
+ className: p(
708
708
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
709
709
  ),
710
710
  onClick: n,
@@ -713,31 +713,31 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
713
713
  )
714
714
  ] })
715
715
  ] });
716
- }, Cs = ({
716
+ }, bs = ({
717
717
  dialogRef: t,
718
718
  onClose: s,
719
719
  participant: n,
720
720
  channel: r,
721
- followerStatusLabel: o,
722
- onLeaveConversation: d,
721
+ followerStatusLabel: a,
722
+ onLeaveConversation: c,
723
723
  onBlockParticipant: l,
724
724
  showDeleteConversation: m = !0,
725
725
  onDeleteConversationClick: h,
726
726
  onBlockParticipantClick: g,
727
- onReportParticipantClick: v
727
+ onReportParticipantClick: w
728
728
  }) => {
729
- var Q, X, ie, U, H, V, G;
730
- const { service: f, debug: S } = oe(), [R, w] = E(!1), [c, x] = E(!1), [y, I] = E(!1), M = _(async () => {
731
- var D;
732
- if (!(!f || !((D = n == null ? void 0 : n.user) != null && D.id)))
729
+ var Q, X, ce, O, H, J, $;
730
+ const { service: f, debug: S } = oe(), [M, v] = y(!1), [d, N] = y(!1), [E, I] = y(!1), k = D(async () => {
731
+ var _;
732
+ if (!(!f || !((_ = n == null ? void 0 : n.user) != null && _.id)))
733
733
  try {
734
734
  const A = (await f.getBlockedUsers()).some(
735
- (W) => {
735
+ (V) => {
736
736
  var K;
737
- return W.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
737
+ return V.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
738
738
  }
739
739
  );
740
- w(A);
740
+ v(A);
741
741
  } catch (T) {
742
742
  console.error(
743
743
  "[ChannelInfoDialog] Failed to check blocked status:",
@@ -745,55 +745,55 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
745
745
  );
746
746
  }
747
747
  }, [f, (Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id]);
748
- $(() => {
749
- M();
750
- }, [M]);
751
- const N = async () => {
752
- var D;
753
- if (!c) {
754
- h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), x(!0);
748
+ G(() => {
749
+ k();
750
+ }, [k]);
751
+ const x = async () => {
752
+ var _;
753
+ if (!d) {
754
+ h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
755
755
  try {
756
- const T = ((D = r._client) == null ? void 0 : D.userID) ?? null;
757
- await r.hide(T, !1), d && await d(r), s();
756
+ const T = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
757
+ await r.hide(T, !1), c && await c(r), s();
758
758
  } catch (T) {
759
759
  console.error("[ChannelInfoDialog] Failed to leave conversation", T);
760
760
  } finally {
761
- x(!1);
761
+ N(!1);
762
762
  }
763
763
  }
764
- }, p = async () => {
765
- var D, T, A;
766
- if (!(y || !f)) {
767
- g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
764
+ }, R = async () => {
765
+ var _, T, A;
766
+ if (!(E || !f)) {
767
+ g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
768
768
  try {
769
769
  await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
770
- } catch (W) {
771
- console.error("[ChannelInfoDialog] Failed to block member", W);
770
+ } catch (V) {
771
+ console.error("[ChannelInfoDialog] Failed to block member", V);
772
772
  } finally {
773
773
  I(!1);
774
774
  }
775
775
  }
776
- }, a = async () => {
777
- var D, T, A;
778
- if (!(y || !f)) {
779
- g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
776
+ }, o = async () => {
777
+ var _, T, A;
778
+ if (!(E || !f)) {
779
+ g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
780
780
  try {
781
781
  await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
782
- } catch (W) {
783
- console.error("[ChannelInfoDialog] Failed to unblock member", W);
782
+ } catch (V) {
783
+ console.error("[ChannelInfoDialog] Failed to unblock member", V);
784
784
  } finally {
785
785
  I(!1);
786
786
  }
787
787
  }
788
788
  }, u = () => {
789
- v == null || v(), s(), window.open(
789
+ w == null || w(), s(), window.open(
790
790
  "https://linktr.ee/s/about/trust-center/report",
791
791
  "_blank",
792
792
  "noopener,noreferrer"
793
793
  );
794
794
  };
795
795
  if (!n) return null;
796
- const C = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (U = n.user) == null ? void 0 : U.image, j = (H = n.user) == null ? void 0 : H.email, Z = (V = n.user) == null ? void 0 : V.username, J = j || (Z ? `linktr.ee/${Z}` : void 0), ae = ((G = n.user) == null ? void 0 : G.id) || "unknown";
796
+ const b = ((X = n.user) == null ? void 0 : X.name) || ((ce = n.user) == null ? void 0 : ce.id) || "Unknown member", B = (O = n.user) == null ? void 0 : O.image, j = (H = n.user) == null ? void 0 : H.email, W = (J = n.user) == null ? void 0 : J.username, Y = j || (W ? `linktr.ee/${W}` : void 0), ie = (($ = n.user) == null ? void 0 : $.id) || "unknown";
797
797
  return (
798
798
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
799
799
  /* @__PURE__ */ e(
@@ -802,8 +802,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
802
802
  ref: t,
803
803
  className: "mes-dialog group",
804
804
  onClose: s,
805
- onClick: (D) => {
806
- D.target === t.current && s();
805
+ onClick: (_) => {
806
+ _.target === t.current && s();
807
807
  },
808
808
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
809
809
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
@@ -818,30 +818,30 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
818
818
  style: { backgroundColor: "#FBFAF9" },
819
819
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
820
820
  /* @__PURE__ */ e(
821
- Y,
821
+ q,
822
822
  {
823
- id: ae,
824
- name: C,
823
+ id: ie,
824
+ name: b,
825
825
  image: B,
826
826
  size: 88,
827
827
  shape: "circle"
828
828
  }
829
829
  ),
830
830
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
831
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: C }),
832
- J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
833
- o && /* @__PURE__ */ e(
831
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: b }),
832
+ Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
833
+ a && /* @__PURE__ */ e(
834
834
  "span",
835
835
  {
836
836
  className: "mt-1 rounded-full text-xs font-normal w-fit",
837
837
  style: {
838
838
  padding: "4px 8px",
839
- backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
840
- color: o === "Subscribed to you" ? "#008236" : "#78716C",
839
+ backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
840
+ color: a === "Subscribed to you" ? "#008236" : "#78716C",
841
841
  lineHeight: "133.333%",
842
842
  letterSpacing: "0.21px"
843
843
  },
844
- children: o
844
+ children: a
845
845
  }
846
846
  )
847
847
  ] })
@@ -852,34 +852,34 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
852
852
  m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
853
853
  ne,
854
854
  {
855
- onClick: N,
856
- disabled: c,
857
- "aria-busy": c,
855
+ onClick: x,
856
+ disabled: d,
857
+ "aria-busy": d,
858
858
  children: [
859
- c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
859
+ d ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
860
860
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
861
861
  ]
862
862
  }
863
863
  ) }),
864
- /* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
864
+ /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
865
865
  ne,
866
866
  {
867
- onClick: a,
868
- disabled: y,
869
- "aria-busy": y,
867
+ onClick: o,
868
+ disabled: E,
869
+ "aria-busy": E,
870
870
  children: [
871
- y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
871
+ E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
872
872
  /* @__PURE__ */ e("span", { children: "Unblock" })
873
873
  ]
874
874
  }
875
875
  ) : /* @__PURE__ */ i(
876
876
  ne,
877
877
  {
878
- onClick: p,
879
- disabled: y,
880
- "aria-busy": y,
878
+ onClick: R,
879
+ disabled: E,
880
+ "aria-busy": E,
881
881
  children: [
882
- y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
882
+ E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
883
883
  /* @__PURE__ */ e("span", { children: "Block" })
884
884
  ]
885
885
  }
@@ -894,43 +894,43 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
894
894
  }
895
895
  )
896
896
  );
897
- }, bs = ({
897
+ }, Cs = ({
898
898
  onBack: t,
899
899
  showBackButton: s,
900
900
  renderMessageInputActions: n,
901
901
  onLeaveConversation: r,
902
- onBlockParticipant: o,
903
- showDeleteConversation: d = !0,
902
+ onBlockParticipant: a,
903
+ showDeleteConversation: c = !0,
904
904
  onDeleteConversationClick: l,
905
905
  onBlockParticipantClick: m,
906
906
  onReportParticipantClick: h
907
907
  }) => {
908
- const { channel: g } = ve(), v = z(null), f = O.useMemo(() => Object.values(g.state.members || {}).find(
909
- (x) => {
910
- var y;
911
- return ((y = x.user) == null ? void 0 : y.id) && x.user.id !== g._client.userID;
908
+ const { channel: g } = we(), w = z(null), f = U.useMemo(() => Object.values(g.state.members || {}).find(
909
+ (N) => {
910
+ var E;
911
+ return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
912
912
  }
913
- ), [g._client.userID, g.state.members]), S = O.useMemo(() => {
914
- const c = g.data ?? {};
915
- if (c.followerStatus)
916
- return String(c.followerStatus);
917
- if (c.isFollower !== void 0)
918
- return c.isFollower ? "Subscribed to you" : "Not subscribed";
919
- }, [g.data]), R = _(() => {
920
- var c;
921
- (c = v.current) == null || c.showModal();
922
- }, []), w = _(() => {
923
- var c;
924
- (c = v.current) == null || c.close();
913
+ ), [g._client.userID, g.state.members]), S = U.useMemo(() => {
914
+ const d = g.data ?? {};
915
+ if (d.followerStatus)
916
+ return String(d.followerStatus);
917
+ if (d.isFollower !== void 0)
918
+ return d.isFollower ? "Subscribed to you" : "Not subscribed";
919
+ }, [g.data]), M = D(() => {
920
+ var d;
921
+ (d = w.current) == null || d.showModal();
922
+ }, []), v = D(() => {
923
+ var d;
924
+ (d = w.current) == null || d.close();
925
925
  }, []);
926
- return /* @__PURE__ */ i(we, { children: [
926
+ return /* @__PURE__ */ i(ve, { children: [
927
927
  /* @__PURE__ */ i(Xe, { children: [
928
928
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
929
929
  Ns,
930
930
  {
931
931
  onBack: t,
932
932
  showBackButton: s,
933
- onShowInfo: R,
933
+ onShowInfo: M,
934
934
  canShowInfo: !!f
935
935
  }
936
936
  ) }),
@@ -950,79 +950,72 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
950
950
  )
951
951
  ] }),
952
952
  /* @__PURE__ */ e(
953
- Cs,
953
+ bs,
954
954
  {
955
- dialogRef: v,
956
- onClose: w,
955
+ dialogRef: w,
956
+ onClose: v,
957
957
  participant: f,
958
958
  channel: g,
959
959
  followerStatusLabel: S,
960
960
  onLeaveConversation: r,
961
- onBlockParticipant: o,
962
- showDeleteConversation: d,
961
+ onBlockParticipant: a,
962
+ showDeleteConversation: c,
963
963
  onDeleteConversationClick: l,
964
964
  onBlockParticipantClick: m,
965
965
  onReportParticipantClick: h
966
966
  }
967
967
  )
968
968
  ] });
969
- }, ke = O.memo(
969
+ }, ke = U.memo(
970
970
  ({
971
971
  channel: t,
972
972
  onBack: s,
973
973
  showBackButton: n = !1,
974
974
  renderMessageInputActions: r,
975
- onLeaveConversation: o,
976
- onBlockParticipant: d,
975
+ onLeaveConversation: a,
976
+ onBlockParticipant: c,
977
977
  className: l,
978
978
  CustomChannelEmptyState: m = gs,
979
979
  showDeleteConversation: h = !0,
980
980
  onDeleteConversationClick: g,
981
- onBlockParticipantClick: v,
981
+ onBlockParticipantClick: w,
982
982
  onReportParticipantClick: f
983
- }) => {
984
- var S, R;
985
- return console.log("[ChannelView] render", {
986
- channelId: t.id,
987
- channelInitialized: t.initialized,
988
- messageCount: (R = (S = t.state) == null ? void 0 : S.messages) == null ? void 0 : R.length
989
- }), /* @__PURE__ */ e(
990
- "div",
991
- {
992
- className: k(
993
- "messaging-channel-view h-full flex flex-col",
994
- l
995
- ),
996
- children: /* @__PURE__ */ e(
997
- Qe,
998
- {
999
- channel: t,
1000
- MessageSystem: fs,
1001
- EmptyStateIndicator: m,
1002
- LoadingIndicator: me,
1003
- children: /* @__PURE__ */ e(
1004
- bs,
1005
- {
1006
- onBack: s,
1007
- showBackButton: n,
1008
- renderMessageInputActions: r,
1009
- onLeaveConversation: o,
1010
- onBlockParticipant: d,
1011
- CustomChannelEmptyState: m,
1012
- showDeleteConversation: h,
1013
- onDeleteConversationClick: g,
1014
- onBlockParticipantClick: v,
1015
- onReportParticipantClick: f
1016
- }
1017
- )
1018
- }
1019
- )
1020
- }
1021
- );
1022
- }
983
+ }) => /* @__PURE__ */ e(
984
+ "div",
985
+ {
986
+ className: p(
987
+ "messaging-channel-view h-full flex flex-col",
988
+ l
989
+ ),
990
+ children: /* @__PURE__ */ e(
991
+ Qe,
992
+ {
993
+ channel: t,
994
+ MessageSystem: fs,
995
+ EmptyStateIndicator: m,
996
+ LoadingIndicator: ae,
997
+ children: /* @__PURE__ */ e(
998
+ Cs,
999
+ {
1000
+ onBack: s,
1001
+ showBackButton: n,
1002
+ renderMessageInputActions: r,
1003
+ onLeaveConversation: a,
1004
+ onBlockParticipant: c,
1005
+ CustomChannelEmptyState: m,
1006
+ showDeleteConversation: h,
1007
+ onDeleteConversationClick: g,
1008
+ onBlockParticipantClick: w,
1009
+ onReportParticipantClick: f
1010
+ }
1011
+ )
1012
+ }
1013
+ )
1014
+ }
1015
+ )
1023
1016
  );
1024
1017
  ke.displayName = "ChannelView";
1025
- function ws({
1018
+ function vs({
1026
1019
  searchQuery: t,
1027
1020
  setSearchQuery: s,
1028
1021
  placeholder: n
@@ -1043,7 +1036,7 @@ function ws({
1043
1036
  type: "text",
1044
1037
  placeholder: n,
1045
1038
  value: t,
1046
- onChange: (o) => s(o.target.value),
1039
+ onChange: (a) => s(a.target.value),
1047
1040
  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"
1048
1041
  }
1049
1042
  ),
@@ -1052,28 +1045,28 @@ function ws({
1052
1045
  {
1053
1046
  label: "Clear search",
1054
1047
  onClick: () => {
1055
- var o;
1056
- s(""), (o = r.current) == null || o.focus();
1048
+ var a;
1049
+ s(""), (a = r.current) == null || a.focus();
1057
1050
  },
1058
1051
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1059
- children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
1052
+ children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
1060
1053
  }
1061
1054
  )
1062
1055
  ] });
1063
1056
  }
1064
- const vs = ({
1057
+ const ws = ({
1065
1058
  participantSource: t,
1066
1059
  onSelectParticipant: s,
1067
1060
  onClose: n,
1068
1061
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1069
- participantLabel: o = "participants",
1070
- searchPlaceholder: d = "Search participants...",
1062
+ participantLabel: a = "participants",
1063
+ searchPlaceholder: c = "Search participants...",
1071
1064
  className: l
1072
1065
  }) => {
1073
- const { debug: m } = oe(), [h, g] = E(""), [v, f] = E([]), [S, R] = E(!1), [w, c] = E(null), [x, y] = E(
1066
+ const { debug: m } = oe(), [h, g] = y(""), [w, f] = y([]), [S, M] = y(!1), [v, d] = y(null), [N, E] = y(
1074
1067
  null
1075
1068
  ), I = z(!1);
1076
- $(() => {
1069
+ G(() => {
1077
1070
  if (t.loading) {
1078
1071
  m && console.log(
1079
1072
  "[ParticipantPicker] Waiting for participant source to finish loading..."
@@ -1082,7 +1075,7 @@ const vs = ({
1082
1075
  }
1083
1076
  if (I.current) return;
1084
1077
  (async () => {
1085
- m && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), c(null);
1078
+ m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), d(null);
1086
1079
  try {
1087
1080
  const u = await t.loadParticipants({
1088
1081
  search: "",
@@ -1094,34 +1087,34 @@ const vs = ({
1094
1087
  u.participants.length
1095
1088
  );
1096
1089
  } catch (u) {
1097
- const C = u instanceof Error ? u.message : "Failed to load participants";
1098
- c(C), console.error("[ParticipantPicker] Failed to load participants:", u);
1090
+ const b = u instanceof Error ? u.message : "Failed to load participants";
1091
+ d(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1099
1092
  } finally {
1100
- R(!1);
1093
+ M(!1);
1101
1094
  }
1102
1095
  })();
1103
1096
  }, [t.loading, m]);
1104
- const M = v.filter((a) => !r.has(a.id)).filter((a) => {
1105
- var C;
1097
+ const k = w.filter((o) => !r.has(o.id)).filter((o) => {
1098
+ var b;
1106
1099
  if (!h) return !0;
1107
1100
  const u = h.toLowerCase();
1108
- return a.name.toLowerCase().includes(u) || ((C = a.email) == null ? void 0 : C.toLowerCase().includes(u)) || !1;
1109
- }), N = _(
1110
- async (a) => {
1111
- if (!x) {
1112
- y(a.id);
1101
+ return o.name.toLowerCase().includes(u) || ((b = o.email) == null ? void 0 : b.toLowerCase().includes(u)) || !1;
1102
+ }), x = D(
1103
+ async (o) => {
1104
+ if (!N) {
1105
+ E(o.id);
1113
1106
  try {
1114
- await s(a);
1107
+ await s(o);
1115
1108
  } catch (u) {
1116
- console.error("[ParticipantPicker] Failed to start chat:", u), y(null);
1109
+ console.error("[ParticipantPicker] Failed to start chat:", u), E(null);
1117
1110
  }
1118
1111
  }
1119
1112
  },
1120
- [s, x]
1121
- ), p = (a, u) => {
1122
- (a.key === "Enter" || a.key === " ") && (a.preventDefault(), N(u));
1113
+ [s, N]
1114
+ ), R = (o, u) => {
1115
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), x(u));
1123
1116
  };
1124
- return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
1117
+ return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
1125
1118
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1126
1119
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1127
1120
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
@@ -1129,68 +1122,68 @@ const vs = ({
1129
1122
  ] }),
1130
1123
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1131
1124
  "Select a ",
1132
- o.slice(0, -1),
1125
+ a.slice(0, -1),
1133
1126
  " to start messaging (",
1134
- M.length,
1127
+ k.length,
1135
1128
  " available)",
1136
- t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${o} total`
1129
+ t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
1137
1130
  ] }),
1138
1131
  /* @__PURE__ */ e(
1139
- ws,
1132
+ vs,
1140
1133
  {
1141
1134
  searchQuery: h,
1142
1135
  setSearchQuery: g,
1143
- placeholder: d
1136
+ placeholder: c
1144
1137
  }
1145
1138
  )
1146
1139
  ] }),
1147
- w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1140
+ v && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1148
1141
  "Error loading ",
1149
- o,
1142
+ a,
1150
1143
  ": ",
1151
- w
1144
+ v
1152
1145
  ] }),
1153
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && M.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1146
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && k.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1154
1147
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1155
1148
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1156
1149
  "Loading ",
1157
- o,
1150
+ a,
1158
1151
  "..."
1159
1152
  ] })
1160
- ] }) }) : M.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1153
+ ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1161
1154
  /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ne, { className: "h-8 w-8 text-charcoal" }) }),
1162
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${o} found` : v.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1163
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1155
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : w.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1156
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1164
1157
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1165
- M.map((a) => {
1166
- const u = a.name || a.email || a.id, C = a.email && a.name ? a.email : a.phone;
1158
+ k.map((o) => {
1159
+ const u = o.name || o.email || o.id, b = o.email && o.name ? o.email : o.phone;
1167
1160
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1168
1161
  "button",
1169
1162
  {
1170
1163
  type: "button",
1171
- onClick: () => N(a),
1172
- onKeyDown: (B) => p(B, a),
1164
+ onClick: () => x(o),
1165
+ onKeyDown: (B) => R(B, o),
1173
1166
  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",
1174
1167
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1175
1168
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1176
1169
  /* @__PURE__ */ e(
1177
- Y,
1170
+ q,
1178
1171
  {
1179
- id: a.id,
1172
+ id: o.id,
1180
1173
  name: u,
1181
- image: a.image,
1174
+ image: o.image,
1182
1175
  size: 40
1183
1176
  }
1184
1177
  ),
1185
1178
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1186
1179
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1187
- C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
1180
+ b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
1188
1181
  ] })
1189
1182
  ] }),
1190
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: x === a.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1183
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === o.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1191
1184
  ] })
1192
1185
  }
1193
- ) }, a.id);
1186
+ ) }, o.id);
1194
1187
  }),
1195
1188
  S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1196
1189
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
@@ -1332,7 +1325,7 @@ const vs = ({
1332
1325
  ] })
1333
1326
  ]
1334
1327
  }
1335
- ), Re = O.memo(
1328
+ ), Re = U.memo(
1336
1329
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1337
1330
  /* @__PURE__ */ e(ys, {}),
1338
1331
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
@@ -1342,7 +1335,7 @@ const vs = ({
1342
1335
  ] }) })
1343
1336
  );
1344
1337
  Re.displayName = "EmptyState";
1345
- const le = O.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1338
+ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1346
1339
  /* @__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: "โš ๏ธ" }) }),
1347
1340
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1348
1341
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1362,111 +1355,111 @@ const Fs = ({
1362
1355
  className: s,
1363
1356
  renderMessageInputActions: n,
1364
1357
  onChannelSelect: r,
1365
- onParticipantSelect: o,
1366
- initialParticipantFilter: d,
1358
+ onParticipantSelect: a,
1359
+ initialParticipantFilter: c,
1367
1360
  initialParticipantData: l,
1368
1361
  CustomChannelEmptyState: m,
1369
1362
  showChannelList: h = !0,
1370
1363
  filters: g,
1371
- channelListCustomEmptyStateIndicator: v,
1364
+ channelListCustomEmptyStateIndicator: w,
1372
1365
  onDeleteConversationClick: f,
1373
1366
  onBlockParticipantClick: S,
1374
- onReportParticipantClick: R
1367
+ onReportParticipantClick: M
1375
1368
  }) => {
1376
1369
  const {
1377
- service: w,
1378
- client: c,
1379
- isConnected: x,
1380
- isLoading: y,
1370
+ service: v,
1371
+ client: d,
1372
+ isConnected: N,
1373
+ isLoading: E,
1381
1374
  error: I,
1382
- refreshConnection: M,
1383
- debug: N
1384
- } = rs(), [p, a] = E(null), [u, C] = E(!1), [B, j] = E(!1), [Z, J] = E(!1), [ae, Q] = E(/* @__PURE__ */ new Set()), [X, ie] = E(0), [U, H] = E(!1), [V, G] = E(null), D = z(null), {
1375
+ refreshConnection: k,
1376
+ debug: x
1377
+ } = rs(), [R, o] = y(null), [u, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [ie, Q] = y(/* @__PURE__ */ new Set()), [X, ce] = y(0), [O, H] = y(!1), [J, $] = y(null), _ = z(null), {
1385
1378
  participantSource: T,
1386
1379
  participantLabel: A = "participants",
1387
- showDeleteConversation: W = !0
1388
- } = t, K = O.useMemo(() => {
1389
- const b = c == null ? void 0 : c.userID;
1380
+ showDeleteConversation: V = !0
1381
+ } = t, K = U.useMemo(() => {
1382
+ const C = d == null ? void 0 : d.userID;
1390
1383
  return {
1391
1384
  ...{
1392
1385
  type: "messaging",
1393
1386
  last_message_at: { $exists: !0 },
1394
- ...b && {
1395
- members: { $in: [b] },
1387
+ ...C && {
1388
+ members: { $in: [C] },
1396
1389
  hidden: !1
1397
1390
  }
1398
1391
  },
1399
1392
  ...g
1400
1393
  };
1401
- }, [g, c == null ? void 0 : c.userID]), ee = z(null), q = _(async () => {
1402
- if (!c || !x) return;
1403
- const b = c.userID;
1404
- if (b)
1394
+ }, [g, d == null ? void 0 : d.userID]), ee = z(null), Z = D(async () => {
1395
+ if (!d || !N) return;
1396
+ const C = d.userID;
1397
+ if (C)
1405
1398
  try {
1406
- N && console.log("[MessagingShell] Syncing channels for user:", b);
1407
- const P = await c.queryChannels(
1399
+ x && console.log("[MessagingShell] Syncing channels for user:", C);
1400
+ const P = await d.queryChannels(
1408
1401
  {
1409
1402
  type: "messaging",
1410
- members: { $in: [b] }
1403
+ members: { $in: [C] }
1411
1404
  },
1412
1405
  {},
1413
1406
  { limit: 100 }
1414
1407
  ), F = /* @__PURE__ */ new Set();
1415
1408
  P.forEach((L) => {
1416
- const ce = L.state.members;
1417
- Object.values(ce).forEach((Oe) => {
1409
+ const de = L.state.members;
1410
+ Object.values(de).forEach((Ue) => {
1418
1411
  var he;
1419
- const de = (he = Oe.user) == null ? void 0 : he.id;
1420
- de && de !== b && F.add(de);
1412
+ const ue = (he = Ue.user) == null ? void 0 : he.id;
1413
+ ue && ue !== C && F.add(ue);
1421
1414
  });
1422
- }), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), C(P.length > 0), j(!0), ee.current = b, N && console.log("[MessagingShell] Channels synced successfully:", {
1415
+ }), Q((L) => L.size === F.size && [...L].every((de) => F.has(de)) ? L : F), b(P.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
1423
1416
  channelCount: P.length,
1424
1417
  memberCount: F.size
1425
1418
  });
1426
1419
  } catch (P) {
1427
1420
  console.error("[MessagingShell] Failed to sync channels:", P);
1428
1421
  }
1429
- }, [c, x, N]);
1430
- $(() => {
1431
- if (!c || !x) return;
1432
- const b = c.userID;
1433
- b && ee.current !== b && q();
1434
- }, [c, x, q]), $(() => {
1435
- if (!d || !c || !x) return;
1422
+ }, [d, N, x]);
1423
+ G(() => {
1424
+ if (!d || !N) return;
1425
+ const C = d.userID;
1426
+ C && ee.current !== C && Z();
1427
+ }, [d, N, Z]), G(() => {
1428
+ if (!c || !d || !N) return;
1436
1429
  (async () => {
1437
- const P = c.userID;
1430
+ const P = d.userID;
1438
1431
  if (P)
1439
1432
  try {
1440
- N && console.log(
1433
+ x && console.log(
1441
1434
  "[MessagingShell] Loading initial conversation with:",
1442
- d
1435
+ c
1443
1436
  );
1444
- const F = await c.queryChannels(
1437
+ const F = await d.queryChannels(
1445
1438
  {
1446
1439
  type: "messaging",
1447
- members: { $eq: [P, d] }
1440
+ members: { $eq: [P, c] }
1448
1441
  },
1449
1442
  {},
1450
1443
  { limit: 1 }
1451
1444
  );
1452
1445
  if (F.length > 0)
1453
- a(F[0]), H(!0), G(null), r && r(F[0]), N && console.log(
1446
+ o(F[0]), H(!0), $(null), r && r(F[0]), x && console.log(
1454
1447
  "[MessagingShell] Initial conversation loaded:",
1455
1448
  F[0].id
1456
1449
  );
1457
- else if (l && w) {
1458
- N && console.log(
1450
+ else if (l && v) {
1451
+ x && console.log(
1459
1452
  "[MessagingShell] No conversation found, creating one for:",
1460
1453
  l
1461
1454
  );
1462
1455
  try {
1463
- const L = await w.startChannelWithParticipant({
1456
+ const L = await v.startChannelWithParticipant({
1464
1457
  id: l.id,
1465
1458
  name: l.name,
1466
1459
  email: l.email,
1467
1460
  phone: l.phone
1468
1461
  });
1469
- a(L), H(!0), G(null), r && r(L), N && console.log(
1462
+ o(L), H(!0), $(null), r && r(L), x && console.log(
1470
1463
  "[MessagingShell] Channel created and loaded:",
1471
1464
  L.id
1472
1465
  );
@@ -1474,101 +1467,93 @@ const Fs = ({
1474
1467
  console.error(
1475
1468
  "[MessagingShell] Failed to create conversation:",
1476
1469
  L
1477
- ), G("Failed to create conversation");
1470
+ ), $("Failed to create conversation");
1478
1471
  }
1479
1472
  } else
1480
- G(
1473
+ $(
1481
1474
  "No conversation found with this account"
1482
- ), N && console.log(
1475
+ ), x && console.log(
1483
1476
  "[MessagingShell] No conversation found for:",
1484
- d
1477
+ c
1485
1478
  );
1486
1479
  } catch (F) {
1487
1480
  console.error(
1488
1481
  "[MessagingShell] Failed to load initial conversation:",
1489
1482
  F
1490
- ), G("Failed to load conversation");
1483
+ ), $("Failed to load conversation");
1491
1484
  }
1492
1485
  })();
1493
1486
  }, [
1494
- d,
1495
- l,
1496
1487
  c,
1497
- x,
1498
- w,
1488
+ l,
1489
+ d,
1499
1490
  N,
1491
+ v,
1492
+ x,
1500
1493
  r
1501
1494
  ]);
1502
- const Me = _(
1503
- (b) => {
1504
- a(b), r == null || r(b);
1495
+ const _e = D(
1496
+ (C) => {
1497
+ o(C), r == null || r(C);
1505
1498
  },
1506
1499
  [r]
1507
- ), De = _(() => {
1508
- U || a(null);
1509
- }, [U]), _e = _(
1510
- async (b) => {
1500
+ ), De = D(() => {
1501
+ O || o(null);
1502
+ }, [O]), Me = D(
1503
+ async (C) => {
1511
1504
  var P;
1512
- if (w)
1505
+ if (v)
1513
1506
  try {
1514
- N && console.log(
1507
+ x && console.log(
1515
1508
  "[MessagingShell] Starting conversation with:",
1516
- b.id
1509
+ C.id
1517
1510
  );
1518
- const F = await w.startChannelWithParticipant({
1519
- id: b.id,
1520
- name: b.name,
1521
- email: b.email,
1522
- phone: b.phone
1511
+ const F = await v.startChannelWithParticipant({
1512
+ id: C.id,
1513
+ name: C.name,
1514
+ email: C.email,
1515
+ phone: C.phone
1523
1516
  });
1524
1517
  try {
1525
1518
  await F.show();
1526
1519
  } catch (L) {
1527
1520
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1528
1521
  }
1529
- a(F), J(!1), (P = D.current) == null || P.close(), o == null || o(b);
1522
+ o(F), Y(!1), (P = _.current) == null || P.close(), a == null || a(C);
1530
1523
  } catch (F) {
1531
1524
  console.error("[MessagingShell] Failed to start conversation:", F);
1532
1525
  }
1533
1526
  },
1534
- [w, o, N]
1535
- ), se = _(() => {
1536
- var b;
1537
- J(!1), (b = D.current) == null || b.close();
1538
- }, []), Fe = _(
1539
- (b) => {
1540
- b.target === D.current && se();
1527
+ [v, a, x]
1528
+ ), se = D(() => {
1529
+ var C;
1530
+ Y(!1), (C = _.current) == null || C.close();
1531
+ }, []), Fe = D(
1532
+ (C) => {
1533
+ C.target === _.current && se();
1541
1534
  },
1542
1535
  [se]
1543
- ), Te = _(
1544
- async (b) => {
1545
- N && console.log("[MessagingShell] Leaving conversation:", b.id), a(null), H(!1), ee.current = null, await q();
1536
+ ), Te = D(
1537
+ async (C) => {
1538
+ x && console.log("[MessagingShell] Leaving conversation:", C.id), o(null), H(!1), ee.current = null, await Z();
1546
1539
  },
1547
- [q, N]
1548
- ), Le = _(
1549
- async (b) => {
1550
- N && console.log("[MessagingShell] Blocking participant:", b), a(null), H(!1), ee.current = null, await q();
1540
+ [Z, x]
1541
+ ), Le = D(
1542
+ async (C) => {
1543
+ x && console.log("[MessagingShell] Blocking participant:", C), o(null), H(!1), ee.current = null, await Z();
1551
1544
  },
1552
- [q, N]
1553
- ), te = !!p;
1554
- return console.log("[MessagingShell] render", {
1555
- isLoading: y,
1556
- error: I,
1557
- isConnected: x,
1558
- hasClient: !!c,
1559
- directConversationError: V,
1560
- selectedChannelId: p == null ? void 0 : p.id,
1561
- directConversationMode: U
1562
- }), y ? (console.log("[MessagingShell] showing LOADING state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(me, {}) })) : I ? (console.log("[MessagingShell] showing ERROR state:", I), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: M }) })) : !x || !c ? (console.log("[MessagingShell] showing NOT CONNECTED state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1545
+ [Z, x]
1546
+ ), te = !!R;
1547
+ return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1563
1548
  le,
1564
1549
  {
1565
1550
  message: "Not connected to messaging service",
1566
- onBack: M
1551
+ onBack: k
1567
1552
  }
1568
- ) })) : V ? (console.log("[MessagingShell] showing DIRECT CONVERSATION ERROR:", V), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: V }) })) : (console.log("[MessagingShell] rendering main UI with ChannelView"), /* @__PURE__ */ i(
1553
+ ) }) : J ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: J }) }) : /* @__PURE__ */ i(
1569
1554
  "div",
1570
1555
  {
1571
- className: k(
1556
+ className: p(
1572
1557
  "messaging-shell h-full bg-background-secondary overflow-hidden",
1573
1558
  s
1574
1559
  ),
@@ -1577,23 +1562,23 @@ const Fs = ({
1577
1562
  /* @__PURE__ */ e(
1578
1563
  "div",
1579
1564
  {
1580
- className: k(
1565
+ className: p(
1581
1566
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1582
1567
  {
1583
- "!hidden": h === !1 || U,
1568
+ "!hidden": h === !1 || O,
1584
1569
  // Hide on mobile when channel selected, show on desktop with consistent narrow width
1585
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && te,
1570
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && te,
1586
1571
  // Show on mobile when no channel selected, use same narrow width on desktop
1587
- "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && !te
1572
+ "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && !te
1588
1573
  }
1589
1574
  ),
1590
1575
  children: /* @__PURE__ */ e(
1591
1576
  Ie,
1592
1577
  {
1593
- onChannelSelect: Me,
1594
- selectedChannel: p || void 0,
1578
+ onChannelSelect: _e,
1579
+ selectedChannel: R || void 0,
1595
1580
  filters: K,
1596
- customEmptyStateIndicator: v
1581
+ customEmptyStateIndicator: w
1597
1582
  }
1598
1583
  )
1599
1584
  }
@@ -1601,32 +1586,35 @@ const Fs = ({
1601
1586
  /* @__PURE__ */ e(
1602
1587
  "div",
1603
1588
  {
1604
- className: k(
1589
+ className: p(
1605
1590
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1606
1591
  {
1607
- // In direct conversation mode, always show (full width)
1608
- flex: U || te,
1592
+ // In direct conversation mode (or waiting for it), always show (full width)
1593
+ flex: O || te || c,
1609
1594
  // Normal mode: hide on mobile when no channel selected
1610
- "hidden lg:flex": !U && !te
1595
+ "hidden lg:flex": !O && !te && !c
1611
1596
  }
1612
1597
  ),
1613
- children: p ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1598
+ children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1614
1599
  ke,
1615
1600
  {
1616
- channel: p,
1601
+ channel: R,
1617
1602
  onBack: De,
1618
- showBackButton: !U,
1603
+ showBackButton: !O,
1619
1604
  renderMessageInputActions: n,
1620
1605
  onLeaveConversation: Te,
1621
1606
  onBlockParticipant: Le,
1622
1607
  CustomChannelEmptyState: m,
1623
- showDeleteConversation: W,
1608
+ showDeleteConversation: V,
1624
1609
  onDeleteConversationClick: f,
1625
1610
  onBlockParticipantClick: S,
1626
- onReportParticipantClick: R
1611
+ onReportParticipantClick: M
1627
1612
  },
1628
- p.id
1629
- ) }) : /* @__PURE__ */ e(
1613
+ R.id
1614
+ ) }) : c ? (
1615
+ // Show loading while creating/loading direct conversation channel
1616
+ /* @__PURE__ */ e(ae, {})
1617
+ ) : /* @__PURE__ */ e(
1630
1618
  Re,
1631
1619
  {
1632
1620
  hasChannels: u,
@@ -1640,17 +1628,17 @@ const Fs = ({
1640
1628
  /* @__PURE__ */ e(
1641
1629
  "dialog",
1642
1630
  {
1643
- ref: D,
1631
+ ref: _,
1644
1632
  className: "mes-dialog",
1645
1633
  onClick: Fe,
1646
1634
  onClose: se,
1647
1635
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1648
- vs,
1636
+ ws,
1649
1637
  {
1650
1638
  participantSource: T,
1651
- onSelectParticipant: _e,
1639
+ onSelectParticipant: Me,
1652
1640
  onClose: se,
1653
- existingParticipantIds: ae,
1641
+ existingParticipantIds: ie,
1654
1642
  participantLabel: A,
1655
1643
  searchPlaceholder: `Search ${A}...`
1656
1644
  },
@@ -1660,7 +1648,7 @@ const Fs = ({
1660
1648
  )
1661
1649
  ]
1662
1650
  }
1663
- ));
1651
+ );
1664
1652
  }, Es = ({
1665
1653
  question: t,
1666
1654
  onClick: s,
@@ -1673,7 +1661,7 @@ const Fs = ({
1673
1661
  onClick: s,
1674
1662
  disabled: n,
1675
1663
  style: { backgroundColor: "#E6E5E3" },
1676
- className: k(
1664
+ className: p(
1677
1665
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1678
1666
  {
1679
1667
  "hover:brightness-95 active:brightness-90": !n,
@@ -1688,18 +1676,18 @@ const Fs = ({
1688
1676
  onFaqClick: s,
1689
1677
  loadingFaqId: n,
1690
1678
  headerText: r,
1691
- className: o,
1692
- avatarImage: d,
1679
+ className: a,
1680
+ avatarImage: c,
1693
1681
  avatarName: l
1694
1682
  }) => {
1695
1683
  const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
1696
- return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1697
- (d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1698
- Y,
1684
+ return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1685
+ (c || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1686
+ q,
1699
1687
  {
1700
1688
  id: l || "account",
1701
1689
  name: l || "Account",
1702
- image: d,
1690
+ image: c,
1703
1691
  size: 24,
1704
1692
  shape: "circle"
1705
1693
  }
@@ -1725,57 +1713,57 @@ const Fs = ({
1725
1713
  )
1726
1714
  ] }) });
1727
1715
  }, Ls = (t, s = {}) => {
1728
- const { initialSearch: n = "", pageSize: r = 20 } = s, [o, d] = E([]), [l, m] = E(!1), [h, g] = E(null), [v, f] = E(n), [S, R] = E(!0), [w, c] = E(), x = _(async (N = !1, p) => {
1716
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [l, m] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, M] = y(!0), [v, d] = y(), N = D(async (x = !1, R) => {
1729
1717
  if (l) return;
1730
- const a = p !== void 0 ? p : v;
1718
+ const o = R !== void 0 ? R : w;
1731
1719
  m(!0), g(null);
1732
1720
  try {
1733
1721
  const u = await t.loadParticipants({
1734
- search: a || void 0,
1722
+ search: o || void 0,
1735
1723
  limit: r,
1736
- cursor: N ? void 0 : w
1724
+ cursor: x ? void 0 : v
1737
1725
  });
1738
- d(
1739
- (C) => N ? u.participants : [...C, ...u.participants]
1740
- ), R(u.hasMore), c(u.nextCursor);
1726
+ c(
1727
+ (b) => x ? u.participants : [...b, ...u.participants]
1728
+ ), M(u.hasMore), d(u.nextCursor);
1741
1729
  } catch (u) {
1742
- const C = u instanceof Error ? u.message : "Failed to load participants";
1743
- g(C), console.error("[useParticipants] Load error:", u);
1730
+ const b = u instanceof Error ? u.message : "Failed to load participants";
1731
+ g(b), console.error("[useParticipants] Load error:", u);
1744
1732
  } finally {
1745
1733
  m(!1);
1746
1734
  }
1747
- }, [t, v, w, r, l]), y = _(() => {
1748
- S && !l && x(!1);
1749
- }, [S, l, x]), I = _((N) => {
1750
- f(N), c(void 0), x(!0, N);
1751
- }, [x]), M = _(() => {
1752
- c(void 0), x(!0);
1753
- }, [x]);
1754
- return $(() => {
1755
- x(!0);
1735
+ }, [t, w, v, r, l]), E = D(() => {
1736
+ S && !l && N(!1);
1737
+ }, [S, l, N]), I = D((x) => {
1738
+ f(x), d(void 0), N(!0, x);
1739
+ }, [N]), k = D(() => {
1740
+ d(void 0), N(!0);
1741
+ }, [N]);
1742
+ return G(() => {
1743
+ N(!0);
1756
1744
  }, [t.loadParticipants]), {
1757
- participants: o,
1745
+ participants: a,
1758
1746
  loading: l,
1759
1747
  error: h,
1760
- searchQuery: v,
1748
+ searchQuery: w,
1761
1749
  hasMore: S,
1762
1750
  totalCount: t.totalCount,
1763
- loadMore: y,
1751
+ loadMore: E,
1764
1752
  search: I,
1765
- refresh: M
1753
+ refresh: k
1766
1754
  };
1767
1755
  };
1768
1756
  export {
1769
- Y as Avatar,
1757
+ q as Avatar,
1770
1758
  gs as ChannelEmptyState,
1771
1759
  Ie as ChannelList,
1772
1760
  ke as ChannelView,
1773
1761
  Ts as FaqList,
1774
1762
  Es as FaqListItem,
1775
- _s as MessagingProvider,
1763
+ Ms as MessagingProvider,
1776
1764
  Fs as MessagingShell,
1777
- vs as ParticipantPicker,
1778
- os as formatRelativeTime,
1765
+ ws as ParticipantPicker,
1766
+ as as formatRelativeTime,
1779
1767
  rs as useMessaging,
1780
1768
  Ls as useParticipants
1781
1769
  };