@cedros/login-react 0.0.42 → 0.0.44

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.
Files changed (89) hide show
  1. package/README.md +216 -0
  2. package/dist/{AuthenticationSettings-JxHsBst9.cjs → AuthenticationSettings-BlYOmaEG.cjs} +1 -1
  3. package/dist/{AuthenticationSettings-JxHsBst9.cjs.map → AuthenticationSettings-BlYOmaEG.cjs.map} +1 -1
  4. package/dist/{AuthenticationSettings-DwSxgjbH.js → AuthenticationSettings-BsuwWKbT.js} +1 -1
  5. package/dist/{AuthenticationSettings-DwSxgjbH.js.map → AuthenticationSettings-BsuwWKbT.js.map} +1 -1
  6. package/dist/{AuthenticationSettings-CheE3j7w.js → AuthenticationSettings-DrHqtD7p.js} +1 -1
  7. package/dist/{AuthenticationSettings-CheE3j7w.js.map → AuthenticationSettings-DrHqtD7p.js.map} +1 -1
  8. package/dist/{AuthenticationSettings-Dl41GbJL.cjs → AuthenticationSettings-bNQiNQ9g.cjs} +1 -1
  9. package/dist/{AuthenticationSettings-Dl41GbJL.cjs.map → AuthenticationSettings-bNQiNQ9g.cjs.map} +1 -1
  10. package/dist/{AutosaveStatus-BMXjH1XN.cjs → AutosaveStatus-CZSwtgrL.cjs} +1 -1
  11. package/dist/AutosaveStatus-CZSwtgrL.cjs.map +1 -0
  12. package/dist/{AutosaveStatus-DNuCl59W.js → AutosaveStatus-D-roPsRx.js} +331 -296
  13. package/dist/AutosaveStatus-D-roPsRx.js.map +1 -0
  14. package/dist/{CreditSystemSettings-LvA8rb17.cjs → CreditSystemSettings-3R6crxvW.cjs} +1 -1
  15. package/dist/{CreditSystemSettings-LvA8rb17.cjs.map → CreditSystemSettings-3R6crxvW.cjs.map} +1 -1
  16. package/dist/{CreditSystemSettings-HSdF2_CY.js → CreditSystemSettings-BTqZFn4K.js} +1 -1
  17. package/dist/{CreditSystemSettings-HSdF2_CY.js.map → CreditSystemSettings-BTqZFn4K.js.map} +1 -1
  18. package/dist/{CreditSystemSettings-BVgl6uUg.cjs → CreditSystemSettings-BskW_NKx.cjs} +1 -1
  19. package/dist/{CreditSystemSettings-BVgl6uUg.cjs.map → CreditSystemSettings-BskW_NKx.cjs.map} +1 -1
  20. package/dist/{CreditSystemSettings-C-ksysSx.js → CreditSystemSettings-SL45GRH3.js} +1 -1
  21. package/dist/{CreditSystemSettings-C-ksysSx.js.map → CreditSystemSettings-SL45GRH3.js.map} +1 -1
  22. package/dist/{EmailSettings-hIhJzux0.js → EmailSettings-BUAQji4I.js} +1 -1
  23. package/dist/{EmailSettings-hIhJzux0.js.map → EmailSettings-BUAQji4I.js.map} +1 -1
  24. package/dist/{EmailSettings-DC_zT4nI.cjs → EmailSettings-CEC1rhrm.cjs} +1 -1
  25. package/dist/{EmailSettings-DC_zT4nI.cjs.map → EmailSettings-CEC1rhrm.cjs.map} +1 -1
  26. package/dist/{EmailSettings-QBMzpbxv.cjs → EmailSettings-CihElRkc.cjs} +1 -1
  27. package/dist/{EmailSettings-QBMzpbxv.cjs.map → EmailSettings-CihElRkc.cjs.map} +1 -1
  28. package/dist/{EmailSettings-Cy1cuVUq.js → EmailSettings-XETM8FdS.js} +1 -1
  29. package/dist/{EmailSettings-Cy1cuVUq.js.map → EmailSettings-XETM8FdS.js.map} +1 -1
  30. package/dist/{EmbeddedWalletSettings-CvvTnRvt.js → EmbeddedWalletSettings-B-083zu6.js} +1 -1
  31. package/dist/{EmbeddedWalletSettings-CvvTnRvt.js.map → EmbeddedWalletSettings-B-083zu6.js.map} +1 -1
  32. package/dist/{EmbeddedWalletSettings-Cwiug0vR.js → EmbeddedWalletSettings-CCT9DwmL.js} +1 -1
  33. package/dist/{EmbeddedWalletSettings-Cwiug0vR.js.map → EmbeddedWalletSettings-CCT9DwmL.js.map} +1 -1
  34. package/dist/{EmbeddedWalletSettings-C81QQMWz.cjs → EmbeddedWalletSettings-DXIjansC.cjs} +1 -1
  35. package/dist/{EmbeddedWalletSettings-C81QQMWz.cjs.map → EmbeddedWalletSettings-DXIjansC.cjs.map} +1 -1
  36. package/dist/{EmbeddedWalletSettings-4qC9KBwh.cjs → EmbeddedWalletSettings-MtwR81WH.cjs} +1 -1
  37. package/dist/{EmbeddedWalletSettings-4qC9KBwh.cjs.map → EmbeddedWalletSettings-MtwR81WH.cjs.map} +1 -1
  38. package/dist/{PermissionsSection-CSB_Ikj9.cjs → PermissionsSection-4zcE9Zs9.cjs} +1 -1
  39. package/dist/PermissionsSection-4zcE9Zs9.cjs.map +1 -0
  40. package/dist/{PermissionsSection-BDDiEfho.js → PermissionsSection-mm9hfp-u.js} +94 -74
  41. package/dist/PermissionsSection-mm9hfp-u.js.map +1 -0
  42. package/dist/{ServerSettings-DPqHtsgV.js → ServerSettings-24DA_BOI.js} +1 -1
  43. package/dist/{ServerSettings-DPqHtsgV.js.map → ServerSettings-24DA_BOI.js.map} +1 -1
  44. package/dist/{ServerSettings-BV0SipW1.cjs → ServerSettings-BNc4LEs4.cjs} +1 -1
  45. package/dist/{ServerSettings-BV0SipW1.cjs.map → ServerSettings-BNc4LEs4.cjs.map} +1 -1
  46. package/dist/{ServerSettings-Bf7gFE8r.cjs → ServerSettings-BTEuzdrf.cjs} +1 -1
  47. package/dist/{ServerSettings-Bf7gFE8r.cjs.map → ServerSettings-BTEuzdrf.cjs.map} +1 -1
  48. package/dist/{ServerSettings-Sfr0CG6K.js → ServerSettings-DBpbRihl.js} +1 -1
  49. package/dist/{ServerSettings-Sfr0CG6K.js.map → ServerSettings-DBpbRihl.js.map} +1 -1
  50. package/dist/{TeamSection-BhsBEckR.js → TeamSection-C_eODdLU.js} +1 -1
  51. package/dist/{TeamSection-BhsBEckR.js.map → TeamSection-C_eODdLU.js.map} +1 -1
  52. package/dist/{TeamSection-DLxtRmta.cjs → TeamSection-Km7EwLWD.cjs} +1 -1
  53. package/dist/{TeamSection-DLxtRmta.cjs.map → TeamSection-Km7EwLWD.cjs.map} +1 -1
  54. package/dist/{UsersSection-BEKfbhQ4.cjs → UsersSection-C1Tt0ePx.cjs} +1 -1
  55. package/dist/{UsersSection-BEKfbhQ4.cjs.map → UsersSection-C1Tt0ePx.cjs.map} +1 -1
  56. package/dist/{UsersSection-DbGkmxty.js → UsersSection-Ct_E-MBF.js} +1 -1
  57. package/dist/{UsersSection-DbGkmxty.js.map → UsersSection-Ct_E-MBF.js.map} +1 -1
  58. package/dist/{WebhookSettings-CMROMCFT.js → WebhookSettings-BhIwucKb.js} +1 -1
  59. package/dist/{WebhookSettings-CMROMCFT.js.map → WebhookSettings-BhIwucKb.js.map} +1 -1
  60. package/dist/{WebhookSettings-BPCKv5Or.cjs → WebhookSettings-C6X_JJcD.cjs} +1 -1
  61. package/dist/{WebhookSettings-BPCKv5Or.cjs.map → WebhookSettings-C6X_JJcD.cjs.map} +1 -1
  62. package/dist/{WebhookSettings-D4mKAWAg.js → WebhookSettings-D9IsXZJN.js} +1 -1
  63. package/dist/{WebhookSettings-D4mKAWAg.js.map → WebhookSettings-D9IsXZJN.js.map} +1 -1
  64. package/dist/{WebhookSettings-Cj-iELGa.cjs → WebhookSettings-H1x6IKOj.cjs} +1 -1
  65. package/dist/{WebhookSettings-Cj-iELGa.cjs.map → WebhookSettings-H1x6IKOj.cjs.map} +1 -1
  66. package/dist/admin-only.cjs +1 -1
  67. package/dist/admin-only.js +1 -1
  68. package/dist/index.cjs +12 -12
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.ts +217 -22
  71. package/dist/index.js +7551 -6310
  72. package/dist/index.js.map +1 -1
  73. package/dist/{plugin-BHGg7ius.cjs → plugin-BwwJh2cY.cjs} +1 -1
  74. package/dist/{plugin-BHGg7ius.cjs.map → plugin-BwwJh2cY.cjs.map} +1 -1
  75. package/dist/{plugin-CK2d7aP5.js → plugin-CetHtdLq.js} +1 -1
  76. package/dist/{plugin-CK2d7aP5.js.map → plugin-CetHtdLq.js.map} +1 -1
  77. package/dist/useUsersStatsSummary-BGeh3RnI.js +2025 -0
  78. package/dist/useUsersStatsSummary-BGeh3RnI.js.map +1 -0
  79. package/dist/useUsersStatsSummary-DnsYtFGX.cjs +1 -0
  80. package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +1 -0
  81. package/package.json +1 -1
  82. package/dist/AutosaveStatus-BMXjH1XN.cjs.map +0 -1
  83. package/dist/AutosaveStatus-DNuCl59W.js.map +0 -1
  84. package/dist/PermissionsSection-BDDiEfho.js.map +0 -1
  85. package/dist/PermissionsSection-CSB_Ikj9.cjs.map +0 -1
  86. package/dist/useUsersStatsSummary-9HQDKBU5.js +0 -1879
  87. package/dist/useUsersStatsSummary-9HQDKBU5.js.map +0 -1
  88. package/dist/useUsersStatsSummary-DiRC8sGs.cjs +0 -1
  89. package/dist/useUsersStatsSummary-DiRC8sGs.cjs.map +0 -1
