@saas-support/react 0.4.0 → 0.5.0

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/react.js CHANGED
@@ -1,33 +1,33 @@
1
- import { jsx as e, jsxs as l, Fragment as W } from "react/jsx-runtime";
2
- import { createContext as ts, useContext as ns, useState as h, useEffect as B, useRef as R, useCallback as C, useMemo as q } from "react";
3
- import { SaaSSupport as os, isMfaRequired as ls, BillingClient as is, Transport as H, ReportClient as J } from "./index.js";
4
- import { SaaSError as oe } from "./index.js";
5
- import { createPortal as cs } from "react-dom";
6
- const Q = ts(null);
7
- function E() {
8
- const s = ns(Q);
9
- if (!s)
1
+ import { jsx as s, jsxs as n, Fragment as G } from "react/jsx-runtime";
2
+ import { createContext as ge, useContext as he, useState as m, useEffect as U, useRef as j, useCallback as N, useMemo as _ } from "react";
3
+ import { SaaSSupport as fe, isMfaRequired as be, BillingClient as ye, Transport as J, ReportClient as K } from "./index.js";
4
+ import { SaaSError as bs } from "./index.js";
5
+ import { createPortal as ve } from "react-dom";
6
+ const se = ge(null);
7
+ function L() {
8
+ const e = he(se);
9
+ if (!e)
10
10
  throw new Error("useSaaSContext must be used within a <SaaSProvider>");
11
- return s;
11
+ return e;
12
12
  }
13
- function Rs({ publishableKey: s, apiKey: a, baseUrl: r, appearance: c, children: t }) {
14
- const [i] = h(() => new os({ publishableKey: s, apiKey: a, baseUrl: r })), [d, u] = h(null), [o, n] = h(!1), [m, p] = h(null);
15
- return B(() => {
16
- let b = !1;
17
- i.load().then(async () => {
18
- if (b) return;
19
- const x = await i.auth.getUser(), y = await i.auth.getSettings();
20
- u(x), p(y), n(!0);
13
+ function Ze({ publishableKey: e, apiKey: a, baseUrl: r, appearance: o, children: t }) {
14
+ const [u] = m(() => new fe({ publishableKey: e, apiKey: a, baseUrl: r })), [i, c] = m(null), [d, l] = m(!1), [g, p] = m(null);
15
+ return U(() => {
16
+ let f = !1;
17
+ u.load().then(async () => {
18
+ if (f) return;
19
+ const k = await u.auth.getUser(), v = await u.auth.getSettings();
20
+ c(k), p(v), l(!0);
21
21
  });
22
- const f = i.auth.onAuthStateChange((x) => {
23
- b || u(x);
22
+ const b = u.auth.onAuthStateChange((k) => {
23
+ f || c(k);
24
24
  });
25
25
  return () => {
26
- b = !0, f(), i.destroy();
26
+ f = !0, b(), u.destroy();
27
27
  };
28
- }, [i]), /* @__PURE__ */ e(Q.Provider, { value: { client: i, user: d, isLoaded: o, appearance: c, settings: m }, children: t });
28
+ }, [u]), /* @__PURE__ */ s(se.Provider, { value: { client: u, user: i, isLoaded: d, appearance: o, settings: g }, children: t });
29
29
  }
30
- const ds = {
30
+ const xe = {
31
31
  colorPrimary: "#6366f1",
32
32
  colorPrimaryHover: "#4f46e5",
33
33
  colorBackground: "#ffffff",
@@ -40,7 +40,7 @@ const ds = {
40
40
  colorWarning: "#f59e0b",
41
41
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
42
42
  borderRadius: "8px"
43
- }, us = {
43
+ }, we = {
44
44
  colorPrimary: "#818cf8",
45
45
  colorPrimaryHover: "#6366f1",
46
46
  colorBackground: "#1e1e2e",
@@ -54,11 +54,11 @@ const ds = {
54
54
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
55
55
  borderRadius: "8px"
56
56
  };
57
- function V(s) {
58
- const a = (s == null ? void 0 : s.baseTheme) === "dark" ? us : ds, r = s == null ? void 0 : s.variables;
57
+ function Z(e) {
58
+ const a = (e == null ? void 0 : e.baseTheme) === "dark" ? we : xe, r = e == null ? void 0 : e.variables;
59
59
  return {
60
60
  colorPrimary: (r == null ? void 0 : r.colorPrimary) ?? a.colorPrimary,
61
- colorPrimaryHover: r != null && r.colorPrimary ? ps(r.colorPrimary, 10) : a.colorPrimaryHover,
61
+ colorPrimaryHover: r != null && r.colorPrimary ? Ne(r.colorPrimary, 10) : a.colorPrimaryHover,
62
62
  colorBackground: (r == null ? void 0 : r.colorBackground) ?? a.colorBackground,
63
63
  colorText: (r == null ? void 0 : r.colorText) ?? a.colorText,
64
64
  colorTextSecondary: a.colorTextSecondary,
@@ -71,16 +71,16 @@ function V(s) {
71
71
  borderRadius: (r == null ? void 0 : r.borderRadius) ?? a.borderRadius
72
72
  };
73
73
  }
74
- function ps(s, a) {
75
- const r = parseInt(s.replace("#", ""), 16), c = Math.max(0, (r >> 16) - Math.round(2.55 * a)), t = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * a)), i = Math.max(0, (r & 255) - Math.round(2.55 * a));
76
- return `#${(c << 16 | t << 8 | i).toString(16).padStart(6, "0")}`;
74
+ function Ne(e, a) {
75
+ const r = parseInt(e.replace("#", ""), 16), o = Math.max(0, (r >> 16) - Math.round(2.55 * a)), t = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * a)), u = Math.max(0, (r & 255) - Math.round(2.55 * a));
76
+ return `#${(o << 16 | t << 8 | u).toString(16).padStart(6, "0")}`;
77
77
  }
78
- function G(s) {
78
+ function X(e) {
79
79
  return `
80
80
  :host {
81
81
  all: initial;
82
- font-family: ${s.fontFamily};
83
- color: ${s.colorText};
82
+ font-family: ${e.fontFamily};
83
+ color: ${e.colorText};
84
84
  line-height: 1.5;
85
85
  -webkit-font-smoothing: antialiased;
86
86
  }
@@ -88,13 +88,13 @@ function G(s) {
88
88
  * { box-sizing: border-box; margin: 0; padding: 0; }
89
89
 
90
90
  .ss-card {
91
- background: ${s.colorBackground};
92
- border-radius: ${s.borderRadius};
91
+ background: ${e.colorBackground};
92
+ border-radius: ${e.borderRadius};
93
93
  padding: 32px;
94
94
  width: 100%;
95
- max-width: 400px;
95
+ max-width: 480px;
96
96
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
97
- border: 1px solid ${s.colorInputBorder};
97
+ border: 1px solid ${e.colorInputBorder};
98
98
  }
99
99
 
100
100
  .ss-card-wide { max-width: 640px; }
@@ -102,14 +102,14 @@ function G(s) {
102
102
  .ss-title {
103
103
  font-size: 22px;
104
104
  font-weight: 700;
105
- color: ${s.colorText};
105
+ color: ${e.colorText};
106
106
  text-align: center;
107
107
  margin-bottom: 24px;
108
108
  }
109
109
 
110
110
  .ss-subtitle {
111
111
  font-size: 14px;
112
- color: ${s.colorTextSecondary};
112
+ color: ${e.colorTextSecondary};
113
113
  text-align: center;
114
114
  margin-top: -16px;
115
115
  margin-bottom: 24px;
@@ -121,7 +121,7 @@ function G(s) {
121
121
  display: block;
122
122
  font-size: 14px;
123
123
  font-weight: 500;
124
- color: ${s.colorText};
124
+ color: ${e.colorText};
125
125
  margin-bottom: 6px;
126
126
  }
127
127
 
@@ -130,20 +130,20 @@ function G(s) {
130
130
  padding: 10px 12px;
131
131
  font-size: 14px;
132
132
  font-family: inherit;
133
- border: 1px solid ${s.colorInputBorder};
134
- border-radius: calc(${s.borderRadius} - 2px);
135
- background: ${s.colorInputBackground};
136
- color: ${s.colorText};
133
+ border: 1px solid ${e.colorInputBorder};
134
+ border-radius: calc(${e.borderRadius} - 2px);
135
+ background: ${e.colorInputBackground};
136
+ color: ${e.colorText};
137
137
  outline: none;
138
138
  transition: border-color 0.15s;
139
139
  }
140
140
 
141
141
  .ss-input:focus {
142
- border-color: ${s.colorPrimary};
143
- box-shadow: 0 0 0 3px ${s.colorPrimary}22;
142
+ border-color: ${e.colorPrimary};
143
+ box-shadow: 0 0 0 3px ${e.colorPrimary}22;
144
144
  }
145
145
 
146
- .ss-input.ss-input-error { border-color: ${s.colorError}; }
146
+ .ss-input.ss-input-error { border-color: ${e.colorError}; }
147
147
 
148
148
  .ss-query-textarea {
149
149
  resize: vertical;
@@ -153,16 +153,16 @@ function G(s) {
153
153
 
154
154
  .ss-error {
155
155
  font-size: 13px;
156
- color: ${s.colorError};
156
+ color: ${e.colorError};
157
157
  margin-top: 4px;
158
158
  }
159
159
 
160
160
  .ss-global-error {
161
161
  font-size: 13px;
162
- color: ${s.colorError};
163
- background: ${s.colorError}11;
164
- border: 1px solid ${s.colorError}33;
165
- border-radius: calc(${s.borderRadius} - 2px);
162
+ color: ${e.colorError};
163
+ background: ${e.colorError}11;
164
+ border: 1px solid ${e.colorError}33;
165
+ border-radius: calc(${e.borderRadius} - 2px);
166
166
  padding: 10px 12px;
167
167
  margin-bottom: 16px;
168
168
  text-align: center;
@@ -170,10 +170,10 @@ function G(s) {
170
170
 
171
171
  .ss-success-msg {
172
172
  font-size: 13px;
173
- color: ${s.colorSuccess};
174
- background: ${s.colorSuccess}11;
175
- border: 1px solid ${s.colorSuccess}33;
176
- border-radius: calc(${s.borderRadius} - 2px);
173
+ color: ${e.colorSuccess};
174
+ background: ${e.colorSuccess}11;
175
+ border: 1px solid ${e.colorSuccess}33;
176
+ border-radius: calc(${e.borderRadius} - 2px);
177
177
  padding: 10px 12px;
178
178
  margin-bottom: 16px;
179
179
  text-align: center;
@@ -182,14 +182,14 @@ function G(s) {
182
182
  .ss-loading {
183
183
  text-align: center;
184
184
  padding: 24px;
185
- color: ${s.colorTextSecondary};
185
+ color: ${e.colorTextSecondary};
186
186
  font-size: 14px;
187
187
  }
188
188
 
189
189
  .ss-empty {
190
190
  text-align: center;
191
191
  padding: 24px;
192
- color: ${s.colorTextSecondary};
192
+ color: ${e.colorTextSecondary};
193
193
  font-size: 14px;
194
194
  }
195
195
 
@@ -202,7 +202,7 @@ function G(s) {
202
202
  font-weight: 600;
203
203
  font-family: inherit;
204
204
  border: none;
205
- border-radius: calc(${s.borderRadius} - 2px);
205
+ border-radius: calc(${e.borderRadius} - 2px);
206
206
  cursor: pointer;
207
207
  transition: background 0.15s, opacity 0.15s;
208
208
  }
@@ -210,23 +210,23 @@ function G(s) {
210
210
  .ss-btn:disabled { opacity: 0.6; cursor: not-allowed; }
211
211
 
212
212
  .ss-btn-primary {
213
- background: ${s.colorPrimary};
213
+ background: ${e.colorPrimary};
214
214
  color: #fff;
215
215
  }
216
216
 
217
- .ss-btn-primary:hover:not(:disabled) { background: ${s.colorPrimaryHover}; }
217
+ .ss-btn-primary:hover:not(:disabled) { background: ${e.colorPrimaryHover}; }
218
218
 
219
219
  .ss-btn-danger {
220
- background: ${s.colorError};
220
+ background: ${e.colorError};
221
221
  color: #fff;
222
222
  }
223
223
 
224
224
  .ss-btn-danger:hover:not(:disabled) { opacity: 0.9; }
225
225
 
226
226
  .ss-btn-current {
227
- background: ${s.colorInputBackground};
228
- color: ${s.colorTextSecondary};
229
- border: 1px solid ${s.colorInputBorder};
227
+ background: ${e.colorInputBackground};
228
+ color: ${e.colorTextSecondary};
229
+ border: 1px solid ${e.colorInputBorder};
230
230
  }
231
231
 
232
232
  .ss-btn-sm {
@@ -247,13 +247,13 @@ function G(s) {
247
247
  display: flex;
248
248
  align-items: center;
249
249
  gap: 8px;
250
- background: ${s.colorInputBackground};
251
- border: 1px solid ${s.colorInputBorder};
252
- color: ${s.colorText};
250
+ background: ${e.colorInputBackground};
251
+ border: 1px solid ${e.colorInputBorder};
252
+ color: ${e.colorText};
253
253
  padding: 8px 12px;
254
254
  font-size: 14px;
255
255
  font-family: inherit;
256
- border-radius: calc(${s.borderRadius} - 2px);
256
+ border-radius: calc(${e.borderRadius} - 2px);
257
257
  cursor: pointer;
258
258
  width: auto;
259
259
  }
@@ -270,16 +270,16 @@ function G(s) {
270
270
  font-size: 14px;
271
271
  font-weight: 500;
272
272
  font-family: inherit;
273
- border: 1px solid ${s.colorInputBorder};
274
- border-radius: calc(${s.borderRadius} - 2px);
275
- background: ${s.colorInputBackground};
276
- color: ${s.colorText};
273
+ border: 1px solid ${e.colorInputBorder};
274
+ border-radius: calc(${e.borderRadius} - 2px);
275
+ background: ${e.colorInputBackground};
276
+ color: ${e.colorText};
277
277
  cursor: pointer;
278
278
  transition: background 0.15s;
279
279
  margin-bottom: 8px;
280
280
  }
281
281
 
282
- .ss-btn-social:hover:not(:disabled) { background: ${s.colorInputBorder}; }
282
+ .ss-btn-social:hover:not(:disabled) { background: ${e.colorInputBorder}; }
283
283
  .ss-btn-social:disabled { opacity: 0.6; cursor: not-allowed; }
284
284
  .ss-btn-social svg { width: 18px; height: 18px; flex-shrink: 0; }
285
285
 
@@ -288,7 +288,7 @@ function G(s) {
288
288
  align-items: center;
289
289
  gap: 12px;
290
290
  margin: 20px 0;
291
- color: ${s.colorTextSecondary};
291
+ color: ${e.colorTextSecondary};
292
292
  font-size: 13px;
293
293
  }
294
294
 
@@ -297,18 +297,18 @@ function G(s) {
297
297
  content: '';
298
298
  flex: 1;
299
299
  height: 1px;
300
- background: ${s.colorInputBorder};
300
+ background: ${e.colorInputBorder};
301
301
  }
302
302
 
303
303
  .ss-footer {
304
304
  text-align: center;
305
305
  margin-top: 20px;
306
306
  font-size: 14px;
307
- color: ${s.colorTextSecondary};
307
+ color: ${e.colorTextSecondary};
308
308
  }
309
309
 
310
310
  .ss-link {
311
- color: ${s.colorPrimary};
311
+ color: ${e.colorPrimary};
312
312
  text-decoration: none;
313
313
  cursor: pointer;
314
314
  font-weight: 500;
@@ -338,7 +338,7 @@ function G(s) {
338
338
  width: 36px;
339
339
  height: 36px;
340
340
  border-radius: 50%;
341
- background: ${s.colorPrimary};
341
+ background: ${e.colorPrimary};
342
342
  color: #fff;
343
343
  display: flex;
344
344
  align-items: center;
@@ -351,15 +351,15 @@ function G(s) {
351
351
  transition: box-shadow 0.15s;
352
352
  }
353
353
 
354
- .ss-avatar:hover { box-shadow: 0 0 0 3px ${s.colorPrimary}33; }
354
+ .ss-avatar:hover { box-shadow: 0 0 0 3px ${e.colorPrimary}33; }
355
355
 
356
356
  .ss-dropdown {
357
357
  position: absolute;
358
358
  top: calc(100% + 8px);
359
359
  right: 0;
360
- background: ${s.colorBackground};
361
- border: 1px solid ${s.colorInputBorder};
362
- border-radius: ${s.borderRadius};
360
+ background: ${e.colorBackground};
361
+ border: 1px solid ${e.colorInputBorder};
362
+ border-radius: ${e.borderRadius};
363
363
  padding: 8px 0;
364
364
  min-width: 200px;
365
365
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
@@ -370,13 +370,13 @@ function G(s) {
370
370
 
371
371
  .ss-dropdown-header {
372
372
  padding: 8px 16px 12px;
373
- border-bottom: 1px solid ${s.colorInputBorder};
373
+ border-bottom: 1px solid ${e.colorInputBorder};
374
374
  margin-bottom: 4px;
375
375
  }
376
376
 
377
377
  .ss-dropdown-email {
378
378
  font-size: 13px;
379
- color: ${s.colorTextSecondary};
379
+ color: ${e.colorTextSecondary};
380
380
  word-break: break-all;
381
381
  }
382
382
 
@@ -386,7 +386,7 @@ function G(s) {
386
386
  padding: 8px 16px;
387
387
  font-size: 14px;
388
388
  font-family: inherit;
389
- color: ${s.colorText};
389
+ color: ${e.colorText};
390
390
  background: none;
391
391
  border: none;
392
392
  text-align: left;
@@ -394,9 +394,29 @@ function G(s) {
394
394
  transition: background 0.1s;
395
395
  }
396
396
 
397
- .ss-dropdown-item:hover { background: ${s.colorInputBackground}; }
398
- .ss-dropdown-item-danger { color: ${s.colorError}; }
399
- .ss-dropdown-item-active { font-weight: 600; color: ${s.colorPrimary}; }
397
+ .ss-dropdown-item:hover { background: ${e.colorInputBackground}; }
398
+ .ss-dropdown-item-danger { color: ${e.colorError}; }
399
+ .ss-dropdown-item-active { font-weight: 600; color: ${e.colorPrimary}; }
400
+
401
+ .ss-dropdown-section-title {
402
+ padding: 8px 16px 4px;
403
+ font-size: 11px;
404
+ font-weight: 600;
405
+ text-transform: uppercase;
406
+ letter-spacing: 0.5px;
407
+ color: ${e.colorTextSecondary};
408
+ }
409
+
410
+ .ss-org-check {
411
+ margin-right: 6px;
412
+ font-size: 12px;
413
+ }
414
+
415
+ .ss-danger-zone {
416
+ padding-top: 20px;
417
+ margin-top: 20px;
418
+ border-top: 2px solid ${e.colorError}33;
419
+ }
400
420
 
401
421
  /* Badges */
402
422
 
@@ -408,21 +428,21 @@ function G(s) {
408
428
  border-radius: 999px;
409
429
  text-transform: uppercase;
410
430
  letter-spacing: 0.3px;
411
- background: ${s.colorInputBackground};
412
- color: ${s.colorTextSecondary};
431
+ background: ${e.colorInputBackground};
432
+ color: ${e.colorTextSecondary};
413
433
  }
414
434
 
415
- .ss-badge-active { background: ${s.colorSuccess}22; color: ${s.colorSuccess}; }
416
- .ss-badge-trialing { background: ${s.colorPrimary}22; color: ${s.colorPrimary}; }
417
- .ss-badge-past-due { background: ${s.colorError}22; color: ${s.colorError}; }
418
- .ss-badge-paused { background: ${s.colorWarning}22; color: ${s.colorWarning}; }
419
- .ss-badge-canceled { background: ${s.colorTextSecondary}22; color: ${s.colorTextSecondary}; }
435
+ .ss-badge-active { background: ${e.colorSuccess}22; color: ${e.colorSuccess}; }
436
+ .ss-badge-trialing { background: ${e.colorPrimary}22; color: ${e.colorPrimary}; }
437
+ .ss-badge-past-due { background: ${e.colorError}22; color: ${e.colorError}; }
438
+ .ss-badge-paused { background: ${e.colorWarning}22; color: ${e.colorWarning}; }
439
+ .ss-badge-canceled { background: ${e.colorTextSecondary}22; color: ${e.colorTextSecondary}; }
420
440
 
421
441
  /* Tabs */
422
442
 
423
443
  .ss-tab-group {
424
444
  display: flex;
425
- border-bottom: 1px solid ${s.colorInputBorder};
445
+ border-bottom: 1px solid ${e.colorInputBorder};
426
446
  margin-bottom: 24px;
427
447
  }
428
448
 
@@ -433,7 +453,7 @@ function G(s) {
433
453
  font-size: 14px;
434
454
  font-weight: 500;
435
455
  font-family: inherit;
436
- color: ${s.colorTextSecondary};
456
+ color: ${e.colorTextSecondary};
437
457
  background: none;
438
458
  border: none;
439
459
  border-bottom: 2px solid transparent;
@@ -441,11 +461,11 @@ function G(s) {
441
461
  transition: color 0.15s, border-color 0.15s;
442
462
  }
443
463
 
444
- .ss-tab:hover { color: ${s.colorText}; }
464
+ .ss-tab:hover { color: ${e.colorText}; }
445
465
 
446
466
  .ss-tab-active {
447
- color: ${s.colorPrimary};
448
- border-bottom-color: ${s.colorPrimary};
467
+ color: ${e.colorPrimary};
468
+ border-bottom-color: ${e.colorPrimary};
449
469
  }
450
470
 
451
471
  .ss-tab-content .ss-card { box-shadow: none; border: none; padding: 0; }
@@ -464,30 +484,30 @@ function G(s) {
464
484
  text-align: left;
465
485
  padding: 10px 12px;
466
486
  font-weight: 600;
467
- color: ${s.colorTextSecondary};
468
- border-bottom: 2px solid ${s.colorInputBorder};
487
+ color: ${e.colorTextSecondary};
488
+ border-bottom: 2px solid ${e.colorInputBorder};
469
489
  white-space: nowrap;
470
490
  }
471
491
 
472
492
  .ss-th-sortable { cursor: pointer; user-select: none; }
473
- .ss-th-sortable:hover { color: ${s.colorText}; }
493
+ .ss-th-sortable:hover { color: ${e.colorText}; }
474
494
 
475
495
  .ss-sort-indicator { font-size: 10px; }
476
- .ss-sorted-asc, .ss-sorted-desc { color: ${s.colorPrimary}; }
496
+ .ss-sorted-asc, .ss-sorted-desc { color: ${e.colorPrimary}; }
477
497
 
478
498
  .ss-td {
479
499
  padding: 10px 12px;
480
- border-bottom: 1px solid ${s.colorInputBorder};
481
- color: ${s.colorText};
500
+ border-bottom: 1px solid ${e.colorInputBorder};
501
+ color: ${e.colorText};
482
502
  }
483
503
 
484
- .ss-tr:hover .ss-td { background: ${s.colorInputBackground}; }
504
+ .ss-tr:hover .ss-td { background: ${e.colorInputBackground}; }
485
505
 
486
506
  .ss-table-footer {
487
507
  text-align: center;
488
508
  padding: 8px;
489
509
  font-size: 12px;
490
- color: ${s.colorTextSecondary};
510
+ color: ${e.colorTextSecondary};
491
511
  }
492
512
 
493
513
  /* Pricing */
@@ -499,15 +519,15 @@ function G(s) {
499
519
  }
500
520
 
501
521
  .ss-pricing-card {
502
- background: ${s.colorBackground};
503
- border: 1px solid ${s.colorInputBorder};
504
- border-radius: ${s.borderRadius};
522
+ background: ${e.colorBackground};
523
+ border: 1px solid ${e.colorInputBorder};
524
+ border-radius: ${e.borderRadius};
505
525
  padding: 24px;
506
526
  display: flex;
507
527
  flex-direction: column;
508
528
  }
509
529
 
510
- .ss-pricing-card-current { border-color: ${s.colorPrimary}; }
530
+ .ss-pricing-card-current { border-color: ${e.colorPrimary}; }
511
531
 
512
532
  .ss-pricing-header {
513
533
  display: flex;
@@ -519,7 +539,7 @@ function G(s) {
519
539
  .ss-pricing-name {
520
540
  font-size: 18px;
521
541
  font-weight: 600;
522
- color: ${s.colorText};
542
+ color: ${e.colorText};
523
543
  }
524
544
 
525
545
  .ss-pricing-price { margin-bottom: 12px; }
@@ -527,17 +547,17 @@ function G(s) {
527
547
  .ss-pricing-amount {
528
548
  font-size: 32px;
529
549
  font-weight: 700;
530
- color: ${s.colorText};
550
+ color: ${e.colorText};
531
551
  }
532
552
 
533
553
  .ss-pricing-interval {
534
554
  font-size: 14px;
535
- color: ${s.colorTextSecondary};
555
+ color: ${e.colorTextSecondary};
536
556
  }
537
557
 
538
558
  .ss-pricing-desc {
539
559
  font-size: 14px;
540
- color: ${s.colorTextSecondary};
560
+ color: ${e.colorTextSecondary};
541
561
  margin-bottom: 16px;
542
562
  }
543
563
 
@@ -549,11 +569,11 @@ function G(s) {
549
569
 
550
570
  .ss-pricing-feature {
551
571
  font-size: 14px;
552
- color: ${s.colorText};
572
+ color: ${e.colorText};
553
573
  padding: 4px 0;
554
574
  }
555
575
 
556
- .ss-check { color: ${s.colorSuccess}; margin-right: 6px; }
576
+ .ss-check { color: ${e.colorSuccess}; margin-right: 6px; }
557
577
 
558
578
  /* Usage / Progress */
559
579
 
@@ -568,30 +588,30 @@ function G(s) {
568
588
  .ss-usage-metric {
569
589
  font-size: 14px;
570
590
  font-weight: 500;
571
- color: ${s.colorText};
591
+ color: ${e.colorText};
572
592
  }
573
593
 
574
594
  .ss-usage-value {
575
595
  font-size: 14px;
576
- color: ${s.colorTextSecondary};
596
+ color: ${e.colorTextSecondary};
577
597
  }
578
598
 
579
599
  .ss-progress-bar {
580
600
  width: 100%;
581
601
  height: 8px;
582
- background: ${s.colorInputBackground};
602
+ background: ${e.colorInputBackground};
583
603
  border-radius: 4px;
584
604
  overflow: hidden;
585
605
  }
586
606
 
587
607
  .ss-progress-fill {
588
608
  height: 100%;
589
- background: ${s.colorPrimary};
609
+ background: ${e.colorPrimary};
590
610
  border-radius: 4px;
591
611
  transition: width 0.3s;
592
612
  }
593
613
 
594
- .ss-progress-danger { background: ${s.colorError}; }
614
+ .ss-progress-danger { background: ${e.colorError}; }
595
615
 
596
616
  /* Chart */
597
617
 
@@ -600,7 +620,7 @@ function G(s) {
600
620
  .ss-chart-title {
601
621
  font-size: 16px;
602
622
  font-weight: 600;
603
- color: ${s.colorText};
623
+ color: ${e.colorText};
604
624
  margin-bottom: 12px;
605
625
  }
606
626
 
@@ -613,16 +633,16 @@ function G(s) {
613
633
  }
614
634
 
615
635
  .ss-widget {
616
- background: ${s.colorBackground};
617
- border: 1px solid ${s.colorInputBorder};
618
- border-radius: ${s.borderRadius};
636
+ background: ${e.colorBackground};
637
+ border: 1px solid ${e.colorInputBorder};
638
+ border-radius: ${e.borderRadius};
619
639
  padding: 16px;
620
640
  }
621
641
 
622
642
  .ss-widget-header {
623
643
  font-size: 14px;
624
644
  font-weight: 600;
625
- color: ${s.colorText};
645
+ color: ${e.colorText};
626
646
  margin-bottom: 12px;
627
647
  }
628
648
 
@@ -630,14 +650,14 @@ function G(s) {
630
650
 
631
651
  .ss-saved-query-card {
632
652
  padding: 12px 16px;
633
- border: 1px solid ${s.colorInputBorder};
634
- border-radius: calc(${s.borderRadius} - 2px);
653
+ border: 1px solid ${e.colorInputBorder};
654
+ border-radius: calc(${e.borderRadius} - 2px);
635
655
  margin-bottom: 8px;
636
656
  cursor: pointer;
637
657
  transition: border-color 0.15s;
638
658
  }
639
659
 
640
- .ss-saved-query-card:hover { border-color: ${s.colorPrimary}; }
660
+ .ss-saved-query-card:hover { border-color: ${e.colorPrimary}; }
641
661
 
642
662
  .ss-saved-query-header {
643
663
  display: flex;
@@ -649,12 +669,12 @@ function G(s) {
649
669
  .ss-saved-query-name {
650
670
  font-size: 14px;
651
671
  font-weight: 600;
652
- color: ${s.colorText};
672
+ color: ${e.colorText};
653
673
  }
654
674
 
655
675
  .ss-saved-query-desc {
656
676
  font-size: 13px;
657
- color: ${s.colorTextSecondary};
677
+ color: ${e.colorTextSecondary};
658
678
  margin-bottom: 8px;
659
679
  }
660
680
 
@@ -666,7 +686,7 @@ function G(s) {
666
686
 
667
687
  .ss-saved-query-date {
668
688
  font-size: 12px;
669
- color: ${s.colorTextSecondary};
689
+ color: ${e.colorTextSecondary};
670
690
  }
671
691
 
672
692
  /* Modal Overlay */
@@ -691,15 +711,15 @@ function G(s) {
691
711
  }
692
712
 
693
713
  .ss-modal {
694
- background: ${s.colorBackground};
695
- border-radius: ${s.borderRadius};
714
+ background: ${e.colorBackground};
715
+ border-radius: ${e.borderRadius};
696
716
  padding: 32px;
697
717
  width: 90%;
698
718
  max-width: 480px;
699
719
  max-height: 90vh;
700
720
  overflow-y: auto;
701
721
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.2);
702
- border: 1px solid ${s.colorInputBorder};
722
+ border: 1px solid ${e.colorInputBorder};
703
723
  animation: ss-scale-in 0.15s ease-out;
704
724
  }
705
725
 
@@ -718,14 +738,14 @@ function G(s) {
718
738
  .ss-modal-title {
719
739
  font-size: 18px;
720
740
  font-weight: 700;
721
- color: ${s.colorText};
741
+ color: ${e.colorText};
722
742
  }
723
743
 
724
744
  .ss-modal-close {
725
745
  background: none;
726
746
  border: none;
727
747
  font-size: 20px;
728
- color: ${s.colorTextSecondary};
748
+ color: ${e.colorTextSecondary};
729
749
  cursor: pointer;
730
750
  padding: 4px;
731
751
  line-height: 1;
@@ -735,20 +755,20 @@ function G(s) {
735
755
  }
736
756
 
737
757
  .ss-modal-close:hover {
738
- background: ${s.colorInputBackground};
739
- color: ${s.colorText};
758
+ background: ${e.colorInputBackground};
759
+ color: ${e.colorText};
740
760
  }
741
761
 
742
762
  .ss-modal-section {
743
763
  padding-top: 20px;
744
764
  margin-top: 20px;
745
- border-top: 1px solid ${s.colorInputBorder};
765
+ border-top: 1px solid ${e.colorInputBorder};
746
766
  }
747
767
 
748
768
  .ss-modal-section-title {
749
769
  font-size: 15px;
750
770
  font-weight: 600;
751
- color: ${s.colorText};
771
+ color: ${e.colorText};
752
772
  margin-bottom: 16px;
753
773
  }
754
774
 
@@ -756,7 +776,7 @@ function G(s) {
756
776
  width: 64px;
757
777
  height: 64px;
758
778
  border-radius: 50%;
759
- background: ${s.colorPrimary};
779
+ background: ${e.colorPrimary};
760
780
  color: #fff;
761
781
  display: flex;
762
782
  align-items: center;
@@ -806,7 +826,7 @@ function G(s) {
806
826
  }
807
827
 
808
828
  .ss-avatar-canvas {
809
- border-radius: ${s.borderRadius};
829
+ border-radius: ${e.borderRadius};
810
830
  background: #111;
811
831
  touch-action: none;
812
832
  max-width: 100%;
@@ -821,7 +841,7 @@ function G(s) {
821
841
 
822
842
  .ss-avatar-zoom-label {
823
843
  font-size: 13px;
824
- color: ${s.colorTextSecondary};
844
+ color: ${e.colorTextSecondary};
825
845
  flex-shrink: 0;
826
846
  }
827
847
 
@@ -830,7 +850,7 @@ function G(s) {
830
850
  height: 4px;
831
851
  -webkit-appearance: none;
832
852
  appearance: none;
833
- background: ${s.colorInputBorder};
853
+ background: ${e.colorInputBorder};
834
854
  border-radius: 2px;
835
855
  outline: none;
836
856
  }
@@ -840,7 +860,7 @@ function G(s) {
840
860
  width: 16px;
841
861
  height: 16px;
842
862
  border-radius: 50%;
843
- background: ${s.colorPrimary};
863
+ background: ${e.colorPrimary};
844
864
  cursor: pointer;
845
865
  }
846
866
 
@@ -848,20 +868,20 @@ function G(s) {
848
868
  width: 16px;
849
869
  height: 16px;
850
870
  border-radius: 50%;
851
- background: ${s.colorPrimary};
871
+ background: ${e.colorPrimary};
852
872
  cursor: pointer;
853
873
  border: none;
854
874
  }
855
875
 
856
876
  /* Dropzone */
857
877
  .ss-avatar-dropzone {
858
- border: 2px dashed ${s.colorInputBorder};
859
- border-radius: ${s.borderRadius};
878
+ border: 2px dashed ${e.colorInputBorder};
879
+ border-radius: ${e.borderRadius};
860
880
  padding: 40px 24px;
861
881
  text-align: center;
862
882
  cursor: pointer;
863
883
  transition: border-color 0.15s, background 0.15s;
864
- color: ${s.colorTextSecondary};
884
+ color: ${e.colorTextSecondary};
865
885
  display: flex;
866
886
  flex-direction: column;
867
887
  align-items: center;
@@ -870,8 +890,8 @@ function G(s) {
870
890
 
871
891
  .ss-avatar-dropzone:hover,
872
892
  .ss-avatar-dropzone-active {
873
- border-color: ${s.colorPrimary};
874
- background: ${s.colorPrimary}08;
893
+ border-color: ${e.colorPrimary};
894
+ background: ${e.colorPrimary}08;
875
895
  }
876
896
 
877
897
  .ss-avatar-dropzone svg {
@@ -887,7 +907,7 @@ function G(s) {
887
907
 
888
908
  .ss-dropdown-divider {
889
909
  height: 1px;
890
- background: ${s.colorInputBorder};
910
+ background: ${e.colorInputBorder};
891
911
  margin: 4px 0;
892
912
  }
893
913
 
@@ -910,229 +930,335 @@ function G(s) {
910
930
  }
911
931
  `;
912
932
  }
913
- function D({ children: s, appearance: a }) {
914
- const r = R(null), [c, t] = h(null);
915
- B(() => {
916
- var m;
933
+ function q({ children: e, appearance: a }) {
934
+ const r = j(null), [o, t] = m(null);
935
+ U(() => {
936
+ var g;
917
937
  if (!r.current || r.current.shadowRoot) {
918
- t(((m = r.current) == null ? void 0 : m.shadowRoot) ?? null);
938
+ t(((g = r.current) == null ? void 0 : g.shadowRoot) ?? null);
919
939
  return;
920
940
  }
921
- const d = r.current.attachShadow({ mode: "open" }), u = V(a), o = document.createElement("style");
922
- o.textContent = G(u), d.appendChild(o);
923
- const n = document.createElement("div");
924
- d.appendChild(n), t(d);
925
- }, []), B(() => {
926
- if (!c) return;
927
- const d = c.querySelector("style");
928
- if (d) {
929
- const u = V(a);
930
- d.textContent = G(u);
931
- }
932
- }, [a, c]);
933
- const i = (c == null ? void 0 : c.querySelector("div")) ?? null;
934
- return /* @__PURE__ */ e("div", { ref: r, style: { display: "contents" }, children: i && cs(s, i) });
941
+ const i = r.current.attachShadow({ mode: "open" }), c = Z(a), d = document.createElement("style");
942
+ d.textContent = X(c), i.appendChild(d);
943
+ const l = document.createElement("div");
944
+ i.appendChild(l), t(i);
945
+ }, []), U(() => {
946
+ if (!o) return;
947
+ const i = o.querySelector("style");
948
+ if (i) {
949
+ const c = Z(a);
950
+ i.textContent = X(c);
951
+ }
952
+ }, [a, o]);
953
+ const u = (o == null ? void 0 : o.querySelector("div")) ?? null;
954
+ return /* @__PURE__ */ s("div", { ref: r, style: { display: "contents" }, children: u && ve(e, u) });
935
955
  }
936
- function Y() {
937
- const { client: s, user: a, isLoaded: r } = E();
956
+ function ee() {
957
+ const { client: e, user: a, isLoaded: r } = L();
938
958
  return {
939
959
  isLoaded: r,
940
960
  isSignedIn: !!a,
941
961
  user: a,
942
- signOut: C(() => s.auth.signOut(), [s]),
943
- getToken: C(() => s.auth.getToken(), [s])
962
+ signOut: N(() => e.auth.signOut(), [e]),
963
+ getToken: N(() => e.auth.getToken(), [e])
944
964
  };
945
965
  }
946
- function Os() {
947
- const { user: s, isLoaded: a } = E();
948
- return { user: s, isLoaded: a };
966
+ function Xe() {
967
+ const { user: e, isLoaded: a } = L();
968
+ return { user: e, isLoaded: a };
949
969
  }
950
- function Z() {
951
- const { client: s } = E(), [a, r] = h(!1), [c, t] = h(null), i = C(
952
- async (o, n) => {
970
+ function re() {
971
+ const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null), u = N(
972
+ async (d, l) => {
953
973
  r(!0), t(null);
954
974
  try {
955
- return await s.auth.signIn(o, n);
956
- } catch (m) {
957
- return t(m instanceof Error ? m.message : "Sign in failed"), null;
975
+ return await e.auth.signIn(d, l);
976
+ } catch (g) {
977
+ return t(g instanceof Error ? g.message : "Sign in failed"), null;
958
978
  } finally {
959
979
  r(!1);
960
980
  }
961
981
  },
962
- [s]
963
- ), d = C(
964
- async (o) => {
982
+ [e]
983
+ ), i = N(
984
+ async (d) => {
965
985
  r(!0), t(null);
966
986
  try {
967
- return await s.auth.signInWithOAuth(o);
968
- } catch (n) {
969
- return t(n instanceof Error ? n.message : "OAuth sign in failed"), null;
987
+ return await e.auth.signInWithOAuth(d);
988
+ } catch (l) {
989
+ return t(l instanceof Error ? l.message : "OAuth sign in failed"), null;
970
990
  } finally {
971
991
  r(!1);
972
992
  }
973
993
  },
974
- [s]
975
- ), u = C(
976
- async (o, n) => {
994
+ [e]
995
+ ), c = N(
996
+ async (d, l) => {
977
997
  r(!0), t(null);
978
998
  try {
979
- return await s.auth.submitMfaCode(o, n);
980
- } catch (m) {
981
- return t(m instanceof Error ? m.message : "MFA verification failed"), null;
999
+ return await e.auth.submitMfaCode(d, l);
1000
+ } catch (g) {
1001
+ return t(g instanceof Error ? g.message : "MFA verification failed"), null;
982
1002
  } finally {
983
1003
  r(!1);
984
1004
  }
985
1005
  },
986
- [s]
1006
+ [e]
987
1007
  );
988
- return { signIn: i, signInWithOAuth: d, submitMfaCode: u, isLoading: a, error: c, setError: t };
1008
+ return { signIn: u, signInWithOAuth: i, submitMfaCode: c, isLoading: a, error: o, setError: t };
989
1009
  }
990
- function ms() {
991
- const { client: s } = E(), [a, r] = h(!1), [c, t] = h(null);
992
- return { signUp: C(
993
- async (d, u) => {
1010
+ function Ce() {
1011
+ const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null);
1012
+ return { signUp: N(
1013
+ async (i, c) => {
994
1014
  r(!0), t(null);
995
1015
  try {
996
- return await s.auth.signUp(d, u);
997
- } catch (o) {
998
- return t(o instanceof Error ? o.message : "Sign up failed"), null;
1016
+ return await e.auth.signUp(i, c);
1017
+ } catch (d) {
1018
+ return t(d instanceof Error ? d.message : "Sign up failed"), null;
999
1019
  } finally {
1000
1020
  r(!1);
1001
1021
  }
1002
1022
  },
1003
- [s]
1004
- ), isLoading: a, error: c, setError: t };
1023
+ [e]
1024
+ ), isLoading: a, error: o, setError: t };
1005
1025
  }
1006
- function gs() {
1007
- const { client: s } = E(), [a, r] = h([]), [c, t] = h(null), [i, d] = h([]), [u, o] = h(!1), [n, m] = h(null), p = C(async () => {
1008
- o(!0), m(null);
1026
+ function ae() {
1027
+ const { client: e } = L(), [a, r] = m([]), [o, t] = m(null), [u, i] = m([]), [c, d] = m([]), [l, g] = m(!1), [p, f] = m(null), b = N(async () => {
1028
+ g(!0), f(null);
1009
1029
  try {
1010
- const x = await s.auth.listOrgs();
1011
- r(x);
1012
- } catch (x) {
1013
- m(x instanceof Error ? x.message : "Failed to load organizations");
1030
+ const w = await e.auth.listOrgs();
1031
+ r(w);
1032
+ const $ = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null;
1033
+ if ($ && w.some((y) => y.id === $) && !o) {
1034
+ const y = w.find((E) => E.id === $);
1035
+ t(y);
1036
+ try {
1037
+ const E = await e.auth.listMembers(y.id);
1038
+ i(E);
1039
+ } catch {
1040
+ }
1041
+ }
1042
+ } catch (w) {
1043
+ f(w instanceof Error ? w.message : "Failed to load organizations");
1014
1044
  } finally {
1015
- o(!1);
1045
+ g(!1);
1016
1046
  }
1017
- }, [s]);
1018
- B(() => {
1019
- p();
1020
- }, [p]);
1021
- const b = C(async (x) => {
1047
+ }, [e, o]);
1048
+ U(() => {
1049
+ b();
1050
+ }, [b]);
1051
+ const k = N(async (w) => {
1022
1052
  try {
1023
- const y = await s.auth.getOrg(x);
1024
- t(y);
1025
- const w = await s.auth.listMembers(x);
1026
- d(w);
1053
+ const $ = await e.auth.getOrg(w);
1054
+ t($), typeof window < "u" && localStorage.setItem("ss_selected_org", w);
1055
+ const y = await e.auth.listMembers(w);
1056
+ i(y);
1057
+ } catch ($) {
1058
+ f($ instanceof Error ? $.message : "Failed to load organization");
1059
+ }
1060
+ }, [e]), v = N(async (w, $) => {
1061
+ try {
1062
+ const y = await e.auth.createOrg(w, $);
1063
+ return r((E) => [...E, y]), y;
1027
1064
  } catch (y) {
1028
- m(y instanceof Error ? y.message : "Failed to load organization");
1065
+ return f(y instanceof Error ? y.message : "Failed to create organization"), null;
1029
1066
  }
1030
- }, [s]), f = C(async (x, y) => {
1067
+ }, [e]), C = N(async (w, $) => {
1031
1068
  try {
1032
- const w = await s.auth.createOrg(x, y);
1033
- return r((v) => [...v, w]), w;
1034
- } catch (w) {
1035
- return m(w instanceof Error ? w.message : "Failed to create organization"), null;
1069
+ const y = await e.auth.updateOrg(w, $);
1070
+ return r((E) => E.map((M) => M.id === w ? y : M)), (o == null ? void 0 : o.id) === w && t(y), y;
1071
+ } catch (y) {
1072
+ return f(y instanceof Error ? y.message : "Failed to update organization"), null;
1073
+ }
1074
+ }, [e, o]), x = N(async (w) => {
1075
+ try {
1076
+ return await e.auth.deleteOrg(w), r(($) => $.filter((y) => y.id !== w)), (o == null ? void 0 : o.id) === w && (t(null), i([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
1077
+ } catch ($) {
1078
+ return f($ instanceof Error ? $.message : "Failed to delete organization"), !1;
1079
+ }
1080
+ }, [e, o]), h = N(async (w, $, y) => {
1081
+ try {
1082
+ return await e.auth.sendInvite(w, $, y);
1083
+ } catch (E) {
1084
+ return f(E instanceof Error ? E.message : "Failed to send invite"), null;
1085
+ }
1086
+ }, [e]), S = N(async (w) => {
1087
+ try {
1088
+ const $ = await e.auth.listInvites(w);
1089
+ d($);
1090
+ } catch ($) {
1091
+ f($ instanceof Error ? $.message : "Failed to load invites");
1092
+ }
1093
+ }, [e]), z = N(async (w, $) => {
1094
+ try {
1095
+ return await e.auth.revokeInvite(w, $), d((y) => y.filter((E) => E.id !== $)), !0;
1096
+ } catch (y) {
1097
+ return f(y instanceof Error ? y.message : "Failed to revoke invite"), !1;
1098
+ }
1099
+ }, [e]), P = N(async (w, $, y) => {
1100
+ try {
1101
+ return await e.auth.updateMemberRole(w, $, y), i((E) => E.map((M) => M.userId === $ ? { ...M, role: y } : M)), !0;
1102
+ } catch (E) {
1103
+ return f(E instanceof Error ? E.message : "Failed to update member role"), !1;
1104
+ }
1105
+ }, [e]), I = N(async (w, $) => {
1106
+ try {
1107
+ return await e.auth.removeMember(w, $), i((y) => y.filter((E) => E.userId !== $)), !0;
1108
+ } catch (y) {
1109
+ return f(y instanceof Error ? y.message : "Failed to remove member"), !1;
1110
+ }
1111
+ }, [e]), T = N(async (w) => {
1112
+ try {
1113
+ const $ = await e.auth.listMembers(w);
1114
+ i($);
1115
+ } catch ($) {
1116
+ f($ instanceof Error ? $.message : "Failed to load members");
1117
+ }
1118
+ }, [e]);
1119
+ return {
1120
+ orgs: a,
1121
+ selectedOrg: o,
1122
+ members: u,
1123
+ invites: c,
1124
+ isLoading: l,
1125
+ error: p,
1126
+ setError: f,
1127
+ refresh: b,
1128
+ selectOrg: k,
1129
+ createOrg: v,
1130
+ updateOrg: C,
1131
+ deleteOrg: x,
1132
+ sendInvite: h,
1133
+ refreshInvites: S,
1134
+ revokeInvite: z,
1135
+ updateMemberRole: P,
1136
+ removeMember: I,
1137
+ refreshMembers: T
1138
+ };
1139
+ }
1140
+ function ke() {
1141
+ const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null);
1142
+ return { deleteAccount: N(async () => {
1143
+ r(!0), t(null);
1144
+ try {
1145
+ return await e.auth.deleteAccount(), !0;
1146
+ } catch (i) {
1147
+ return t(i instanceof Error ? i.message : "Failed to delete account"), !1;
1148
+ } finally {
1149
+ r(!1);
1036
1150
  }
1037
- }, [s]);
1038
- return { orgs: a, selectedOrg: c, members: i, isLoading: u, error: n, refresh: p, selectOrg: b, createOrg: f };
1151
+ }, [e]), isLoading: a, error: o, setError: t };
1039
1152
  }
1040
- function X() {
1041
- const { client: s, user: a } = E(), [r, c] = h(!1), [t, i] = h(null), [d, u] = h(null), o = C(
1153
+ function te() {
1154
+ const { client: e, user: a } = L(), [r, o] = m(!1), [t, u] = m(null), [i, c] = m(null), d = N(
1042
1155
  async (p) => {
1043
- c(!0), i(null), u(null);
1156
+ o(!0), u(null), c(null);
1044
1157
  try {
1045
- const b = await s.auth.updateProfile(p);
1046
- return u("Profile updated"), b;
1047
- } catch (b) {
1048
- return i(b instanceof Error ? b.message : "Failed to update profile"), null;
1158
+ const f = await e.auth.updateProfile(p);
1159
+ return c("Profile updated"), f;
1160
+ } catch (f) {
1161
+ return u(f instanceof Error ? f.message : "Failed to update profile"), null;
1049
1162
  } finally {
1050
- c(!1);
1163
+ o(!1);
1051
1164
  }
1052
1165
  },
1053
- [s]
1054
- ), n = C(
1055
- async (p, b) => {
1056
- c(!0), i(null), u(null);
1166
+ [e]
1167
+ ), l = N(
1168
+ async (p, f) => {
1169
+ o(!0), u(null), c(null);
1057
1170
  try {
1058
- return await s.auth.changePassword(p, b), u("Password changed successfully"), !0;
1059
- } catch (f) {
1060
- return i(f instanceof Error ? f.message : "Failed to change password"), !1;
1171
+ return await e.auth.changePassword(p, f), c("Password changed successfully"), !0;
1172
+ } catch (b) {
1173
+ return u(b instanceof Error ? b.message : "Failed to change password"), !1;
1061
1174
  } finally {
1062
- c(!1);
1175
+ o(!1);
1063
1176
  }
1064
1177
  },
1065
- [s]
1066
- ), m = C(
1178
+ [e]
1179
+ ), g = N(
1067
1180
  async (p) => {
1068
- c(!0), i(null), u(null);
1181
+ o(!0), u(null), c(null);
1069
1182
  try {
1070
- const b = await s.auth.uploadAvatar(p);
1071
- return u("Avatar updated"), b;
1072
- } catch (b) {
1073
- return i(b instanceof Error ? b.message : "Failed to upload avatar"), null;
1183
+ const f = await e.auth.uploadAvatar(p);
1184
+ return c("Avatar updated"), f;
1185
+ } catch (f) {
1186
+ return u(f instanceof Error ? f.message : "Failed to upload avatar"), null;
1074
1187
  } finally {
1075
- c(!1);
1188
+ o(!1);
1076
1189
  }
1077
1190
  },
1078
- [s]
1191
+ [e]
1079
1192
  );
1080
- return { user: a, updateProfile: o, uploadAvatar: m, changePassword: n, isLoading: r, error: t, success: d, setError: i, setSuccess: u };
1193
+ return { user: a, updateProfile: d, uploadAvatar: g, changePassword: l, isLoading: r, error: t, success: i, setError: u, setSuccess: c };
1081
1194
  }
1082
- const K = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', ss = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>';
1083
- function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
1084
- const { appearance: c, settings: t } = E(), { signIn: i, signInWithOAuth: d, submitMfaCode: u, isLoading: o, error: n, setError: m } = Z(), p = s ?? c, [b, f] = h(""), [x, y] = h(""), [w, v] = h(!1), [g, N] = h(""), [S, k] = h(""), z = C(
1085
- async (T) => {
1086
- if (T.preventDefault(), w) {
1087
- await u(g, S);
1195
+ const ne = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', oe = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>', Se = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z" fill="currentColor"/></svg>';
1196
+ function Ke({ appearance: e, signUpUrl: a, onSignUp: r }) {
1197
+ const { appearance: o, settings: t } = L(), { signIn: u, signInWithOAuth: i, submitMfaCode: c, isLoading: d, error: l, setError: g } = re(), p = e ?? o, [f, b] = m(""), [k, v] = m(""), [C, x] = m(!1), [h, S] = m(""), [z, P] = m(""), [I, T] = m(!1), w = N(
1198
+ async (E) => {
1199
+ if (E.preventDefault(), C) {
1200
+ await c(h, z);
1088
1201
  return;
1089
1202
  }
1090
- const $ = await i(b, x);
1091
- $ && ls($) && (N($.mfaToken), v(!0), m(null));
1203
+ const M = await u(f, k);
1204
+ M && be(M) && (S(M.mfaToken), x(!0), g(null));
1092
1205
  },
1093
- [b, x, w, g, S, i, u, m]
1094
- ), P = C(
1095
- async (T) => {
1096
- await d(T);
1206
+ [f, k, C, h, z, u, c, g]
1207
+ ), $ = N(
1208
+ async (E) => {
1209
+ await i(E);
1097
1210
  },
1098
- [d]
1099
- ), A = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled);
1100
- return /* @__PURE__ */ e(D, { appearance: p, children: /* @__PURE__ */ l("div", { className: "ss-card", children: [
1101
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Sign in" }),
1102
- !w && /* @__PURE__ */ l(W, { children: [
1103
- (t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ l(
1211
+ [i]
1212
+ ), y = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled);
1213
+ return /* @__PURE__ */ s(q, { appearance: p, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
1214
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Sign in" }),
1215
+ !C && /* @__PURE__ */ n(G, { children: [
1216
+ (t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ n(
1104
1217
  "button",
1105
1218
  {
1106
1219
  type: "button",
1107
1220
  className: "ss-btn-social",
1108
- onClick: () => P("google"),
1109
- disabled: o,
1221
+ onClick: () => $("google"),
1222
+ disabled: d,
1110
1223
  children: [
1111
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: K } }),
1224
+ /* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
1112
1225
  "Continue with Google"
1113
1226
  ]
1114
1227
  }
1115
1228
  ),
1116
- (t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ l(
1229
+ (t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
1117
1230
  "button",
1118
1231
  {
1119
1232
  type: "button",
1120
1233
  className: "ss-btn-social",
1121
- onClick: () => P("github"),
1122
- disabled: o,
1234
+ onClick: () => $("github"),
1235
+ disabled: d,
1123
1236
  children: [
1124
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ss } }),
1237
+ /* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
1125
1238
  "Continue with GitHub"
1126
1239
  ]
1127
1240
  }
1128
1241
  ),
1129
- A && /* @__PURE__ */ e("div", { className: "ss-divider", children: "or" })
1242
+ y && !I && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" }),
1243
+ y && !I && /* @__PURE__ */ n(
1244
+ "button",
1245
+ {
1246
+ type: "button",
1247
+ className: "ss-btn-social",
1248
+ onClick: () => T(!0),
1249
+ children: [
1250
+ /* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: Se } }),
1251
+ "Login with email"
1252
+ ]
1253
+ }
1254
+ ),
1255
+ y && I && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" })
1130
1256
  ] }),
1131
- n && /* @__PURE__ */ e("div", { className: "ss-global-error", children: n }),
1132
- /* @__PURE__ */ l("form", { onSubmit: z, children: [
1133
- w ? /* @__PURE__ */ l("div", { className: "ss-field", children: [
1134
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-mfa-code", children: "Authentication code" }),
1135
- /* @__PURE__ */ e(
1257
+ l && /* @__PURE__ */ s("div", { className: "ss-global-error", children: l }),
1258
+ (I || C || !y) && /* @__PURE__ */ n("form", { onSubmit: w, children: [
1259
+ C ? /* @__PURE__ */ n("div", { className: "ss-field", children: [
1260
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-mfa-code", children: "Authentication code" }),
1261
+ /* @__PURE__ */ s(
1136
1262
  "input",
1137
1263
  {
1138
1264
  id: "ss-mfa-code",
@@ -1141,15 +1267,15 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
1141
1267
  inputMode: "numeric",
1142
1268
  autoComplete: "one-time-code",
1143
1269
  placeholder: "Enter 6-digit code",
1144
- value: S,
1145
- onChange: (T) => k(T.target.value),
1270
+ value: z,
1271
+ onChange: (E) => P(E.target.value),
1146
1272
  autoFocus: !0
1147
1273
  }
1148
1274
  )
1149
- ] }) : /* @__PURE__ */ l(W, { children: [
1150
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1151
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-email", children: "Email" }),
1152
- /* @__PURE__ */ e(
1275
+ ] }) : /* @__PURE__ */ n(G, { children: [
1276
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1277
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-email", children: "Email" }),
1278
+ /* @__PURE__ */ s(
1153
1279
  "input",
1154
1280
  {
1155
1281
  id: "ss-email",
@@ -1157,15 +1283,15 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
1157
1283
  type: "email",
1158
1284
  autoComplete: "email",
1159
1285
  placeholder: "you@example.com",
1160
- value: b,
1161
- onChange: (T) => f(T.target.value),
1286
+ value: f,
1287
+ onChange: (E) => b(E.target.value),
1162
1288
  required: !0
1163
1289
  }
1164
1290
  )
1165
1291
  ] }),
1166
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1167
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-password", children: "Password" }),
1168
- /* @__PURE__ */ e(
1292
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1293
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-password", children: "Password" }),
1294
+ /* @__PURE__ */ s(
1169
1295
  "input",
1170
1296
  {
1171
1297
  id: "ss-password",
@@ -1173,90 +1299,90 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
1173
1299
  type: "password",
1174
1300
  autoComplete: "current-password",
1175
1301
  placeholder: "Enter your password",
1176
- value: x,
1177
- onChange: (T) => y(T.target.value),
1302
+ value: k,
1303
+ onChange: (E) => v(E.target.value),
1178
1304
  required: !0
1179
1305
  }
1180
1306
  )
1181
1307
  ] })
1182
1308
  ] }),
1183
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: o, children: [
1184
- o && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
1185
- w ? "Verify" : "Continue"
1309
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: d, children: [
1310
+ d && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1311
+ C ? "Verify" : "Continue"
1186
1312
  ] })
1187
1313
  ] }),
1188
- w && /* @__PURE__ */ e("div", { className: "ss-footer", children: /* @__PURE__ */ e(
1314
+ C && /* @__PURE__ */ s("div", { className: "ss-footer", children: /* @__PURE__ */ s(
1189
1315
  "span",
1190
1316
  {
1191
1317
  className: "ss-link",
1192
1318
  onClick: () => {
1193
- v(!1), k(""), m(null);
1319
+ x(!1), P(""), g(null);
1194
1320
  },
1195
1321
  children: "Back to sign in"
1196
1322
  }
1197
1323
  ) }),
1198
- !w && /* @__PURE__ */ l("div", { className: "ss-footer", children: [
1324
+ !C && /* @__PURE__ */ n("div", { className: "ss-footer", children: [
1199
1325
  "Don't have an account?",
1200
1326
  " ",
1201
- r ? /* @__PURE__ */ e("span", { className: "ss-link", onClick: r, children: "Sign up" }) : a ? /* @__PURE__ */ e("a", { className: "ss-link", href: a, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-link", children: "Sign up" })
1327
+ r ? /* @__PURE__ */ s("span", { className: "ss-link", onClick: r, children: "Sign up" }) : a ? /* @__PURE__ */ s("a", { className: "ss-link", href: a, children: "Sign up" }) : /* @__PURE__ */ s("span", { className: "ss-link", children: "Sign up" })
1202
1328
  ] })
1203
1329
  ] }) });
1204
1330
  }
1205
- function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
1206
- const { appearance: c, settings: t } = E(), { signUp: i, isLoading: d, error: u, setError: o } = ms(), { signInWithOAuth: n } = Z(), m = s ?? c, [p, b] = h(""), [f, x] = h(""), [y, w] = h(""), [v, g] = h(null), N = C(
1207
- async (P) => {
1208
- if (P.preventDefault(), g(null), f !== y) {
1209
- g("Passwords do not match");
1331
+ function es({ appearance: e, signInUrl: a, onSignIn: r }) {
1332
+ const { appearance: o, settings: t } = L(), { signUp: u, isLoading: i, error: c, setError: d } = Ce(), { signInWithOAuth: l } = re(), g = e ?? o, [p, f] = m(""), [b, k] = m(""), [v, C] = m(""), [x, h] = m(null), S = N(
1333
+ async (T) => {
1334
+ if (T.preventDefault(), h(null), b !== v) {
1335
+ h("Passwords do not match");
1210
1336
  return;
1211
1337
  }
1212
- const A = (t == null ? void 0 : t.passwordMinLength) ?? 8;
1213
- if (f.length < A) {
1214
- g(`Password must be at least ${A} characters`);
1338
+ const w = (t == null ? void 0 : t.passwordMinLength) ?? 8;
1339
+ if (b.length < w) {
1340
+ h(`Password must be at least ${w} characters`);
1215
1341
  return;
1216
1342
  }
1217
- await i(p, f);
1343
+ await u(p, b);
1218
1344
  },
1219
- [p, f, y, t, i]
1220
- ), S = C(
1221
- async (P) => {
1222
- await n(P);
1345
+ [p, b, v, t, u]
1346
+ ), z = N(
1347
+ async (T) => {
1348
+ await l(T);
1223
1349
  },
1224
- [n]
1225
- ), k = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled), z = v || u;
1226
- return /* @__PURE__ */ e(D, { appearance: m, children: /* @__PURE__ */ l("div", { className: "ss-card", children: [
1227
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Create account" }),
1228
- (t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ l(
1350
+ [l]
1351
+ ), P = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled), I = x || c;
1352
+ return /* @__PURE__ */ s(q, { appearance: g, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
1353
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Create account" }),
1354
+ (t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ n(
1229
1355
  "button",
1230
1356
  {
1231
1357
  type: "button",
1232
1358
  className: "ss-btn-social",
1233
- onClick: () => S("google"),
1234
- disabled: d,
1359
+ onClick: () => z("google"),
1360
+ disabled: i,
1235
1361
  children: [
1236
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: K } }),
1362
+ /* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
1237
1363
  "Continue with Google"
1238
1364
  ]
1239
1365
  }
1240
1366
  ),
1241
- (t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ l(
1367
+ (t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
1242
1368
  "button",
1243
1369
  {
1244
1370
  type: "button",
1245
1371
  className: "ss-btn-social",
1246
- onClick: () => S("github"),
1247
- disabled: d,
1372
+ onClick: () => z("github"),
1373
+ disabled: i,
1248
1374
  children: [
1249
- /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ss } }),
1375
+ /* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
1250
1376
  "Continue with GitHub"
1251
1377
  ]
1252
1378
  }
1253
1379
  ),
1254
- k && /* @__PURE__ */ e("div", { className: "ss-divider", children: "or" }),
1255
- z && /* @__PURE__ */ e("div", { className: "ss-global-error", children: z }),
1256
- /* @__PURE__ */ l("form", { onSubmit: N, children: [
1257
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1258
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-signup-email", children: "Email" }),
1259
- /* @__PURE__ */ e(
1380
+ P && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" }),
1381
+ I && /* @__PURE__ */ s("div", { className: "ss-global-error", children: I }),
1382
+ /* @__PURE__ */ n("form", { onSubmit: S, children: [
1383
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1384
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-email", children: "Email" }),
1385
+ /* @__PURE__ */ s(
1260
1386
  "input",
1261
1387
  {
1262
1388
  id: "ss-signup-email",
@@ -1265,14 +1391,14 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
1265
1391
  autoComplete: "email",
1266
1392
  placeholder: "you@example.com",
1267
1393
  value: p,
1268
- onChange: (P) => b(P.target.value),
1394
+ onChange: (T) => f(T.target.value),
1269
1395
  required: !0
1270
1396
  }
1271
1397
  )
1272
1398
  ] }),
1273
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1274
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-signup-password", children: "Password" }),
1275
- /* @__PURE__ */ e(
1399
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1400
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-password", children: "Password" }),
1401
+ /* @__PURE__ */ s(
1276
1402
  "input",
1277
1403
  {
1278
1404
  id: "ss-signup-password",
@@ -1280,17 +1406,17 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
1280
1406
  type: "password",
1281
1407
  autoComplete: "new-password",
1282
1408
  placeholder: "Create a password",
1283
- value: f,
1284
- onChange: (P) => {
1285
- x(P.target.value), g(null);
1409
+ value: b,
1410
+ onChange: (T) => {
1411
+ k(T.target.value), h(null);
1286
1412
  },
1287
1413
  required: !0
1288
1414
  }
1289
1415
  )
1290
1416
  ] }),
1291
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1292
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-signup-confirm", children: "Confirm password" }),
1293
- /* @__PURE__ */ e(
1417
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1418
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-confirm", children: "Confirm password" }),
1419
+ /* @__PURE__ */ s(
1294
1420
  "input",
1295
1421
  {
1296
1422
  id: "ss-signup-confirm",
@@ -1298,585 +1424,765 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
1298
1424
  type: "password",
1299
1425
  autoComplete: "new-password",
1300
1426
  placeholder: "Confirm your password",
1301
- value: y,
1302
- onChange: (P) => {
1303
- w(P.target.value), g(null);
1427
+ value: v,
1428
+ onChange: (T) => {
1429
+ C(T.target.value), h(null);
1304
1430
  },
1305
1431
  required: !0
1306
1432
  }
1307
1433
  )
1308
1434
  ] }),
1309
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: d, children: [
1310
- d && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
1435
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
1436
+ i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1311
1437
  "Create account"
1312
1438
  ] })
1313
1439
  ] }),
1314
- /* @__PURE__ */ l("div", { className: "ss-footer", children: [
1440
+ /* @__PURE__ */ n("div", { className: "ss-footer", children: [
1315
1441
  "Already have an account?",
1316
1442
  " ",
1317
- r ? /* @__PURE__ */ e("span", { className: "ss-link", onClick: r, children: "Sign in" }) : a ? /* @__PURE__ */ e("a", { className: "ss-link", href: a, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-link", children: "Sign in" })
1443
+ r ? /* @__PURE__ */ s("span", { className: "ss-link", onClick: r, children: "Sign in" }) : a ? /* @__PURE__ */ s("a", { className: "ss-link", href: a, children: "Sign in" }) : /* @__PURE__ */ s("span", { className: "ss-link", children: "Sign in" })
1318
1444
  ] })
1319
1445
  ] }) });
1320
1446
  }
1321
- const I = 256, F = 112;
1322
- function hs({ file: s, onCrop: a, onCancel: r }) {
1323
- const c = R(null), t = R(null), [i, d] = h(1), [u, o] = h({ x: 0, y: 0 }), [n, m] = h(!1), p = R({ x: 0, y: 0, ox: 0, oy: 0 }), [b, f] = h(!1);
1324
- B(() => {
1325
- const g = new Image(), N = URL.createObjectURL(s);
1326
- return g.onload = () => {
1327
- t.current = g, f(!0), o({ x: 0, y: 0 }), d(1);
1328
- }, g.src = N, () => URL.revokeObjectURL(N);
1329
- }, [s]), B(() => {
1330
- if (!b || !t.current || !c.current) return;
1331
- const g = c.current.getContext("2d");
1332
- if (!g) return;
1333
- const N = t.current;
1334
- g.clearRect(0, 0, I, I), g.fillStyle = "#111", g.fillRect(0, 0, I, I);
1335
- const S = Math.max(I / N.width, I / N.height) * i, k = N.width * S, z = N.height * S, P = (I - k) / 2 + u.x, A = (I - z) / 2 + u.y;
1336
- g.save(), g.beginPath(), g.arc(I / 2, I / 2, F, 0, Math.PI * 2), g.clip(), g.drawImage(N, P, A, k, z), g.restore(), g.save(), g.fillStyle = "rgba(0, 0, 0, 0.6)", g.fillRect(0, 0, I, I), g.globalCompositeOperation = "destination-out", g.beginPath(), g.arc(I / 2, I / 2, F, 0, Math.PI * 2), g.fill(), g.restore(), g.save(), g.beginPath(), g.arc(I / 2, I / 2, F, 0, Math.PI * 2), g.clip(), g.drawImage(N, P, A, k, z), g.restore(), g.strokeStyle = "rgba(255, 255, 255, 0.6)", g.lineWidth = 2, g.beginPath(), g.arc(I / 2, I / 2, F, 0, Math.PI * 2), g.stroke();
1337
- }, [i, u, b]);
1338
- const x = C(
1339
- (g) => {
1340
- m(!0), p.current = { x: g.clientX, y: g.clientY, ox: u.x, oy: u.y }, g.target.setPointerCapture(g.pointerId);
1447
+ const B = 256, R = 112;
1448
+ function $e({ file: e, onCrop: a, onCancel: r }) {
1449
+ const o = j(null), t = j(null), [u, i] = m(1), [c, d] = m({ x: 0, y: 0 }), [l, g] = m(!1), p = j({ x: 0, y: 0, ox: 0, oy: 0 }), [f, b] = m(!1);
1450
+ U(() => {
1451
+ const h = new Image(), S = URL.createObjectURL(e);
1452
+ return h.onload = () => {
1453
+ t.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
1454
+ }, h.src = S, () => URL.revokeObjectURL(S);
1455
+ }, [e]), U(() => {
1456
+ if (!f || !t.current || !o.current) return;
1457
+ const h = o.current.getContext("2d");
1458
+ if (!h) return;
1459
+ const S = t.current;
1460
+ h.clearRect(0, 0, B, B), h.fillStyle = "#111", h.fillRect(0, 0, B, B);
1461
+ const z = Math.max(B / S.width, B / S.height) * u, P = S.width * z, I = S.height * z, T = (B - P) / 2 + c.x, w = (B - I) / 2 + c.y;
1462
+ h.save(), h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.clip(), h.drawImage(S, T, w, P, I), h.restore(), h.save(), h.fillStyle = "rgba(0, 0, 0, 0.6)", h.fillRect(0, 0, B, B), h.globalCompositeOperation = "destination-out", h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.clip(), h.drawImage(S, T, w, P, I), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.6)", h.lineWidth = 2, h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.stroke();
1463
+ }, [u, c, f]);
1464
+ const k = N(
1465
+ (h) => {
1466
+ g(!0), p.current = { x: h.clientX, y: h.clientY, ox: c.x, oy: c.y }, h.target.setPointerCapture(h.pointerId);
1341
1467
  },
1342
- [u]
1343
- ), y = C(
1344
- (g) => {
1345
- n && o({
1346
- x: p.current.ox + (g.clientX - p.current.x),
1347
- y: p.current.oy + (g.clientY - p.current.y)
1468
+ [c]
1469
+ ), v = N(
1470
+ (h) => {
1471
+ l && d({
1472
+ x: p.current.ox + (h.clientX - p.current.x),
1473
+ y: p.current.oy + (h.clientY - p.current.y)
1348
1474
  });
1349
1475
  },
1350
- [n]
1351
- ), w = C(() => m(!1), []), v = C(() => {
1476
+ [l]
1477
+ ), C = N(() => g(!1), []), x = N(() => {
1352
1478
  if (!t.current) return;
1353
- const g = document.createElement("canvas"), N = F * 2;
1354
- g.width = N, g.height = N;
1355
- const S = g.getContext("2d");
1356
- if (!S) return;
1357
- const k = t.current, z = Math.max(I / k.width, I / k.height) * i, P = k.width * z, A = k.height * z, T = (I - P) / 2 + u.x - (I / 2 - F), $ = (I - A) / 2 + u.y - (I / 2 - F);
1358
- S.beginPath(), S.arc(F, F, F, 0, Math.PI * 2), S.clip(), S.drawImage(k, T, $, P, A), g.toBlob((M) => {
1359
- M && a(M);
1479
+ const h = document.createElement("canvas"), S = R * 2;
1480
+ h.width = S, h.height = S;
1481
+ const z = h.getContext("2d");
1482
+ if (!z) return;
1483
+ const P = t.current, I = Math.max(B / P.width, B / P.height) * u, T = P.width * I, w = P.height * I, $ = (B - T) / 2 + c.x - (B / 2 - R), y = (B - w) / 2 + c.y - (B / 2 - R);
1484
+ z.beginPath(), z.arc(R, R, R, 0, Math.PI * 2), z.clip(), z.drawImage(P, $, y, T, w), h.toBlob((E) => {
1485
+ E && a(E);
1360
1486
  }, "image/png");
1361
- }, [i, u, a]);
1362
- return /* @__PURE__ */ l("div", { className: "ss-avatar-cropper", children: [
1363
- /* @__PURE__ */ e(
1487
+ }, [u, c, a]);
1488
+ return /* @__PURE__ */ n("div", { className: "ss-avatar-cropper", children: [
1489
+ /* @__PURE__ */ s(
1364
1490
  "canvas",
1365
1491
  {
1366
- ref: c,
1367
- width: I,
1368
- height: I,
1492
+ ref: o,
1493
+ width: B,
1494
+ height: B,
1369
1495
  className: "ss-avatar-canvas",
1370
- onPointerDown: x,
1371
- onPointerMove: y,
1372
- onPointerUp: w,
1373
- style: { cursor: n ? "grabbing" : "grab" }
1496
+ onPointerDown: k,
1497
+ onPointerMove: v,
1498
+ onPointerUp: C,
1499
+ style: { cursor: l ? "grabbing" : "grab" }
1374
1500
  }
1375
1501
  ),
1376
- /* @__PURE__ */ l("div", { className: "ss-avatar-zoom", children: [
1377
- /* @__PURE__ */ e("span", { className: "ss-avatar-zoom-label", children: "Zoom" }),
1378
- /* @__PURE__ */ e(
1502
+ /* @__PURE__ */ n("div", { className: "ss-avatar-zoom", children: [
1503
+ /* @__PURE__ */ s("span", { className: "ss-avatar-zoom-label", children: "Zoom" }),
1504
+ /* @__PURE__ */ s(
1379
1505
  "input",
1380
1506
  {
1381
1507
  type: "range",
1382
1508
  min: "1",
1383
1509
  max: "3",
1384
1510
  step: "0.01",
1385
- value: i,
1386
- onChange: (g) => d(parseFloat(g.target.value)),
1511
+ value: u,
1512
+ onChange: (h) => i(parseFloat(h.target.value)),
1387
1513
  className: "ss-avatar-zoom-slider"
1388
1514
  }
1389
1515
  )
1390
1516
  ] }),
1391
- /* @__PURE__ */ l("div", { className: "ss-btn-group", children: [
1392
- /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger ss-btn-sm", onClick: r, children: "Cancel" }),
1393
- /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary ss-btn-sm", onClick: v, children: "Save" })
1517
+ /* @__PURE__ */ n("div", { className: "ss-btn-group", children: [
1518
+ /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger ss-btn-sm", onClick: r, children: "Cancel" }),
1519
+ /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-primary ss-btn-sm", onClick: x, children: "Save" })
1394
1520
  ] })
1395
1521
  ] });
1396
1522
  }
1397
- function es({ onUpload: s, onClose: a, isLoading: r }) {
1398
- const [c, t] = h(null), [i, d] = h(!1), [u, o] = h(null), n = R(null), m = C((f) => {
1399
- if (!f.type.startsWith("image/")) {
1400
- o("Please select an image file");
1523
+ function le({ onUpload: e, onClose: a, isLoading: r }) {
1524
+ const [o, t] = m(null), [u, i] = m(!1), [c, d] = m(null), l = j(null), g = N((b) => {
1525
+ if (!b.type.startsWith("image/")) {
1526
+ d("Please select an image file");
1401
1527
  return;
1402
1528
  }
1403
- if (f.size > 5 * 1024 * 1024) {
1404
- o("Image must be smaller than 5 MB");
1529
+ if (b.size > 5 * 1024 * 1024) {
1530
+ d("Image must be smaller than 5 MB");
1405
1531
  return;
1406
1532
  }
1407
- o(null), t(f);
1408
- }, []), p = C(
1409
- (f) => {
1410
- f.preventDefault(), d(!1);
1411
- const x = f.dataTransfer.files[0];
1412
- x && m(x);
1533
+ d(null), t(b);
1534
+ }, []), p = N(
1535
+ (b) => {
1536
+ b.preventDefault(), i(!1);
1537
+ const k = b.dataTransfer.files[0];
1538
+ k && g(k);
1413
1539
  },
1414
- [m]
1415
- ), b = C(
1416
- async (f) => {
1417
- await s(f);
1540
+ [g]
1541
+ ), f = N(
1542
+ async (b) => {
1543
+ await e(b);
1418
1544
  },
1419
- [s]
1545
+ [e]
1420
1546
  );
1421
- return /* @__PURE__ */ e("div", { className: "ss-modal-overlay", onClick: (f) => {
1422
- f.target === f.currentTarget && a();
1423
- }, children: /* @__PURE__ */ l("div", { className: "ss-modal", children: [
1424
- /* @__PURE__ */ l("div", { className: "ss-modal-header", children: [
1425
- /* @__PURE__ */ e("span", { className: "ss-modal-title", children: "Upload Avatar" }),
1426
- /* @__PURE__ */ e("button", { type: "button", className: "ss-modal-close", onClick: a, children: "✕" })
1547
+ return /* @__PURE__ */ s("div", { className: "ss-modal-overlay", onClick: (b) => {
1548
+ b.target === b.currentTarget && a();
1549
+ }, children: /* @__PURE__ */ n("div", { className: "ss-modal", children: [
1550
+ /* @__PURE__ */ n("div", { className: "ss-modal-header", children: [
1551
+ /* @__PURE__ */ s("span", { className: "ss-modal-title", children: "Upload Avatar" }),
1552
+ /* @__PURE__ */ s("button", { type: "button", className: "ss-modal-close", onClick: a, children: "✕" })
1427
1553
  ] }),
1428
- u && /* @__PURE__ */ e("div", { className: "ss-global-error", children: u }),
1429
- c ? /* @__PURE__ */ e(hs, { file: c, onCrop: b, onCancel: () => t(null) }) : /* @__PURE__ */ l(
1554
+ c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
1555
+ o ? /* @__PURE__ */ s($e, { file: o, onCrop: f, onCancel: () => t(null) }) : /* @__PURE__ */ n(
1430
1556
  "div",
1431
1557
  {
1432
- className: `ss-avatar-dropzone${i ? " ss-avatar-dropzone-active" : ""}`,
1433
- onDragOver: (f) => {
1434
- f.preventDefault(), d(!0);
1558
+ className: `ss-avatar-dropzone${u ? " ss-avatar-dropzone-active" : ""}`,
1559
+ onDragOver: (b) => {
1560
+ b.preventDefault(), i(!0);
1435
1561
  },
1436
- onDragLeave: () => d(!1),
1562
+ onDragLeave: () => i(!1),
1437
1563
  onDrop: p,
1438
1564
  onClick: () => {
1439
- var f;
1440
- return (f = n.current) == null ? void 0 : f.click();
1565
+ var b;
1566
+ return (b = l.current) == null ? void 0 : b.click();
1441
1567
  },
1442
1568
  children: [
1443
- /* @__PURE__ */ l("svg", { width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
1444
- /* @__PURE__ */ e("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
1445
- /* @__PURE__ */ e("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
1569
+ /* @__PURE__ */ n("svg", { width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
1570
+ /* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
1571
+ /* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
1446
1572
  ] }),
1447
- /* @__PURE__ */ e("span", { children: "Drop image here or click to browse" }),
1448
- /* @__PURE__ */ e(
1573
+ /* @__PURE__ */ s("span", { children: "Drop image here or click to browse" }),
1574
+ /* @__PURE__ */ s(
1449
1575
  "input",
1450
1576
  {
1451
- ref: n,
1577
+ ref: l,
1452
1578
  type: "file",
1453
1579
  accept: "image/*",
1454
1580
  style: { display: "none" },
1455
- onChange: (f) => {
1456
- var x;
1457
- (x = f.target.files) != null && x[0] && m(f.target.files[0]);
1581
+ onChange: (b) => {
1582
+ var k;
1583
+ (k = b.target.files) != null && k[0] && g(b.target.files[0]);
1458
1584
  }
1459
1585
  }
1460
1586
  )
1461
1587
  ]
1462
1588
  }
1463
1589
  ),
1464
- r && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Uploading..." })
1590
+ r && /* @__PURE__ */ s("div", { className: "ss-loading", children: "Uploading..." })
1465
1591
  ] }) });
1466
1592
  }
1467
- function js({ appearance: s }) {
1468
- const { appearance: a } = E(), { user: r, signOut: c } = Y(), t = s ?? a, [i, d] = h(!1), [u, o] = h(!1), n = R(null), m = C((b) => {
1469
- n.current && !b.composedPath().includes(n.current) && d(!1);
1593
+ function ss({
1594
+ appearance: e,
1595
+ afterSignOutUrl: a,
1596
+ afterDeleteAccountUrl: r,
1597
+ showOrgSwitcher: o = !0,
1598
+ onOrgChange: t,
1599
+ onOrgSettingsClick: u
1600
+ }) {
1601
+ const { appearance: i } = L(), { user: c, signOut: d } = ee(), l = e ?? i, [g, p] = m(!1), [f, b] = m(!1), [k, v] = m(!1), [C, x] = m(""), [h, S] = m(""), [z, P] = m(null), [I, T] = m(!1), w = j(null), { orgs: $, selectedOrg: y, selectOrg: E, createOrg: M } = ae(), O = N((D) => {
1602
+ w.current && !D.composedPath().includes(w.current) && (p(!1), v(!1));
1470
1603
  }, []);
1471
- if (B(() => {
1472
- if (i) {
1473
- const b = setTimeout(() => {
1474
- document.addEventListener("click", m);
1604
+ U(() => {
1605
+ if (g) {
1606
+ const D = setTimeout(() => {
1607
+ document.addEventListener("click", O);
1475
1608
  }, 0);
1476
1609
  return () => {
1477
- clearTimeout(b), document.removeEventListener("click", m);
1610
+ clearTimeout(D), document.removeEventListener("click", O);
1478
1611
  };
1479
1612
  }
1480
- }, [i, m]), !r) return null;
1481
- const p = (r.name || r.email).charAt(0).toUpperCase();
1482
- return /* @__PURE__ */ e(D, { appearance: t, children: /* @__PURE__ */ l("div", { className: "ss-user-btn", ref: n, children: [
1483
- /* @__PURE__ */ e(
1613
+ }, [g, O]);
1614
+ const V = N((D) => {
1615
+ x(D), S(D.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
1616
+ }, []), F = N(
1617
+ async (D) => {
1618
+ D.preventDefault(), P(null), T(!0);
1619
+ try {
1620
+ const H = await M(C, h);
1621
+ H && (await E(H.id), t == null || t(H), v(!1), x(""), S(""), p(!1));
1622
+ } catch (H) {
1623
+ P(H instanceof Error ? H.message : "Failed to create organization");
1624
+ } finally {
1625
+ T(!1);
1626
+ }
1627
+ },
1628
+ [C, h, M, E, t]
1629
+ );
1630
+ if (!c) return null;
1631
+ const W = (c.name || c.email).charAt(0).toUpperCase();
1632
+ return /* @__PURE__ */ s(q, { appearance: l, children: /* @__PURE__ */ n("div", { className: "ss-user-btn", ref: w, children: [
1633
+ /* @__PURE__ */ s(
1484
1634
  "button",
1485
1635
  {
1486
1636
  type: "button",
1487
1637
  className: "ss-avatar",
1488
- onClick: () => d(!i),
1638
+ onClick: () => p(!g),
1489
1639
  "aria-label": "User menu",
1490
- children: r.avatarUrl ? /* @__PURE__ */ e("img", { src: r.avatarUrl, alt: "", style: { width: "100%", height: "100%", borderRadius: "50%", objectFit: "cover" } }) : p
1640
+ children: c.avatarUrl ? /* @__PURE__ */ s("img", { src: c.avatarUrl, alt: "", style: { width: "100%", height: "100%", borderRadius: "50%", objectFit: "cover" } }) : W
1491
1641
  }
1492
1642
  ),
1493
- i && /* @__PURE__ */ l("div", { className: "ss-dropdown", children: [
1494
- /* @__PURE__ */ l("div", { className: "ss-dropdown-header", children: [
1495
- r.name && /* @__PURE__ */ e("div", { style: { fontWeight: 600, fontSize: "14px", color: "inherit" }, children: r.name }),
1496
- /* @__PURE__ */ e("div", { className: "ss-dropdown-email", children: r.email })
1643
+ g && /* @__PURE__ */ n("div", { className: "ss-dropdown", children: [
1644
+ /* @__PURE__ */ n("div", { className: "ss-dropdown-header", children: [
1645
+ c.name && /* @__PURE__ */ s("div", { style: { fontWeight: 600, fontSize: "14px", color: "inherit" }, children: c.name }),
1646
+ /* @__PURE__ */ s("div", { className: "ss-dropdown-email", children: c.email })
1497
1647
  ] }),
1498
- /* @__PURE__ */ e(
1648
+ /* @__PURE__ */ s(
1499
1649
  "button",
1500
1650
  {
1501
1651
  type: "button",
1502
1652
  className: "ss-dropdown-item",
1503
1653
  onClick: () => {
1504
- d(!1), o(!0);
1654
+ p(!1), b(!0);
1505
1655
  },
1506
1656
  children: "Profile"
1507
1657
  }
1508
1658
  ),
1509
- /* @__PURE__ */ e(
1659
+ o && /* @__PURE__ */ n(G, { children: [
1660
+ /* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
1661
+ /* @__PURE__ */ s("div", { className: "ss-dropdown-section-title", children: "Organizations" }),
1662
+ $.map((D) => /* @__PURE__ */ n(
1663
+ "button",
1664
+ {
1665
+ type: "button",
1666
+ className: `ss-dropdown-item${(y == null ? void 0 : y.id) === D.id ? " ss-dropdown-item-active" : ""}`,
1667
+ onClick: async () => {
1668
+ p(!1), v(!1), await E(D.id), t == null || t(D);
1669
+ },
1670
+ children: [
1671
+ (y == null ? void 0 : y.id) === D.id && /* @__PURE__ */ s("span", { className: "ss-org-check", children: "✓" }),
1672
+ D.name
1673
+ ]
1674
+ },
1675
+ D.id
1676
+ )),
1677
+ k ? /* @__PURE__ */ n("div", { className: "ss-inline-form", children: [
1678
+ z && /* @__PURE__ */ s("div", { className: "ss-global-error", style: { marginBottom: "8px", fontSize: "12px" }, children: z }),
1679
+ /* @__PURE__ */ n("form", { onSubmit: F, children: [
1680
+ /* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
1681
+ "input",
1682
+ {
1683
+ className: "ss-input",
1684
+ type: "text",
1685
+ placeholder: "Organization name",
1686
+ value: C,
1687
+ onChange: (D) => V(D.target.value),
1688
+ required: !0,
1689
+ autoFocus: !0
1690
+ }
1691
+ ) }),
1692
+ /* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
1693
+ "input",
1694
+ {
1695
+ className: "ss-input",
1696
+ type: "text",
1697
+ placeholder: "org-slug",
1698
+ value: h,
1699
+ onChange: (D) => S(D.target.value),
1700
+ required: !0
1701
+ }
1702
+ ) }),
1703
+ /* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
1704
+ /* @__PURE__ */ s(
1705
+ "button",
1706
+ {
1707
+ type: "button",
1708
+ className: "ss-btn ss-btn-sm ss-btn-current",
1709
+ onClick: () => {
1710
+ v(!1), P(null);
1711
+ },
1712
+ children: "Cancel"
1713
+ }
1714
+ ),
1715
+ /* @__PURE__ */ n(
1716
+ "button",
1717
+ {
1718
+ type: "submit",
1719
+ className: "ss-btn ss-btn-sm ss-btn-primary",
1720
+ disabled: I,
1721
+ children: [
1722
+ I && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1723
+ "Create"
1724
+ ]
1725
+ }
1726
+ )
1727
+ ] })
1728
+ ] })
1729
+ ] }) : /* @__PURE__ */ s(
1730
+ "button",
1731
+ {
1732
+ type: "button",
1733
+ className: "ss-dropdown-item",
1734
+ onClick: () => v(!0),
1735
+ style: { fontWeight: 500 },
1736
+ children: "+ Create organization"
1737
+ }
1738
+ ),
1739
+ y && u && /* @__PURE__ */ s(
1740
+ "button",
1741
+ {
1742
+ type: "button",
1743
+ className: "ss-dropdown-item",
1744
+ onClick: () => {
1745
+ p(!1), u(y);
1746
+ },
1747
+ children: "Org settings"
1748
+ }
1749
+ )
1750
+ ] }),
1751
+ /* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
1752
+ /* @__PURE__ */ s(
1510
1753
  "button",
1511
1754
  {
1512
1755
  type: "button",
1513
1756
  className: "ss-dropdown-item ss-dropdown-item-danger",
1514
1757
  onClick: async () => {
1515
- d(!1), await c();
1758
+ p(!1), await d(), a && (window.location.href = a);
1516
1759
  },
1517
1760
  children: "Sign out"
1518
1761
  }
1519
1762
  )
1520
1763
  ] }),
1521
- u && /* @__PURE__ */ e(bs, { onClose: () => o(!1) })
1764
+ f && /* @__PURE__ */ s(
1765
+ Ee,
1766
+ {
1767
+ onClose: () => b(!1),
1768
+ afterDeleteAccountUrl: r
1769
+ }
1770
+ )
1522
1771
  ] }) });
1523
1772
  }
1524
- function bs({ onClose: s }) {
1525
- const { user: a, updateProfile: r, uploadAvatar: c, changePassword: t, isLoading: i, error: d, success: u, setError: o, setSuccess: n } = X(), [m, p] = h((a == null ? void 0 : a.name) ?? ""), [b, f] = h((a == null ? void 0 : a.avatarUrl) ?? ""), [x, y] = h(!1), [w, v] = h(""), [g, N] = h(""), [S, k] = h(""), [z, P] = h(null), A = C(
1526
- async (L) => {
1527
- L.preventDefault(), o(null), n(null), await r({ name: m, avatarUrl: b || void 0 });
1773
+ function Ee({ onClose: e, afterDeleteAccountUrl: a }) {
1774
+ const { user: r, updateProfile: o, uploadAvatar: t, changePassword: u, isLoading: i, error: c, success: d, setError: l, setSuccess: g } = te(), { signOut: p } = ee(), { deleteAccount: f, isLoading: b, error: k, setError: v } = ke(), [C, x] = m((r == null ? void 0 : r.name) ?? ""), [h, S] = m((r == null ? void 0 : r.avatarUrl) ?? ""), [z, P] = m(!1), [I, T] = m(""), [w, $] = m(""), [y, E] = m(""), [M, O] = m(null), [V, F] = m(!1), [W, D] = m(""), H = N(
1775
+ async (A) => {
1776
+ A.preventDefault(), l(null), g(null), await o({ name: C, avatarUrl: h || void 0 });
1528
1777
  },
1529
- [m, b, r, o, n]
1530
- ), T = C(
1531
- async (L) => {
1532
- const O = await c(L);
1533
- O && (f(O.avatarUrl), y(!1));
1778
+ [C, h, o, l, g]
1779
+ ), ce = N(
1780
+ async (A) => {
1781
+ const Y = await t(A);
1782
+ Y && (S(Y.avatarUrl), P(!1));
1534
1783
  },
1535
- [c]
1536
- ), $ = C(
1537
- async (L) => {
1538
- if (L.preventDefault(), P(null), o(null), n(null), g !== S) {
1539
- P("Passwords do not match");
1784
+ [t]
1785
+ ), de = N(
1786
+ async (A) => {
1787
+ if (A.preventDefault(), O(null), l(null), g(null), w !== y) {
1788
+ O("Passwords do not match");
1540
1789
  return;
1541
1790
  }
1542
- if (g.length < 8) {
1543
- P("Password must be at least 8 characters");
1791
+ if (w.length < 8) {
1792
+ O("Password must be at least 8 characters");
1544
1793
  return;
1545
1794
  }
1546
- await t(w, g) && (v(""), N(""), k(""));
1795
+ await u(I, w) && (T(""), $(""), E(""));
1547
1796
  },
1548
- [w, g, S, t, o, n]
1549
- ), M = (a == null ? void 0 : a.provider) === "email";
1550
- return /* @__PURE__ */ e("div", { className: "ss-modal-overlay", onClick: (L) => {
1551
- L.target === L.currentTarget && s();
1552
- }, children: /* @__PURE__ */ l("div", { className: "ss-modal", children: [
1553
- /* @__PURE__ */ l("div", { className: "ss-modal-header", children: [
1554
- /* @__PURE__ */ e("span", { className: "ss-modal-title", children: "Profile" }),
1555
- /* @__PURE__ */ e("button", { type: "button", className: "ss-modal-close", onClick: s, children: "✕" })
1797
+ [I, w, y, u, l, g]
1798
+ ), ue = N(async () => {
1799
+ await f() && (await p(), a && (window.location.href = a));
1800
+ }, [f, p, a]), pe = (r == null ? void 0 : r.provider) === "email", me = W === (r == null ? void 0 : r.email);
1801
+ return /* @__PURE__ */ s("div", { className: "ss-modal-overlay", onClick: (A) => {
1802
+ A.target === A.currentTarget && e();
1803
+ }, children: /* @__PURE__ */ n("div", { className: "ss-modal", children: [
1804
+ /* @__PURE__ */ n("div", { className: "ss-modal-header", children: [
1805
+ /* @__PURE__ */ s("span", { className: "ss-modal-title", children: "Profile" }),
1806
+ /* @__PURE__ */ s("button", { type: "button", className: "ss-modal-close", onClick: e, children: "✕" })
1556
1807
  ] }),
1557
- d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
1558
- u && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: u }),
1559
- /* @__PURE__ */ l(
1808
+ c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
1809
+ d && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: d }),
1810
+ /* @__PURE__ */ n(
1560
1811
  "div",
1561
1812
  {
1562
1813
  className: "ss-avatar-preview ss-avatar-hoverable",
1563
- onClick: () => y(!0),
1814
+ onClick: () => P(!0),
1564
1815
  title: "Click to change avatar",
1565
1816
  children: [
1566
- b ? /* @__PURE__ */ e("img", { src: b, alt: "" }) : (m || (a == null ? void 0 : a.email) || "?").charAt(0).toUpperCase(),
1567
- /* @__PURE__ */ e("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ l("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1568
- /* @__PURE__ */ e("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
1569
- /* @__PURE__ */ e("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
1817
+ h ? /* @__PURE__ */ s("img", { src: h, alt: "" }) : (C || (r == null ? void 0 : r.email) || "?").charAt(0).toUpperCase(),
1818
+ /* @__PURE__ */ s("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1819
+ /* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
1820
+ /* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
1570
1821
  ] }) })
1571
1822
  ]
1572
1823
  }
1573
1824
  ),
1574
- /* @__PURE__ */ l("form", { onSubmit: A, children: [
1575
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1576
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Name" }),
1577
- /* @__PURE__ */ e(
1825
+ /* @__PURE__ */ n("form", { onSubmit: H, children: [
1826
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1827
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Name" }),
1828
+ /* @__PURE__ */ s(
1578
1829
  "input",
1579
1830
  {
1580
1831
  className: "ss-input",
1581
1832
  type: "text",
1582
1833
  placeholder: "Your name",
1583
- value: m,
1584
- onChange: (L) => p(L.target.value)
1834
+ value: C,
1835
+ onChange: (A) => x(A.target.value)
1585
1836
  }
1586
1837
  )
1587
1838
  ] }),
1588
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1589
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Email" }),
1590
- /* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "email", value: (a == null ? void 0 : a.email) ?? "", disabled: !0, readOnly: !0 })
1839
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1840
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Email" }),
1841
+ /* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "email", value: (r == null ? void 0 : r.email) ?? "", disabled: !0, readOnly: !0 })
1591
1842
  ] }),
1592
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1593
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Provider" }),
1594
- /* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "text", value: (a == null ? void 0 : a.provider) ?? "", disabled: !0, readOnly: !0 })
1843
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1844
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Provider" }),
1845
+ /* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: (r == null ? void 0 : r.provider) ?? "", disabled: !0, readOnly: !0 })
1595
1846
  ] }),
1596
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
1597
- i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
1847
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
1848
+ i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1598
1849
  "Save changes"
1599
1850
  ] })
1600
1851
  ] }),
1601
- M && /* @__PURE__ */ l("div", { className: "ss-modal-section", children: [
1602
- /* @__PURE__ */ e("div", { className: "ss-modal-section-title", children: "Change password" }),
1603
- z && /* @__PURE__ */ e("div", { className: "ss-global-error", children: z }),
1604
- /* @__PURE__ */ l("form", { onSubmit: $, children: [
1605
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1606
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Current password" }),
1607
- /* @__PURE__ */ e(
1852
+ pe && /* @__PURE__ */ n("div", { className: "ss-modal-section", children: [
1853
+ /* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Change password" }),
1854
+ M && /* @__PURE__ */ s("div", { className: "ss-global-error", children: M }),
1855
+ /* @__PURE__ */ n("form", { onSubmit: de, children: [
1856
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1857
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Current password" }),
1858
+ /* @__PURE__ */ s(
1608
1859
  "input",
1609
1860
  {
1610
1861
  className: "ss-input",
1611
1862
  type: "password",
1612
- value: w,
1613
- onChange: (L) => v(L.target.value),
1863
+ value: I,
1864
+ onChange: (A) => T(A.target.value),
1614
1865
  required: !0
1615
1866
  }
1616
1867
  )
1617
1868
  ] }),
1618
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1619
- /* @__PURE__ */ e("label", { className: "ss-label", children: "New password" }),
1620
- /* @__PURE__ */ e(
1869
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1870
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "New password" }),
1871
+ /* @__PURE__ */ s(
1621
1872
  "input",
1622
1873
  {
1623
1874
  className: "ss-input",
1624
1875
  type: "password",
1625
- value: g,
1626
- onChange: (L) => N(L.target.value),
1876
+ value: w,
1877
+ onChange: (A) => $(A.target.value),
1627
1878
  required: !0
1628
1879
  }
1629
1880
  )
1630
1881
  ] }),
1631
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1632
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Confirm new password" }),
1633
- /* @__PURE__ */ e(
1882
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1883
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Confirm new password" }),
1884
+ /* @__PURE__ */ s(
1634
1885
  "input",
1635
1886
  {
1636
1887
  className: "ss-input",
1637
1888
  type: "password",
1638
- value: S,
1639
- onChange: (L) => k(L.target.value),
1889
+ value: y,
1890
+ onChange: (A) => E(A.target.value),
1640
1891
  required: !0
1641
1892
  }
1642
1893
  )
1643
1894
  ] }),
1644
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
1645
- i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
1895
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
1896
+ i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1646
1897
  "Update password"
1647
1898
  ] })
1648
1899
  ] })
1649
1900
  ] }),
1650
- x && /* @__PURE__ */ e(
1651
- es,
1901
+ /* @__PURE__ */ n("div", { className: "ss-danger-zone", children: [
1902
+ /* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Danger zone" }),
1903
+ /* @__PURE__ */ s("p", { style: { fontSize: "13px", margin: "0 0 12px 0", opacity: 0.8 }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
1904
+ k && /* @__PURE__ */ s("div", { className: "ss-global-error", children: k }),
1905
+ V ? /* @__PURE__ */ n("div", { children: [
1906
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
1907
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Type your email to confirm" }),
1908
+ /* @__PURE__ */ s(
1909
+ "input",
1910
+ {
1911
+ className: "ss-input",
1912
+ type: "email",
1913
+ placeholder: r == null ? void 0 : r.email,
1914
+ value: W,
1915
+ onChange: (A) => D(A.target.value),
1916
+ autoFocus: !0
1917
+ }
1918
+ )
1919
+ ] }),
1920
+ /* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
1921
+ /* @__PURE__ */ s(
1922
+ "button",
1923
+ {
1924
+ type: "button",
1925
+ className: "ss-btn ss-btn-sm ss-btn-current",
1926
+ onClick: () => {
1927
+ F(!1), D(""), v(null);
1928
+ },
1929
+ children: "Cancel"
1930
+ }
1931
+ ),
1932
+ /* @__PURE__ */ n(
1933
+ "button",
1934
+ {
1935
+ type: "button",
1936
+ className: "ss-btn ss-btn-sm ss-btn-danger",
1937
+ disabled: !me || b,
1938
+ onClick: ue,
1939
+ children: [
1940
+ b && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1941
+ "Delete account"
1942
+ ]
1943
+ }
1944
+ )
1945
+ ] })
1946
+ ] }) : /* @__PURE__ */ s(
1947
+ "button",
1948
+ {
1949
+ type: "button",
1950
+ className: "ss-btn ss-btn-danger",
1951
+ onClick: () => F(!0),
1952
+ children: "Delete my account"
1953
+ }
1954
+ )
1955
+ ] }),
1956
+ z && /* @__PURE__ */ s(
1957
+ le,
1652
1958
  {
1653
- onUpload: T,
1654
- onClose: () => y(!1),
1959
+ onUpload: ce,
1960
+ onClose: () => P(!1),
1655
1961
  isLoading: i
1656
1962
  }
1657
1963
  )
1658
1964
  ] }) });
1659
1965
  }
1660
- function _s({ appearance: s }) {
1661
- const { appearance: a } = E(), { user: r, signOut: c } = Y(), { updateProfile: t, uploadAvatar: i, changePassword: d, isLoading: u, error: o, success: n, setError: m, setSuccess: p } = X(), b = s ?? a, [f, x] = h((r == null ? void 0 : r.name) ?? ""), [y, w] = h((r == null ? void 0 : r.avatarUrl) ?? ""), [v, g] = h(!1), [N, S] = h(""), [k, z] = h(""), [P, A] = h(""), [T, $] = h(null), M = C(
1662
- async (U) => {
1663
- U.preventDefault(), m(null), p(null), await t({ name: f, avatarUrl: y || void 0 });
1966
+ function rs({ appearance: e }) {
1967
+ const { appearance: a } = L(), { user: r, signOut: o } = ee(), { updateProfile: t, uploadAvatar: u, changePassword: i, isLoading: c, error: d, success: l, setError: g, setSuccess: p } = te(), f = e ?? a, [b, k] = m((r == null ? void 0 : r.name) ?? ""), [v, C] = m((r == null ? void 0 : r.avatarUrl) ?? ""), [x, h] = m(!1), [S, z] = m(""), [P, I] = m(""), [T, w] = m(""), [$, y] = m(null), E = N(
1968
+ async (F) => {
1969
+ F.preventDefault(), g(null), p(null), await t({ name: b, avatarUrl: v || void 0 });
1664
1970
  },
1665
- [f, y, t, m, p]
1666
- ), L = C(
1667
- async (U) => {
1668
- const _ = await i(U);
1669
- _ && (w(_.avatarUrl), g(!1));
1971
+ [b, v, t, g, p]
1972
+ ), M = N(
1973
+ async (F) => {
1974
+ const W = await u(F);
1975
+ W && (C(W.avatarUrl), h(!1));
1670
1976
  },
1671
- [i]
1672
- ), O = C(
1673
- async (U) => {
1674
- if (U.preventDefault(), $(null), m(null), p(null), k !== P) {
1675
- $("Passwords do not match");
1977
+ [u]
1978
+ ), O = N(
1979
+ async (F) => {
1980
+ if (F.preventDefault(), y(null), g(null), p(null), P !== T) {
1981
+ y("Passwords do not match");
1676
1982
  return;
1677
1983
  }
1678
- if (k.length < 8) {
1679
- $("Password must be at least 8 characters");
1984
+ if (P.length < 8) {
1985
+ y("Password must be at least 8 characters");
1680
1986
  return;
1681
1987
  }
1682
- await d(N, k) && (S(""), z(""), A(""));
1988
+ await i(S, P) && (z(""), I(""), w(""));
1683
1989
  },
1684
- [N, k, P, d, m, p]
1990
+ [S, P, T, i, g, p]
1685
1991
  );
1686
1992
  if (!r) return null;
1687
- const as = r.provider === "email";
1688
- return /* @__PURE__ */ e(D, { appearance: b, children: /* @__PURE__ */ l("div", { className: "ss-card ss-card-wide", children: [
1689
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Profile" }),
1690
- o && /* @__PURE__ */ e("div", { className: "ss-global-error", children: o }),
1691
- n && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: n }),
1692
- /* @__PURE__ */ l(
1993
+ const V = r.provider === "email";
1994
+ return /* @__PURE__ */ s(q, { appearance: f, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
1995
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Profile" }),
1996
+ d && /* @__PURE__ */ s("div", { className: "ss-global-error", children: d }),
1997
+ l && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: l }),
1998
+ /* @__PURE__ */ n(
1693
1999
  "div",
1694
2000
  {
1695
2001
  className: "ss-avatar-preview ss-avatar-hoverable",
1696
2002
  style: { margin: "0 auto 16px" },
1697
- onClick: () => g(!0),
2003
+ onClick: () => h(!0),
1698
2004
  title: "Click to change avatar",
1699
2005
  children: [
1700
- y ? /* @__PURE__ */ e("img", { src: y, alt: "" }) : (f || r.email).charAt(0).toUpperCase(),
1701
- /* @__PURE__ */ e("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ l("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1702
- /* @__PURE__ */ e("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
1703
- /* @__PURE__ */ e("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
2006
+ v ? /* @__PURE__ */ s("img", { src: v, alt: "" }) : (b || r.email).charAt(0).toUpperCase(),
2007
+ /* @__PURE__ */ s("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
2008
+ /* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
2009
+ /* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
1704
2010
  ] }) })
1705
2011
  ]
1706
2012
  }
1707
2013
  ),
1708
- /* @__PURE__ */ l("form", { onSubmit: M, children: [
1709
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1710
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Name" }),
1711
- /* @__PURE__ */ e("input", { className: "ss-input", type: "text", placeholder: "Your name", value: f, onChange: (U) => x(U.target.value) })
2014
+ /* @__PURE__ */ n("form", { onSubmit: E, children: [
2015
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2016
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Name" }),
2017
+ /* @__PURE__ */ s("input", { className: "ss-input", type: "text", placeholder: "Your name", value: b, onChange: (F) => k(F.target.value) })
1712
2018
  ] }),
1713
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1714
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Email" }),
1715
- /* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "email", value: r.email, disabled: !0, readOnly: !0 })
2019
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2020
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Email" }),
2021
+ /* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "email", value: r.email, disabled: !0, readOnly: !0 })
1716
2022
  ] }),
1717
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1718
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Provider" }),
1719
- /* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "text", value: r.provider, disabled: !0, readOnly: !0 })
2023
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2024
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Provider" }),
2025
+ /* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: r.provider, disabled: !0, readOnly: !0 })
1720
2026
  ] }),
1721
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1722
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Email verified" }),
1723
- /* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "text", value: r.emailVerified ? "Yes" : "No", disabled: !0, readOnly: !0 })
2027
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2028
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Email verified" }),
2029
+ /* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: r.emailVerified ? "Yes" : "No", disabled: !0, readOnly: !0 })
1724
2030
  ] }),
1725
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: u, children: [
1726
- u && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2031
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
2032
+ c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1727
2033
  "Save changes"
1728
2034
  ] })
1729
2035
  ] }),
1730
- as && /* @__PURE__ */ l("div", { className: "ss-modal-section", children: [
1731
- /* @__PURE__ */ e("div", { className: "ss-modal-section-title", children: "Change password" }),
1732
- T && /* @__PURE__ */ e("div", { className: "ss-global-error", children: T }),
1733
- /* @__PURE__ */ l("form", { onSubmit: O, children: [
1734
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1735
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Current password" }),
1736
- /* @__PURE__ */ e("input", { className: "ss-input", type: "password", value: N, onChange: (U) => S(U.target.value), required: !0 })
2036
+ V && /* @__PURE__ */ n("div", { className: "ss-modal-section", children: [
2037
+ /* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Change password" }),
2038
+ $ && /* @__PURE__ */ s("div", { className: "ss-global-error", children: $ }),
2039
+ /* @__PURE__ */ n("form", { onSubmit: O, children: [
2040
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2041
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Current password" }),
2042
+ /* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: S, onChange: (F) => z(F.target.value), required: !0 })
1737
2043
  ] }),
1738
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1739
- /* @__PURE__ */ e("label", { className: "ss-label", children: "New password" }),
1740
- /* @__PURE__ */ e("input", { className: "ss-input", type: "password", value: k, onChange: (U) => z(U.target.value), required: !0 })
2044
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2045
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "New password" }),
2046
+ /* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: P, onChange: (F) => I(F.target.value), required: !0 })
1741
2047
  ] }),
1742
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
1743
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Confirm new password" }),
1744
- /* @__PURE__ */ e("input", { className: "ss-input", type: "password", value: P, onChange: (U) => A(U.target.value), required: !0 })
2048
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2049
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Confirm new password" }),
2050
+ /* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: T, onChange: (F) => w(F.target.value), required: !0 })
1745
2051
  ] }),
1746
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: u, children: [
1747
- u && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2052
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
2053
+ c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1748
2054
  "Update password"
1749
2055
  ] })
1750
2056
  ] })
1751
2057
  ] }),
1752
- /* @__PURE__ */ e("div", { style: { marginTop: "24px" }, children: /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: () => c(), children: "Sign out" }) }),
1753
- v && /* @__PURE__ */ e(
1754
- es,
2058
+ /* @__PURE__ */ s("div", { style: { marginTop: "24px" }, children: /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: () => o(), children: "Sign out" }) }),
2059
+ x && /* @__PURE__ */ s(
2060
+ le,
1755
2061
  {
1756
- onUpload: L,
1757
- onClose: () => g(!1),
1758
- isLoading: u
2062
+ onUpload: M,
2063
+ onClose: () => h(!1),
2064
+ isLoading: c
1759
2065
  }
1760
2066
  )
1761
2067
  ] }) });
1762
2068
  }
1763
- function Vs({ appearance: s, onOrgChange: a }) {
1764
- const { appearance: r } = E(), { orgs: c, selectedOrg: t, selectOrg: i, createOrg: d, isLoading: u } = gs(), o = s ?? r, [n, m] = h(!1), [p, b] = h(!1), [f, x] = h(""), [y, w] = h(""), [v, g] = h(null), [N, S] = h(!1), k = R(null), z = C(($) => {
1765
- k.current && !$.composedPath().includes(k.current) && (m(!1), b(!1));
2069
+ function as({ appearance: e, onOrgChange: a }) {
2070
+ const { appearance: r } = L(), { orgs: o, selectedOrg: t, selectOrg: u, createOrg: i, isLoading: c } = ae(), d = e ?? r, [l, g] = m(!1), [p, f] = m(!1), [b, k] = m(""), [v, C] = m(""), [x, h] = m(null), [S, z] = m(!1), P = j(null), I = N((y) => {
2071
+ P.current && !y.composedPath().includes(P.current) && (g(!1), f(!1));
1766
2072
  }, []);
1767
- B(() => {
1768
- if (n) {
1769
- const $ = setTimeout(() => {
1770
- document.addEventListener("click", z);
2073
+ U(() => {
2074
+ if (l) {
2075
+ const y = setTimeout(() => {
2076
+ document.addEventListener("click", I);
1771
2077
  }, 0);
1772
2078
  return () => {
1773
- clearTimeout($), document.removeEventListener("click", z);
2079
+ clearTimeout(y), document.removeEventListener("click", I);
1774
2080
  };
1775
2081
  }
1776
- }, [n, z]);
1777
- const P = C(($) => {
1778
- x($), w($.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
1779
- }, []), A = C(
1780
- async ($) => {
1781
- $.preventDefault(), g(null), S(!0);
2082
+ }, [l, I]);
2083
+ const T = N((y) => {
2084
+ k(y), C(y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
2085
+ }, []), w = N(
2086
+ async (y) => {
2087
+ y.preventDefault(), h(null), z(!0);
1782
2088
  try {
1783
- const M = await d(f, y);
1784
- M && (await i(M.id), a == null || a(M), b(!1), x(""), w(""), m(!1));
1785
- } catch (M) {
1786
- g(M instanceof Error ? M.message : "Failed to create organization");
2089
+ const E = await i(b, v);
2090
+ E && (await u(E.id), a == null || a(E), f(!1), k(""), C(""), g(!1));
2091
+ } catch (E) {
2092
+ h(E instanceof Error ? E.message : "Failed to create organization");
1787
2093
  } finally {
1788
- S(!1);
2094
+ z(!1);
1789
2095
  }
1790
2096
  },
1791
- [f, y, d, i, a]
2097
+ [b, v, i, u, a]
1792
2098
  );
1793
- if (u) return null;
1794
- const T = (t == null ? void 0 : t.name) ?? (c.length === 0 ? "No organization" : "Select organization");
1795
- return /* @__PURE__ */ e(D, { appearance: o, children: /* @__PURE__ */ l("div", { className: "ss-user-btn", ref: k, children: [
1796
- /* @__PURE__ */ l(
2099
+ if (c) return null;
2100
+ const $ = (t == null ? void 0 : t.name) ?? (o.length === 0 ? "No organization" : "Select organization");
2101
+ return /* @__PURE__ */ s(q, { appearance: d, children: /* @__PURE__ */ n("div", { className: "ss-user-btn", ref: P, children: [
2102
+ /* @__PURE__ */ n(
1797
2103
  "button",
1798
2104
  {
1799
2105
  type: "button",
1800
2106
  className: "ss-btn ss-btn-org-switcher",
1801
- onClick: () => m(!n),
2107
+ onClick: () => g(!l),
1802
2108
  children: [
1803
- T,
1804
- /* @__PURE__ */ e("span", { className: "ss-chevron", children: n ? "▲" : "▼" })
2109
+ $,
2110
+ /* @__PURE__ */ s("span", { className: "ss-chevron", children: l ? "▲" : "▼" })
1805
2111
  ]
1806
2112
  }
1807
2113
  ),
1808
- n && /* @__PURE__ */ l("div", { className: "ss-dropdown ss-dropdown-org", children: [
1809
- c.map(($) => /* @__PURE__ */ e(
2114
+ l && /* @__PURE__ */ n("div", { className: "ss-dropdown ss-dropdown-org", children: [
2115
+ o.map((y) => /* @__PURE__ */ s(
1810
2116
  "button",
1811
2117
  {
1812
2118
  type: "button",
1813
- className: `ss-dropdown-item ${(t == null ? void 0 : t.id) === $.id ? "ss-dropdown-item-active" : ""}`,
2119
+ className: `ss-dropdown-item ${(t == null ? void 0 : t.id) === y.id ? "ss-dropdown-item-active" : ""}`,
1814
2120
  onClick: async () => {
1815
- m(!1), b(!1), await i($.id), a == null || a($);
2121
+ g(!1), f(!1), await u(y.id), a == null || a(y);
1816
2122
  },
1817
- children: $.name
2123
+ children: y.name
1818
2124
  },
1819
- $.id
2125
+ y.id
1820
2126
  )),
1821
- /* @__PURE__ */ e("div", { className: "ss-dropdown-divider" }),
1822
- p ? /* @__PURE__ */ l("div", { className: "ss-inline-form", children: [
1823
- v && /* @__PURE__ */ e("div", { className: "ss-global-error", style: { marginBottom: "8px", fontSize: "12px" }, children: v }),
1824
- /* @__PURE__ */ l("form", { onSubmit: A, children: [
1825
- /* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
2127
+ /* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
2128
+ p ? /* @__PURE__ */ n("div", { className: "ss-inline-form", children: [
2129
+ x && /* @__PURE__ */ s("div", { className: "ss-global-error", style: { marginBottom: "8px", fontSize: "12px" }, children: x }),
2130
+ /* @__PURE__ */ n("form", { onSubmit: w, children: [
2131
+ /* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
1826
2132
  "input",
1827
2133
  {
1828
2134
  className: "ss-input",
1829
2135
  type: "text",
1830
2136
  placeholder: "Organization name",
1831
- value: f,
1832
- onChange: ($) => P($.target.value),
2137
+ value: b,
2138
+ onChange: (y) => T(y.target.value),
1833
2139
  required: !0,
1834
2140
  autoFocus: !0
1835
2141
  }
1836
2142
  ) }),
1837
- /* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
2143
+ /* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
1838
2144
  "input",
1839
2145
  {
1840
2146
  className: "ss-input",
1841
2147
  type: "text",
1842
2148
  placeholder: "org-slug",
1843
- value: y,
1844
- onChange: ($) => w($.target.value),
2149
+ value: v,
2150
+ onChange: (y) => C(y.target.value),
1845
2151
  required: !0
1846
2152
  }
1847
2153
  ) }),
1848
- /* @__PURE__ */ l("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
1849
- /* @__PURE__ */ e(
2154
+ /* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
2155
+ /* @__PURE__ */ s(
1850
2156
  "button",
1851
2157
  {
1852
2158
  type: "button",
1853
2159
  className: "ss-btn ss-btn-sm ss-btn-current",
1854
2160
  onClick: () => {
1855
- b(!1), g(null);
2161
+ f(!1), h(null);
1856
2162
  },
1857
2163
  children: "Cancel"
1858
2164
  }
1859
2165
  ),
1860
- /* @__PURE__ */ l(
2166
+ /* @__PURE__ */ n(
1861
2167
  "button",
1862
2168
  {
1863
2169
  type: "submit",
1864
2170
  className: "ss-btn ss-btn-sm ss-btn-primary",
1865
- disabled: N,
2171
+ disabled: S,
1866
2172
  children: [
1867
- N && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2173
+ S && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
1868
2174
  "Create"
1869
2175
  ]
1870
2176
  }
1871
2177
  )
1872
2178
  ] })
1873
2179
  ] })
1874
- ] }) : /* @__PURE__ */ e(
2180
+ ] }) : /* @__PURE__ */ s(
1875
2181
  "button",
1876
2182
  {
1877
2183
  type: "button",
1878
2184
  className: "ss-dropdown-item",
1879
- onClick: () => b(!0),
2185
+ onClick: () => f(!0),
1880
2186
  style: { fontWeight: 500 },
1881
2187
  children: "+ Create organization"
1882
2188
  }
@@ -1884,636 +2190,636 @@ function Vs({ appearance: s, onOrgChange: a }) {
1884
2190
  ] })
1885
2191
  ] }) });
1886
2192
  }
1887
- function fs(s, a = "USD") {
2193
+ function Pe(e, a = "USD") {
1888
2194
  return new Intl.NumberFormat("en-US", {
1889
2195
  style: "currency",
1890
2196
  currency: a,
1891
- minimumFractionDigits: s % 100 === 0 ? 0 : 2
1892
- }).format(s / 100);
2197
+ minimumFractionDigits: e % 100 === 0 ? 0 : 2
2198
+ }).format(e / 100);
1893
2199
  }
1894
- function Gs({ plans: s, currentPlanId: a, onSelectPlan: r, interval: c, appearance: t }) {
1895
- const { appearance: i } = E(), d = t ?? i, u = c ? s.filter((o) => o.interval === c || o.isFree) : s;
1896
- return /* @__PURE__ */ e(D, { appearance: d, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: u.map((o) => {
1897
- const n = o.id === a;
1898
- return /* @__PURE__ */ l("div", { className: `ss-pricing-card ${n ? "ss-pricing-card-current" : ""}`, children: [
1899
- /* @__PURE__ */ l("div", { className: "ss-pricing-header", children: [
1900
- /* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: o.name }),
1901
- o.trialDays > 0 && /* @__PURE__ */ l("span", { className: "ss-badge ss-badge-trialing", children: [
1902
- o.trialDays,
2200
+ function ts({ plans: e, currentPlanId: a, onSelectPlan: r, interval: o, appearance: t }) {
2201
+ const { appearance: u } = L(), i = t ?? u, c = o ? e.filter((d) => d.interval === o || d.isFree) : e;
2202
+ return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ s("div", { className: "ss-pricing-grid", children: c.map((d) => {
2203
+ const l = d.id === a;
2204
+ return /* @__PURE__ */ n("div", { className: `ss-pricing-card ${l ? "ss-pricing-card-current" : ""}`, children: [
2205
+ /* @__PURE__ */ n("div", { className: "ss-pricing-header", children: [
2206
+ /* @__PURE__ */ s("h3", { className: "ss-pricing-name", children: d.name }),
2207
+ d.trialDays > 0 && /* @__PURE__ */ n("span", { className: "ss-badge ss-badge-trialing", children: [
2208
+ d.trialDays,
1903
2209
  "-day trial"
1904
2210
  ] }),
1905
- o.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
2211
+ d.isFree && /* @__PURE__ */ s("span", { className: "ss-badge ss-badge-active", children: "Free" })
1906
2212
  ] }),
1907
- /* @__PURE__ */ e("div", { className: "ss-pricing-price", children: o.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ l(W, { children: [
1908
- /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: fs(o.amountCents, o.currency) }),
1909
- /* @__PURE__ */ l("span", { className: "ss-pricing-interval", children: [
2213
+ /* @__PURE__ */ s("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ s("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ n(G, { children: [
2214
+ /* @__PURE__ */ s("span", { className: "ss-pricing-amount", children: Pe(d.amountCents, d.currency) }),
2215
+ /* @__PURE__ */ n("span", { className: "ss-pricing-interval", children: [
1910
2216
  "/",
1911
- o.interval
2217
+ d.interval
1912
2218
  ] })
1913
2219
  ] }) }),
1914
- o.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: o.description }),
1915
- o.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: o.features.map((m, p) => /* @__PURE__ */ l("li", { className: "ss-pricing-feature", children: [
1916
- /* @__PURE__ */ e("span", { className: "ss-check", children: "✓" }),
2220
+ d.description && /* @__PURE__ */ s("p", { className: "ss-pricing-desc", children: d.description }),
2221
+ d.features.length > 0 && /* @__PURE__ */ s("ul", { className: "ss-pricing-features", children: d.features.map((g, p) => /* @__PURE__ */ n("li", { className: "ss-pricing-feature", children: [
2222
+ /* @__PURE__ */ s("span", { className: "ss-check", children: "✓" }),
1917
2223
  " ",
1918
- m
2224
+ g
1919
2225
  ] }, p)) }),
1920
- /* @__PURE__ */ e(
2226
+ /* @__PURE__ */ s(
1921
2227
  "button",
1922
2228
  {
1923
2229
  type: "button",
1924
- className: `ss-btn ${n ? "ss-btn-current" : "ss-btn-primary"}`,
1925
- disabled: n,
1926
- onClick: () => r(o.id),
1927
- children: n ? "Current plan" : "Select plan"
2230
+ className: `ss-btn ${l ? "ss-btn-current" : "ss-btn-primary"}`,
2231
+ disabled: l,
2232
+ onClick: () => r(d.id),
2233
+ children: l ? "Current plan" : "Select plan"
1928
2234
  }
1929
2235
  )
1930
- ] }, o.id);
2236
+ ] }, d.id);
1931
2237
  }) }) });
1932
2238
  }
1933
- function Js() {
1934
- const { client: s } = E();
1935
- return { billing: s.billing };
2239
+ function ns() {
2240
+ const { client: e } = L();
2241
+ return { billing: e.billing };
1936
2242
  }
1937
- function j(s) {
1938
- const { client: a } = E();
1939
- return q(() => {
1940
- if (s) {
1941
- const r = new H("https://api.saas-support.com/v1", { type: "portalToken", token: s });
1942
- return new is(r);
2243
+ function Q(e) {
2244
+ const { client: a } = L();
2245
+ return _(() => {
2246
+ if (e) {
2247
+ const r = new J("https://api.saas-support.com/v1", { type: "portalToken", token: e });
2248
+ return new ye(r);
1943
2249
  }
1944
2250
  return a.billing;
1945
- }, [a, s]);
2251
+ }, [a, e]);
1946
2252
  }
1947
- function ys(s, a) {
1948
- const r = j(a), [c, t] = h(null), [i, d] = h(!0), [u, o] = h(null), n = C(async () => {
1949
- d(!0), o(null);
2253
+ function ze(e, a) {
2254
+ const r = Q(a), [o, t] = m(null), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
2255
+ i(!0), d(null);
1950
2256
  try {
1951
- const m = await r.getCustomer(s);
1952
- t(m);
1953
- } catch (m) {
1954
- o(m instanceof Error ? m.message : "Failed to load subscription");
2257
+ const g = await r.getCustomer(e);
2258
+ t(g);
2259
+ } catch (g) {
2260
+ d(g instanceof Error ? g.message : "Failed to load subscription");
1955
2261
  } finally {
1956
- d(!1);
2262
+ i(!1);
1957
2263
  }
1958
- }, [r, s]);
1959
- return B(() => {
1960
- n();
1961
- }, [n]), { customer: c, isLoading: i, error: u, refresh: n };
2264
+ }, [r, e]);
2265
+ return U(() => {
2266
+ l();
2267
+ }, [l]), { customer: o, isLoading: u, error: c, refresh: l };
1962
2268
  }
1963
- function xs(s, a) {
1964
- const r = j(a), [c, t] = h([]), [i, d] = h(!0), [u, o] = h(null), n = C(async () => {
1965
- d(!0), o(null);
2269
+ function Ie(e, a) {
2270
+ const r = Q(a), [o, t] = m([]), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
2271
+ i(!0), d(null);
1966
2272
  try {
1967
- const m = await r.getInvoices(s);
1968
- t(m);
1969
- } catch (m) {
1970
- o(m instanceof Error ? m.message : "Failed to load invoices");
2273
+ const g = await r.getInvoices(e);
2274
+ t(g);
2275
+ } catch (g) {
2276
+ d(g instanceof Error ? g.message : "Failed to load invoices");
1971
2277
  } finally {
1972
- d(!1);
2278
+ i(!1);
1973
2279
  }
1974
- }, [r, s]);
1975
- return B(() => {
1976
- n();
1977
- }, [n]), { invoices: c, isLoading: i, error: u, refresh: n };
2280
+ }, [r, e]);
2281
+ return U(() => {
2282
+ l();
2283
+ }, [l]), { invoices: o, isLoading: u, error: c, refresh: l };
1978
2284
  }
1979
- function vs(s, a) {
1980
- const r = j(a), [c, t] = h([]), [i, d] = h(!0), [u, o] = h(null), n = C(async () => {
1981
- d(!0), o(null);
2285
+ function Te(e, a) {
2286
+ const r = Q(a), [o, t] = m([]), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
2287
+ i(!0), d(null);
1982
2288
  try {
1983
- const m = await r.getCurrentUsage(s);
1984
- t(m);
1985
- } catch (m) {
1986
- o(m instanceof Error ? m.message : "Failed to load usage");
2289
+ const g = await r.getCurrentUsage(e);
2290
+ t(g);
2291
+ } catch (g) {
2292
+ d(g instanceof Error ? g.message : "Failed to load usage");
1987
2293
  } finally {
1988
- d(!1);
2294
+ i(!1);
1989
2295
  }
1990
- }, [r, s]);
1991
- return B(() => {
1992
- n();
1993
- }, [n]), { usage: c, isLoading: i, error: u, refresh: n };
2296
+ }, [r, e]);
2297
+ return U(() => {
2298
+ l();
2299
+ }, [l]), { usage: o, isLoading: u, error: c, refresh: l };
1994
2300
  }
1995
- const ws = {
2301
+ const Le = {
1996
2302
  active: "ss-badge-active"
1997
2303
  };
1998
- function Ns({
1999
- customerId: s,
2304
+ function Be({
2305
+ customerId: e,
2000
2306
  portalToken: a,
2001
2307
  onChangePlan: r,
2002
- onCancel: c,
2308
+ onCancel: o,
2003
2309
  appearance: t
2004
2310
  }) {
2005
- const { appearance: i } = E(), { customer: d, isLoading: u, error: o } = ys(s, a);
2006
- return /* @__PURE__ */ e(D, { appearance: t ?? i, children: /* @__PURE__ */ l("div", { className: "ss-card", children: [
2007
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Subscription" }),
2008
- u && /* @__PURE__ */ l("div", { className: "ss-loading", children: [
2009
- /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2311
+ const { appearance: u } = L(), { customer: i, isLoading: c, error: d } = ze(e, a);
2312
+ return /* @__PURE__ */ s(q, { appearance: t ?? u, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
2313
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Subscription" }),
2314
+ c && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
2315
+ /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2010
2316
  " Loading..."
2011
2317
  ] }),
2012
- o && /* @__PURE__ */ e("div", { className: "ss-global-error", children: o }),
2013
- d && !u && /* @__PURE__ */ l(W, { children: [
2014
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
2015
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Customer" }),
2016
- /* @__PURE__ */ e("input", { className: "ss-input", value: d.name || d.email, disabled: !0, readOnly: !0 })
2318
+ d && /* @__PURE__ */ s("div", { className: "ss-global-error", children: d }),
2319
+ i && !c && /* @__PURE__ */ n(G, { children: [
2320
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2321
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Customer" }),
2322
+ /* @__PURE__ */ s("input", { className: "ss-input", value: i.name || i.email, disabled: !0, readOnly: !0 })
2017
2323
  ] }),
2018
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
2019
- /* @__PURE__ */ e("label", { className: "ss-label", children: "Status" }),
2020
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${ws.active}`, children: "Active" }) })
2324
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2325
+ /* @__PURE__ */ s("label", { className: "ss-label", children: "Status" }),
2326
+ /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("span", { className: `ss-badge ${Le.active}`, children: "Active" }) })
2021
2327
  ] }),
2022
- /* @__PURE__ */ l("div", { className: "ss-btn-group", children: [
2023
- r && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
2024
- c && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: c, children: "Cancel subscription" })
2328
+ /* @__PURE__ */ n("div", { className: "ss-btn-group", children: [
2329
+ r && /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
2330
+ o && /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: o, children: "Cancel subscription" })
2025
2331
  ] })
2026
2332
  ] })
2027
2333
  ] }) });
2028
2334
  }
2029
- const Cs = {
2335
+ const De = {
2030
2336
  paid: "ss-badge-active",
2031
2337
  open: "ss-badge-trialing",
2032
2338
  draft: "ss-badge-paused",
2033
2339
  void: "ss-badge-canceled",
2034
2340
  uncollectible: "ss-badge-past-due"
2035
2341
  };
2036
- function ks(s) {
2037
- return new Date(s).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
2342
+ function Ae(e) {
2343
+ return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
2038
2344
  }
2039
- function Ss(s) {
2040
- return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(s / 100);
2345
+ function Me(e) {
2346
+ return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(e / 100);
2041
2347
  }
2042
- function $s({ customerId: s, portalToken: a, appearance: r }) {
2043
- const { appearance: c } = E(), { invoices: t, isLoading: i, error: d } = xs(s, a), u = r ?? c, o = [...t].sort((n, m) => new Date(m.createdAt).getTime() - new Date(n.createdAt).getTime());
2044
- return /* @__PURE__ */ e(D, { appearance: u, children: /* @__PURE__ */ l("div", { className: "ss-card ss-card-wide", children: [
2045
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Invoices" }),
2046
- i && /* @__PURE__ */ l("div", { className: "ss-loading", children: [
2047
- /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2348
+ function Fe({ customerId: e, portalToken: a, appearance: r }) {
2349
+ const { appearance: o } = L(), { invoices: t, isLoading: u, error: i } = Ie(e, a), c = r ?? o, d = [...t].sort((l, g) => new Date(g.createdAt).getTime() - new Date(l.createdAt).getTime());
2350
+ return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
2351
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Invoices" }),
2352
+ u && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
2353
+ /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2048
2354
  " Loading..."
2049
2355
  ] }),
2050
- d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
2051
- !i && o.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
2052
- !i && o.length > 0 && /* @__PURE__ */ l("table", { className: "ss-table", children: [
2053
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { children: [
2054
- /* @__PURE__ */ e("th", { className: "ss-th", children: "Date" }),
2055
- /* @__PURE__ */ e("th", { className: "ss-th", children: "Amount" }),
2056
- /* @__PURE__ */ e("th", { className: "ss-th", children: "Status" }),
2057
- /* @__PURE__ */ e("th", { className: "ss-th", children: "PDF" })
2356
+ i && /* @__PURE__ */ s("div", { className: "ss-global-error", children: i }),
2357
+ !u && d.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No invoices yet." }),
2358
+ !u && d.length > 0 && /* @__PURE__ */ n("table", { className: "ss-table", children: [
2359
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ n("tr", { children: [
2360
+ /* @__PURE__ */ s("th", { className: "ss-th", children: "Date" }),
2361
+ /* @__PURE__ */ s("th", { className: "ss-th", children: "Amount" }),
2362
+ /* @__PURE__ */ s("th", { className: "ss-th", children: "Status" }),
2363
+ /* @__PURE__ */ s("th", { className: "ss-th", children: "PDF" })
2058
2364
  ] }) }),
2059
- /* @__PURE__ */ e("tbody", { children: o.map((n) => /* @__PURE__ */ l("tr", { className: "ss-tr", children: [
2060
- /* @__PURE__ */ e("td", { className: "ss-td", children: ks(n.createdAt) }),
2061
- /* @__PURE__ */ e("td", { className: "ss-td", children: Ss(n.amountCents) }),
2062
- /* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${Cs[n.status] || ""}`, children: n.status }) }),
2063
- /* @__PURE__ */ e("td", { className: "ss-td", children: n.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: n.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
2064
- ] }, n.id)) })
2365
+ /* @__PURE__ */ s("tbody", { children: d.map((l) => /* @__PURE__ */ n("tr", { className: "ss-tr", children: [
2366
+ /* @__PURE__ */ s("td", { className: "ss-td", children: Ae(l.createdAt) }),
2367
+ /* @__PURE__ */ s("td", { className: "ss-td", children: Me(l.amountCents) }),
2368
+ /* @__PURE__ */ s("td", { className: "ss-td", children: /* @__PURE__ */ s("span", { className: `ss-badge ${De[l.status] || ""}`, children: l.status }) }),
2369
+ /* @__PURE__ */ s("td", { className: "ss-td", children: l.pdfUrl ? /* @__PURE__ */ s("a", { className: "ss-link", href: l.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
2370
+ ] }, l.id)) })
2065
2371
  ] })
2066
2372
  ] }) });
2067
2373
  }
2068
- function Ps({ customerId: s, limits: a, portalToken: r, appearance: c }) {
2069
- const { appearance: t } = E(), { usage: i, isLoading: d, error: u } = vs(s, r);
2070
- return /* @__PURE__ */ e(D, { appearance: c ?? t, children: /* @__PURE__ */ l("div", { className: "ss-card", children: [
2071
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Usage" }),
2072
- d && /* @__PURE__ */ l("div", { className: "ss-loading", children: [
2073
- /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2374
+ function Ue({ customerId: e, limits: a, portalToken: r, appearance: o }) {
2375
+ const { appearance: t } = L(), { usage: u, isLoading: i, error: c } = Te(e, r);
2376
+ return /* @__PURE__ */ s(q, { appearance: o ?? t, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
2377
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Usage" }),
2378
+ i && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
2379
+ /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2074
2380
  " Loading..."
2075
2381
  ] }),
2076
- u && /* @__PURE__ */ e("div", { className: "ss-global-error", children: u }),
2077
- !d && i.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
2078
- !d && i.map((n) => {
2079
- const m = a == null ? void 0 : a[n.metric], p = m ? Math.min(100, n.total / m * 100) : null;
2080
- return /* @__PURE__ */ l("div", { className: "ss-usage-item", children: [
2081
- /* @__PURE__ */ l("div", { className: "ss-usage-header", children: [
2082
- /* @__PURE__ */ e("span", { className: "ss-usage-metric", children: n.metric }),
2083
- /* @__PURE__ */ l("span", { className: "ss-usage-value", children: [
2084
- n.total.toLocaleString(),
2085
- m ? ` / ${m.toLocaleString()}` : ""
2382
+ c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
2383
+ !i && u.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No usage data." }),
2384
+ !i && u.map((l) => {
2385
+ const g = a == null ? void 0 : a[l.metric], p = g ? Math.min(100, l.total / g * 100) : null;
2386
+ return /* @__PURE__ */ n("div", { className: "ss-usage-item", children: [
2387
+ /* @__PURE__ */ n("div", { className: "ss-usage-header", children: [
2388
+ /* @__PURE__ */ s("span", { className: "ss-usage-metric", children: l.metric }),
2389
+ /* @__PURE__ */ n("span", { className: "ss-usage-value", children: [
2390
+ l.total.toLocaleString(),
2391
+ g ? ` / ${g.toLocaleString()}` : ""
2086
2392
  ] })
2087
2393
  ] }),
2088
- p !== null && /* @__PURE__ */ e("div", { className: "ss-progress-bar", children: /* @__PURE__ */ e(
2394
+ p !== null && /* @__PURE__ */ s("div", { className: "ss-progress-bar", children: /* @__PURE__ */ s(
2089
2395
  "div",
2090
2396
  {
2091
2397
  className: `ss-progress-fill ${p > 90 ? "ss-progress-danger" : ""}`,
2092
2398
  style: { width: `${p}%` }
2093
2399
  }
2094
2400
  ) })
2095
- ] }, n.metric);
2401
+ ] }, l.metric);
2096
2402
  })
2097
2403
  ] }) });
2098
2404
  }
2099
- function Qs({
2100
- customerId: s,
2405
+ function os({
2406
+ customerId: e,
2101
2407
  portalToken: a,
2102
2408
  limits: r,
2103
- onChangePlan: c,
2409
+ onChangePlan: o,
2104
2410
  onCancel: t,
2105
- appearance: i
2411
+ appearance: u
2106
2412
  }) {
2107
- const { appearance: d } = E(), u = i ?? d, [o, n] = h("subscription");
2108
- return /* @__PURE__ */ e(D, { appearance: u, children: /* @__PURE__ */ l("div", { className: "ss-card ss-card-wide", children: [
2109
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Billing" }),
2110
- /* @__PURE__ */ e("div", { className: "ss-tab-group", children: [
2413
+ const { appearance: i } = L(), c = u ?? i, [d, l] = m("subscription");
2414
+ return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
2415
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Billing" }),
2416
+ /* @__PURE__ */ s("div", { className: "ss-tab-group", children: [
2111
2417
  { id: "subscription", label: "Subscription" },
2112
2418
  { id: "invoices", label: "Invoices" },
2113
2419
  { id: "usage", label: "Usage" }
2114
- ].map((p) => /* @__PURE__ */ e(
2420
+ ].map((p) => /* @__PURE__ */ s(
2115
2421
  "button",
2116
2422
  {
2117
2423
  type: "button",
2118
- className: `ss-tab ${o === p.id ? "ss-tab-active" : ""}`,
2119
- onClick: () => n(p.id),
2424
+ className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
2425
+ onClick: () => l(p.id),
2120
2426
  children: p.label
2121
2427
  },
2122
2428
  p.id
2123
2429
  )) }),
2124
- /* @__PURE__ */ l("div", { className: "ss-tab-content", children: [
2125
- o === "subscription" && /* @__PURE__ */ e(
2126
- Ns,
2430
+ /* @__PURE__ */ n("div", { className: "ss-tab-content", children: [
2431
+ d === "subscription" && /* @__PURE__ */ s(
2432
+ Be,
2127
2433
  {
2128
- customerId: s,
2434
+ customerId: e,
2129
2435
  portalToken: a,
2130
- onChangePlan: c,
2436
+ onChangePlan: o,
2131
2437
  onCancel: t
2132
2438
  }
2133
2439
  ),
2134
- o === "invoices" && /* @__PURE__ */ e($s, { customerId: s, portalToken: a }),
2135
- o === "usage" && /* @__PURE__ */ e(Ps, { customerId: s, portalToken: a, limits: r })
2440
+ d === "invoices" && /* @__PURE__ */ s(Fe, { customerId: e, portalToken: a }),
2441
+ d === "usage" && /* @__PURE__ */ s(Ue, { customerId: e, portalToken: a, limits: r })
2136
2442
  ] })
2137
2443
  ] }) });
2138
2444
  }
2139
- function Ys({ customerId: s, portalToken: a, onApplied: r, appearance: c }) {
2140
- const { appearance: t } = E(), i = j(a), d = c ?? t, [u, o] = h(""), [n, m] = h(!1), [p, b] = h(null), [f, x] = h(null), y = C(async (w) => {
2141
- if (w.preventDefault(), !!u.trim()) {
2142
- m(!0), b(null), x(null);
2445
+ function ls({ customerId: e, portalToken: a, onApplied: r, appearance: o }) {
2446
+ const { appearance: t } = L(), u = Q(a), i = o ?? t, [c, d] = m(""), [l, g] = m(!1), [p, f] = m(null), [b, k] = m(null), v = N(async (C) => {
2447
+ if (C.preventDefault(), !!c.trim()) {
2448
+ g(!0), f(null), k(null);
2143
2449
  try {
2144
- const v = await i.applyCoupon(s, u.trim());
2145
- x(`Coupon applied! ${v.discountType === "percent" ? `${v.amount}% off` : `$${(v.amount / 100).toFixed(2)} off`}`), o(""), r == null || r(v);
2146
- } catch (v) {
2147
- b(v instanceof Error ? v.message : "Invalid coupon code");
2450
+ const x = await u.applyCoupon(e, c.trim());
2451
+ k(`Coupon applied! ${x.discountType === "percent" ? `${x.amount}% off` : `$${(x.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(x);
2452
+ } catch (x) {
2453
+ f(x instanceof Error ? x.message : "Invalid coupon code");
2148
2454
  } finally {
2149
- m(!1);
2455
+ g(!1);
2150
2456
  }
2151
2457
  }
2152
- }, [i, s, u, r]);
2153
- return /* @__PURE__ */ e(D, { appearance: d, children: /* @__PURE__ */ l("div", { className: "ss-card", children: [
2154
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
2155
- p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
2156
- f && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: f }),
2157
- /* @__PURE__ */ l("form", { onSubmit: y, children: [
2158
- /* @__PURE__ */ l("div", { className: "ss-field", children: [
2159
- /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
2160
- /* @__PURE__ */ e(
2458
+ }, [u, e, c, r]);
2459
+ return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
2460
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Apply coupon" }),
2461
+ p && /* @__PURE__ */ s("div", { className: "ss-global-error", children: p }),
2462
+ b && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: b }),
2463
+ /* @__PURE__ */ n("form", { onSubmit: v, children: [
2464
+ /* @__PURE__ */ n("div", { className: "ss-field", children: [
2465
+ /* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
2466
+ /* @__PURE__ */ s(
2161
2467
  "input",
2162
2468
  {
2163
2469
  id: "ss-coupon-code",
2164
2470
  className: "ss-input",
2165
2471
  type: "text",
2166
2472
  placeholder: "Enter coupon code",
2167
- value: u,
2168
- onChange: (w) => o(w.target.value),
2473
+ value: c,
2474
+ onChange: (C) => d(C.target.value),
2169
2475
  required: !0
2170
2476
  }
2171
2477
  )
2172
2478
  ] }),
2173
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: n || !u.trim(), children: [
2174
- n && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2479
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: l || !c.trim(), children: [
2480
+ l && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2175
2481
  "Apply"
2176
2482
  ] })
2177
2483
  ] })
2178
2484
  ] }) });
2179
2485
  }
2180
- function Zs() {
2181
- const { client: s } = E();
2182
- return { report: s.report };
2486
+ function is() {
2487
+ const { client: e } = L();
2488
+ return { report: e.report };
2183
2489
  }
2184
- function rs() {
2185
- const { client: s } = E(), [a, r] = h(null), [c, t] = h(!1), [i, d] = h(null), u = C(async (o) => {
2186
- t(!0), d(null);
2490
+ function ie() {
2491
+ const { client: e } = L(), [a, r] = m(null), [o, t] = m(!1), [u, i] = m(null), c = N(async (d) => {
2492
+ t(!0), i(null);
2187
2493
  try {
2188
- const n = await s.report.executeQuery(o);
2189
- return r(n), n;
2190
- } catch (n) {
2191
- return d(n instanceof Error ? n.message : "Query failed"), null;
2494
+ const l = await e.report.executeQuery(d);
2495
+ return r(l), l;
2496
+ } catch (l) {
2497
+ return i(l instanceof Error ? l.message : "Query failed"), null;
2192
2498
  } finally {
2193
2499
  t(!1);
2194
2500
  }
2195
- }, [s]);
2196
- return { result: a, execute: u, isLoading: c, error: i };
2501
+ }, [e]);
2502
+ return { result: a, execute: c, isLoading: o, error: u };
2197
2503
  }
2198
- function Es(s) {
2199
- const { client: a } = E(), [r, c] = h(null), [t, i] = h(!0), [d, u] = h(null), o = C(async () => {
2200
- i(!0), u(null);
2504
+ function qe(e) {
2505
+ const { client: a } = L(), [r, o] = m(null), [t, u] = m(!0), [i, c] = m(null), d = N(async () => {
2506
+ u(!0), c(null);
2201
2507
  try {
2202
- const n = await a.report.listQueries(s);
2203
- c(n);
2204
- } catch (n) {
2205
- u(n instanceof Error ? n.message : "Failed to load queries");
2508
+ const l = await a.report.listQueries(e);
2509
+ o(l);
2510
+ } catch (l) {
2511
+ c(l instanceof Error ? l.message : "Failed to load queries");
2206
2512
  } finally {
2207
- i(!1);
2513
+ u(!1);
2208
2514
  }
2209
- }, [a, s]);
2210
- return B(() => {
2211
- o();
2212
- }, [o]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: t, error: d, refresh: o };
2515
+ }, [a, e]);
2516
+ return U(() => {
2517
+ d();
2518
+ }, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: t, error: i, refresh: d };
2213
2519
  }
2214
- function Xs(s) {
2215
- const { client: a } = E(), [r, c] = h(null), [t, i] = h(!0), [d, u] = h(null), o = C(async () => {
2216
- i(!0), u(null);
2520
+ function cs(e) {
2521
+ const { client: a } = L(), [r, o] = m(null), [t, u] = m(!0), [i, c] = m(null), d = N(async () => {
2522
+ u(!0), c(null);
2217
2523
  try {
2218
- const n = await a.report.getDashboard(s);
2219
- c(n);
2220
- } catch (n) {
2221
- u(n instanceof Error ? n.message : "Failed to load dashboard");
2524
+ const l = await a.report.getDashboard(e);
2525
+ o(l);
2526
+ } catch (l) {
2527
+ c(l instanceof Error ? l.message : "Failed to load dashboard");
2222
2528
  } finally {
2223
- i(!1);
2529
+ u(!1);
2224
2530
  }
2225
- }, [a, s]);
2226
- return B(() => {
2227
- o();
2228
- }, [o]), { dashboard: r, isLoading: t, error: d, refresh: o };
2531
+ }, [a, e]);
2532
+ return U(() => {
2533
+ d();
2534
+ }, [d]), { dashboard: r, isLoading: t, error: i, refresh: d };
2229
2535
  }
2230
- function Ks(s, a, r = "https://api.saas-support.com/v1") {
2231
- const c = q(() => {
2232
- const p = new H(r, { type: "embedToken", token: s });
2233
- return new J(p);
2234
- }, [s, r]), [t, i] = h(null), [d, u] = h(!0), [o, n] = h(null), m = C(async () => {
2235
- u(!0), n(null);
2536
+ function ds(e, a, r = "https://api.saas-support.com/v1") {
2537
+ const o = _(() => {
2538
+ const p = new J(r, { type: "embedToken", token: e });
2539
+ return new K(p);
2540
+ }, [e, r]), [t, u] = m(null), [i, c] = m(!0), [d, l] = m(null), g = N(async () => {
2541
+ c(!0), l(null);
2236
2542
  try {
2237
- const p = await c.getDashboard(a);
2238
- i(p);
2543
+ const p = await o.getDashboard(a);
2544
+ u(p);
2239
2545
  } catch (p) {
2240
- n(p instanceof Error ? p.message : "Failed to load dashboard");
2546
+ l(p instanceof Error ? p.message : "Failed to load dashboard");
2241
2547
  } finally {
2242
- u(!1);
2548
+ c(!1);
2243
2549
  }
2244
- }, [c, a]);
2245
- return B(() => {
2246
- m();
2247
- }, [m]), { dashboard: t, reportClient: c, isLoading: d, error: o, refresh: m };
2550
+ }, [o, a]);
2551
+ return U(() => {
2552
+ g();
2553
+ }, [g]), { dashboard: t, reportClient: o, isLoading: i, error: d, refresh: g };
2248
2554
  }
2249
- function se({ onResult: s, mode: a = "both", placeholder: r, appearance: c }) {
2250
- const { appearance: t } = E(), { execute: i, isLoading: d, error: u } = rs(), o = c ?? t, [n, m] = h(""), [p, b] = h(a === "sql" ? "sql" : "nl"), f = C(async (x) => {
2251
- if (x.preventDefault(), !n.trim()) return;
2252
- const w = await i(p === "sql" ? { sql: n } : { naturalLanguage: n });
2253
- w && (s == null || s(w));
2254
- }, [n, p, i, s]);
2255
- return /* @__PURE__ */ e(D, { appearance: o, children: /* @__PURE__ */ l("div", { className: "ss-card ss-card-wide", children: [
2256
- a === "both" && /* @__PURE__ */ l("div", { className: "ss-tab-group ss-tab-group-sm", children: [
2257
- /* @__PURE__ */ e(
2555
+ function us({ onResult: e, mode: a = "both", placeholder: r, appearance: o }) {
2556
+ const { appearance: t } = L(), { execute: u, isLoading: i, error: c } = ie(), d = o ?? t, [l, g] = m(""), [p, f] = m(a === "sql" ? "sql" : "nl"), b = N(async (k) => {
2557
+ if (k.preventDefault(), !l.trim()) return;
2558
+ const C = await u(p === "sql" ? { sql: l } : { naturalLanguage: l });
2559
+ C && (e == null || e(C));
2560
+ }, [l, p, u, e]);
2561
+ return /* @__PURE__ */ s(q, { appearance: d, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
2562
+ a === "both" && /* @__PURE__ */ n("div", { className: "ss-tab-group ss-tab-group-sm", children: [
2563
+ /* @__PURE__ */ s(
2258
2564
  "button",
2259
2565
  {
2260
2566
  type: "button",
2261
2567
  className: `ss-tab ${p === "nl" ? "ss-tab-active" : ""}`,
2262
- onClick: () => b("nl"),
2568
+ onClick: () => f("nl"),
2263
2569
  children: "Natural Language"
2264
2570
  }
2265
2571
  ),
2266
- /* @__PURE__ */ e(
2572
+ /* @__PURE__ */ s(
2267
2573
  "button",
2268
2574
  {
2269
2575
  type: "button",
2270
2576
  className: `ss-tab ${p === "sql" ? "ss-tab-active" : ""}`,
2271
- onClick: () => b("sql"),
2577
+ onClick: () => f("sql"),
2272
2578
  children: "SQL"
2273
2579
  }
2274
2580
  )
2275
2581
  ] }),
2276
- u && /* @__PURE__ */ e("div", { className: "ss-global-error", children: u }),
2277
- /* @__PURE__ */ l("form", { onSubmit: f, children: [
2278
- /* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
2582
+ c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
2583
+ /* @__PURE__ */ n("form", { onSubmit: b, children: [
2584
+ /* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
2279
2585
  "textarea",
2280
2586
  {
2281
2587
  className: "ss-input ss-query-textarea",
2282
2588
  placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
2283
- value: n,
2284
- onChange: (x) => m(x.target.value),
2589
+ value: l,
2590
+ onChange: (k) => g(k.target.value),
2285
2591
  rows: 3
2286
2592
  }
2287
2593
  ) }),
2288
- /* @__PURE__ */ l("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: d || !n.trim(), children: [
2289
- d && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2594
+ /* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !l.trim(), children: [
2595
+ i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2290
2596
  "Run query"
2291
2597
  ] })
2292
2598
  ] })
2293
2599
  ] }) });
2294
2600
  }
2295
- function Is({ columns: s, rows: a, sortable: r = !0, maxRows: c, appearance: t }) {
2296
- const { appearance: i } = E(), d = t ?? i, [u, o] = h(null), [n, m] = h("asc"), p = q(() => u ? [...a].sort((y, w) => {
2297
- const v = y[u], g = w[u];
2298
- if (v == null && g == null) return 0;
2299
- if (v == null) return 1;
2300
- if (g == null) return -1;
2301
- if (typeof v == "number" && typeof g == "number")
2302
- return n === "asc" ? v - g : g - v;
2303
- const N = String(v), S = String(g);
2304
- return n === "asc" ? N.localeCompare(S) : S.localeCompare(N);
2305
- }) : a, [a, u, n]), b = c ? p.slice(0, c) : p, f = (y) => {
2306
- r && (u === y ? m((w) => w === "asc" ? "desc" : "asc") : (o(y), m("asc")));
2601
+ function Re({ columns: e, rows: a, sortable: r = !0, maxRows: o, appearance: t }) {
2602
+ const { appearance: u } = L(), i = t ?? u, [c, d] = m(null), [l, g] = m("asc"), p = _(() => c ? [...a].sort((v, C) => {
2603
+ const x = v[c], h = C[c];
2604
+ if (x == null && h == null) return 0;
2605
+ if (x == null) return 1;
2606
+ if (h == null) return -1;
2607
+ if (typeof x == "number" && typeof h == "number")
2608
+ return l === "asc" ? x - h : h - x;
2609
+ const S = String(x), z = String(h);
2610
+ return l === "asc" ? S.localeCompare(z) : z.localeCompare(S);
2611
+ }) : a, [a, c, l]), f = o ? p.slice(0, o) : p, b = (v) => {
2612
+ r && (c === v ? g((C) => C === "asc" ? "desc" : "asc") : (d(v), g("asc")));
2307
2613
  };
2308
- function x(y) {
2309
- return y == null ? "" : typeof y == "object" ? JSON.stringify(y) : String(y);
2614
+ function k(v) {
2615
+ return v == null ? "" : typeof v == "object" ? JSON.stringify(v) : String(v);
2310
2616
  }
2311
- return /* @__PURE__ */ e(D, { appearance: d, children: /* @__PURE__ */ l("div", { className: "ss-table-container", children: [
2312
- /* @__PURE__ */ l("table", { className: "ss-table", children: [
2313
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: s.map((y) => /* @__PURE__ */ l(
2617
+ return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-table-container", children: [
2618
+ /* @__PURE__ */ n("table", { className: "ss-table", children: [
2619
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: e.map((v) => /* @__PURE__ */ n(
2314
2620
  "th",
2315
2621
  {
2316
- className: `ss-th ${r ? "ss-th-sortable" : ""} ${u === y ? n === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
2317
- onClick: () => f(y),
2622
+ className: `ss-th ${r ? "ss-th-sortable" : ""} ${c === v ? l === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
2623
+ onClick: () => b(v),
2318
2624
  children: [
2319
- y,
2320
- u === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: n === "asc" ? " ▲" : " ▼" })
2625
+ v,
2626
+ c === v && /* @__PURE__ */ s("span", { className: "ss-sort-indicator", children: l === "asc" ? " ▲" : " ▼" })
2321
2627
  ]
2322
2628
  },
2323
- y
2629
+ v
2324
2630
  )) }) }),
2325
- /* @__PURE__ */ e("tbody", { children: b.map((y, w) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: s.map((v) => /* @__PURE__ */ e("td", { className: "ss-td", children: x(y[v]) }, v)) }, w)) })
2631
+ /* @__PURE__ */ s("tbody", { children: f.map((v, C) => /* @__PURE__ */ s("tr", { className: "ss-tr", children: e.map((x) => /* @__PURE__ */ s("td", { className: "ss-td", children: k(v[x]) }, x)) }, C)) })
2326
2632
  ] }),
2327
- c && a.length > c && /* @__PURE__ */ l("div", { className: "ss-table-footer", children: [
2633
+ o && a.length > o && /* @__PURE__ */ n("div", { className: "ss-table-footer", children: [
2328
2634
  "Showing ",
2329
- c,
2635
+ o,
2330
2636
  " of ",
2331
2637
  a.length,
2332
2638
  " rows"
2333
2639
  ] })
2334
2640
  ] }) });
2335
2641
  }
2336
- function zs(s, a = "#6366f1") {
2337
- const r = parseInt(a.replace("#", "").slice(0, 2), 16), c = [];
2338
- for (let t = 0; t < s; t++) {
2339
- const i = (r + t * Math.floor(360 / Math.max(s, 1))) % 360;
2340
- c.push(`hsl(${i}, 65%, 55%)`);
2642
+ function Oe(e, a = "#6366f1") {
2643
+ const r = parseInt(a.replace("#", "").slice(0, 2), 16), o = [];
2644
+ for (let t = 0; t < e; t++) {
2645
+ const u = (r + t * Math.floor(360 / Math.max(e, 1))) % 360;
2646
+ o.push(`hsl(${u}, 65%, 55%)`);
2341
2647
  }
2342
- return c;
2648
+ return o;
2343
2649
  }
2344
- function Ts({ labels: s, values: a, w: r, h: c, colors: t }) {
2345
- const i = Math.max(...a, 1), d = 40, u = r - d * 2, o = c - d * 2, n = Math.max(1, u / s.length - 4);
2346
- return /* @__PURE__ */ l("g", { children: [
2347
- /* @__PURE__ */ e("line", { x1: d, y1: c - d, x2: r - d, y2: c - d, stroke: "#ccc", strokeWidth: 1 }),
2348
- a.map((m, p) => {
2349
- const b = m / i * o, f = d + u / s.length * p + 2, x = c - d - b;
2350
- return /* @__PURE__ */ l("g", { children: [
2351
- /* @__PURE__ */ e("rect", { x: f, y: x, width: n, height: b, fill: t[p % t.length], rx: 2 }),
2352
- /* @__PURE__ */ e("text", { x: f + n / 2, y: c - d + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: s[p].length > 8 ? s[p].slice(0, 8) + "..." : s[p] })
2650
+ function We({ labels: e, values: a, w: r, h: o, colors: t }) {
2651
+ const u = Math.max(...a, 1), i = 40, c = r - i * 2, d = o - i * 2, l = Math.max(1, c / e.length - 4);
2652
+ return /* @__PURE__ */ n("g", { children: [
2653
+ /* @__PURE__ */ s("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
2654
+ a.map((g, p) => {
2655
+ const f = g / u * d, b = i + c / e.length * p + 2, k = o - i - f;
2656
+ return /* @__PURE__ */ n("g", { children: [
2657
+ /* @__PURE__ */ s("rect", { x: b, y: k, width: l, height: f, fill: t[p % t.length], rx: 2 }),
2658
+ /* @__PURE__ */ s("text", { x: b + l / 2, y: o - i + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: e[p].length > 8 ? e[p].slice(0, 8) + "..." : e[p] })
2353
2659
  ] }, p);
2354
2660
  })
2355
2661
  ] });
2356
2662
  }
2357
- function Ls({ labels: s, values: a, w: r, h: c, colors: t }) {
2358
- const i = Math.max(...a, 1), d = 40, u = r - d * 2, o = c - d * 2, n = s.length > 1 ? u / (s.length - 1) : 0, m = a.map((p, b) => {
2359
- const f = d + n * b, x = c - d - p / i * o;
2360
- return `${f},${x}`;
2663
+ function He({ labels: e, values: a, w: r, h: o, colors: t }) {
2664
+ const u = Math.max(...a, 1), i = 40, c = r - i * 2, d = o - i * 2, l = e.length > 1 ? c / (e.length - 1) : 0, g = a.map((p, f) => {
2665
+ const b = i + l * f, k = o - i - p / u * d;
2666
+ return `${b},${k}`;
2361
2667
  });
2362
- return /* @__PURE__ */ l("g", { children: [
2668
+ return /* @__PURE__ */ n("g", { children: [
2363
2669
  [0.25, 0.5, 0.75, 1].map((p) => {
2364
- const b = c - d - p * o;
2365
- return /* @__PURE__ */ e("line", { x1: d, y1: b, x2: r - d, y2: b, stroke: "#eee", strokeWidth: 1 }, p);
2670
+ const f = o - i - p * d;
2671
+ return /* @__PURE__ */ s("line", { x1: i, y1: f, x2: r - i, y2: f, stroke: "#eee", strokeWidth: 1 }, p);
2366
2672
  }),
2367
- /* @__PURE__ */ e("polyline", { points: m.join(" "), fill: "none", stroke: t[0], strokeWidth: 2 }),
2368
- a.map((p, b) => {
2369
- const f = d + n * b, x = c - d - p / i * o;
2370
- return /* @__PURE__ */ e("circle", { cx: f, cy: x, r: 4, fill: t[0] }, b);
2673
+ /* @__PURE__ */ s("polyline", { points: g.join(" "), fill: "none", stroke: t[0], strokeWidth: 2 }),
2674
+ a.map((p, f) => {
2675
+ const b = i + l * f, k = o - i - p / u * d;
2676
+ return /* @__PURE__ */ s("circle", { cx: b, cy: k, r: 4, fill: t[0] }, f);
2371
2677
  })
2372
2678
  ] });
2373
2679
  }
2374
- function Bs({ labels: s, values: a, w: r, h: c, colors: t }) {
2375
- const i = a.reduce((b, f) => b + f, 0) || 1, d = r / 2, u = c / 2 - 20, o = Math.min(r, c) / 2 - 40, n = 2 * Math.PI * o;
2376
- let m = 0;
2377
- const p = a.map((b, f) => {
2378
- const x = b / i, y = x * n, w = { dash: y, offset: m, color: t[f % t.length], label: s[f], pct: x };
2379
- return m += y, w;
2680
+ function _e({ labels: e, values: a, w: r, h: o, colors: t }) {
2681
+ const u = a.reduce((f, b) => f + b, 0) || 1, i = r / 2, c = o / 2 - 20, d = Math.min(r, o) / 2 - 40, l = 2 * Math.PI * d;
2682
+ let g = 0;
2683
+ const p = a.map((f, b) => {
2684
+ const k = f / u, v = k * l, C = { dash: v, offset: g, color: t[b % t.length], label: e[b], pct: k };
2685
+ return g += v, C;
2380
2686
  });
2381
- return /* @__PURE__ */ l("g", { children: [
2382
- p.map((b, f) => /* @__PURE__ */ e(
2687
+ return /* @__PURE__ */ n("g", { children: [
2688
+ p.map((f, b) => /* @__PURE__ */ s(
2383
2689
  "circle",
2384
2690
  {
2385
- cx: d,
2386
- cy: u,
2387
- r: o,
2691
+ cx: i,
2692
+ cy: c,
2693
+ r: d,
2388
2694
  fill: "none",
2389
- stroke: b.color,
2390
- strokeWidth: o * 0.6,
2391
- strokeDasharray: `${b.dash} ${n - b.dash}`,
2392
- strokeDashoffset: -b.offset,
2393
- transform: `rotate(-90 ${d} ${u})`
2695
+ stroke: f.color,
2696
+ strokeWidth: d * 0.6,
2697
+ strokeDasharray: `${f.dash} ${l - f.dash}`,
2698
+ strokeDashoffset: -f.offset,
2699
+ transform: `rotate(-90 ${i} ${c})`
2394
2700
  },
2395
- f
2701
+ b
2396
2702
  )),
2397
- /* @__PURE__ */ e("g", { transform: `translate(${d - s.length * 30}, ${c - 20})`, children: p.slice(0, 6).map((b, f) => /* @__PURE__ */ l("g", { transform: `translate(${f * 60}, 0)`, children: [
2398
- /* @__PURE__ */ e("rect", { width: 10, height: 10, fill: b.color, rx: 2 }),
2399
- /* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: b.label.length > 6 ? b.label.slice(0, 6) + ".." : b.label })
2400
- ] }, f)) })
2703
+ /* @__PURE__ */ s("g", { transform: `translate(${i - e.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((f, b) => /* @__PURE__ */ n("g", { transform: `translate(${b * 60}, 0)`, children: [
2704
+ /* @__PURE__ */ s("rect", { width: 10, height: 10, fill: f.color, rx: 2 }),
2705
+ /* @__PURE__ */ s("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: f.label.length > 6 ? f.label.slice(0, 6) + ".." : f.label })
2706
+ ] }, b)) })
2401
2707
  ] });
2402
2708
  }
2403
- function As({ type: s, data: a, title: r, width: c = 400, height: t = 300, appearance: i }) {
2404
- const { appearance: d } = E(), u = i ?? d, o = q(() => zs(a.labels.length), [a.labels.length]);
2405
- return /* @__PURE__ */ e(D, { appearance: u, children: /* @__PURE__ */ l("div", { className: "ss-chart-container", children: [
2406
- r && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: r }),
2407
- /* @__PURE__ */ l("svg", { viewBox: `0 0 ${c} ${t}`, width: "100%", style: { maxWidth: c }, children: [
2408
- s === "bar" && /* @__PURE__ */ e(Ts, { labels: a.labels, values: a.values, w: c, h: t, colors: o }),
2409
- s === "line" && /* @__PURE__ */ e(Ls, { labels: a.labels, values: a.values, w: c, h: t, colors: o }),
2410
- s === "pie" && /* @__PURE__ */ e(Bs, { labels: a.labels, values: a.values, w: c, h: t, colors: o })
2709
+ function je({ type: e, data: a, title: r, width: o = 400, height: t = 300, appearance: u }) {
2710
+ const { appearance: i } = L(), c = u ?? i, d = _(() => Oe(a.labels.length), [a.labels.length]);
2711
+ return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-chart-container", children: [
2712
+ r && /* @__PURE__ */ s("h3", { className: "ss-chart-title", children: r }),
2713
+ /* @__PURE__ */ n("svg", { viewBox: `0 0 ${o} ${t}`, width: "100%", style: { maxWidth: o }, children: [
2714
+ e === "bar" && /* @__PURE__ */ s(We, { labels: a.labels, values: a.values, w: o, h: t, colors: d }),
2715
+ e === "line" && /* @__PURE__ */ s(He, { labels: a.labels, values: a.values, w: o, h: t, colors: d }),
2716
+ e === "pie" && /* @__PURE__ */ s(_e, { labels: a.labels, values: a.values, w: o, h: t, colors: d })
2411
2717
  ] })
2412
2718
  ] }) });
2413
2719
  }
2414
- function ee({ dashboardId: s, embedToken: a, baseUrl: r, refreshInterval: c, appearance: t }) {
2415
- const i = E(), d = t ?? (i == null ? void 0 : i.appearance), u = q(() => {
2720
+ function ps({ dashboardId: e, embedToken: a, baseUrl: r, refreshInterval: o, appearance: t }) {
2721
+ const u = L(), i = t ?? (u == null ? void 0 : u.appearance), c = _(() => {
2416
2722
  if (a) {
2417
- const v = r ?? "https://api.saas-support.com/v1", g = new H(v, { type: "embedToken", token: a });
2418
- return new J(g);
2723
+ const x = r ?? "https://api.saas-support.com/v1", h = new J(x, { type: "embedToken", token: a });
2724
+ return new K(h);
2419
2725
  }
2420
- return i.client.report;
2421
- }, [a, r, i]), [o, n] = h([]), [m, p] = h({}), [b, f] = h(!0), [x, y] = h(null), w = C(async () => {
2422
- f(!0), y(null);
2726
+ return u.client.report;
2727
+ }, [a, r, u]), [d, l] = m([]), [g, p] = m({}), [f, b] = m(!0), [k, v] = m(null), C = N(async () => {
2728
+ b(!0), v(null);
2423
2729
  try {
2424
- const v = await u.getDashboard(s), g = JSON.parse(v.layoutJson || "[]");
2425
- n(g);
2426
- const N = {};
2427
- for (const S of g)
2730
+ const x = await c.getDashboard(e), h = JSON.parse(x.layoutJson || "[]");
2731
+ l(h);
2732
+ const S = {};
2733
+ for (const z of h)
2428
2734
  try {
2429
- const k = await u.listQueries({ search: S.queryId, perPage: 1 });
2430
- if (k.data.length > 0 && k.data[0].generatedSql) {
2431
- const z = await u.executeQuery({ sql: k.data[0].generatedSql });
2432
- N[S.queryId] = z;
2735
+ const P = await c.listQueries({ search: z.queryId, perPage: 1 });
2736
+ if (P.data.length > 0 && P.data[0].generatedSql) {
2737
+ const I = await c.executeQuery({ sql: P.data[0].generatedSql });
2738
+ S[z.queryId] = I;
2433
2739
  }
2434
2740
  } catch {
2435
2741
  }
2436
- p(N);
2437
- } catch (v) {
2438
- y(v instanceof Error ? v.message : "Failed to load dashboard");
2742
+ p(S);
2743
+ } catch (x) {
2744
+ v(x instanceof Error ? x.message : "Failed to load dashboard");
2439
2745
  } finally {
2440
- f(!1);
2441
- }
2442
- }, [u, s]);
2443
- return B(() => {
2444
- w();
2445
- }, [w]), B(() => {
2446
- if (!c || c <= 0) return;
2447
- const v = setInterval(w, c * 1e3);
2448
- return () => clearInterval(v);
2449
- }, [c, w]), /* @__PURE__ */ e(D, { appearance: d, children: /* @__PURE__ */ l("div", { className: "ss-dashboard-grid", children: [
2450
- b && /* @__PURE__ */ l("div", { className: "ss-loading", children: [
2451
- /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2746
+ b(!1);
2747
+ }
2748
+ }, [c, e]);
2749
+ return U(() => {
2750
+ C();
2751
+ }, [C]), U(() => {
2752
+ if (!o || o <= 0) return;
2753
+ const x = setInterval(C, o * 1e3);
2754
+ return () => clearInterval(x);
2755
+ }, [o, C]), /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-dashboard-grid", children: [
2756
+ f && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
2757
+ /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2452
2758
  " Loading dashboard..."
2453
2759
  ] }),
2454
- x && /* @__PURE__ */ e("div", { className: "ss-global-error", children: x }),
2455
- !b && o.map((v, g) => {
2456
- const N = m[v.queryId];
2457
- if (!N) return null;
2458
- const S = N.columns.length >= 2 ? {
2459
- labels: N.rows.map((k) => String(k[N.columns[0]] ?? "")),
2460
- values: N.rows.map((k) => Number(k[N.columns[1]] ?? 0))
2760
+ k && /* @__PURE__ */ s("div", { className: "ss-global-error", children: k }),
2761
+ !f && d.map((x, h) => {
2762
+ const S = g[x.queryId];
2763
+ if (!S) return null;
2764
+ const z = S.columns.length >= 2 ? {
2765
+ labels: S.rows.map((P) => String(P[S.columns[0]] ?? "")),
2766
+ values: S.rows.map((P) => Number(P[S.columns[1]] ?? 0))
2461
2767
  } : { labels: [], values: [] };
2462
- return /* @__PURE__ */ l("div", { className: "ss-widget", children: [
2463
- v.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: v.title }),
2464
- v.chartType === "table" ? /* @__PURE__ */ e(Is, { columns: N.columns, rows: N.rows, maxRows: 50 }) : /* @__PURE__ */ e(
2465
- As,
2768
+ return /* @__PURE__ */ n("div", { className: "ss-widget", children: [
2769
+ x.title && /* @__PURE__ */ s("h4", { className: "ss-widget-header", children: x.title }),
2770
+ x.chartType === "table" ? /* @__PURE__ */ s(Re, { columns: S.columns, rows: S.rows, maxRows: 50 }) : /* @__PURE__ */ s(
2771
+ je,
2466
2772
  {
2467
- type: v.chartType || "bar",
2468
- data: S,
2469
- width: v.w,
2470
- height: v.h
2773
+ type: x.chartType || "bar",
2774
+ data: z,
2775
+ width: x.w,
2776
+ height: x.h
2471
2777
  }
2472
2778
  )
2473
- ] }, g);
2779
+ ] }, h);
2474
2780
  })
2475
2781
  ] }) });
2476
2782
  }
2477
- function Ds(s) {
2478
- return new Date(s).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
2783
+ function Ve(e) {
2784
+ return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
2479
2785
  }
2480
- function re({ onSelectQuery: s, onRunQuery: a, appearance: r }) {
2481
- const { appearance: c } = E(), { queries: t, isLoading: i, error: d } = Es(), { execute: u, isLoading: o } = rs(), n = r ?? c, m = C(async (p) => {
2786
+ function ms({ onSelectQuery: e, onRunQuery: a, appearance: r }) {
2787
+ const { appearance: o } = L(), { queries: t, isLoading: u, error: i } = qe(), { execute: c, isLoading: d } = ie(), l = r ?? o, g = N(async (p) => {
2482
2788
  if (!p.generatedSql) return;
2483
- const b = await u({ sql: p.generatedSql });
2484
- b && (a == null || a(b));
2485
- }, [u, a]);
2486
- return /* @__PURE__ */ e(D, { appearance: n, children: /* @__PURE__ */ l("div", { className: "ss-card ss-card-wide", children: [
2487
- /* @__PURE__ */ e("h2", { className: "ss-title", children: "Saved Queries" }),
2488
- i && /* @__PURE__ */ l("div", { className: "ss-loading", children: [
2489
- /* @__PURE__ */ e("span", { className: "ss-spinner" }),
2789
+ const f = await c({ sql: p.generatedSql });
2790
+ f && (a == null || a(f));
2791
+ }, [c, a]);
2792
+ return /* @__PURE__ */ s(q, { appearance: l, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
2793
+ /* @__PURE__ */ s("h2", { className: "ss-title", children: "Saved Queries" }),
2794
+ u && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
2795
+ /* @__PURE__ */ s("span", { className: "ss-spinner" }),
2490
2796
  " Loading..."
2491
2797
  ] }),
2492
- d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
2493
- !i && t.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No saved queries." }),
2494
- !i && t.map((p) => /* @__PURE__ */ l(
2798
+ i && /* @__PURE__ */ s("div", { className: "ss-global-error", children: i }),
2799
+ !u && t.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No saved queries." }),
2800
+ !u && t.map((p) => /* @__PURE__ */ n(
2495
2801
  "div",
2496
2802
  {
2497
2803
  className: "ss-saved-query-card",
2498
- onClick: () => s == null ? void 0 : s(p),
2804
+ onClick: () => e == null ? void 0 : e(p),
2499
2805
  children: [
2500
- /* @__PURE__ */ l("div", { className: "ss-saved-query-header", children: [
2501
- /* @__PURE__ */ e("span", { className: "ss-saved-query-name", children: p.name }),
2502
- p.chartType && /* @__PURE__ */ e("span", { className: "ss-badge", children: p.chartType })
2806
+ /* @__PURE__ */ n("div", { className: "ss-saved-query-header", children: [
2807
+ /* @__PURE__ */ s("span", { className: "ss-saved-query-name", children: p.name }),
2808
+ p.chartType && /* @__PURE__ */ s("span", { className: "ss-badge", children: p.chartType })
2503
2809
  ] }),
2504
- p.naturalLanguage && /* @__PURE__ */ e("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
2505
- /* @__PURE__ */ l("div", { className: "ss-saved-query-footer", children: [
2506
- /* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: Ds(p.createdAt) }),
2507
- /* @__PURE__ */ e(
2810
+ p.naturalLanguage && /* @__PURE__ */ s("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
2811
+ /* @__PURE__ */ n("div", { className: "ss-saved-query-footer", children: [
2812
+ /* @__PURE__ */ s("span", { className: "ss-saved-query-date", children: Ve(p.createdAt) }),
2813
+ /* @__PURE__ */ s(
2508
2814
  "button",
2509
2815
  {
2510
2816
  type: "button",
2511
2817
  className: "ss-btn ss-btn-sm ss-btn-primary",
2512
- disabled: o || !p.generatedSql,
2513
- onClick: (b) => {
2514
- b.stopPropagation(), m(p);
2818
+ disabled: d || !p.generatedSql,
2819
+ onClick: (f) => {
2820
+ f.stopPropagation(), g(p);
2515
2821
  },
2516
- children: o ? /* @__PURE__ */ e("span", { className: "ss-spinner" }) : "Run"
2822
+ children: d ? /* @__PURE__ */ s("span", { className: "ss-spinner" }) : "Run"
2517
2823
  }
2518
2824
  )
2519
2825
  ] })
@@ -2523,105 +2829,106 @@ function re({ onSelectQuery: s, onRunQuery: a, appearance: r }) {
2523
2829
  ))
2524
2830
  ] }) });
2525
2831
  }
2526
- function ae({ embedToken: s, dashboardId: a, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: c, appearance: t }) {
2527
- const i = q(() => {
2528
- const y = new H(r, { type: "embedToken", token: s });
2529
- return new J(y);
2530
- }, [s, r]), [d, u] = h([]), [o, n] = h(!0), [m, p] = h(null), b = q(() => V(t), [t]), f = q(() => G(b), [b]), x = C(async () => {
2531
- n(!0), p(null);
2832
+ function gs({ embedToken: e, dashboardId: a, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: o, appearance: t }) {
2833
+ const u = _(() => {
2834
+ const v = new J(r, { type: "embedToken", token: e });
2835
+ return new K(v);
2836
+ }, [e, r]), [i, c] = m([]), [d, l] = m(!0), [g, p] = m(null), f = _(() => Z(t), [t]), b = _(() => X(f), [f]), k = N(async () => {
2837
+ l(!0), p(null);
2532
2838
  try {
2533
- const y = await i.getDashboard(a), w = JSON.parse(y.layoutJson || "[]"), v = await Promise.all(
2534
- w.map(async (g) => {
2839
+ const v = await u.getDashboard(a), C = JSON.parse(v.layoutJson || "[]"), x = await Promise.all(
2840
+ C.map(async (h) => {
2535
2841
  try {
2536
- const N = await i.listQueries({ search: g.queryId, perPage: 1 });
2537
- if (N.data.length > 0 && N.data[0].generatedSql) {
2538
- const S = await i.executeQuery({ sql: N.data[0].generatedSql });
2539
- return { ...g, result: S };
2842
+ const S = await u.listQueries({ search: h.queryId, perPage: 1 });
2843
+ if (S.data.length > 0 && S.data[0].generatedSql) {
2844
+ const z = await u.executeQuery({ sql: S.data[0].generatedSql });
2845
+ return { ...h, result: z };
2540
2846
  }
2541
2847
  } catch {
2542
2848
  }
2543
- return g;
2849
+ return h;
2544
2850
  })
2545
2851
  );
2546
- u(v);
2547
- } catch (y) {
2548
- p(y instanceof Error ? y.message : "Failed to load dashboard");
2852
+ c(x);
2853
+ } catch (v) {
2854
+ p(v instanceof Error ? v.message : "Failed to load dashboard");
2549
2855
  } finally {
2550
- n(!1);
2551
- }
2552
- }, [i, a]);
2553
- return B(() => {
2554
- x();
2555
- }, [x]), B(() => {
2556
- if (!c || c <= 0) return;
2557
- const y = setInterval(x, c * 1e3);
2558
- return () => clearInterval(y);
2559
- }, [c, x]), /* @__PURE__ */ e(
2856
+ l(!1);
2857
+ }
2858
+ }, [u, a]);
2859
+ return U(() => {
2860
+ k();
2861
+ }, [k]), U(() => {
2862
+ if (!o || o <= 0) return;
2863
+ const v = setInterval(k, o * 1e3);
2864
+ return () => clearInterval(v);
2865
+ }, [o, k]), /* @__PURE__ */ s(
2560
2866
  "div",
2561
2867
  {
2562
- ref: (y) => {
2563
- if (!y || y.shadowRoot) return;
2564
- const w = y.attachShadow({ mode: "open" }), v = document.createElement("style");
2565
- v.textContent = f, w.appendChild(v);
2566
- const g = document.createElement("div");
2567
- w.appendChild(g);
2868
+ ref: (v) => {
2869
+ if (!v || v.shadowRoot) return;
2870
+ const C = v.attachShadow({ mode: "open" }), x = document.createElement("style");
2871
+ x.textContent = b, C.appendChild(x);
2872
+ const h = document.createElement("div");
2873
+ C.appendChild(h);
2568
2874
  },
2569
2875
  style: { display: "contents" },
2570
- children: /* @__PURE__ */ l("div", { className: "ss-dashboard-grid", children: [
2571
- o && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
2572
- m && /* @__PURE__ */ e("div", { className: "ss-global-error", children: m }),
2573
- !o && d.map((y, w) => {
2574
- if (!y.result) return null;
2575
- const { columns: v, rows: g } = y.result;
2576
- return /* @__PURE__ */ l("div", { className: "ss-widget", children: [
2577
- y.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: y.title }),
2578
- /* @__PURE__ */ l("table", { className: "ss-table", children: [
2579
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: v.map((N) => /* @__PURE__ */ e("th", { className: "ss-th", children: N }, N)) }) }),
2580
- /* @__PURE__ */ e("tbody", { children: g.slice(0, 50).map((N, S) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: v.map((k) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(N[k] ?? "") }, k)) }, S)) })
2876
+ children: /* @__PURE__ */ n("div", { className: "ss-dashboard-grid", children: [
2877
+ d && /* @__PURE__ */ s("div", { className: "ss-loading", children: "Loading dashboard..." }),
2878
+ g && /* @__PURE__ */ s("div", { className: "ss-global-error", children: g }),
2879
+ !d && i.map((v, C) => {
2880
+ if (!v.result) return null;
2881
+ const { columns: x, rows: h } = v.result;
2882
+ return /* @__PURE__ */ n("div", { className: "ss-widget", children: [
2883
+ v.title && /* @__PURE__ */ s("h4", { className: "ss-widget-header", children: v.title }),
2884
+ /* @__PURE__ */ n("table", { className: "ss-table", children: [
2885
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: x.map((S) => /* @__PURE__ */ s("th", { className: "ss-th", children: S }, S)) }) }),
2886
+ /* @__PURE__ */ s("tbody", { children: h.slice(0, 50).map((S, z) => /* @__PURE__ */ s("tr", { className: "ss-tr", children: x.map((P) => /* @__PURE__ */ s("td", { className: "ss-td", children: String(S[P] ?? "") }, P)) }, z)) })
2581
2887
  ] })
2582
- ] }, w);
2888
+ ] }, C);
2583
2889
  })
2584
2890
  ] })
2585
2891
  }
2586
2892
  );
2587
2893
  }
2588
2894
  export {
2589
- As as Chart,
2590
- Ys as CouponInput,
2591
- ee as DashboardView,
2592
- Is as DataTable,
2593
- $s as InvoiceHistory,
2594
- Vs as OrgSwitcher,
2595
- Qs as PaymentPortal,
2596
- Gs as PricingTable,
2597
- se as QueryInput,
2598
- ae as ReportEmbed,
2599
- Q as SaaSContext,
2600
- oe as SaaSError,
2601
- Rs as SaaSProvider,
2602
- os as SaaSSupport,
2603
- re as SavedQueryList,
2604
- Ws as SignIn,
2605
- Hs as SignUp,
2606
- Ns as SubscriptionStatus,
2607
- Ps as UsageDisplay,
2608
- js as UserButton,
2609
- _s as UserProfile,
2610
- ls as isMfaRequired,
2611
- Y as useAuth,
2612
- Js as useBilling,
2613
- Xs as useDashboard,
2614
- Ks as useEmbedDashboard,
2615
- xs as useInvoices,
2616
- gs as useOrg,
2617
- X as useProfile,
2618
- rs as useQuery,
2619
- Zs as useReport,
2620
- E as useSaaSContext,
2621
- Es as useSavedQueries,
2622
- Z as useSignIn,
2623
- ms as useSignUp,
2624
- ys as useSubscription,
2625
- vs as useUsage,
2626
- Os as useUser
2895
+ je as Chart,
2896
+ ls as CouponInput,
2897
+ ps as DashboardView,
2898
+ Re as DataTable,
2899
+ Fe as InvoiceHistory,
2900
+ as as OrgSwitcher,
2901
+ os as PaymentPortal,
2902
+ ts as PricingTable,
2903
+ us as QueryInput,
2904
+ gs as ReportEmbed,
2905
+ se as SaaSContext,
2906
+ bs as SaaSError,
2907
+ Ze as SaaSProvider,
2908
+ fe as SaaSSupport,
2909
+ ms as SavedQueryList,
2910
+ Ke as SignIn,
2911
+ es as SignUp,
2912
+ Be as SubscriptionStatus,
2913
+ Ue as UsageDisplay,
2914
+ ss as UserButton,
2915
+ rs as UserProfile,
2916
+ be as isMfaRequired,
2917
+ ee as useAuth,
2918
+ ns as useBilling,
2919
+ cs as useDashboard,
2920
+ ke as useDeleteAccount,
2921
+ ds as useEmbedDashboard,
2922
+ Ie as useInvoices,
2923
+ ae as useOrg,
2924
+ te as useProfile,
2925
+ ie as useQuery,
2926
+ is as useReport,
2927
+ L as useSaaSContext,
2928
+ qe as useSavedQueries,
2929
+ re as useSignIn,
2930
+ Ce as useSignUp,
2931
+ ze as useSubscription,
2932
+ Te as useUsage,
2933
+ Xe as useUser
2627
2934
  };