@linktr.ee/messaging-react 1.7.0 → 1.7.2-rc-1763202567

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