@@ -0,0 +1,2025 @@
1
+ import { jsxs as r, jsx as e, Fragment as V } from "react/jsx-runtime";
2
+ import { useState as p, useMemo as re, useCallback as S, useEffect as I } from "react";
3
+ import { A as Ze, h as U, u as Ce } from "./useCedrosLogin-CFfID-0i.js";
4
+ import { u as ze } from "./useSystemSettings-rgskaDqP.js";
5
+ class Se {
6
+ client;
7
+ constructor(s, n, a, m) {
8
+ this.client = new Ze({ baseUrl: s, timeoutMs: n, retryAttempts: a, getAccessToken: m });
9
+ }
10
+ /**
11
+ * List all users in the system
12
+ */
13
+ async listUsers(s) {
14
+ try {
15
+ const n = new URLSearchParams();
16
+ s?.limit && n.set("limit", String(s.limit)), s?.offset && n.set("offset", String(s.offset));
17
+ const a = n.toString(), m = `/admin/users${a ? `?${a}` : ""}`;
18
+ return await this.client.get(m);
19
+ } catch (n) {
20
+ throw U(n, "Failed to list users");
21
+ }
22
+ }
23
+ /**
24
+ * Get a specific user by ID
25
+ */
26
+ async getUser(s) {
27
+ try {
28
+ return await this.client.get(`/admin/users/${s}`);
29
+ } catch (n) {
30
+ throw U(n, "Failed to get user");
31
+ }
32
+ }
33
+ /**
34
+ * Set a user's system admin status
35
+ */
36
+ async setSystemAdmin(s, n) {
37
+ try {
38
+ await this.client.patch(`/admin/users/${s}/system-admin`, { isAdmin: n });
39
+ } catch (a) {
40
+ throw U(a, "Failed to update system admin status");
41
+ }
42
+ }
43
+ /**
44
+ * Update a user's profile
45
+ */
46
+ async updateUser(s, n) {
47
+ try {
48
+ return await this.client.patch(`/admin/users/${s}`, n);
49
+ } catch (a) {
50
+ throw U(a, "Failed to update user");
51
+ }
52
+ }
53
+ /**
54
+ * Delete a user
55
+ */
56
+ async deleteUser(s) {
57
+ try {
58
+ await this.client.delete(`/admin/users/${s}`);
59
+ } catch (n) {
60
+ throw U(n, "Failed to delete user");
61
+ }
62
+ }
63
+ /**
64
+ * Send a password reset email to a user
65
+ */
66
+ async forcePasswordReset(s) {
67
+ try {
68
+ await this.client.post(`/admin/users/${s}/force-password-reset`, {});
69
+ } catch (n) {
70
+ throw U(n, "Failed to send password reset email");
71
+ }
72
+ }
73
+ /**
74
+ * Adjust a user's credits
75
+ */
76
+ async adjustCredits(s, n) {
77
+ try {
78
+ await this.client.post(`/admin/users/${s}/credits`, n);
79
+ } catch (a) {
80
+ throw U(a, "Failed to adjust credits");
81
+ }
82
+ }
83
+ /**
84
+ * Get a user's deposit history
85
+ */
86
+ async getUserDeposits(s, n) {
87
+ try {
88
+ const a = new URLSearchParams();
89
+ n?.limit && a.set("limit", String(n.limit)), n?.offset && a.set("offset", String(n.offset));
90
+ const m = a.toString(), b = `/admin/users/${s}/deposits${m ? `?${m}` : ""}`;
91
+ return await this.client.get(b);
92
+ } catch (a) {
93
+ throw U(a, "Failed to get user deposits");
94
+ }
95
+ }
96
+ /**
97
+ * Get a user's credit stats and transaction history
98
+ */
99
+ async getUserCredits(s, n) {
100
+ try {
101
+ const a = new URLSearchParams();
102
+ n?.limit && a.set("limit", String(n.limit)), n?.offset && a.set("offset", String(n.offset));
103
+ const m = a.toString(), b = `/admin/users/${s}/credits${m ? `?${m}` : ""}`;
104
+ return await this.client.get(b);
105
+ } catch (a) {
106
+ throw U(a, "Failed to get user credits");
107
+ }
108
+ }
109
+ /**
110
+ * Get a user's withdrawal history
111
+ */
112
+ async getUserWithdrawalHistory(s, n) {
113
+ try {
114
+ const a = new URLSearchParams();
115
+ n?.limit && a.set("limit", String(n.limit)), n?.offset && a.set("offset", String(n.offset));
116
+ const m = a.toString(), b = `/admin/users/${s}/withdrawal-history${m ? `?${m}` : ""}`;
117
+ return await this.client.get(b);
118
+ } catch (a) {
119
+ throw U(a, "Failed to get user withdrawal history");
120
+ }
121
+ }
122
+ /**
123
+ * Get a user's chat history (from cedros-pay)
124
+ * Only available when cedros-pay is enabled.
125
+ */
126
+ async getUserChats(s, n) {
127
+ try {
128
+ const a = new URLSearchParams();
129
+ n?.limit && a.set("limit", String(n.limit)), n?.offset && a.set("offset", String(n.offset));
130
+ const m = a.toString(), b = `/admin/users/${s}/chats${m ? `?${m}` : ""}`;
131
+ return await this.client.get(b);
132
+ } catch (a) {
133
+ throw U(a, "Failed to get user chat history");
134
+ }
135
+ }
136
+ /**
137
+ * Get the list of users directly referred by a given user
138
+ */
139
+ async getUserReferrals(s, n) {
140
+ try {
141
+ const a = new URLSearchParams();
142
+ n?.limit && a.set("limit", String(n.limit)), n?.offset && a.set("offset", String(n.offset));
143
+ const m = a.toString(), b = `/admin/users/${s}/referrals${m ? `?${m}` : ""}`;
144
+ return await this.client.get(b);
145
+ } catch (a) {
146
+ throw U(a, "Failed to get user referrals");
147
+ }
148
+ }
149
+ /**
150
+ * Get a user's KYC status and session history
151
+ */
152
+ async getUserKyc(s) {
153
+ try {
154
+ return await this.client.get(`/admin/users/${s}/kyc`);
155
+ } catch (n) {
156
+ throw U(n, "Failed to get user KYC data");
157
+ }
158
+ }
159
+ /**
160
+ * Override a user's KYC status (system admin only)
161
+ *
162
+ * @param userId - target user ID
163
+ * @param status - new status: "none" | "verified" | "failed"
164
+ */
165
+ async overrideUserKyc(s, n) {
166
+ try {
167
+ await this.client.post(`/admin/users/${s}/kyc/override`, { status: n });
168
+ } catch (a) {
169
+ throw U(a, "Failed to override KYC status");
170
+ }
171
+ }
172
+ /**
173
+ * Get a user's accreditation status and submission history
174
+ */
175
+ async getUserAccreditation(s) {
176
+ try {
177
+ return await this.client.get(
178
+ `/admin/users/${s}/accreditation`
179
+ );
180
+ } catch (n) {
181
+ throw U(n, "Failed to get user accreditation data");
182
+ }
183
+ }
184
+ /**
185
+ * Review an accreditation submission (approve or reject).
186
+ *
187
+ * @param submissionId - target submission ID
188
+ * @param approved - true to approve, false to reject
189
+ * @param reviewerNotes - optional internal notes
190
+ * @param rejectionReason - required when approved is false
191
+ * @param expiryDays - override default expiry (approve only)
192
+ */
193
+ async reviewAccreditation(s, n, a, m, b) {
194
+ try {
195
+ await this.client.post(`/admin/accreditation/${s}/review`, {
196
+ approved: n,
197
+ reviewerNotes: a,
198
+ rejectionReason: m,
199
+ expiryDays: b
200
+ });
201
+ } catch (v) {
202
+ throw U(v, "Failed to review accreditation submission");
203
+ }
204
+ }
205
+ /**
206
+ * Override a user's accreditation status (system admin only).
207
+ *
208
+ * @param userId - target user ID
209
+ * @param status - new status: "none" | "approved" | "rejected"
210
+ */
211
+ async overrideAccreditationStatus(s, n) {
212
+ try {
213
+ await this.client.post(`/admin/users/${s}/accreditation/override`, { status: n });
214
+ } catch (a) {
215
+ throw U(a, "Failed to override accreditation status");
216
+ }
217
+ }
218
+ /**
219
+ * Get user statistics by auth method
220
+ */
221
+ async getStats() {
222
+ try {
223
+ return await this.client.get("/admin/users/stats");
224
+ } catch (s) {
225
+ throw U(s, "Failed to get user stats");
226
+ }
227
+ }
228
+ /**
229
+ * List pending accreditation submissions (queue view).
230
+ *
231
+ * @param limit - page size (default 20)
232
+ * @param offset - pagination offset
233
+ */
234
+ async listPendingAccreditations(s = 20, n = 0) {
235
+ try {
236
+ const a = new URLSearchParams();
237
+ return a.set("limit", String(s)), a.set("offset", String(n)), await this.client.get(
238
+ `/admin/accreditation/pending?${a.toString()}`
239
+ );
240
+ } catch (a) {
241
+ throw U(a, "Failed to list pending accreditations");
242
+ }
243
+ }
244
+ /**
245
+ * Get full detail for a single accreditation submission.
246
+ *
247
+ * @param submissionId - submission UUID
248
+ */
249
+ async getAccreditationSubmission(s) {
250
+ try {
251
+ return await this.client.get(
252
+ `/admin/accreditation/${s}`
253
+ );
254
+ } catch (n) {
255
+ throw U(n, "Failed to get accreditation submission");
256
+ }
257
+ }
258
+ /**
259
+ * Get a presigned download URL for an accreditation document.
260
+ *
261
+ * @param docId - document UUID
262
+ * @returns presigned URL string
263
+ */
264
+ async getAccreditationDocumentUrl(s) {
265
+ try {
266
+ return (await this.client.get(
267
+ `/admin/accreditation/documents/${s}/url`
268
+ )).url;
269
+ } catch (n) {
270
+ throw U(n, "Failed to get document URL");
271
+ }
272
+ }
273
+ /**
274
+ * Fetch sanctions screening stats.
275
+ */
276
+ async getSanctionsStats() {
277
+ try {
278
+ return await this.client.get("/admin/sanctions/stats");
279
+ } catch (s) {
280
+ throw U(s, "Failed to get sanctions stats");
281
+ }
282
+ }
283
+ /**
284
+ * Force-refresh the sanctions cache.
285
+ */
286
+ async refreshSanctions() {
287
+ try {
288
+ await this.client.post("/admin/sanctions/refresh", {});
289
+ } catch (s) {
290
+ throw U(s, "Failed to refresh sanctions cache");
291
+ }
292
+ }
293
+ }
294
+ function ve() {
295
+ const { config: t, _internal: s } = Ce(), [n, a] = p([]), [m, b] = p(0), [v, c] = p(!1), [o, f] = p(null), [$, P] = p({}), y = re(
296
+ () => new Se(
297
+ t.serverUrl,
298
+ t.requestTimeout,
299
+ t.retryAttempts,
300
+ s?.getAccessToken
301
+ ),
302
+ [t.serverUrl, t.requestTimeout, t.retryAttempts, s]
303
+ ), L = S(
304
+ async (l) => {
305
+ c(!0), f(null), P(l || {});
306
+ try {
307
+ const i = await y.listUsers(l);
308
+ return a(i.users), b(i.total), i;
309
+ } catch (i) {
310
+ const d = i instanceof Error ? i : new Error("Failed to list users");
311
+ throw f(d), d;
312
+ } finally {
313
+ c(!1);
314
+ }
315
+ },
316
+ [y]
317
+ ), A = S(
318
+ async (l) => {
319
+ c(!0), f(null);
320
+ try {
321
+ return await y.getUser(l);
322
+ } catch (i) {
323
+ const d = i instanceof Error ? i : new Error("Failed to get user");
324
+ throw f(d), d;
325
+ } finally {
326
+ c(!1);
327
+ }
328
+ },
329
+ [y]
330
+ ), E = S(
331
+ async (l, i) => {
332
+ c(!0), f(null);
333
+ try {
334
+ await y.setSystemAdmin(l, i), a(
335
+ (d) => d.map((g) => g.id === l ? { ...g, isSystemAdmin: i } : g)
336
+ );
337
+ } catch (d) {
338
+ const g = d instanceof Error ? d : new Error("Failed to update admin status");
339
+ throw f(g), g;
340
+ } finally {
341
+ c(!1);
342
+ }
343
+ },
344
+ [y]
345
+ ), R = S(
346
+ async (l, i) => {
347
+ c(!0), f(null);
348
+ try {
349
+ const d = await y.updateUser(l, i);
350
+ return a((g) => g.map((q) => q.id === l ? d : q)), d;
351
+ } catch (d) {
352
+ const g = d instanceof Error ? d : new Error("Failed to update user");
353
+ throw f(g), g;
354
+ } finally {
355
+ c(!1);
356
+ }
357
+ },
358
+ [y]
359
+ ), w = S(
360
+ async (l) => {
361
+ c(!0), f(null);
362
+ try {
363
+ await y.deleteUser(l), a((i) => i.filter((d) => d.id !== l)), b((i) => i - 1);
364
+ } catch (i) {
365
+ const d = i instanceof Error ? i : new Error("Failed to delete user");
366
+ throw f(d), d;
367
+ } finally {
368
+ c(!1);
369
+ }
370
+ },
371
+ [y]
372
+ ), N = S(
373
+ async (l) => {
374
+ c(!0), f(null);
375
+ try {
376
+ await y.forcePasswordReset(l);
377
+ } catch (i) {
378
+ const d = i instanceof Error ? i : new Error("Failed to send password reset");
379
+ throw f(d), d;
380
+ } finally {
381
+ c(!1);
382
+ }
383
+ },
384
+ [y]
385
+ ), C = S(
386
+ async (l, i, d) => {
387
+ c(!0), f(null);
388
+ try {
389
+ await y.adjustCredits(l, { amount: i, reason: d });
390
+ } catch (g) {
391
+ const q = g instanceof Error ? g : new Error("Failed to adjust credits");
392
+ throw f(q), q;
393
+ } finally {
394
+ c(!1);
395
+ }
396
+ },
397
+ [y]
398
+ ), F = S(
399
+ async (l, i) => {
400
+ c(!0), f(null);
401
+ try {
402
+ return await y.getUserDeposits(l, i);
403
+ } catch (d) {
404
+ const g = d instanceof Error ? d : new Error("Failed to get user deposits");
405
+ throw f(g), g;
406
+ } finally {
407
+ c(!1);
408
+ }
409
+ },
410
+ [y]
411
+ ), _ = S(
412
+ async (l, i) => {
413
+ c(!0), f(null);
414
+ try {
415
+ return await y.getUserCredits(l, i);
416
+ } catch (d) {
417
+ const g = d instanceof Error ? d : new Error("Failed to get user credits");
418
+ throw f(g), g;
419
+ } finally {
420
+ c(!1);
421
+ }
422
+ },
423
+ [y]
424
+ ), O = S(
425
+ async (l, i) => {
426
+ c(!0), f(null);
427
+ try {
428
+ return await y.getUserWithdrawalHistory(l, i);
429
+ } catch (d) {
430
+ const g = d instanceof Error ? d : new Error("Failed to get user withdrawal history");
431
+ throw f(g), g;
432
+ } finally {
433
+ c(!1);
434
+ }
435
+ },
436
+ [y]
437
+ ), x = S(
438
+ async (l, i) => {
439
+ c(!0), f(null);
440
+ try {
441
+ return await y.getUserChats(l, i);
442
+ } catch (d) {
443
+ const g = d instanceof Error ? d : new Error("Failed to get user chat history");
444
+ throw f(g), g;
445
+ } finally {
446
+ c(!1);
447
+ }
448
+ },
449
+ [y]
450
+ ), M = S(
451
+ async (l, i) => {
452
+ c(!0), f(null);
453
+ try {
454
+ return await y.getUserReferrals(l, i);
455
+ } catch (d) {
456
+ const g = d instanceof Error ? d : new Error("Failed to get user referrals");
457
+ throw f(g), g;
458
+ } finally {
459
+ c(!1);
460
+ }
461
+ },
462
+ [y]
463
+ ), K = S(async () => {
464
+ c(!0), f(null);
465
+ try {
466
+ return await y.getStats();
467
+ } catch (l) {
468
+ const i = l instanceof Error ? l : new Error("Failed to get user stats");
469
+ throw f(i), i;
470
+ } finally {
471
+ c(!1);
472
+ }
473
+ }, [y]), u = S(async () => {
474
+ await L($);
475
+ }, [L, $]), k = S(() => {
476
+ f(null);
477
+ }, []);
478
+ return {
479
+ users: n,
480
+ total: m,
481
+ isLoading: v,
482
+ error: o,
483
+ listUsers: L,
484
+ getUser: A,
485
+ setSystemAdmin: E,
486
+ updateUser: R,
487
+ deleteUser: w,
488
+ forcePasswordReset: N,
489
+ adjustCredits: C,
490
+ getUserDeposits: F,
491
+ getUserCredits: _,
492
+ getUserWithdrawalHistory: O,
493
+ getUserChats: x,
494
+ getUserReferrals: M,
495
+ getStats: K,
496
+ refresh: u,
497
+ clearError: k
498
+ };
499
+ }
500
+ function we(t) {
501
+ return new Date(t).toLocaleDateString(void 0, {
502
+ year: "numeric",
503
+ month: "short",
504
+ day: "numeric"
505
+ });
506
+ }
507
+ function et(t) {
508
+ return t.length <= 12 ? t : `${t.slice(0, 6)}...${t.slice(-4)}`;
509
+ }
510
+ function tt(t) {
511
+ return t == null ? "-" : (t / 1e9).toFixed(4);
512
+ }
513
+ function St({
514
+ pageSize: t = 20,
515
+ refreshInterval: s = 0,
516
+ currentUserId: n,
517
+ className: a = "",
518
+ onLoad: m,
519
+ onUserClick: b
520
+ }) {
521
+ const { users: v, total: c, isLoading: o, error: f, listUsers: $, clearError: P } = ve(), [y, L] = p(0), [A, E] = p(null), [R, w] = p("createdAt"), [N, C] = p("desc"), F = (u) => {
522
+ R === u ? C(N === "asc" ? "desc" : "asc") : (w(u), C("desc"));
523
+ }, _ = re(() => [...v].sort((u, k) => {
524
+ let l, i;
525
+ switch (R) {
526
+ case "name":
527
+ l = (u.name || u.email || "").toLowerCase(), i = (k.name || k.email || "").toLowerCase();
528
+ break;
529
+ case "createdAt":
530
+ l = new Date(u.createdAt).getTime(), i = new Date(k.createdAt).getTime();
531
+ break;
532
+ case "lastLoginAt":
533
+ l = u.lastLoginAt ? new Date(u.lastLoginAt).getTime() : 0, i = k.lastLoginAt ? new Date(k.lastLoginAt).getTime() : 0;
534
+ break;
535
+ case "balanceLamports":
536
+ l = u.balanceLamports ?? 0, i = k.balanceLamports ?? 0;
537
+ break;
538
+ default:
539
+ return 0;
540
+ }
541
+ return l < i ? N === "asc" ? -1 : 1 : l > i ? N === "asc" ? 1 : -1 : 0;
542
+ }), [v, R, N]), O = S(async () => {
543
+ try {
544
+ const u = await $({ limit: t, offset: y });
545
+ m?.(u), E(null);
546
+ } catch (u) {
547
+ E(u instanceof Error ? u.message : "Failed to load users");
548
+ }
549
+ }, [t, y, $, m]);
550
+ I(() => {
551
+ L(0);
552
+ }, [t]), I(() => {
553
+ O();
554
+ }, [O]), I(() => {
555
+ if (s <= 0) return;
556
+ const u = setInterval(O, s);
557
+ return () => clearInterval(u);
558
+ }, [s, O]);
559
+ const x = Math.ceil(c / t), M = Math.floor(y / t) + 1, K = (u) => {
560
+ const k = (u - 1) * t;
561
+ L(Math.max(0, Math.min(k, Math.max(0, c - 1))));
562
+ };
563
+ return A || f ? /* @__PURE__ */ r("div", { className: `cedros-admin-user-list cedros-admin-user-list-error ${a}`, children: [
564
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error", children: A || f?.message }),
565
+ /* @__PURE__ */ e(
566
+ "button",
567
+ {
568
+ type: "button",
569
+ className: "cedros-button cedros-button-outline",
570
+ onClick: () => {
571
+ P(), E(null), O();
572
+ },
573
+ children: "Retry"
574
+ }
575
+ )
576
+ ] }) : o && v.length === 0 ? /* @__PURE__ */ r("div", { className: `cedros-admin-user-list cedros-admin-user-list-loading ${a}`, children: [
577
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
578
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-text", children: "Loading users..." })
579
+ ] }) : /* @__PURE__ */ r("div", { className: `cedros-admin-user-list ${a}`, children: [
580
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-list-header", children: [
581
+ /* @__PURE__ */ e("h4", { className: "cedros-admin-user-list-title", children: "All Users" }),
582
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-list-actions", children: [
583
+ /* @__PURE__ */ r("span", { className: "cedros-admin-queue-count", children: [
584
+ c,
585
+ " user",
586
+ c !== 1 ? "s" : ""
587
+ ] }),
588
+ /* @__PURE__ */ e(
589
+ "button",
590
+ {
591
+ type: "button",
592
+ className: "cedros-admin__stats-bar-refresh",
593
+ onClick: O,
594
+ disabled: o,
595
+ title: "Refresh list",
596
+ "aria-label": "Refresh list",
597
+ children: o ? "..." : "↻"
598
+ }
599
+ )
600
+ ] })
601
+ ] }),
602
+ v.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty", children: /* @__PURE__ */ e("p", { className: "cedros-admin-empty-message", children: "No users found." }) }) : /* @__PURE__ */ r(V, { children: [
603
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-table", children: [
604
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-thead", children: [
605
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-th", children: /* @__PURE__ */ r(
606
+ "button",
607
+ {
608
+ type: "button",
609
+ className: `cedros-admin-sort-button ${R === "name" ? "cedros-admin-sort-active" : ""}`,
610
+ onClick: () => F("name"),
611
+ "aria-label": "Sort by user",
612
+ children: [
613
+ "User",
614
+ " ",
615
+ /* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: R === "name" ? N === "asc" ? "↑" : "↓" : "↕" })
616
+ ]
617
+ }
618
+ ) }),
619
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-th", children: /* @__PURE__ */ r(
620
+ "button",
621
+ {
622
+ type: "button",
623
+ className: `cedros-admin-sort-button ${R === "createdAt" ? "cedros-admin-sort-active" : ""}`,
624
+ onClick: () => F("createdAt"),
625
+ "aria-label": "Sort by registered date",
626
+ children: [
627
+ "Registered",
628
+ " ",
629
+ /* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: R === "createdAt" ? N === "asc" ? "↑" : "↓" : "↕" })
630
+ ]
631
+ }
632
+ ) }),
633
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-th", children: /* @__PURE__ */ r(
634
+ "button",
635
+ {
636
+ type: "button",
637
+ className: `cedros-admin-sort-button ${R === "lastLoginAt" ? "cedros-admin-sort-active" : ""}`,
638
+ onClick: () => F("lastLoginAt"),
639
+ "aria-label": "Sort by last login",
640
+ children: [
641
+ "Last Login",
642
+ " ",
643
+ /* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: R === "lastLoginAt" ? N === "asc" ? "↑" : "↓" : "↕" })
644
+ ]
645
+ }
646
+ ) }),
647
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-th", children: /* @__PURE__ */ r(
648
+ "button",
649
+ {
650
+ type: "button",
651
+ className: `cedros-admin-sort-button ${R === "balanceLamports" ? "cedros-admin-sort-active" : ""}`,
652
+ onClick: () => F("balanceLamports"),
653
+ "aria-label": "Sort by balance",
654
+ children: [
655
+ "Balance",
656
+ " ",
657
+ /* @__PURE__ */ e("span", { className: "cedros-admin-sort-icon", children: R === "balanceLamports" ? N === "asc" ? "↑" : "↓" : "↕" })
658
+ ]
659
+ }
660
+ ) })
661
+ ] }),
662
+ _.map((u) => {
663
+ const k = u.id === n;
664
+ return /* @__PURE__ */ r(
665
+ "div",
666
+ {
667
+ className: `cedros-admin-user-row ${k ? "cedros-admin-user-row-current" : ""}`,
668
+ onClick: () => b?.(u),
669
+ onKeyDown: (l) => {
670
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), b?.(u));
671
+ },
672
+ role: b ? "button" : void 0,
673
+ tabIndex: b ? 0 : void 0,
674
+ children: [
675
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-td cedros-admin-user-info", children: [
676
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-avatar", children: u.picture ? /* @__PURE__ */ e(
677
+ "img",
678
+ {
679
+ src: u.picture,
680
+ alt: u.name || u.email || "User",
681
+ className: "cedros-admin-user-avatar-img",
682
+ referrerPolicy: "no-referrer"
683
+ }
684
+ ) : /* @__PURE__ */ e("span", { className: "cedros-admin-user-avatar-placeholder", children: (u.name?.[0] || u.email?.[0] || "?").toUpperCase() }) }),
685
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-details", children: [
686
+ /* @__PURE__ */ r("span", { className: "cedros-admin-user-name", children: [
687
+ u.name || "Unknown",
688
+ k && /* @__PURE__ */ e("span", { className: "cedros-admin-user-you", children: "(you)" })
689
+ ] }),
690
+ /* @__PURE__ */ e("span", { className: "cedros-admin-user-email", title: u.email, children: u.email || et(u.id) })
691
+ ] })
692
+ ] }),
693
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-td", children: we(u.createdAt) }),
694
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-td", children: u.lastLoginAt ? we(u.lastLoginAt) : "-" }),
695
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-td", children: tt(u.balanceLamports) })
696
+ ]
697
+ },
698
+ u.id
699
+ );
700
+ })
701
+ ] }),
702
+ x > 1 && /* @__PURE__ */ r("div", { className: "cedros-admin-pagination", children: [
703
+ /* @__PURE__ */ e(
704
+ "button",
705
+ {
706
+ type: "button",
707
+ className: "cedros-button cedros-button-outline cedros-button-sm",
708
+ onClick: () => K(M - 1),
709
+ disabled: M <= 1,
710
+ children: "Previous"
711
+ }
712
+ ),
713
+ /* @__PURE__ */ r("span", { className: "cedros-admin-page-info", children: [
714
+ "Page ",
715
+ M,
716
+ " of ",
717
+ x,
718
+ " (",
719
+ c,
720
+ " total)"
721
+ ] }),
722
+ /* @__PURE__ */ e(
723
+ "button",
724
+ {
725
+ type: "button",
726
+ className: "cedros-button cedros-button-outline cedros-button-sm",
727
+ onClick: () => K(M + 1),
728
+ disabled: M >= x,
729
+ children: "Next"
730
+ }
731
+ )
732
+ ] })
733
+ ] })
734
+ ] });
735
+ }
736
+ function be(t) {
737
+ return new Date(t).toLocaleDateString(void 0, {
738
+ year: "numeric",
739
+ month: "short",
740
+ day: "numeric"
741
+ });
742
+ }
743
+ function j(t) {
744
+ return new Date(t).toLocaleString(void 0, {
745
+ year: "numeric",
746
+ month: "short",
747
+ day: "numeric",
748
+ hour: "2-digit",
749
+ minute: "2-digit"
750
+ });
751
+ }
752
+ function st(t) {
753
+ return t == null ? "—" : `${(t / 1e9).toFixed(4)} SOL`;
754
+ }
755
+ function se(t) {
756
+ return t == null ? "—" : (t / 1e9).toFixed(4);
757
+ }
758
+ function rt(t) {
759
+ return {
760
+ DEPOSIT: "Deposit",
761
+ SPEND: "Spend",
762
+ ADJUSTMENT: "Adjustment",
763
+ REFUND: "Refund"
764
+ }[t.toUpperCase()] || t;
765
+ }
766
+ function at(t, s) {
767
+ return s ? {
768
+ deposit: "Credit deposit",
769
+ purchase: "Purchase",
770
+ api_call: "API usage",
771
+ subscription: "Subscription",
772
+ refund: "Refund",
773
+ bonus: "Bonus credit",
774
+ promo: "Promotional credit",
775
+ correction: "Balance correction"
776
+ }[s.toLowerCase()] || s : {
777
+ DEPOSIT: "Credit added",
778
+ SPEND: "Credit used",
779
+ ADJUSTMENT: "Manual adjustment",
780
+ REFUND: "Credit refunded"
781
+ }[t.toUpperCase()] || "—";
782
+ }
783
+ function ae({ currentPage: t, totalPages: s, total: n, onPageChange: a }) {
784
+ return /* @__PURE__ */ r("div", { className: "cedros-admin-pagination", children: [
785
+ /* @__PURE__ */ e(
786
+ "button",
787
+ {
788
+ type: "button",
789
+ className: "cedros-button cedros-button-outline cedros-button-sm",
790
+ onClick: () => a(t - 1),
791
+ disabled: t <= 1,
792
+ children: "Previous"
793
+ }
794
+ ),
795
+ /* @__PURE__ */ r("span", { className: "cedros-admin-page-info", children: [
796
+ "Page ",
797
+ t,
798
+ " of ",
799
+ s,
800
+ " (",
801
+ n,
802
+ " total)"
803
+ ] }),
804
+ /* @__PURE__ */ e(
805
+ "button",
806
+ {
807
+ type: "button",
808
+ className: "cedros-button cedros-button-outline cedros-button-sm",
809
+ onClick: () => a(t + 1),
810
+ disabled: t >= s,
811
+ children: "Next"
812
+ }
813
+ )
814
+ ] });
815
+ }
816
+ function nt({
817
+ deposits: t,
818
+ total: s,
819
+ currentPage: n,
820
+ totalPages: a,
821
+ onPageChange: m,
822
+ isLoading: b,
823
+ error: v,
824
+ onRetry: c
825
+ }) {
826
+ return v ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
827
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: v }),
828
+ /* @__PURE__ */ e(
829
+ "button",
830
+ {
831
+ type: "button",
832
+ className: "cedros-button cedros-button-outline cedros-button-sm",
833
+ onClick: c,
834
+ children: "Retry"
835
+ }
836
+ )
837
+ ] }) : b && t.length === 0 ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
838
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
839
+ /* @__PURE__ */ e("span", { children: "Loading deposits..." })
840
+ ] }) : s === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No deposits found." }) : /* @__PURE__ */ r(V, { children: [
841
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
842
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
843
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Date" }),
844
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Amount" }),
845
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Status" }),
846
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Transaction" })
847
+ ] }),
848
+ t.map((o) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
849
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: j(o.createdAt) }),
850
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: st(o.amountLamports) }),
851
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: /* @__PURE__ */ e("span", { className: `cedros-admin-status-badge cedros-admin-status-${o.status}`, children: o.status }) }),
852
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td cedros-admin-list-td-actions", children: o.txSignature ? /* @__PURE__ */ r(V, { children: [
853
+ /* @__PURE__ */ r("span", { className: "cedros-admin-list-td-mono", title: o.txSignature, children: [
854
+ o.txSignature.slice(0, 8),
855
+ "..."
856
+ ] }),
857
+ /* @__PURE__ */ e(
858
+ "a",
859
+ {
860
+ href: `https://orbmarkets.io/tx/${o.txSignature}`,
861
+ target: "_blank",
862
+ rel: "noopener noreferrer",
863
+ className: "cedros-admin-icon-link",
864
+ title: "View on Orbmarkets",
865
+ "aria-label": "View transaction on Orbmarkets",
866
+ children: "↗"
867
+ }
868
+ )
869
+ ] }) : /* @__PURE__ */ e("span", { className: "cedros-admin-list-td-muted", children: "—" }) })
870
+ ] }, o.id))
871
+ ] }),
872
+ a > 1 && /* @__PURE__ */ e(
873
+ ae,
874
+ {
875
+ currentPage: n,
876
+ totalPages: a,
877
+ total: s,
878
+ onPageChange: m
879
+ }
880
+ )
881
+ ] });
882
+ }
883
+ function it({
884
+ transactions: t,
885
+ total: s,
886
+ currentPage: n,
887
+ totalPages: a,
888
+ onPageChange: m,
889
+ isLoading: b,
890
+ error: v,
891
+ onRetry: c
892
+ }) {
893
+ return v ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
894
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: v }),
895
+ /* @__PURE__ */ e(
896
+ "button",
897
+ {
898
+ type: "button",
899
+ className: "cedros-button cedros-button-outline cedros-button-sm",
900
+ onClick: c,
901
+ children: "Retry"
902
+ }
903
+ )
904
+ ] }) : b && t.length === 0 ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
905
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
906
+ /* @__PURE__ */ e("span", { children: "Loading transactions..." })
907
+ ] }) : s === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No credit transactions found." }) : /* @__PURE__ */ r(V, { children: [
908
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
909
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
910
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Date" }),
911
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Type" }),
912
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Description" }),
913
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Amount" })
914
+ ] }),
915
+ t.map((o) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
916
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: j(o.createdAt) }),
917
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: /* @__PURE__ */ e(
918
+ "span",
919
+ {
920
+ className: `cedros-admin-tx-type cedros-admin-tx-type-${o.txType.toLowerCase()}`,
921
+ children: rt(o.txType)
922
+ }
923
+ ) }),
924
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: at(o.txType, o.referenceType) }),
925
+ /* @__PURE__ */ r(
926
+ "div",
927
+ {
928
+ className: `cedros-admin-list-td ${o.amountLamports >= 0 ? "cedros-admin-amount-positive" : "cedros-admin-amount-negative"}`,
929
+ children: [
930
+ o.amountLamports >= 0 ? "+" : "",
931
+ se(o.amountLamports)
932
+ ]
933
+ }
934
+ )
935
+ ] }, o.id))
936
+ ] }),
937
+ a > 1 && /* @__PURE__ */ e(
938
+ ae,
939
+ {
940
+ currentPage: n,
941
+ totalPages: a,
942
+ total: s,
943
+ onPageChange: m
944
+ }
945
+ )
946
+ ] });
947
+ }
948
+ function ct({
949
+ sessions: t,
950
+ total: s,
951
+ currentPage: n,
952
+ totalPages: a,
953
+ onPageChange: m,
954
+ isLoading: b,
955
+ error: v,
956
+ onRetry: c
957
+ }) {
958
+ return v ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
959
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: v }),
960
+ /* @__PURE__ */ e(
961
+ "button",
962
+ {
963
+ type: "button",
964
+ className: "cedros-button cedros-button-outline cedros-button-sm",
965
+ onClick: c,
966
+ children: "Retry"
967
+ }
968
+ )
969
+ ] }) : b && t.length === 0 ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
970
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
971
+ /* @__PURE__ */ e("span", { children: "Loading chat history..." })
972
+ ] }) : s === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No chat sessions found." }) : /* @__PURE__ */ r(V, { children: [
973
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
974
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
975
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Date" }),
976
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Session" }),
977
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Messages" })
978
+ ] }),
979
+ t.map((o) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
980
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: j(o.createdAt) }),
981
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: o.title || `Chat ${o.id.slice(0, 8)}...` }),
982
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: o.messageCount })
983
+ ] }, o.id))
984
+ ] }),
985
+ a > 1 && /* @__PURE__ */ e(
986
+ ae,
987
+ {
988
+ currentPage: n,
989
+ totalPages: a,
990
+ total: s,
991
+ onPageChange: m
992
+ }
993
+ )
994
+ ] });
995
+ }
996
+ function ot({
997
+ referrals: t,
998
+ total: s,
999
+ currentPage: n,
1000
+ totalPages: a,
1001
+ onPageChange: m,
1002
+ isLoading: b,
1003
+ error: v,
1004
+ onRetry: c
1005
+ }) {
1006
+ return v ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
1007
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: v }),
1008
+ /* @__PURE__ */ e(
1009
+ "button",
1010
+ {
1011
+ type: "button",
1012
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1013
+ onClick: c,
1014
+ children: "Retry"
1015
+ }
1016
+ )
1017
+ ] }) : b && t.length === 0 ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
1018
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
1019
+ /* @__PURE__ */ e("span", { children: "Loading referrals..." })
1020
+ ] }) : s === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No referred users found." }) : /* @__PURE__ */ r(V, { children: [
1021
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
1022
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
1023
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Name" }),
1024
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Email" }),
1025
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Joined" }),
1026
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Last Login" })
1027
+ ] }),
1028
+ t.map((o) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
1029
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: o.name || "—" }),
1030
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: o.email || "—" }),
1031
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: be(o.createdAt) }),
1032
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: o.lastLoginAt ? j(o.lastLoginAt) : "—" })
1033
+ ] }, o.id))
1034
+ ] }),
1035
+ a > 1 && /* @__PURE__ */ e(
1036
+ ae,
1037
+ {
1038
+ currentPage: n,
1039
+ totalPages: a,
1040
+ total: s,
1041
+ onPageChange: m
1042
+ }
1043
+ )
1044
+ ] });
1045
+ }
1046
+ const dt = [
1047
+ { value: "none", label: "None (reset)" },
1048
+ { value: "verified", label: "Verified" },
1049
+ { value: "failed", label: "Failed" }
1050
+ ];
1051
+ function lt({
1052
+ kycData: t,
1053
+ userKycStatus: s,
1054
+ userKycVerifiedAt: n,
1055
+ userKycExpiresAt: a,
1056
+ error: m,
1057
+ onRetry: b,
1058
+ onOverride: v
1059
+ }) {
1060
+ const [c, o] = p("none"), [f, $] = p(!1), [P, y] = p(null), L = t?.status ?? s ?? "none", A = t?.verifiedAt ?? n, E = t?.expiresAt ?? a, R = async () => {
1061
+ if (window.confirm(
1062
+ `Override KYC status to "${c}" for this user?`
1063
+ )) {
1064
+ $(!0), y(null);
1065
+ try {
1066
+ await v(c);
1067
+ } catch (N) {
1068
+ y(N instanceof Error ? N.message : "Override failed");
1069
+ } finally {
1070
+ $(!1);
1071
+ }
1072
+ }
1073
+ };
1074
+ return m ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
1075
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: m }),
1076
+ /* @__PURE__ */ e(
1077
+ "button",
1078
+ {
1079
+ type: "button",
1080
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1081
+ onClick: b,
1082
+ children: "Retry"
1083
+ }
1084
+ )
1085
+ ] }) : !t && !s ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
1086
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
1087
+ /* @__PURE__ */ e("span", { children: "Loading KYC data..." })
1088
+ ] }) : /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab", children: [
1089
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-summary", children: [
1090
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1091
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Status" }),
1092
+ /* @__PURE__ */ e("span", { className: `cedros-admin-status-badge cedros-kyc-status-${L}`, children: L })
1093
+ ] }),
1094
+ A && /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1095
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Verified at" }),
1096
+ /* @__PURE__ */ e("span", { children: j(A) })
1097
+ ] }),
1098
+ E && /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1099
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Expires at" }),
1100
+ /* @__PURE__ */ e("span", { children: j(E) })
1101
+ ] })
1102
+ ] }),
1103
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-override", children: [
1104
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-override-label", children: "Override status" }),
1105
+ /* @__PURE__ */ e(
1106
+ "select",
1107
+ {
1108
+ className: "cedros-kyc-admin-override-select",
1109
+ value: c,
1110
+ onChange: (w) => o(w.target.value),
1111
+ disabled: f,
1112
+ "aria-label": "Select KYC override status",
1113
+ children: dt.map((w) => /* @__PURE__ */ e("option", { value: w.value, children: w.label }, w.value))
1114
+ }
1115
+ ),
1116
+ /* @__PURE__ */ e(
1117
+ "button",
1118
+ {
1119
+ type: "button",
1120
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1121
+ onClick: R,
1122
+ disabled: f,
1123
+ children: f ? "Saving..." : "Apply Override"
1124
+ }
1125
+ ),
1126
+ P && /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: P })
1127
+ ] }),
1128
+ t && t.sessions.length > 0 ? /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
1129
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
1130
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Date" }),
1131
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Provider" }),
1132
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Status" }),
1133
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Error" }),
1134
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Completed" })
1135
+ ] }),
1136
+ t.sessions.map((w) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
1137
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: j(w.createdAt) }),
1138
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: w.provider }),
1139
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: /* @__PURE__ */ e(
1140
+ "span",
1141
+ {
1142
+ className: `cedros-admin-status-badge cedros-kyc-status-${w.status}`,
1143
+ children: w.status
1144
+ }
1145
+ ) }),
1146
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td cedros-admin-list-td-muted", children: w.errorCode ? `${w.errorCode}${w.errorReason ? `: ${w.errorReason}` : ""}` : "—" }),
1147
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: w.completedAt ? j(w.completedAt) : "—" })
1148
+ ] }, w.id))
1149
+ ] }) : t && /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No verification sessions found." })
1150
+ ] });
1151
+ }
1152
+ const mt = [
1153
+ { value: "none", label: "None (reset)" },
1154
+ { value: "approved", label: "Approved" },
1155
+ { value: "rejected", label: "Rejected" }
1156
+ ];
1157
+ function ut({
1158
+ accreditationData: t,
1159
+ userAccreditationStatus: s,
1160
+ userAccreditationVerifiedAt: n,
1161
+ userAccreditationExpiresAt: a,
1162
+ error: m,
1163
+ onRetry: b,
1164
+ onOverride: v,
1165
+ onReview: c
1166
+ }) {
1167
+ const [o, f] = p("none"), [$, P] = p(!1), [y, L] = p(null), [A, E] = p(null), [R, w] = p(""), [N, C] = p(""), [F, _] = p(!1), [O, x] = p(null), M = t?.status ?? s ?? "none", K = t?.verifiedAt ?? n, u = t?.expiresAt ?? a, k = async () => {
1168
+ if (window.confirm(
1169
+ `Override accreditation status to "${o}" for this user?`
1170
+ )) {
1171
+ P(!0), L(null);
1172
+ try {
1173
+ await v(o);
1174
+ } catch (d) {
1175
+ L(d instanceof Error ? d.message : "Override failed");
1176
+ } finally {
1177
+ P(!1);
1178
+ }
1179
+ }
1180
+ }, l = async (i, d) => {
1181
+ const g = d ? "approve" : "reject";
1182
+ if (window.confirm(
1183
+ `${g.charAt(0).toUpperCase() + g.slice(1)} this submission?`
1184
+ )) {
1185
+ _(!0), x(null);
1186
+ try {
1187
+ await c(
1188
+ i,
1189
+ d,
1190
+ R || void 0,
1191
+ d ? void 0 : N || void 0
1192
+ ), E(null), w(""), C("");
1193
+ } catch (Y) {
1194
+ x(Y instanceof Error ? Y.message : "Review failed");
1195
+ } finally {
1196
+ _(!1);
1197
+ }
1198
+ }
1199
+ };
1200
+ return m ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-error", children: [
1201
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: m }),
1202
+ /* @__PURE__ */ e(
1203
+ "button",
1204
+ {
1205
+ type: "button",
1206
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1207
+ onClick: b,
1208
+ children: "Retry"
1209
+ }
1210
+ )
1211
+ ] }) : !t && !s ? /* @__PURE__ */ r("div", { className: "cedros-admin-tab-loading", children: [
1212
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
1213
+ /* @__PURE__ */ e("span", { children: "Loading accreditation data..." })
1214
+ ] }) : /* @__PURE__ */ r("div", { className: "cedros-accreditation-admin-tab", children: [
1215
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-summary", children: [
1216
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1217
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Status" }),
1218
+ /* @__PURE__ */ e(
1219
+ "span",
1220
+ {
1221
+ className: `cedros-admin-status-badge cedros-accreditation-status-${M}`,
1222
+ children: M
1223
+ }
1224
+ )
1225
+ ] }),
1226
+ K && /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1227
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Verified at" }),
1228
+ /* @__PURE__ */ e("span", { children: j(K) })
1229
+ ] }),
1230
+ u && /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-tab-row", children: [
1231
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-tab-label", children: "Expires at" }),
1232
+ /* @__PURE__ */ e("span", { children: j(u) })
1233
+ ] })
1234
+ ] }),
1235
+ /* @__PURE__ */ r("div", { className: "cedros-kyc-admin-override", children: [
1236
+ /* @__PURE__ */ e("span", { className: "cedros-kyc-admin-override-label", children: "Override status" }),
1237
+ /* @__PURE__ */ e(
1238
+ "select",
1239
+ {
1240
+ className: "cedros-kyc-admin-override-select",
1241
+ value: o,
1242
+ onChange: (i) => f(i.target.value),
1243
+ disabled: $,
1244
+ "aria-label": "Select accreditation override status",
1245
+ children: mt.map((i) => /* @__PURE__ */ e("option", { value: i.value, children: i.label }, i.value))
1246
+ }
1247
+ ),
1248
+ /* @__PURE__ */ e(
1249
+ "button",
1250
+ {
1251
+ type: "button",
1252
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1253
+ onClick: k,
1254
+ disabled: $,
1255
+ children: $ ? "Saving..." : "Apply Override"
1256
+ }
1257
+ ),
1258
+ y && /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: y })
1259
+ ] }),
1260
+ t && t.submissions.length > 0 ? /* @__PURE__ */ r(V, { children: [
1261
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-table", children: [
1262
+ /* @__PURE__ */ r("div", { className: "cedros-admin-list-thead", children: [
1263
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Date" }),
1264
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Method" }),
1265
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Status" }),
1266
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Expires" }),
1267
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-th", children: "Actions" })
1268
+ ] }),
1269
+ t.submissions.map((i) => /* @__PURE__ */ r("div", { className: "cedros-admin-list-row", children: [
1270
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: j(i.createdAt) }),
1271
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: i.method.replace(/_/g, " ") }),
1272
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: /* @__PURE__ */ e(
1273
+ "span",
1274
+ {
1275
+ className: `cedros-admin-status-badge cedros-accreditation-status-${i.status}`,
1276
+ children: i.status
1277
+ }
1278
+ ) }),
1279
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td", children: i.expiresAt ? j(i.expiresAt) : "—" }),
1280
+ /* @__PURE__ */ e("div", { className: "cedros-admin-list-td cedros-admin-list-td-actions", children: i.status === "pending" && /* @__PURE__ */ e(
1281
+ "button",
1282
+ {
1283
+ type: "button",
1284
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1285
+ onClick: () => E(A === i.id ? null : i.id),
1286
+ children: "Review"
1287
+ }
1288
+ ) })
1289
+ ] }, i.id))
1290
+ ] }),
1291
+ A && /* @__PURE__ */ r("div", { className: "cedros-accreditation-review-panel", children: [
1292
+ /* @__PURE__ */ e("p", { className: "cedros-accreditation-review-title", children: "Review submission" }),
1293
+ /* @__PURE__ */ e("label", { className: "cedros-kyc-admin-tab-label", htmlFor: "review-notes", children: "Reviewer notes (internal)" }),
1294
+ /* @__PURE__ */ e(
1295
+ "input",
1296
+ {
1297
+ id: "review-notes",
1298
+ type: "text",
1299
+ className: "cedros-input cedros-input-sm",
1300
+ value: R,
1301
+ onChange: (i) => w(i.target.value),
1302
+ placeholder: "Optional internal notes",
1303
+ disabled: F
1304
+ }
1305
+ ),
1306
+ /* @__PURE__ */ e("label", { className: "cedros-kyc-admin-tab-label", htmlFor: "review-rejection", children: "Rejection reason (shown to user if rejected)" }),
1307
+ /* @__PURE__ */ e(
1308
+ "input",
1309
+ {
1310
+ id: "review-rejection",
1311
+ type: "text",
1312
+ className: "cedros-input cedros-input-sm",
1313
+ value: N,
1314
+ onChange: (i) => C(i.target.value),
1315
+ placeholder: "Required when rejecting",
1316
+ disabled: F
1317
+ }
1318
+ ),
1319
+ /* @__PURE__ */ r("div", { className: "cedros-accreditation-review-actions", children: [
1320
+ /* @__PURE__ */ e(
1321
+ "button",
1322
+ {
1323
+ type: "button",
1324
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1325
+ onClick: () => l(A, !0),
1326
+ disabled: F,
1327
+ children: F ? "Saving..." : "Approve"
1328
+ }
1329
+ ),
1330
+ /* @__PURE__ */ e(
1331
+ "button",
1332
+ {
1333
+ type: "button",
1334
+ className: "cedros-button cedros-button-outline cedros-button-sm cedros-admin-btn-danger",
1335
+ onClick: () => l(A, !1),
1336
+ disabled: F || !N.trim(),
1337
+ children: F ? "Saving..." : "Reject"
1338
+ }
1339
+ )
1340
+ ] }),
1341
+ O && /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: O })
1342
+ ] })
1343
+ ] }) : t && /* @__PURE__ */ e("div", { className: "cedros-admin-empty-message", children: "No accreditation submissions found." })
1344
+ ] });
1345
+ }
1346
+ function ht({ user: t, isCurrentUser: s }) {
1347
+ return /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-info", children: [
1348
+ /* @__PURE__ */ e("div", { className: "cedros-admin-user-detail-avatar", children: t.picture ? /* @__PURE__ */ e(
1349
+ "img",
1350
+ {
1351
+ src: t.picture,
1352
+ alt: t.name || t.email || "User",
1353
+ className: "cedros-admin-user-detail-avatar-img",
1354
+ referrerPolicy: "no-referrer"
1355
+ }
1356
+ ) : /* @__PURE__ */ e("span", { className: "cedros-admin-user-detail-avatar-placeholder", children: (t.name?.[0] || t.email?.[0] || "?").toUpperCase() }) }),
1357
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-meta", children: [
1358
+ /* @__PURE__ */ r("h2", { className: "cedros-admin-user-detail-name", children: [
1359
+ t.name || "Unknown",
1360
+ s && /* @__PURE__ */ e("span", { className: "cedros-admin-user-you", children: "(you)" })
1361
+ ] }),
1362
+ /* @__PURE__ */ r("p", { className: "cedros-admin-user-detail-email", children: [
1363
+ t.email || "No email",
1364
+ t.emailVerified && /* @__PURE__ */ e("span", { className: "cedros-admin-verified-badge", title: "Email verified", children: "Verified" })
1365
+ ] }),
1366
+ t.isSystemAdmin && /* @__PURE__ */ e("div", { className: "cedros-admin-user-detail-badges", children: /* @__PURE__ */ e("span", { className: "cedros-admin-admin-badge cedros-admin-admin-badge-yes", children: "System Admin" }) }),
1367
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-methods", children: [
1368
+ /* @__PURE__ */ e("span", { className: "cedros-admin-user-detail-methods-label", children: "Auth Methods:" }),
1369
+ t.authMethods.length > 0 ? t.authMethods.map((n) => /* @__PURE__ */ e(
1370
+ "span",
1371
+ {
1372
+ className: `cedros-admin-auth-badge cedros-admin-auth-badge-${n}`,
1373
+ children: n
1374
+ },
1375
+ n
1376
+ )) : /* @__PURE__ */ e("span", { className: "cedros-admin-auth-badge cedros-admin-auth-badge-none", children: "none" })
1377
+ ] }),
1378
+ /* @__PURE__ */ r("p", { className: "cedros-admin-user-detail-dates", children: [
1379
+ "Registered: ",
1380
+ be(t.createdAt),
1381
+ " | Updated: ",
1382
+ be(t.updatedAt)
1383
+ ] }),
1384
+ t.referralCode && /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-referral", children: [
1385
+ /* @__PURE__ */ e("span", { className: "cedros-admin-user-detail-referral-label", children: "Referral:" }),
1386
+ /* @__PURE__ */ e("span", { className: "cedros-admin-user-detail-referral-code", children: t.referralCode }),
1387
+ t.referralCount !== void 0 && t.referralCount > 0 && /* @__PURE__ */ r("span", { className: "cedros-admin-user-detail-referral-count", children: [
1388
+ "(",
1389
+ t.referralCount,
1390
+ " referred)"
1391
+ ] }),
1392
+ t.referredBy && /* @__PURE__ */ r("span", { className: "cedros-admin-user-detail-referred-by", children: [
1393
+ "Referred by:",
1394
+ " ",
1395
+ /* @__PURE__ */ e(
1396
+ "button",
1397
+ {
1398
+ type: "button",
1399
+ className: "cedros-admin-user-uuid-link",
1400
+ onClick: () => navigator.clipboard?.writeText(t.referredBy),
1401
+ title: "Click to copy referrer UUID",
1402
+ children: t.referredBy
1403
+ }
1404
+ )
1405
+ ] })
1406
+ ] })
1407
+ ] })
1408
+ ] });
1409
+ }
1410
+ function ft({ credits: t, creditsError: s, onRetry: n }) {
1411
+ return s ? /* @__PURE__ */ r("div", { className: "cedros-admin-stats-error", children: [
1412
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error-inline", children: s }),
1413
+ /* @__PURE__ */ e(
1414
+ "button",
1415
+ {
1416
+ type: "button",
1417
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1418
+ onClick: n,
1419
+ children: "Retry"
1420
+ }
1421
+ )
1422
+ ] }) : t ? /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-stats", children: [
1423
+ /* @__PURE__ */ r("div", { className: "cedros-admin-stat-card", children: [
1424
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-label", children: "Credit Balance" }),
1425
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-value", children: se(t.stats.currentBalanceLamports) })
1426
+ ] }),
1427
+ /* @__PURE__ */ r("div", { className: "cedros-admin-stat-card", children: [
1428
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-label", children: "Total Credited" }),
1429
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-value", children: se(t.stats.totalDepositedLamports) })
1430
+ ] }),
1431
+ /* @__PURE__ */ r("div", { className: "cedros-admin-stat-card", children: [
1432
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-label", children: "Total Spent" }),
1433
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-value", children: se(t.stats.totalSpentLamports) })
1434
+ ] }),
1435
+ /* @__PURE__ */ r("div", { className: "cedros-admin-stat-card", children: [
1436
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-label", children: "Deposits" }),
1437
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-value", children: t.stats.depositCount })
1438
+ ] }),
1439
+ /* @__PURE__ */ r("div", { className: "cedros-admin-stat-card", children: [
1440
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-label", children: "Transactions" }),
1441
+ /* @__PURE__ */ e("span", { className: "cedros-admin-stat-value", children: t.stats.spendCount })
1442
+ ] })
1443
+ ] }) : /* @__PURE__ */ r("div", { className: "cedros-admin-stats-loading", children: [
1444
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
1445
+ /* @__PURE__ */ e("span", { children: "Loading credit stats..." })
1446
+ ] });
1447
+ }
1448
+ function yt({
1449
+ activeTab: t,
1450
+ onTabChange: s,
1451
+ cedrosPayEnabled: n,
1452
+ user: a,
1453
+ deposits: m,
1454
+ credits: b,
1455
+ chats: v,
1456
+ referrals: c,
1457
+ kycData: o,
1458
+ accreditationData: f,
1459
+ depositsError: $,
1460
+ creditsError: P,
1461
+ chatsError: y,
1462
+ referralsError: L,
1463
+ kycError: A,
1464
+ accreditationError: E,
1465
+ depositsCurrentPage: R,
1466
+ depositsTotalPages: w,
1467
+ onDepositsPageChange: N,
1468
+ transactionsCurrentPage: C,
1469
+ transactionsTotalPages: F,
1470
+ onTransactionsPageChange: _,
1471
+ chatsCurrentPage: O,
1472
+ chatsTotalPages: x,
1473
+ onChatsPageChange: M,
1474
+ referralsCurrentPage: K,
1475
+ referralsTotalPages: u,
1476
+ onReferralsPageChange: k,
1477
+ isLoading: l,
1478
+ onRetryDeposits: i,
1479
+ onRetryCredits: d,
1480
+ onRetryChats: g,
1481
+ onRetryReferrals: q,
1482
+ onRetryKyc: Y,
1483
+ onRetryAccreditation: ne,
1484
+ onKycOverride: G,
1485
+ onAccreditationOverride: H,
1486
+ onAccreditationReview: Q
1487
+ }) {
1488
+ return /* @__PURE__ */ r(V, { children: [
1489
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-tabs", children: [
1490
+ /* @__PURE__ */ r(
1491
+ "button",
1492
+ {
1493
+ type: "button",
1494
+ className: `cedros-admin-tab ${t === "deposits" ? "cedros-admin-tab-active" : ""}`,
1495
+ onClick: () => s("deposits"),
1496
+ children: [
1497
+ "Deposits (",
1498
+ m?.total ?? 0,
1499
+ ")"
1500
+ ]
1501
+ }
1502
+ ),
1503
+ /* @__PURE__ */ r(
1504
+ "button",
1505
+ {
1506
+ type: "button",
1507
+ className: `cedros-admin-tab ${t === "transactions" ? "cedros-admin-tab-active" : ""}`,
1508
+ onClick: () => s("transactions"),
1509
+ children: [
1510
+ "Credits (",
1511
+ b?.totalTransactions ?? 0,
1512
+ ")"
1513
+ ]
1514
+ }
1515
+ ),
1516
+ n && /* @__PURE__ */ r(
1517
+ "button",
1518
+ {
1519
+ type: "button",
1520
+ className: `cedros-admin-tab ${t === "chats" ? "cedros-admin-tab-active" : ""}`,
1521
+ onClick: () => s("chats"),
1522
+ children: [
1523
+ "Chats (",
1524
+ v?.total ?? 0,
1525
+ ")"
1526
+ ]
1527
+ }
1528
+ ),
1529
+ /* @__PURE__ */ r(
1530
+ "button",
1531
+ {
1532
+ type: "button",
1533
+ className: `cedros-admin-tab ${t === "referrals" ? "cedros-admin-tab-active" : ""}`,
1534
+ onClick: () => s("referrals"),
1535
+ children: [
1536
+ "Referrals (",
1537
+ c?.total ?? a.referralCount ?? 0,
1538
+ ")"
1539
+ ]
1540
+ }
1541
+ ),
1542
+ /* @__PURE__ */ r(
1543
+ "button",
1544
+ {
1545
+ type: "button",
1546
+ className: `cedros-admin-tab ${t === "kyc" ? "cedros-admin-tab-active" : ""}`,
1547
+ onClick: () => s("kyc"),
1548
+ children: [
1549
+ "KYC (",
1550
+ o?.totalSessions ?? 0,
1551
+ ")"
1552
+ ]
1553
+ }
1554
+ ),
1555
+ /* @__PURE__ */ r(
1556
+ "button",
1557
+ {
1558
+ type: "button",
1559
+ className: `cedros-admin-tab ${t === "accreditation" ? "cedros-admin-tab-active" : ""}`,
1560
+ onClick: () => s("accreditation"),
1561
+ children: [
1562
+ "Accreditation (",
1563
+ f?.totalSubmissions ?? 0,
1564
+ ")"
1565
+ ]
1566
+ }
1567
+ )
1568
+ ] }),
1569
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-content", children: [
1570
+ t === "deposits" && /* @__PURE__ */ e(
1571
+ nt,
1572
+ {
1573
+ deposits: m?.deposits ?? [],
1574
+ total: m?.total ?? 0,
1575
+ currentPage: R,
1576
+ totalPages: w,
1577
+ onPageChange: N,
1578
+ isLoading: l,
1579
+ error: $,
1580
+ onRetry: i
1581
+ }
1582
+ ),
1583
+ t === "transactions" && /* @__PURE__ */ e(
1584
+ it,
1585
+ {
1586
+ transactions: b?.transactions ?? [],
1587
+ total: b?.totalTransactions ?? 0,
1588
+ currentPage: C,
1589
+ totalPages: F,
1590
+ onPageChange: _,
1591
+ error: P,
1592
+ onRetry: d,
1593
+ isLoading: l
1594
+ }
1595
+ ),
1596
+ t === "chats" && n && /* @__PURE__ */ e(
1597
+ ct,
1598
+ {
1599
+ sessions: v?.sessions ?? [],
1600
+ total: v?.total ?? 0,
1601
+ currentPage: O,
1602
+ totalPages: x,
1603
+ onPageChange: M,
1604
+ error: y,
1605
+ onRetry: g,
1606
+ isLoading: l
1607
+ }
1608
+ ),
1609
+ t === "referrals" && /* @__PURE__ */ e(
1610
+ ot,
1611
+ {
1612
+ referrals: c?.users ?? [],
1613
+ total: c?.total ?? 0,
1614
+ currentPage: K,
1615
+ totalPages: u,
1616
+ onPageChange: k,
1617
+ error: L,
1618
+ onRetry: q,
1619
+ isLoading: l
1620
+ }
1621
+ ),
1622
+ t === "kyc" && /* @__PURE__ */ e(
1623
+ lt,
1624
+ {
1625
+ kycData: o,
1626
+ userKycStatus: a.kycStatus,
1627
+ userKycVerifiedAt: a.kycVerifiedAt,
1628
+ userKycExpiresAt: a.kycExpiresAt,
1629
+ error: A,
1630
+ onRetry: Y,
1631
+ onOverride: G
1632
+ }
1633
+ ),
1634
+ t === "accreditation" && /* @__PURE__ */ e(
1635
+ ut,
1636
+ {
1637
+ accreditationData: f,
1638
+ userAccreditationStatus: a.accreditationStatus,
1639
+ userAccreditationVerifiedAt: a.accreditationVerifiedAt,
1640
+ userAccreditationExpiresAt: a.accreditationExpiresAt,
1641
+ error: E,
1642
+ onRetry: ne,
1643
+ onOverride: H,
1644
+ onReview: Q
1645
+ }
1646
+ )
1647
+ ] })
1648
+ ] });
1649
+ }
1650
+ function At({
1651
+ userId: t,
1652
+ onBack: s,
1653
+ currentUserId: n,
1654
+ onEditUser: a,
1655
+ onAdjustCredits: m,
1656
+ cedrosPayEnabled: b = !1,
1657
+ className: v = ""
1658
+ }) {
1659
+ const { config: c, _internal: o } = Ce(), {
1660
+ isLoading: f,
1661
+ getUser: $,
1662
+ getUserDeposits: P,
1663
+ getUserCredits: y,
1664
+ getUserChats: L,
1665
+ getUserReferrals: A,
1666
+ deleteUser: E,
1667
+ forcePasswordReset: R,
1668
+ clearError: w
1669
+ } = ve(), N = re(
1670
+ () => new Se(
1671
+ c.serverUrl,
1672
+ c.requestTimeout,
1673
+ c.retryAttempts,
1674
+ o?.getAccessToken
1675
+ ),
1676
+ [c.serverUrl, c.requestTimeout, c.retryAttempts, o]
1677
+ ), [C, F] = p(null), [_, O] = p(null), [x, M] = p(null), [K, u] = p(null), [k, l] = p(null), [i, d] = p(null), [g, q] = p(null), [Y, ne] = p("deposits"), [G, H] = p(null), [Q, X] = p(null), [Ae, ie] = p(null), [Ee, ce] = p(null), [Ue, oe] = p(null), [Re, Z] = p(null), [ke, J] = p(null), [z, ee] = p(!1), [de, $e] = p(0), [le, Le] = p(0), [me, Pe] = p(0), [ue, Fe] = p(0), D = 10, he = S(async () => {
1678
+ try {
1679
+ const h = await $(t);
1680
+ F(h), H(null);
1681
+ } catch (h) {
1682
+ H(h instanceof Error ? h.message : "Failed to load user");
1683
+ }
1684
+ }, [t, $]), fe = S(async () => {
1685
+ try {
1686
+ const T = await P(t, { limit: D, offset: de });
1687
+ M(T), ie(null);
1688
+ } catch (h) {
1689
+ ie(h instanceof Error ? h.message : "Failed to load deposits");
1690
+ }
1691
+ }, [t, P, de]), te = S(async () => {
1692
+ try {
1693
+ const T = await y(t, { limit: D, offset: le });
1694
+ O(T), X(null);
1695
+ } catch (h) {
1696
+ X(h instanceof Error ? h.message : "Failed to load credits");
1697
+ }
1698
+ }, [t, y, le]), ye = S(async () => {
1699
+ if (b)
1700
+ try {
1701
+ const T = await L(t, { limit: D, offset: me });
1702
+ u(T), ce(null);
1703
+ } catch (h) {
1704
+ ce(h instanceof Error ? h.message : "Failed to load chat history");
1705
+ }
1706
+ }, [t, L, me, b]), pe = S(async () => {
1707
+ try {
1708
+ const T = await A(t, { limit: D, offset: ue });
1709
+ l(T), oe(null);
1710
+ } catch (h) {
1711
+ oe(h instanceof Error ? h.message : "Failed to load referrals");
1712
+ }
1713
+ }, [t, A, ue]), W = S(async () => {
1714
+ try {
1715
+ const h = await N.getUserKyc(t);
1716
+ d(h), Z(null);
1717
+ } catch (h) {
1718
+ Z(h instanceof Error ? h.message : "Failed to load KYC data");
1719
+ }
1720
+ }, [t, N]), B = S(async () => {
1721
+ try {
1722
+ const h = await N.getUserAccreditation(t);
1723
+ q(h), J(null);
1724
+ } catch (h) {
1725
+ J(
1726
+ h instanceof Error ? h.message : "Failed to load accreditation data"
1727
+ );
1728
+ }
1729
+ }, [t, N]), De = S(
1730
+ async (h) => {
1731
+ try {
1732
+ await N.overrideAccreditationStatus(t, h), await B();
1733
+ } catch (T) {
1734
+ J(
1735
+ T instanceof Error ? T.message : "Failed to override accreditation status"
1736
+ );
1737
+ }
1738
+ },
1739
+ [t, N, B]
1740
+ ), Oe = S(
1741
+ async (h, T, Qe, Xe) => {
1742
+ try {
1743
+ await N.reviewAccreditation(
1744
+ h,
1745
+ T,
1746
+ Qe,
1747
+ Xe
1748
+ ), await B();
1749
+ } catch (Ne) {
1750
+ J(
1751
+ Ne instanceof Error ? Ne.message : "Failed to review accreditation submission"
1752
+ );
1753
+ }
1754
+ },
1755
+ [N, B]
1756
+ ), Te = S(
1757
+ async (h) => {
1758
+ try {
1759
+ await N.overrideUserKyc(t, h), await W();
1760
+ } catch (T) {
1761
+ Z(T instanceof Error ? T.message : "Failed to override KYC status");
1762
+ }
1763
+ },
1764
+ [t, N, W]
1765
+ );
1766
+ I(() => {
1767
+ he(), fe(), te(), pe(), W(), B(), b && ye();
1768
+ }, [he, fe, te, ye, pe, W, B, b]);
1769
+ const xe = async () => {
1770
+ if (!C) return;
1771
+ if (C.id === n) {
1772
+ alert("You cannot delete your own account");
1773
+ return;
1774
+ }
1775
+ if (C.isSystemAdmin) {
1776
+ alert("Cannot delete a system admin. Remove admin status first.");
1777
+ return;
1778
+ }
1779
+ if (window.confirm(
1780
+ `Are you sure you want to delete ${C.name || C.email || "this user"}? This action cannot be undone.`
1781
+ )) {
1782
+ ee(!0);
1783
+ try {
1784
+ await E(C.id), s();
1785
+ } catch {
1786
+ } finally {
1787
+ ee(!1);
1788
+ }
1789
+ }
1790
+ }, Me = async () => {
1791
+ if (!C?.email) {
1792
+ alert("User has no email address");
1793
+ return;
1794
+ }
1795
+ if (window.confirm(`Send a password reset email to ${C.email}?`)) {
1796
+ ee(!0);
1797
+ try {
1798
+ await R(C.id), alert("Password reset email sent");
1799
+ } catch {
1800
+ } finally {
1801
+ ee(!1);
1802
+ }
1803
+ }
1804
+ }, _e = x ? Math.ceil(x.total / D) : 0, Ke = Math.floor(de / D) + 1, je = _ ? Math.ceil(_.totalTransactions / D) : 0, qe = Math.floor(le / D) + 1, Ve = K ? Math.ceil(K.total / D) : 0, Be = Math.floor(me / D) + 1, Ye = k ? Math.ceil(k.total / D) : 0, Ie = Math.floor(ue / D) + 1, He = (h) => $e((h - 1) * D), Je = (h) => Le((h - 1) * D), We = (h) => Pe((h - 1) * D), Ge = (h) => Fe((h - 1) * D);
1805
+ if (G)
1806
+ return /* @__PURE__ */ r("div", { className: `cedros-admin-user-detail cedros-admin-user-detail-error ${v}`, children: [
1807
+ /* @__PURE__ */ e(
1808
+ "button",
1809
+ {
1810
+ type: "button",
1811
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1812
+ onClick: s,
1813
+ children: "Back"
1814
+ }
1815
+ ),
1816
+ /* @__PURE__ */ e("p", { className: "cedros-admin-error", children: G }),
1817
+ /* @__PURE__ */ e(
1818
+ "button",
1819
+ {
1820
+ type: "button",
1821
+ className: "cedros-button cedros-button-outline",
1822
+ onClick: () => {
1823
+ w(), H(null), he();
1824
+ },
1825
+ children: "Retry"
1826
+ }
1827
+ )
1828
+ ] });
1829
+ if (f && !C)
1830
+ return /* @__PURE__ */ r("div", { className: `cedros-admin-user-detail cedros-admin-user-detail-loading ${v}`, children: [
1831
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-indicator" }),
1832
+ /* @__PURE__ */ e("span", { className: "cedros-admin-loading-text", children: "Loading user..." })
1833
+ ] });
1834
+ if (!C)
1835
+ return /* @__PURE__ */ r("div", { className: `cedros-admin-user-detail ${v}`, children: [
1836
+ /* @__PURE__ */ e(
1837
+ "button",
1838
+ {
1839
+ type: "button",
1840
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1841
+ onClick: s,
1842
+ children: "Back"
1843
+ }
1844
+ ),
1845
+ /* @__PURE__ */ e("p", { className: "cedros-admin-empty-message", children: "User not found." })
1846
+ ] });
1847
+ const ge = C.id === n;
1848
+ return /* @__PURE__ */ r("div", { className: `cedros-admin-user-detail ${v}`, children: [
1849
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-header", children: [
1850
+ /* @__PURE__ */ e(
1851
+ "button",
1852
+ {
1853
+ type: "button",
1854
+ className: "cedros-button cedros-button-outline cedros-button-sm cedros-admin-back-btn",
1855
+ onClick: s,
1856
+ children: "Back to Users"
1857
+ }
1858
+ ),
1859
+ /* @__PURE__ */ r("div", { className: "cedros-admin-user-detail-actions", children: [
1860
+ a && /* @__PURE__ */ e(
1861
+ "button",
1862
+ {
1863
+ type: "button",
1864
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1865
+ onClick: () => a(C),
1866
+ disabled: z,
1867
+ children: "Edit"
1868
+ }
1869
+ ),
1870
+ C.email && /* @__PURE__ */ e(
1871
+ "button",
1872
+ {
1873
+ type: "button",
1874
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1875
+ onClick: Me,
1876
+ disabled: z,
1877
+ children: "Reset Password"
1878
+ }
1879
+ ),
1880
+ m && /* @__PURE__ */ e(
1881
+ "button",
1882
+ {
1883
+ type: "button",
1884
+ className: "cedros-button cedros-button-outline cedros-button-sm",
1885
+ onClick: () => m(C),
1886
+ disabled: z,
1887
+ children: "Adjust Credits"
1888
+ }
1889
+ ),
1890
+ !ge && !C.isSystemAdmin && /* @__PURE__ */ e(
1891
+ "button",
1892
+ {
1893
+ type: "button",
1894
+ className: "cedros-button cedros-button-outline cedros-button-sm cedros-admin-btn-danger",
1895
+ onClick: xe,
1896
+ disabled: z,
1897
+ children: "Delete"
1898
+ }
1899
+ )
1900
+ ] })
1901
+ ] }),
1902
+ /* @__PURE__ */ e(ht, { user: C, isCurrentUser: ge }),
1903
+ /* @__PURE__ */ e(
1904
+ ft,
1905
+ {
1906
+ credits: _,
1907
+ creditsError: Q,
1908
+ onRetry: () => {
1909
+ X(null), te();
1910
+ }
1911
+ }
1912
+ ),
1913
+ /* @__PURE__ */ e(
1914
+ yt,
1915
+ {
1916
+ activeTab: Y,
1917
+ onTabChange: ne,
1918
+ cedrosPayEnabled: b,
1919
+ user: C,
1920
+ deposits: x,
1921
+ credits: _,
1922
+ chats: K,
1923
+ referrals: k,
1924
+ kycData: i,
1925
+ accreditationData: g,
1926
+ depositsError: Ae,
1927
+ creditsError: Q,
1928
+ chatsError: Ee,
1929
+ referralsError: Ue,
1930
+ kycError: Re,
1931
+ accreditationError: ke,
1932
+ depositsCurrentPage: Ke,
1933
+ depositsTotalPages: _e,
1934
+ onDepositsPageChange: He,
1935
+ transactionsCurrentPage: qe,
1936
+ transactionsTotalPages: je,
1937
+ onTransactionsPageChange: Je,
1938
+ chatsCurrentPage: Be,
1939
+ chatsTotalPages: Ve,
1940
+ onChatsPageChange: We,
1941
+ referralsCurrentPage: Ie,
1942
+ referralsTotalPages: Ye,
1943
+ onReferralsPageChange: Ge,
1944
+ isLoading: f,
1945
+ onRetryDeposits: () => {
1946
+ ie(null), fe();
1947
+ },
1948
+ onRetryCredits: () => {
1949
+ X(null), te();
1950
+ },
1951
+ onRetryChats: () => {
1952
+ ce(null), ye();
1953
+ },
1954
+ onRetryReferrals: () => {
1955
+ oe(null), pe();
1956
+ },
1957
+ onRetryKyc: () => {
1958
+ Z(null), W();
1959
+ },
1960
+ onRetryAccreditation: () => {
1961
+ J(null), B();
1962
+ },
1963
+ onKycOverride: Te,
1964
+ onAccreditationOverride: De,
1965
+ onAccreditationReview: Oe
1966
+ }
1967
+ )
1968
+ ] });
1969
+ }
1970
+ const pt = ["email", "google", "apple", "solana", "webauthn", "sso"], bt = {
1971
+ email: "Email Users",
1972
+ google: "Google Users",
1973
+ apple: "Apple Users",
1974
+ solana: "Solana Users",
1975
+ webauthn: "Passkey Users",
1976
+ sso: "SSO Provider Users"
1977
+ }, vt = {
1978
+ email: "auth_email_enabled",
1979
+ google: "auth_google_enabled",
1980
+ apple: "auth_apple_enabled",
1981
+ solana: "auth_solana_enabled",
1982
+ webauthn: "auth_webauthn_enabled",
1983
+ sso: "feature_sso"
1984
+ };
1985
+ function Et() {
1986
+ const { getStats: t } = ve(), { fetchSettings: s, getValue: n } = ze(), [a, m] = p(null), [b, v] = p(!1), [c, o] = p(null), [f, $] = p(!1);
1987
+ I(() => {
1988
+ f || (s(), $(!0));
1989
+ }, [s, f]);
1990
+ const P = S(
1991
+ (A) => {
1992
+ const E = n(A);
1993
+ return E === void 0 ? !1 : E === "true" || E === "1";
1994
+ },
1995
+ [n]
1996
+ ), y = S(async () => {
1997
+ v(!0), o(null);
1998
+ try {
1999
+ const A = await t();
2000
+ m(A);
2001
+ } catch (A) {
2002
+ o(A instanceof Error ? A.message : "Failed to load user stats");
2003
+ } finally {
2004
+ v(!1);
2005
+ }
2006
+ }, [t]);
2007
+ return I(() => {
2008
+ y();
2009
+ }, [y]), { statsItems: re(() => {
2010
+ const A = [{ label: "Total Users", value: a?.total ?? "—" }];
2011
+ return pt.forEach((E) => {
2012
+ P(vt[E]) && A.push({
2013
+ label: bt[E],
2014
+ value: a?.authMethodCounts[E] ?? 0
2015
+ });
2016
+ }), A;
2017
+ }, [a, P]), isLoading: b, error: c, refresh: y };
2018
+ }
2019
+ export {
2020
+ At as A,
2021
+ St as a,
2022
+ Se as b,
2023
+ ve as c,
2024
+ Et as u
2025
+ };